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 | /* |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Kiet Lam | 0fb93dd | 2014-02-19 00:32:59 -0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 29 | |
| 30 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 31 | /** ------------------------------------------------------------------------- * |
| 32 | ------------------------------------------------------------------------- * |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 33 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 34 | |
| 35 | \file csrApiRoam.c |
| 36 | |
| 37 | Implementation for the Common Roaming interfaces. |
| 38 | |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 39 | Copyright (C) 2008 Qualcomm, Incorporated |
| 40 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | |
| 42 | ========================================================================== */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | /*=========================================================================== |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 44 | EDIT HISTORY FOR FILE |
| 45 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 46 | This section contains comments describing changes made to the module. |
| 47 | Notice that changes are listed in reverse chronological order. |
| 48 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 49 | when who what, where, why |
| 50 | ---------- --- -------------------------------------------------------- |
| 51 | 06/03/10 js Added support to hostapd driven |
| 52 | * deauth/disassoc/mic failure |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 53 | ===========================================================================*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 54 | #include "aniGlobal.h" //for tpAniSirGlobal |
| 55 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 56 | #include "halMsgApi.h" //for HAL_STA_INVALID_IDX. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 57 | #include "limUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | #include "palApi.h" |
| 59 | #include "csrInsideApi.h" |
| 60 | #include "smsDebug.h" |
| 61 | #include "logDump.h" |
| 62 | #include "smeQosInternal.h" |
| 63 | #include "wlan_qct_tl.h" |
| 64 | #include "smeInside.h" |
| 65 | #include "vos_diag_core_event.h" |
| 66 | #include "vos_diag_core_log.h" |
| 67 | #include "csrApi.h" |
| 68 | #include "pmc.h" |
| 69 | #include "vos_nvitem.h" |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 70 | #include "macTrace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 71 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 72 | #include "csrNeighborRoam.h" |
| 73 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 74 | #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) |
| 75 | #include "csrEse.h" |
| 76 | #endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */ |
Mukul Sharma | be91e2f | 2014-06-29 22:09:20 +0530 | [diff] [blame] | 77 | #ifdef DEBUG_ROAM_DELAY |
| 78 | #include "vos_utils.h" |
| 79 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 80 | #define CSR_NUM_IBSS_START_CHANNELS_50 4 |
| 81 | #define CSR_NUM_IBSS_START_CHANNELS_24 3 |
| 82 | #define CSR_DEF_IBSS_START_CHANNEL_50 36 |
| 83 | #define CSR_DEF_IBSS_START_CHANNEL_24 1 |
Srikant Kuppa | 2062aaf | 2012-12-27 17:36:41 -0800 | [diff] [blame] | 84 | #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] | 85 | #define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD ( 120 * PAL_TIMER_TO_SEC_UNIT ) // 120 seconds, for WPS |
| 86 | /*--------------------------------------------------------------------------- |
| 87 | OBIWAN recommends [8 10]% : pick 9% |
| 88 | ---------------------------------------------------------------------------*/ |
| 89 | #define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 90 | /*--------------------------------------------------------------------------- |
| 91 | OBIWAN recommends -85dBm |
| 92 | ---------------------------------------------------------------------------*/ |
| 93 | #define CSR_VCC_RSSI_THRESHOLD 80 |
| 94 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD 500 //ms |
| 95 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 //ms |
| 96 | #define CSR_MIN_TL_STAT_QUERY_PERIOD 500 //ms |
| 97 | #define CSR_DIAG_LOG_STAT_PERIOD 3000 //ms |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 98 | //We use constatnt 4 here |
| 99 | //This macro returns true when higher AC parameter is bigger than lower AC for a difference |
| 100 | //The bigger the number, the less chance of TX |
| 101 | //It must put lower AC as the first parameter. |
| 102 | #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] | 103 | //Flag to send/do not send disassoc frame over the air |
| 104 | #define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | #define RSSI_HACK_BMPS (-40) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 106 | #define MAX_CB_VALUE_IN_INI (2) |
| 107 | |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 108 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 109 | static tANI_BOOLEAN bRoamScanOffloadStarted = VOS_FALSE; |
| 110 | #endif |
| 111 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 112 | /*-------------------------------------------------------------------------- |
| 113 | Static Type declarations |
| 114 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 115 | static tCsrRoamSession csrRoamRoamSession[CSR_ROAM_SESSION_MAX]; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 116 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 117 | /*-------------------------------------------------------------------------- |
| 118 | Type declarations |
| 119 | ------------------------------------------------------------------------*/ |
| 120 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 121 | int diagAuthTypeFromCSRType(eCsrAuthType authType) |
| 122 | { |
| 123 | int n = AUTH_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 124 | switch(authType) |
| 125 | { |
| 126 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 127 | n = AUTH_SHARED; |
| 128 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 129 | case eCSR_AUTH_TYPE_WPA: |
| 130 | n = AUTH_WPA_EAP; |
| 131 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 132 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 133 | n = AUTH_WPA_PSK; |
| 134 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 135 | case eCSR_AUTH_TYPE_RSN: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 136 | #ifdef WLAN_FEATURE_11W |
| 137 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 138 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 139 | n = AUTH_WPA2_EAP; |
| 140 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 141 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 142 | #ifdef WLAN_FEATURE_11W |
| 143 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 144 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 145 | n = AUTH_WPA2_PSK; |
| 146 | break; |
| 147 | #ifdef FEATURE_WLAN_WAPI |
| 148 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 149 | n = AUTH_WAPI_CERT; |
| 150 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 151 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 152 | n = AUTH_WAPI_PSK; |
| 153 | break; |
| 154 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 155 | default: |
| 156 | break; |
| 157 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 158 | return (n); |
| 159 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 160 | int diagEncTypeFromCSRType(eCsrEncryptionType encType) |
| 161 | { |
| 162 | int n = ENC_MODE_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 163 | switch(encType) |
| 164 | { |
| 165 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 166 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 167 | n = ENC_MODE_WEP40; |
| 168 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 169 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 170 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 171 | n = ENC_MODE_WEP104; |
| 172 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 173 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 174 | n = ENC_MODE_TKIP; |
| 175 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 176 | case eCSR_ENCRYPT_TYPE_AES: |
| 177 | n = ENC_MODE_AES; |
| 178 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 179 | #ifdef FEATURE_WLAN_WAPI |
| 180 | case eCSR_ENCRYPT_TYPE_WPI: |
| 181 | n = ENC_MODE_SMS4; |
| 182 | break; |
| 183 | #endif /* FEATURE_WLAN_WAPI */ |
| 184 | default: |
| 185 | break; |
| 186 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | return (n); |
| 188 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 189 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40, 44, 48}; |
| 191 | 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] | 192 | static void initConfigParam(tpAniSirGlobal pMac); |
| 193 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 194 | eCsrRoamCompleteResult Result, void *Context ); |
| 195 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 196 | tCsrRoamProfile *pProfile, |
| 197 | tANI_BOOLEAN *pfSameIbss ); |
| 198 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss ); |
| 199 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 200 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes); |
| 201 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 202 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac); |
| 203 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ); |
| 204 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac); |
| 205 | eHalStatus csrRoamClose(tpAniSirGlobal pMac); |
| 206 | void csrRoamMICErrorTimerHandler(void *pv); |
| 207 | void csrRoamTKIPCounterMeasureTimerHandler(void *pv); |
| 208 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2); |
| 209 | |
| 210 | static eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 211 | static eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 212 | static void csrRoamRoamingTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 213 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval); |
| 214 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac); |
| 215 | static void csrRoamWaitForKeyTimeOutHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 216 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 217 | static eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 218 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ); |
| 219 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 220 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 221 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 222 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 223 | tANI_U8 *pKeyRsc ); |
| 224 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 225 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, |
| 226 | tCsrRoamProfile *pProfile ); |
| 227 | void csrRoamStatisticsTimerHandler(void *pv); |
| 228 | void csrRoamStatsGlobalClassDTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 229 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid); |
| 230 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 231 | v_U8_t rssiNotification, |
| 232 | void * context); |
| 233 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 234 | void csrRoamVccTrigger(tpAniSirGlobal pMac); |
| 235 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId); |
| 236 | /* |
| 237 | pStaEntry is no longer invalid upon the return of this function. |
| 238 | */ |
| 239 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 240 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 241 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 242 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 243 | tDblLinkList *pStaList, |
| 244 | tCsrStatsClientReqInfo *pStaEntry); |
| 245 | void csrRoamStatsClientTimerHandler(void *pv); |
| 246 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 247 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId); |
| 248 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 249 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 250 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 251 | void csrRoamTlStatsTimerHandler(void *pv); |
| 252 | void csrRoamPeStatsTimerHandler(void *pv); |
| 253 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 254 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry); |
| 255 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 256 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac); |
| 257 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ); |
| 258 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ); |
| 259 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ); |
| 260 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 261 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ); |
| 262 | //static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ); |
| 263 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
| 264 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac); |
| 265 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 266 | void csrRoamJoinRetryTimerHandler(void *pv); |
| 267 | #endif |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 268 | void limInitOperatingClasses( tHalHandle hHal ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 269 | extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 270 | extern void btampEstablishLogLinkHdlr(void* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 271 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 272 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 273 | |
| 274 | //Initialize global variables |
| 275 | static void csrRoamInitGlobals(tpAniSirGlobal pMac) |
| 276 | { |
| 277 | if(pMac) |
| 278 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 279 | vos_mem_zero(&csrRoamRoamSession, sizeof(csrRoamRoamSession)); |
| 280 | pMac->roam.roamSession = csrRoamRoamSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 281 | } |
| 282 | return; |
| 283 | } |
| 284 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 285 | static void csrRoamDeInitGlobals(tpAniSirGlobal pMac) |
| 286 | { |
| 287 | if(pMac) |
| 288 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 289 | pMac->roam.roamSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 290 | } |
| 291 | return; |
| 292 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | eHalStatus csrOpen(tpAniSirGlobal pMac) |
| 294 | { |
| 295 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 296 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 297 | static uNvTables nvTables; |
| 298 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 299 | v_REGDOMAIN_t regId; |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 300 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 301 | tANI_U32 i; |
| 302 | |
| 303 | do |
| 304 | { |
| 305 | /* Initialize CSR Roam Globals */ |
| 306 | csrRoamInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 307 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 308 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i); |
| 309 | |
| 310 | initConfigParam(pMac); |
| 311 | if(!HAL_STATUS_SUCCESS((status = csrScanOpen(pMac)))) |
| 312 | break; |
| 313 | if(!HAL_STATUS_SUCCESS((status = csrRoamOpen(pMac)))) |
| 314 | break; |
| 315 | pMac->roam.nextRoamId = 1; //Must not be 0 |
| 316 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.statsClientReqList))) |
| 317 | break; |
| 318 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.peStatsReqList))) |
| 319 | break; |
| 320 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList))) |
| 321 | break; |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 322 | |
| 323 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 324 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 325 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 326 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 327 | vos_mem_copy(pMac->scan.countryCodeDefault, nvTables.defaultCountryTable.countryCode, |
| 328 | WNI_CFG_COUNTRY_CODE_LEN); |
| 329 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 330 | } |
| 331 | else |
| 332 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 333 | smsLog( pMac, LOGE, FL(" fail to get NV_FIELD_IMAGE") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 334 | //hardcoded for now |
| 335 | pMac->scan.countryCodeDefault[0] = 'U'; |
| 336 | pMac->scan.countryCodeDefault[1] = 'S'; |
| 337 | pMac->scan.countryCodeDefault[2] = 'I'; |
| 338 | //status = eHAL_STATUS_SUCCESS; |
| 339 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 340 | smsLog( pMac, LOG1, FL(" country Code from nvRam %.2s"), pMac->scan.countryCodeDefault ); |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 341 | |
| 342 | if (!('0' == pMac->scan.countryCodeDefault[0] && |
| 343 | '0' == pMac->scan.countryCodeDefault[1])) |
| 344 | { |
| 345 | csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, |
| 346 | ®Id, COUNTRY_NV); |
| 347 | } |
| 348 | else |
| 349 | { |
| 350 | regId = REGDOMAIN_WORLD; |
| 351 | } |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 352 | WDA_SetRegDomain(pMac, regId, eSIR_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 353 | pMac->scan.domainIdDefault = regId; |
| 354 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 355 | vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault, |
| 356 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 357 | status = csrInitGetChannels( pMac ); |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 358 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | }while(0); |
Mahesh A Saptasagar | 74289d2 | 2014-05-14 12:43:37 +0530 | [diff] [blame] | 360 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 361 | return (status); |
| 362 | } |
| 363 | |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 364 | /* -------------------------------------------------------------------------- |
| 365 | \fn csrInitChannels |
| 366 | \brief This function must be called to initialize CSR channel lists |
| 367 | \return eHalStatus |
| 368 | ----------------------------------------------------------------------------*/ |
| 369 | eHalStatus csrInitChannels(tpAniSirGlobal pMac) |
| 370 | { |
| 371 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 372 | static uNvTables nvTables; |
| 373 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 74289d2 | 2014-05-14 12:43:37 +0530 | [diff] [blame] | 374 | v_REGDOMAIN_t regId = REGDOMAIN_WORLD; |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 375 | |
| 376 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 377 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 378 | { |
| 379 | vos_mem_copy(pMac->scan.countryCodeDefault, |
| 380 | nvTables.defaultCountryTable.countryCode, |
| 381 | WNI_CFG_COUNTRY_CODE_LEN); |
| 382 | } |
| 383 | else |
| 384 | { |
| 385 | smsLog( pMac, LOGE, FL(" fail to get NV_FIELD_IMAGE") ); |
| 386 | //hardcoded for now |
| 387 | pMac->scan.countryCodeDefault[0] = 'U'; |
| 388 | pMac->scan.countryCodeDefault[1] = 'S'; |
| 389 | pMac->scan.countryCodeDefault[2] = 'I'; |
| 390 | } |
| 391 | smsLog( pMac, LOG1, FL(" country Code from nvRam %.2s"), pMac->scan.countryCodeDefault ); |
| 392 | |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 393 | WDA_SetRegDomain(pMac, regId, eSIR_TRUE); |
| 394 | pMac->scan.domainIdDefault = regId; |
| 395 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
| 396 | vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault, |
| 397 | WNI_CFG_COUNTRY_CODE_LEN); |
Agrawal Ashish | 0b6984f | 2014-04-05 18:35:45 +0530 | [diff] [blame] | 398 | vos_mem_copy(pMac->scan.countryCodeElected, pMac->scan.countryCodeDefault, |
| 399 | WNI_CFG_COUNTRY_CODE_LEN); |
Agarwal Ashish | cd9b8e6 | 2014-07-21 19:48:24 +0530 | [diff] [blame] | 400 | vos_mem_copy(pMac->scan.countryCode11d, pMac->scan.countryCodeDefault, |
| 401 | WNI_CFG_COUNTRY_CODE_LEN); |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 402 | status = csrInitGetChannels( pMac ); |
Agrawal Ashish | 0b6984f | 2014-04-05 18:35:45 +0530 | [diff] [blame] | 403 | csrClearVotesForCountryInfo(pMac); |
Mihir Shete | e1093ba | 2014-01-21 20:13:32 +0530 | [diff] [blame] | 404 | |
| 405 | return status; |
| 406 | } |
| 407 | |
Mihir Shete | 0420645 | 2014-11-20 17:50:58 +0530 | [diff] [blame] | 408 | #ifdef CONFIG_ENABLE_LINUX_REG |
Agarwal Ashish | 6db9d53 | 2014-09-30 18:19:10 +0530 | [diff] [blame] | 409 | eHalStatus csrInitChannelsForCC(tpAniSirGlobal pMac, driver_load_type init) |
Mahesh A Saptasagar | 74289d2 | 2014-05-14 12:43:37 +0530 | [diff] [blame] | 410 | { |
| 411 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 412 | v_REGDOMAIN_t regId = REGDOMAIN_WORLD; |
Agarwal Ashish | 6db9d53 | 2014-09-30 18:19:10 +0530 | [diff] [blame] | 413 | tANI_U8 cc[WNI_CFG_COUNTRY_CODE_LEN]; |
Mahesh A Saptasagar | 74289d2 | 2014-05-14 12:43:37 +0530 | [diff] [blame] | 414 | |
Agarwal Ashish | 6db9d53 | 2014-09-30 18:19:10 +0530 | [diff] [blame] | 415 | /* In case of driver load ; driver need to get channel |
| 416 | * list with default Countrycode. |
| 417 | * In case of SSR; driver need to get channel list |
| 418 | * with old country code. 0 is for init and |
| 419 | * 1 is for reinit |
| 420 | */ |
| 421 | switch (init) |
Mahesh A Saptasagar | 74289d2 | 2014-05-14 12:43:37 +0530 | [diff] [blame] | 422 | { |
Agarwal Ashish | 6db9d53 | 2014-09-30 18:19:10 +0530 | [diff] [blame] | 423 | case INIT: |
| 424 | vos_mem_copy(cc, pMac->scan.countryCodeDefault, |
| 425 | WNI_CFG_COUNTRY_CODE_LEN); |
| 426 | if (!('0' == cc[0] && |
| 427 | '0' == cc[1])) |
| 428 | { |
| 429 | csrGetRegulatoryDomainForCountry(pMac, cc, |
| 430 | ®Id, COUNTRY_NV); |
| 431 | } |
| 432 | else |
| 433 | { |
| 434 | return status; |
| 435 | } |
| 436 | pMac->scan.domainIdDefault = regId; |
| 437 | break; |
| 438 | case REINIT: |
| 439 | vos_getCurrentCountryCode(&cc[0]); |
| 440 | status = csrGetRegulatoryDomainForCountry(pMac, |
| 441 | cc, ®Id, COUNTRY_QUERY); |
| 442 | break; |
Mahesh A Saptasagar | 74289d2 | 2014-05-14 12:43:37 +0530 | [diff] [blame] | 443 | } |
| 444 | WDA_SetRegDomain(pMac, regId, eSIR_TRUE); |
Agarwal Ashish | 6db9d53 | 2014-09-30 18:19:10 +0530 | [diff] [blame] | 445 | pMac->scan.domainIdCurrent = regId; |
| 446 | vos_mem_copy(pMac->scan.countryCodeCurrent, cc, |
Mahesh A Saptasagar | 74289d2 | 2014-05-14 12:43:37 +0530 | [diff] [blame] | 447 | WNI_CFG_COUNTRY_CODE_LEN); |
| 448 | status = csrInitGetChannels( pMac ); |
Agarwal Ashish | f3298ac | 2014-07-26 19:34:17 +0530 | [diff] [blame] | 449 | |
Agarwal Ashish | 6db9d53 | 2014-09-30 18:19:10 +0530 | [diff] [blame] | 450 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 451 | FL("Current Country is %c%c "), pMac->scan.countryCodeCurrent[0], |
| 452 | pMac->scan.countryCodeCurrent[1]); |
| 453 | |
Agarwal Ashish | f3298ac | 2014-07-26 19:34:17 +0530 | [diff] [blame] | 454 | /* reset info based on new cc, and we are done */ |
| 455 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE); |
| 456 | csrScanFilterResults(pMac); |
| 457 | |
Mahesh A Saptasagar | 74289d2 | 2014-05-14 12:43:37 +0530 | [diff] [blame] | 458 | return status; |
| 459 | } |
Mihir Shete | 0420645 | 2014-11-20 17:50:58 +0530 | [diff] [blame] | 460 | #endif |
Mahesh A Saptasagar | 74289d2 | 2014-05-14 12:43:37 +0530 | [diff] [blame] | 461 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 462 | eHalStatus csrSetRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode) |
| 463 | { |
| 464 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 465 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 466 | v_REGDOMAIN_t regId; |
| 467 | v_U8_t cntryCodeLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 468 | if(NULL == apCntryCode) |
| 469 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 470 | smsLog( pMac, LOGE, FL(" Invalid country Code Pointer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 471 | return eHAL_STATUS_FAILURE; |
| 472 | } |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 473 | smsLog( pMac, LOG1, FL(" country Code %.2s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 474 | /* To get correct Regulatory domain from NV table |
| 475 | * 2 character Country code should be used |
| 476 | * 3rd charater is optional for indoor/outdoor setting */ |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 477 | cntryCodeLength = WNI_CFG_COUNTRY_CODE_LEN; |
| 478 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 479 | cntryCodeLength = strlen(apCntryCode); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 480 | |
| 481 | if (cntryCodeLength > WNI_CFG_COUNTRY_CODE_LEN) |
| 482 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 483 | smsLog( pMac, LOGW, FL(" Invalid Country Code Length") ); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 484 | return eHAL_STATUS_FAILURE; |
| 485 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 486 | */ |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 487 | status = csrGetRegulatoryDomainForCountry(pMac, apCntryCode, ®Id, |
| 488 | COUNTRY_USER); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 489 | if (status != eHAL_STATUS_SUCCESS) |
| 490 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 491 | 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] | 492 | return status; |
| 493 | } |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 494 | status = WDA_SetRegDomain(hHal, regId, eSIR_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 495 | if (status != eHAL_STATUS_SUCCESS) |
| 496 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 497 | 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] | 498 | return status; |
| 499 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 500 | pMac->scan.domainIdDefault = regId; |
| 501 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 502 | /* Clear CC field */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 503 | vos_mem_set(pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN, 0); |
| 504 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 505 | /* Copy 2 or 3 bytes country code */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 506 | vos_mem_copy(pMac->scan.countryCodeDefault, apCntryCode, cntryCodeLength); |
| 507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | /* If 2 bytes country code, 3rd byte must be filled with space */ |
| 509 | if((WNI_CFG_COUNTRY_CODE_LEN - 1) == cntryCodeLength) |
| 510 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 511 | vos_mem_set(pMac->scan.countryCodeDefault + 2, 1, 0x20); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 512 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 513 | vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault, |
| 514 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 515 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 516 | return status; |
| 517 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 518 | eHalStatus csrSetChannels(tHalHandle hHal, tCsrConfigParam *pParam ) |
| 519 | { |
| 520 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 521 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 522 | tANI_U8 index = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 523 | vos_mem_copy(pParam->Csr11dinfo.countryCode, pMac->scan.countryCodeCurrent, |
| 524 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 525 | for ( index = 0; index < pMac->scan.base20MHzChannels.numChannels ; index++) |
| 526 | { |
| 527 | pParam->Csr11dinfo.Channels.channelList[index] = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 528 | pParam->Csr11dinfo.ChnPower[index].firstChannel = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 529 | pParam->Csr11dinfo.ChnPower[index].numChannels = 1; |
| 530 | pParam->Csr11dinfo.ChnPower[index].maxtxPower = pMac->scan.defaultPowerTable[index].pwr; |
| 531 | } |
| 532 | pParam->Csr11dinfo.Channels.numChannels = pMac->scan.base20MHzChannels.numChannels; |
| 533 | |
| 534 | return status; |
| 535 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 536 | eHalStatus csrClose(tpAniSirGlobal pMac) |
| 537 | { |
| 538 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 539 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 540 | csrRoamClose(pMac); |
| 541 | csrScanClose(pMac); |
| 542 | csrLLClose(&pMac->roam.statsClientReqList); |
| 543 | csrLLClose(&pMac->roam.peStatsReqList); |
| 544 | csrLLClose(&pMac->roam.roamCmdPendingList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 545 | /* DeInit Globals */ |
| 546 | csrRoamDeInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 547 | return (status); |
| 548 | } |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 549 | |
Leela Venkata Kiran Kumar Reddy Chirala | c6663f7 | 2014-02-03 21:04:58 -0800 | [diff] [blame] | 550 | eHalStatus csrUpdateChannelList(tpAniSirGlobal pMac) |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 551 | { |
| 552 | tSirUpdateChanList *pChanList; |
Leela Venkata Kiran Kumar Reddy Chirala | c6663f7 | 2014-02-03 21:04:58 -0800 | [diff] [blame] | 553 | tCsrScanStruct *pScan = &pMac->scan; |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 554 | tANI_U32 numChan = 0; |
| 555 | tANI_U32 bufLen ; |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 556 | vos_msg_t msg; |
| 557 | tANI_U8 i; |
| 558 | |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 559 | limInitOperatingClasses((tHalHandle)pMac); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 560 | numChan = sizeof(pMac->roam.validChannelList); |
| 561 | |
| 562 | if ( !HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, |
| 563 | (tANI_U8 *)pMac->roam.validChannelList, &numChan))) |
| 564 | { |
| 565 | smsLog( pMac, LOGE, "Failed to get Channel list from CFG"); |
| 566 | return eHAL_STATUS_FAILED_ALLOC; |
| 567 | } |
| 568 | |
| 569 | bufLen = sizeof(tSirUpdateChanList) + |
| 570 | (sizeof(tSirUpdateChanParam) * (numChan - 1)); |
| 571 | |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 572 | pChanList = (tSirUpdateChanList *) vos_mem_malloc(bufLen); |
| 573 | if (!pChanList) |
| 574 | { |
| 575 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 576 | "Failed to allocate memory for tSirUpdateChanList"); |
| 577 | return eHAL_STATUS_FAILED_ALLOC; |
| 578 | } |
| 579 | |
| 580 | msg.type = WDA_UPDATE_CHAN_LIST_REQ; |
| 581 | msg.reserved = 0; |
| 582 | msg.bodyptr = pChanList; |
| 583 | pChanList->numChan = numChan; |
| 584 | for (i = 0; i < pChanList->numChan; i++) |
| 585 | { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 586 | pChanList->chanParam[i].chanId = pMac->roam.validChannelList[i]; |
Leela Venkata Kiran Kumar Reddy Chirala | c6663f7 | 2014-02-03 21:04:58 -0800 | [diff] [blame] | 587 | pChanList->chanParam[i].pwr = cfgGetRegulatoryMaxTransmitPower(pMac, |
| 588 | pScan->defaultPowerTable[i].chanId); |
| 589 | if (vos_nv_getChannelEnabledState(pChanList->chanParam[i].chanId) == |
| 590 | NV_CHANNEL_DFS) |
| 591 | pChanList->chanParam[i].dfsSet = VOS_TRUE; |
| 592 | else |
| 593 | pChanList->chanParam[i].dfsSet = VOS_FALSE; |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 594 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 595 | "%s Supported Channel: %d\n", __func__, pChanList->chanParam[i].chanId); |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 599 | { |
| 600 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
| 601 | "%s: Failed to post msg to WDA", __func__); |
| 602 | vos_mem_free(pChanList); |
| 603 | return eHAL_STATUS_FAILURE; |
| 604 | } |
| 605 | |
| 606 | return eHAL_STATUS_SUCCESS; |
| 607 | } |
| 608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 609 | eHalStatus csrStart(tpAniSirGlobal pMac) |
| 610 | { |
| 611 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 612 | tANI_U32 i; |
| 613 | |
| 614 | do |
| 615 | { |
| 616 | //save the global vos context |
| 617 | pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 618 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 619 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i ); |
| 620 | |
| 621 | status = csrRoamStart(pMac); |
| 622 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 623 | pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE; |
| 624 | status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac); |
| 625 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 626 | pMac->roam.sPendingCommands = 0; |
| 627 | csrScanEnable(pMac); |
| 628 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 629 | status = csrNeighborRoamInit(pMac); |
| 630 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 631 | pMac->roam.tlStatsReqInfo.numClient = 0; |
| 632 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 633 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 634 | //init the link quality indication also |
| 635 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND; |
| 636 | if(!HAL_STATUS_SUCCESS(status)) |
| 637 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 638 | smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 639 | break; |
| 640 | } |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 641 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 642 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 643 | #if defined(ANI_LOGDUMP) |
| 644 | csrDumpInit(pMac); |
| 645 | #endif //#if defined(ANI_LOGDUMP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 646 | return (status); |
| 647 | } |
| 648 | |
Kiet Lam | a72a232 | 2013-11-15 11:18:11 +0530 | [diff] [blame] | 649 | eHalStatus csrStop(tpAniSirGlobal pMac, tHalStopType stopType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 650 | { |
| 651 | tANI_U32 sessionId; |
| 652 | tANI_U32 i; |
| 653 | |
| 654 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 655 | { |
| 656 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 657 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 658 | csrScanDisable(pMac); |
| 659 | pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE; |
| 660 | pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 661 | csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE ); |
| 662 | |
| 663 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 664 | csrNeighborRoamClose(pMac); |
| 665 | #endif |
| 666 | csrScanFlushResult(pMac); //Do we want to do this? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 667 | // deregister from PMC since we register during csrStart() |
| 668 | // (ignore status since there is nothing we can do if it fails) |
| 669 | (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 670 | //Reset the domain back to the deault |
| 671 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 672 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 673 | |
| 674 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 675 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 676 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 677 | pMac->roam.curSubState[i] = eCSR_ROAM_SUBSTATE_NONE; |
| 678 | } |
| 679 | |
Kiet Lam | a72a232 | 2013-11-15 11:18:11 +0530 | [diff] [blame] | 680 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 681 | /* When HAL resets all the context information |
| 682 | * in HAL is lost, so we might need to send the |
| 683 | * scan offload request again when it comes |
| 684 | * out of reset for scan offload to be functional |
| 685 | */ |
| 686 | if (HAL_STOP_TYPE_SYS_RESET == stopType) |
| 687 | { |
| 688 | bRoamScanOffloadStarted = VOS_FALSE; |
| 689 | } |
| 690 | #endif |
| 691 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 692 | return (eHAL_STATUS_SUCCESS); |
| 693 | } |
| 694 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 695 | eHalStatus csrReady(tpAniSirGlobal pMac) |
| 696 | { |
| 697 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 698 | csrScanGetSupportedChannels( pMac ); |
| 699 | //WNI_CFG_VALID_CHANNEL_LIST should be set by this time |
| 700 | //use it to init the background scan list |
| 701 | csrInitBGScanChannelList(pMac); |
| 702 | /* HDD issues the init scan */ |
| 703 | csrScanStartResultAgingTimer(pMac); |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 704 | /* If the gScanAgingTime is set to '0' then scan results aging timeout |
| 705 | based on timer feature is not enabled*/ |
| 706 | if(0 != pMac->scan.scanResultCfgAgingTime ) |
| 707 | { |
| 708 | csrScanStartResultCfgAgingTimer(pMac); |
| 709 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 710 | //Store the AC weights in TL for later use |
| 711 | WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 712 | status = csrInitChannelList( pMac ); |
| 713 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 714 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 715 | smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 716 | status ); |
| 717 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 718 | return (status); |
| 719 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 720 | void csrSetDefaultDot11Mode( tpAniSirGlobal pMac ) |
| 721 | { |
| 722 | v_U32_t wniDot11mode = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 723 | wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode); |
| 724 | ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE); |
| 725 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 726 | void csrSetGlobalCfgs( tpAniSirGlobal pMac ) |
| 727 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 728 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 729 | ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 730 | ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 731 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 732 | ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), |
| 733 | NULL, eANI_BOOLEAN_FALSE); |
| 734 | 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] | 735 | /* 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 |
| 736 | * Once session is established we will use the session related params stored in PE session for CB mode |
| 737 | */ |
| 738 | 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] | 739 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE); |
| 740 | |
| 741 | //Update the operating mode to configured value during initialization, |
| 742 | //So that client can advertise full capabilities in Probe request frame. |
| 743 | csrSetDefaultDot11Mode( pMac ); |
| 744 | } |
| 745 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 746 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac) |
| 747 | { |
| 748 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 749 | tANI_U32 i; |
| 750 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 751 | do |
| 752 | { |
| 753 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 754 | { |
| 755 | pSession = CSR_GET_SESSION( pMac, i ); |
| 756 | pSession->roamingTimerInfo.pMac = pMac; |
| 757 | pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 758 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 759 | pMac->roam.WaitForKeyTimerInfo.pMac = pMac; |
| 760 | pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 761 | status = vos_timer_init(&pMac->roam.hTimerWaitForKey, VOS_TIMER_TYPE_SW, |
| 762 | csrRoamWaitForKeyTimeOutHandler, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 763 | &pMac->roam.WaitForKeyTimerInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 764 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 765 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 766 | smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 767 | break; |
| 768 | } |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 769 | status = vos_timer_init(&pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 770 | VOS_TIMER_TYPE_SW, csrRoamTlStatsTimerHandler, pMac); |
| 771 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 772 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 773 | smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 774 | return eHAL_STATUS_FAILURE; |
| 775 | } |
| 776 | }while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 777 | return (status); |
| 778 | } |
| 779 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 780 | eHalStatus csrRoamClose(tpAniSirGlobal pMac) |
| 781 | { |
| 782 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 783 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 784 | { |
| 785 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 786 | } |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 787 | vos_timer_stop(&pMac->roam.hTimerWaitForKey); |
| 788 | vos_timer_destroy(&pMac->roam.hTimerWaitForKey); |
| 789 | vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 790 | vos_timer_destroy(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 791 | return (eHAL_STATUS_SUCCESS); |
| 792 | } |
| 793 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 794 | eHalStatus csrRoamStart(tpAniSirGlobal pMac) |
| 795 | { |
| 796 | (void)pMac; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 797 | return (eHAL_STATUS_SUCCESS); |
| 798 | } |
| 799 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 800 | void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 801 | { |
| 802 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 803 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 804 | csrRoamDeregStatisticsReq(pMac); |
| 805 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 806 | eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState) |
| 807 | { |
| 808 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Srinivas Girigowda | c84c57c | 2013-02-19 17:41:56 -0800 | [diff] [blame] | 809 | if ( CSR_IS_SESSION_VALID(pMac, sessionId) && (NULL != pState) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 810 | { |
| 811 | status = eHAL_STATUS_SUCCESS; |
| 812 | *pState = pMac->roam.roamSession[sessionId].connectState; |
| 813 | } |
| 814 | return (status); |
| 815 | } |
| 816 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 817 | eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 818 | { |
| 819 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 820 | tANI_U32 size = 0; |
| 821 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 822 | |
| 823 | if(!pSession) |
| 824 | { |
| 825 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 826 | return eHAL_STATUS_FAILURE; |
| 827 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 828 | |
| 829 | if(pProfile) |
| 830 | { |
| 831 | if(pSession->pConnectBssDesc) |
| 832 | { |
| 833 | do |
| 834 | { |
| 835 | size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length); |
| 836 | if(size) |
| 837 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 838 | pProfile->pBssDesc = vos_mem_malloc(size); |
| 839 | if ( NULL != pProfile->pBssDesc ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 840 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 841 | vos_mem_copy(pProfile->pBssDesc, |
| 842 | pSession->pConnectBssDesc, size); |
| 843 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 844 | } |
| 845 | else |
| 846 | break; |
| 847 | } |
| 848 | else |
| 849 | { |
| 850 | pProfile->pBssDesc = NULL; |
| 851 | } |
| 852 | pProfile->AuthType = pSession->connectedProfile.AuthType; |
| 853 | pProfile->EncryptionType = pSession->connectedProfile.EncryptionType; |
| 854 | pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType; |
| 855 | pProfile->BSSType = pSession->connectedProfile.BSSType; |
| 856 | pProfile->operationChannel = pSession->connectedProfile.operationChannel; |
| 857 | pProfile->CBMode = pSession->connectedProfile.CBMode; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 858 | vos_mem_copy(&pProfile->bssid, &pSession->connectedProfile.bssid, |
| 859 | sizeof(tCsrBssid)); |
| 860 | vos_mem_copy(&pProfile->SSID, &pSession->connectedProfile.SSID, |
| 861 | sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 862 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 863 | if (pSession->connectedProfile.MDID.mdiePresent) |
| 864 | { |
| 865 | pProfile->MDID.mdiePresent = 1; |
| 866 | pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain; |
| 867 | } |
| 868 | else |
| 869 | { |
| 870 | pProfile->MDID.mdiePresent = 0; |
| 871 | pProfile->MDID.mobilityDomain = 0; |
| 872 | } |
| 873 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 874 | #ifdef FEATURE_WLAN_ESE |
| 875 | pProfile->isESEAssoc = pSession->connectedProfile.isESEAssoc; |
| 876 | if (csrIsAuthTypeESE(pSession->connectedProfile.AuthType)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 877 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 878 | vos_mem_copy (pProfile->eseCckmInfo.krk, |
| 879 | pSession->connectedProfile.eseCckmInfo.krk, |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 880 | CSR_KRK_KEY_LEN); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 881 | pProfile->eseCckmInfo.reassoc_req_num= |
| 882 | pSession->connectedProfile.eseCckmInfo.reassoc_req_num; |
| 883 | pProfile->eseCckmInfo.krk_plumbed = |
| 884 | pSession->connectedProfile.eseCckmInfo.krk_plumbed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 885 | } |
| 886 | #endif |
| 887 | }while(0); |
| 888 | } |
| 889 | } |
| 890 | |
| 891 | return (status); |
| 892 | } |
| 893 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 894 | eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 895 | { |
| 896 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 897 | |
| 898 | if((csrIsConnStateConnected(pMac, sessionId)) || |
| 899 | (csrIsConnStateIbss(pMac, sessionId))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 900 | { |
| 901 | if(pProfile) |
| 902 | { |
| 903 | status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile); |
| 904 | } |
| 905 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 906 | return (status); |
| 907 | } |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 908 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 909 | eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile) |
| 910 | { |
| 911 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 912 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 913 | if (pProfile->pBssDesc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 914 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 915 | vos_mem_free(pProfile->pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 916 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 917 | if (pProfile->pAddIEAssoc) |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 918 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 919 | vos_mem_free(pProfile->pAddIEAssoc); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 920 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 921 | vos_mem_set(pProfile, sizeof(tCsrRoamConnectedProfile), 0); |
| 922 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 923 | pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 924 | return (status); |
| 925 | } |
| 926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 927 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ) |
| 928 | { |
| 929 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 930 | if( pConnectedInfo->pbFrames ) |
| 931 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 932 | vos_mem_free(pConnectedInfo->pbFrames); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 933 | pConnectedInfo->pbFrames = NULL; |
| 934 | } |
| 935 | pConnectedInfo->nBeaconLength = 0; |
| 936 | pConnectedInfo->nAssocReqLength = 0; |
| 937 | pConnectedInfo->nAssocRspLength = 0; |
| 938 | pConnectedInfo->staId = 0; |
| 939 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 940 | pConnectedInfo->nRICRspLength = 0; |
| 941 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 942 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 943 | pConnectedInfo->nTspecIeLength = 0; |
| 944 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 945 | return ( status ); |
| 946 | } |
| 947 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 948 | |
| 949 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 950 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 951 | void csrReleaseCommandPreauth(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 952 | { |
| 953 | csrReinitPreauthCmd(pMac, pCommand); |
| 954 | csrReleaseCommand( pMac, pCommand ); |
| 955 | } |
| 956 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 957 | void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 958 | { |
| 959 | csrReinitRoamCmd(pMac, pCommand); |
| 960 | csrReleaseCommand( pMac, pCommand ); |
| 961 | } |
| 962 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 963 | void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 964 | { |
| 965 | csrReinitScanCmd(pMac, pCommand); |
| 966 | csrReleaseCommand( pMac, pCommand ); |
| 967 | } |
| 968 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 969 | void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 970 | { |
| 971 | csrReinitWmStatusChangeCmd(pMac, pCommand); |
| 972 | csrReleaseCommand( pMac, pCommand ); |
| 973 | } |
| 974 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 975 | void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 976 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 977 | vos_mem_set(&pCommand->u.setKeyCmd, sizeof(tSetKeyCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 978 | } |
| 979 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 980 | void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 981 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 982 | vos_mem_set(&pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 983 | } |
| 984 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 985 | void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 986 | { |
| 987 | csrReinitSetKeyCmd(pMac, pCommand); |
| 988 | csrReleaseCommand( pMac, pCommand ); |
| 989 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 990 | void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 991 | { |
| 992 | csrReinitRemoveKeyCmd(pMac, pCommand); |
| 993 | csrReleaseCommand( pMac, pCommand ); |
| 994 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 995 | void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ) |
| 996 | { |
| 997 | |
| 998 | if( eSmeCsrCommandMask & pCommand->command ) |
| 999 | { |
| 1000 | switch (pCommand->command) |
| 1001 | { |
| 1002 | case eSmeCommandScan: |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 1003 | // We need to inform the requester before dropping the scan command |
Jeff Johnson | c7c54b1 | 2013-11-17 11:49:03 -0800 | [diff] [blame] | 1004 | smsLog( pMac, LOGW, "%s: Drop scan reason %d callback %p", |
| 1005 | __func__, pCommand->u.scanCmd.reason, |
| 1006 | pCommand->u.scanCmd.callback); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1007 | if (NULL != pCommand->u.scanCmd.callback) |
| 1008 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1009 | smsLog( pMac, LOGW, "%s callback scan requester", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1010 | csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT); |
| 1011 | } |
| 1012 | csrReleaseCommandScan( pMac, pCommand ); |
| 1013 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1014 | case eSmeCommandRoam: |
| 1015 | csrReleaseCommandRoam( pMac, pCommand ); |
| 1016 | break; |
| 1017 | |
| 1018 | case eSmeCommandWmStatusChange: |
| 1019 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 1020 | break; |
| 1021 | |
| 1022 | case eSmeCommandSetKey: |
| 1023 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 1024 | break; |
| 1025 | |
| 1026 | case eSmeCommandRemoveKey: |
| 1027 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 1028 | break; |
| 1029 | |
| 1030 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1031 | smsLog( pMac, LOGW, " CSR abort standard command %d", pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | csrReleaseCommand( pMac, pCommand ); |
| 1033 | break; |
| 1034 | } |
| 1035 | } |
| 1036 | } |
| 1037 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1038 | void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId) |
| 1039 | { |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 1040 | smsLog(pMac, LOG1, FL("CSR RoamSubstate: [ %s <== %s ]"), |
| 1041 | macTraceGetcsrRoamSubState(NewSubstate), |
| 1042 | macTraceGetcsrRoamSubState(pMac->roam.curSubState[sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1043 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1044 | if(pMac->roam.curSubState[sessionId] == NewSubstate) |
| 1045 | { |
| 1046 | return; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1048 | pMac->roam.curSubState[sessionId] = NewSubstate; |
| 1049 | } |
| 1050 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1051 | eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId) |
| 1052 | { |
| 1053 | eCsrRoamState PreviousState; |
| 1054 | |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 1055 | smsLog(pMac, LOG1, FL("CSR RoamState[%hu]: [ %s <== %s ]"), sessionId, |
| 1056 | macTraceGetcsrRoamState(NewRoamState), |
| 1057 | macTraceGetcsrRoamState(pMac->roam.curState[sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1058 | |
| 1059 | PreviousState = pMac->roam.curState[sessionId]; |
| 1060 | |
| 1061 | if ( NewRoamState != pMac->roam.curState[sessionId] ) |
| 1062 | { |
| 1063 | // Whenever we transition OUT of the Roaming state, clear the Roaming substate... |
| 1064 | if ( CSR_IS_ROAM_JOINING(pMac, sessionId) ) |
| 1065 | { |
| 1066 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 1067 | } |
| 1068 | |
| 1069 | pMac->roam.curState[sessionId] = NewRoamState; |
| 1070 | } |
| 1071 | return( PreviousState ); |
| 1072 | } |
| 1073 | |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1074 | void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_S8 bestApRssi, tANI_U8 catOffset) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1075 | { |
| 1076 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1077 | if(catOffset) |
| 1078 | { |
| 1079 | pMac->roam.configParam.bCatRssiOffset = catOffset; |
| 1080 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 1081 | { |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1082 | 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] | 1083 | } |
| 1084 | } |
| 1085 | } |
| 1086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1087 | static void initConfigParam(tpAniSirGlobal pMac) |
| 1088 | { |
| 1089 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1090 | pMac->roam.configParam.agingCount = CSR_AGING_COUNT; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 1091 | pMac->roam.configParam.channelBondingMode24GHz = |
| 1092 | WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 1093 | pMac->roam.configParam.channelBondingMode5GHz = |
| 1094 | WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1095 | pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 1096 | pMac->roam.configParam.eBand = eCSR_BAND_ALL; |
| 1097 | pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 1098 | pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT; |
| 1099 | pMac->roam.configParam.HeartbeatThresh24 = 40; |
| 1100 | pMac->roam.configParam.HeartbeatThresh50 = 40; |
| 1101 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 1102 | pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE; |
| 1103 | pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1104 | pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1105 | pMac->roam.configParam.RTSThreshold = 2346; |
| 1106 | pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE; |
| 1107 | pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto; |
| 1108 | pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE; |
| 1109 | pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO; |
| 1110 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1111 | pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS; |
| 1112 | pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS; |
| 1113 | pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS; |
| 1114 | pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS; |
| 1115 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 1116 | { |
| 1117 | pMac->roam.configParam.BssPreferValue[i] = i; |
| 1118 | } |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1119 | csrAssignRssiForCategory(pMac, CSR_BEST_RSSI_VALUE, CSR_DEFAULT_RSSI_DB_GAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1120 | pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; |
| 1121 | pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE; |
| 1122 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1123 | pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE; |
| 1124 | pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE; |
Abhishek Singh | 2ec36ab | 2014-08-07 16:14:25 +0530 | [diff] [blame] | 1125 | pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1126 | pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; |
| 1127 | pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; |
| 1128 | pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; |
| 1129 | pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1130 | pMac->roam.configParam.nActiveMaxChnTimeBtc = CSR_ACTIVE_MAX_CHANNEL_TIME_BTC; |
| 1131 | pMac->roam.configParam.nActiveMinChnTimeBtc = CSR_ACTIVE_MIN_CHANNEL_TIME_BTC; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1132 | pMac->roam.configParam.disableAggWithBtc = eANI_BOOLEAN_TRUE; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1133 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1134 | pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; |
| 1135 | pMac->roam.configParam.nActiveMinChnTimeConc = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC; |
| 1136 | pMac->roam.configParam.nPassiveMaxChnTimeConc = CSR_PASSIVE_MAX_CHANNEL_TIME_CONC; |
| 1137 | pMac->roam.configParam.nPassiveMinChnTimeConc = CSR_PASSIVE_MIN_CHANNEL_TIME_CONC; |
| 1138 | pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1139 | pMac->roam.configParam.nNumStaChanCombinedConc = CSR_NUM_STA_CHAN_COMBINED_CONC; |
| 1140 | pMac->roam.configParam.nNumP2PChanCombinedConc = CSR_NUM_P2P_CHAN_COMBINED_CONC; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1141 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1142 | pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default |
| 1143 | pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; |
| 1144 | pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; |
| 1145 | pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1146 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1147 | pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0; |
| 1148 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1149 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1150 | pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3; |
| 1151 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120; |
| 1152 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125; |
| 1153 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20; |
| 1154 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40; |
| 1155 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200; |
| 1156 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3; |
| 1157 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1; |
| 1158 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6; |
| 1159 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11; |
| 1160 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1161 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = 0; |
Mukul Sharma | 20aa658 | 2014-08-07 21:36:12 +0530 | [diff] [blame] | 1162 | pMac->roam.configParam.neighborRoamConfig.nNeighborInitialForcedRoamTo5GhEnable = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1163 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1164 | #ifdef WLAN_FEATURE_11AC |
| 1165 | pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1; |
| 1166 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1167 | |
| 1168 | pMac->roam.configParam.addTSWhenACMIsOff = 0; |
| 1169 | pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE; |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1170 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1171 | //Remove this code once SLM_Sessionization is supported |
| 1172 | //BMPS_WORKAROUND_NOT_NEEDED |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1173 | pMac->roam.configParam.doBMPSWorkaround = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1174 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1175 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1176 | eCsrBand csrGetCurrentBand(tHalHandle hHal) |
| 1177 | { |
| 1178 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1179 | return pMac->roam.configParam.bandCapability; |
| 1180 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1181 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1182 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1183 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1184 | /* |
| 1185 | This function flushes the roam scan cache |
| 1186 | */ |
| 1187 | eHalStatus csrFlushRoamScanRoamChannelList(tpAniSirGlobal pMac) |
| 1188 | { |
| 1189 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1190 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1191 | |
| 1192 | /* Free up the memory first (if required) */ |
| 1193 | if (NULL != pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 1194 | { |
| 1195 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 1196 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 1197 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
| 1198 | } |
| 1199 | return status; |
| 1200 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1201 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1202 | |
| 1203 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1204 | #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] | 1205 | /* |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1206 | This function flushes the roam scan cache |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1207 | */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1208 | eHalStatus csrFlushCfgBgScanRoamChannelList(tpAniSirGlobal pMac) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1209 | { |
| 1210 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1211 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1212 | |
| 1213 | /* Free up the memory first (if required) */ |
| 1214 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1215 | { |
| 1216 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 1217 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1218 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1219 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1220 | return status; |
| 1221 | } |
| 1222 | |
| 1223 | |
| 1224 | |
| 1225 | /* |
| 1226 | This function flushes the roam scan cache and creates fresh cache |
| 1227 | based on the input channel list |
| 1228 | */ |
| 1229 | eHalStatus csrCreateBgScanRoamChannelList(tpAniSirGlobal pMac, |
| 1230 | const tANI_U8 *pChannelList, |
| 1231 | const tANI_U8 numChannels) |
| 1232 | { |
| 1233 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1234 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1235 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1236 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = numChannels; |
| 1237 | |
| 1238 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = |
| 1239 | vos_mem_malloc(pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1240 | |
| 1241 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1242 | { |
| 1243 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 1244 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
| 1245 | return eHAL_STATUS_RESOURCES; |
| 1246 | } |
| 1247 | |
| 1248 | /* Update the roam global structure */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1249 | vos_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
| 1250 | pChannelList, |
| 1251 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1252 | return status; |
| 1253 | } |
| 1254 | |
| 1255 | /* This function modifies the bgscan channel list set via config ini or |
| 1256 | runtime, whenever the band changes. |
| 1257 | if the band is auto, then no operation is performed on the channel list |
| 1258 | if the band is 2.4G, then make sure channel list contains only 2.4G valid channels |
| 1259 | if the band is 5G, then make sure channel list contains only 5G valid channels |
| 1260 | */ |
| 1261 | eHalStatus csrUpdateBgScanConfigIniChannelList(tpAniSirGlobal pMac, |
| 1262 | eCsrBand eBand) |
| 1263 | { |
| 1264 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1265 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1266 | tANI_U8 outNumChannels = 0; |
| 1267 | tANI_U8 inNumChannels = 0; |
| 1268 | tANI_U8 *inPtr = NULL; |
| 1269 | tANI_U8 i = 0; |
| 1270 | tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1271 | |
| 1272 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1273 | |
| 1274 | { |
| 1275 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1276 | "No update required for channel list " |
| 1277 | "either cfg.ini channel list is not set up or " |
| 1278 | "auto band (Band %d)", eBand); |
| 1279 | return status; |
| 1280 | } |
| 1281 | |
| 1282 | inNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
| 1283 | inPtr = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 1284 | if (eCSR_BAND_24 == eBand) |
| 1285 | { |
| 1286 | for (i = 0; i < inNumChannels; i++) |
| 1287 | { |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 1288 | if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrRoamIsChannelValid(pMac, inPtr[i])) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1289 | { |
| 1290 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1291 | } |
| 1292 | } |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1293 | csrFlushCfgBgScanRoamChannelList(pMac); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1294 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1295 | } |
| 1296 | else if (eCSR_BAND_5G == eBand) |
| 1297 | { |
| 1298 | for (i = 0; i < inNumChannels; i++) |
| 1299 | { |
| 1300 | /* Add 5G Non-DFS channel */ |
| 1301 | if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) && |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 1302 | csrRoamIsChannelValid(pMac, inPtr[i]) && |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1303 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1304 | { |
| 1305 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1306 | } |
| 1307 | } |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1308 | csrFlushCfgBgScanRoamChannelList(pMac); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1309 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1310 | } |
| 1311 | else if (eCSR_BAND_ALL == eBand) |
| 1312 | { |
| 1313 | for (i = 0; i < inNumChannels; i++) |
| 1314 | { |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 1315 | if (csrRoamIsChannelValid(pMac, inPtr[i]) && |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1316 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1317 | { |
| 1318 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1319 | } |
| 1320 | } |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1321 | csrFlushCfgBgScanRoamChannelList(pMac); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1322 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1323 | } |
| 1324 | else |
| 1325 | { |
| 1326 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 1327 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 1328 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 1329 | } |
| 1330 | |
| 1331 | return status; |
| 1332 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1333 | #endif |
| 1334 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1335 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1336 | /* This function modifies the roam scan channel list as per AP neighbor |
| 1337 | report; AP neighbor report may be empty or may include only other AP |
| 1338 | channels; in any case, we merge the channel list with the learned occupied |
| 1339 | channels list. |
| 1340 | if the band is 2.4G, then make sure channel list contains only 2.4G valid channels |
| 1341 | if the band is 5G, then make sure channel list contains only 5G valid channels |
| 1342 | */ |
| 1343 | eHalStatus csrCreateRoamScanChannelList(tpAniSirGlobal pMac, |
| 1344 | tANI_U8 *pChannelList, |
| 1345 | tANI_U8 numChannels, |
| 1346 | const eCsrBand eBand) |
| 1347 | { |
| 1348 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1349 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1350 | tANI_U8 outNumChannels = 0; |
| 1351 | tANI_U8 inNumChannels = numChannels; |
| 1352 | tANI_U8 *inPtr = pChannelList; |
| 1353 | tANI_U8 i = 0; |
| 1354 | tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1355 | tANI_U8 tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1356 | tANI_U8 mergedOutputNumOfChannels = 0; |
| 1357 | tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 1358 | |
| 1359 | /* Create a Union of occupied channel list learnt by the DUT along with the Neighbor |
| 1360 | * report Channels. This increases the chances of the DUT to get a candidate AP while |
| 1361 | * roaming even if the Neighbor Report is not able to provide sufficient information. */ |
| 1362 | if (pMac->scan.occupiedChannels.numChannels) |
| 1363 | { |
| 1364 | csrNeighborRoamMergeChannelLists(pMac, |
| 1365 | &pMac->scan.occupiedChannels.channelList[0], |
| 1366 | pMac->scan.occupiedChannels.numChannels, |
| 1367 | inPtr, |
| 1368 | inNumChannels, |
| 1369 | &mergedOutputNumOfChannels); |
| 1370 | inNumChannels = mergedOutputNumOfChannels; |
| 1371 | } |
| 1372 | |
| 1373 | if (eCSR_BAND_24 == eBand) |
| 1374 | { |
| 1375 | for (i = 0; i < inNumChannels; i++) |
| 1376 | { |
| 1377 | if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrRoamIsChannelValid(pMac, inPtr[i])) |
| 1378 | { |
| 1379 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1380 | } |
| 1381 | } |
| 1382 | } |
| 1383 | else if (eCSR_BAND_5G == eBand) |
| 1384 | { |
| 1385 | for (i = 0; i < inNumChannels; i++) |
| 1386 | { |
| 1387 | /* Add 5G Non-DFS channel */ |
| 1388 | if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) && |
| 1389 | csrRoamIsChannelValid(pMac, inPtr[i]) && |
| 1390 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1391 | { |
| 1392 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1393 | } |
| 1394 | } |
| 1395 | } |
| 1396 | else if (eCSR_BAND_ALL == eBand) |
| 1397 | { |
| 1398 | for (i = 0; i < inNumChannels; i++) |
| 1399 | { |
| 1400 | if (csrRoamIsChannelValid(pMac, inPtr[i]) && |
| 1401 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1402 | { |
| 1403 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1404 | } |
| 1405 | } |
| 1406 | } |
| 1407 | else |
| 1408 | { |
| 1409 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 1410 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 1411 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1412 | } |
| 1413 | |
| 1414 | /* if roaming within band is enabled, then select only the |
| 1415 | in band channels . |
| 1416 | This is required only if the band capability is set to ALL, |
| 1417 | E.g., if band capability is only 2.4G then all the channels in the |
| 1418 | list are already filtered for 2.4G channels, hence ignore this check*/ |
| 1419 | |
| 1420 | if ((eCSR_BAND_ALL == eBand) && CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac)) |
| 1421 | { |
Mukul Sharma | 20aa658 | 2014-08-07 21:36:12 +0530 | [diff] [blame] | 1422 | csrNeighborRoamChannelsFilterByBand( |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1423 | pMac, |
| 1424 | ChannelList, |
| 1425 | outNumChannels, |
| 1426 | tmpChannelList, |
Mukul Sharma | 20aa658 | 2014-08-07 21:36:12 +0530 | [diff] [blame] | 1427 | &outNumChannels, |
| 1428 | GetRFBand(pMac->roam.neighborRoamInfo.currAPoperationChannel)); |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 1429 | vos_mem_copy(ChannelList, |
| 1430 | tmpChannelList, outNumChannels); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1431 | } |
| 1432 | |
| 1433 | /* Prepare final roam scan channel list */ |
| 1434 | if(outNumChannels) |
| 1435 | { |
| 1436 | /* Clear the channel list first */ |
| 1437 | if (NULL != currChannelListInfo->ChannelList) |
| 1438 | { |
| 1439 | vos_mem_free(currChannelListInfo->ChannelList); |
| 1440 | currChannelListInfo->ChannelList = NULL; |
| 1441 | currChannelListInfo->numOfChannels = 0; |
| 1442 | } |
| 1443 | |
| 1444 | currChannelListInfo->ChannelList = vos_mem_malloc(outNumChannels * sizeof(tANI_U8)); |
| 1445 | if (NULL == currChannelListInfo->ChannelList) |
| 1446 | { |
| 1447 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
| 1448 | "Failed to allocate memory for roam scan channel list"); |
| 1449 | currChannelListInfo->numOfChannels = 0; |
| 1450 | return VOS_STATUS_E_RESOURCES; |
| 1451 | } |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 1452 | vos_mem_copy(currChannelListInfo->ChannelList, |
| 1453 | ChannelList, outNumChannels); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1454 | } |
| 1455 | return status; |
| 1456 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1457 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1458 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1459 | eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand) |
| 1460 | { |
| 1461 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1462 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1463 | if (CSR_IS_PHY_MODE_A_ONLY(pMac) && |
| 1464 | (eBand == eCSR_BAND_24)) |
| 1465 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1466 | /* DOT11 mode configured to 11a only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1467 | request to change the band to 2.4 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1468 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1469 | "failed to set band cfg80211 = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1470 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1471 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1472 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1473 | if ((CSR_IS_PHY_MODE_B_ONLY(pMac) || |
| 1474 | CSR_IS_PHY_MODE_G_ONLY(pMac)) && |
| 1475 | (eBand == eCSR_BAND_5G)) |
| 1476 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1477 | /* DOT11 mode configured to 11b/11g only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1478 | request to change the band to 5 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1479 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1480 | "failed to set band dot11mode = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1481 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1482 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1483 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1484 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1485 | "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] | 1486 | pMac->roam.configParam.eBand = eBand; |
| 1487 | pMac->roam.configParam.bandCapability = eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1488 | csrScanGetSupportedChannels( pMac ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1489 | #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] | 1490 | if (!csrRoamIsRoamOffloadScanEnabled(pMac)) |
| 1491 | csrUpdateBgScanConfigIniChannelList( pMac, eBand ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1492 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1493 | status = csrInitGetChannels( pMac ); |
| 1494 | if (eHAL_STATUS_SUCCESS == status) |
| 1495 | csrInitChannelList( hHal ); |
| 1496 | return status; |
| 1497 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1498 | |
| 1499 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1500 | /* The funcns csrConvertCBIniValueToPhyCBState and csrConvertPhyCBStateToIniValue have been |
| 1501 | * introduced to convert the ini value to the ENUM used in csr and MAC for CB state |
| 1502 | * Ideally we should have kept the ini value and enum value same and representing the same |
| 1503 | * cb values as in 11n standard i.e. |
| 1504 | * Set to 1 (SCA) if the secondary channel is above the primary channel |
| 1505 | * Set to 3 (SCB) if the secondary channel is below the primary channel |
| 1506 | * Set to 0 (SCN) if no secondary channel is present |
| 1507 | * However, since our driver is already distributed we will keep the ini definition as it is which is: |
| 1508 | * 0 - secondary none |
| 1509 | * 1 - secondary LOW |
| 1510 | * 2 - secondary HIGH |
| 1511 | * and convert to enum value used within the driver in csrChangeDefaultConfigParam using this funcn |
| 1512 | * The enum values are as follows: |
| 1513 | * PHY_SINGLE_CHANNEL_CENTERED = 0 |
| 1514 | * PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1 |
| 1515 | * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 1516 | */ |
| 1517 | ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue) |
| 1518 | { |
| 1519 | |
| 1520 | ePhyChanBondState phyCbState; |
| 1521 | switch (cbIniValue) { |
| 1522 | // secondary none |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1523 | case eCSR_INI_SINGLE_CHANNEL_CENTERED: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1524 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1525 | break; |
| 1526 | // secondary LOW |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1527 | case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1528 | phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 1529 | break; |
| 1530 | // secondary HIGH |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1531 | case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1532 | phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 1533 | break; |
| 1534 | #ifdef WLAN_FEATURE_11AC |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1535 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 1536 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1537 | break; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1538 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1539 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1540 | break; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1541 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1542 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED; |
| 1543 | break; |
| 1544 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1545 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 1546 | break; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1547 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1548 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1549 | break; |
| 1550 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1551 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 1552 | break; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1553 | case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1554 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1555 | break; |
| 1556 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1557 | default: |
| 1558 | // If an invalid value is passed, disable CHANNEL BONDING |
| 1559 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1560 | break; |
| 1561 | } |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1562 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1563 | return phyCbState; |
| 1564 | } |
| 1565 | |
| 1566 | v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState) |
| 1567 | { |
| 1568 | |
| 1569 | v_U32_t cbIniValue; |
| 1570 | switch (phyCbState) { |
| 1571 | // secondary none |
| 1572 | case PHY_SINGLE_CHANNEL_CENTERED: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1573 | cbIniValue = eCSR_INI_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1574 | break; |
| 1575 | // secondary LOW |
| 1576 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1577 | cbIniValue = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1578 | break; |
| 1579 | // secondary HIGH |
| 1580 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1581 | cbIniValue = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1582 | break; |
| 1583 | #ifdef WLAN_FEATURE_11AC |
| 1584 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1585 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1586 | break; |
| 1587 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1588 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1589 | break; |
| 1590 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1591 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1592 | break; |
| 1593 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1594 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1595 | break; |
| 1596 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1597 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1598 | break; |
| 1599 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1600 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1601 | break; |
| 1602 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1603 | cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1604 | break; |
| 1605 | #endif |
| 1606 | default: |
| 1607 | // return some invalid value |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1608 | cbIniValue = eCSR_INI_CHANNEL_BONDING_STATE_MAX; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1609 | break; |
| 1610 | } |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1611 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1612 | return cbIniValue; |
| 1613 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1614 | |
| 1615 | eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1616 | { |
| 1617 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1618 | |
| 1619 | if(pParam) |
| 1620 | { |
| 1621 | pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode; |
| 1622 | pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled; |
| 1623 | pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold; |
| 1624 | pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled; |
| 1625 | pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled; |
| 1626 | pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled; |
| 1627 | |
| 1628 | pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; |
Mohit Khanna | 7ed53f0 | 2012-09-11 17:52:10 -0700 | [diff] [blame] | 1629 | pMac->roam.configParam.fAllowMCCGODiffBI = pParam->fAllowMCCGODiffBI; |
| 1630 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1631 | /* channelBondingMode5GHz plays a dual role right now |
| 1632 | * 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 |
| 1633 | * This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change |
| 1634 | */ |
| 1635 | if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI) |
| 1636 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1637 | 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] | 1638 | } |
| 1639 | pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz); |
| 1640 | if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI) |
| 1641 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1642 | 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] | 1643 | } |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1644 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 1645 | pMac->roam.configParam.channelBondingAPMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingAPMode24GHz); |
| 1646 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1647 | pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1648 | pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold; |
| 1649 | pMac->roam.configParam.phyMode = pParam->phyMode; |
| 1650 | pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime; |
| 1651 | pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24; |
| 1652 | pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50; |
| 1653 | pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled; |
| 1654 | pMac->roam.configParam.TxRate = pParam->TxRate; |
| 1655 | pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; |
| 1656 | pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; |
| 1657 | pMac->roam.configParam.bandCapability = pParam->bandCapability; |
| 1658 | pMac->roam.configParam.cbChoice = pParam->cbChoice; |
| 1659 | pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1660 | pMac->roam.configParam.disableAggWithBtc = pParam->disableAggWithBtc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1661 | //if HDD passed down non zero values then only update, |
| 1662 | //otherwise keep using the defaults |
c_hpothu | 059edb0 | 2014-03-12 21:44:28 +0530 | [diff] [blame] | 1663 | if (pParam->nInitialDwellTime) |
| 1664 | { |
| 1665 | pMac->roam.configParam.nInitialDwellTime = |
| 1666 | pParam->nInitialDwellTime; |
| 1667 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1668 | if (pParam->nActiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1669 | { |
| 1670 | pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime; |
Rajesh Babu Prathipati | b09815c | 2014-07-05 11:22:24 +0530 | [diff] [blame] | 1671 | cfgSetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME, |
| 1672 | pParam->nActiveMaxChnTime); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1673 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1674 | if (pParam->nActiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1675 | { |
| 1676 | pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime; |
Rajesh Babu Prathipati | b09815c | 2014-07-05 11:22:24 +0530 | [diff] [blame] | 1677 | cfgSetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME, |
| 1678 | pParam->nActiveMinChnTime); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1679 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1680 | if (pParam->nPassiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1681 | { |
| 1682 | pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime; |
Rajesh Babu Prathipati | b09815c | 2014-07-05 11:22:24 +0530 | [diff] [blame] | 1683 | cfgSetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, |
| 1684 | pParam->nPassiveMaxChnTime); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1685 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1686 | if (pParam->nPassiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1687 | { |
| 1688 | pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime; |
Rajesh Babu Prathipati | b09815c | 2014-07-05 11:22:24 +0530 | [diff] [blame] | 1689 | cfgSetInt(pMac, WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME, |
| 1690 | pParam->nPassiveMinChnTime); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1691 | } |
Sushant Kaushik | c9682be | 2014-11-26 12:27:04 +0530 | [diff] [blame^] | 1692 | if (pParam->nOBSSScanWidthTriggerInterval) |
| 1693 | { |
| 1694 | pMac->roam.configParam.nOBSSScanWidthTriggerInterval = |
| 1695 | pParam->nOBSSScanWidthTriggerInterval; |
| 1696 | cfgSetInt(pMac, WNI_CFG_OBSS_HT40_SCAN_WIDTH_TRIGGER_INTERVAL, |
| 1697 | pParam->nOBSSScanWidthTriggerInterval); |
| 1698 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1699 | if (pParam->nActiveMaxChnTimeBtc) |
| 1700 | { |
| 1701 | pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc; |
| 1702 | } |
| 1703 | if (pParam->nActiveMinChnTimeBtc) |
| 1704 | { |
| 1705 | pMac->roam.configParam.nActiveMinChnTimeBtc = pParam->nActiveMinChnTimeBtc; |
| 1706 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1707 | #ifdef WLAN_AP_STA_CONCURRENCY |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1708 | if (pParam->nActiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1709 | { |
| 1710 | pMac->roam.configParam.nActiveMaxChnTimeConc = pParam->nActiveMaxChnTimeConc; |
| 1711 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1712 | if (pParam->nActiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1713 | { |
| 1714 | pMac->roam.configParam.nActiveMinChnTimeConc = pParam->nActiveMinChnTimeConc; |
| 1715 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1716 | if (pParam->nPassiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1717 | { |
| 1718 | pMac->roam.configParam.nPassiveMaxChnTimeConc = pParam->nPassiveMaxChnTimeConc; |
| 1719 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1720 | if (pParam->nPassiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1721 | { |
| 1722 | pMac->roam.configParam.nPassiveMinChnTimeConc = pParam->nPassiveMinChnTimeConc; |
| 1723 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1724 | if (pParam->nRestTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1725 | { |
| 1726 | pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc; |
| 1727 | } |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1728 | if (pParam->nNumStaChanCombinedConc) |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1729 | { |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1730 | pMac->roam.configParam.nNumStaChanCombinedConc = pParam->nNumStaChanCombinedConc; |
| 1731 | } |
| 1732 | if (pParam->nNumP2PChanCombinedConc) |
| 1733 | { |
| 1734 | pMac->roam.configParam.nNumP2PChanCombinedConc = pParam->nNumP2PChanCombinedConc; |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1735 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1736 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1737 | //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] | 1738 | if (pParam->impsSleepTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1739 | { |
| 1740 | //Change the unit from second to microsecond |
| 1741 | tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1742 | if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime) |
| 1743 | { |
| 1744 | pMac->roam.configParam.impsSleepTime = impsSleepTime; |
| 1745 | } |
| 1746 | else |
| 1747 | { |
| 1748 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1749 | } |
| 1750 | } |
| 1751 | else |
| 1752 | { |
| 1753 | pMac->roam.configParam.impsSleepTime = 0; |
| 1754 | } |
| 1755 | pMac->roam.configParam.eBand = pParam->eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1756 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode, |
| 1757 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1758 | //if HDD passed down non zero values for age params, then only update, |
| 1759 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1760 | if (pParam->nScanResultAgeCount) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1761 | { |
| 1762 | pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount; |
| 1763 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1764 | if(pParam->scanAgeTimeNCNPS) |
| 1765 | { |
| 1766 | pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS; |
| 1767 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1768 | if(pParam->scanAgeTimeNCPS) |
| 1769 | { |
| 1770 | pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS; |
| 1771 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1772 | if(pParam->scanAgeTimeCNPS) |
| 1773 | { |
| 1774 | pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS; |
| 1775 | } |
| 1776 | if(pParam->scanAgeTimeCPS) |
| 1777 | { |
| 1778 | pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS; |
| 1779 | } |
c_hpothu | 0d5a735 | 2014-03-22 12:30:25 +0530 | [diff] [blame] | 1780 | if (pParam->initialScanSkipDFSCh) |
| 1781 | { |
| 1782 | pMac->roam.configParam.initialScanSkipDFSCh = |
| 1783 | pParam->initialScanSkipDFSCh; |
| 1784 | } |
| 1785 | |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1786 | csrAssignRssiForCategory(pMac, CSR_BEST_RSSI_VALUE, pParam->bCatRssiOffset); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1787 | pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; |
| 1788 | pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels; |
| 1789 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; |
| 1790 | pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch; |
| 1791 | pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1792 | pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold; |
| 1793 | pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1794 | pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled; |
| 1795 | pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity; |
| 1796 | pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS; |
| 1797 | //Assign this before calling CsrInit11dInfo |
| 1798 | pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1799 | if( csrIs11dSupported( pMac ) ) |
| 1800 | { |
| 1801 | status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo); |
| 1802 | } |
| 1803 | else |
| 1804 | { |
| 1805 | pMac->scan.curScanType = eSIR_ACTIVE_SCAN; |
| 1806 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1807 | |
| 1808 | /* Initialize the power + channel information if 11h is enabled. |
| 1809 | If 11d is enabled this information has already been initialized */ |
| 1810 | if( csrIs11hSupported( pMac ) && !csrIs11dSupported( pMac ) ) |
| 1811 | { |
| 1812 | csrInitChannelPowerList(pMac, &pParam->Csr11dinfo); |
| 1813 | } |
| 1814 | |
| 1815 | |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 1816 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1817 | vos_mem_copy(&pMac->roam.configParam.csr11rConfig, |
| 1818 | &pParam->csr11rConfig, sizeof(tCsr11rConfigParams)); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1819 | smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1820 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1821 | #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] | 1822 | pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1823 | pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1824 | pMac->roam.configParam.nImmediateRoamRssiDiff = pParam->nImmediateRoamRssiDiff; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1825 | smsLog( pMac, LOG1, "nImmediateRoamRssiDiff = %d", |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1826 | pMac->roam.configParam.nImmediateRoamRssiDiff ); |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 1827 | pMac->roam.configParam.nRoamPrefer5GHz = pParam->nRoamPrefer5GHz; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 1828 | pMac->roam.configParam.nRoamIntraBand = pParam->nRoamIntraBand; |
Srinivas Girigowda | ad34ca9 | 2013-10-22 10:54:29 -0700 | [diff] [blame] | 1829 | pMac->roam.configParam.isWESModeEnabled = pParam->isWESModeEnabled; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 1830 | pMac->roam.configParam.nProbes = pParam->nProbes; |
| 1831 | pMac->roam.configParam.nRoamScanHomeAwayTime = pParam->nRoamScanHomeAwayTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1832 | #endif |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1833 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1834 | pMac->roam.configParam.isRoamOffloadScanEnabled = pParam->isRoamOffloadScanEnabled; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1835 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = pParam->bFastRoamInConIniFeatureEnabled; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1836 | #endif |
| 1837 | #ifdef FEATURE_WLAN_LFR |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1838 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled; |
Sameer Thalappil | 4ae66ec | 2013-11-05 14:17:35 -0800 | [diff] [blame] | 1839 | pMac->roam.configParam.MAWCEnabled = pParam->MAWCEnabled; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1840 | #endif |
| 1841 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 1842 | #ifdef FEATURE_WLAN_ESE |
| 1843 | pMac->roam.configParam.isEseIniFeatureEnabled = pParam->isEseIniFeatureEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1844 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1845 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1846 | vos_mem_copy(&pMac->roam.configParam.neighborRoamConfig, |
| 1847 | &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams)); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1848 | smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod); |
| 1849 | smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold); |
| 1850 | smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold); |
| 1851 | smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime); |
| 1852 | smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime); |
| 1853 | smsLog( pMac, LOG1, "nMaxNeighborRetries = %d", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); |
| 1854 | smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); |
| 1855 | smsLog( pMac, LOG1, "nEmptyScanRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod); |
Mukul Sharma | 20aa658 | 2014-08-07 21:36:12 +0530 | [diff] [blame] | 1856 | smsLog( pMac, LOG1, "nNeighborInitialForcedRoamTo5GhEnable = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborInitialForcedRoamTo5GhEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1857 | { |
| 1858 | int i; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1859 | 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] | 1860 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1861 | { |
| 1862 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1863 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1864 | } |
| 1865 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1866 | pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff; |
| 1867 | pMac->scan.fValidateList = pParam->fValidateList; |
| 1868 | pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d; |
| 1869 | pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan; |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 1870 | pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1871 | pMac->roam.configParam.fScanTwice = pParam->fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1872 | pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 1873 | pMac->scan.scanBandPreference = pParam->scanBandPreference; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1874 | /* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here |
| 1875 | * This paramtere is used in concurrency to determine if there are concurrent active sessions. |
| 1876 | * Is used as a temporary fix to disconnect all active sessions when BMPS enabled so the active session if Infra STA |
| 1877 | * will automatically connect back and resume BMPS since resume BMPS is not working when moving from concurrent to |
| 1878 | * single session |
| 1879 | */ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1880 | //Remove this code once SLM_Sessionization is supported |
| 1881 | //BMPS_WORKAROUND_NOT_NEEDED |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1882 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 1883 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1884 | #ifdef WLAN_FEATURE_11AC |
| 1885 | pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1886 | pMac->roam.configParam.txBFEnable= pParam->enableTxBF; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1887 | pMac->roam.configParam.txBFCsnValue = pParam->txBFCsnValue; |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 1888 | pMac->roam.configParam.enableVhtFor24GHz = pParam->enableVhtFor24GHz; |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 1889 | /* Consider Mu-beamformee only if SU-beamformee is enabled */ |
| 1890 | if ( pParam->enableTxBF ) |
| 1891 | pMac->roam.configParam.txMuBformee= pParam->enableMuBformee; |
| 1892 | else |
| 1893 | pMac->roam.configParam.txMuBformee= 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1894 | #endif |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1895 | pMac->roam.configParam.txLdpcEnable = pParam->enableTxLdpc; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1896 | |
| 1897 | pMac->roam.configParam.isAmsduSupportInAMPDU = pParam->isAmsduSupportInAMPDU; |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 1898 | pMac->roam.configParam.nSelect5GHzMargin = pParam->nSelect5GHzMargin; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 1899 | pMac->roam.configParam.isCoalesingInIBSSAllowed = |
| 1900 | pParam->isCoalesingInIBSSAllowed; |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 1901 | pMac->roam.configParam.allowDFSChannelRoam = pParam->allowDFSChannelRoam; |
Abhishek Singh | de51a41 | 2014-05-20 19:17:26 +0530 | [diff] [blame] | 1902 | pMac->roam.configParam.sendDeauthBeforeCon = pParam->sendDeauthBeforeCon; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1903 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 1904 | pMac->roam.configParam.apHT40_24GEnabled = pParam->apHT40_24GEnabled; |
| 1905 | #endif |
| 1906 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1907 | } |
| 1908 | |
| 1909 | return status; |
| 1910 | } |
| 1911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1912 | eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1913 | { |
| 1914 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1915 | if(pParam) |
| 1916 | { |
| 1917 | pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode; |
| 1918 | pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled; |
| 1919 | pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold; |
| 1920 | pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled; |
| 1921 | pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 1922 | pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1923 | pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz); |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 1924 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 1925 | pParam->channelBondingAPMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingAPMode24GHz); |
| 1926 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1927 | pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1928 | pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold; |
| 1929 | pParam->phyMode = pMac->roam.configParam.phyMode; |
| 1930 | pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 1931 | pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24; |
| 1932 | pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50; |
| 1933 | pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled; |
| 1934 | pParam->TxRate = pMac->roam.configParam.TxRate; |
| 1935 | pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24; |
| 1936 | pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G; |
| 1937 | pParam->bandCapability = pMac->roam.configParam.bandCapability; |
| 1938 | pParam->cbChoice = pMac->roam.configParam.cbChoice; |
| 1939 | pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1940 | pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime; |
| 1941 | pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; |
| 1942 | pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; |
| 1943 | pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1944 | pParam->nActiveMaxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; |
| 1945 | pParam->nActiveMinChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; |
| 1946 | pParam->disableAggWithBtc = pMac->roam.configParam.disableAggWithBtc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1947 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1948 | pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc; |
| 1949 | pParam->nActiveMinChnTimeConc = pMac->roam.configParam.nActiveMinChnTimeConc; |
| 1950 | pParam->nPassiveMaxChnTimeConc = pMac->roam.configParam.nPassiveMaxChnTimeConc; |
| 1951 | pParam->nPassiveMinChnTimeConc = pMac->roam.configParam.nPassiveMinChnTimeConc; |
| 1952 | pParam->nRestTimeConc = pMac->roam.configParam.nRestTimeConc; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1953 | pParam->nNumStaChanCombinedConc = pMac->roam.configParam.nNumStaChanCombinedConc; |
| 1954 | pParam->nNumP2PChanCombinedConc = pMac->roam.configParam.nNumP2PChanCombinedConc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1955 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | //Change the unit from microsecond to second |
| 1957 | pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT; |
| 1958 | pParam->eBand = pMac->roam.configParam.eBand; |
| 1959 | pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount; |
| 1960 | pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS; |
| 1961 | pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS; |
| 1962 | pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS; |
| 1963 | pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS; |
| 1964 | pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset; |
| 1965 | pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime; |
| 1966 | pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels; |
| 1967 | pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority; |
| 1968 | pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch; |
| 1969 | pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain; |
| 1970 | pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold; |
| 1971 | pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1972 | pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled; |
| 1973 | pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap; |
| 1974 | pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 1975 | pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1976 | pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff; |
| 1977 | pParam->fValidateList = pMac->roam.configParam.fValidateList; |
| 1978 | pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d; |
| 1979 | pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan; |
| 1980 | pParam->fScanTwice = pMac->roam.configParam.fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1981 | pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl; |
Madan Mohan Koyyalamudi | ed41951 | 2012-11-29 15:53:46 -0800 | [diff] [blame] | 1982 | pParam->fEnableMCCMode = pMac->roam.configParam.fenableMCCMode; |
Madan Mohan Koyyalamudi | 057bd80 | 2012-11-29 16:02:39 -0800 | [diff] [blame] | 1983 | pParam->fAllowMCCGODiffBI = pMac->roam.configParam.fAllowMCCGODiffBI; |
Sunil Ravi | 39b2e53 | 2013-01-20 23:45:53 -0800 | [diff] [blame] | 1984 | pParam->scanCfgAgingTime = pMac->scan.scanResultCfgAgingTime; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 1985 | pParam->scanBandPreference = pMac->scan.scanBandPreference; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1986 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1987 | vos_mem_copy(&pParam->neighborRoamConfig, |
| 1988 | &pMac->roam.configParam.neighborRoamConfig, |
| 1989 | sizeof(tCsrNeighborRoamConfigParams)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1990 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1991 | #ifdef WLAN_FEATURE_11AC |
| 1992 | pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1993 | pParam->enableTxBF = pMac->roam.configParam.txBFEnable; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1994 | pParam->txBFCsnValue = pMac->roam.configParam.txBFCsnValue; |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 1995 | pParam->enableVhtFor24GHz = pMac->roam.configParam.enableVhtFor24GHz; |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 1996 | /* Consider Mu-beamformee only if SU-beamformee is enabled */ |
| 1997 | if ( pParam->enableTxBF ) |
| 1998 | pParam->enableMuBformee = pMac->roam.configParam.txMuBformee; |
| 1999 | else |
| 2000 | pParam->enableMuBformee = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2001 | #endif |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 2002 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2003 | vos_mem_copy(&pMac->roam.configParam.csr11rConfig, |
| 2004 | &pParam->csr11rConfig, sizeof(tCsr11rConfigParams)); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 2005 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2006 | #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] | 2007 | pParam->isFastTransitionEnabled = pMac->roam.configParam.isFastTransitionEnabled; |
| 2008 | pParam->RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff; |
| 2009 | pParam->nImmediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff; |
| 2010 | pParam->nRoamPrefer5GHz = pMac->roam.configParam.nRoamPrefer5GHz; |
| 2011 | pParam->nRoamIntraBand = pMac->roam.configParam.nRoamIntraBand; |
Srinivas Girigowda | ad34ca9 | 2013-10-22 10:54:29 -0700 | [diff] [blame] | 2012 | pParam->isWESModeEnabled = pMac->roam.configParam.isWESModeEnabled; |
Srinivas Girigowda | 6cf0b82 | 2013-06-27 14:00:20 -0700 | [diff] [blame] | 2013 | pParam->nProbes = pMac->roam.configParam.nProbes; |
| 2014 | pParam->nRoamScanHomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 2015 | #endif |
| 2016 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 2017 | pParam->isRoamOffloadScanEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled; |
| 2018 | pParam->bFastRoamInConIniFeatureEnabled = pMac->roam.configParam.bFastRoamInConIniFeatureEnabled; |
| 2019 | #endif |
| 2020 | #ifdef FEATURE_WLAN_LFR |
| 2021 | pParam->isFastRoamIniFeatureEnabled = pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
| 2022 | #endif |
| 2023 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2024 | #ifdef FEATURE_WLAN_ESE |
| 2025 | pParam->isEseIniFeatureEnabled = pMac->roam.configParam.isEseIniFeatureEnabled; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 2026 | #endif |
| 2027 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2028 | vos_mem_copy(&pParam->neighborRoamConfig, |
| 2029 | &pMac->roam.configParam.neighborRoamConfig, |
| 2030 | sizeof(tCsrNeighborRoamConfigParams)); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 2031 | { |
| 2032 | int i; |
| 2033 | smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
| 2034 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 2035 | { |
| 2036 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 2037 | } |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 2038 | } |
| 2039 | #endif |
| 2040 | |
Venkata Prathyusha Kuntupalli | f2695c1 | 2013-04-17 15:41:23 -0700 | [diff] [blame] | 2041 | pParam->enableTxLdpc = pMac->roam.configParam.txLdpcEnable; |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 2042 | |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 2043 | pParam->isAmsduSupportInAMPDU = pMac->roam.configParam.isAmsduSupportInAMPDU; |
Srinivas Girigowda | 41c7c5f | 2013-10-21 19:01:38 -0700 | [diff] [blame] | 2044 | pParam->nSelect5GHzMargin = pMac->roam.configParam.nSelect5GHzMargin; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 2045 | |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 2046 | pParam->isCoalesingInIBSSAllowed = |
| 2047 | pMac->roam.configParam.isCoalesingInIBSSAllowed; |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 2048 | pParam->allowDFSChannelRoam = |
| 2049 | pMac->roam.configParam.allowDFSChannelRoam; |
Abhishek Singh | de51a41 | 2014-05-20 19:17:26 +0530 | [diff] [blame] | 2050 | pParam->sendDeauthBeforeCon = pMac->roam.configParam.sendDeauthBeforeCon; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2051 | csrSetChannels(pMac, pParam); |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 2052 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 2053 | pParam->apHT40_24GEnabled = pMac->roam.configParam.apHT40_24GEnabled; |
| 2054 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2055 | |
| 2056 | status = eHAL_STATUS_SUCCESS; |
| 2057 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2058 | return (status); |
| 2059 | } |
| 2060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2061 | eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded) |
| 2062 | { |
| 2063 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 2064 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2065 | tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE; |
| 2066 | eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2067 | do |
| 2068 | { |
| 2069 | if(eCSR_BAND_24 == eBand) |
| 2070 | { |
| 2071 | if(CSR_IS_RADIO_A_ONLY(pMac)) break; |
| 2072 | if((eCSR_DOT11_MODE_11a & phyMode) || (eCSR_DOT11_MODE_11a_ONLY & phyMode)) break; |
| 2073 | } |
| 2074 | if(eCSR_BAND_5G == eBand) |
| 2075 | { |
| 2076 | if(CSR_IS_RADIO_BG_ONLY(pMac)) break; |
| 2077 | if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) || |
| 2078 | (eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 2079 | ) |
| 2080 | { |
| 2081 | break; |
| 2082 | } |
| 2083 | } |
| 2084 | if((0 == phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)) |
| 2085 | { |
| 2086 | newPhyMode = eCSR_DOT11_MODE_TAURUS; |
| 2087 | } |
| 2088 | else if(eCSR_DOT11_MODE_AUTO & phyMode) |
| 2089 | { |
| 2090 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 2091 | } |
| 2092 | else |
| 2093 | { |
| 2094 | //Check for dual band and higher capability first |
| 2095 | if(eCSR_DOT11_MODE_11n_ONLY & phyMode) |
| 2096 | { |
| 2097 | if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break; |
| 2098 | newPhyMode = eCSR_DOT11_MODE_11n_ONLY; |
| 2099 | } |
| 2100 | else if(eCSR_DOT11_MODE_11a_ONLY & phyMode) |
| 2101 | { |
| 2102 | if(eCSR_DOT11_MODE_11a_ONLY != phyMode) break; |
| 2103 | if(eCSR_BAND_24 == eBand) break; |
| 2104 | newPhyMode = eCSR_DOT11_MODE_11a_ONLY; |
| 2105 | eBand = eCSR_BAND_5G; |
| 2106 | } |
| 2107 | else if(eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 2108 | { |
| 2109 | if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break; |
| 2110 | if(eCSR_BAND_5G == eBand) break; |
| 2111 | newPhyMode = eCSR_DOT11_MODE_11g_ONLY; |
| 2112 | eBand = eCSR_BAND_24; |
| 2113 | } |
| 2114 | else if(eCSR_DOT11_MODE_11b_ONLY & phyMode) |
| 2115 | { |
| 2116 | if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break; |
| 2117 | if(eCSR_BAND_5G == eBand) break; |
| 2118 | newPhyMode = eCSR_DOT11_MODE_11b_ONLY; |
| 2119 | eBand = eCSR_BAND_24; |
| 2120 | } |
| 2121 | else if(eCSR_DOT11_MODE_11n & phyMode) |
| 2122 | { |
| 2123 | newPhyMode = eCSR_DOT11_MODE_11n; |
| 2124 | } |
| 2125 | else if(eCSR_DOT11_MODE_abg & phyMode) |
| 2126 | { |
| 2127 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 2128 | } |
| 2129 | else if(eCSR_DOT11_MODE_11a & phyMode) |
| 2130 | { |
| 2131 | if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode)) |
| 2132 | { |
| 2133 | if(eCSR_BAND_ALL == eBand) |
| 2134 | { |
| 2135 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 2136 | } |
| 2137 | else |
| 2138 | { |
| 2139 | //bad setting |
| 2140 | break; |
| 2141 | } |
| 2142 | } |
| 2143 | else |
| 2144 | { |
| 2145 | newPhyMode = eCSR_DOT11_MODE_11a; |
| 2146 | eBand = eCSR_BAND_5G; |
| 2147 | } |
| 2148 | } |
| 2149 | else if(eCSR_DOT11_MODE_11g & phyMode) |
| 2150 | { |
| 2151 | newPhyMode = eCSR_DOT11_MODE_11g; |
| 2152 | eBand = eCSR_BAND_24; |
| 2153 | } |
| 2154 | else if(eCSR_DOT11_MODE_11b & phyMode) |
| 2155 | { |
| 2156 | newPhyMode = eCSR_DOT11_MODE_11b; |
| 2157 | eBand = eCSR_BAND_24; |
| 2158 | } |
| 2159 | else |
| 2160 | { |
| 2161 | //We will never be here |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2162 | smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X"), phyMode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2163 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 2164 | } |
| 2165 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2166 | //Done validating |
| 2167 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2168 | //Now we need to check whether a restart is needed. |
| 2169 | if(eBand != pMac->roam.configParam.eBand) |
| 2170 | { |
| 2171 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 2172 | break; |
| 2173 | } |
| 2174 | if(newPhyMode != pMac->roam.configParam.phyMode) |
| 2175 | { |
| 2176 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 2177 | break; |
| 2178 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2179 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2180 | if(HAL_STATUS_SUCCESS(status)) |
| 2181 | { |
| 2182 | pMac->roam.configParam.eBand = eBand; |
| 2183 | pMac->roam.configParam.phyMode = newPhyMode; |
| 2184 | if(pfRestartNeeded) |
| 2185 | { |
| 2186 | *pfRestartNeeded = fRestartNeeded; |
| 2187 | } |
| 2188 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2189 | return (status); |
| 2190 | } |
| 2191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2192 | void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList ) |
| 2193 | { |
| 2194 | tANI_U8 Index; |
| 2195 | tANI_U8 cChannels; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2196 | // for dual band NICs, don't need to trim the channel list.... |
| 2197 | if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) ) |
| 2198 | { |
| 2199 | // 2.4 GHz band operation requires the channel list to be trimmed to |
| 2200 | // the 2.4 GHz channels only... |
| 2201 | if ( CSR_IS_24_BAND_ONLY( pMac ) ) |
| 2202 | { |
| 2203 | for( Index = 0, cChannels = 0; Index < pChannelList->numChannels; |
| 2204 | Index++ ) |
| 2205 | { |
| 2206 | if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) ) |
| 2207 | { |
| 2208 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 2209 | cChannels++; |
| 2210 | } |
| 2211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2212 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 2213 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 2214 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 2215 | // only if we need to. |
| 2216 | // |
| 2217 | // The amount of memory to clear is the number of channesl that we trimmed |
| 2218 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 2219 | |
| 2220 | if ( pChannelList->numChannels > cChannels ) |
| 2221 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2222 | vos_mem_set(&pChannelList->channelList[ cChannels ], |
| 2223 | sizeof( pChannelList->channelList[ 0 ] ) * |
| 2224 | ( pChannelList->numChannels - cChannels ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2225 | } |
| 2226 | |
| 2227 | pChannelList->numChannels = cChannels; |
| 2228 | } |
| 2229 | else if ( CSR_IS_5G_BAND_ONLY( pMac ) ) |
| 2230 | { |
| 2231 | for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ ) |
| 2232 | { |
| 2233 | if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) ) |
| 2234 | { |
| 2235 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 2236 | cChannels++; |
| 2237 | } |
| 2238 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2239 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 2240 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 2241 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 2242 | // only if we need to. |
| 2243 | // |
| 2244 | // The amount of memory to clear is the number of channesl that we trimmed |
| 2245 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 2246 | if ( pChannelList->numChannels > cChannels ) |
| 2247 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2248 | vos_mem_set(&pChannelList->channelList[ cChannels ], |
| 2249 | sizeof( pChannelList->channelList[ 0 ] ) * |
| 2250 | ( pChannelList->numChannels - cChannels ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2251 | } |
| 2252 | |
| 2253 | pChannelList->numChannels = cChannels; |
| 2254 | } |
| 2255 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2256 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2257 | #define INFRA_AP_DEFAULT_CHANNEL 6 |
| 2258 | eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum) |
| 2259 | { |
| 2260 | tANI_U8 index= 0; |
| 2261 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2262 | for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++) |
| 2263 | { |
| 2264 | if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){ |
| 2265 | status = eHAL_STATUS_SUCCESS; |
| 2266 | break; |
| 2267 | } |
| 2268 | } |
| 2269 | return status; |
| 2270 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2271 | |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2272 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2273 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac) |
| 2274 | { |
| 2275 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2276 | tANI_U8 num20MHzChannelsFound = 0; |
| 2277 | VOS_STATUS vosStatus; |
| 2278 | tANI_U8 Index = 0; |
| 2279 | tANI_U8 num40MHzChannelsFound = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2280 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2281 | |
| 2282 | //TODO: this interface changed to include the 40MHz channel list |
| 2283 | // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation |
| 2284 | // Read the scan channel list (including the power limit) from EEPROM |
| 2285 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 2286 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 2287 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 2288 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2289 | smsLog( pMac, LOGE, FL("failed to get channels ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2290 | status = eHAL_STATUS_FAILURE; |
| 2291 | } |
| 2292 | else |
| 2293 | { |
| 2294 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 2295 | { |
| 2296 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2297 | } |
| 2298 | pMac->scan.numChannelsDefault = num20MHzChannelsFound; |
| 2299 | // Move the channel list to the global data |
| 2300 | // structure -- this will be used as the scan list |
| 2301 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 2302 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2303 | pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2304 | } |
| 2305 | pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound; |
| 2306 | if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2307 | { |
| 2308 | num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2309 | } |
| 2310 | for ( Index = 0; Index < num40MHzChannelsFound; Index++) |
| 2311 | { |
| 2312 | pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId; |
| 2313 | } |
| 2314 | pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound; |
| 2315 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2316 | return (status); |
| 2317 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2318 | eHalStatus csrInitChannelList( tHalHandle hHal ) |
| 2319 | { |
| 2320 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2321 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2322 | csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels); |
| 2323 | csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 2324 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_FALSE); |
| 2325 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2326 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2327 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Atul Mittal | b849d5a | 2014-07-29 12:08:39 +0530 | [diff] [blame] | 2328 | limInitOperatingClasses(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2329 | return (status); |
| 2330 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2331 | eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, |
| 2332 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 2333 | { |
| 2334 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2335 | tCsr11dinfo *ps11dinfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2336 | ps11dinfo = &pUpdateConfigParam->Csr11dinfo; |
| 2337 | status = CsrInit11dInfo(pMac, ps11dinfo); |
| 2338 | return status; |
| 2339 | } |
| 2340 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2341 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2342 | { |
| 2343 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2344 | tANI_U8 index; |
| 2345 | tANI_U32 count=0; |
| 2346 | tSirMacChanInfo *pChanInfo; |
| 2347 | tSirMacChanInfo *pChanInfoStart; |
| 2348 | tANI_BOOLEAN applyConfig = TRUE; |
| 2349 | |
Mihir Shete | bc866f6 | 2014-02-13 16:08:53 +0530 | [diff] [blame] | 2350 | pMac->scan.currentCountryRSSI = -128; |
| 2351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2352 | if(!ps11dinfo) |
| 2353 | { |
| 2354 | return (status); |
| 2355 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2356 | if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) |
| 2357 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2358 | pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels; |
| 2359 | vos_mem_copy(pMac->scan.base20MHzChannels.channelList, |
| 2360 | ps11dinfo->Channels.channelList, |
| 2361 | ps11dinfo->Channels.numChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2362 | } |
| 2363 | else |
| 2364 | { |
| 2365 | //No change |
| 2366 | return (eHAL_STATUS_SUCCESS); |
| 2367 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2368 | //legacy maintenance |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2369 | |
| 2370 | vos_mem_copy(pMac->scan.countryCodeDefault, ps11dinfo->countryCode, |
| 2371 | WNI_CFG_COUNTRY_CODE_LEN); |
| 2372 | |
| 2373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2374 | //Tush: at csropen get this initialized with default, during csr reset if this |
| 2375 | // already set with some value no need initilaize with default again |
| 2376 | if(0 == pMac->scan.countryCodeCurrent[0]) |
| 2377 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2378 | vos_mem_copy(pMac->scan.countryCodeCurrent, ps11dinfo->countryCode, |
| 2379 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2380 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2381 | // need to add the max power channel list |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2382 | pChanInfo = vos_mem_malloc(sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2383 | if (pChanInfo != NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2384 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2385 | vos_mem_set(pChanInfo, |
| 2386 | sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN , |
| 2387 | 0); |
| 2388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2389 | pChanInfoStart = pChanInfo; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2390 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2391 | { |
| 2392 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2393 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2394 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2395 | pChanInfo++; |
| 2396 | count++; |
| 2397 | } |
| 2398 | if(count) |
| 2399 | { |
| 2400 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2401 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2402 | vos_mem_free(pChanInfoStart); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2403 | } |
| 2404 | //Only apply them to CFG when not in STOP state. Otherwise they will be applied later |
| 2405 | if( HAL_STATUS_SUCCESS(status) ) |
| 2406 | { |
| 2407 | for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ ) |
| 2408 | { |
| 2409 | if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index)) |
| 2410 | { |
| 2411 | applyConfig = FALSE; |
| 2412 | } |
| 2413 | } |
| 2414 | |
| 2415 | if(TRUE == applyConfig) |
| 2416 | { |
| 2417 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2418 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2419 | } |
| 2420 | |
| 2421 | } |
| 2422 | return (status); |
| 2423 | } |
| 2424 | /* Initialize the Channel + Power List in the local cache and in the CFG */ |
| 2425 | eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2426 | { |
| 2427 | tANI_U8 index; |
| 2428 | tANI_U32 count=0; |
| 2429 | tSirMacChanInfo *pChanInfo; |
| 2430 | tSirMacChanInfo *pChanInfoStart; |
| 2431 | |
| 2432 | if(!ps11dinfo || !pMac) |
| 2433 | { |
| 2434 | return eHAL_STATUS_FAILURE; |
| 2435 | } |
| 2436 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2437 | pChanInfo = vos_mem_malloc(sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2438 | if (pChanInfo != NULL) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2439 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2440 | vos_mem_set(pChanInfo, |
| 2441 | sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN, |
| 2442 | 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2443 | pChanInfoStart = pChanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2444 | |
| 2445 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2446 | { |
| 2447 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2448 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2449 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2450 | pChanInfo++; |
| 2451 | count++; |
| 2452 | } |
| 2453 | if(count) |
| 2454 | { |
| 2455 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2456 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2457 | vos_mem_free(pChanInfoStart); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2458 | } |
| 2459 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2460 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2461 | } |
| 2462 | |
| 2463 | //pCommand may be NULL |
| 2464 | //Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL. |
| 2465 | void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason) |
| 2466 | { |
| 2467 | tListElem *pEntry, *pNextEntry; |
| 2468 | tSmeCmd *pDupCommand; |
| 2469 | tDblLinkList localList; |
| 2470 | |
| 2471 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 2472 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 2473 | { |
| 2474 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 2475 | return; |
| 2476 | } |
| 2477 | csrLLLock( &pMac->sme.smeCmdPendingList ); |
| 2478 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK ); |
| 2479 | while( pEntry ) |
| 2480 | { |
| 2481 | pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 2482 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2483 | // Remove the previous command if.. |
| 2484 | // - the new roam command is for the same RoamReason... |
| 2485 | // - the new roam command is a NewProfileList. |
| 2486 | // - the new roam command is a Forced Dissoc |
| 2487 | // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID). |
| 2488 | if ( |
| 2489 | (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) && |
| 2490 | ((pCommand->command == pDupCommand->command) && |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 2491 | /* This peermac check is requried for Softap/GO scenarios |
| 2492 | * For STA scenario below OR check will suffice as pCommand will |
| 2493 | * always be NULL for STA scenarios |
| 2494 | */ |
| 2495 | (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] | 2496 | (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason || |
| 2497 | eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason || |
| 2498 | eCsrHddIssued == pCommand->u.roamCmd.roamReason))) |
| 2499 | || |
| 2500 | //below the pCommand is NULL |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2501 | ( (sessionId == pDupCommand->sessionId) && |
| 2502 | (eSmeCommandRoam == pDupCommand->command) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2503 | ((eCsrForcedDisassoc == eRoamReason) || |
| 2504 | (eCsrHddIssued == eRoamReason)) |
| 2505 | ) |
| 2506 | ) |
| 2507 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2508 | smsLog(pMac, LOGW, FL(" roamReason = %d"), pDupCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2509 | // Remove the 'stale' roam command from the pending list... |
| 2510 | if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK )) |
| 2511 | { |
| 2512 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 2513 | } |
| 2514 | } |
| 2515 | pEntry = pNextEntry; |
| 2516 | } |
| 2517 | csrLLUnlock( &pMac->sme.smeCmdPendingList ); |
| 2518 | |
| 2519 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 2520 | { |
| 2521 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 2522 | //Tell caller that the command is cancelled |
| 2523 | csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId, |
| 2524 | eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE); |
| 2525 | csrReleaseCommandRoam(pMac, pDupCommand); |
| 2526 | } |
| 2527 | csrLLClose(&localList); |
| 2528 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2529 | eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, |
| 2530 | tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2) |
| 2531 | { |
| 2532 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2533 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2534 | WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type); |
| 2535 | #endif |
| 2536 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2537 | if( CSR_IS_SESSION_VALID( pMac, sessionId) ) |
| 2538 | { |
| 2539 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2540 | } |
| 2541 | else |
| 2542 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2543 | smsLog(pMac, LOGE, "Session ID:%d is not valid", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2544 | VOS_ASSERT(0); |
| 2545 | return eHAL_STATUS_FAILURE; |
| 2546 | } |
krunal soni | 587bf01 | 2014-02-04 12:35:11 -0800 | [diff] [blame] | 2547 | |
| 2548 | if (eANI_BOOLEAN_FALSE == pSession->sessionActive) |
| 2549 | { |
| 2550 | smsLog(pMac, LOG1, "%s Session is not Active", __func__); |
| 2551 | return eHAL_STATUS_FAILURE; |
| 2552 | } |
krunal soni | 7f7d2c9 | 2014-02-06 15:08:43 -0800 | [diff] [blame] | 2553 | |
krunal soni | 587bf01 | 2014-02-04 12:35:11 -0800 | [diff] [blame] | 2554 | smsLog(pMac, LOG4, "Recieved RoamCmdStatus %d with Roam Result %d", u1, u2); |
| 2555 | |
krunal soni | 7f7d2c9 | 2014-02-06 15:08:43 -0800 | [diff] [blame] | 2556 | if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2557 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2558 | 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] | 2559 | } |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 2560 | if ((u1 == eCSR_ROAM_FT_REASSOC_FAILED) && (pSession->bRefAssocStartCnt)) { |
| 2561 | /* |
| 2562 | * Decrement bRefAssocStartCnt for FT reassoc failure. |
| 2563 | * Reason: For FT reassoc failures, we first call |
| 2564 | * csrRoamCallCallback before notifying a failed roam |
| 2565 | * completion through csrRoamComplete. The latter in |
| 2566 | * turn calls csrRoamProcessResults which tries to |
| 2567 | * once again call csrRoamCallCallback if bRefAssocStartCnt |
| 2568 | * is non-zero. Since this is redundant for FT reassoc |
| 2569 | * failure, decrement bRefAssocStartCnt. |
| 2570 | */ |
| 2571 | pSession->bRefAssocStartCnt--; |
| 2572 | } |
| 2573 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2574 | if(NULL != pSession->callback) |
| 2575 | { |
| 2576 | if( pRoamInfo ) |
| 2577 | { |
| 2578 | pRoamInfo->sessionId = (tANI_U8)sessionId; |
| 2579 | } |
| 2580 | |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 2581 | /* avoid holding the global lock when making the roaming callback, original change came |
| 2582 | from a raised CR (CR304874). Since this callback is in HDD a potential deadlock |
| 2583 | is possible on other OS ports where the callback may need to take locks to protect |
| 2584 | HDD state |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2585 | UPDATE : revert this change but keep the comments here. Need to revisit as there are callbacks |
| 2586 | that may actually depend on the lock being held */ |
| 2587 | // TODO: revisit: sme_ReleaseGlobalLock( &pMac->sme ); |
| 2588 | status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2); |
| 2589 | // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme ); |
| 2590 | } |
| 2591 | //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 2592 | // eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, |
| 2593 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2594 | vos_mem_set(&connectionStatus, |
| 2595 | sizeof(vos_event_wlan_status_payload_type), 0); |
| 2596 | |
krunal soni | 7f7d2c9 | 2014-02-06 15:08:43 -0800 | [diff] [blame] | 2597 | if((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) && (eCSR_ROAM_RESULT_ASSOCIATED == u2) && pRoamInfo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2598 | { |
| 2599 | connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 2600 | connectionStatus.bssType = pRoamInfo->u.pConnectedProfile->BSSType; |
| 2601 | if(NULL != pRoamInfo->pBssDesc) |
| 2602 | { |
| 2603 | connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1); |
| 2604 | connectionStatus.channel = pRoamInfo->pBssDesc->channelId; |
| 2605 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2606 | connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection; |
| 2607 | connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType); |
| 2608 | connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2609 | vos_mem_copy(connectionStatus.ssid, |
| 2610 | pRoamInfo->u.pConnectedProfile->SSID.ssId, 6); |
| 2611 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2612 | connectionStatus.reason = eCSR_REASON_UNSPECIFIED; |
| 2613 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2614 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2615 | if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2)) |
| 2616 | { |
| 2617 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2618 | connectionStatus.reason = eCSR_REASON_MIC_ERROR; |
| 2619 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2620 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2621 | if(eCSR_ROAM_RESULT_FORCED == u2) |
| 2622 | { |
| 2623 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2624 | connectionStatus.reason = eCSR_REASON_USER_REQUESTED; |
| 2625 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2626 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2627 | if(eCSR_ROAM_RESULT_DISASSOC_IND == u2) |
| 2628 | { |
| 2629 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2630 | connectionStatus.reason = eCSR_REASON_DISASSOC; |
| 2631 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2632 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2633 | if(eCSR_ROAM_RESULT_DEAUTH_IND == u2) |
| 2634 | { |
| 2635 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2636 | connectionStatus.reason = eCSR_REASON_DEAUTH; |
| 2637 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2638 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2639 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2640 | |
| 2641 | return (status); |
| 2642 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2643 | // Returns whether handoff is currently in progress or not |
| 2644 | tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 2645 | { |
| 2646 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 2647 | return csrNeighborRoamIsHandoffInProgress(pMac); |
| 2648 | #else |
| 2649 | return eANI_BOOLEAN_FALSE; |
| 2650 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2651 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2652 | eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2653 | eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure ) |
| 2654 | { |
| 2655 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2656 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2657 | tANI_U16 reasonCode; |
| 2658 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2659 | |
| 2660 | if(!pSession) |
| 2661 | { |
| 2662 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2663 | return eHAL_STATUS_FAILURE; |
| 2664 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2665 | |
| 2666 | //Restore AC weight in case we change it |
| 2667 | if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 2668 | { |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 2669 | 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] | 2670 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 2671 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 2672 | } |
| 2673 | |
| 2674 | if ( fMICFailure ) |
| 2675 | { |
| 2676 | reasonCode = eSIR_MAC_MIC_FAILURE_REASON; |
| 2677 | } |
| 2678 | else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF) |
| 2679 | { |
| 2680 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2681 | } |
| 2682 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2683 | { |
| 2684 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 2685 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2686 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2687 | if ( (csrRoamIsHandoffInProgress(pMac)) && |
| 2688 | (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)) |
| 2689 | { |
| 2690 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2691 | vos_mem_copy(&bssId, |
| 2692 | pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, |
| 2693 | sizeof(tSirMacAddr)); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2694 | } |
| 2695 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2696 | #endif |
| 2697 | if(pSession->pConnectBssDesc) |
| 2698 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2699 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2700 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2701 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2702 | |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 2703 | smsLog(pMac, LOG2, FL("CSR Attempting to Disassociate Bssid="MAC_ADDRESS_STR |
| 2704 | " subState = %s reason=%d"), |
| 2705 | MAC_ADDR_ARRAY(bssId), macTraceGetcsrRoamSubState(NewSubstate), |
| 2706 | reasonCode); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 2707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2708 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2709 | |
| 2710 | status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode ); |
| 2711 | |
| 2712 | if(HAL_STATUS_SUCCESS(status)) |
| 2713 | { |
| 2714 | csrRoamLinkDown(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2715 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2716 | //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO |
| 2717 | if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate) |
| 2718 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2719 | //notify QoS module that disassoc happening |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2720 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 2721 | } |
| 2722 | #endif |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2723 | } |
| 2724 | else |
| 2725 | { |
| 2726 | smsLog(pMac, LOGW, FL("csrSendMBDisassocReqMsg failed with status %d"), status); |
| 2727 | } |
| 2728 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2729 | return (status); |
| 2730 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2731 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2732 | /* --------------------------------------------------------------------------- |
| 2733 | \fn csrRoamIssueDisassociateStaCmd |
| 2734 | \brief csr function that HDD calls to disassociate a associated station |
| 2735 | \param sessionId - session Id for Soft AP |
| 2736 | \param pPeerMacAddr - MAC of associated station to delete |
| 2737 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2738 | \return eHalStatus |
| 2739 | ---------------------------------------------------------------------------*/ |
| 2740 | eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, |
| 2741 | tANI_U32 sessionId, |
| 2742 | tANI_U8 *pPeerMacAddr, |
| 2743 | tANI_U32 reason) |
| 2744 | { |
| 2745 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2746 | tSmeCmd *pCommand; |
| 2747 | |
| 2748 | do |
| 2749 | { |
| 2750 | pCommand = csrGetCommandBuffer( pMac ); |
| 2751 | if ( !pCommand ) |
| 2752 | { |
| 2753 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2754 | status = eHAL_STATUS_RESOURCES; |
| 2755 | break; |
| 2756 | } |
| 2757 | pCommand->command = eSmeCommandRoam; |
| 2758 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2759 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta; |
| 2760 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2761 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2762 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2763 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2764 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2765 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2766 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2767 | } |
| 2768 | }while(0); |
| 2769 | |
| 2770 | return status; |
| 2771 | } |
| 2772 | |
| 2773 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2774 | /* --------------------------------------------------------------------------- |
| 2775 | \fn csrRoamIssueDeauthSta |
| 2776 | \brief csr function that HDD calls to delete a associated station |
| 2777 | \param sessionId - session Id for Soft AP |
Hanumantha Reddy Pothula | f57da15 | 2014-10-31 13:02:08 +0530 | [diff] [blame] | 2778 | \param pDelStaParams- Pointer to parameters of the station to deauthenticate |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2779 | \return eHalStatus |
| 2780 | ---------------------------------------------------------------------------*/ |
| 2781 | eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, |
Hanumantha Reddy Pothula | f57da15 | 2014-10-31 13:02:08 +0530 | [diff] [blame] | 2782 | tANI_U32 sessionId, |
| 2783 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2784 | { |
| 2785 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2786 | tSmeCmd *pCommand; |
| 2787 | |
| 2788 | do |
| 2789 | { |
| 2790 | pCommand = csrGetCommandBuffer( pMac ); |
| 2791 | if ( !pCommand ) |
| 2792 | { |
| 2793 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2794 | status = eHAL_STATUS_RESOURCES; |
| 2795 | break; |
| 2796 | } |
| 2797 | pCommand->command = eSmeCommandRoam; |
| 2798 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2799 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
Hanumantha Reddy Pothula | f57da15 | 2014-10-31 13:02:08 +0530 | [diff] [blame] | 2800 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pDelStaParams->peerMacAddr, |
| 2801 | sizeof(tSirMacAddr)); |
| 2802 | pCommand->u.roamCmd.reason = |
| 2803 | (tSirMacReasonCodes)pDelStaParams->reason_code; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2804 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2805 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2806 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2807 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2808 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2809 | } |
| 2810 | }while(0); |
| 2811 | |
| 2812 | return status; |
| 2813 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2814 | eHalStatus |
| 2815 | csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2816 | tANI_BOOLEAN bEnable ) |
| 2817 | { |
| 2818 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2819 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2820 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2821 | if (!pSession) |
| 2822 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2823 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2824 | return (status); |
| 2825 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2826 | if (pSession->pConnectBssDesc) |
| 2827 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2828 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2829 | } |
| 2830 | else |
| 2831 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2832 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2833 | return (status); |
| 2834 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2835 | smsLog( pMac, LOG2, "CSR issuing tkip counter measures for Bssid = "MAC_ADDRESS_STR", Enable = %d", |
| 2836 | MAC_ADDR_ARRAY(bssId), bEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2837 | status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId ); |
| 2838 | return (status); |
| 2839 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2840 | eHalStatus |
| 2841 | csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2842 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2843 | void *pfnSapEventCallback, v_U8_t *pAssocStasBuf ) |
| 2844 | { |
| 2845 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2846 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2847 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2848 | if (!pSession) |
| 2849 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2850 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2851 | return (status); |
| 2852 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2853 | if(pSession->pConnectBssDesc) |
| 2854 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2855 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2856 | } |
| 2857 | else |
| 2858 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2859 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2860 | return (status); |
| 2861 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2862 | smsLog( pMac, LOG2, "CSR getting associated stations for Bssid = "MAC_ADDRESS_STR, |
| 2863 | MAC_ADDR_ARRAY(bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2864 | status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2865 | return (status); |
| 2866 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2867 | eHalStatus |
| 2868 | csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2869 | void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac ) |
| 2870 | { |
| 2871 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2872 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2873 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2874 | |
| 2875 | if (!pSession) |
| 2876 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2877 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2878 | return (status); |
| 2879 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2880 | if(pSession->pConnectBssDesc) |
| 2881 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2882 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2883 | } |
| 2884 | else |
| 2885 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2886 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2887 | return (status); |
| 2888 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2889 | smsLog( pMac, LOG2, "CSR getting WPS Session Overlap for Bssid = "MAC_ADDRESS_STR, |
| 2890 | MAC_ADDR_ARRAY(bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2891 | |
| 2892 | status = csrSendMBGetWPSPBCSessions( pMac, sessionId, bssId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2893 | |
| 2894 | return (status); |
| 2895 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2896 | eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 2897 | { |
| 2898 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2899 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2900 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2901 | |
| 2902 | if (!pSession) |
| 2903 | { |
| 2904 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2905 | return eHAL_STATUS_FAILURE; |
| 2906 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2907 | |
| 2908 | if(pSession->pConnectBssDesc) |
| 2909 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2910 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2911 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 2912 | smsLog( pMac, LOG2, "CSR Attempting to Deauth Bssid= "MAC_ADDRESS_STR, |
| 2913 | MAC_ADDR_ARRAY(bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2914 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2915 | |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2916 | status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON ); |
Mukul Sharma | 4504918 | 2014-06-17 23:34:10 +0530 | [diff] [blame] | 2917 | if(HAL_STATUS_SUCCESS(status)) |
| 2918 | { |
| 2919 | csrRoamLinkDown(pMac, sessionId); |
| 2920 | } |
| 2921 | else |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2922 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 2923 | smsLog(pMac, LOGE, FL("csrSendMBDeauthReqMsg failed with status %d Session ID: %d" |
| 2924 | MAC_ADDRESS_STR ), status, sessionId, MAC_ADDR_ARRAY(bssId)); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2925 | } |
| 2926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2927 | return (status); |
| 2928 | } |
| 2929 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2930 | eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc ) |
| 2931 | { |
| 2932 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2933 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2934 | tANI_U32 size; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2935 | |
| 2936 | if(!pSession) |
| 2937 | { |
| 2938 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2939 | return eHAL_STATUS_FAILURE; |
| 2940 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2941 | |
| 2942 | // If no BSS description was found in this connection (happens with start IBSS), then |
| 2943 | // nix the BSS description that we keep around for the connected BSS) and get out... |
| 2944 | if(NULL == pBssDesc) |
| 2945 | { |
| 2946 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2947 | } |
| 2948 | else |
| 2949 | { |
| 2950 | size = pBssDesc->length + sizeof( pBssDesc->length ); |
| 2951 | if(NULL != pSession->pConnectBssDesc) |
| 2952 | { |
| 2953 | if(((pSession->pConnectBssDesc->length) + sizeof(pSession->pConnectBssDesc->length)) < size) |
| 2954 | { |
| 2955 | //not enough room for the new BSS, pMac->roam.pConnectBssDesc is freed inside |
| 2956 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2957 | } |
| 2958 | } |
| 2959 | if(NULL == pSession->pConnectBssDesc) |
| 2960 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2961 | pSession->pConnectBssDesc = vos_mem_malloc(size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2962 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2963 | if (NULL == pSession->pConnectBssDesc) |
| 2964 | status = eHAL_STATUS_FAILURE; |
| 2965 | else |
| 2966 | vos_mem_copy(pSession->pConnectBssDesc, pBssDesc, size); |
| 2967 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2968 | return (status); |
| 2969 | } |
| 2970 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2971 | eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2972 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 2973 | tDot11fBeaconIEs *pIes) |
| 2974 | { |
| 2975 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2976 | eCsrCfgDot11Mode cfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2977 | VOS_ASSERT( pIes != NULL ); |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 2978 | if (pIes == NULL) |
| 2979 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2981 | do |
| 2982 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2983 | vos_mem_copy(&pBssConfig->BssCap, &pBssDesc->capabilityInfo, |
| 2984 | sizeof(tSirMacCapabilityInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2985 | //get qos |
| 2986 | pBssConfig->qosType = csrGetQoSFromBssDesc(pMac, pBssDesc, pIes); |
| 2987 | //get SSID |
| 2988 | if(pIes->SSID.present) |
| 2989 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2990 | 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] | 2991 | pBssConfig->SSID.length = pIes->SSID.num_ssid; |
| 2992 | } |
| 2993 | else |
| 2994 | pBssConfig->SSID.length = 0; |
| 2995 | if(csrIsNULLSSID(pBssConfig->SSID.ssId, pBssConfig->SSID.length)) |
| 2996 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2997 | smsLog(pMac, LOGW, " BSS desc SSID is a wildcard"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2998 | //Return failed if profile doesn't have an SSID either. |
| 2999 | if(pProfile->SSIDs.numOfSSIDs == 0) |
| 3000 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3001 | smsLog(pMac, LOGW, " Both BSS desc and profile doesn't have SSID"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3002 | status = eHAL_STATUS_FAILURE; |
| 3003 | break; |
| 3004 | } |
| 3005 | } |
| 3006 | if(CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId)) |
| 3007 | { |
| 3008 | pBssConfig->eBand = eCSR_BAND_5G; |
| 3009 | } |
| 3010 | else |
| 3011 | { |
| 3012 | pBssConfig->eBand = eCSR_BAND_24; |
| 3013 | } |
| 3014 | //phymode |
| 3015 | if(csrIsPhyModeMatch( pMac, pProfile->phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes )) |
| 3016 | { |
| 3017 | pBssConfig->uCfgDot11Mode = cfgDot11Mode; |
| 3018 | } |
| 3019 | else |
| 3020 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3021 | smsLog(pMac, LOGW, " Can not find match phy mode"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3022 | //force it |
| 3023 | if(eCSR_BAND_24 == pBssConfig->eBand) |
| 3024 | { |
| 3025 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 3026 | } |
| 3027 | else |
| 3028 | { |
| 3029 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 3030 | } |
| 3031 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3032 | //Qos |
| 3033 | if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && |
| 3034 | (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) |
| 3035 | { |
| 3036 | //Joining BSS is not 11n capable and WMM is disabled on client. |
| 3037 | //Disable QoS and WMM |
| 3038 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 3039 | } |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 3040 | |
| 3041 | if (((pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N) || |
Pratik Bhalgat | 8d46164 | 2012-11-22 16:55:42 +0530 | [diff] [blame] | 3042 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC)) && |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 3043 | ((pBssConfig->qosType != eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP) || |
| 3044 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_HCF) || |
| 3045 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_eDCF) )) |
| 3046 | { |
| 3047 | //Joining BSS is 11n capable and WMM is disabled on AP. |
| 3048 | //Assume all HT AP's are QOS AP's and enable WMM |
| 3049 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 3050 | } |
| 3051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3052 | //auth type |
| 3053 | switch( pProfile->negotiatedAuthType ) |
| 3054 | { |
| 3055 | default: |
| 3056 | case eCSR_AUTH_TYPE_WPA: |
| 3057 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 3058 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3059 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3060 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 3061 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3062 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3063 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 3064 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3065 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3066 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 3067 | break; |
| 3068 | } |
| 3069 | //short slot time |
| 3070 | if( eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode ) |
| 3071 | { |
| 3072 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 3073 | } |
| 3074 | else |
| 3075 | { |
| 3076 | pBssConfig->uShortSlotTime = 0; |
| 3077 | } |
| 3078 | if(pBssConfig->BssCap.ibss) |
| 3079 | { |
| 3080 | //We don't support 11h on IBSS |
| 3081 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 3082 | } |
| 3083 | else |
| 3084 | { |
| 3085 | pBssConfig->f11hSupport = pMac->roam.configParam.Is11hSupportEnabled; |
| 3086 | } |
| 3087 | //power constraint |
| 3088 | pBssConfig->uPowerLimit = csrGet11hPowerConstraint(pMac, &pIes->PowerConstraints); |
| 3089 | //heartbeat |
| 3090 | if ( CSR_IS_11A_BSS( pBssDesc ) ) |
| 3091 | { |
| 3092 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 3093 | } |
| 3094 | else |
| 3095 | { |
| 3096 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 3097 | } |
| 3098 | //Join timeout |
| 3099 | // 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] | 3100 | // be 10 x the BeaconInterval. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3101 | if ( pBssDesc->beaconInterval ) |
| 3102 | { |
| 3103 | //Make sure it is bigger than the minimal |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3104 | 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] | 3105 | } |
| 3106 | else |
| 3107 | { |
| 3108 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 3109 | } |
| 3110 | //validate CB |
| 3111 | pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes); |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3112 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3113 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3114 | return (status); |
| 3115 | } |
| 3116 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3117 | static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 3118 | tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc) |
| 3119 | { |
| 3120 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3121 | tANI_U8 operationChannel = 0; |
| 3122 | tANI_U8 qAPisEnabled = FALSE; |
| 3123 | //SSID |
| 3124 | pBssConfig->SSID.length = 0; |
| 3125 | if(pProfile->SSIDs.numOfSSIDs) |
| 3126 | { |
| 3127 | //only use the first one |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3128 | vos_mem_copy(&pBssConfig->SSID, &pProfile->SSIDs.SSIDList[0].SSID, |
| 3129 | sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3130 | } |
| 3131 | else |
| 3132 | { |
| 3133 | //SSID must present |
| 3134 | return eHAL_STATUS_FAILURE; |
| 3135 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3136 | //Settomg up the capabilities |
| 3137 | if( csrIsBssTypeIBSS(pProfile->BSSType) ) |
| 3138 | { |
| 3139 | pBssConfig->BssCap.ibss = 1; |
| 3140 | } |
| 3141 | else |
| 3142 | { |
| 3143 | pBssConfig->BssCap.ess = 1; |
| 3144 | } |
| 3145 | if( eCSR_ENCRYPT_TYPE_NONE != pProfile->EncryptionType.encryptionType[0] ) |
| 3146 | { |
| 3147 | pBssConfig->BssCap.privacy = 1; |
| 3148 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3149 | pBssConfig->eBand = pMac->roam.configParam.eBand; |
| 3150 | //phymode |
| 3151 | if(pProfile->ChannelInfo.ChannelList) |
| 3152 | { |
| 3153 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3154 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3155 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, |
| 3156 | &pBssConfig->eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3157 | //QOS |
| 3158 | //Is this correct to always set to this //*** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3159 | if ( pBssConfig->BssCap.ess == 1 ) |
| 3160 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3161 | /*For Softap case enable WMM*/ |
| 3162 | if(CSR_IS_INFRA_AP(pProfile) && (eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode )){ |
| 3163 | qAPisEnabled = TRUE; |
| 3164 | } |
| 3165 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3166 | if (csrRoamGetQosInfoFromBss(pMac, pBssDesc) == eHAL_STATUS_SUCCESS) { |
| 3167 | qAPisEnabled = TRUE; |
| 3168 | } else { |
| 3169 | qAPisEnabled = FALSE; |
| 3170 | } |
| 3171 | } else { |
| 3172 | qAPisEnabled = TRUE; |
| 3173 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3174 | if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) || |
| 3175 | (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) || |
| 3176 | ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS |
| 3177 | ) |
| 3178 | { |
| 3179 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 3180 | } else { |
| 3181 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 3182 | } |
| 3183 | |
| 3184 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 3185 | switch( pProfile->AuthType.authType[0] ) //Take the preferred Auth type. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3186 | { |
| 3187 | default: |
| 3188 | case eCSR_AUTH_TYPE_WPA: |
| 3189 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 3190 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3191 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3192 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 3193 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3194 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3195 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 3196 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3197 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3198 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 3199 | break; |
| 3200 | } |
| 3201 | //short slot time |
| 3202 | if( WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode ) |
| 3203 | { |
| 3204 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 3205 | } |
| 3206 | else |
| 3207 | { |
| 3208 | pBssConfig->uShortSlotTime = 0; |
| 3209 | } |
| 3210 | //power constraint. We don't support 11h on IBSS |
| 3211 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 3212 | pBssConfig->uPowerLimit = 0; |
| 3213 | //heartbeat |
| 3214 | if ( eCSR_BAND_5G == pBssConfig->eBand ) |
| 3215 | { |
| 3216 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 3217 | } |
| 3218 | else |
| 3219 | { |
| 3220 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 3221 | } |
| 3222 | //Join timeout |
| 3223 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3224 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3225 | return (status); |
| 3226 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3227 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc) |
| 3228 | { |
| 3229 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3230 | tDot11fBeaconIEs *pIes = NULL; |
| 3231 | |
| 3232 | do |
| 3233 | { |
| 3234 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 3235 | { |
| 3236 | //err msg |
| 3237 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3238 | "csrRoamGetQosInfoFromBss() failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3239 | break; |
| 3240 | } |
| 3241 | //check if the AP is QAP & it supports APSD |
| 3242 | if( CSR_IS_QOS_BSS(pIes) ) |
| 3243 | { |
Kiet Lam | b537cfb | 2013-11-07 12:56:49 +0530 | [diff] [blame] | 3244 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3245 | } |
| 3246 | } while (0); |
Kiet Lam | b537cfb | 2013-11-07 12:56:49 +0530 | [diff] [blame] | 3247 | |
| 3248 | if (NULL != pIes) |
| 3249 | { |
| 3250 | vos_mem_free(pIes); |
| 3251 | } |
| 3252 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3253 | return status; |
| 3254 | } |
| 3255 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3256 | void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy ) |
| 3257 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3258 | // !! Note: the only difference between this function and the csrSetCfgPrivacyFromProfile() is the |
| 3259 | // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. |
| 3260 | // See !!Note: below in this function... |
| 3261 | tANI_U32 PrivacyEnabled = 0; |
| 3262 | tANI_U32 RsnEnabled = 0; |
| 3263 | tANI_U32 WepDefaultKeyId = 0; |
| 3264 | tANI_U32 WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; /* default 40 bits */ |
| 3265 | tANI_U32 Key0Length = 0; |
| 3266 | tANI_U32 Key1Length = 0; |
| 3267 | tANI_U32 Key2Length = 0; |
| 3268 | tANI_U32 Key3Length = 0; |
| 3269 | |
| 3270 | // Reserve for the biggest key |
| 3271 | tANI_U8 Key0[ WNI_CFG_WEP_DEFAULT_KEY_1_LEN ]; |
| 3272 | tANI_U8 Key1[ WNI_CFG_WEP_DEFAULT_KEY_2_LEN ]; |
| 3273 | tANI_U8 Key2[ WNI_CFG_WEP_DEFAULT_KEY_3_LEN ]; |
| 3274 | tANI_U8 Key3[ WNI_CFG_WEP_DEFAULT_KEY_4_LEN ]; |
| 3275 | |
| 3276 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 3277 | { |
| 3278 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3279 | |
| 3280 | // for NO encryption, turn off Privacy and Rsn. |
| 3281 | PrivacyEnabled = 0; |
| 3282 | RsnEnabled = 0; |
| 3283 | |
| 3284 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3285 | |
| 3286 | // clear out the WEP keys that may be hanging around. |
| 3287 | Key0Length = 0; |
| 3288 | Key1Length = 0; |
| 3289 | Key2Length = 0; |
| 3290 | Key3Length = 0; |
| 3291 | |
| 3292 | break; |
| 3293 | |
| 3294 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3295 | case eCSR_ENCRYPT_TYPE_WEP40: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3296 | |
| 3297 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3298 | PrivacyEnabled = 1; |
| 3299 | RsnEnabled = 0; |
| 3300 | |
| 3301 | // Set the Wep default key ID. |
| 3302 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3303 | // Wep key size if 5 bytes (40 bits). |
| 3304 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3305 | |
| 3306 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3307 | if ( pProfile->Keys.KeyLength[0] ) |
| 3308 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3309 | vos_mem_copy(Key0, pProfile->Keys.KeyMaterial[0], |
| 3310 | WNI_CFG_WEP_KEY_LENGTH_5); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3311 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3312 | } |
| 3313 | else |
| 3314 | { |
| 3315 | Key0Length = 0; |
| 3316 | } |
| 3317 | |
| 3318 | if ( pProfile->Keys.KeyLength[1] ) |
| 3319 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3320 | vos_mem_copy(Key1, pProfile->Keys.KeyMaterial[1], |
| 3321 | WNI_CFG_WEP_KEY_LENGTH_5); |
| 3322 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_5; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3323 | } |
| 3324 | else |
| 3325 | { |
| 3326 | Key1Length = 0; |
| 3327 | } |
| 3328 | |
| 3329 | if ( pProfile->Keys.KeyLength[2] ) |
| 3330 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3331 | vos_mem_copy(Key2, pProfile->Keys.KeyMaterial[2], |
| 3332 | WNI_CFG_WEP_KEY_LENGTH_5); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3333 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3334 | } |
| 3335 | else |
| 3336 | { |
| 3337 | Key2Length = 0; |
| 3338 | } |
| 3339 | |
| 3340 | if ( pProfile->Keys.KeyLength[3] ) |
| 3341 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3342 | vos_mem_copy(Key3, pProfile->Keys.KeyMaterial[3], |
| 3343 | WNI_CFG_WEP_KEY_LENGTH_5); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3344 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3345 | } |
| 3346 | else |
| 3347 | { |
| 3348 | Key3Length = 0; |
| 3349 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3350 | break; |
| 3351 | |
| 3352 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3353 | case eCSR_ENCRYPT_TYPE_WEP104: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3354 | |
| 3355 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3356 | PrivacyEnabled = 1; |
| 3357 | RsnEnabled = 0; |
| 3358 | |
| 3359 | // Set the Wep default key ID. |
| 3360 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 3361 | |
| 3362 | // Wep key size if 13 bytes (104 bits). |
| 3363 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3364 | |
| 3365 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3366 | if ( pProfile->Keys.KeyLength[0] ) |
| 3367 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3368 | vos_mem_copy(Key0, pProfile->Keys.KeyMaterial[ 0 ], |
| 3369 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3370 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3371 | } |
| 3372 | else |
| 3373 | { |
| 3374 | Key0Length = 0; |
| 3375 | } |
| 3376 | |
| 3377 | if ( pProfile->Keys.KeyLength[1] ) |
| 3378 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3379 | vos_mem_copy(Key1, pProfile->Keys.KeyMaterial[ 1 ], |
| 3380 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3381 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3382 | } |
| 3383 | else |
| 3384 | { |
| 3385 | Key1Length = 0; |
| 3386 | } |
| 3387 | |
| 3388 | if ( pProfile->Keys.KeyLength[2] ) |
| 3389 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3390 | vos_mem_copy(Key2, pProfile->Keys.KeyMaterial[ 2 ], |
| 3391 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3392 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3393 | } |
| 3394 | else |
| 3395 | { |
| 3396 | Key2Length = 0; |
| 3397 | } |
| 3398 | |
| 3399 | if ( pProfile->Keys.KeyLength[3] ) |
| 3400 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3401 | vos_mem_copy(Key3, pProfile->Keys.KeyMaterial[ 3 ], |
| 3402 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3403 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3404 | } |
| 3405 | else |
| 3406 | { |
| 3407 | Key3Length = 0; |
| 3408 | } |
| 3409 | |
| 3410 | break; |
| 3411 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3412 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3413 | case eCSR_ENCRYPT_TYPE_AES: |
| 3414 | #ifdef FEATURE_WLAN_WAPI |
| 3415 | case eCSR_ENCRYPT_TYPE_WPI: |
| 3416 | #endif /* FEATURE_WLAN_WAPI */ |
| 3417 | // !! Note: this is the only difference between this function and the csrSetCfgPrivacyFromProfile() |
| 3418 | // (setting of the privacy CFG based on the advertised privacy setting from the AP for WPA/WAPI associations ). |
| 3419 | PrivacyEnabled = (0 != fPrivacy); |
| 3420 | |
| 3421 | // turn on RSN enabled for WPA associations |
| 3422 | RsnEnabled = 1; |
| 3423 | |
| 3424 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3425 | |
| 3426 | // clear out the static WEP keys that may be hanging around. |
| 3427 | Key0Length = 0; |
| 3428 | Key1Length = 0; |
| 3429 | Key2Length = 0; |
| 3430 | Key3Length = 0; |
| 3431 | |
| 3432 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3433 | default: |
| 3434 | PrivacyEnabled = 0; |
| 3435 | RsnEnabled = 0; |
| 3436 | break; |
| 3437 | } |
| 3438 | |
| 3439 | ccmCfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3440 | ccmCfgSetInt(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3441 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length, NULL, eANI_BOOLEAN_FALSE); |
| 3442 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length, NULL, eANI_BOOLEAN_FALSE); |
| 3443 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length, NULL, eANI_BOOLEAN_FALSE); |
| 3444 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length, NULL, eANI_BOOLEAN_FALSE); |
| 3445 | ccmCfgSetInt(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength, NULL, eANI_BOOLEAN_FALSE); |
| 3446 | ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE); |
| 3447 | } |
| 3448 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3449 | static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID ) |
| 3450 | { |
| 3451 | tANI_U32 len = 0; |
| 3452 | if(pSSID->length <= WNI_CFG_SSID_LEN) |
| 3453 | { |
| 3454 | len = pSSID->length; |
| 3455 | } |
| 3456 | ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE); |
| 3457 | } |
| 3458 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3459 | eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType ) |
| 3460 | { |
| 3461 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3462 | tANI_U32 QoSEnabled; |
| 3463 | tANI_U32 WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3464 | // set the CFG enable/disable variables based on the qosType being configured... |
| 3465 | switch( qosType ) |
| 3466 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3467 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p: |
| 3468 | QoSEnabled = FALSE; |
| 3469 | WmeEnabled = TRUE; |
| 3470 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3471 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP: |
| 3472 | QoSEnabled = FALSE; |
| 3473 | WmeEnabled = TRUE; |
| 3474 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3475 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify: |
| 3476 | QoSEnabled = FALSE; |
| 3477 | WmeEnabled = TRUE; |
| 3478 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3479 | case eCSR_MEDIUM_ACCESS_11e_eDCF: |
| 3480 | QoSEnabled = TRUE; |
| 3481 | WmeEnabled = FALSE; |
| 3482 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3483 | case eCSR_MEDIUM_ACCESS_11e_HCF: |
| 3484 | QoSEnabled = TRUE; |
| 3485 | WmeEnabled = FALSE; |
| 3486 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3487 | default: |
| 3488 | case eCSR_MEDIUM_ACCESS_DCF: |
| 3489 | QoSEnabled = FALSE; |
| 3490 | WmeEnabled = FALSE; |
| 3491 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3492 | } |
| 3493 | //save the WMM setting for later use |
| 3494 | pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled; |
Sandeep Puligilla | aea98a2 | 2013-12-04 13:36:32 +0530 | [diff] [blame] | 3495 | pMac->roam.roamSession[sessionId].fQOSConnection = (tANI_BOOLEAN)QoSEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3496 | return (status); |
| 3497 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3498 | static eHalStatus csrGetRateSet( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc, |
| 3499 | tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet) |
| 3500 | { |
| 3501 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3502 | int i; |
| 3503 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3504 | tANI_U8 *pDstRate; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3505 | vos_mem_set(pOpRateSet, sizeof(tSirMacRateSet), 0); |
| 3506 | vos_mem_set(pExRateSet, sizeof(tSirMacRateSet), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3507 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3508 | |
| 3509 | if( NULL != pIes ) |
| 3510 | { |
| 3511 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3512 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3513 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3514 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3515 | // would blindly put the rates we support into our Operational Rate set |
| 3516 | // (including the basic rates, which we have already verified are |
| 3517 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3518 | // However, it turns out that this is not always the case. Some AP's |
| 3519 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3520 | // too. Now, we're a little more careful: |
| 3521 | pDstRate = pOpRateSet->rate; |
| 3522 | if(pIes->SuppRates.present) |
| 3523 | { |
| 3524 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3525 | { |
| 3526 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) |
| 3527 | { |
| 3528 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3529 | pOpRateSet->numRates++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3530 | } |
| 3531 | } |
| 3532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3533 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3534 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3535 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3536 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3537 | { |
| 3538 | // If there are Extended Rates in the beacon, we will reflect those |
| 3539 | // extended rates that we support in out Extended Operational Rate |
| 3540 | // set: |
| 3541 | pDstRate = pExRateSet->rate; |
| 3542 | if(pIes->ExtSuppRates.present) |
| 3543 | { |
| 3544 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3545 | { |
| 3546 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) |
| 3547 | { |
| 3548 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3549 | pExRateSet->numRates++; |
| 3550 | } |
| 3551 | } |
| 3552 | } |
| 3553 | } |
| 3554 | }//Parsing BSSDesc |
| 3555 | else |
| 3556 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3557 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3558 | } |
| 3559 | if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) status = eHAL_STATUS_SUCCESS; |
| 3560 | return status; |
| 3561 | } |
| 3562 | |
| 3563 | static void csrSetCfgRateSet( tpAniSirGlobal pMac, eCsrPhyMode phyMode, tCsrRoamProfile *pProfile, |
| 3564 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3565 | { |
| 3566 | int i; |
| 3567 | tANI_U8 *pDstRate; |
| 3568 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3569 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3570 | tANI_U32 OperationalRatesLength = 0; |
| 3571 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3572 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3573 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3574 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3575 | tANI_U32 PropRatesEnable = 0; |
| 3576 | tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ]; |
| 3577 | tANI_U32 MCSRateLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3578 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3579 | if( NULL != pIes ) |
| 3580 | { |
| 3581 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3582 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3583 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3584 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3585 | // would blindly put the rates we support into our Operational Rate set |
| 3586 | // (including the basic rates, which we have already verified are |
| 3587 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3588 | // However, it turns out that this is not always the case. Some AP's |
| 3589 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3590 | // too. Now, we're a little more careful: |
| 3591 | pDstRate = OperationalRates; |
| 3592 | if(pIes->SuppRates.present) |
| 3593 | { |
| 3594 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3595 | { |
| 3596 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) && |
| 3597 | ( OperationalRatesLength < CSR_DOT11_SUPPORTED_RATES_MAX )) |
| 3598 | { |
| 3599 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
| 3600 | OperationalRatesLength++; |
| 3601 | } |
| 3602 | } |
| 3603 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3604 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3605 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3606 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3607 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3608 | { |
| 3609 | // If there are Extended Rates in the beacon, we will reflect those |
| 3610 | // extended rates that we support in out Extended Operational Rate |
| 3611 | // set: |
| 3612 | pDstRate = ExtendedOperationalRates; |
| 3613 | if(pIes->ExtSuppRates.present) |
| 3614 | { |
| 3615 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3616 | { |
| 3617 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) && |
| 3618 | ( ExtendedOperationalRatesLength < CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX )) |
| 3619 | { |
| 3620 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3621 | ExtendedOperationalRatesLength++; |
| 3622 | } |
| 3623 | } |
| 3624 | } |
| 3625 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3626 | // Enable proprietary MAC features if peer node is Airgo node and STA |
| 3627 | // user wants to use them |
| 3628 | if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3629 | { |
| 3630 | PropRatesEnable = 1; |
| 3631 | } |
| 3632 | else |
| 3633 | { |
| 3634 | PropRatesEnable = 0; |
| 3635 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3636 | // For ANI network companions, we need to populate the proprietary rate |
| 3637 | // set with any proprietary rates we found in the beacon, only if user |
| 3638 | // allows them... |
| 3639 | if ( PropRatesEnable && pIes->Airgo.PropSuppRates.present && |
| 3640 | ( pIes->Airgo.PropSuppRates.num_rates > 0 )) |
| 3641 | { |
| 3642 | ProprietaryOperationalRatesLength = pIes->Airgo.PropSuppRates.num_rates; |
| 3643 | if ( ProprietaryOperationalRatesLength > sizeof(ProprietaryOperationalRates) ) |
| 3644 | { |
| 3645 | ProprietaryOperationalRatesLength = sizeof (ProprietaryOperationalRates); |
| 3646 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3647 | vos_mem_copy(ProprietaryOperationalRates, |
| 3648 | pIes->Airgo.PropSuppRates.rates, |
| 3649 | ProprietaryOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3650 | } |
| 3651 | else { |
| 3652 | // No proprietary modes... |
| 3653 | ProprietaryOperationalRatesLength = 0; |
| 3654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3655 | /* Get MCS Rate */ |
| 3656 | pDstRate = MCSRateIdxSet; |
| 3657 | if ( pIes->HTCaps.present ) |
| 3658 | { |
| 3659 | for ( i = 0; i < VALID_MAX_MCS_INDEX; i++ ) |
| 3660 | { |
| 3661 | if ( (unsigned int)pIes->HTCaps.supportedMCSSet[0] & (1 << i) ) |
| 3662 | { |
| 3663 | MCSRateLength++; |
| 3664 | *pDstRate++ = i; |
| 3665 | } |
| 3666 | } |
| 3667 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3668 | // Set the operational rate set CFG variables... |
| 3669 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3670 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3671 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3672 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3673 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3674 | ProprietaryOperationalRates, |
| 3675 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3676 | ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE); |
| 3677 | ccmCfgSetStr(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, |
| 3678 | MCSRateLength, NULL, eANI_BOOLEAN_FALSE); |
| 3679 | }//Parsing BSSDesc |
| 3680 | else |
| 3681 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3682 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3683 | } |
| 3684 | } |
| 3685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3686 | static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac, |
| 3687 | tCsrRoamProfile *pProfile ) |
| 3688 | { |
| 3689 | tSirMacRateSetIE DefaultSupportedRates11a = { SIR_MAC_RATESET_EID, |
| 3690 | { 8, |
| 3691 | { SIR_MAC_RATE_6, |
| 3692 | SIR_MAC_RATE_9, |
| 3693 | SIR_MAC_RATE_12, |
| 3694 | SIR_MAC_RATE_18, |
| 3695 | SIR_MAC_RATE_24, |
| 3696 | SIR_MAC_RATE_36, |
| 3697 | SIR_MAC_RATE_48, |
| 3698 | SIR_MAC_RATE_54 } } }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3699 | tSirMacRateSetIE DefaultSupportedRates11b = { SIR_MAC_RATESET_EID, |
| 3700 | { 4, |
| 3701 | { SIR_MAC_RATE_1, |
| 3702 | SIR_MAC_RATE_2, |
| 3703 | SIR_MAC_RATE_5_5, |
| 3704 | SIR_MAC_RATE_11 } } }; |
| 3705 | |
| 3706 | |
| 3707 | tSirMacPropRateSet DefaultSupportedPropRates = { 3, |
| 3708 | { SIR_MAC_RATE_72, |
| 3709 | SIR_MAC_RATE_96, |
| 3710 | SIR_MAC_RATE_108 } }; |
| 3711 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3712 | eCsrBand eBand; |
| 3713 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3714 | tANI_U32 OperationalRatesLength = 0; |
| 3715 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3716 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3717 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3718 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3719 | tANI_U32 PropRatesEnable = 0; |
| 3720 | tANI_U8 operationChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3721 | if(pProfile->ChannelInfo.ChannelList) |
| 3722 | { |
| 3723 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3724 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3725 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3726 | // For 11a networks, the 11a rates go into the Operational Rate set. For 11b and 11g |
| 3727 | // networks, the 11b rates appear in the Operational Rate set. In either case, |
| 3728 | // we can blindly put the rates we support into our Operational Rate set |
| 3729 | // (including the basic rates, which we have already verified are supported |
| 3730 | // earlier in the roaming decision). |
| 3731 | if ( eCSR_BAND_5G == eBand ) |
| 3732 | { |
| 3733 | // 11a rates into the Operational Rate Set. |
| 3734 | OperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3735 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3736 | vos_mem_copy(OperationalRates, |
| 3737 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3738 | OperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3739 | |
| 3740 | // Nothing in the Extended rate set. |
| 3741 | ExtendedOperationalRatesLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3742 | // populate proprietary rates if user allows them |
| 3743 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3744 | { |
| 3745 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3746 | sizeof(*DefaultSupportedPropRates.propRate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3747 | vos_mem_copy(ProprietaryOperationalRates, |
| 3748 | DefaultSupportedPropRates.propRate, |
| 3749 | ProprietaryOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3750 | } |
| 3751 | else |
| 3752 | { |
| 3753 | // No proprietary modes |
| 3754 | ProprietaryOperationalRatesLength = 0; |
| 3755 | } |
| 3756 | } |
| 3757 | else if ( eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode ) |
| 3758 | { |
| 3759 | // 11b rates into the Operational Rate Set. |
| 3760 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3761 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3762 | vos_mem_copy(OperationalRates, |
| 3763 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3764 | OperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3765 | // Nothing in the Extended rate set. |
| 3766 | ExtendedOperationalRatesLength = 0; |
| 3767 | // No proprietary modes |
| 3768 | ProprietaryOperationalRatesLength = 0; |
| 3769 | } |
| 3770 | else |
| 3771 | { |
| 3772 | // 11G |
| 3773 | |
| 3774 | // 11b rates into the Operational Rate Set. |
| 3775 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3776 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3777 | vos_mem_copy(OperationalRates, |
| 3778 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3779 | OperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3780 | |
| 3781 | // 11a rates go in the Extended rate set. |
| 3782 | ExtendedOperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3783 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3784 | vos_mem_copy(ExtendedOperationalRates, |
| 3785 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3786 | ExtendedOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3787 | |
| 3788 | // populate proprietary rates if user allows them |
| 3789 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3790 | { |
| 3791 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3792 | sizeof(*DefaultSupportedPropRates.propRate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3793 | vos_mem_copy(ProprietaryOperationalRates, |
| 3794 | DefaultSupportedPropRates.propRate, |
| 3795 | ProprietaryOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3796 | } |
| 3797 | else |
| 3798 | { |
| 3799 | // No proprietary modes |
| 3800 | ProprietaryOperationalRatesLength = 0; |
| 3801 | } |
| 3802 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3803 | // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them |
| 3804 | if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3805 | { |
| 3806 | PropRatesEnable = 1; |
| 3807 | } |
| 3808 | else |
| 3809 | { |
| 3810 | PropRatesEnable = 0; |
| 3811 | } |
| 3812 | |
| 3813 | // Set the operational rate set CFG variables... |
| 3814 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3815 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3816 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3817 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3818 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3819 | ProprietaryOperationalRates, |
| 3820 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3821 | 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] | 3822 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3823 | void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result) |
| 3824 | { |
| 3825 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3826 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3827 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 3828 | tANI_U32 sessionId; |
| 3829 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3830 | if(NULL == pEntry) |
| 3831 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3832 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3833 | return; |
| 3834 | } |
| 3835 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 3836 | sessionId = pCommand->sessionId; |
Kaushik, Sushant | 74dbbba | 2014-05-30 10:31:41 +0530 | [diff] [blame] | 3837 | smsLog(pMac, LOG1, FL("CCM CFG return value is %d, " |
| 3838 | " current state : %d sub state : %d "), |
| 3839 | result, pMac->roam.curState[sessionId], |
| 3840 | pMac->roam.curSubState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3841 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 3842 | { |
| 3843 | csrRoamingStateConfigCnfProcessor(pMac, (tANI_U32)result); |
| 3844 | } |
| 3845 | } |
| 3846 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3847 | //This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE |
| 3848 | tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band) |
| 3849 | { |
| 3850 | if(eCSR_CFG_DOT11_MODE_11B == dot11Mode) |
| 3851 | { |
| 3852 | return (WNI_CFG_PHY_MODE_11B); |
| 3853 | } |
| 3854 | else |
| 3855 | { |
| 3856 | if(eCSR_BAND_24 == band) |
| 3857 | return (WNI_CFG_PHY_MODE_11G); |
| 3858 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3859 | return (WNI_CFG_PHY_MODE_11A); |
| 3860 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3861 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3862 | |
| 3863 | #ifdef WLAN_FEATURE_11AC |
| 3864 | ePhyChanBondState csrGetHTCBStateFromVHTCBState(ePhyChanBondState aniCBMode) |
| 3865 | { |
| 3866 | switch ( aniCBMode ) |
| 3867 | { |
| 3868 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 3869 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 3870 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 3871 | return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 3872 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 3873 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 3874 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 3875 | return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 3876 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3877 | default : |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3878 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 3879 | } |
| 3880 | } |
| 3881 | #endif |
| 3882 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3883 | //pIes may be NULL |
| 3884 | eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3885 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3886 | tDot11fBeaconIEs *pIes, tANI_BOOLEAN resetCountry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3887 | { |
| 3888 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3889 | tANI_U32 cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3890 | tANI_U8 channel = 0; |
| 3891 | //Make sure we have the domain info for the BSS we try to connect to. |
| 3892 | //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] | 3893 | if (pBssDesc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3894 | { |
Chandrasekaran, Manishekar | 90c4932 | 2014-06-24 13:26:14 +0530 | [diff] [blame] | 3895 | if (csrLearnCountryInformation(pMac, pBssDesc, pIes, eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3896 | { |
| 3897 | //Make sure the 11d info from this BSSDesc can be applied |
| 3898 | pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3899 | if (VOS_TRUE == resetCountry) |
| 3900 | { |
| 3901 | csrApplyCountryInformation(pMac, FALSE); |
| 3902 | } |
| 3903 | else |
| 3904 | { |
| 3905 | csrApplyCountryInformation(pMac, TRUE); |
| 3906 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3907 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3908 | if ((csrIs11dSupported (pMac)) && pIes) |
| 3909 | { |
| 3910 | if (!pIes->Country.present) |
Tushnim Bhattacharyya | c3c1e8e | 2013-10-29 17:27:43 -0700 | [diff] [blame] | 3911 | { |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3912 | csrResetCountryInformation(pMac, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE ); |
Tushnim Bhattacharyya | c3c1e8e | 2013-10-29 17:27:43 -0700 | [diff] [blame] | 3913 | } |
| 3914 | else |
| 3915 | { |
| 3916 | //Let's also update the below to make sure we don't update CC while |
| 3917 | //connected to an AP which is advertising some CC |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 3918 | vos_mem_copy(pMac->scan.currentCountryBssid, |
Tushnim Bhattacharyya | c3c1e8e | 2013-10-29 17:27:43 -0700 | [diff] [blame] | 3919 | pBssDesc->bssId, sizeof(tSirMacAddr)); |
| 3920 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3921 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3922 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3923 | //Qos |
| 3924 | csrSetQosToCfg( pMac, sessionId, pBssConfig->qosType ); |
| 3925 | //SSID |
| 3926 | csrSetCfgSsid(pMac, &pBssConfig->SSID ); |
| 3927 | //fragment threshold |
| 3928 | //ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3929 | //RTS threshold |
| 3930 | //ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3931 | |
| 3932 | //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] | 3933 | //Auth type |
| 3934 | ccmCfgSetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType, NULL, eANI_BOOLEAN_FALSE); |
| 3935 | //encryption type |
| 3936 | csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy ); |
| 3937 | //short slot time |
| 3938 | 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] | 3939 | //11d |
| 3940 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 3941 | ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : pProfile->ieee80211d), |
| 3942 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3943 | /*//11h |
| 3944 | ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3945 | */ |
| 3946 | ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE); |
| 3947 | //CB |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3948 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 3949 | 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] | 3950 | { |
| 3951 | channel = pProfile->operationChannel; |
| 3952 | } |
| 3953 | else |
| 3954 | { |
| 3955 | if(pBssDesc) |
| 3956 | { |
| 3957 | channel = pBssDesc->channelId; |
| 3958 | } |
| 3959 | } |
| 3960 | if(0 != channel) |
| 3961 | { |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3962 | if(CSR_IS_CHANNEL_24GHZ(channel) && |
| 3963 | !pMac->roam.configParam.channelBondingMode24GHz && |
| 3964 | !WDA_getFwWlanFeatCaps(HT40_OBSS_SCAN)) |
| 3965 | {//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] | 3966 | cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3967 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: " |
| 3968 | " cbMode disabled cfgCb = %d channelBondingMode24GHz %d", |
| 3969 | __func__, cfgCb, pMac->roam.configParam.channelBondingMode24GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3970 | } |
| 3971 | else |
| 3972 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3973 | cfgCb = pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3974 | } |
| 3975 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3976 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | a0d8893 | 2012-11-13 10:51:26 -0800 | [diff] [blame] | 3977 | // cbMode = 1 in cfg.ini is mapped to PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 3978 | // in function csrConvertCBIniValueToPhyCBState() |
| 3979 | // So, max value for cbMode in 40MHz mode is 3 (MAC\src\include\sirParams.h) |
| 3980 | if(cfgCb > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3981 | { |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3982 | if(!WDA_getFwWlanFeatCaps(DOT11AC)) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3983 | cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb); |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3984 | } |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 3985 | else |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3986 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3987 | 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] | 3988 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3989 | } |
| 3990 | else |
| 3991 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3992 | ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE); |
| 3993 | //Rate |
| 3994 | //Fixed Rate |
| 3995 | if(pBssDesc) |
| 3996 | { |
| 3997 | csrSetCfgRateSet(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile, pBssDesc, pIes); |
| 3998 | } |
| 3999 | else |
| 4000 | { |
| 4001 | csrSetCfgRateSetFromProfile(pMac, pProfile); |
| 4002 | } |
| 4003 | //Make this the last CFG to set. The callback will trigger a join_req |
| 4004 | //Join time out |
| 4005 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId ); |
| 4006 | |
| 4007 | 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] | 4008 | return (status); |
| 4009 | } |
| 4010 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4011 | eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 4012 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 4013 | { |
| 4014 | eHalStatus status; |
| 4015 | tBssConfigParam *pBssConfig; |
| 4016 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4017 | |
| 4018 | if(!pSession) |
| 4019 | { |
| 4020 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4021 | return eHAL_STATUS_FAILURE; |
| 4022 | } |
| 4023 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4024 | pBssConfig = vos_mem_malloc(sizeof(tBssConfigParam)); |
| 4025 | if ( NULL == pBssConfig ) |
| 4026 | status = eHAL_STATUS_FAILURE; |
| 4027 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4028 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4029 | vos_mem_set(pBssConfig, sizeof(tBssConfigParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4030 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, pBssConfig, pIes); |
| 4031 | if(HAL_STATUS_SUCCESS(status)) |
| 4032 | { |
| 4033 | pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4034 | /* This will allow to pass cbMode during join req */ |
| 4035 | pSession->bssParams.cbMode= pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4036 | //For IBSS, we need to prepare some more information |
| 4037 | if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4038 | || CSR_IS_INFRA_AP(pProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4039 | ) |
| 4040 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4041 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4042 | } |
| 4043 | // If we are in an IBSS, then stop the IBSS... |
| 4044 | ////Not worry about WDS connection for now |
| 4045 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 4046 | { |
| 4047 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 4048 | } |
| 4049 | else |
| 4050 | { |
| 4051 | // if we are in an Infrastructure association.... |
| 4052 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 4053 | { |
| 4054 | // and the new Bss is an Ibss OR we are roaming from Infra to Infra |
| 4055 | // across SSIDs (roaming to a new SSID)... // |
| 4056 | //Not worry about WDS connection for now |
| 4057 | if ( pBssDesc && ( ( csrIsIbssBssDesc( pBssDesc ) ) || |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4058 | !csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIes ) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4059 | { |
| 4060 | // then we need to disassociate from the Infrastructure network... |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4061 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 4062 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4063 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4064 | else |
| 4065 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4066 | // In an Infrastucture and going to an Infrastructure network with the same SSID. This |
| 4067 | // 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] | 4068 | if ( pBssDesc ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4069 | { |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4070 | // Set parameters for this Bss. |
| 4071 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 4072 | pBssDesc, pBssConfig, |
| 4073 | pIes, eANI_BOOLEAN_FALSE); |
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 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4076 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4077 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4078 | { |
| 4079 | // Neiher in IBSS nor in Infra. We can go ahead and set the CFG for tne new network... |
| 4080 | // Nothing to stop. |
| 4081 | if ( pBssDesc || CSR_IS_WDS_AP( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4082 | || CSR_IS_INFRA_AP(pProfile) |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4083 | ) |
| 4084 | { |
| 4085 | tANI_BOOLEAN is11rRoamingFlag = eANI_BOOLEAN_FALSE; |
| 4086 | is11rRoamingFlag = csrRoamIs11rAssoc(pMac); |
| 4087 | // Set parameters for this Bss. |
| 4088 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 4089 | pBssDesc, pBssConfig, |
| 4090 | pIes, is11rRoamingFlag); |
| 4091 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4092 | } |
| 4093 | } |
| 4094 | }//Success getting BSS config info |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4095 | vos_mem_free(pBssConfig); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4096 | }//Allocate memory |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4097 | return (status); |
| 4098 | } |
| 4099 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4100 | eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 4101 | tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile ) |
| 4102 | { |
| 4103 | eCsrJoinState eRoamState = eCsrContinueRoaming; |
| 4104 | eHalStatus status; |
| 4105 | tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor; |
| 4106 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL |
| 4107 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4108 | |
| 4109 | if(!pSession) |
| 4110 | { |
| 4111 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4112 | return (eCsrStopRoaming); |
| 4113 | } |
| 4114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4115 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 4116 | { |
| 4117 | status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc ); |
| 4118 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 4119 | { |
| 4120 | eRoamState = eCsrStopRoaming; |
| 4121 | } |
| 4122 | } |
| 4123 | else |
| 4124 | { |
| 4125 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 4126 | { |
| 4127 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
| 4128 | return (eCsrStopRoaming); |
| 4129 | } |
| 4130 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 4131 | { |
| 4132 | // If we are connected in infrastructure mode and the Join Bss description is for the same BssID, then we are |
| 4133 | // attempting to join the AP we are already connected with. In that case, see if the Bss or Sta capabilities |
| 4134 | // have changed and handle the changes (without disturbing the current association). |
| 4135 | |
| 4136 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && |
| 4137 | csrIsBssIdEqual( pMac, pBssDesc, pSession->pConnectBssDesc ) && |
| 4138 | csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIesLocal ) |
| 4139 | ) |
| 4140 | { |
| 4141 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 4142 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 4143 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 4144 | // a new Association. |
| 4145 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 4146 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 4147 | smsLog(pMac, LOGW, FL(" detect same profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4148 | if(csrRoamIsSameProfileKeys(pMac, &pSession->connectedProfile, pProfile)) |
| 4149 | { |
| 4150 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 4151 | } |
| 4152 | else |
| 4153 | { |
| 4154 | tBssConfigParam bssConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4155 | //The key changes |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4156 | vos_mem_set(&bssConfig, sizeof(bssConfig), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4157 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 4158 | if(HAL_STATUS_SUCCESS(status)) |
| 4159 | { |
| 4160 | pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4161 | pSession->bssParams.cbMode = bssConfig.cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4162 | //Reapply the config including Keys so reassoc is happening. |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4163 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 4164 | pBssDesc, &bssConfig, |
| 4165 | pIesLocal, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4166 | if(!HAL_STATUS_SUCCESS(status)) |
| 4167 | { |
| 4168 | eRoamState = eCsrStopRoaming; |
| 4169 | } |
| 4170 | } |
| 4171 | else |
| 4172 | { |
| 4173 | eRoamState = eCsrStopRoaming; |
| 4174 | } |
| 4175 | }//same profile |
| 4176 | } |
| 4177 | else |
| 4178 | { |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4179 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, sessionId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4180 | eCSR_ROAM_SUBSTATE_DISASSOC_REQ, FALSE ))) |
| 4181 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 4182 | smsLog(pMac, LOGE, FL(" fail to issue disassociate with Session ID %d"), |
| 4183 | sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4184 | eRoamState = eCsrStopRoaming; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4185 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4186 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4187 | } |
| 4188 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4189 | { |
| 4190 | // note: we used to pre-auth here with open authentication networks but that was not working so well. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4191 | // stop the existing network before attempting to join the new network... |
| 4192 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 4193 | { |
| 4194 | eRoamState = eCsrStopRoaming; |
| 4195 | } |
| 4196 | } |
| 4197 | }//Infra |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4198 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4199 | { |
| 4200 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 4201 | { |
| 4202 | eRoamState = eCsrStopRoaming; |
| 4203 | } |
| 4204 | } |
| 4205 | if( pIesLocal && !pScanResult->pvIes ) |
| 4206 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4207 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4208 | } |
| 4209 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4210 | return( eRoamState ); |
| 4211 | } |
| 4212 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4213 | eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 4214 | tSirBssDescription *pBssDesc, tANI_U32 roamId) |
| 4215 | { |
| 4216 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4217 | tCsrRoamInfo roamInfo; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4218 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4219 | roamInfo.pBssDesc = pBssDesc; |
| 4220 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE); |
| 4221 | return (status); |
| 4222 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4223 | //In case no matching BSS is found, use whatever default we can find |
| 4224 | static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4225 | { |
| 4226 | //Need to get all negotiated types in place first |
| 4227 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 4228 | 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] | 4229 | { |
| 4230 | default: |
| 4231 | case eCSR_AUTH_TYPE_WPA: |
| 4232 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 4233 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 4234 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 4235 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4236 | break; |
| 4237 | |
| 4238 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 4239 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 4240 | break; |
| 4241 | |
| 4242 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 4243 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 4244 | break; |
| 4245 | } |
| 4246 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 4247 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 4248 | //In this case, the multicast encryption needs to follow the uncast ones. |
| 4249 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 4250 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 4251 | } |
| 4252 | |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4253 | |
| 4254 | static void csrSetAbortRoamingCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4255 | { |
| 4256 | switch(pCommand->u.roamCmd.roamReason) |
| 4257 | { |
| 4258 | case eCsrLostLink1: |
| 4259 | pCommand->u.roamCmd.roamReason = eCsrLostLink1Abort; |
| 4260 | break; |
| 4261 | case eCsrLostLink2: |
| 4262 | pCommand->u.roamCmd.roamReason = eCsrLostLink2Abort; |
| 4263 | break; |
| 4264 | case eCsrLostLink3: |
| 4265 | pCommand->u.roamCmd.roamReason = eCsrLostLink3Abort; |
| 4266 | break; |
| 4267 | default: |
| 4268 | smsLog(pMac, LOGE, FL(" aborting roaming reason %d not recognized"), |
| 4269 | pCommand->u.roamCmd.roamReason); |
| 4270 | break; |
| 4271 | } |
| 4272 | } |
| 4273 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4274 | static eCsrJoinState csrRoamJoinNextBss( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fUseSameBss ) |
| 4275 | { |
| 4276 | eHalStatus status; |
| 4277 | tCsrScanResult *pScanResult = NULL; |
| 4278 | eCsrJoinState eRoamState = eCsrStopRoaming; |
| 4279 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 4280 | tANI_BOOLEAN fDone = eANI_BOOLEAN_FALSE; |
| 4281 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 4282 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4283 | v_U8_t acm_mask = 0; |
| 4284 | #endif |
| 4285 | tANI_U32 sessionId = pCommand->sessionId; |
| 4286 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4287 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4288 | tANI_U8 concurrentChannel = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4289 | |
| 4290 | if(!pSession) |
| 4291 | { |
| 4292 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4293 | return (eCsrStopRoaming); |
| 4294 | } |
| 4295 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4296 | do |
| 4297 | { |
| 4298 | // Check for Cardbus eject condition, before trying to Roam to any BSS |
| 4299 | //***if( !balIsCardPresent(pAdapter) ) break; |
| 4300 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4301 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Rajesh Babu Prathipati | 20cdffa | 2014-07-01 22:24:59 +0530 | [diff] [blame] | 4302 | vos_mem_copy (&roamInfo.bssid, &pSession->joinFailStatusCode.bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4303 | if(NULL != pBSSList) |
| 4304 | { |
| 4305 | // When handling AP's capability change, continue to associate to |
| 4306 | // same BSS and make sure pRoamBssEntry is not Null. |
| 4307 | if((eANI_BOOLEAN_FALSE == fUseSameBss) || (pCommand->u.roamCmd.pRoamBssEntry == NULL)) |
| 4308 | { |
| 4309 | if(pCommand->u.roamCmd.pRoamBssEntry == NULL) |
| 4310 | { |
| 4311 | //Try the first BSS |
| 4312 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4313 | pCommand->u.roamCmd.pRoamBssEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 4314 | } |
| 4315 | else |
| 4316 | { |
| 4317 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4318 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4319 | { |
| 4320 | //Done with all the BSSs |
| 4321 | //In this case, will tell HDD the completion |
| 4322 | break; |
| 4323 | } |
| 4324 | else |
| 4325 | { |
| 4326 | //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] | 4327 | //vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4328 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; //this shall not be NULL |
| 4329 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4330 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4331 | pRoamInfo = &roamInfo; |
| 4332 | } |
| 4333 | } |
| 4334 | while(pCommand->u.roamCmd.pRoamBssEntry) |
| 4335 | { |
| 4336 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4337 | /*If concurrency enabled take the concurrent connected channel first. */ |
| 4338 | /* Valid multichannel concurrent sessions exempted */ |
Agarwal Ashish | 5974ed3 | 2014-06-16 16:59:54 +0530 | [diff] [blame] | 4339 | if (vos_concurrent_open_sessions_running() && |
| 4340 | !csrIsValidMcConcurrentSession(pMac, sessionId, |
| 4341 | &pScanResult->Result.BssDescriptor)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4342 | { |
| 4343 | concurrentChannel = |
| 4344 | csrGetConcurrentOperationChannel(pMac); |
| 4345 | 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] | 4346 | " csr Concurrent Channel = %d", __func__, concurrentChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4347 | if ((concurrentChannel) && |
| 4348 | (concurrentChannel == |
| 4349 | pScanResult->Result.BssDescriptor.channelId)) |
| 4350 | { |
| 4351 | //make this 0 because we do not want the |
| 4352 | //below check to pass as we don't want to |
| 4353 | //connect on other channel |
| 4354 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 4355 | FL("Concurrent channel match =%d"), |
| 4356 | concurrentChannel); |
| 4357 | concurrentChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4358 | } |
| 4359 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4360 | |
| 4361 | if (!concurrentChannel) |
| 4362 | { |
| 4363 | |
| 4364 | if(HAL_STATUS_SUCCESS(csrRoamShouldRoam(pMac, |
| 4365 | sessionId, &pScanResult->Result.BssDescriptor, |
| 4366 | pCommand->u.roamCmd.roamId))) |
| 4367 | { |
| 4368 | //Ok to roam this |
| 4369 | break; |
| 4370 | } |
| 4371 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4372 | else |
| 4373 | { |
| 4374 | eRoamState = eCsrStopRoamingDueToConcurrency; |
| 4375 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4376 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4377 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4378 | { |
| 4379 | //Done with all the BSSs |
| 4380 | fDone = eANI_BOOLEAN_TRUE; |
| 4381 | break; |
| 4382 | } |
| 4383 | } |
| 4384 | if(fDone) |
| 4385 | { |
| 4386 | break; |
| 4387 | } |
| 4388 | } |
| 4389 | } |
| 4390 | //We have something to roam, tell HDD when it is infra. |
| 4391 | //For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND |
| 4392 | //For WDS, the indication is eCSR_ROAM_WDS_IND |
| 4393 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 4394 | { |
| 4395 | if(pRoamInfo) |
| 4396 | { |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4397 | if(pSession->bRefAssocStartCnt) |
| 4398 | { |
| 4399 | pSession->bRefAssocStartCnt--; |
| 4400 | //Complete the last association attemp because a new one is about to be tried |
| 4401 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4402 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4403 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4404 | } |
| 4405 | } |
| 4406 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 4407 | if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 4408 | { |
| 4409 | //No need to complete roaming here as it already completes |
| 4410 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed"), |
| 4411 | pCommand->u.roamCmd.roamReason); |
| 4412 | eRoamState = eCsrStopRoaming; |
| 4413 | csrSetAbortRoamingCommand(pMac, pCommand); |
| 4414 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4415 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4416 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4417 | if(pScanResult) |
| 4418 | { |
| 4419 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4420 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) ) |
| 4421 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4422 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4423 | fDone = eANI_BOOLEAN_TRUE; |
| 4424 | eRoamState = eCsrStopRoaming; |
| 4425 | break; |
| 4426 | } |
| 4427 | roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4428 | pCommand->u.roamCmd.pLastRoamBss = roamInfo.pBssDesc; |
| 4429 | //No need to put uapsd_mask in if the BSS doesn't support uAPSD |
| 4430 | if( pCommand->u.roamCmd.roamProfile.uapsd_mask && |
| 4431 | CSR_IS_QOS_BSS(pIesLocal) && |
| 4432 | CSR_IS_UAPSD_BSS(pIesLocal) ) |
| 4433 | { |
| 4434 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4435 | acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, |
| 4436 | pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4437 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4438 | } |
| 4439 | else |
| 4440 | { |
| 4441 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4442 | } |
| 4443 | if( pIesLocal && !pScanResult->Result.pvIes) |
| 4444 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4445 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4446 | } |
| 4447 | } |
| 4448 | else |
| 4449 | { |
| 4450 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4451 | } |
| 4452 | roamInfo.pProfile = pProfile; |
| 4453 | pSession->bRefAssocStartCnt++; |
| 4454 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4455 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4456 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4457 | if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) |
| 4458 | { |
| 4459 | // If this is a start IBSS profile, then we need to start the IBSS. |
| 4460 | if ( CSR_IS_START_IBSS(pProfile) ) |
| 4461 | { |
| 4462 | tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4463 | // Attempt to start this IBSS... |
| 4464 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4465 | status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss ); |
| 4466 | if(HAL_STATUS_SUCCESS(status)) |
| 4467 | { |
| 4468 | if ( fSameIbss ) |
| 4469 | { |
| 4470 | eRoamState = eCsrStartIbssSameIbss; |
| 4471 | } |
| 4472 | else |
| 4473 | { |
| 4474 | eRoamState = eCsrContinueRoaming; |
| 4475 | } |
| 4476 | } |
| 4477 | else |
| 4478 | { |
| 4479 | //it somehow fail need to stop |
| 4480 | eRoamState = eCsrStopRoaming; |
| 4481 | } |
| 4482 | break; |
| 4483 | } |
| 4484 | else if ( (CSR_IS_WDS_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4485 | || (CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4486 | ) |
| 4487 | { |
| 4488 | // Attempt to start this WDS... |
| 4489 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4490 | /* For AP WDS, we dont have any BSSDescription */ |
| 4491 | status = csrRoamStartWds( pMac, sessionId, pProfile, NULL ); |
| 4492 | if(HAL_STATUS_SUCCESS(status)) |
| 4493 | { |
| 4494 | eRoamState = eCsrContinueRoaming; |
| 4495 | } |
| 4496 | else |
| 4497 | { |
| 4498 | //it somehow fail need to stop |
| 4499 | eRoamState = eCsrStopRoaming; |
| 4500 | } |
| 4501 | } |
| 4502 | else |
| 4503 | { |
| 4504 | //Nothing we can do |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4505 | smsLog(pMac, LOGW, FL("cannot continue without BSS list")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4506 | eRoamState = eCsrStopRoaming; |
| 4507 | break; |
| 4508 | } |
| 4509 | } |
| 4510 | else //We have BSS |
| 4511 | { |
| 4512 | //Need to assign these value because they are used in csrIsSameProfile |
| 4513 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
Leela Venkata Kiran Kumar Reddy Chirala | 909b881 | 2014-05-16 22:09:05 -0700 | [diff] [blame] | 4514 | /* The OSEN IE doesn't provide the cipher suite. |
| 4515 | * Therefore set to constant value of AES */ |
| 4516 | if(pCommand->u.roamCmd.roamProfile.bOSENAssociation) |
| 4517 | { |
| 4518 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 4519 | eCSR_ENCRYPT_TYPE_AES; |
| 4520 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 4521 | eCSR_ENCRYPT_TYPE_AES; |
| 4522 | } |
| 4523 | else |
| 4524 | { |
| 4525 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 4526 | pScanResult->ucEncryptionType; //Negotiated while building scan result. |
| 4527 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 4528 | pScanResult->mcEncryptionType; |
| 4529 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4530 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = pScanResult->authType; |
| 4531 | if ( CSR_IS_START_IBSS(&pCommand->u.roamCmd.roamProfile) ) |
| 4532 | { |
| 4533 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 4534 | { |
| 4535 | eRoamState = eCsrStartIbssSameIbss; |
| 4536 | break; |
| 4537 | } |
| 4538 | } |
| 4539 | if( pCommand->u.roamCmd.fReassocToSelfNoCapChange ) |
| 4540 | { |
| 4541 | //trying to connect to the one already connected |
| 4542 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_FALSE; |
| 4543 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 4544 | break; |
| 4545 | } |
| 4546 | // Attempt to Join this Bss... |
| 4547 | eRoamState = csrRoamJoin( pMac, sessionId, &pScanResult->Result, pProfile ); |
| 4548 | break; |
| 4549 | } |
| 4550 | |
| 4551 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4552 | if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) ) |
| 4553 | { |
| 4554 | //Need to indicate association_completion if association_start has been done |
| 4555 | if(pSession->bRefAssocStartCnt > 0) |
| 4556 | { |
| 4557 | pSession->bRefAssocStartCnt--; |
| 4558 | //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] | 4559 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4560 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4561 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 4562 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 4563 | } |
| 4564 | } |
| 4565 | |
| 4566 | return( eRoamState ); |
| 4567 | } |
| 4568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4569 | static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4570 | { |
| 4571 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4572 | eCsrJoinState RoamState; |
| 4573 | tANI_U32 sessionId = pCommand->sessionId; |
| 4574 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4575 | //***if( hddIsRadioStateOn( pAdapter ) ) |
| 4576 | { |
| 4577 | // Attept to join a Bss... |
| 4578 | RoamState = csrRoamJoinNextBss( pMac, pCommand, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4579 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4580 | // if nothing to join.. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4581 | if (( eCsrStopRoaming == RoamState ) || ( eCsrStopRoamingDueToConcurrency == RoamState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4582 | { |
| 4583 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4584 | // and if connected in Infrastructure mode... |
| 4585 | if ( csrIsConnStateInfra(pMac, sessionId) ) |
| 4586 | { |
| 4587 | //... then we need to issue a disassociation |
| 4588 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, FALSE ); |
| 4589 | if(!HAL_STATUS_SUCCESS(status)) |
| 4590 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4591 | smsLog(pMac, LOGW, FL(" failed to issue disassociate, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4592 | //roam command is completed by caller in the failed case |
| 4593 | fComplete = eANI_BOOLEAN_TRUE; |
| 4594 | } |
| 4595 | } |
| 4596 | else if( csrIsConnStateIbss(pMac, sessionId) ) |
| 4597 | { |
| 4598 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4599 | if(!HAL_STATUS_SUCCESS(status)) |
| 4600 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4601 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4602 | //roam command is completed by caller in the failed case |
| 4603 | fComplete = eANI_BOOLEAN_TRUE; |
| 4604 | } |
| 4605 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4606 | else if (csrIsConnStateConnectedInfraAp(pMac, sessionId)) |
| 4607 | { |
| 4608 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4609 | if(!HAL_STATUS_SUCCESS(status)) |
| 4610 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4611 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4612 | //roam command is completed by caller in the failed case |
| 4613 | fComplete = eANI_BOOLEAN_TRUE; |
| 4614 | } |
| 4615 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4616 | else |
| 4617 | { |
| 4618 | fComplete = eANI_BOOLEAN_TRUE; |
| 4619 | } |
| 4620 | if(fComplete) |
| 4621 | { |
| 4622 | // ... otherwise, we can complete the Roam command here. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4623 | if(eCsrStopRoamingDueToConcurrency == RoamState) |
| 4624 | { |
| 4625 | csrRoamComplete( pMac, eCsrJoinFailureDueToConcurrency, NULL ); |
| 4626 | } |
| 4627 | else |
| 4628 | { |
| 4629 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 4630 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4631 | } |
| 4632 | } |
| 4633 | else if ( eCsrReassocToSelfNoCapChange == RoamState ) |
| 4634 | { |
| 4635 | csrRoamComplete( pMac, eCsrSilentlyStopRoamingSaveState, NULL ); |
| 4636 | } |
| 4637 | else if ( eCsrStartIbssSameIbss == RoamState ) |
| 4638 | { |
| 4639 | csrRoamComplete( pMac, eCsrSilentlyStopRoaming, NULL ); |
| 4640 | } |
| 4641 | }//hddIsRadioStateOn |
| 4642 | |
| 4643 | return status; |
| 4644 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4645 | eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4646 | { |
| 4647 | tANI_U32 sessionId; |
| 4648 | tCsrRoamSession *pSession; |
| 4649 | tCsrScanResult *pScanResult = NULL; |
| 4650 | tSirBssDescription *pBssDesc = NULL; |
| 4651 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4652 | sessionId = pCommand->sessionId; |
| 4653 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4654 | |
| 4655 | if(!pSession) |
| 4656 | { |
| 4657 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4658 | return eHAL_STATUS_FAILURE; |
| 4659 | } |
| 4660 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4661 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 4662 | { |
| 4663 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4664 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4665 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4666 | return eHAL_STATUS_FAILURE; |
| 4667 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4668 | if (pCommand->u.roamCmd.pRoamBssEntry) |
| 4669 | { |
| 4670 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4671 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4672 | } |
| 4673 | else |
| 4674 | { |
| 4675 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4676 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4677 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4678 | return eHAL_STATUS_FAILURE; |
| 4679 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4680 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 4681 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 4682 | return status; |
| 4683 | } |
| 4684 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4685 | eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4686 | { |
| 4687 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4688 | tCsrRoamInfo roamInfo; |
| 4689 | tANI_U32 sessionId = pCommand->sessionId; |
| 4690 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4691 | |
| 4692 | if(!pSession) |
| 4693 | { |
| 4694 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4695 | return eHAL_STATUS_FAILURE; |
| 4696 | } |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 4697 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4698 | switch ( pCommand->u.roamCmd.roamReason ) |
| 4699 | { |
| 4700 | case eCsrForcedDisassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4701 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4702 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4703 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4704 | case eCsrSmeIssuedDisassocForHandoff: |
| 4705 | //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect |
| 4706 | #if 0 // TODO : Confirm this change |
| 4707 | status = csrRoamProcessDisassociate( pMac, pCommand, FALSE ); |
| 4708 | #else |
| 4709 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 4710 | #endif |
| 4711 | |
| 4712 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4713 | case eCsrForcedDisassocMICFailure: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4714 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4715 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4716 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4717 | case eCsrForcedDeauth: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4718 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4719 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4720 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4721 | case eCsrHddIssuedReassocToSameAP: |
| 4722 | case eCsrSmeIssuedReassocToSameAP: |
| 4723 | { |
| 4724 | tDot11fBeaconIEs *pIes = NULL; |
| 4725 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4726 | if( pSession->pConnectBssDesc ) |
| 4727 | { |
| 4728 | status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes); |
| 4729 | if(!HAL_STATUS_SUCCESS(status) ) |
| 4730 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4731 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4732 | } |
| 4733 | else |
| 4734 | { |
| 4735 | roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged; |
| 4736 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 4737 | pSession->roamingReason = eCsrReassocRoaming; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4738 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 4739 | roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4740 | pSession->bRefAssocStartCnt++; |
| 4741 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4742 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4743 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4744 | smsLog(pMac, LOG1, FL(" calling csrRoamIssueReassociate")); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4745 | status = csrRoamIssueReassociate( pMac, sessionId, pSession->pConnectBssDesc, pIes, |
| 4746 | &pCommand->u.roamCmd.roamProfile ); |
| 4747 | if(!HAL_STATUS_SUCCESS(status)) |
| 4748 | { |
| 4749 | smsLog(pMac, LOGE, FL("csrRoamIssueReassociate failed with status %d"), status); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 4750 | csrReleaseCommandRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4751 | } |
| 4752 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4753 | vos_mem_free(pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4754 | pIes = NULL; |
| 4755 | } |
| 4756 | } |
Padma, Santhosh Kumar | 3d8d576 | 2014-07-22 14:52:23 +0530 | [diff] [blame] | 4757 | else |
| 4758 | status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4759 | break; |
| 4760 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4761 | case eCsrCapsChange: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4762 | smsLog(pMac, LOGE, FL("received eCsrCapsChange ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4763 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4764 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); |
| 4765 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4766 | case eCsrSmeIssuedFTReassoc: |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4767 | smsLog(pMac, LOG1, FL("received FT Reassoc Req ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4768 | status = csrProcessFTReassocRoamCommand(pMac, pCommand); |
| 4769 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4771 | case eCsrStopBss: |
| 4772 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4773 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4774 | break; |
| 4775 | |
| 4776 | case eCsrForcedDisassocSta: |
| 4777 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4778 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId); |
| 4779 | status = csrSendMBDisassocReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4780 | pCommand->u.roamCmd.reason); |
| 4781 | break; |
| 4782 | |
| 4783 | case eCsrForcedDeauthSta: |
| 4784 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4785 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId); |
| 4786 | status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4787 | pCommand->u.roamCmd.reason); |
| 4788 | break; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4789 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4790 | case eCsrPerformPreauth: |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 4791 | smsLog(pMac, LOG1, FL("Attempting FT PreAuth Req")); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4792 | status = csrRoamIssueFTPreauthReq(pMac, sessionId, |
| 4793 | pCommand->u.roamCmd.pLastRoamBss); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4794 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4795 | |
| 4796 | default: |
| 4797 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4798 | |
| 4799 | if( pCommand->u.roamCmd.fUpdateCurRoamProfile ) |
| 4800 | { |
| 4801 | //Remember the roaming profile |
| 4802 | csrFreeRoamProfile(pMac, sessionId); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4803 | pSession->pCurRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 4804 | if ( NULL != pSession->pCurRoamProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4805 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4806 | vos_mem_set(pSession->pCurRoamProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4807 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, &pCommand->u.roamCmd.roamProfile); |
| 4808 | } |
| 4809 | } |
| 4810 | |
| 4811 | //At this point, original uapsd_mask is saved in pCurRoamProfile |
| 4812 | //uapsd_mask in the pCommand may change from this point on. |
| 4813 | |
| 4814 | // Attempt to roam with the new scan results (if we need to..) |
| 4815 | status = csrRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4816 | if(!HAL_STATUS_SUCCESS(status)) |
| 4817 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4818 | smsLog(pMac, LOGW, FL("csrRoam() failed with status = 0x%08X"), status); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4819 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4820 | break; |
| 4821 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4822 | return (status); |
| 4823 | } |
| 4824 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4825 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4826 | { |
| 4827 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4828 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4829 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4830 | vos_mem_set(&pCommand->u.roamCmd, sizeof(tRoamCmd), 0); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4831 | } |
| 4832 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4833 | void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4834 | { |
| 4835 | if(pCommand->u.roamCmd.fReleaseBssList) |
| 4836 | { |
| 4837 | csrScanResultPurge(pMac, pCommand->u.roamCmd.hBSSList); |
| 4838 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 4839 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 4840 | } |
| 4841 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 4842 | { |
| 4843 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 4844 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 4845 | } |
| 4846 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4847 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4848 | vos_mem_set(&pCommand->u.roamCmd, sizeof(tRoamCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4849 | } |
| 4850 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4851 | void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4852 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4853 | vos_mem_set(&pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4854 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4855 | void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context ) |
| 4856 | { |
| 4857 | tListElem *pEntry; |
| 4858 | tSmeCmd *pCommand; |
| 4859 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4860 | smsLog( pMac, LOG2, "Roam Completion ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4861 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 4862 | if ( pEntry ) |
| 4863 | { |
| 4864 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4865 | // If the head of the queue is Active and it is a ROAM command, remove |
| 4866 | // and put this on the Free queue. |
| 4867 | if ( eSmeCommandRoam == pCommand->command ) |
| 4868 | { |
| 4869 | //we need to process the result first before removing it from active list because state changes |
| 4870 | //still happening insides roamQProcessRoamResults so no other roam command should be issued |
| 4871 | fReleaseCommand = csrRoamProcessResults( pMac, pCommand, Result, Context ); |
| 4872 | if( fReleaseCommand ) |
| 4873 | { |
| 4874 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 4875 | { |
| 4876 | csrReleaseCommandRoam( pMac, pCommand ); |
| 4877 | } |
| 4878 | else |
| 4879 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4880 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4881 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4882 | } |
| 4883 | } |
| 4884 | else |
| 4885 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4886 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4887 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4888 | } |
| 4889 | } |
| 4890 | else |
| 4891 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4892 | 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] | 4893 | } |
| 4894 | } |
| 4895 | else |
| 4896 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4897 | smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4898 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4899 | if( fReleaseCommand ) |
| 4900 | { |
| 4901 | smeProcessPendingQueue( pMac ); |
| 4902 | } |
| 4903 | } |
| 4904 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4905 | void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4906 | { |
| 4907 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4908 | if(!pSession) |
| 4909 | { |
| 4910 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4911 | return; |
| 4912 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4913 | vos_mem_set(&(pSession->PmkidCandidateInfo[0]), |
| 4914 | sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4915 | pSession->NumPmkidCandidate = 0; |
| 4916 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4917 | #ifdef FEATURE_WLAN_WAPI |
| 4918 | void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4919 | { |
| 4920 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4921 | if(!pSession) |
| 4922 | { |
| 4923 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4924 | return; |
| 4925 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4926 | vos_mem_set(&(pSession->BkidCandidateInfo[0]), |
| 4927 | sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4928 | pSession->NumBkidCandidate = 0; |
| 4929 | } |
| 4930 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4931 | extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ]; |
| 4932 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4933 | static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, |
| 4934 | tSirBssDescription *pSirBssDesc, |
| 4935 | tDot11fBeaconIEs *pIes) |
| 4936 | { |
| 4937 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4938 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4939 | tDot11fBeaconIEs *pIesLocal = pIes; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4940 | |
| 4941 | if(!pSession) |
| 4942 | { |
| 4943 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4944 | return eHAL_STATUS_FAILURE; |
| 4945 | } |
| 4946 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4947 | if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4948 | (eCSR_AUTH_TYPE_WPA_PSK == authType) || |
| 4949 | (eCSR_AUTH_TYPE_RSN == authType) || |
| 4950 | (eCSR_AUTH_TYPE_RSN_PSK == authType) |
| 4951 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4952 | || |
| 4953 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4954 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) |
| 4955 | #endif /* FEATURE_WLAN_WAPI */ |
| 4956 | #ifdef FEATURE_WLAN_WAPI |
| 4957 | || |
| 4958 | (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4959 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType) |
| 4960 | #endif /* FEATURE_WLAN_WAPI */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4961 | #ifdef WLAN_FEATURE_11W |
| 4962 | || |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 4963 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) || |
| 4964 | (eCSR_AUTH_TYPE_RSN_8021X_SHA256 == authType) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4965 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4966 | ) |
| 4967 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4968 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4969 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4970 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4971 | } |
| 4972 | if( pIesLocal ) |
| 4973 | { |
| 4974 | tANI_U32 nIeLen; |
| 4975 | tANI_U8 *pIeBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4976 | if((eCSR_AUTH_TYPE_RSN == authType) || |
| 4977 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4978 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4979 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) || |
| 4980 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4981 | #if defined WLAN_FEATURE_11W |
| 4982 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) || |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 4983 | (eCSR_AUTH_TYPE_RSN_8021X_SHA256 == authType) || |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4984 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4985 | (eCSR_AUTH_TYPE_RSN_PSK == authType)) |
| 4986 | { |
| 4987 | if(pIesLocal->RSN.present) |
| 4988 | { |
| 4989 | //Calculate the actual length |
| 4990 | nIeLen = 8 //version + gp_cipher_suite + pwise_cipher_suite_count |
| 4991 | + pIesLocal->RSN.pwise_cipher_suite_count * 4 //pwise_cipher_suites |
| 4992 | + 2 //akm_suite_count |
| 4993 | + pIesLocal->RSN.akm_suite_count * 4 //akm_suites |
| 4994 | + 2; //reserved |
| 4995 | if( pIesLocal->RSN.pmkid_count ) |
| 4996 | { |
| 4997 | nIeLen += 2 + pIesLocal->RSN.pmkid_count * 4; //pmkid |
| 4998 | } |
| 4999 | //nIeLen doesn't count EID and length fields |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5000 | pSession->pWpaRsnRspIE = vos_mem_malloc(nIeLen + 2); |
| 5001 | if (NULL == pSession->pWpaRsnRspIE) |
| 5002 | status = eHAL_STATUS_FAILURE; |
| 5003 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5004 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5005 | vos_mem_set(pSession->pWpaRsnRspIE, nIeLen + 2, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5006 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_RSN; |
| 5007 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 5008 | //copy upto akm_suites |
| 5009 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5010 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.version, |
| 5011 | sizeof(pIesLocal->RSN.version)); |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 5012 | pIeBuf += sizeof(pIesLocal->RSN.version); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5013 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.gp_cipher_suite, |
| 5014 | sizeof(pIesLocal->RSN.gp_cipher_suite)); |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 5015 | pIeBuf += sizeof(pIesLocal->RSN.gp_cipher_suite); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5016 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.pwise_cipher_suite_count, |
| 5017 | sizeof(pIesLocal->RSN.pwise_cipher_suite_count)); |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 5018 | pIeBuf += sizeof(pIesLocal->RSN.pwise_cipher_suite_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5019 | if( pIesLocal->RSN.pwise_cipher_suite_count ) |
| 5020 | { |
| 5021 | //copy pwise_cipher_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5022 | vos_mem_copy(pIeBuf, |
| 5023 | pIesLocal->RSN.pwise_cipher_suites, |
| 5024 | pIesLocal->RSN.pwise_cipher_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5025 | pIeBuf += pIesLocal->RSN.pwise_cipher_suite_count * 4; |
| 5026 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5027 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.akm_suite_count, 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5028 | pIeBuf += 2; |
| 5029 | if( pIesLocal->RSN.akm_suite_count ) |
| 5030 | { |
| 5031 | //copy akm_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5032 | vos_mem_copy(pIeBuf, |
| 5033 | pIesLocal->RSN.akm_suites, |
| 5034 | pIesLocal->RSN.akm_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5035 | pIeBuf += pIesLocal->RSN.akm_suite_count * 4; |
| 5036 | } |
| 5037 | //copy the rest |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5038 | vos_mem_copy(pIeBuf, |
| 5039 | pIesLocal->RSN.akm_suites + pIesLocal->RSN.akm_suite_count * 4, |
| 5040 | 2 + pIesLocal->RSN.pmkid_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5041 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 5042 | } |
| 5043 | } |
| 5044 | } |
| 5045 | else if((eCSR_AUTH_TYPE_WPA == authType) || |
| 5046 | (eCSR_AUTH_TYPE_WPA_PSK == authType)) |
| 5047 | { |
| 5048 | if(pIesLocal->WPA.present) |
| 5049 | { |
| 5050 | //Calculate the actual length |
| 5051 | nIeLen = 12 //OUI + version + multicast_cipher + unicast_cipher_count |
| 5052 | + pIesLocal->WPA.unicast_cipher_count * 4 //unicast_ciphers |
| 5053 | + 2 //auth_suite_count |
| 5054 | + pIesLocal->WPA.auth_suite_count * 4; //auth_suites |
| 5055 | // The WPA capabilities follows the Auth Suite (two octects)-- |
| 5056 | // this field is optional, and we always "send" zero, so just |
| 5057 | // remove it. This is consistent with our assumptions in the |
| 5058 | // frames compiler; c.f. bug 15234: |
| 5059 | //nIeLen doesn't count EID and length fields |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5060 | |
| 5061 | pSession->pWpaRsnRspIE = vos_mem_malloc(nIeLen + 2); |
| 5062 | if ( NULL == pSession->pWpaRsnRspIE ) |
| 5063 | status = eHAL_STATUS_FAILURE; |
| 5064 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5065 | { |
| 5066 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_WPA; |
| 5067 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 5068 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 5069 | //Copy WPA OUI |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5070 | vos_mem_copy(pIeBuf, &csrWpaOui[1], 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5071 | pIeBuf += 4; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5072 | vos_mem_copy(pIeBuf, &pIesLocal->WPA.version, |
| 5073 | 8 + pIesLocal->WPA.unicast_cipher_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5074 | pIeBuf += 8 + pIesLocal->WPA.unicast_cipher_count * 4; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5075 | vos_mem_copy(pIeBuf, &pIesLocal->WPA.auth_suite_count, |
| 5076 | 2 + pIesLocal->WPA.auth_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5077 | pIeBuf += pIesLocal->WPA.auth_suite_count * 4; |
| 5078 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 5079 | } |
| 5080 | } |
| 5081 | } |
| 5082 | #ifdef FEATURE_WLAN_WAPI |
| 5083 | else if((eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 5084 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType)) |
| 5085 | { |
| 5086 | if(pIesLocal->WAPI.present) |
| 5087 | { |
| 5088 | //Calculate the actual length |
| 5089 | nIeLen = 4 //version + akm_suite_count |
| 5090 | + pIesLocal->WAPI.akm_suite_count * 4 // akm_suites |
| 5091 | + 2 //pwise_cipher_suite_count |
| 5092 | + pIesLocal->WAPI.unicast_cipher_suite_count * 4 //pwise_cipher_suites |
| 5093 | + 6; //gp_cipher_suite + preauth + reserved |
| 5094 | if( pIesLocal->WAPI.bkid_count ) |
| 5095 | { |
| 5096 | nIeLen += 2 + pIesLocal->WAPI.bkid_count * 4; //bkid |
| 5097 | } |
| 5098 | |
| 5099 | //nIeLen doesn't count EID and length fields |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5100 | pSession->pWapiRspIE = vos_mem_malloc(nIeLen + 2); |
| 5101 | if ( NULL == pSession->pWapiRspIE ) |
| 5102 | status = eHAL_STATUS_FAILURE; |
| 5103 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5104 | { |
| 5105 | pSession->pWapiRspIE[0] = DOT11F_EID_WAPI; |
| 5106 | pSession->pWapiRspIE[1] = (tANI_U8)nIeLen; |
| 5107 | pIeBuf = pSession->pWapiRspIE + 2; |
| 5108 | //copy upto akm_suite_count |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5109 | vos_mem_copy(pIeBuf, &pIesLocal->WAPI.version, 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5110 | pIeBuf += 4; |
| 5111 | if( pIesLocal->WAPI.akm_suite_count ) |
| 5112 | { |
| 5113 | //copy akm_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5114 | vos_mem_copy(pIeBuf, pIesLocal->WAPI.akm_suites, |
| 5115 | pIesLocal->WAPI.akm_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5116 | pIeBuf += pIesLocal->WAPI.akm_suite_count * 4; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5117 | } |
| 5118 | vos_mem_copy(pIeBuf, |
| 5119 | &pIesLocal->WAPI.unicast_cipher_suite_count, |
| 5120 | 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5121 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5122 | if( pIesLocal->WAPI.unicast_cipher_suite_count ) |
| 5123 | { |
| 5124 | //copy pwise_cipher_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5125 | vos_mem_copy( pIeBuf, |
| 5126 | pIesLocal->WAPI.unicast_cipher_suites, |
| 5127 | pIesLocal->WAPI.unicast_cipher_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5128 | pIeBuf += pIesLocal->WAPI.unicast_cipher_suite_count * 4; |
| 5129 | } |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 5130 | //gp_cipher_suite |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5131 | vos_mem_copy(pIeBuf, |
| 5132 | pIesLocal->WAPI.multicast_cipher_suite, |
| 5133 | 4); |
Praveen Kumar Sirisilla | 16c6377 | 2013-10-23 19:31:58 -0700 | [diff] [blame] | 5134 | pIeBuf += 4; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 5135 | //preauth + reserved |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5136 | vos_mem_copy(pIeBuf, |
| 5137 | pIesLocal->WAPI.multicast_cipher_suite + 4, |
| 5138 | 2); |
Praveen Kumar Sirisilla | 16c6377 | 2013-10-23 19:31:58 -0700 | [diff] [blame] | 5139 | pIeBuf += 2; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 5140 | //bkid_count |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5141 | vos_mem_copy(pIeBuf, &pIesLocal->WAPI.bkid_count, 2); |
| 5142 | |
Praveen Kumar Sirisilla | 16c6377 | 2013-10-23 19:31:58 -0700 | [diff] [blame] | 5143 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5144 | if( pIesLocal->WAPI.bkid_count ) |
| 5145 | { |
| 5146 | //copy akm_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5147 | vos_mem_copy(pIeBuf, pIesLocal->WAPI.bkid, |
| 5148 | pIesLocal->WAPI.bkid_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5149 | pIeBuf += pIesLocal->WAPI.bkid_count * 4; |
| 5150 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 5151 | pSession->nWapiRspIeLength = nIeLen + 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5152 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5153 | } |
| 5154 | } |
| 5155 | #endif /* FEATURE_WLAN_WAPI */ |
| 5156 | if( !pIes ) |
| 5157 | { |
| 5158 | //locally allocated |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5159 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5160 | } |
| 5161 | } |
| 5162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5163 | return (status); |
| 5164 | } |
| 5165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5166 | static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs ) |
| 5167 | { |
| 5168 | v_U8_t bACWeights[WLANTL_MAX_AC]; |
| 5169 | v_U8_t paramBk, paramBe, paramVi, paramVo; |
| 5170 | v_BOOL_t fWeightChange = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5171 | //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO) |
| 5172 | //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount |
| 5173 | //of the higher AC one, make the higher AC has the same weight as the lower AC. |
| 5174 | //This doesn't address the case where the lower AC needs a real higher weight |
| 5175 | if( pIEs->WMMParams.present ) |
| 5176 | { |
| 5177 | //no change to the lowest ones |
| 5178 | bACWeights[WLANTL_AC_BK] = pMac->roam.ucACWeights[WLANTL_AC_BK]; |
| 5179 | bACWeights[WLANTL_AC_BE] = pMac->roam.ucACWeights[WLANTL_AC_BE]; |
| 5180 | bACWeights[WLANTL_AC_VI] = pMac->roam.ucACWeights[WLANTL_AC_VI]; |
| 5181 | bACWeights[WLANTL_AC_VO] = pMac->roam.ucACWeights[WLANTL_AC_VO]; |
| 5182 | paramBk = pIEs->WMMParams.acbk_aifsn + pIEs->WMMParams.acbk_acwmin; |
| 5183 | paramBe = pIEs->WMMParams.acbe_aifsn + pIEs->WMMParams.acbe_acwmin; |
| 5184 | paramVi = pIEs->WMMParams.acvi_aifsn + pIEs->WMMParams.acvi_acwmin; |
| 5185 | paramVo = pIEs->WMMParams.acvo_aifsn + pIEs->WMMParams.acvo_acwmin; |
| 5186 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramBe) ) |
| 5187 | { |
| 5188 | bACWeights[WLANTL_AC_BE] = bACWeights[WLANTL_AC_BK]; |
| 5189 | fWeightChange = VOS_TRUE; |
| 5190 | } |
| 5191 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVi) ) |
| 5192 | { |
| 5193 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BK]; |
| 5194 | fWeightChange = VOS_TRUE; |
| 5195 | } |
| 5196 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVi) ) |
| 5197 | { |
| 5198 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BE]; |
| 5199 | fWeightChange = VOS_TRUE; |
| 5200 | } |
| 5201 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVo) ) |
| 5202 | { |
| 5203 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BK]; |
| 5204 | fWeightChange = VOS_TRUE; |
| 5205 | } |
| 5206 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVo) ) |
| 5207 | { |
| 5208 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BE]; |
| 5209 | fWeightChange = VOS_TRUE; |
| 5210 | } |
| 5211 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramVi, paramVo) ) |
| 5212 | { |
| 5213 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_VI]; |
| 5214 | fWeightChange = VOS_TRUE; |
| 5215 | } |
| 5216 | if(fWeightChange) |
| 5217 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5218 | 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] | 5219 | bACWeights[2], bACWeights[3]); |
| 5220 | WLANTL_SetACWeights(pMac->roam.gVosContext, bACWeights); |
| 5221 | } |
| 5222 | } |
| 5223 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5224 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5225 | //Returns whether the current association is a 11r assoc or not |
| 5226 | tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 5227 | { |
| 5228 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5229 | return csrNeighborRoamIs11rAssoc(pMac); |
| 5230 | #else |
| 5231 | return eANI_BOOLEAN_FALSE; |
| 5232 | #endif |
| 5233 | } |
| 5234 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5235 | #ifdef FEATURE_WLAN_ESE |
| 5236 | //Returns whether the current association is a ESE assoc or not |
| 5237 | tANI_BOOLEAN csrRoamIsESEAssoc(tpAniSirGlobal pMac) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5238 | { |
| 5239 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5240 | return csrNeighborRoamIsESEAssoc(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5241 | #else |
| 5242 | return eANI_BOOLEAN_FALSE; |
| 5243 | #endif |
| 5244 | } |
| 5245 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5246 | #ifdef FEATURE_WLAN_LFR |
| 5247 | //Returns whether "Legacy Fast Roaming" is currently enabled...or not |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 5248 | tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac, tANI_U32 sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5249 | { |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 5250 | tCsrRoamSession *pSession = NULL; |
| 5251 | |
| 5252 | if (CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 5253 | { |
| 5254 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 5255 | if (NULL != pSession->pCurRoamProfile) |
| 5256 | { |
| 5257 | if (pSession->pCurRoamProfile->csrPersona != VOS_STA_MODE) |
| 5258 | { |
| 5259 | return eANI_BOOLEAN_FALSE; |
| 5260 | } |
| 5261 | } |
| 5262 | } |
| 5263 | |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5264 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 5265 | if (eANI_BOOLEAN_TRUE == CSR_IS_FASTROAM_IN_CONCURRENCY_INI_FEATURE_ENABLED(pMac)) |
| 5266 | { |
| 5267 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled); |
| 5268 | } |
| 5269 | else |
| 5270 | #endif |
| 5271 | { |
| 5272 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled && |
Madan Mohan Koyyalamudi | 393a434 | 2012-10-15 16:07:09 -0700 | [diff] [blame] | 5273 | (!csrIsConcurrentSessionRunning(pMac))); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5274 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5275 | } |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5276 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5277 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5278 | /* --------------------------------------------------------------------------- |
| 5279 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5280 | \fn csrNeighborRoamIsESEAssoc |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5281 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5282 | \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] | 5283 | |
| 5284 | \param pMac - The handle returned by macOpen. |
| 5285 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5286 | \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] | 5287 | |
| 5288 | ---------------------------------------------------------------------------*/ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5289 | tANI_BOOLEAN csrNeighborRoamIsESEAssoc(tpAniSirGlobal pMac) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5290 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5291 | return pMac->roam.neighborRoamInfo.isESEAssoc; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5292 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5293 | #endif /* FEATURE_WLAN_ESE */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5294 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 5295 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 5296 | //Returns whether "FW based BG scan" is currently enabled...or not |
| 5297 | tANI_BOOLEAN csrRoamIsRoamOffloadScanEnabled(tpAniSirGlobal pMac) |
| 5298 | { |
| 5299 | return (pMac->roam.configParam.isRoamOffloadScanEnabled); |
| 5300 | } |
| 5301 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5302 | #endif |
| 5303 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5304 | #if defined(FEATURE_WLAN_ESE) |
| 5305 | tANI_BOOLEAN csrRoamIsEseIniFeatureEnabled(tpAniSirGlobal pMac) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5306 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5307 | return pMac->roam.configParam.isEseIniFeatureEnabled; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5308 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5309 | #endif /*FEATURE_WLAN_ESE*/ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5310 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5311 | //Return true means the command can be release, else not |
| 5312 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 5313 | eCsrRoamCompleteResult Result, void *Context ) |
| 5314 | { |
| 5315 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
| 5316 | tSirBssDescription *pSirBssDesc = NULL; |
| 5317 | tSirMacAddr BroadcastMac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 5318 | tCsrScanResult *pScanResult = NULL; |
| 5319 | tCsrRoamInfo roamInfo; |
| 5320 | sme_QosAssocInfo assocInfo; |
| 5321 | sme_QosCsrEventIndType ind_qos;//indication for QoS module in SME |
| 5322 | tANI_U8 acm_mask = 0; //HDD needs the ACM mask in the assoc rsp callback |
| 5323 | tDot11fBeaconIEs *pIes = NULL; |
| 5324 | tANI_U32 sessionId = pCommand->sessionId; |
| 5325 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 5326 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 5327 | eRoamCmdStatus roamStatus; |
| 5328 | eCsrRoamResult roamResult; |
| 5329 | eHalStatus status; |
| 5330 | tANI_U32 key_timeout_interval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5331 | tSirSmeStartBssRsp *pSmeStartBssRsp = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5332 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5333 | if(!pSession) |
| 5334 | { |
| 5335 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 5336 | return eANI_BOOLEAN_FALSE; |
| 5337 | } |
| 5338 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5339 | smsLog( pMac, LOG1, FL("Processing ROAM results...")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5340 | switch( Result ) |
| 5341 | { |
| 5342 | case eCsrJoinSuccess: |
| 5343 | // reset the IDLE timer |
| 5344 | // !! |
| 5345 | // !! fall through to the next CASE statement here is intentional !! |
| 5346 | // !! |
| 5347 | case eCsrReassocSuccess: |
| 5348 | if(eCsrReassocSuccess == Result) |
| 5349 | { |
| 5350 | ind_qos = SME_QOS_CSR_REASSOC_COMPLETE; |
| 5351 | } |
| 5352 | else |
| 5353 | { |
| 5354 | ind_qos = SME_QOS_CSR_ASSOC_COMPLETE; |
| 5355 | } |
| 5356 | // Success Join Response from LIM. Tell NDIS we are connected and save the |
| 5357 | // Connected state... |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5358 | smsLog(pMac, LOGW, FL("receives association indication")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5359 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5360 | //always free the memory here |
| 5361 | if(pSession->pWpaRsnRspIE) |
| 5362 | { |
| 5363 | pSession->nWpaRsnRspIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5364 | vos_mem_free(pSession->pWpaRsnRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5365 | pSession->pWpaRsnRspIE = NULL; |
| 5366 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5367 | #ifdef FEATURE_WLAN_WAPI |
| 5368 | if(pSession->pWapiRspIE) |
| 5369 | { |
| 5370 | pSession->nWapiRspIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5371 | vos_mem_free(pSession->pWapiRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5372 | pSession->pWapiRspIE = NULL; |
| 5373 | } |
| 5374 | #endif /* FEATURE_WLAN_WAPI */ |
| 5375 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5376 | //Reset counter so no join retry is needed. |
| 5377 | pSession->maxRetryCount = 0; |
| 5378 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 5379 | #endif |
| 5380 | /* This creates problem since we have not saved the connected profile. |
| 5381 | So moving this after saving the profile |
| 5382 | */ |
| 5383 | //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED ); |
Abhishek Singh | 36abbcb | 2014-03-20 13:04:09 +0530 | [diff] [blame] | 5384 | |
| 5385 | /* Reset remainInPowerActiveTillDHCP as it might have been set |
| 5386 | * by last failed secured connection. |
| 5387 | * It should be set only for secured connection. |
| 5388 | */ |
| 5389 | pMac->pmc.remainInPowerActiveTillDHCP = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5390 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 5391 | { |
| 5392 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 5393 | } |
| 5394 | else |
| 5395 | { |
| 5396 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED; |
| 5397 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5398 | //Use the last connected bssdesc for reassoc-ing to the same AP. |
| 5399 | //NOTE: What to do when reassoc to a different AP??? |
| 5400 | if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) || |
| 5401 | (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ) |
| 5402 | { |
| 5403 | pSirBssDesc = pSession->pConnectBssDesc; |
| 5404 | if(pSirBssDesc) |
| 5405 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5406 | vos_mem_copy(&roamInfo.bssid, &pSirBssDesc->bssId, |
| 5407 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5408 | } |
| 5409 | } |
| 5410 | else |
| 5411 | { |
| 5412 | |
| 5413 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5414 | { |
| 5415 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 5416 | if(pScanResult != NULL) |
| 5417 | { |
| 5418 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5419 | //this can be NULL |
| 5420 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5421 | vos_mem_copy(&roamInfo.bssid, &pSirBssDesc->bssId, |
| 5422 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5423 | } |
| 5424 | } |
| 5425 | } |
| 5426 | if( pSirBssDesc ) |
| 5427 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5428 | roamInfo.staId = HAL_STA_INVALID_IDX; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5429 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 5430 | //Save WPA/RSN IE |
| 5431 | csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5432 | #ifdef FEATURE_WLAN_ESE |
| 5433 | roamInfo.isESEAssoc = pSession->connectedProfile.isESEAssoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5434 | #endif |
Mukul Sharma | 9ca96b2 | 2014-11-15 19:40:04 +0530 | [diff] [blame] | 5435 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5436 | if (pSirBssDesc->mdiePresent) |
| 5437 | { |
| 5438 | if(csrIsAuthType11r(pProfile->negotiatedAuthType, VOS_TRUE) |
| 5439 | #ifdef FEATURE_WLAN_ESE |
| 5440 | && !((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) && |
| 5441 | (pIes->ESEVersion.present) && (pMac->roam.configParam.isEseIniFeatureEnabled)) |
| 5442 | #endif |
| 5443 | ) |
| 5444 | { |
| 5445 | // is11Rconnection; |
| 5446 | roamInfo.is11rAssoc = VOS_TRUE; |
| 5447 | } |
| 5448 | else |
| 5449 | { |
| 5450 | // is11Rconnection; |
| 5451 | roamInfo.is11rAssoc = VOS_FALSE; |
| 5452 | } |
| 5453 | } |
| 5454 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5455 | // csrRoamStateChange also affects sub-state. Hence, csrRoamStateChange happens first and then |
| 5456 | // substate change. |
| 5457 | // Moving even save profile above so that below mentioned conditon is also met. |
| 5458 | // JEZ100225: Moved to after saving the profile. Fix needed in main/latest |
| 5459 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5460 | // Make sure the Set Context is issued before link indication to NDIS. After link indication is |
| 5461 | // made to NDIS, frames could start flowing. If we have not set context with LIM, the frames |
| 5462 | // will be dropped for the security context may not be set properly. |
| 5463 | // |
| 5464 | // this was causing issues in the 2c_wlan_wep WHQL test when the SetContext was issued after the link |
| 5465 | // indication. (Link Indication happens in the profFSMSetConnectedInfra call). |
| 5466 | // |
| 5467 | // this reordering was done on titan_prod_usb branch and is being replicated here. |
| 5468 | // |
| 5469 | |
| 5470 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && |
| 5471 | !pProfile->bWPSAssociation) |
| 5472 | { |
| 5473 | // Issue the set Context request to LIM to establish the Unicast STA context |
| 5474 | if( !HAL_STATUS_SUCCESS( csrRoamIssueSetContextReq( pMac, sessionId, |
| 5475 | pProfile->negotiatedUCEncryptionType, |
| 5476 | pSirBssDesc, &(pSirBssDesc->bssId), |
| 5477 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ) ) ) // NO keys... these key parameters don't matter. |
| 5478 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5479 | smsLog( pMac, LOGE, FL(" Set context for unicast fail") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5480 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 5481 | } |
| 5482 | // Issue the set Context request to LIM to establish the Broadcast STA context |
| 5483 | csrRoamIssueSetContextReq( pMac, sessionId, pProfile->negotiatedMCEncryptionType, |
| 5484 | pSirBssDesc, &BroadcastMac, |
| 5485 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5486 | } |
| 5487 | else |
| 5488 | { |
| 5489 | //Need to wait for supplicant authtication |
| 5490 | roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5491 | //Set the subestate to WaitForKey in case authentiation is needed |
| 5492 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId ); |
| 5493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5494 | if(pProfile->bWPSAssociation) |
| 5495 | { |
| 5496 | key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD; |
| 5497 | } |
| 5498 | else |
| 5499 | { |
| 5500 | key_timeout_interval = CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD; |
| 5501 | } |
| 5502 | |
| 5503 | //Save sessionId in case of timeout |
| 5504 | pMac->roam.WaitForKeyTimerInfo.sessionId = (tANI_U8)sessionId; |
| 5505 | //This time should be long enough for the rest of the process plus setting key |
| 5506 | if(!HAL_STATUS_SUCCESS( csrRoamStartWaitForKeyTimer( pMac, key_timeout_interval ) ) ) |
| 5507 | { |
| 5508 | //Reset our state so nothting is blocked. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5509 | smsLog( pMac, LOGE, FL(" Failed to start pre-auth timer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5510 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 5511 | } |
| 5512 | } |
| 5513 | |
| 5514 | assocInfo.pBssDesc = pSirBssDesc; //could be NULL |
| 5515 | assocInfo.pProfile = pProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5516 | if(Context) |
| 5517 | { |
| 5518 | tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context; |
| 5519 | tANI_U32 len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5520 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5521 | len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength; |
| 5522 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5523 | len += pJoinRsp->parsedRicRspLen; |
| 5524 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5525 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5526 | len += pJoinRsp->tspecIeLen; |
| 5527 | #endif |
| 5528 | if(len) |
| 5529 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5530 | pSession->connectedInfo.pbFrames = vos_mem_malloc(len); |
| 5531 | if ( pSession->connectedInfo.pbFrames != NULL ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5532 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5533 | vos_mem_copy(pSession->connectedInfo.pbFrames, |
| 5534 | pJoinRsp->frames, len); |
| 5535 | pSession->connectedInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5536 | pSession->connectedInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5537 | pSession->connectedInfo.nBeaconLength = pJoinRsp->beaconLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5538 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5539 | pSession->connectedInfo.nRICRspLength = pJoinRsp->parsedRicRspLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5540 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 5541 | #ifdef FEATURE_WLAN_ESE |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5542 | pSession->connectedInfo.nTspecIeLength = pJoinRsp->tspecIeLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5543 | #endif |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5544 | roamInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5545 | roamInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5546 | roamInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 5547 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5548 | } |
| 5549 | } |
| 5550 | if(pCommand->u.roamCmd.fReassoc) |
| 5551 | { |
| 5552 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5553 | } |
| 5554 | pSession->connectedInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5555 | roamInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5556 | roamInfo.ucastSig = ( tANI_U8 )pJoinRsp->ucastSig; |
| 5557 | roamInfo.bcastSig = ( tANI_U8 )pJoinRsp->bcastSig; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 5558 | roamInfo.maxRateFlags = pJoinRsp->maxRateFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5559 | } |
| 5560 | else |
| 5561 | { |
| 5562 | if(pCommand->u.roamCmd.fReassoc) |
| 5563 | { |
| 5564 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5565 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5566 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5567 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5568 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5569 | } |
| 5570 | } |
Sandeep Puligilla | d91dccb | 2014-06-18 11:51:48 +0530 | [diff] [blame] | 5571 | /* Update the staId from the previous connected profile info |
| 5572 | as the reassociation is triggred at SME/HDD */ |
| 5573 | if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) || |
| 5574 | (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ) |
| 5575 | { |
| 5576 | roamInfo.staId = pSession->connectedInfo.staId; |
| 5577 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5578 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5579 | // Indicate SME-QOS with reassoc success event, only after |
| 5580 | // copying the frames |
| 5581 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo); |
| 5582 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5583 | roamInfo.pBssDesc = pSirBssDesc; |
| 5584 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5585 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5586 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5587 | acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL); |
| 5588 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 5589 | pSession->connectedProfile.acm_mask = acm_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5590 | //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame |
| 5591 | //It may be better to let QoS do this???? |
| 5592 | if( pSession->connectedProfile.modifyProfileFields.uapsd_mask ) |
| 5593 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5594 | smsLog(pMac, LOGE, " uapsd_mask (0x%X) set, request UAPSD now", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5595 | pSession->connectedProfile.modifyProfileFields.uapsd_mask); |
| 5596 | pmcStartUapsd( pMac, NULL, NULL ); |
| 5597 | } |
Gopichand Nakkala | dacbcb5 | 2013-04-18 16:41:54 +0530 | [diff] [blame] | 5598 | pSession->connectedProfile.dot11Mode = pSession->bssParams.uCfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5599 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5600 | if( pSession->bRefAssocStartCnt > 0 ) |
| 5601 | { |
| 5602 | pSession->bRefAssocStartCnt--; |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5603 | //Remove this code once SLM_Sessionization is supported |
| 5604 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5605 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5606 | { |
| 5607 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5608 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5609 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5610 | } |
| 5611 | |
| 5612 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5613 | // reset the PMKID candidate list |
| 5614 | csrResetPMKIDCandidateList( pMac, sessionId ); |
| 5615 | //Update TL's AC weight base on the current EDCA parameters |
| 5616 | //These parameters may change in the course of the connection, that sictuation |
| 5617 | //is not taken care here. This change is mainly to address a WIFI WMM test where |
| 5618 | //BE has a equal or higher TX priority than VI. |
| 5619 | //We only do this for infra link |
| 5620 | if( csrIsConnStateConnectedInfra(pMac, sessionId ) && pIes ) |
| 5621 | { |
| 5622 | csrCheckAndUpdateACWeight(pMac, pIes); |
| 5623 | } |
| 5624 | #ifdef FEATURE_WLAN_WAPI |
| 5625 | // reset the BKID candidate list |
| 5626 | csrResetBKIDCandidateList( pMac, sessionId ); |
| 5627 | #endif /* FEATURE_WLAN_WAPI */ |
| 5628 | } |
| 5629 | else |
| 5630 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5631 | smsLog(pMac, LOGW, " Roam command doesn't have a BSS desc"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5632 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5633 | csrScanCancelIdleScan(pMac); |
| 5634 | //Not to signal link up because keys are yet to be set. |
| 5635 | //The linkup function will overwrite the sub-state that we need to keep at this point. |
| 5636 | if( !CSR_IS_WAIT_FOR_KEY(pMac, sessionId) ) |
| 5637 | { |
| 5638 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 5639 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5640 | //Check if BMPS is required and start the BMPS retry timer. Timer period is large |
| 5641 | //enough to let security and DHCP handshake succeed before entry into BMPS |
| 5642 | if (pmcShouldBmpsTimerRun(pMac)) |
| 5643 | { |
Abhishek Singh | 65d939e | 2014-04-25 13:33:07 +0530 | [diff] [blame] | 5644 | /* Set remainInPowerActiveTillDHCP to make sure we wait for |
| 5645 | * until keys are set before going into BMPS. |
| 5646 | */ |
| 5647 | if(eANI_BOOLEAN_TRUE == roamInfo.fAuthRequired) |
| 5648 | { |
| 5649 | pMac->pmc.remainInPowerActiveTillDHCP = TRUE; |
| 5650 | smsLog(pMac, LOG1, FL("Set remainInPowerActiveTillDHCP " |
| 5651 | "to make sure we wait until keys are set before" |
| 5652 | " going to BMPS")); |
| 5653 | } |
| 5654 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5655 | if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP) |
| 5656 | != eHAL_STATUS_SUCCESS) |
| 5657 | { |
| 5658 | smsLog(pMac, LOGP, FL("Cannot start BMPS Retry timer")); |
| 5659 | } |
| 5660 | smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started")); |
| 5661 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5662 | break; |
| 5663 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5664 | case eCsrStartBssSuccess: |
| 5665 | // on the StartBss Response, LIM is returning the Bss Description that we |
| 5666 | // are beaconing. Add this Bss Description to our scan results and |
| 5667 | // chain the Profile to this Bss Description. On a Start BSS, there was no |
| 5668 | // detected Bss description (no partner) so we issued the Start Bss to |
| 5669 | // start the Ibss without any Bss description. Lim was kind enough to return |
| 5670 | // 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] | 5671 | smsLog(pMac, LOG2, FL("receives start BSS ok indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5672 | status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5673 | pSmeStartBssRsp = (tSirSmeStartBssRsp *)Context; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5674 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5675 | if( CSR_IS_IBSS( pProfile ) ) |
| 5676 | { |
| 5677 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 5678 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5679 | else if (CSR_IS_INFRA_AP(pProfile)) |
| 5680 | { |
| 5681 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 5682 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5683 | else |
| 5684 | { |
| 5685 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 5686 | } |
| 5687 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 5688 | { |
| 5689 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5690 | pSirBssDesc = &pSmeStartBssRsp->bssDescription; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5691 | if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs( pMac, pSirBssDesc, &pIes )) ) |
| 5692 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 5693 | smsLog(pMac, LOGW, FL("cannot parse IBSS IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5694 | roamInfo.pBssDesc = pSirBssDesc; |
| 5695 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5696 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5697 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_START_FAILED ); |
| 5698 | break; |
| 5699 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5700 | if (!CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5701 | { |
Tushnim Bhattacharyya | 5128d75 | 2013-06-26 23:23:18 -0700 | [diff] [blame] | 5702 | pScanResult = csrScanAppendBssDescription( pMac, pSirBssDesc, pIes, FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5703 | } |
| 5704 | csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
| 5705 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5706 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5707 | if(pSirBssDesc) |
| 5708 | { |
| 5709 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5710 | vos_mem_copy(&roamInfo.bssid, &pSirBssDesc->bssId, |
| 5711 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5712 | } |
| 5713 | //We are doen with the IEs so free it |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5714 | vos_mem_free(pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5715 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5716 | { |
| 5717 | vos_log_ibss_pkt_type *pIbssLog; |
| 5718 | tANI_U32 bi; |
| 5719 | |
| 5720 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5721 | if(pIbssLog) |
| 5722 | { |
| 5723 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 5724 | { |
| 5725 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5726 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_RSP; |
| 5727 | } |
| 5728 | else |
| 5729 | { |
| 5730 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_RSP; |
| 5731 | } |
| 5732 | if(pSirBssDesc) |
| 5733 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5734 | vos_mem_copy(pIbssLog->bssid, pSirBssDesc->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5735 | pIbssLog->operatingChannel = pSirBssDesc->channelId; |
| 5736 | } |
| 5737 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 5738 | { |
| 5739 | //***U8 is not enough for beacon interval |
| 5740 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 5741 | } |
| 5742 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5743 | } |
| 5744 | } |
| 5745 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5746 | //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption |
| 5747 | //is WPA2-PSK so it won't matter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5748 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile )) |
| 5749 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5750 | // Issue the set Context request to LIM to establish the Broadcast STA context for the Ibss. |
| 5751 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 5752 | pProfile->negotiatedMCEncryptionType, |
| 5753 | pSirBssDesc, &BroadcastMac, |
| 5754 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5755 | } |
| 5756 | } |
| 5757 | else |
| 5758 | { |
| 5759 | //Keep the state to eCSR_ROAMING_STATE_JOINING |
| 5760 | //Need to send join_req. |
| 5761 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5762 | { |
| 5763 | if((pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link))) |
| 5764 | { |
| 5765 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5766 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 5767 | // Set the roaming substate to 'join attempt'... |
| 5768 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 5769 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5770 | } |
| 5771 | } |
| 5772 | else |
| 5773 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5774 | smsLog( pMac, LOGE, " StartBSS for WDS station with no BssDesc" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5775 | VOS_ASSERT( 0 ); |
| 5776 | } |
| 5777 | } |
| 5778 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5779 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5780 | //trigger the connection start indication in Vista |
| 5781 | if( !CSR_IS_JOIN_TO_IBSS( pProfile ) ) |
| 5782 | { |
| 5783 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5784 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5785 | if( CSR_IS_WDS( pProfile ) ) |
| 5786 | { |
| 5787 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5788 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5789 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5790 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5791 | { |
| 5792 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5793 | roamResult = eCSR_ROAM_RESULT_INFRA_STARTED; |
| 5794 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5795 | |
| 5796 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5797 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5798 | //trigger the connection start indication in Vista |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5799 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5800 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5801 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 5802 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5803 | roamInfo.pBssDesc = pSirBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5804 | roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5805 | vos_mem_copy(roamInfo.bssid, pSirBssDesc->bssId, |
| 5806 | sizeof(tCsrBssid)); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5807 | //Remove this code once SLM_Sessionization is supported |
| 5808 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5809 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5810 | ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5811 | { |
| 5812 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5813 | } |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5814 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5815 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5816 | } |
| 5817 | |
| 5818 | csrScanCancelIdleScan(pMac); |
Ravi Joshi | 414b14c | 2013-10-04 16:33:26 -0700 | [diff] [blame] | 5819 | |
| 5820 | if( CSR_IS_WDS_STA( pProfile ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5821 | { |
| 5822 | //need to send stop BSS because we fail to send join_req |
| 5823 | csrRoamIssueDisassociateCmd( pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 5824 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5825 | eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED ); |
| 5826 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5827 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5828 | case eCsrStartBssFailure: |
| 5829 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5830 | { |
| 5831 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5832 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5833 | if(pIbssLog) |
| 5834 | { |
| 5835 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 5836 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5837 | } |
| 5838 | } |
| 5839 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5840 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5841 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5842 | if( CSR_IS_WDS( pProfile ) ) |
| 5843 | { |
| 5844 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5845 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5846 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5847 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5848 | { |
| 5849 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5850 | roamResult = eCSR_ROAM_RESULT_INFRA_START_FAILED; |
| 5851 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5852 | if(Context) |
| 5853 | { |
| 5854 | pSirBssDesc = (tSirBssDescription *)Context; |
| 5855 | } |
| 5856 | else |
| 5857 | { |
| 5858 | pSirBssDesc = NULL; |
| 5859 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5860 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5861 | roamInfo.pBssDesc = pSirBssDesc; |
| 5862 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5863 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5864 | csrSetDefaultDot11Mode( pMac ); |
| 5865 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5866 | case eCsrSilentlyStopRoaming: |
| 5867 | // We are here because we try to start the same IBSS |
| 5868 | //No message to PE |
| 5869 | // return the roaming state to Joined. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5870 | smsLog(pMac, LOGW, FL("receives silently roaming indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5871 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 5872 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5873 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5874 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5875 | if( roamInfo.pBssDesc ) |
| 5876 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5877 | vos_mem_copy(&roamInfo.bssid, &roamInfo.pBssDesc->bssId, |
| 5878 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5879 | } |
| 5880 | //Since there is no change in the current state, simply pass back no result otherwise |
| 5881 | //HDD may be mistakenly mark to disconnected state. |
| 5882 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5883 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5884 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5885 | case eCsrSilentlyStopRoamingSaveState: |
| 5886 | //We are here because we try to connect to the same AP |
| 5887 | //No message to PE |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5888 | smsLog(pMac, LOGW, FL("receives silently stop roaming indication")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5889 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5890 | |
| 5891 | //to aviod resetting the substate to NONE |
| 5892 | pMac->roam.curState[sessionId] = eCSR_ROAMING_STATE_JOINED; |
| 5893 | //No need to change substate to wai_for_key because there is no state change |
| 5894 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5895 | if( roamInfo.pBssDesc ) |
| 5896 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5897 | vos_mem_copy(&roamInfo.bssid, &roamInfo.pBssDesc->bssId, |
| 5898 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5899 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5900 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5901 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5902 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5903 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5904 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5905 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5906 | roamInfo.staId = pSession->connectedInfo.staId; |
| 5907 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5908 | VOS_ASSERT( roamInfo.staId != 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5909 | pSession->bRefAssocStartCnt--; |
| 5910 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5911 | eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5912 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE); |
| 5913 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5914 | case eCsrReassocFailure: |
| 5915 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5916 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL); |
| 5917 | #endif |
| 5918 | case eCsrJoinWdsFailure: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5919 | smsLog(pMac, LOGW, FL("failed to join WDS")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5920 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5921 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5922 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5923 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5924 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5925 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5926 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5927 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5928 | eCSR_ROAM_WDS_IND, |
| 5929 | eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED); |
| 5930 | //Need to issue stop_bss |
| 5931 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5932 | case eCsrJoinFailure: |
| 5933 | case eCsrNothingToJoin: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5934 | case eCsrJoinFailureDueToConcurrency: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5935 | default: |
| 5936 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5937 | smsLog(pMac, LOGW, FL("receives no association indication")); |
| 5938 | smsLog(pMac, LOG1, FL("Assoc ref count %d"), |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 5939 | pSession->bRefAssocStartCnt); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5940 | if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || |
| 5941 | CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) ) |
| 5942 | { |
| 5943 | //do not free for the other profiles as we need to send down stop BSS later |
| 5944 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5945 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5946 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5947 | csrSetDefaultDot11Mode( pMac ); |
| 5948 | } |
| 5949 | |
| 5950 | switch( pCommand->u.roamCmd.roamReason ) |
| 5951 | { |
| 5952 | // If this transition is because of an 802.11 OID, then we transition |
| 5953 | // back to INIT state so we sit waiting for more OIDs to be issued and |
| 5954 | // we don't start the IDLE timer. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5955 | case eCsrSmeIssuedFTReassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5956 | case eCsrSmeIssuedAssocToSimilarAP: |
| 5957 | case eCsrHddIssued: |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 5958 | case eCsrSmeIssuedDisassocForHandoff: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5959 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5960 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5961 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5962 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5963 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5964 | vos_mem_copy(&roamInfo.bssid, |
| 5965 | &pSession->joinFailStatusCode.bssId, |
| 5966 | sizeof(tCsrBssid)); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 5967 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5968 | /* Defeaturize this later if needed */ |
| 5969 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5970 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 5971 | if (csrRoamIsHandoffInProgress(pMac)) |
| 5972 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5973 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 5974 | csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE); |
| 5975 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5976 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5977 | if(pSession->bRefAssocStartCnt > 0) |
| 5978 | { |
| 5979 | pSession->bRefAssocStartCnt--; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5980 | if(eCsrJoinFailureDueToConcurrency == Result) |
| 5981 | { |
| 5982 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5983 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5984 | eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
| 5985 | } |
| 5986 | else |
| 5987 | { |
| 5988 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5989 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5990 | eCSR_ROAM_RESULT_FAILURE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5991 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5992 | } |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5993 | else |
| 5994 | { |
| 5995 | /* bRefAssocStartCnt is not incremented when |
| 5996 | * eRoamState == eCsrStopRoamingDueToConcurrency |
| 5997 | * in csrRoamJoinNextBss API. so handle this in |
| 5998 | * else case by sending assoc failure |
| 5999 | */ |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 6000 | csrRoamCallCallback(pMac, sessionId, &roamInfo, |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 6001 | pCommand->u.scanCmd.roamId, |
| 6002 | eCSR_ROAM_ASSOCIATION_FAILURE, |
| 6003 | eCSR_ROAM_RESULT_FAILURE); |
| 6004 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6005 | smsLog(pMac, LOG1, FL(" roam(reason %d) failed"), pCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6006 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Mukul Sharma | 5960ac8 | 2014-01-09 20:31:35 +0530 | [diff] [blame] | 6007 | sme_QosUpdateHandOff((tANI_U8)sessionId, VOS_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6008 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 6009 | #endif |
| 6010 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 6011 | csrScanStartIdleScan(pMac); |
| 6012 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6013 | //For WDS STA. To fix the issue where the WDS AP side may be too busy by |
| 6014 | //BT activity and not able to recevie WLAN traffic. Retry the join |
| 6015 | if( CSR_IS_WDS_STA(pProfile) ) |
| 6016 | { |
| 6017 | csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD); |
| 6018 | } |
| 6019 | #endif |
| 6020 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6021 | case eCsrHddIssuedReassocToSameAP: |
| 6022 | case eCsrSmeIssuedReassocToSameAP: |
| 6023 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 6024 | |
| 6025 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 6026 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6027 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 6028 | #endif |
| 6029 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 6030 | csrScanStartIdleScan(pMac); |
| 6031 | break; |
| 6032 | case eCsrForcedDisassoc: |
| 6033 | case eCsrForcedDeauth: |
| 6034 | case eCsrSmeIssuedIbssJoinFailure: |
| 6035 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 6036 | |
| 6037 | if(eCsrSmeIssuedIbssJoinFailure == pCommand->u.roamCmd.roamReason) |
| 6038 | { |
| 6039 | // Notify HDD that IBSS join failed |
| 6040 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 6041 | } |
| 6042 | else |
| 6043 | { |
| 6044 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 6045 | pCommand->u.roamCmd.roamId, |
| 6046 | eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 6047 | } |
| 6048 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6049 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 6050 | #endif |
| 6051 | csrRoamLinkDown(pMac, sessionId); |
Leela Venkata Kiran Kumar Reddy Chirala | 56df73f | 2014-01-30 14:18:00 -0800 | [diff] [blame] | 6052 | /* |
| 6053 | *DelSta not done FW still in conneced state so dont |
| 6054 | *issue IMPS req |
| 6055 | */ |
| 6056 | if (pMac->roam.deauthRspStatus == eSIR_SME_DEAUTH_STATUS) |
| 6057 | { |
| 6058 | smsLog(pMac, LOGW, FL("FW still in connected state ")); |
| 6059 | break; |
| 6060 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6061 | csrScanStartIdleScan(pMac); |
| 6062 | break; |
| 6063 | case eCsrForcedIbssLeave: |
| 6064 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 6065 | pCommand->u.roamCmd.roamId, |
| 6066 | eCSR_ROAM_IBSS_LEAVE, |
| 6067 | eCSR_ROAM_RESULT_IBSS_STOP); |
| 6068 | break; |
| 6069 | case eCsrForcedDisassocMICFailure: |
| 6070 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 6071 | |
| 6072 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_MIC_FAILURE); |
| 6073 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 6074 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 6075 | #endif |
| 6076 | csrScanStartIdleScan(pMac); |
| 6077 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6078 | case eCsrStopBss: |
| 6079 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 6080 | pCommand->u.roamCmd.roamId, |
| 6081 | eCSR_ROAM_INFRA_IND, |
| 6082 | eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 6083 | break; |
| 6084 | case eCsrForcedDisassocSta: |
| 6085 | case eCsrForcedDeauthSta: |
| 6086 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId); |
| 6087 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 6088 | { |
| 6089 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6090 | |
| 6091 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 6092 | { |
| 6093 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6094 | vos_mem_copy(roamInfo.peerMac, |
| 6095 | pCommand->u.roamCmd.peerMac, |
| 6096 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6097 | roamInfo.reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 6098 | roamInfo.statusCode = eSIR_SME_SUCCESS; |
| 6099 | status = csrRoamCallCallback(pMac, sessionId, |
| 6100 | &roamInfo, pCommand->u.roamCmd.roamId, |
| 6101 | eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 6102 | } |
| 6103 | } |
| 6104 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6105 | case eCsrLostLink1: |
| 6106 | // if lost link roam1 failed, then issue lost link Scan2 ... |
| 6107 | csrScanRequestLostLink2(pMac, sessionId); |
| 6108 | break; |
| 6109 | case eCsrLostLink2: |
| 6110 | // if lost link roam2 failed, then issue lost link scan3 ... |
| 6111 | csrScanRequestLostLink3(pMac, sessionId); |
| 6112 | break; |
| 6113 | case eCsrLostLink3: |
| 6114 | default: |
| 6115 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 6116 | |
| 6117 | //We are done with one round of lostlink roaming here |
| 6118 | csrScanHandleFailedLostlink3(pMac, sessionId); |
| 6119 | break; |
| 6120 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6121 | break; |
| 6122 | } |
| 6123 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6124 | return ( fReleaseCommand ); |
| 6125 | } |
| 6126 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6127 | eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext) |
| 6128 | { |
| 6129 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6130 | return (status); |
| 6131 | } |
| 6132 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6133 | eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile) |
| 6134 | { |
| 6135 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6136 | tANI_U32 size = 0; |
| 6137 | |
| 6138 | do |
| 6139 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6140 | vos_mem_set(pDstProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6141 | if(pSrcProfile->BSSIDs.numOfBSSIDs) |
| 6142 | { |
| 6143 | size = sizeof(tCsrBssid) * pSrcProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6144 | pDstProfile->BSSIDs.bssid = vos_mem_malloc(size); |
| 6145 | if ( NULL == pDstProfile->BSSIDs.bssid ) |
| 6146 | status = eHAL_STATUS_FAILURE; |
| 6147 | else |
| 6148 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6149 | if(!HAL_STATUS_SUCCESS(status)) |
| 6150 | { |
| 6151 | break; |
| 6152 | } |
| 6153 | pDstProfile->BSSIDs.numOfBSSIDs = pSrcProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6154 | vos_mem_copy(pDstProfile->BSSIDs.bssid, |
| 6155 | pSrcProfile->BSSIDs.bssid, size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6156 | } |
| 6157 | if(pSrcProfile->SSIDs.numOfSSIDs) |
| 6158 | { |
| 6159 | size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6160 | pDstProfile->SSIDs.SSIDList = vos_mem_malloc(size); |
| 6161 | if ( NULL == pDstProfile->SSIDs.SSIDList ) |
| 6162 | status = eHAL_STATUS_FAILURE; |
| 6163 | else |
| 6164 | status = eHAL_STATUS_SUCCESS; |
| 6165 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6166 | { |
| 6167 | break; |
| 6168 | } |
| 6169 | pDstProfile->SSIDs.numOfSSIDs = pSrcProfile->SSIDs.numOfSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6170 | vos_mem_copy(pDstProfile->SSIDs.SSIDList, |
| 6171 | pSrcProfile->SSIDs.SSIDList, size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6172 | } |
| 6173 | if(pSrcProfile->nWPAReqIELength) |
| 6174 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6175 | pDstProfile->pWPAReqIE = vos_mem_malloc(pSrcProfile->nWPAReqIELength); |
| 6176 | if ( NULL == pDstProfile->pWPAReqIE ) |
| 6177 | status = eHAL_STATUS_FAILURE; |
| 6178 | else |
| 6179 | status = eHAL_STATUS_SUCCESS; |
| 6180 | |
| 6181 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6182 | { |
| 6183 | break; |
| 6184 | } |
| 6185 | pDstProfile->nWPAReqIELength = pSrcProfile->nWPAReqIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6186 | vos_mem_copy(pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, |
| 6187 | pSrcProfile->nWPAReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6188 | } |
| 6189 | if(pSrcProfile->nRSNReqIELength) |
| 6190 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6191 | pDstProfile->pRSNReqIE = vos_mem_malloc(pSrcProfile->nRSNReqIELength); |
| 6192 | if ( NULL == pDstProfile->pRSNReqIE ) |
| 6193 | status = eHAL_STATUS_FAILURE; |
| 6194 | else |
| 6195 | status = eHAL_STATUS_SUCCESS; |
| 6196 | |
| 6197 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6198 | { |
| 6199 | break; |
| 6200 | } |
| 6201 | pDstProfile->nRSNReqIELength = pSrcProfile->nRSNReqIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6202 | vos_mem_copy(pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, |
| 6203 | pSrcProfile->nRSNReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6204 | } |
| 6205 | #ifdef FEATURE_WLAN_WAPI |
| 6206 | if(pSrcProfile->nWAPIReqIELength) |
| 6207 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6208 | pDstProfile->pWAPIReqIE = vos_mem_malloc(pSrcProfile->nWAPIReqIELength); |
| 6209 | if ( NULL == pDstProfile->pWAPIReqIE ) |
| 6210 | status = eHAL_STATUS_FAILURE; |
| 6211 | else |
| 6212 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6213 | if(!HAL_STATUS_SUCCESS(status)) |
| 6214 | { |
| 6215 | break; |
| 6216 | } |
| 6217 | pDstProfile->nWAPIReqIELength = pSrcProfile->nWAPIReqIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6218 | vos_mem_copy(pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, |
| 6219 | pSrcProfile->nWAPIReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6220 | } |
| 6221 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6222 | if(pSrcProfile->nAddIEScanLength) |
| 6223 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6224 | memset(pDstProfile->addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH); |
| 6225 | if ( SIR_MAC_MAX_IE_LENGTH >= pSrcProfile->nAddIEScanLength) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6226 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6227 | vos_mem_copy(pDstProfile->addIEScan, pSrcProfile->addIEScan, |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6228 | pSrcProfile->nAddIEScanLength); |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 6229 | pDstProfile->nAddIEScanLength = pSrcProfile->nAddIEScanLength; |
| 6230 | } |
| 6231 | else |
| 6232 | { |
| 6233 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 6234 | FL(" AddIEScanLength is not valid %u"), |
| 6235 | pSrcProfile->nAddIEScanLength); |
| 6236 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6237 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6238 | if(pSrcProfile->nAddIEAssocLength) |
| 6239 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6240 | pDstProfile->pAddIEAssoc = vos_mem_malloc(pSrcProfile->nAddIEAssocLength); |
| 6241 | if ( NULL == pDstProfile->pAddIEAssoc ) |
| 6242 | status = eHAL_STATUS_FAILURE; |
| 6243 | else |
| 6244 | status = eHAL_STATUS_SUCCESS; |
| 6245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6246 | if(!HAL_STATUS_SUCCESS(status)) |
| 6247 | { |
| 6248 | break; |
| 6249 | } |
| 6250 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6251 | vos_mem_copy(pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 6252 | pSrcProfile->nAddIEAssocLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6253 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6254 | if(pSrcProfile->ChannelInfo.ChannelList) |
| 6255 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6256 | pDstProfile->ChannelInfo.ChannelList = vos_mem_malloc( |
| 6257 | pSrcProfile->ChannelInfo.numOfChannels); |
| 6258 | if ( NULL == pDstProfile->ChannelInfo.ChannelList ) |
| 6259 | status = eHAL_STATUS_FAILURE; |
| 6260 | else |
| 6261 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6262 | if(!HAL_STATUS_SUCCESS(status)) |
| 6263 | { |
| 6264 | break; |
| 6265 | } |
| 6266 | pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6267 | vos_mem_copy(pDstProfile->ChannelInfo.ChannelList, |
| 6268 | pSrcProfile->ChannelInfo.ChannelList, |
| 6269 | pSrcProfile->ChannelInfo.numOfChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6270 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6271 | pDstProfile->AuthType = pSrcProfile->AuthType; |
| 6272 | pDstProfile->EncryptionType = pSrcProfile->EncryptionType; |
| 6273 | pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType; |
| 6274 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->negotiatedUCEncryptionType; |
| 6275 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->negotiatedMCEncryptionType; |
| 6276 | pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6277 | #ifdef WLAN_FEATURE_11W |
| 6278 | pDstProfile->MFPEnabled = pSrcProfile->MFPEnabled; |
| 6279 | pDstProfile->MFPRequired = pSrcProfile->MFPRequired; |
| 6280 | pDstProfile->MFPCapable = pSrcProfile->MFPCapable; |
| 6281 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6282 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 6283 | pDstProfile->phyMode = pSrcProfile->phyMode; |
| 6284 | pDstProfile->csrPersona = pSrcProfile->csrPersona; |
| 6285 | |
| 6286 | #ifdef FEATURE_WLAN_WAPI |
| 6287 | if(csrIsProfileWapi(pSrcProfile)) |
| 6288 | { |
| 6289 | if(pDstProfile->phyMode & eCSR_DOT11_MODE_11n) |
| 6290 | { |
| 6291 | pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 6292 | } |
| 6293 | } |
| 6294 | #endif /* FEATURE_WLAN_WAPI */ |
| 6295 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 6296 | /*Save the WPS info*/ |
| 6297 | pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 6298 | pDstProfile->bOSENAssociation = pSrcProfile->bOSENAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6299 | pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6300 | pDstProfile->beaconInterval = pSrcProfile->beaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6301 | pDstProfile->privacy = pSrcProfile->privacy; |
| 6302 | pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq; |
| 6303 | pDstProfile->csr80211AuthType = pSrcProfile->csr80211AuthType; |
| 6304 | pDstProfile->dtimPeriod = pSrcProfile->dtimPeriod; |
| 6305 | pDstProfile->ApUapsdEnable = pSrcProfile->ApUapsdEnable; |
| 6306 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->SSIDs.SSIDList[0].ssidHidden; |
| 6307 | pDstProfile->protEnabled = pSrcProfile->protEnabled; |
| 6308 | pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled; |
| 6309 | pDstProfile->cfg_protection = pSrcProfile->cfg_protection; |
| 6310 | pDstProfile->wps_state = pSrcProfile->wps_state; |
| 6311 | pDstProfile->ieee80211d = pSrcProfile->ieee80211d; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6312 | vos_mem_copy(&pDstProfile->Keys, &pSrcProfile->Keys, |
| 6313 | sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6314 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6315 | if (pSrcProfile->MDID.mdiePresent) |
| 6316 | { |
| 6317 | pDstProfile->MDID.mdiePresent = 1; |
| 6318 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 6319 | } |
| 6320 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6321 | }while(0); |
| 6322 | |
| 6323 | if(!HAL_STATUS_SUCCESS(status)) |
| 6324 | { |
| 6325 | csrReleaseProfile(pMac, pDstProfile); |
| 6326 | pDstProfile = NULL; |
| 6327 | } |
| 6328 | |
| 6329 | return (status); |
| 6330 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6331 | eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile ) |
| 6332 | { |
| 6333 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6334 | tCsrRoamConnectedProfile *pSrcProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 6335 | do |
| 6336 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6337 | vos_mem_set(pDstProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6338 | if(pSrcProfile->bssid) |
| 6339 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6340 | pDstProfile->BSSIDs.bssid = vos_mem_malloc(sizeof(tCsrBssid)); |
| 6341 | if ( NULL == pDstProfile->BSSIDs.bssid ) |
| 6342 | status = eHAL_STATUS_FAILURE; |
| 6343 | else |
| 6344 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6345 | if(!HAL_STATUS_SUCCESS(status)) |
| 6346 | { |
Kiet Lam | 1cc9539 | 2013-11-22 15:59:36 +0530 | [diff] [blame] | 6347 | smsLog( pMac, LOGE, |
| 6348 | FL("failed to allocate memory for BSSID" |
| 6349 | "%02x:%02x:%02x:%02x:%02x:%02x"), |
| 6350 | pSrcProfile->bssid[0], pSrcProfile->bssid[1], pSrcProfile->bssid[2], |
| 6351 | pSrcProfile->bssid[3], pSrcProfile->bssid[4], pSrcProfile->bssid[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6352 | break; |
| 6353 | } |
| 6354 | pDstProfile->BSSIDs.numOfBSSIDs = 1; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6355 | vos_mem_copy(pDstProfile->BSSIDs.bssid, pSrcProfile->bssid, |
| 6356 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6357 | } |
| 6358 | if(pSrcProfile->SSID.ssId) |
| 6359 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6360 | pDstProfile->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); |
| 6361 | if ( NULL == pDstProfile->SSIDs.SSIDList ) |
| 6362 | status = eHAL_STATUS_FAILURE; |
| 6363 | else |
| 6364 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6365 | if(!HAL_STATUS_SUCCESS(status)) |
| 6366 | { |
Kiet Lam | 1cc9539 | 2013-11-22 15:59:36 +0530 | [diff] [blame] | 6367 | smsLog( pMac, LOGE, |
| 6368 | FL("failed to allocate memory for SSIDList" |
| 6369 | "%02x:%02x:%02x:%02x:%02x:%02x"), |
| 6370 | pSrcProfile->bssid[0], pSrcProfile->bssid[1], pSrcProfile->bssid[2], |
| 6371 | pSrcProfile->bssid[3], pSrcProfile->bssid[4], pSrcProfile->bssid[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6372 | break; |
| 6373 | } |
| 6374 | pDstProfile->SSIDs.numOfSSIDs = 1; |
| 6375 | pDstProfile->SSIDs.SSIDList[0].handoffPermitted = pSrcProfile->handoffPermitted; |
| 6376 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6377 | vos_mem_copy(&pDstProfile->SSIDs.SSIDList[0].SSID, |
| 6378 | &pSrcProfile->SSID, sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6379 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6380 | if(pSrcProfile->nAddIEAssocLength) |
| 6381 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6382 | pDstProfile->pAddIEAssoc = vos_mem_malloc(pSrcProfile->nAddIEAssocLength); |
| 6383 | if ( NULL == pDstProfile->pAddIEAssoc) |
| 6384 | status = eHAL_STATUS_FAILURE; |
| 6385 | else |
| 6386 | status = eHAL_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6387 | if(!HAL_STATUS_SUCCESS(status)) |
| 6388 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6389 | smsLog( pMac, LOGE, FL(" failed to allocate memory for additional IEs ") ); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6390 | break; |
| 6391 | } |
| 6392 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6393 | vos_mem_copy(pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 6394 | pSrcProfile->nAddIEAssocLength); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6395 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6396 | pDstProfile->ChannelInfo.ChannelList = vos_mem_malloc(1); |
| 6397 | if ( NULL == pDstProfile->ChannelInfo.ChannelList ) |
| 6398 | status = eHAL_STATUS_FAILURE; |
| 6399 | else |
| 6400 | status = eHAL_STATUS_SUCCESS; |
| 6401 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6402 | if(!HAL_STATUS_SUCCESS(status)) |
| 6403 | { |
| 6404 | break; |
| 6405 | } |
| 6406 | pDstProfile->ChannelInfo.numOfChannels = 1; |
| 6407 | pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6408 | pDstProfile->AuthType.numEntries = 1; |
| 6409 | pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; |
| 6410 | pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; |
| 6411 | pDstProfile->EncryptionType.numEntries = 1; |
| 6412 | pDstProfile->EncryptionType.encryptionType[0] = pSrcProfile->EncryptionType; |
| 6413 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->EncryptionType; |
| 6414 | pDstProfile->mcEncryptionType.numEntries = 1; |
| 6415 | pDstProfile->mcEncryptionType.encryptionType[0] = pSrcProfile->mcEncryptionType; |
| 6416 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->mcEncryptionType; |
| 6417 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 6418 | pDstProfile->CBMode = pSrcProfile->CBMode; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6419 | vos_mem_copy(&pDstProfile->Keys, &pSrcProfile->Keys, |
| 6420 | sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6421 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6422 | if (pSrcProfile->MDID.mdiePresent) |
| 6423 | { |
| 6424 | pDstProfile->MDID.mdiePresent = 1; |
| 6425 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 6426 | } |
| 6427 | #endif |
| 6428 | |
| 6429 | }while(0); |
| 6430 | |
| 6431 | if(!HAL_STATUS_SUCCESS(status)) |
| 6432 | { |
| 6433 | csrReleaseProfile(pMac, pDstProfile); |
| 6434 | pDstProfile = NULL; |
| 6435 | } |
| 6436 | |
| 6437 | return (status); |
| 6438 | } |
| 6439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6440 | eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6441 | tScanResultHandle hBSSList, |
| 6442 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate, |
| 6443 | tANI_BOOLEAN fClearScan) |
| 6444 | { |
| 6445 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6446 | tSmeCmd *pCommand; |
| 6447 | |
| 6448 | pCommand = csrGetCommandBuffer(pMac); |
| 6449 | if(NULL == pCommand) |
| 6450 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6451 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6452 | status = eHAL_STATUS_RESOURCES; |
| 6453 | } |
| 6454 | else |
| 6455 | { |
| 6456 | if( fClearScan ) |
| 6457 | { |
| 6458 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6459 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6460 | } |
| 6461 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6462 | if(NULL == pProfile) |
| 6463 | { |
| 6464 | //We can roam now |
| 6465 | //Since pProfile is NULL, we need to build our own profile, set everything to default |
| 6466 | //We can only support open and no encryption |
| 6467 | pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; |
| 6468 | pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6469 | pCommand->u.roamCmd.roamProfile.EncryptionType.numEntries = 1; |
| 6470 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 6471 | pCommand->u.roamCmd.roamProfile.csrPersona = VOS_STA_MODE; |
| 6472 | } |
| 6473 | else |
| 6474 | { |
| 6475 | //make a copy of the profile |
| 6476 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 6477 | if(HAL_STATUS_SUCCESS(status)) |
| 6478 | { |
| 6479 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 6480 | } |
| 6481 | } |
| 6482 | pCommand->command = eSmeCommandRoam; |
| 6483 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6484 | pCommand->u.roamCmd.hBSSList = hBSSList; |
| 6485 | pCommand->u.roamCmd.roamId = roamId; |
| 6486 | pCommand->u.roamCmd.roamReason = reason; |
| 6487 | //We need to free the BssList when the command is done |
| 6488 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE; |
| 6489 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6490 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 6491 | FL("CSR PERSONA=%d"), |
| 6492 | pCommand->u.roamCmd.roamProfile.csrPersona); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6493 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 6494 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6495 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6496 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6497 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6498 | } |
| 6499 | } |
| 6500 | |
| 6501 | return (status); |
| 6502 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6503 | eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6504 | tCsrRoamModifyProfileFields *pMmodProfileFields, |
| 6505 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 6506 | { |
| 6507 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6508 | tSmeCmd *pCommand; |
| 6509 | |
| 6510 | pCommand = csrGetCommandBuffer(pMac); |
| 6511 | if(NULL == pCommand) |
| 6512 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6513 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6514 | status = eHAL_STATUS_RESOURCES; |
| 6515 | } |
| 6516 | else |
| 6517 | { |
| 6518 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6519 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6520 | if(pProfile) |
| 6521 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6522 | //This is likely trying to reassoc to different profile |
| 6523 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6524 | //make a copy of the profile |
| 6525 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 6526 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6527 | } |
| 6528 | else |
| 6529 | { |
| 6530 | status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile); |
| 6531 | //how to update WPA/WPA2 info in roamProfile?? |
| 6532 | pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6534 | if(HAL_STATUS_SUCCESS(status)) |
| 6535 | { |
| 6536 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 6537 | } |
| 6538 | pCommand->command = eSmeCommandRoam; |
| 6539 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6540 | pCommand->u.roamCmd.roamId = roamId; |
| 6541 | pCommand->u.roamCmd.roamReason = reason; |
| 6542 | //We need to free the BssList when the command is done |
| 6543 | //For reassoc there is no BSS list, so the boolean set to false |
| 6544 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 6545 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 6546 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6547 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 6548 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6549 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6550 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6551 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 6552 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6553 | } |
| 6554 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6555 | return (status); |
| 6556 | } |
| 6557 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6558 | eHalStatus csrRoamEnqueuePreauth(tpAniSirGlobal pMac, tANI_U32 sessionId, tpSirBssDescription pBssDescription, |
| 6559 | eCsrRoamReason reason, tANI_BOOLEAN fImmediate) |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 6560 | // , eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6561 | { |
| 6562 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6563 | tSmeCmd *pCommand; |
| 6564 | |
| 6565 | pCommand = csrGetCommandBuffer(pMac); |
| 6566 | if(NULL == pCommand) |
| 6567 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6568 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6569 | status = eHAL_STATUS_RESOURCES; |
| 6570 | } |
| 6571 | else |
| 6572 | { |
| 6573 | if(pBssDescription) |
| 6574 | { |
| 6575 | //copy over the parameters we need later |
| 6576 | pCommand->command = eSmeCommandRoam; |
| 6577 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6578 | pCommand->u.roamCmd.roamReason = reason; |
| 6579 | //this is the important parameter |
| 6580 | //in this case we are using this field for the "next" BSS |
| 6581 | pCommand->u.roamCmd.pLastRoamBss = pBssDescription; |
| 6582 | status = csrQueueSmeCommand(pMac, pCommand, fImmediate); |
| 6583 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6584 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6585 | 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] | 6586 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6587 | } |
| 6588 | } |
| 6589 | else |
| 6590 | { |
| 6591 | //Return failure |
| 6592 | status = eHAL_STATUS_RESOURCES; |
| 6593 | } |
| 6594 | } |
| 6595 | return (status); |
| 6596 | } |
| 6597 | |
| 6598 | eHalStatus csrRoamDequeuePreauth(tpAniSirGlobal pMac) |
| 6599 | { |
| 6600 | tListElem *pEntry; |
| 6601 | tSmeCmd *pCommand; |
| 6602 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 6603 | if ( pEntry ) |
| 6604 | { |
| 6605 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 6606 | if ( (eSmeCommandRoam == pCommand->command) && |
| 6607 | (eCsrPerformPreauth == pCommand->u.roamCmd.roamReason)) |
| 6608 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6609 | smsLog( pMac, LOG1, FL("DQ-Command = %d, Reason = %d"), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6610 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6611 | if (csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK )) { |
| 6612 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6613 | } |
| 6614 | } else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6615 | smsLog( pMac, LOGE, FL("Command = %d, Reason = %d "), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6616 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6617 | } |
| 6618 | } |
| 6619 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6620 | 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] | 6621 | } |
| 6622 | smeProcessPendingQueue( pMac ); |
| 6623 | return eHAL_STATUS_SUCCESS; |
| 6624 | } |
| 6625 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6626 | eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6627 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6628 | { |
| 6629 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6630 | tScanResultHandle hBSSList; |
| 6631 | tANI_U32 roamId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6632 | status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList); |
| 6633 | if(HAL_STATUS_SUCCESS(status)) |
| 6634 | { |
| 6635 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6636 | if(pRoamId) |
| 6637 | { |
| 6638 | *pRoamId = roamId; |
| 6639 | } |
| 6640 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6641 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6642 | if(!HAL_STATUS_SUCCESS(status)) |
| 6643 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6644 | smsLog(pMac, LOGE, FL("failed to start a join process")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6645 | csrScanResultPurge(pMac, hBSSList); |
| 6646 | } |
| 6647 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6648 | return (status); |
| 6649 | } |
| 6650 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6651 | eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6652 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6653 | { |
| 6654 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6655 | tScanResultHandle hBSSList; |
| 6656 | tCsrScanResultFilter *pScanFilter; |
| 6657 | tANI_U32 roamId = 0; |
| 6658 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE; |
| 6659 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6660 | if (NULL == pProfile) |
| 6661 | { |
| 6662 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6663 | return eHAL_STATUS_FAILURE; |
| 6664 | } |
Sushant Kaushik | e0d2cce | 2014-04-10 14:36:07 +0530 | [diff] [blame] | 6665 | smsLog(pMac, LOG1, FL("called BSSType = %s (%d) authtype = %d " |
| 6666 | "encryType = %d"), |
| 6667 | lim_BssTypetoString(pProfile->BSSType), |
| 6668 | pProfile->BSSType, |
| 6669 | pProfile->AuthType.authType[0], |
| 6670 | pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6671 | if( CSR_IS_WDS( pProfile ) && |
| 6672 | !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) ) |
| 6673 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6674 | 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] | 6675 | pProfile->operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6676 | return status; |
| 6677 | } |
| 6678 | csrRoamCancelRoaming(pMac, sessionId); |
| 6679 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6680 | csrScanCancelIdleScan(pMac); |
| 6681 | //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] | 6682 | csrScanAbortMacScan(pMac, sessionId, eCSR_SCAN_ABORT_DEFAULT); |
Agarwal Ashish | 5974ed3 | 2014-06-16 16:59:54 +0530 | [diff] [blame] | 6683 | |
| 6684 | if (!vos_concurrent_open_sessions_running() && |
| 6685 | (VOS_STA_SAP_MODE == pProfile->csrPersona)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6686 | { |
Agarwal Ashish | 5974ed3 | 2014-06-16 16:59:54 +0530 | [diff] [blame] | 6687 | /* In case of AP mode we do not want idle mode scan */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6688 | csrScanDisable(pMac); |
| 6689 | } |
Agarwal Ashish | 5974ed3 | 2014-06-16 16:59:54 +0530 | [diff] [blame] | 6690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6691 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6692 | //Check whether ssid changes |
| 6693 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6694 | { |
| 6695 | if(pProfile->SSIDs.numOfSSIDs && !csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6696 | { |
| 6697 | csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6698 | } |
| 6699 | } |
| 6700 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6701 | pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; |
| 6702 | #endif |
| 6703 | if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn) |
| 6704 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6705 | smsLog(pMac, LOG1, FL("is called with BSSList")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6706 | status = csrRoamConnectWithBSSList(pMac, sessionId, pProfile, hBssListIn, pRoamId); |
| 6707 | if(pRoamId) |
| 6708 | { |
| 6709 | roamId = *pRoamId; |
| 6710 | } |
| 6711 | if(!HAL_STATUS_SUCCESS(status)) |
| 6712 | { |
| 6713 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6714 | } |
| 6715 | } |
| 6716 | else |
| 6717 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6718 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 6719 | if ( NULL == pScanFilter ) |
| 6720 | status = eHAL_STATUS_FAILURE; |
| 6721 | else |
| 6722 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6723 | if(HAL_STATUS_SUCCESS(status)) |
| 6724 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6725 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6726 | //Try to connect to any BSS |
| 6727 | if(NULL == pProfile) |
| 6728 | { |
| 6729 | //No encryption |
| 6730 | pScanFilter->EncryptionType.numEntries = 1; |
| 6731 | pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 6732 | }//we don't have a profile |
| 6733 | else |
| 6734 | { |
| 6735 | //Here is the profile we need to connect to |
| 6736 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6737 | }//We have a profile |
| 6738 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6739 | if(pRoamId) |
| 6740 | { |
| 6741 | *pRoamId = roamId; |
| 6742 | } |
| 6743 | |
| 6744 | if(HAL_STATUS_SUCCESS(status)) |
| 6745 | { |
| 6746 | /*Save the WPS info*/ |
| 6747 | if(NULL != pProfile) |
| 6748 | { |
| 6749 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 6750 | pScanFilter->bOSENAssociation = pProfile->bOSENAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6751 | } |
| 6752 | else |
| 6753 | { |
| 6754 | pScanFilter->bWPSAssociation = 0; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 6755 | pScanFilter->bOSENAssociation = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6757 | do |
| 6758 | { |
| 6759 | if( (pProfile && CSR_IS_WDS_AP( pProfile ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6760 | || (pProfile && CSR_IS_INFRA_AP ( pProfile )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6761 | ) |
| 6762 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6763 | //This can be started right away |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6764 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6765 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6766 | if(!HAL_STATUS_SUCCESS(status)) |
| 6767 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6768 | smsLog(pMac, LOGE, FL(" CSR failed to issue start BSS command with status = 0x%08X"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6769 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6770 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6771 | else |
| 6772 | { |
| 6773 | smsLog(pMac, LOG1, FL("Connect request to proceed for AMP/SoftAP mode")); |
| 6774 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6775 | break; |
| 6776 | } |
| 6777 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6778 | smsLog(pMac, LOG1, "************ csrScanGetResult Status ********* %d", status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6779 | if(HAL_STATUS_SUCCESS(status)) |
| 6780 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6781 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6782 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6783 | if(!HAL_STATUS_SUCCESS(status)) |
| 6784 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6785 | 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] | 6786 | csrScanResultPurge(pMac, hBSSList); |
| 6787 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6788 | } |
| 6789 | }//Have scan result |
| 6790 | else if(NULL != pProfile) |
| 6791 | { |
| 6792 | //Check whether it is for start ibss |
| 6793 | if(CSR_IS_START_IBSS(pProfile)) |
| 6794 | { |
| 6795 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6796 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6797 | if(!HAL_STATUS_SUCCESS(status)) |
| 6798 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6799 | 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] | 6800 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6801 | } |
| 6802 | } |
| 6803 | else |
| 6804 | { |
| 6805 | //scan for this SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6806 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6807 | if(!HAL_STATUS_SUCCESS(status)) |
| 6808 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6809 | 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] | 6810 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6811 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6812 | else |
| 6813 | { |
| 6814 | smsLog(pMac, LOG1, FL("SSID scan requested for Infra connect req")); |
| 6815 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6816 | } |
| 6817 | } |
| 6818 | else |
| 6819 | { |
| 6820 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6821 | } |
| 6822 | } while (0); |
| 6823 | if(NULL != pProfile) |
| 6824 | { |
| 6825 | //we need to free memory for filter if profile exists |
| 6826 | csrFreeScanFilter(pMac, pScanFilter); |
| 6827 | } |
| 6828 | }//Got the scan filter from profile |
| 6829 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6830 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6831 | }//allocated memory for pScanFilter |
| 6832 | }//No Bsslist coming in |
| 6833 | //tell the caller if we fail to trigger a join request |
| 6834 | if( fCallCallback ) |
| 6835 | { |
| 6836 | csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6837 | } |
| 6838 | |
| 6839 | return (status); |
| 6840 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6841 | eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6842 | tCsrRoamModifyProfileFields modProfileFields, |
| 6843 | tANI_U32 *pRoamId) |
| 6844 | { |
| 6845 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6846 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE; |
| 6847 | tANI_U32 roamId = 0; |
| 6848 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6849 | if (NULL == pProfile) |
| 6850 | { |
| 6851 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6852 | return eHAL_STATUS_FAILURE; |
| 6853 | } |
Sushant Kaushik | e0d2cce | 2014-04-10 14:36:07 +0530 | [diff] [blame] | 6854 | smsLog(pMac, LOG1, FL("called BSSType = %s (%d) authtype = %d " |
| 6855 | "encryType = %d"), |
| 6856 | lim_BssTypetoString(pProfile->BSSType), |
| 6857 | pProfile->BSSType, |
| 6858 | pProfile->AuthType.authType[0], |
| 6859 | pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6860 | csrRoamCancelRoaming(pMac, sessionId); |
| 6861 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6862 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6863 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6864 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6865 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6866 | { |
| 6867 | if(pProfile) |
| 6868 | { |
| 6869 | if(pProfile->SSIDs.numOfSSIDs && |
| 6870 | csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6871 | { |
| 6872 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6873 | } |
| 6874 | else |
| 6875 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6876 | 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] | 6877 | } |
| 6878 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6879 | else if (!vos_mem_compare(&modProfileFields, |
| 6880 | &pSession->connectedProfile.modifyProfileFields, |
| 6881 | sizeof(tCsrRoamModifyProfileFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6882 | { |
| 6883 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6884 | } |
| 6885 | else |
| 6886 | { |
| 6887 | 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] | 6888 | "in tCsrRoamModifyProfileFields got modified")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6889 | } |
| 6890 | } |
| 6891 | else |
| 6892 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6893 | smsLog(pMac, LOG1, FL("Not connected! No need to reassoc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6894 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6895 | if(!fCallCallback) |
| 6896 | { |
| 6897 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6898 | if(pRoamId) |
| 6899 | { |
| 6900 | *pRoamId = roamId; |
| 6901 | } |
| 6902 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6903 | status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, |
| 6904 | eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6905 | } |
| 6906 | else |
| 6907 | { |
| 6908 | status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, |
| 6909 | eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6910 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6911 | return status; |
| 6912 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6913 | eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6914 | { |
| 6915 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6916 | tScanResultHandle hBSSList = NULL; |
| 6917 | tCsrScanResultFilter *pScanFilter = NULL; |
| 6918 | tANI_U32 roamId; |
| 6919 | tCsrRoamProfile *pProfile = NULL; |
| 6920 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6921 | |
| 6922 | if(!pSession) |
| 6923 | { |
| 6924 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6925 | return eHAL_STATUS_FAILURE; |
| 6926 | } |
| 6927 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6928 | do |
| 6929 | { |
| 6930 | if(pSession->pCurRoamProfile) |
| 6931 | { |
| 6932 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6933 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6934 | //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] | 6935 | pProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 6936 | if ( NULL == pProfile ) |
| 6937 | status = eHAL_STATUS_FAILURE; |
| 6938 | else |
| 6939 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6940 | if(!HAL_STATUS_SUCCESS(status)) |
| 6941 | break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6942 | vos_mem_set(pProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6943 | status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6944 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6945 | break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6946 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 6947 | if ( NULL == pScanFilter ) |
| 6948 | status = eHAL_STATUS_FAILURE; |
| 6949 | else |
| 6950 | status = eHAL_STATUS_SUCCESS; |
| 6951 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6952 | if(!HAL_STATUS_SUCCESS(status)) |
| 6953 | { |
| 6954 | break; |
| 6955 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6956 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6957 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6958 | if(!HAL_STATUS_SUCCESS(status)) |
| 6959 | { |
| 6960 | break; |
| 6961 | } |
| 6962 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6963 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 6964 | if(HAL_STATUS_SUCCESS(status)) |
| 6965 | { |
| 6966 | //we want to put the last connected BSS to the very beginning, if possible |
| 6967 | csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList); |
| 6968 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6969 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6970 | if(!HAL_STATUS_SUCCESS(status)) |
| 6971 | { |
| 6972 | csrScanResultPurge(pMac, hBSSList); |
| 6973 | break; |
| 6974 | } |
| 6975 | } |
| 6976 | else |
| 6977 | { |
| 6978 | //Do a scan on this profile |
| 6979 | //scan for this SSID only in case the AP suppresses SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6980 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6981 | if(!HAL_STATUS_SUCCESS(status)) |
| 6982 | { |
| 6983 | break; |
| 6984 | } |
| 6985 | } |
| 6986 | }//We have a profile |
| 6987 | else |
| 6988 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6989 | smsLog(pMac, LOGW, FL("cannot find a roaming profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6990 | break; |
| 6991 | } |
| 6992 | }while(0); |
| 6993 | if(pScanFilter) |
| 6994 | { |
| 6995 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6996 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6997 | } |
| 6998 | if(NULL != pProfile) |
| 6999 | { |
| 7000 | csrReleaseProfile(pMac, pProfile); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7001 | vos_mem_free(pProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7002 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7003 | return (status); |
| 7004 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7005 | eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 7006 | { |
| 7007 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7008 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 7009 | { |
| 7010 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 7011 | if(HAL_STATUS_SUCCESS(status)) |
| 7012 | { |
| 7013 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 7014 | } |
| 7015 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7016 | return (status); |
| 7017 | } |
| 7018 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7019 | eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 7020 | { |
| 7021 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7022 | smsLog(pMac, LOGW, FL("is called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7023 | csrRoamCancelRoaming(pMac, sessionId); |
| 7024 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 7025 | if(csrIsConnStateDisconnected(pMac, sessionId)) |
| 7026 | { |
| 7027 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 7028 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7029 | return (status); |
| 7030 | } |
| 7031 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7032 | eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure ) |
| 7033 | { |
| 7034 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7035 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
| 7036 | eCsrRoamSubState NewSubstate; |
| 7037 | tANI_U32 sessionId = pCommand->sessionId; |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 7038 | |
| 7039 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7040 | { |
| 7041 | smsLog(pMac, LOG1, FL(" Stop Wait for key timer and change substate to" |
| 7042 | " eCSR_ROAM_SUBSTATE_NONE")); |
| 7043 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7044 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 7045 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7046 | // change state to 'Roaming'... |
| 7047 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 7048 | |
| 7049 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 7050 | { |
| 7051 | // If we are in an IBSS, then stop the IBSS... |
| 7052 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 7053 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 7054 | } |
| 7055 | else if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7056 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7057 | 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] | 7058 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 7059 | //Restore AC weight in case we change it |
| 7060 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 7061 | // in Infrasturcture, we need to disassociate from the Infrastructure network... |
| 7062 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
| 7063 | if(eCsrSmeIssuedDisassocForHandoff == pCommand->u.roamCmd.roamReason) |
| 7064 | { |
| 7065 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF; |
| 7066 | } |
Abhishek Singh | cf4590b | 2014-04-16 18:58:08 +0530 | [diff] [blame] | 7067 | else |
| 7068 | { |
| 7069 | // If we are in neighbor preauth done state then on receiving |
| 7070 | // disassoc or deauth we dont roam instead we just disassoc |
| 7071 | // from current ap and then go to disconnected state |
| 7072 | // This happens for ESE and 11r FT connections ONLY. |
| 7073 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7074 | if (csrRoamIs11rAssoc(pMac) && |
| 7075 | (csrNeighborRoamStatePreauthDone(pMac))) |
| 7076 | { |
| 7077 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 7078 | } |
| 7079 | #endif |
| 7080 | #ifdef FEATURE_WLAN_ESE |
| 7081 | if (csrRoamIsESEAssoc(pMac) && |
| 7082 | (csrNeighborRoamStatePreauthDone(pMac))) |
| 7083 | { |
| 7084 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 7085 | } |
| 7086 | #endif |
| 7087 | #ifdef FEATURE_WLAN_LFR |
| 7088 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && |
| 7089 | (csrNeighborRoamStatePreauthDone(pMac))) |
| 7090 | { |
| 7091 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 7092 | } |
| 7093 | #endif |
| 7094 | } |
| 7095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7096 | if( fDisassoc ) |
| 7097 | { |
| 7098 | status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure ); |
Mukul Sharma | be91e2f | 2014-06-29 22:09:20 +0530 | [diff] [blame] | 7099 | #ifdef DEBUG_ROAM_DELAY |
| 7100 | vos_record_roam_event(e_SME_DISASSOC_ISSUE, NULL, 0); |
| 7101 | #endif /* DEBUG_ROAM_DELAY */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7102 | } |
| 7103 | else |
| 7104 | { |
| 7105 | status = csrRoamIssueDeauth( pMac, sessionId, eCSR_ROAM_SUBSTATE_DEAUTH_REQ ); |
| 7106 | } |
| 7107 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 7108 | } |
| 7109 | else if ( csrIsConnStateWds( pMac, sessionId ) ) |
| 7110 | { |
| 7111 | if( CSR_IS_WDS_AP( &pMac->roam.roamSession[sessionId].connectedProfile ) ) |
| 7112 | { |
| 7113 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 7114 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 7115 | } |
| 7116 | //This has to be WDS station |
| 7117 | else if( csrIsConnStateConnectedWds( pMac, sessionId ) ) //This has to be WDS station |
| 7118 | { |
| 7119 | |
| 7120 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 7121 | if( fDisassoc ) |
| 7122 | { |
| 7123 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 7124 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, fMICFailure ); |
| 7125 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 7126 | } |
| 7127 | } |
| 7128 | } else { |
| 7129 | // we got a dis-assoc request while not connected to any peer |
| 7130 | // just complete the command |
| 7131 | fComplete = eANI_BOOLEAN_TRUE; |
| 7132 | status = eHAL_STATUS_FAILURE; |
| 7133 | } |
| 7134 | if(fComplete) |
| 7135 | { |
| 7136 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7137 | } |
| 7138 | |
| 7139 | if(HAL_STATUS_SUCCESS(status)) |
| 7140 | { |
| 7141 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7142 | { |
| 7143 | //Set the state to disconnect here |
| 7144 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7145 | } |
| 7146 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 7147 | else |
| 7148 | { |
| 7149 | smsLog(pMac, LOGW, FL(" failed with status %d"), status); |
| 7150 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7151 | return (status); |
| 7152 | } |
| 7153 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7154 | /* This is been removed from latest code base */ |
| 7155 | /* |
| 7156 | static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 7157 | { |
| 7158 | eHalStatus status; |
| 7159 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7160 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING ); |
| 7161 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7162 | return ( status ); |
| 7163 | } |
| 7164 | */ |
| 7165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7166 | eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason ) |
| 7167 | { |
| 7168 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7169 | tSmeCmd *pCommand; |
| 7170 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7171 | do |
| 7172 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 7173 | smsLog( pMac, LOG1, FL(" reason = %d"), reason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7174 | pCommand = csrGetCommandBuffer( pMac ); |
| 7175 | if ( !pCommand ) |
| 7176 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7177 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7178 | status = eHAL_STATUS_RESOURCES; |
| 7179 | break; |
| 7180 | } |
| 7181 | //Change the substate in case it is wait-for-key |
| 7182 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7183 | { |
| 7184 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7185 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 7186 | } |
| 7187 | pCommand->command = eSmeCommandRoam; |
| 7188 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7189 | switch ( reason ) |
| 7190 | { |
| 7191 | case eCSR_DISCONNECT_REASON_MIC_ERROR: |
| 7192 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure; |
| 7193 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7194 | case eCSR_DISCONNECT_REASON_DEAUTH: |
| 7195 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauth; |
| 7196 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7197 | case eCSR_DISCONNECT_REASON_HANDOFF: |
| 7198 | fHighPriority = eANI_BOOLEAN_TRUE; |
| 7199 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff; |
| 7200 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7201 | case eCSR_DISCONNECT_REASON_UNSPECIFIED: |
| 7202 | case eCSR_DISCONNECT_REASON_DISASSOC: |
| 7203 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 7204 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7205 | case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE: |
| 7206 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure; |
| 7207 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7208 | case eCSR_DISCONNECT_REASON_IBSS_LEAVE: |
| 7209 | pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave; |
| 7210 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7211 | default: |
| 7212 | break; |
| 7213 | } |
| 7214 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 7215 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7216 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7217 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7218 | csrReleaseCommandRoam( pMac, pCommand ); |
| 7219 | } |
| 7220 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7221 | return( status ); |
| 7222 | } |
| 7223 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7224 | eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority ) |
| 7225 | { |
| 7226 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7227 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7228 | pCommand = csrGetCommandBuffer( pMac ); |
| 7229 | if ( NULL != pCommand ) |
| 7230 | { |
| 7231 | //Change the substate in case it is wait-for-key |
| 7232 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 7233 | { |
| 7234 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7235 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 7236 | } |
| 7237 | pCommand->command = eSmeCommandRoam; |
| 7238 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7239 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 7240 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 7241 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7242 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7243 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7244 | csrReleaseCommandRoam( pMac, pCommand ); |
| 7245 | } |
| 7246 | } |
| 7247 | else |
| 7248 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7249 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7250 | status = eHAL_STATUS_RESOURCES; |
| 7251 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7252 | return ( status ); |
| 7253 | } |
| 7254 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7255 | eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 7256 | { |
| 7257 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7258 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7259 | |
| 7260 | if(!pSession) |
| 7261 | { |
| 7262 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7263 | return eHAL_STATUS_FAILURE; |
| 7264 | } |
| 7265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7266 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 7267 | //Stop te retry |
| 7268 | pSession->maxRetryCount = 0; |
| 7269 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 7270 | #endif |
| 7271 | //Not to call cancel roaming here |
| 7272 | //Only issue disconnect when necessary |
| 7273 | if(csrIsConnStateConnected(pMac, sessionId) || csrIsBssTypeIBSS(pSession->connectedProfile.BSSType) |
| 7274 | || csrIsBssTypeWDS(pSession->connectedProfile.BSSType) |
| 7275 | || csrIsRoamCommandWaitingForSession(pMac, sessionId) ) |
| 7276 | |
| 7277 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7278 | smsLog(pMac, LOG2, FL("called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7279 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason); |
| 7280 | } |
Agarwal Ashish | 8514a4f | 2014-02-10 15:57:06 +0530 | [diff] [blame] | 7281 | else |
| 7282 | { |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 7283 | csrScanAbortScanForSSID(pMac, sessionId); |
| 7284 | status = eHAL_STATUS_CMD_NOT_QUEUED; |
| 7285 | smsLog( pMac, LOG1, FL(" Disconnect cmd not queued, Roam command is not present" |
| 7286 | " return with status %d"), status); |
Agarwal Ashish | 8514a4f | 2014-02-10 15:57:06 +0530 | [diff] [blame] | 7287 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7288 | return (status); |
| 7289 | } |
| 7290 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7291 | eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 7292 | { |
| 7293 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7294 | |
| 7295 | if(!pSession) |
| 7296 | { |
| 7297 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7298 | return eHAL_STATUS_FAILURE; |
| 7299 | } |
| 7300 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7301 | csrRoamCancelRoaming(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7302 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrForcedDisassoc); |
| 7303 | |
| 7304 | return (csrRoamDisconnectInternal(pMac, sessionId, reason)); |
| 7305 | } |
| 7306 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7307 | eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 7308 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes) |
| 7309 | { |
| 7310 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7311 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 7312 | tANI_U8 index; |
| 7313 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7314 | tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7315 | |
| 7316 | if(!pSession) |
| 7317 | { |
| 7318 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7319 | return eHAL_STATUS_FAILURE; |
| 7320 | } |
Madan Mohan Koyyalamudi | d02b594 | 2013-07-19 18:35:59 +0800 | [diff] [blame] | 7321 | if(pConnectProfile->pAddIEAssoc) |
| 7322 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7323 | vos_mem_free(pConnectProfile->pAddIEAssoc); |
Madan Mohan Koyyalamudi | d02b594 | 2013-07-19 18:35:59 +0800 | [diff] [blame] | 7324 | pConnectProfile->pAddIEAssoc = NULL; |
| 7325 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7326 | vos_mem_set(&pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7327 | pConnectProfile->AuthType = pProfile->negotiatedAuthType; |
| 7328 | pConnectProfile->AuthInfo = pProfile->AuthType; |
| 7329 | pConnectProfile->CBMode = pProfile->CBMode; //*** this may not be valid |
| 7330 | pConnectProfile->EncryptionType = pProfile->negotiatedUCEncryptionType; |
| 7331 | pConnectProfile->EncryptionInfo = pProfile->EncryptionType; |
| 7332 | pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType; |
| 7333 | pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; |
| 7334 | pConnectProfile->BSSType = pProfile->BSSType; |
| 7335 | pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask; |
| 7336 | pConnectProfile->operationChannel = pSirBssDesc->channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7337 | pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval; |
AnjaneeDevi Kapparapu | 4b04391 | 2014-02-18 13:22:35 +0530 | [diff] [blame] | 7338 | if (!pConnectProfile->beaconInterval) |
| 7339 | { |
| 7340 | smsLog(pMac, LOGW, FL("ERROR: Beacon interval is ZERO")); |
| 7341 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7342 | vos_mem_copy(&pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys)); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 7343 | /* saving the addional IE`s like Hot spot indication element and extended capabilities */ |
| 7344 | if(pProfile->nAddIEAssocLength) |
| 7345 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7346 | pConnectProfile->pAddIEAssoc = vos_mem_malloc(pProfile->nAddIEAssocLength); |
| 7347 | if ( NULL == pConnectProfile->pAddIEAssoc ) |
| 7348 | status = eHAL_STATUS_FAILURE; |
| 7349 | else |
| 7350 | status = eHAL_STATUS_SUCCESS; |
| 7351 | if (!HAL_STATUS_SUCCESS(status)) |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 7352 | { |
| 7353 | smsLog(pMac, LOGE, FL("Failed to allocate memory for additional IEs")) ; |
| 7354 | return eHAL_STATUS_FAILURE; |
| 7355 | } |
| 7356 | pConnectProfile->nAddIEAssocLength = pProfile->nAddIEAssocLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7357 | vos_mem_copy(pConnectProfile->pAddIEAssoc, pProfile->pAddIEAssoc, |
| 7358 | pProfile->nAddIEAssocLength); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 7359 | } |
| 7360 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7361 | //Save bssid |
| 7362 | csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid); |
| 7363 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7364 | if (pSirBssDesc->mdiePresent) |
| 7365 | { |
| 7366 | pConnectProfile->MDID.mdiePresent = 1; |
| 7367 | pConnectProfile->MDID.mobilityDomain = (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]); |
| 7368 | } |
| 7369 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | d48e327 | 2013-04-12 14:21:07 -0700 | [diff] [blame] | 7370 | if( NULL == pIesTemp ) |
| 7371 | { |
| 7372 | status = csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp); |
| 7373 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7374 | #ifdef FEATURE_WLAN_ESE |
| 7375 | if ((csrIsProfileESE(pProfile) || |
| 7376 | ((pIesTemp->ESEVersion.present) |
Sachin Ahuja | 23ff119 | 2014-10-06 22:02:45 +0530 | [diff] [blame] | 7377 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 7378 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 7379 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 7380 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
| 7381 | #ifdef WLAN_FEATURE_11W |
| 7382 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
Abhishek Singh | 83080e0 | 2014-11-07 12:04:16 +0530 | [diff] [blame] | 7383 | || (pProfile->negotiatedAuthType == |
| 7384 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) |
Sachin Ahuja | 23ff119 | 2014-10-06 22:02:45 +0530 | [diff] [blame] | 7385 | #endif |
| 7386 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7387 | && (pMac->roam.configParam.isEseIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7388 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7389 | pConnectProfile->isESEAssoc = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7390 | } |
| 7391 | #endif |
| 7392 | //save ssid |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7393 | if(HAL_STATUS_SUCCESS(status)) |
| 7394 | { |
| 7395 | if(pIesTemp->SSID.present) |
| 7396 | { |
| 7397 | pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7398 | vos_mem_copy(pConnectProfile->SSID.ssId, pIesTemp->SSID.ssid, |
| 7399 | pIesTemp->SSID.num_ssid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7400 | } |
| 7401 | |
| 7402 | //Save the bss desc |
| 7403 | status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 7404 | |
| 7405 | if( CSR_IS_QOS_BSS(pIesTemp) || pIesTemp->HTCaps.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7406 | { |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 7407 | //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] | 7408 | pConnectProfile->qap = TRUE; |
| 7409 | } |
| 7410 | else |
| 7411 | { |
| 7412 | pConnectProfile->qap = FALSE; |
| 7413 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7414 | if ( NULL == pIes ) |
| 7415 | { |
| 7416 | //Free memory if it allocated locally |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7417 | vos_mem_free(pIesTemp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7418 | } |
| 7419 | } |
| 7420 | //Save Qos connection |
| 7421 | pConnectProfile->qosConnection = pMac->roam.roamSession[sessionId].fWMMConnection; |
| 7422 | |
| 7423 | if(!HAL_STATUS_SUCCESS(status)) |
| 7424 | { |
| 7425 | csrFreeConnectBssDesc(pMac, sessionId); |
| 7426 | } |
| 7427 | for(index = 0; index < pProfile->SSIDs.numOfSSIDs; index++) |
| 7428 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7429 | if ((pProfile->SSIDs.SSIDList[index].SSID.length == pConnectProfile->SSID.length) && |
| 7430 | vos_mem_compare(pProfile->SSIDs.SSIDList[index].SSID.ssId, |
| 7431 | pConnectProfile->SSID.ssId, |
| 7432 | pConnectProfile->SSID.length)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7433 | { |
| 7434 | pConnectProfile->handoffPermitted = pProfile->SSIDs.SSIDList[index].handoffPermitted; |
| 7435 | break; |
| 7436 | } |
| 7437 | pConnectProfile->handoffPermitted = FALSE; |
| 7438 | } |
| 7439 | |
| 7440 | return (status); |
| 7441 | } |
| 7442 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7443 | static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp ) |
| 7444 | { |
| 7445 | tListElem *pEntry = NULL; |
| 7446 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7447 | //The head of the active list is the request we sent |
| 7448 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7449 | if(pEntry) |
| 7450 | { |
| 7451 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7452 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7453 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 7454 | { |
| 7455 | if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason) |
| 7456 | { |
| 7457 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 7458 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 7459 | #endif |
| 7460 | } |
| 7461 | csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp ); |
| 7462 | } |
| 7463 | else |
| 7464 | { |
| 7465 | tANI_U32 roamId = 0; |
| 7466 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7467 | if(!pSession) |
| 7468 | { |
| 7469 | smsLog(pMac, LOGE, FL(" session %d not found "), pSmeJoinRsp->sessionId); |
| 7470 | return; |
| 7471 | } |
| 7472 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7473 | |
| 7474 | //The head of the active list is the request we sent |
| 7475 | //Try to get back the same profile and roam again |
| 7476 | if(pCommand) |
| 7477 | { |
| 7478 | roamId = pCommand->u.roamCmd.roamId; |
| 7479 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7480 | pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode; |
| 7481 | pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode; |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 7482 | 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] | 7483 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7484 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 7485 | if (csrRoamIsHandoffInProgress(pMac)) |
| 7486 | { |
| 7487 | csrRoamCallCallback(pMac, pSmeJoinRsp->sessionId, NULL, roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 7488 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 7489 | csrNeighborRoamIndicateConnect(pMac, pSmeJoinRsp->sessionId, VOS_STATUS_E_FAILURE); |
| 7490 | } |
| 7491 | #endif |
| 7492 | if (pCommand) |
| 7493 | { |
| 7494 | if(CSR_IS_WDS_STA( &pCommand->u.roamCmd.roamProfile )) |
| 7495 | { |
| 7496 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 7497 | pSession->connectedProfile.BSSType = eCSR_BSS_TYPE_WDS_STA; |
| 7498 | csrRoamReissueRoamCommand(pMac); |
| 7499 | } |
| 7500 | else if( CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) ) |
| 7501 | { |
| 7502 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7503 | } |
| 7504 | else |
| 7505 | { |
| 7506 | csrRoam(pMac, pCommand); |
| 7507 | } |
| 7508 | } |
| 7509 | else |
| 7510 | { |
| 7511 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7512 | } |
| 7513 | } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */ |
| 7514 | } |
| 7515 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7516 | eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 7517 | tDot11fBeaconIEs *pIes, |
| 7518 | tCsrRoamProfile *pProfile, tANI_U32 roamId ) |
| 7519 | { |
| 7520 | eHalStatus status; |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 7521 | smsLog( pMac, LOG1, "Attempting to Join Bssid= "MAC_ADDRESS_STR, |
| 7522 | MAC_ADDR_ARRAY(pSirBssDesc->bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7523 | |
| 7524 | // Set the roaming substate to 'join attempt'... |
| 7525 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7526 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 7527 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7528 | return (status); |
| 7529 | } |
| 7530 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7531 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 7532 | tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile) |
| 7533 | { |
| 7534 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7535 | // Set the roaming substate to 'join attempt'... |
| 7536 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId ); |
| 7537 | |
Kaushik, Sushant | 8489f47 | 2014-01-27 11:41:22 +0530 | [diff] [blame] | 7538 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 7539 | FL(" calling csrSendJoinReqMsg (eWNI_SME_REASSOC_REQ)")); |
Mukul Sharma | be91e2f | 2014-06-29 22:09:20 +0530 | [diff] [blame] | 7540 | #ifdef DEBUG_ROAM_DELAY |
| 7541 | //HACK usign buff len as Auth type |
| 7542 | vos_record_roam_event(e_SME_ISSUE_REASSOC_REQ, NULL, pProfile->negotiatedAuthType); |
| 7543 | vos_record_roam_event(e_CACHE_ROAM_PEER_MAC, (void *)pSirBssDesc->bssId, 6); |
| 7544 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7545 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 7546 | return csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_REASSOC_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7547 | } |
| 7548 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7549 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac) |
| 7550 | { |
| 7551 | tListElem *pEntry; |
| 7552 | tSmeCmd *pCommand; |
| 7553 | tCsrRoamInfo roamInfo; |
| 7554 | tANI_U32 sessionId; |
| 7555 | tCsrRoamSession *pSession; |
| 7556 | |
| 7557 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7558 | if(pEntry) |
| 7559 | { |
| 7560 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7561 | if ( eSmeCommandRoam == pCommand->command ) |
| 7562 | { |
| 7563 | sessionId = pCommand->sessionId; |
| 7564 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7565 | |
| 7566 | if(!pSession) |
| 7567 | { |
| 7568 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7569 | return; |
| 7570 | } |
Abhishek Singh | af15f15 | 2013-11-30 16:08:55 +0530 | [diff] [blame] | 7571 | /* While switching between two AP, csr will reissue roam command again |
| 7572 | to the nextbss if it was interrupted by the dissconnect req for the |
| 7573 | previous bss.During this csr is incrementing bRefAssocStartCnt twice. |
| 7574 | so reset the bRefAssocStartCnt. |
| 7575 | */ |
| 7576 | if(pSession->bRefAssocStartCnt > 0) |
| 7577 | { |
| 7578 | pSession->bRefAssocStartCnt--; |
| 7579 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7580 | if( pCommand->u.roamCmd.fStopWds ) |
| 7581 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7582 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7583 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 7584 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 7585 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7586 | if (CSR_IS_WDS(&pSession->connectedProfile)){ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7587 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 7588 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 7589 | eCSR_ROAM_WDS_IND, |
| 7590 | eCSR_ROAM_RESULT_WDS_DISASSOCIATED); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7591 | }else if (CSR_IS_INFRA_AP(&pSession->connectedProfile)){ |
| 7592 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 7593 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 7594 | eCSR_ROAM_INFRA_IND, |
| 7595 | eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
| 7596 | } |
| 7597 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7598 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7599 | if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) ) |
| 7600 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7601 | 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] | 7602 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7603 | } |
| 7604 | } |
| 7605 | else if(eCsrStopRoaming == csrRoamJoinNextBss(pMac, pCommand, eANI_BOOLEAN_TRUE)) |
| 7606 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7607 | smsLog(pMac, LOGW, " Failed to reissue join command after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7608 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7609 | } |
| 7610 | } |
| 7611 | else |
| 7612 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7613 | smsLog(pMac, LOGW, " Command is not roaming after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7614 | } |
| 7615 | } |
| 7616 | else |
| 7617 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7618 | smsLog(pMac, LOGE, " Disassoc rsp cannot continue because no command is available"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7619 | } |
| 7620 | } |
| 7621 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7622 | tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 7623 | { |
| 7624 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7625 | tListElem *pEntry; |
| 7626 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7627 | //alwasy lock active list before locking pending list |
| 7628 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7629 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7630 | if(pEntry) |
| 7631 | { |
| 7632 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7633 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7634 | { |
| 7635 | fRet = eANI_BOOLEAN_TRUE; |
| 7636 | } |
| 7637 | } |
| 7638 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7639 | { |
| 7640 | csrLLLock(&pMac->sme.smeCmdPendingList); |
| 7641 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK); |
| 7642 | while(pEntry) |
| 7643 | { |
| 7644 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7645 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7646 | { |
| 7647 | fRet = eANI_BOOLEAN_TRUE; |
| 7648 | break; |
| 7649 | } |
| 7650 | pEntry = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 7651 | } |
| 7652 | csrLLUnlock(&pMac->sme.smeCmdPendingList); |
| 7653 | } |
Agarwal Ashish | 8514a4f | 2014-02-10 15:57:06 +0530 | [diff] [blame] | 7654 | if (eANI_BOOLEAN_FALSE == fRet) |
| 7655 | { |
| 7656 | csrLLLock(&pMac->roam.roamCmdPendingList); |
| 7657 | pEntry = csrLLPeekHead(&pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK); |
| 7658 | while (pEntry) |
| 7659 | { |
| 7660 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7661 | if (( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7662 | { |
| 7663 | fRet = eANI_BOOLEAN_TRUE; |
| 7664 | break; |
| 7665 | } |
| 7666 | pEntry = csrLLNext(&pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 7667 | } |
| 7668 | csrLLUnlock(&pMac->roam.roamCmdPendingList); |
| 7669 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7670 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7671 | return (fRet); |
| 7672 | } |
| 7673 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7674 | tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac) |
| 7675 | { |
| 7676 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7677 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7678 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 7679 | { |
| 7680 | if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) ) |
| 7681 | { |
| 7682 | break; |
| 7683 | } |
| 7684 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7685 | return ( fRet ); |
| 7686 | } |
| 7687 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7688 | tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac) |
| 7689 | { |
| 7690 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7691 | //alwasy lock active list before locking pending list |
| 7692 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7693 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7694 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7695 | { |
| 7696 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK); |
| 7697 | } |
| 7698 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7699 | return (fRet); |
| 7700 | } |
| 7701 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7702 | tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac ) |
| 7703 | { |
| 7704 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7705 | tListElem *pEntry; |
| 7706 | tCsrCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7707 | //alwasy lock active list before locking pending list |
| 7708 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7709 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7710 | if( pEntry ) |
| 7711 | { |
| 7712 | pCommand = GET_BASE_ADDR(pEntry, tCsrCmd, Link); |
| 7713 | if( ( eCsrRoamCommandScan == pCommand->command ) && |
| 7714 | ( ( eCsrScanForSsid == pCommand->u.scanCmd.reason ) || |
| 7715 | ( eCsrScanForCapsChange == pCommand->u.scanCmd.reason ) || |
| 7716 | ( eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason ) ) ) |
| 7717 | { |
| 7718 | fRet = eANI_BOOLEAN_TRUE; |
| 7719 | } |
| 7720 | } |
| 7721 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7722 | return (fRet); |
| 7723 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7724 | eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 7725 | { |
| 7726 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7727 | tSmeCmd *pCommand = NULL; |
| 7728 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE; |
| 7729 | tANI_BOOLEAN fRemoveCmd = FALSE; |
| 7730 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7731 | // Delete the old assoc command. All is setup for reassoc to be serialized |
| 7732 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7733 | if ( pEntry ) |
| 7734 | { |
| 7735 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 7736 | if ( !pCommand ) |
| 7737 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7738 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7739 | return eHAL_STATUS_RESOURCES; |
| 7740 | } |
| 7741 | if ( eSmeCommandRoam == pCommand->command ) |
| 7742 | { |
| 7743 | if (pCommand->u.roamCmd.roamReason == eCsrSmeIssuedAssocToSimilarAP) |
| 7744 | { |
| 7745 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7746 | } |
| 7747 | else |
| 7748 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7749 | smsLog( pMac, LOGE, FL(" Unexpected active roam command present ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7750 | } |
| 7751 | if (fRemoveCmd == FALSE) |
| 7752 | { |
| 7753 | // Implies we did not get the serialized assoc command we |
| 7754 | // were expecting |
| 7755 | pCommand = NULL; |
| 7756 | } |
| 7757 | } |
| 7758 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7759 | if(NULL == pCommand) |
| 7760 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7761 | 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] | 7762 | return eHAL_STATUS_RESOURCES; |
| 7763 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7764 | do |
| 7765 | { |
| 7766 | //Change the substate in case it is wait-for-key |
| 7767 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7768 | { |
| 7769 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7770 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 7771 | } |
| 7772 | pCommand->command = eSmeCommandRoam; |
| 7773 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7774 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7775 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 7776 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7777 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7778 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7779 | csrReleaseCommandRoam( pMac, pCommand ); |
| 7780 | } |
| 7781 | } while( 0 ); |
| 7782 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7783 | return( status ); |
| 7784 | } |
| 7785 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ) |
| 7786 | { |
| 7787 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7788 | tCsrScanResult *pScanResult = NULL; |
| 7789 | tSirBssDescription *pBssDesc = NULL; |
| 7790 | tSmeCmd *pCommand = NULL; |
| 7791 | tANI_U32 sessionId; |
| 7792 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7793 | if(NULL == pEntry) |
| 7794 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 7795 | smsLog(pMac, LOGE, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7796 | return; |
| 7797 | } |
| 7798 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7799 | sessionId = pCommand->sessionId; |
| 7800 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7801 | |
| 7802 | if(!pSession) |
| 7803 | { |
| 7804 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7805 | return; |
| 7806 | } |
Kaushik, Sushant | 74dbbba | 2014-05-30 10:31:41 +0530 | [diff] [blame] | 7807 | smsLog(pMac, LOG1, FL("CFG return value is %d " |
| 7808 | " current state is : %d substate is : %d "), |
| 7809 | result, pMac->roam.curState[sessionId], |
| 7810 | pMac->roam.curSubState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7811 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 7812 | { |
| 7813 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7814 | smsLog(pMac, LOGW, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7815 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7816 | } |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 7817 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 7818 | else if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 7819 | { |
| 7820 | //No need to complete roaming here as it already completes |
| 7821 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed\n"), |
| 7822 | pCommand->u.roamCmd.roamReason); |
| 7823 | csrSetAbortRoamingCommand( pMac, pCommand ); |
| 7824 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7825 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7826 | else |
| 7827 | { |
| 7828 | if ( CCM_IS_RESULT_SUCCESS(result) ) |
| 7829 | { |
Kaushik, Sushant | 74dbbba | 2014-05-30 10:31:41 +0530 | [diff] [blame] | 7830 | smsLog(pMac, LOG1, "Cfg sequence complete"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7831 | // Successfully set the configuration parameters for the new Bss. Attempt to |
| 7832 | // join the roaming Bss. |
| 7833 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 7834 | { |
| 7835 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 7836 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 7837 | } |
| 7838 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) || |
| 7839 | CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7840 | || CSR_IS_INFRA_AP(&pCommand->u.roamCmd.roamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7841 | ) |
| 7842 | { |
| 7843 | if(!HAL_STATUS_SUCCESS(csrRoamIssueStartBss( pMac, sessionId, |
| 7844 | &pSession->bssParams, &pCommand->u.roamCmd.roamProfile, |
| 7845 | pBssDesc, pCommand->u.roamCmd.roamId ))) |
| 7846 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 7847 | smsLog(pMac, LOGE, " CSR start BSS failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7848 | //We need to complete the command |
| 7849 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7850 | } |
| 7851 | } |
| 7852 | else |
| 7853 | { |
| 7854 | if (!pCommand->u.roamCmd.pRoamBssEntry) |
| 7855 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 7856 | smsLog(pMac, LOGE, " pRoamBssEntry is NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7857 | //We need to complete the command |
| 7858 | csrRoamComplete(pMac, eCsrJoinFailure, NULL); |
| 7859 | return; |
| 7860 | } |
| 7861 | // If we are roaming TO an Infrastructure BSS... |
| 7862 | VOS_ASSERT(pScanResult != NULL); |
| 7863 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7864 | { |
| 7865 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Kaushik, Sushant | 74dbbba | 2014-05-30 10:31:41 +0530 | [diff] [blame] | 7866 | smsLog(pMac, LOG1, " Roaming in a Infra BSS"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7867 | if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 7868 | { |
| 7869 | // ..and currently in an Infrastructure connection.... |
| 7870 | if( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 7871 | { |
Kaushik, Sushant | 74dbbba | 2014-05-30 10:31:41 +0530 | [diff] [blame] | 7872 | smsLog(pMac, LOG1, " Connected to infra BSS"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7873 | // ...and the SSIDs are equal, then we Reassoc. |
| 7874 | if ( csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, |
| 7875 | pIesLocal ) ) |
| 7876 | // ..and currently in an infrastructure connection |
| 7877 | { |
| 7878 | // then issue a Reassoc. |
| 7879 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
| 7880 | csrRoamIssueReassociate( pMac, sessionId, pBssDesc, pIesLocal, |
| 7881 | &pCommand->u.roamCmd.roamProfile ); |
| 7882 | } |
| 7883 | else |
| 7884 | { |
| 7885 | |
| 7886 | // otherwise, we have to issue a new Join request to LIM because we disassociated from the |
| 7887 | // previously associated AP. |
| 7888 | if(!HAL_STATUS_SUCCESS(csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7889 | pIesLocal, |
| 7890 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ))) |
| 7891 | { |
| 7892 | //try something else |
| 7893 | csrRoam( pMac, pCommand ); |
| 7894 | } |
| 7895 | } |
| 7896 | } |
| 7897 | else |
| 7898 | { |
| 7899 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7900 | |
| 7901 | /* We need to come with other way to figure out that this is because of HO in BMP |
| 7902 | 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] | 7903 | /* 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] | 7904 | * use join request */ |
| 7905 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7906 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7907 | csrRoamIs11rAssoc(pMac)) |
| 7908 | { |
Kaushik, Sushant | 74dbbba | 2014-05-30 10:31:41 +0530 | [diff] [blame] | 7909 | smsLog(pMac, LOG1, " HandoffInProgress with 11r enabled"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7910 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 7911 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 7912 | } |
| 7913 | else |
| 7914 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7915 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7916 | if (csrRoamIsHandoffInProgress(pMac) && |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7917 | csrRoamIsESEAssoc(pMac)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7918 | { |
Kaushik, Sushant | 74dbbba | 2014-05-30 10:31:41 +0530 | [diff] [blame] | 7919 | smsLog(pMac, LOG1, " HandoffInProgress with ESE enabled"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7920 | // Now serialize the reassoc command. |
| 7921 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7922 | } |
| 7923 | else |
| 7924 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7925 | #ifdef FEATURE_WLAN_LFR |
| 7926 | if (csrRoamIsHandoffInProgress(pMac) && |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 7927 | csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7928 | { |
Kaushik, Sushant | 74dbbba | 2014-05-30 10:31:41 +0530 | [diff] [blame] | 7929 | smsLog(pMac, LOG1, " HandoffInProgress with LFR enabled"); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7930 | // Now serialize the reassoc command. |
| 7931 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7932 | } |
| 7933 | else |
| 7934 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7935 | // else we are not connected and attempting to Join. Issue the |
| 7936 | // Join request. |
| 7937 | { |
Kaushik, Sushant | 74dbbba | 2014-05-30 10:31:41 +0530 | [diff] [blame] | 7938 | smsLog(pMac, LOG1, " Not connected, Attempting to Join"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7939 | status = csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7940 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), |
| 7941 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ); |
| 7942 | } |
| 7943 | if(!HAL_STATUS_SUCCESS(status)) |
| 7944 | { |
| 7945 | //try something else |
| 7946 | csrRoam( pMac, pCommand ); |
| 7947 | } |
| 7948 | } |
| 7949 | if( !pScanResult->Result.pvIes ) |
| 7950 | { |
| 7951 | //Locally allocated |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7952 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7953 | } |
| 7954 | } |
| 7955 | }//if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7956 | else |
| 7957 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7958 | smsLog(pMac, LOGW, FL(" found BSSType mismatching the one in BSS description")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7959 | } |
| 7960 | }//else |
| 7961 | }//if ( WNI_CFG_SUCCESS == result ) |
| 7962 | else |
| 7963 | { |
| 7964 | // In the event the configuration failed, for infra let the roam processor |
| 7965 | //attempt to join something else... |
| 7966 | if( pCommand->u.roamCmd.pRoamBssEntry && CSR_IS_INFRASTRUCTURE( &pCommand->u.roamCmd.roamProfile ) ) |
| 7967 | { |
| 7968 | csrRoam(pMac, pCommand); |
| 7969 | } |
| 7970 | else |
| 7971 | { |
| 7972 | //We need to complete the command |
| 7973 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) ) |
| 7974 | { |
| 7975 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7976 | } |
| 7977 | else |
| 7978 | { |
| 7979 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7980 | } |
| 7981 | } |
| 7982 | } |
| 7983 | }//we have active entry |
| 7984 | } |
| 7985 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7986 | static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp ) |
| 7987 | { |
| 7988 | //No one is sending eWNI_SME_AUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7989 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7990 | if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) |
| 7991 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7992 | smsLog( pMac, LOGW, "CSR SmeAuthReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7993 | // Successfully authenticated with a new Bss. Attempt to stop the current Bss and |
| 7994 | // join the new one... |
| 7995 | /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7996 | roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/ |
| 7997 | } |
| 7998 | else { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 7999 | 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] | 8000 | /***profHandleLostLinkAfterReset(pAdapter); |
| 8001 | // In the event the authenticate fails, let the roam processor attempt to join something else... |
| 8002 | roamRoam( pAdapter );***/ |
| 8003 | } |
| 8004 | } |
| 8005 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8006 | static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp ) |
| 8007 | { |
| 8008 | eCsrRoamCompleteResult result; |
| 8009 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 8010 | tCsrRoamInfo roamInfo; |
| 8011 | tANI_U32 roamId = 0; |
| 8012 | |
| 8013 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 8014 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8015 | smsLog( pMac, LOGW, "CSR SmeReassocReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8016 | result = eCsrReassocSuccess; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8017 | /* Defeaturize this part later if needed */ |
| 8018 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 8019 | /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, |
| 8020 | * we need the response contents while processing the result in csrRoamProcessResults() */ |
| 8021 | if (csrRoamIsHandoffInProgress(pMac)) |
| 8022 | { |
| 8023 | /* Need to dig more on indicating events to SME QoS module */ |
| 8024 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 8025 | csrRoamComplete( pMac, result, pSmeJoinRsp); |
| 8026 | } |
| 8027 | else |
| 8028 | #endif |
| 8029 | { |
| 8030 | csrRoamComplete( pMac, result, NULL ); |
| 8031 | } |
| 8032 | } |
| 8033 | /* Should we handle this similar to handling the join failure? Is it ok |
| 8034 | * to call csrRoamComplete() with state as CsrJoinFailure */ |
| 8035 | else |
| 8036 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 8037 | 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] | 8038 | result = eCsrReassocFailure; |
| 8039 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8040 | if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) || |
Mukul Sharma | a052e3d | 2014-09-08 23:47:06 +0530 | [diff] [blame] | 8041 | (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode) || |
| 8042 | (eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA == pSmeJoinRsp->statusCode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8043 | { |
| 8044 | // Inform HDD to turn off FT flag in HDD |
| 8045 | if (pNeighborRoamInfo) |
| 8046 | { |
| 8047 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 8048 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, |
| 8049 | &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
Madan Mohan Koyyalamudi | 5777216 | 2012-10-18 19:46:14 -0700 | [diff] [blame] | 8050 | /* |
| 8051 | * Since the above callback sends a disconnect |
| 8052 | * to HDD, we should clean-up our state |
| 8053 | * machine as well to be in sync with the upper |
| 8054 | * layers. There is no need to send a disassoc |
| 8055 | * since: 1) we will never reassoc to the current |
| 8056 | * AP in LFR, and 2) there is no need to issue a |
| 8057 | * disassoc to the AP with which we were trying |
| 8058 | * to reassoc. |
| 8059 | */ |
| 8060 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 8061 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8062 | } |
| 8063 | } |
| 8064 | #endif |
| 8065 | // In the event that the Reassociation fails, then we need to Disassociate the current association and keep |
| 8066 | // roaming. Note that we will attempt to Join the AP instead of a Reassoc since we may have attempted a |
| 8067 | // 'Reassoc to self', which AP's that don't support Reassoc will force a Disassoc. |
| 8068 | //The disassoc rsp message will remove the command from active list |
| 8069 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, pSmeJoinRsp->sessionId, |
| 8070 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE ))) |
| 8071 | { |
| 8072 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 8073 | } |
| 8074 | } |
| 8075 | } |
| 8076 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8077 | static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp) |
| 8078 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8079 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8080 | { |
| 8081 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8082 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 8083 | if(pIbssLog) |
| 8084 | { |
| 8085 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP; |
| 8086 | if(eSIR_SME_SUCCESS != pSmeRsp->statusCode) |
| 8087 | { |
| 8088 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 8089 | } |
| 8090 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 8091 | } |
| 8092 | } |
| 8093 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8094 | pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8095 | if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId)) |
| 8096 | { |
| 8097 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 8098 | } |
| 8099 | else if(CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId)) |
| 8100 | { |
| 8101 | csrRoamReissueRoamCommand(pMac); |
| 8102 | } |
| 8103 | } |
| 8104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8105 | void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp ) |
| 8106 | { |
| 8107 | tSirResultCodes statusCode; |
| 8108 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 8109 | tScanResultHandle hBSSList; |
| 8110 | tANI_BOOLEAN fCallCallback, fRemoveCmd; |
| 8111 | eHalStatus status; |
| 8112 | tCsrRoamInfo roamInfo; |
| 8113 | tCsrScanResultFilter *pScanFilter = NULL; |
| 8114 | tANI_U32 roamId = 0; |
| 8115 | tCsrRoamProfile *pCurRoamProfile = NULL; |
| 8116 | tListElem *pEntry = NULL; |
| 8117 | tSmeCmd *pCommand = NULL; |
| 8118 | #endif |
| 8119 | tANI_U32 sessionId; |
| 8120 | tCsrRoamSession *pSession; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8121 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8122 | tSirSmeDisassocRsp SmeDisassocRsp; |
| 8123 | |
| 8124 | csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp); |
| 8125 | sessionId = SmeDisassocRsp.sessionId; |
| 8126 | statusCode = SmeDisassocRsp.statusCode; |
| 8127 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8128 | smsLog( pMac, LOG2, "csrRoamRoamingStateDisassocRspProcessor sessionId %d", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8129 | |
| 8130 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 8131 | { |
| 8132 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 8133 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8134 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8135 | |
| 8136 | if(!pSession) |
| 8137 | { |
| 8138 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8139 | return; |
| 8140 | } |
| 8141 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8142 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) ) |
| 8143 | { |
| 8144 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 8145 | } |
| 8146 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) || |
| 8147 | CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, sessionId ) ) |
| 8148 | { |
| 8149 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 8150 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8151 | smsLog( pMac, LOG2, "CSR SmeDisassocReq force disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8152 | //A callback to HDD will be issued from csrRoamComplete so no need to do anything here |
| 8153 | } |
| 8154 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 8155 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8156 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) ) |
| 8157 | { |
Kaushik, Sushant | 8489f47 | 2014-01-27 11:41:22 +0530 | [diff] [blame] | 8158 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, |
| 8159 | "CSR SmeDisassocReq due to HO on session %d", sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8160 | #if defined (WLAN_FEATURE_NEIGHBOR_ROAMING) |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8161 | /* |
| 8162 | * First ensure if the roam profile is in the scan cache. |
| 8163 | * If not, post a reassoc failure and disconnect. |
| 8164 | */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8165 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 8166 | if ( NULL == pScanFilter ) |
| 8167 | status = eHAL_STATUS_FAILURE; |
| 8168 | else |
| 8169 | status = eHAL_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8170 | if(HAL_STATUS_SUCCESS(status)) |
| 8171 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8172 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8173 | status = csrRoamPrepareFilterFromProfile(pMac, |
| 8174 | &pMac->roam.neighborRoamInfo.csrNeighborRoamProfile, pScanFilter); |
| 8175 | if(!HAL_STATUS_SUCCESS(status)) |
| 8176 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8177 | 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] | 8178 | __func__, status); |
| 8179 | goto POST_ROAM_FAILURE; |
| 8180 | } |
| 8181 | else |
| 8182 | { |
| 8183 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 8184 | if (!HAL_STATUS_SUCCESS(status)) |
| 8185 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8186 | smsLog( pMac, LOGE,"%s: csrScanGetResult failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8187 | __func__, status); |
| 8188 | goto POST_ROAM_FAILURE; |
| 8189 | } |
| 8190 | } |
| 8191 | } |
| 8192 | else |
| 8193 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8194 | smsLog( pMac, LOGE,"%s: alloc for pScanFilter failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8195 | __func__, status); |
| 8196 | goto POST_ROAM_FAILURE; |
| 8197 | } |
| 8198 | |
| 8199 | /* |
| 8200 | * After ensuring that the roam profile is in the scan result list, |
| 8201 | * dequeue the command from the active list. |
| 8202 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8203 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 8204 | if ( pEntry ) |
| 8205 | { |
| 8206 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8207 | /* If the head of the queue is Active and it is a ROAM command, remove |
| 8208 | * and put this on the Free queue. |
| 8209 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8210 | if ( eSmeCommandRoam == pCommand->command ) |
| 8211 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8212 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8213 | /* |
| 8214 | * we need to process the result first before removing it from active list |
| 8215 | * because state changes still happening insides roamQProcessRoamResults so |
| 8216 | * no other roam command should be issued. |
| 8217 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8218 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 8219 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 8220 | { |
| 8221 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 8222 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 8223 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8224 | if( fRemoveCmd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8225 | csrReleaseCommandRoam( pMac, pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8226 | else |
| 8227 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8228 | smsLog( pMac, LOGE, "%s: fail to remove cmd reason %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8229 | __func__, pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8230 | } |
| 8231 | } |
| 8232 | else |
| 8233 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8234 | smsLog( pMac, LOGE, "%s: roam command not active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8235 | } |
| 8236 | } |
| 8237 | else |
| 8238 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8239 | smsLog( pMac, LOGE, "%s: NO commands are active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8240 | } |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8241 | |
| 8242 | /* Notify HDD about handoff and provide the BSSID too */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8243 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 8244 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8245 | vos_mem_copy(roamInfo.bssid, |
| 8246 | pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, |
| 8247 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8248 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8249 | csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, |
| 8250 | eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8251 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8252 | /* 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] | 8253 | pCurRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 8254 | if ( pCurRoamProfile != NULL ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8255 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8256 | vos_mem_set(pCurRoamProfile, sizeof(tCsrRoamProfile), 0); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8257 | csrRoamCopyProfile(pMac, pCurRoamProfile, pSession->pCurRoamProfile); |
| 8258 | //make sure to put it at the head of the cmd queue |
| 8259 | status = csrRoamIssueConnect(pMac, sessionId, pCurRoamProfile, |
| 8260 | hBSSList, eCsrSmeIssuedAssocToSimilarAP, |
| 8261 | roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE); |
| 8262 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8263 | if(!HAL_STATUS_SUCCESS(status)) |
| 8264 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8265 | smsLog( pMac, LOGE,"%s: csrRoamIssueConnect failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8266 | __func__, status); |
| 8267 | fCallCallback = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8268 | } |
| 8269 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8270 | /* Notify sub-modules like QoS etc. that handoff happening */ |
| 8271 | sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 8272 | csrReleaseProfile(pMac, pCurRoamProfile); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8273 | vos_mem_free(pCurRoamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8274 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8275 | vos_mem_free(pScanFilter); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8276 | return; |
| 8277 | } |
| 8278 | |
| 8279 | POST_ROAM_FAILURE: |
| 8280 | if (pScanFilter) |
| 8281 | { |
| 8282 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8283 | vos_mem_free(pScanFilter); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8284 | } |
| 8285 | if (pCurRoamProfile) |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8286 | vos_mem_free(pCurRoamProfile); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8287 | |
| 8288 | /* Inform the upper layers that the reassoc failed */ |
| 8289 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 8290 | csrRoamCallCallback(pMac, sessionId, |
| 8291 | &roamInfo, 0, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
| 8292 | |
| 8293 | /* |
| 8294 | * Issue a disassoc request so that PE/LIM uses this to clean-up the FT session. |
| 8295 | * Upon success, we would re-enter this routine after receiving the disassoc |
| 8296 | * response and will fall into the reassoc fail sub-state. And, eventually |
| 8297 | * call csrRoamComplete which would remove the roam command from SME active |
| 8298 | * queue. |
| 8299 | */ |
| 8300 | if (!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate(pMac, sessionId, |
| 8301 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE))) |
| 8302 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8303 | smsLog( pMac, LOGE,"%s: csrRoamIssueDisassociate failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8304 | __func__, status); |
| 8305 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8306 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8307 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8309 | } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) ) |
| 8310 | else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) ) |
| 8311 | { |
| 8312 | // Disassoc due to Reassoc failure falls into this codepath.... |
| 8313 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 8314 | } |
| 8315 | else |
| 8316 | { |
| 8317 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 8318 | { |
| 8319 | // Successfully disassociated from the 'old' Bss... |
| 8320 | // |
| 8321 | // We get Disassociate response in three conditions. |
| 8322 | // - First is the case where we are disasociating from an Infra Bss to start an IBSS. |
| 8323 | // - Second is the when we are disassociating from an Infra Bss to join an IBSS or a new |
| 8324 | // Infrastructure network. |
| 8325 | // - Third is where we are doing an Infra to Infra roam between networks with different |
| 8326 | // SSIDs. In all cases, we set the new Bss configuration here and attempt to join |
| 8327 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8328 | smsLog( pMac, LOG2, "CSR SmeDisassocReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8329 | } |
| 8330 | else |
| 8331 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 8332 | smsLog( pMac, LOGE, "SmeDisassocReq failed with statusCode= 0x%08X", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8333 | } |
| 8334 | //We are not done yet. Get the data and continue roaming |
| 8335 | csrRoamReissueRoamCommand(pMac); |
| 8336 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8337 | } |
| 8338 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8339 | static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp ) |
| 8340 | { |
| 8341 | tSirResultCodes statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8342 | //No one is sending eWNI_SME_DEAUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8343 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8344 | statusCode = csrGetDeAuthRspStatusCode( pSmeRsp ); |
Leela Venkata Kiran Kumar Reddy Chirala | 56df73f | 2014-01-30 14:18:00 -0800 | [diff] [blame] | 8345 | pMac->roam.deauthRspStatus = statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8346 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 8347 | { |
| 8348 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 8349 | } |
| 8350 | else |
| 8351 | { |
| 8352 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 8353 | { |
| 8354 | // Successfully deauth from the 'old' Bss... |
| 8355 | // |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8356 | smsLog( pMac, LOG2, "CSR SmeDeauthReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8357 | } |
| 8358 | else |
| 8359 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 8360 | smsLog( pMac, LOGW, "SmeDeauthReq failed with statusCode= 0x%08X", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8361 | } |
| 8362 | //We are not done yet. Get the data and continue roaming |
| 8363 | csrRoamReissueRoamCommand(pMac); |
| 8364 | } |
| 8365 | } |
| 8366 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8367 | static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp ) |
| 8368 | { |
| 8369 | eCsrRoamCompleteResult result; |
| 8370 | |
| 8371 | if ( eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode ) |
| 8372 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8373 | smsLog( pMac, LOGW, "SmeStartBssReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8374 | result = eCsrStartBssSuccess; |
| 8375 | } |
| 8376 | else |
| 8377 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 8378 | smsLog( pMac, LOGW, "SmeStartBssReq failed with statusCode= 0x%08X", pSmeStartBssRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8379 | //Let csrRoamComplete decide what to do |
| 8380 | result = eCsrStartBssFailure; |
| 8381 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8382 | csrRoamComplete( pMac, result, pSmeStartBssRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8383 | } |
| 8384 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8385 | /* |
| 8386 | We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres. |
| 8387 | It depends on how the message is constructed. If the message is sent by limSendSmeRsp, |
| 8388 | the pMsgBuf is only a generic response and can only be used as pointer to tSirSmeRsp. |
| 8389 | For the messages where sender allocates memory for specific structures, then it can be |
| 8390 | cast accordingly. |
| 8391 | */ |
| 8392 | void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 8393 | { |
| 8394 | tSirSmeRsp *pSmeRsp; |
| 8395 | tSmeIbssPeerInd *pIbssPeerInd; |
| 8396 | tCsrRoamInfo roamInfo; |
| 8397 | // TODO Session Id need to be acquired in this function |
| 8398 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8399 | pSmeRsp = (tSirSmeRsp *)pMsgBuf; |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 8400 | smsLog(pMac, LOG2, FL("Message %d[0x%04X] received in substate %s"), |
| 8401 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 8402 | macTraceGetcsrRoamSubState( |
| 8403 | pMac->roam.curSubState[pSmeRsp->sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8404 | pSmeRsp->messageType = (pSmeRsp->messageType); |
| 8405 | pSmeRsp->length = (pSmeRsp->length); |
| 8406 | pSmeRsp->statusCode = (pSmeRsp->statusCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8407 | switch (pSmeRsp->messageType) |
| 8408 | { |
| 8409 | |
| 8410 | case eWNI_SME_JOIN_RSP: // in Roaming state, process the Join response message... |
| 8411 | if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId)) |
| 8412 | { |
| 8413 | //We sent a JOIN_REQ |
| 8414 | csrRoamJoinRspProcessor( pMac, (tSirSmeJoinRsp *)pSmeRsp ); |
| 8415 | } |
| 8416 | break; |
| 8417 | |
| 8418 | case eWNI_SME_AUTH_RSP: // or the Authenticate response message... |
| 8419 | if (CSR_IS_ROAM_SUBSTATE_AUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 8420 | { |
| 8421 | //We sent a AUTH_REQ |
| 8422 | csrRoamRoamingStateAuthRspProcessor( pMac, (tSirSmeAuthRsp *)pSmeRsp ); |
| 8423 | } |
| 8424 | break; |
| 8425 | |
| 8426 | case eWNI_SME_REASSOC_RSP: // or the Reassociation response message... |
| 8427 | if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ( pMac, pSmeRsp->sessionId) ) |
| 8428 | { |
| 8429 | csrRoamRoamingStateReassocRspProcessor( pMac, (tpSirSmeJoinRsp )pSmeRsp ); |
| 8430 | } |
| 8431 | break; |
| 8432 | |
| 8433 | case eWNI_SME_STOP_BSS_RSP: // or the Stop Bss response message... |
| 8434 | { |
| 8435 | csrRoamRoamingStateStopBssRspProcessor(pMac, pSmeRsp); |
| 8436 | } |
| 8437 | break; |
| 8438 | |
| 8439 | case eWNI_SME_DISASSOC_RSP: // or the Disassociate response message... |
| 8440 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, pSmeRsp->sessionId ) || |
| 8441 | CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, pSmeRsp->sessionId ) || |
| 8442 | CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, pSmeRsp->sessionId ) || |
| 8443 | CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, pSmeRsp->sessionId ) || |
| 8444 | CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId ) || |
| 8445 | //HO |
| 8446 | CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, pSmeRsp->sessionId ) ) |
| 8447 | { |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 8448 | smsLog(pMac, LOG1, FL("eWNI_SME_DISASSOC_RSP subState = %s"), |
| 8449 | macTraceGetcsrRoamSubState( |
| 8450 | pMac->roam.curSubState[pSmeRsp->sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8451 | csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp ); |
Mukul Sharma | be91e2f | 2014-06-29 22:09:20 +0530 | [diff] [blame] | 8452 | #ifdef DEBUG_ROAM_DELAY |
| 8453 | vos_record_roam_event(e_SME_DISASSOC_COMPLETE, NULL, 0); |
| 8454 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8455 | } |
| 8456 | break; |
| 8457 | |
| 8458 | case eWNI_SME_DEAUTH_RSP: // or the Deauthentication response message... |
| 8459 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId ) ) |
| 8460 | { |
| 8461 | csrRoamRoamingStateDeauthRspProcessor( pMac, (tSirSmeDeauthRsp *)pSmeRsp ); |
| 8462 | } |
| 8463 | break; |
| 8464 | |
| 8465 | case eWNI_SME_START_BSS_RSP: // or the Start BSS response message... |
| 8466 | if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ( pMac, pSmeRsp->sessionId ) ) |
| 8467 | { |
| 8468 | csrRoamRoamingStateStartBssRspProcessor( pMac, (tSirSmeStartBssRsp *)pSmeRsp ); |
| 8469 | } |
| 8470 | break; |
| 8471 | |
| 8472 | case WNI_CFG_SET_CNF: // process the Config Confirm messages when we are in 'Config' substate... |
| 8473 | if ( CSR_IS_ROAM_SUBSTATE_CONFIG( pMac, pSmeRsp->sessionId ) ) |
| 8474 | { |
| 8475 | csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus ); |
| 8476 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8477 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8478 | //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them |
| 8479 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 8480 | pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8481 | smsLog(pMac, LOGE, "CSR: Peer departed notification from LIM in joining state"); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8482 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
| 8483 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8484 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 8485 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8486 | vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, |
| 8487 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8488 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 8489 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 8490 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 8491 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8492 | default: |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 8493 | smsLog(pMac, LOG1, |
| 8494 | FL("Unexpected message type = %d[0x%X] received in substate %s"), |
| 8495 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 8496 | macTraceGetcsrRoamSubState( |
| 8497 | pMac->roam.curSubState[pSmeRsp->sessionId])); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8498 | |
| 8499 | //If we are connected, check the link status change |
| 8500 | if(!csrIsConnStateDisconnected(pMac, sessionId)) |
| 8501 | { |
| 8502 | csrRoamCheckForLinkStatusChange( pMac, pSmeRsp ); |
| 8503 | } |
| 8504 | break; |
| 8505 | } |
| 8506 | } |
| 8507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8508 | void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 8509 | { |
| 8510 | tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8511 | switch (pSirMsg->messageType) |
| 8512 | { |
| 8513 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8514 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8515 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 8516 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8517 | case eWNI_SME_UPPER_LAYER_ASSOC_CNF: |
| 8518 | { |
| 8519 | tCsrRoamSession *pSession; |
| 8520 | tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; |
| 8521 | tCsrRoamInfo roamInfo; |
| 8522 | tCsrRoamInfo *pRoamInfo = NULL; |
| 8523 | tANI_U32 sessionId; |
| 8524 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8525 | smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer ")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8526 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8527 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8528 | pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf; |
| 8529 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId ); |
| 8530 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8531 | |
| 8532 | if(!pSession) |
| 8533 | { |
| 8534 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8535 | return; |
| 8536 | } |
| 8537 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8538 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 8539 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8540 | pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid; |
| 8541 | pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length; |
| 8542 | pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8543 | pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length; |
| 8544 | pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8545 | vos_mem_copy(pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, |
| 8546 | sizeof(tSirMacAddr)); |
| 8547 | vos_mem_copy(&pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, |
| 8548 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8549 | pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta; |
Hardik Kantilal Patel | 1ba630f | 2014-11-21 04:32:05 +0530 | [diff] [blame] | 8550 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 8551 | pRoamInfo->HT40MHzIntoEnabledSta = |
| 8552 | pUpperLayerAssocCnf->HT40MHzIntoEnabledSta; |
| 8553 | smsLog( pMac, LOGW, FL("HT40MHzIntoEnabledSta: %d \n"), |
| 8554 | pRoamInfo->HT40MHzIntoEnabledSta); |
| 8555 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8556 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) ) |
| 8557 | { |
| 8558 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED; |
| 8559 | pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq; |
| 8560 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 8561 | } |
| 8562 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 8563 | { |
| 8564 | vos_sleep( 100 ); |
| 8565 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta |
| 8566 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 8567 | } |
| 8568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8569 | } |
| 8570 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8571 | default: |
| 8572 | csrRoamCheckForLinkStatusChange( pMac, pSirMsg ); |
| 8573 | break; |
| 8574 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8575 | } |
| 8576 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8577 | eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, |
| 8578 | tSirBssDescription *pBssDescription, |
| 8579 | tSirMacAddr *bssId, tANI_BOOLEAN addKey, |
| 8580 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 8581 | tANI_U8 keyId, tANI_U16 keyLength, |
| 8582 | tANI_U8 *pKey, tANI_U8 paeRole ) |
| 8583 | { |
| 8584 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8585 | tAniEdType edType; |
| 8586 | |
| 8587 | if(eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType) |
| 8588 | { |
| 8589 | EncryptType = eCSR_ENCRYPT_TYPE_NONE; //*** |
| 8590 | } |
| 8591 | |
| 8592 | edType = csrTranslateEncryptTypeToEdType( EncryptType ); |
| 8593 | |
| 8594 | // Allow 0 keys to be set for the non-WPA encrypt types... For WPA encrypt types, the num keys must be non-zero |
| 8595 | // or LIM will reject the set context (assumes the SET_CONTEXT does not occur until the keys are distrubuted). |
| 8596 | if ( CSR_IS_ENC_TYPE_STATIC( EncryptType ) || |
| 8597 | addKey ) |
| 8598 | { |
| 8599 | tCsrRoamSetKey setKey; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8600 | setKey.encType = EncryptType; |
| 8601 | setKey.keyDirection = aniKeyDirection; //Tx, Rx or Tx-and-Rx |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8602 | vos_mem_copy(&setKey.peerMac, bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8603 | setKey.paeRole = paeRole; //0 for supplicant |
| 8604 | setKey.keyId = keyId; // Kye index |
| 8605 | setKey.keyLength = keyLength; |
| 8606 | if( keyLength ) |
| 8607 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8608 | vos_mem_copy(setKey.Key, pKey, keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8609 | } |
| 8610 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 ); |
| 8611 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8612 | return (status); |
| 8613 | } |
| 8614 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8615 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8616 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8617 | { |
| 8618 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 8619 | tSmeCmd *pCommand = NULL; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8620 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8621 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8622 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8623 | |
| 8624 | do |
| 8625 | { |
| 8626 | pCommand = csrGetCommandBuffer(pMac); |
| 8627 | if(NULL == pCommand) |
| 8628 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8629 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8630 | status = eHAL_STATUS_RESOURCES; |
| 8631 | break; |
| 8632 | } |
Sushant Kaushik | e7de85f | 2014-06-16 17:13:30 +0530 | [diff] [blame] | 8633 | vos_mem_zero(pCommand, sizeof(tSmeCmd)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8634 | pCommand->command = eSmeCommandSetKey; |
| 8635 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8636 | // validate the key length, Adjust if too long... |
| 8637 | // for static WEP the keys are not set thru' SetContextReq |
| 8638 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 8639 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ) ) |
| 8640 | { |
| 8641 | //KeyLength maybe 0 for static WEP |
| 8642 | if( pSetKey->keyLength ) |
| 8643 | { |
| 8644 | if ( pSetKey->keyLength < CSR_WEP40_KEY_LEN ) |
| 8645 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8646 | smsLog( pMac, LOGW, "Invalid WEP40 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8647 | break; |
| 8648 | } |
| 8649 | |
| 8650 | pCommand->u.setKeyCmd.keyLength = CSR_WEP40_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8651 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8652 | CSR_WEP40_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8653 | } |
| 8654 | } |
| 8655 | else if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 8656 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ) ) |
| 8657 | { |
| 8658 | //KeyLength maybe 0 for static WEP |
| 8659 | if( pSetKey->keyLength ) |
| 8660 | { |
| 8661 | if ( pSetKey->keyLength < CSR_WEP104_KEY_LEN ) |
| 8662 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8663 | smsLog( pMac, LOGW, "Invalid WEP104 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8664 | break; |
| 8665 | } |
| 8666 | |
| 8667 | pCommand->u.setKeyCmd.keyLength = CSR_WEP104_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8668 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8669 | CSR_WEP104_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8670 | } |
| 8671 | } |
| 8672 | else if ( eCSR_ENCRYPT_TYPE_TKIP == pSetKey->encType ) |
| 8673 | { |
| 8674 | if ( pSetKey->keyLength < CSR_TKIP_KEY_LEN ) |
| 8675 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8676 | smsLog( pMac, LOGW, "Invalid TKIP keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8677 | break; |
| 8678 | } |
| 8679 | pCommand->u.setKeyCmd.keyLength = CSR_TKIP_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8680 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8681 | CSR_TKIP_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8682 | } |
| 8683 | else if ( eCSR_ENCRYPT_TYPE_AES == pSetKey->encType ) |
| 8684 | { |
| 8685 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 8686 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8687 | 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] | 8688 | break; |
| 8689 | } |
| 8690 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8691 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8692 | CSR_AES_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8693 | } |
| 8694 | #ifdef FEATURE_WLAN_WAPI |
| 8695 | else if ( eCSR_ENCRYPT_TYPE_WPI == pSetKey->encType ) |
| 8696 | { |
| 8697 | if ( pSetKey->keyLength < CSR_WAPI_KEY_LEN ) |
| 8698 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8699 | smsLog( pMac, LOGW, "Invalid WAPI keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8700 | break; |
| 8701 | } |
| 8702 | pCommand->u.setKeyCmd.keyLength = CSR_WAPI_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8703 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8704 | CSR_WAPI_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8705 | } |
| 8706 | #endif /* FEATURE_WLAN_WAPI */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8707 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8708 | else if ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 8709 | { |
| 8710 | if ( pSetKey->keyLength < CSR_KRK_KEY_LEN ) |
| 8711 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8712 | smsLog( pMac, LOGW, "Invalid KRK keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8713 | break; |
| 8714 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8715 | vos_mem_copy(pSession->eseCckmInfo.krk, pSetKey->Key, |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8716 | CSR_KRK_KEY_LEN); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8717 | pSession->eseCckmInfo.reassoc_req_num=1; |
| 8718 | pSession->eseCckmInfo.krk_plumbed = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8719 | status = eHAL_STATUS_SUCCESS; |
| 8720 | break; |
| 8721 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8722 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8723 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8724 | #ifdef WLAN_FEATURE_11W |
| 8725 | //Check for 11w BIP |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8726 | else if (eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8727 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8728 | if (pSetKey->keyLength < CSR_AES_KEY_LEN) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8729 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8730 | 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] | 8731 | break; |
| 8732 | } |
| 8733 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8734 | 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] | 8735 | } |
| 8736 | #endif |
| 8737 | status = eHAL_STATUS_SUCCESS; |
| 8738 | pCommand->u.setKeyCmd.roamId = roamId; |
| 8739 | pCommand->u.setKeyCmd.encType = pSetKey->encType; |
| 8740 | pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection; //Tx, Rx or Tx-and-Rx |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8741 | vos_mem_copy(&pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, |
| 8742 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8743 | pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole; //0 for supplicant |
| 8744 | pCommand->u.setKeyCmd.keyId = pSetKey->keyId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8745 | 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] | 8746 | //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 |
| 8747 | |
| 8748 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 8749 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8750 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8751 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8752 | } |
| 8753 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8754 | // 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] | 8755 | // "local" operation like the set ESE CCKM KRK key. |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8756 | if ( ( NULL != pCommand ) && |
| 8757 | ( (!HAL_STATUS_SUCCESS( status ) ) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8758 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8759 | || ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 8760 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8761 | ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8762 | { |
| 8763 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 8764 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8765 | return( status ); |
| 8766 | } |
| 8767 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8768 | eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8769 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId ) |
| 8770 | { |
| 8771 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 8772 | tSmeCmd *pCommand = NULL; |
| 8773 | tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8774 | do |
| 8775 | { |
| 8776 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8777 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8778 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8779 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8780 | break; |
| 8781 | } |
| 8782 | pCommand = csrGetCommandBuffer(pMac); |
| 8783 | if(NULL == pCommand) |
| 8784 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8785 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8786 | status = eHAL_STATUS_RESOURCES; |
| 8787 | break; |
| 8788 | } |
| 8789 | pCommand->command = eSmeCommandRemoveKey; |
| 8790 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8791 | pCommand->u.removeKeyCmd.roamId = roamId; |
| 8792 | pCommand->u.removeKeyCmd.encType = pRemoveKey->encType; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8793 | vos_mem_copy(&pCommand->u.removeKeyCmd.peerMac, &pRemoveKey->peerMac, |
| 8794 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8795 | pCommand->u.removeKeyCmd.keyId = pRemoveKey->keyId; |
| 8796 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8797 | { |
| 8798 | //in this case, put it to the end of the Q incase there is a set key pending. |
| 8799 | fImediate = eANI_BOOLEAN_FALSE; |
| 8800 | } |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8801 | smsLog( pMac, LOGE, FL("keyType=%d, keyId=%d, PeerMac="MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8802 | pRemoveKey->encType, pRemoveKey->keyId, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 8803 | MAC_ADDR_ARRAY(pCommand->u.removeKeyCmd.peerMac)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8804 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 8805 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8806 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8807 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8808 | break; |
| 8809 | } |
| 8810 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8811 | if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) ) |
| 8812 | { |
| 8813 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 8814 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8815 | return (status ); |
| 8816 | } |
| 8817 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8818 | eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8819 | { |
| 8820 | eHalStatus status; |
| 8821 | tANI_U8 numKeys = ( pCommand->u.setKeyCmd.keyLength ) ? 1 : 0; |
| 8822 | tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType ); |
| 8823 | tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE; |
| 8824 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8825 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8826 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8827 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
Girish Gowli | 2857eb2 | 2014-07-31 19:49:46 +0530 | [diff] [blame] | 8828 | if(!pSession) |
| 8829 | { |
| 8830 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8831 | return eHAL_STATUS_FAILURE; |
| 8832 | } |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8833 | if(eSIR_ED_NONE != edType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8834 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8835 | vos_mem_set(&setKeyEvent, |
| 8836 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8837 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8838 | { |
| 8839 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ; |
| 8840 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8841 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8842 | } |
| 8843 | else |
| 8844 | { |
| 8845 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ; |
| 8846 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8847 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8848 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8849 | vos_mem_copy(setKeyEvent.bssid, pSession->connectedProfile.bssid, 6); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8850 | if(CSR_IS_ENC_TYPE_STATIC(pCommand->u.setKeyCmd.encType)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8851 | { |
| 8852 | tANI_U32 defKeyId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8853 | //It has to be static WEP here |
| 8854 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId))) |
| 8855 | { |
| 8856 | setKeyEvent.keyId = (v_U8_t)defKeyId; |
| 8857 | } |
| 8858 | } |
| 8859 | else |
| 8860 | { |
| 8861 | setKeyEvent.keyId = pCommand->u.setKeyCmd.keyId; |
| 8862 | } |
| 8863 | setKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8864 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8865 | } |
| 8866 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8867 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8868 | { |
| 8869 | status = csrSendMBSetContextReqMsg( pMac, sessionId, |
| 8870 | ( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac, |
| 8871 | numKeys, edType, fUnicast, pCommand->u.setKeyCmd.keyDirection, |
| 8872 | pCommand->u.setKeyCmd.keyId, pCommand->u.setKeyCmd.keyLength, |
| 8873 | pCommand->u.setKeyCmd.Key, pCommand->u.setKeyCmd.paeRole, |
| 8874 | pCommand->u.setKeyCmd.keyRsc); |
| 8875 | } |
| 8876 | else |
| 8877 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8878 | smsLog( pMac, LOGW, FL(" cannot process not connected") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8879 | //Set this status so the error handling take care of the case. |
| 8880 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8881 | } |
| 8882 | if( !HAL_STATUS_SUCCESS(status) ) |
| 8883 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8884 | smsLog( pMac, LOGE, FL(" error status %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8885 | 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] | 8886 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8887 | if(eSIR_ED_NONE != edType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8888 | { |
| 8889 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8890 | { |
| 8891 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 8892 | } |
| 8893 | else |
| 8894 | { |
| 8895 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 8896 | } |
| 8897 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 8898 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8899 | } |
| 8900 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8901 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8902 | return ( status ); |
| 8903 | } |
| 8904 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8905 | eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8906 | { |
| 8907 | eHalStatus status; |
| 8908 | tpSirSmeRemoveKeyReq pMsg = NULL; |
| 8909 | tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq); |
| 8910 | tANI_U8 *p; |
| 8911 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8912 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8913 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8914 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Girish Gowli | 2857eb2 | 2014-07-31 19:49:46 +0530 | [diff] [blame] | 8915 | if(!pSession) |
| 8916 | { |
| 8917 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8918 | return eHAL_STATUS_FAILURE; |
| 8919 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8920 | vos_mem_set(&removeKeyEvent, |
| 8921 | sizeof(vos_event_wlan_security_payload_type),0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8922 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ; |
| 8923 | removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8924 | removeKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8925 | vos_mem_copy(removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8926 | removeKeyEvent.keyId = pCommand->u.removeKeyCmd.keyId; |
| 8927 | removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8928 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8929 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8930 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8931 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8932 | pMsg = vos_mem_malloc(wMsgLen); |
| 8933 | if ( NULL == pMsg ) |
| 8934 | status = eHAL_STATUS_FAILURE; |
| 8935 | else |
| 8936 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8937 | } |
| 8938 | else |
| 8939 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8940 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8941 | //Set the error status so error handling kicks in below |
| 8942 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8943 | } |
| 8944 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8945 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8946 | vos_mem_set(pMsg, wMsgLen ,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8947 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ); |
| 8948 | pMsg->length = pal_cpu_to_be16(wMsgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8949 | pMsg->sessionId = (tANI_U8)sessionId; |
| 8950 | pMsg->transactionId = 0; |
| 8951 | p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) + |
| 8952 | sizeof(pMsg->sessionId) + sizeof(pMsg->transactionId); |
| 8953 | // bssId - copy from session Info |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8954 | vos_mem_copy(p, |
| 8955 | &pMac->roam.roamSession[sessionId].connectedProfile.bssid, |
| 8956 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8957 | p += sizeof(tSirMacAddr); |
| 8958 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8959 | vos_mem_copy(p, pCommand->u.removeKeyCmd.peerMac, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8960 | p += sizeof(tSirMacAddr); |
| 8961 | // edType |
| 8962 | *p = (tANI_U8)csrTranslateEncryptTypeToEdType( pCommand->u.removeKeyCmd.encType ); |
| 8963 | p++; |
| 8964 | // weptype |
| 8965 | if( ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pCommand->u.removeKeyCmd.encType ) || |
| 8966 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pCommand->u.removeKeyCmd.encType ) ) |
| 8967 | { |
| 8968 | *p = (tANI_U8)eSIR_WEP_STATIC; |
| 8969 | } |
| 8970 | else |
| 8971 | { |
| 8972 | *p = (tANI_U8)eSIR_WEP_DYNAMIC; |
| 8973 | } |
| 8974 | p++; |
| 8975 | //keyid |
| 8976 | *p = pCommand->u.removeKeyCmd.keyId; |
| 8977 | p++; |
| 8978 | *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8979 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 8980 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8981 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8982 | { |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 8983 | smsLog( pMac, LOGE, FL(" error status %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8984 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8985 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 8986 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8987 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8988 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8989 | csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE); |
| 8990 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8991 | return ( status ); |
| 8992 | } |
| 8993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8994 | eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8995 | { |
| 8996 | eHalStatus status; |
| 8997 | |
| 8998 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8999 | { |
| 9000 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 9001 | } |
| 9002 | else |
| 9003 | { |
| 9004 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId ); |
| 9005 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9006 | return ( status ); |
| 9007 | } |
| 9008 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9009 | /* |
| 9010 | Prepare a filter base on a profile for parsing the scan results. |
| 9011 | Upon successful return, caller MUST call csrFreeScanFilter on |
| 9012 | pScanFilter when it is done with the filter. |
| 9013 | */ |
| 9014 | eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 9015 | tCsrScanResultFilter *pScanFilter) |
| 9016 | { |
| 9017 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9018 | tANI_U32 size = 0; |
| 9019 | tANI_U8 index = 0; |
| 9020 | |
| 9021 | do |
| 9022 | { |
| 9023 | if(pProfile->BSSIDs.numOfBSSIDs) |
| 9024 | { |
| 9025 | size = sizeof(tCsrBssid) * pProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9026 | pScanFilter->BSSIDs.bssid = vos_mem_malloc(size); |
| 9027 | if ( NULL == pScanFilter->BSSIDs.bssid ) |
| 9028 | status = eHAL_STATUS_FAILURE; |
| 9029 | else |
| 9030 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9031 | if(!HAL_STATUS_SUCCESS(status)) |
| 9032 | { |
| 9033 | break; |
| 9034 | } |
| 9035 | pScanFilter->BSSIDs.numOfBSSIDs = pProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9036 | vos_mem_copy(pScanFilter->BSSIDs.bssid, pProfile->BSSIDs.bssid, size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9037 | } |
| 9038 | if(pProfile->SSIDs.numOfSSIDs) |
| 9039 | { |
| 9040 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 9041 | { |
| 9042 | pScanFilter->SSIDs.numOfSSIDs = pProfile->SSIDs.numOfSSIDs; |
| 9043 | } |
| 9044 | else |
| 9045 | { |
| 9046 | //For WDS station |
| 9047 | //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join |
| 9048 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 9049 | } |
| 9050 | size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9051 | pScanFilter->SSIDs.SSIDList = vos_mem_malloc(size); |
| 9052 | if ( NULL == pScanFilter->SSIDs.SSIDList ) |
| 9053 | status = eHAL_STATUS_FAILURE; |
| 9054 | else |
| 9055 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9056 | if(!HAL_STATUS_SUCCESS(status)) |
| 9057 | { |
| 9058 | break; |
| 9059 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9060 | vos_mem_copy(pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, |
| 9061 | size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9062 | } |
| 9063 | if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) ) |
| 9064 | { |
| 9065 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 9066 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 9067 | } |
| 9068 | else if(pProfile->ChannelInfo.numOfChannels) |
| 9069 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9070 | pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc( |
| 9071 | sizeof(*pScanFilter->ChannelInfo.ChannelList) * |
| 9072 | pProfile->ChannelInfo.numOfChannels); |
| 9073 | if ( NULL == pScanFilter->ChannelInfo.ChannelList ) |
| 9074 | status = eHAL_STATUS_FAILURE; |
| 9075 | else |
| 9076 | status = eHAL_STATUS_SUCCESS; |
| 9077 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9078 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 9079 | if(HAL_STATUS_SUCCESS(status)) |
| 9080 | { |
| 9081 | for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++) |
| 9082 | { |
| 9083 | if(csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[index])) |
| 9084 | { |
| 9085 | pScanFilter->ChannelInfo.ChannelList[pScanFilter->ChannelInfo.numOfChannels] |
| 9086 | = pProfile->ChannelInfo.ChannelList[index]; |
| 9087 | pScanFilter->ChannelInfo.numOfChannels++; |
| 9088 | } |
| 9089 | else |
| 9090 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9091 | 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] | 9092 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9093 | } |
| 9094 | } |
| 9095 | else |
| 9096 | { |
| 9097 | break; |
| 9098 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9099 | } |
| 9100 | else |
| 9101 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 9102 | smsLog(pMac, LOGE, FL("Channel list empty")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9103 | status = eHAL_STATUS_FAILURE; |
| 9104 | break; |
| 9105 | } |
| 9106 | pScanFilter->uapsd_mask = pProfile->uapsd_mask; |
| 9107 | pScanFilter->authType = pProfile->AuthType; |
| 9108 | pScanFilter->EncryptionType = pProfile->EncryptionType; |
| 9109 | pScanFilter->mcEncryptionType = pProfile->mcEncryptionType; |
| 9110 | pScanFilter->BSSType = pProfile->BSSType; |
| 9111 | pScanFilter->phyMode = pProfile->phyMode; |
| 9112 | #ifdef FEATURE_WLAN_WAPI |
| 9113 | //check if user asked for WAPI with 11n or auto mode, in that case modify |
| 9114 | //the phymode to 11g |
| 9115 | if(csrIsProfileWapi(pProfile)) |
| 9116 | { |
| 9117 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_11n) |
| 9118 | { |
| 9119 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 9120 | } |
| 9121 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_AUTO) |
| 9122 | { |
| 9123 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_AUTO; |
| 9124 | } |
| 9125 | if(!pScanFilter->phyMode) |
| 9126 | { |
| 9127 | pScanFilter->phyMode = eCSR_DOT11_MODE_11g; |
| 9128 | } |
| 9129 | } |
| 9130 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9131 | /*Save the WPS info*/ |
| 9132 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 9133 | pScanFilter->bOSENAssociation = pProfile->bOSENAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9134 | if( pProfile->countryCode[0] ) |
| 9135 | { |
| 9136 | //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] | 9137 | vos_mem_copy(pScanFilter->countryCode, pProfile->countryCode, |
| 9138 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9139 | } |
| 9140 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9141 | if (pProfile->MDID.mdiePresent) |
| 9142 | { |
| 9143 | pScanFilter->MDID.mdiePresent = 1; |
| 9144 | pScanFilter->MDID.mobilityDomain = pProfile->MDID.mobilityDomain; |
| 9145 | } |
| 9146 | #endif |
Abhishek Singh | 3b56d3a | 2014-06-25 12:37:39 +0530 | [diff] [blame] | 9147 | |
| 9148 | #ifdef WLAN_FEATURE_11W |
| 9149 | // Management Frame Protection |
| 9150 | pScanFilter->MFPEnabled = pProfile->MFPEnabled; |
| 9151 | pScanFilter->MFPRequired = pProfile->MFPRequired; |
| 9152 | pScanFilter->MFPCapable = pProfile->MFPCapable; |
| 9153 | #endif |
| 9154 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9155 | }while(0); |
| 9156 | |
| 9157 | if(!HAL_STATUS_SUCCESS(status)) |
| 9158 | { |
| 9159 | csrFreeScanFilter(pMac, pScanFilter); |
| 9160 | } |
| 9161 | |
| 9162 | return(status); |
| 9163 | } |
| 9164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9165 | tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 9166 | eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp ) |
| 9167 | { |
| 9168 | tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE; |
| 9169 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9170 | do |
| 9171 | { |
| 9172 | // Validate the type is ok... |
| 9173 | if ( ( eCsrDisassociated != Type ) && ( eCsrDeauthenticated != Type ) ) break; |
| 9174 | pCommand = csrGetCommandBuffer( pMac ); |
| 9175 | if ( !pCommand ) |
| 9176 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9177 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9178 | break; |
| 9179 | } |
| 9180 | //Change the substate in case it is waiting for key |
| 9181 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 9182 | { |
| 9183 | csrRoamStopWaitForKeyTimer( pMac ); |
| 9184 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 9185 | } |
| 9186 | pCommand->command = eSmeCommandWmStatusChange; |
| 9187 | pCommand->sessionId = (tANI_U8)sessionId; |
| 9188 | pCommand->u.wmStatusChangeCmd.Type = Type; |
| 9189 | if ( eCsrDisassociated == Type ) |
| 9190 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9191 | vos_mem_copy(&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg, |
| 9192 | pSmeRsp, |
| 9193 | sizeof( pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9194 | } |
| 9195 | else |
| 9196 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9197 | vos_mem_copy(&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg, |
| 9198 | pSmeRsp, |
| 9199 | sizeof( pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9200 | } |
| 9201 | if( HAL_STATUS_SUCCESS( csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE) ) ) |
| 9202 | { |
| 9203 | fCommandQueued = eANI_BOOLEAN_TRUE; |
| 9204 | } |
| 9205 | else |
| 9206 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9207 | smsLog( pMac, LOGE, FL(" fail to send message ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9208 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 9209 | } |
| 9210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9211 | /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */ |
| 9212 | csrSetDefaultDot11Mode( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9213 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9214 | return( fCommandQueued ); |
| 9215 | } |
| 9216 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9217 | static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg) |
| 9218 | { |
| 9219 | v_S7_t rssi = 0; |
| 9220 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq*)pMsg; |
| 9221 | if(pGetRssiReq) |
| 9222 | { |
| 9223 | if(NULL != pGetRssiReq->pVosContext) |
| 9224 | { |
| 9225 | WLANTL_GetRssi(pGetRssiReq->pVosContext, pGetRssiReq->staId, &rssi); |
| 9226 | } |
| 9227 | else |
| 9228 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9229 | smsLog( pMac, LOGE, FL("pGetRssiReq->pVosContext is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9230 | return; |
| 9231 | } |
| 9232 | |
| 9233 | if(NULL != pGetRssiReq->rssiCallback) |
| 9234 | { |
| 9235 | ((tCsrRssiCallback)(pGetRssiReq->rssiCallback))(rssi, pGetRssiReq->staId, pGetRssiReq->pDevContext); |
| 9236 | } |
| 9237 | else |
| 9238 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9239 | smsLog( pMac, LOGE, FL("pGetRssiReq->rssiCallback is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9240 | return; |
| 9241 | } |
| 9242 | } |
| 9243 | else |
| 9244 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9245 | smsLog( pMac, LOGE, FL("pGetRssiReq is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9246 | } |
| 9247 | return; |
| 9248 | } |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 9249 | |
| 9250 | static void csrUpdateSnr(tpAniSirGlobal pMac, void* pMsg) |
| 9251 | { |
| 9252 | tANI_S8 snr = 0; |
| 9253 | tAniGetSnrReq *pGetSnrReq = (tAniGetSnrReq*)pMsg; |
| 9254 | |
| 9255 | if (pGetSnrReq) |
| 9256 | { |
| 9257 | if (VOS_STATUS_SUCCESS != |
| 9258 | WDA_GetSnr(pGetSnrReq->staId, &snr)) |
| 9259 | { |
| 9260 | smsLog(pMac, LOGE, FL("Error in WLANTL_GetSnr")); |
| 9261 | return; |
| 9262 | } |
| 9263 | |
| 9264 | if (pGetSnrReq->snrCallback) |
| 9265 | { |
| 9266 | ((tCsrSnrCallback)(pGetSnrReq->snrCallback))(snr, pGetSnrReq->staId, |
| 9267 | pGetSnrReq->pDevContext); |
| 9268 | } |
| 9269 | else |
| 9270 | { |
| 9271 | smsLog(pMac, LOGE, FL("pGetSnrReq->snrCallback is NULL")); |
| 9272 | return; |
| 9273 | } |
| 9274 | } |
| 9275 | else |
| 9276 | { |
| 9277 | smsLog(pMac, LOGE, FL("pGetSnrReq is NULL")); |
| 9278 | } |
| 9279 | return; |
| 9280 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9281 | #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] | 9282 | void csrRoamRssiRspProcessor(tpAniSirGlobal pMac, void* pMsg) |
| 9283 | { |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9284 | tAniGetRoamRssiRsp* pRoamRssiRsp = (tAniGetRoamRssiRsp*)pMsg; |
| 9285 | |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 9286 | if (NULL != pRoamRssiRsp) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9287 | { |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 9288 | /* Get roam Rssi request is backed up and passed back to the response, |
| 9289 | Extract the request message to fetch callback */ |
| 9290 | tpAniGetRssiReq reqBkp = (tAniGetRssiReq*)pRoamRssiRsp->rssiReq; |
| 9291 | v_S7_t rssi = pRoamRssiRsp->rssi; |
| 9292 | |
| 9293 | if ((NULL != reqBkp) && (NULL != reqBkp->rssiCallback)) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9294 | { |
| 9295 | ((tCsrRssiCallback)(reqBkp->rssiCallback))(rssi, pRoamRssiRsp->staId, reqBkp->pDevContext); |
| 9296 | reqBkp->rssiCallback = NULL; |
| 9297 | vos_mem_free(reqBkp); |
Kiran Kumar Lokere | 111cff4 | 2013-12-11 21:05:44 -0800 | [diff] [blame] | 9298 | pRoamRssiRsp->rssiReq = NULL; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9299 | } |
| 9300 | else |
| 9301 | { |
| 9302 | smsLog( pMac, LOGE, FL("reqBkp->rssiCallback is NULL")); |
| 9303 | if (NULL != reqBkp) |
| 9304 | { |
| 9305 | vos_mem_free(reqBkp); |
Kiran Kumar Lokere | 111cff4 | 2013-12-11 21:05:44 -0800 | [diff] [blame] | 9306 | pRoamRssiRsp->rssiReq = NULL; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 9307 | } |
| 9308 | } |
| 9309 | } |
| 9310 | else |
| 9311 | { |
| 9312 | smsLog( pMac, LOGE, FL("pRoamRssiRsp is NULL")); |
| 9313 | } |
| 9314 | return; |
| 9315 | } |
| 9316 | #endif |
| 9317 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9318 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9319 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9320 | void csrTsmStatsRspProcessor(tpAniSirGlobal pMac, void* pMsg) |
| 9321 | { |
| 9322 | tAniGetTsmStatsRsp* pTsmStatsRsp = (tAniGetTsmStatsRsp*)pMsg; |
| 9323 | |
| 9324 | if (NULL != pTsmStatsRsp) |
| 9325 | { |
| 9326 | /* Get roam Rssi request is backed up and passed back to the response, |
| 9327 | Extract the request message to fetch callback */ |
| 9328 | tpAniGetTsmStatsReq reqBkp = (tAniGetTsmStatsReq*)pTsmStatsRsp->tsmStatsReq; |
| 9329 | |
| 9330 | if (NULL != reqBkp) |
| 9331 | { |
| 9332 | if (NULL != reqBkp->tsmStatsCallback) |
| 9333 | { |
| 9334 | ((tCsrTsmStatsCallback)(reqBkp->tsmStatsCallback))(pTsmStatsRsp->tsmMetrics, |
| 9335 | pTsmStatsRsp->staId, reqBkp->pDevContext); |
| 9336 | reqBkp->tsmStatsCallback = NULL; |
| 9337 | } |
| 9338 | vos_mem_free(reqBkp); |
Kiran Kumar Lokere | 111cff4 | 2013-12-11 21:05:44 -0800 | [diff] [blame] | 9339 | pTsmStatsRsp->tsmStatsReq = NULL; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9340 | } |
| 9341 | else |
| 9342 | { |
| 9343 | smsLog( pMac, LOGE, FL("reqBkp is NULL")); |
| 9344 | if (NULL != reqBkp) |
| 9345 | { |
| 9346 | vos_mem_free(reqBkp); |
Kiran Kumar Lokere | 111cff4 | 2013-12-11 21:05:44 -0800 | [diff] [blame] | 9347 | pTsmStatsRsp->tsmStatsReq = NULL; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9348 | } |
| 9349 | } |
| 9350 | } |
| 9351 | else |
| 9352 | { |
| 9353 | smsLog( pMac, LOGE, FL("pTsmStatsRsp is NULL")); |
| 9354 | } |
| 9355 | return; |
| 9356 | } |
| 9357 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9358 | void csrSendEseAdjacentApRepInd(tpAniSirGlobal pMac, tCsrRoamSession *pSession) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9359 | { |
| 9360 | tANI_U32 roamTS2 = 0; |
| 9361 | tCsrRoamInfo roamInfo; |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame] | 9362 | tpPESession pSessionEntry = NULL; |
| 9363 | tANI_U8 sessionId = CSR_SESSION_ID_INVALID; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9364 | |
| 9365 | if (NULL == pSession) |
| 9366 | { |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame] | 9367 | smsLog(pMac, LOGE, FL("pSession is NULL")); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9368 | return; |
| 9369 | } |
| 9370 | |
| 9371 | roamTS2 = vos_timer_get_system_time(); |
| 9372 | roamInfo.tsmRoamDelay = roamTS2 - pSession->roamTS1; |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 9373 | smsLog(pMac, LOG1, "Bssid("MAC_ADDRESS_STR") Roaming Delay(%u ms)", |
| 9374 | MAC_ADDR_ARRAY(pSession->connectedProfile.bssid), |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame] | 9375 | roamInfo.tsmRoamDelay); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9376 | |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame] | 9377 | pSessionEntry = peFindSessionByBssid(pMac, pSession->connectedProfile.bssid, &sessionId); |
| 9378 | if (NULL == pSessionEntry) |
| 9379 | { |
| 9380 | smsLog(pMac, LOGE, FL("session %d not found"), sessionId); |
| 9381 | return; |
| 9382 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9383 | pSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly = roamInfo.tsmRoamDelay; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9384 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9385 | 0, eCSR_ROAM_ESE_ADJ_AP_REPORT_IND, 0); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9386 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9387 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9388 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9389 | static void csrRoamRssiIndHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 9390 | { |
| 9391 | WLANTL_TlIndicationReq *pTlRssiInd = (WLANTL_TlIndicationReq*)pMsg; |
| 9392 | if(pTlRssiInd) |
| 9393 | { |
| 9394 | if(NULL != pTlRssiInd->tlCallback) |
| 9395 | { |
| 9396 | ((WLANTL_RSSICrossThresholdCBType)(pTlRssiInd->tlCallback)) |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 9397 | (pTlRssiInd->pAdapter, pTlRssiInd->rssiNotification, pTlRssiInd->pUserCtxt, pTlRssiInd->avgRssi); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9398 | } |
| 9399 | else |
| 9400 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9401 | smsLog( pMac, LOGE, FL("pTlRssiInd->tlCallback is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9402 | } |
| 9403 | } |
| 9404 | else |
| 9405 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9406 | smsLog( pMac, LOGE, FL("pTlRssiInd is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9407 | } |
| 9408 | return; |
| 9409 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9410 | |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9411 | eHalStatus csrSendResetApCapsChanged(tpAniSirGlobal pMac, tSirMacAddr *bssId) |
| 9412 | { |
| 9413 | tpSirResetAPCapsChange pMsg; |
| 9414 | tANI_U16 len; |
| 9415 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9416 | |
| 9417 | /* Create the message and send to lim */ |
| 9418 | len = sizeof(tSirResetAPCapsChange); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9419 | pMsg = vos_mem_malloc(len); |
| 9420 | if ( NULL == pMsg ) |
| 9421 | status = eHAL_STATUS_FAILURE; |
| 9422 | else |
| 9423 | status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9424 | if (HAL_STATUS_SUCCESS(status)) |
| 9425 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9426 | vos_mem_set(pMsg, sizeof(tSirResetAPCapsChange), 0); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9427 | pMsg->messageType = eWNI_SME_RESET_AP_CAPS_CHANGED; |
| 9428 | pMsg->length = len; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9429 | vos_mem_copy(pMsg->bssId, bssId, sizeof(tSirMacAddr)); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 9430 | smsLog( pMac, LOG1, FL("CSR reset caps change for Bssid= "MAC_ADDRESS_STR), |
| 9431 | MAC_ADDR_ARRAY(pMsg->bssId)); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9432 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 9433 | } |
| 9434 | else |
| 9435 | { |
| 9436 | smsLog( pMac, LOGE, FL("Memory allocation failed\n")); |
| 9437 | } |
| 9438 | return status; |
| 9439 | } |
| 9440 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9441 | void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) |
| 9442 | { |
| 9443 | tSirSmeAssocInd *pAssocInd; |
| 9444 | tSirSmeDisassocInd *pDisassocInd; |
| 9445 | tSirSmeDeauthInd *pDeauthInd; |
| 9446 | tSirSmeWmStatusChangeNtf *pStatusChangeMsg; |
| 9447 | tSirSmeNewBssInfo *pNewBss; |
| 9448 | tSmeIbssPeerInd *pIbssPeerInd; |
| 9449 | tSirMacAddr Broadcastaddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 9450 | tSirSmeApNewCaps *pApNewCaps; |
| 9451 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 9452 | eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED; |
| 9453 | tCsrRoamInfo *pRoamInfo = NULL; |
| 9454 | tCsrRoamInfo roamInfo; |
| 9455 | eHalStatus status; |
| 9456 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
| 9457 | tCsrRoamSession *pSession = NULL; |
| 9458 | tpSirSmeSwitchChannelInd pSwitchChnInd; |
| 9459 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9460 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
krunal soni | 587bf01 | 2014-02-04 12:35:11 -0800 | [diff] [blame] | 9461 | |
| 9462 | |
| 9463 | if (NULL == pSirMsg) |
| 9464 | { smsLog(pMac, LOGE, FL("pSirMsg is NULL")); |
| 9465 | return; |
| 9466 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9467 | switch( pSirMsg->messageType ) |
| 9468 | { |
| 9469 | case eWNI_SME_ASSOC_IND: |
| 9470 | { |
| 9471 | tCsrRoamSession *pSession; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9472 | smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9473 | pAssocInd = (tSirSmeAssocInd *)pSirMsg; |
| 9474 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId ); |
| 9475 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9476 | { |
| 9477 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 9478 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9479 | if(!pSession) |
| 9480 | { |
| 9481 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9482 | return; |
| 9483 | } |
| 9484 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9485 | pRoamInfo = &roamInfo; |
| 9486 | |
| 9487 | // Required for indicating the frames to upper layer |
| 9488 | pRoamInfo->assocReqLength = pAssocInd->assocReqLength; |
| 9489 | pRoamInfo->assocReqPtr = pAssocInd->assocReqPtr; |
| 9490 | |
| 9491 | pRoamInfo->beaconPtr = pAssocInd->beaconPtr; |
| 9492 | pRoamInfo->beaconLength = pAssocInd->beaconLength; |
| 9493 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 9494 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9495 | |
| 9496 | pRoamInfo->staId = (tANI_U8)pAssocInd->staId; |
| 9497 | pRoamInfo->rsnIELen = (tANI_U8)pAssocInd->rsnIE.length; |
| 9498 | pRoamInfo->prsnIE = pAssocInd->rsnIE.rsnIEdata; |
| 9499 | |
| 9500 | pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length; |
| 9501 | pRoamInfo->paddIE = pAssocInd->addIE.addIEdata; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9502 | vos_mem_copy(pRoamInfo->peerMac, pAssocInd->peerMacAddr, |
| 9503 | sizeof(tSirMacAddr)); |
| 9504 | vos_mem_copy(&pRoamInfo->bssid, pAssocInd->bssId, |
| 9505 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9506 | pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta; |
Hardik Kantilal Patel | 1ba630f | 2014-11-21 04:32:05 +0530 | [diff] [blame] | 9507 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 9508 | pRoamInfo->HT40MHzIntoEnabledSta = |
| 9509 | pAssocInd->HT40MHzIntoEnabledSta; |
| 9510 | smsLog(pMac, LOGW, FL("HT40MHzIntoEnabledSta: %d \n"), |
| 9511 | pRoamInfo->HT40MHzIntoEnabledSta); |
| 9512 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9513 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9514 | 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] | 9515 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile)) |
| 9516 | { |
| 9517 | if( CSR_IS_ENC_TYPE_STATIC( pSession->pCurRoamProfile->negotiatedUCEncryptionType )) |
| 9518 | { |
| 9519 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->pCurRoamProfile->negotiatedUCEncryptionType, |
| 9520 | pSession->pConnectBssDesc, |
| 9521 | &(pRoamInfo->peerMac), |
| 9522 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 9523 | pRoamInfo->fAuthRequired = FALSE; |
| 9524 | } |
| 9525 | else |
| 9526 | { |
| 9527 | pRoamInfo->fAuthRequired = TRUE; |
| 9528 | } |
| 9529 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
| 9530 | if (!HAL_STATUS_SUCCESS(status)) |
| 9531 | pRoamInfo->statusCode = eSIR_SME_ASSOC_REFUSED;// Refused due to Mac filtering |
| 9532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9533 | /* Send Association completion message to PE */ |
| 9534 | status = csrSendAssocCnfMsg( pMac, pAssocInd, status );//Sta |
| 9535 | |
| 9536 | /* send a message to CSR itself just to avoid the EAPOL frames going |
| 9537 | * OTA before association response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9538 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 9539 | { |
| 9540 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 9541 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9542 | else if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) && (pRoamInfo->statusCode != eSIR_SME_ASSOC_REFUSED)) |
| 9543 | { |
| 9544 | pRoamInfo->fReassocReq = pAssocInd->reassocReq; |
| 9545 | //status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 9546 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 9547 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9548 | } |
| 9549 | } |
| 9550 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9551 | case eWNI_SME_DISASSOC_IND: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9552 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9553 | // Check if AP dis-associated us because of MIC failure. If so, |
| 9554 | // then we need to take action immediately and not wait till the |
| 9555 | // the WmStatusChange requests is pushed and processed |
| 9556 | tSmeCmd *pCommand; |
| 9557 | |
| 9558 | pDisassocInd = (tSirSmeDisassocInd *)pSirMsg; |
| 9559 | status = csrRoamGetSessionIdFromBSSID( pMac, |
| 9560 | (tCsrBssid *)pDisassocInd->bssId, &sessionId ); |
| 9561 | if( HAL_STATUS_SUCCESS( status ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9562 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9563 | smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC" |
| 9564 | " for session %d "), sessionId); |
| 9565 | smsLog( pMac, LOGE, FL("DISASSOCIATION from peer =" |
| 9566 | MAC_ADDRESS_STR " " |
| 9567 | " reason = %d status = %d "), |
| 9568 | MAC_ADDR_ARRAY(pDisassocInd->peerMacAddr), |
| 9569 | pDisassocInd->reasonCode, |
| 9570 | pDisassocInd->statusCode); |
| 9571 | // If we are in neighbor preauth done state then on receiving |
| 9572 | // disassoc or deauth we dont roam instead we just disassoc |
| 9573 | // from current ap and then go to disconnected state |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9574 | // This happens for ESE and 11r FT connections ONLY. |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9575 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9576 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9577 | { |
| 9578 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9579 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9580 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9581 | #ifdef FEATURE_WLAN_ESE |
| 9582 | if (csrRoamIsESEAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9583 | { |
| 9584 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9585 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9586 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9587 | #ifdef FEATURE_WLAN_LFR |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9588 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9589 | { |
| 9590 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9591 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9592 | #endif |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9593 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9594 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9595 | if (!pSession) |
| 9596 | { |
| 9597 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9598 | return; |
| 9599 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9600 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9601 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 9602 | { |
| 9603 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 9604 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9605 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9606 | 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] | 9607 | #endif |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9608 | csrRoamLinkDown(pMac, sessionId); |
| 9609 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg ); |
| 9610 | if (CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 9611 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9612 | pRoamInfo = &roamInfo; |
| 9613 | pRoamInfo->statusCode = pDisassocInd->statusCode; |
| 9614 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9615 | pRoamInfo->staId = (tANI_U8)pDisassocInd->staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9616 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9617 | vos_mem_copy(pRoamInfo->peerMac, pDisassocInd->peerMacAddr, |
| 9618 | sizeof(tSirMacAddr)); |
| 9619 | vos_mem_copy(&pRoamInfo->bssid, pDisassocInd->bssId, |
| 9620 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9621 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9622 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 9623 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DISASSOC_IND); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9624 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9625 | /* |
| 9626 | * STA/P2P client got disassociated so remove any pending deauth |
| 9627 | * commands in sme pending list |
| 9628 | */ |
Kaushik, Sushant | 488df38 | 2014-03-05 11:43:47 +0530 | [diff] [blame] | 9629 | pCommand = csrGetCommandBuffer(pMac); |
| 9630 | if (NULL == pCommand) |
| 9631 | { |
| 9632 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 9633 | status = eHAL_STATUS_RESOURCES; |
| 9634 | return; |
| 9635 | } |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9636 | pCommand->command = eSmeCommandRoam; |
| 9637 | pCommand->sessionId = (tANI_U8)sessionId; |
| 9638 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 9639 | vos_mem_copy(pCommand->u.roamCmd.peerMac, |
| 9640 | pDisassocInd->peerMacAddr, |
| 9641 | sizeof(tSirMacAddr)); |
| 9642 | csrRoamRemoveDuplicateCommand(pMac, sessionId, pCommand, eCsrForcedDeauthSta); |
| 9643 | csrReleaseCommand( pMac, pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9644 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9645 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9646 | } |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 9647 | else |
| 9648 | { |
| 9649 | smsLog(pMac, LOGE, FL(" Session Id not found for BSSID " MAC_ADDRESS_STR), |
| 9650 | MAC_ADDR_ARRAY(pDisassocInd->bssId)); |
| 9651 | } |
Kiet Lam | 82004c6 | 2013-11-11 13:24:28 +0530 | [diff] [blame] | 9652 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9653 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9654 | case eWNI_SME_DEAUTH_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9655 | smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9656 | pDeauthInd = (tpSirSmeDeauthInd)pSirMsg; |
| 9657 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDeauthInd->bssId, &sessionId ); |
| 9658 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9659 | { |
| 9660 | // If we are in neighbor preauth done state then on receiving |
| 9661 | // disassoc or deauth we dont roam instead we just disassoc |
| 9662 | // from current ap and then go to disconnected state |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9663 | // This happens for ESE and 11r FT connections ONLY. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9664 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9665 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9666 | { |
| 9667 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9668 | } |
| 9669 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 9670 | #ifdef FEATURE_WLAN_ESE |
| 9671 | if (csrRoamIsESEAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9672 | { |
| 9673 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9674 | } |
| 9675 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9676 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 9677 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9678 | { |
| 9679 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9680 | } |
| 9681 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9682 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 9683 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9684 | if(!pSession) |
| 9685 | { |
| 9686 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9687 | return; |
| 9688 | } |
| 9689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9690 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 9691 | { |
| 9692 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 9693 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9694 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 9695 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 9696 | #endif |
| 9697 | csrRoamLinkDown(pMac, sessionId); |
| 9698 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9699 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 9700 | { |
| 9701 | |
| 9702 | pRoamInfo = &roamInfo; |
| 9703 | |
| 9704 | pRoamInfo->statusCode = pDeauthInd->statusCode; |
| 9705 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9706 | |
| 9707 | pRoamInfo->staId = (tANI_U8)pDeauthInd->staId; |
| 9708 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9709 | vos_mem_copy(pRoamInfo->peerMac, pDeauthInd->peerMacAddr, |
| 9710 | sizeof(tSirMacAddr)); |
| 9711 | vos_mem_copy(&pRoamInfo->bssid, pDeauthInd->bssId, |
| 9712 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9713 | |
| 9714 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND); |
| 9715 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9716 | } |
| 9717 | break; |
| 9718 | |
| 9719 | 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] | 9720 | smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9721 | pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg; |
| 9722 | //Update with the new channel id. |
| 9723 | //The channel id is hidden in the statusCode. |
| 9724 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pSwitchChnInd->bssId, &sessionId ); |
| 9725 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9726 | { |
| 9727 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9728 | if(!pSession) |
| 9729 | { |
| 9730 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9731 | return; |
| 9732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9733 | pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId; |
| 9734 | if(pSession->pConnectBssDesc) |
| 9735 | { |
| 9736 | pSession->pConnectBssDesc->channelId = (tANI_U8)pSwitchChnInd->newChannelId; |
| 9737 | } |
| 9738 | } |
| 9739 | break; |
| 9740 | |
| 9741 | case eWNI_SME_DEAUTH_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9742 | smsLog( pMac, LOGW, FL("eWNI_SME_DEAUTH_RSP from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9743 | { |
| 9744 | tSirSmeDeauthRsp* pDeauthRsp = (tSirSmeDeauthRsp *)pSirMsg; |
| 9745 | sessionId = pDeauthRsp->sessionId; |
| 9746 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 9747 | { |
| 9748 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9749 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 9750 | { |
| 9751 | pRoamInfo = &roamInfo; |
| 9752 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9753 | vos_mem_copy(pRoamInfo->peerMac, pDeauthRsp->peerMacAddr, |
| 9754 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9755 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 9756 | pRoamInfo->statusCode = pDeauthRsp->statusCode; |
| 9757 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 9758 | } |
| 9759 | } |
| 9760 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9761 | break; |
| 9762 | |
| 9763 | case eWNI_SME_DISASSOC_RSP: |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9764 | /* 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] | 9765 | smsLog( pMac, LOGW, FL("eWNI_SME_DISASSOC_RSP from SME ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9766 | { |
| 9767 | tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *)pSirMsg; |
| 9768 | sessionId = pDisassocRsp->sessionId; |
| 9769 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 9770 | { |
| 9771 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9772 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 9773 | { |
| 9774 | pRoamInfo = &roamInfo; |
| 9775 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9776 | vos_mem_copy(pRoamInfo->peerMac, pDisassocRsp->peerMacAddr, |
| 9777 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9778 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 9779 | pRoamInfo->statusCode = pDisassocRsp->statusCode; |
| 9780 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 9781 | } |
| 9782 | } |
| 9783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9784 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9785 | case eWNI_SME_MIC_FAILURE_IND: |
| 9786 | { |
| 9787 | tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg; |
| 9788 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 9789 | eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
Leo Chang | 9b01ad9 | 2013-09-12 17:26:56 -0700 | [diff] [blame] | 9790 | |
| 9791 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId ); |
| 9792 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9793 | { |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 9794 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Leo Chang | 9b01ad9 | 2013-09-12 17:26:56 -0700 | [diff] [blame] | 9795 | roamInfo.u.pMICFailureInfo = &pMicInd->info; |
| 9796 | pRoamInfo = &roamInfo; |
| 9797 | if(pMicInd->info.multicast) |
| 9798 | { |
| 9799 | result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP; |
| 9800 | } |
| 9801 | else |
| 9802 | { |
| 9803 | result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 9804 | } |
| 9805 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_MIC_ERROR_IND, result); |
| 9806 | } |
| 9807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9808 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9809 | { |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9810 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9811 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9812 | if(!pSession) |
| 9813 | { |
| 9814 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9815 | return; |
| 9816 | } |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9817 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9818 | vos_mem_set(&secEvent, sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9819 | secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR; |
| 9820 | secEvent.encryptionModeMulticast = |
| 9821 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9822 | secEvent.encryptionModeUnicast = |
| 9823 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9824 | secEvent.authMode = |
| 9825 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9826 | vos_mem_copy(secEvent.bssid, |
| 9827 | pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9828 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 9829 | } |
| 9830 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9831 | } |
| 9832 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9833 | case eWNI_SME_WPS_PBC_PROBE_REQ_IND: |
| 9834 | { |
| 9835 | tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg; |
| 9836 | tCsrRoamInfo roamInfo; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9837 | smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9838 | |
| 9839 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId ); |
| 9840 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9841 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9842 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9843 | roamInfo.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq; |
| 9844 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, |
| 9845 | eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 9846 | } |
| 9847 | } |
| 9848 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9849 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9850 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 9851 | pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg; |
| 9852 | switch( pStatusChangeMsg->statusChangeCode ) |
| 9853 | { |
| 9854 | case eSIR_SME_IBSS_ACTIVE: |
| 9855 | sessionId = csrFindIbssSession( pMac ); |
| 9856 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9857 | { |
| 9858 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9859 | if(!pSession) |
| 9860 | { |
| 9861 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9862 | return; |
| 9863 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9864 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED; |
| 9865 | if(pSession->pConnectBssDesc) |
| 9866 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9867 | vos_mem_copy(&roamInfo.bssid, |
| 9868 | pSession->pConnectBssDesc->bssId, |
| 9869 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9870 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 9871 | pRoamInfo = &roamInfo; |
| 9872 | } |
| 9873 | else |
| 9874 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9875 | 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] | 9876 | } |
| 9877 | result = eCSR_ROAM_RESULT_IBSS_CONNECT; |
| 9878 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9879 | } |
| 9880 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9881 | case eSIR_SME_IBSS_INACTIVE: |
| 9882 | sessionId = csrFindIbssSession( pMac ); |
| 9883 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9884 | { |
| 9885 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9886 | if(!pSession) |
| 9887 | { |
| 9888 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9889 | return; |
| 9890 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9891 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 9892 | result = eCSR_ROAM_RESULT_IBSS_INACTIVE; |
| 9893 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9894 | } |
| 9895 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9896 | case eSIR_SME_JOINED_NEW_BSS: // IBSS coalescing. |
| 9897 | sessionId = csrFindIbssSession( pMac ); |
| 9898 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9899 | { |
| 9900 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9901 | if(!pSession) |
| 9902 | { |
| 9903 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9904 | return; |
| 9905 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9906 | // update the connection state information |
| 9907 | pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9908 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9909 | { |
| 9910 | vos_log_ibss_pkt_type *pIbssLog; |
| 9911 | tANI_U32 bi; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9912 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9913 | if(pIbssLog) |
| 9914 | { |
| 9915 | pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING; |
| 9916 | if(pNewBss) |
| 9917 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9918 | vos_mem_copy(pIbssLog->bssid, pNewBss->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9919 | if(pNewBss->ssId.length) |
| 9920 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9921 | vos_mem_copy(pIbssLog->ssid, pNewBss->ssId.ssId, |
| 9922 | pNewBss->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9923 | } |
| 9924 | pIbssLog->operatingChannel = pNewBss->channelNumber; |
| 9925 | } |
| 9926 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 9927 | { |
| 9928 | //***U8 is not enough for beacon interval |
| 9929 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 9930 | } |
| 9931 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9932 | } |
| 9933 | } |
| 9934 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9935 | csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss ); |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9936 | |
| 9937 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 9938 | pSession->connectedProfile.EncryptionType )) |
| 9939 | { |
| 9940 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 9941 | pSession->connectedProfile.EncryptionType, |
| 9942 | pSession->pConnectBssDesc, |
| 9943 | &Broadcastaddr, |
| 9944 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); |
| 9945 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9946 | result = eCSR_ROAM_RESULT_IBSS_COALESCED; |
| 9947 | roamStatus = eCSR_ROAM_IBSS_IND; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9948 | vos_mem_copy(&roamInfo.bssid, &pNewBss->bssId, |
| 9949 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9950 | pRoamInfo = &roamInfo; |
| 9951 | //This BSSID is th ereal BSSID, let's save it |
| 9952 | if(pSession->pConnectBssDesc) |
| 9953 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9954 | vos_mem_copy(pSession->pConnectBssDesc->bssId, |
| 9955 | &pNewBss->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9956 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9957 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9958 | smsLog(pMac, LOGW, "CSR: eSIR_SME_JOINED_NEW_BSS received from PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9959 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9960 | // detection by LIM that the capabilities of the associated AP have changed. |
| 9961 | case eSIR_SME_AP_CAPS_CHANGED: |
| 9962 | pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9963 | smsLog(pMac, LOGW, "CSR handling eSIR_SME_AP_CAPS_CHANGED"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9964 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pApNewCaps->bssId, &sessionId ); |
| 9965 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9966 | { |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9967 | if ((eCSR_ROAMING_STATE_JOINED == pMac->roam.curState[sessionId]) && |
| 9968 | ((eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9969 | (eCSR_ROAM_SUBSTATE_NONE == pMac->roam.curSubState[sessionId]) || |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9970 | (eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
| 9971 | (eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC == pMac->roam.curSubState[sessionId])) |
| 9972 | ) |
| 9973 | { |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9974 | smsLog(pMac, LOGW, "Calling csrRoamDisconnectInternal"); |
| 9975 | csrRoamDisconnectInternal(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9976 | } |
| 9977 | else |
| 9978 | { |
| 9979 | smsLog(pMac, LOGW, |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 9980 | FL("Skipping csrScanForCapabilityChange as " |
| 9981 | "CSR is in state %s and sub-state %s"), |
| 9982 | macTraceGetcsrRoamState( |
| 9983 | pMac->roam.curState[sessionId]), |
| 9984 | macTraceGetcsrRoamSubState( |
| 9985 | pMac->roam.curSubState[sessionId])); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9986 | /* We ignore the caps change event if CSR is not in full connected state. |
| 9987 | * Send one event to PE to reset limSentCapsChangeNtf |
| 9988 | * Once limSentCapsChangeNtf set 0, lim can send sub sequent CAPS change event |
| 9989 | * otherwise lim cannot send any CAPS change events to SME */ |
| 9990 | csrSendResetApCapsChanged(pMac, &pApNewCaps->bssId); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9991 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9992 | } |
| 9993 | break; |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9994 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9995 | default: |
| 9996 | roamStatus = eCSR_ROAM_FAILED; |
| 9997 | result = eCSR_ROAM_RESULT_NONE; |
| 9998 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9999 | } // end switch on statusChangeCode |
| 10000 | if(eCSR_ROAM_RESULT_NONE != result) |
| 10001 | { |
| 10002 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result); |
| 10003 | } |
| 10004 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10005 | case eWNI_SME_IBSS_NEW_PEER_IND: |
| 10006 | pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10007 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10008 | { |
| 10009 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10010 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 10011 | if(pIbssLog) |
| 10012 | { |
| 10013 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10014 | vos_mem_copy(pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10015 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 10016 | } |
| 10017 | } |
| 10018 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10019 | sessionId = csrFindIbssSession( pMac ); |
| 10020 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 10021 | { |
| 10022 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10023 | |
| 10024 | if(!pSession) |
| 10025 | { |
| 10026 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10027 | return; |
| 10028 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10029 | // Issue the set Context request to LIM to establish the Unicast STA context for the new peer... |
| 10030 | if(pSession->pConnectBssDesc) |
| 10031 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10032 | vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, |
| 10033 | sizeof(tCsrBssid)); |
| 10034 | vos_mem_copy(&roamInfo.bssid, pSession->pConnectBssDesc->bssId, |
| 10035 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10036 | if(pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd)) |
| 10037 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10038 | roamInfo.pbFrames = vos_mem_malloc((pIbssPeerInd->mesgLen |
| 10039 | - sizeof(tSmeIbssPeerInd))); |
| 10040 | if ( NULL == roamInfo.pbFrames ) |
| 10041 | status = eHAL_STATUS_FAILURE; |
| 10042 | else |
| 10043 | status = eHAL_STATUS_SUCCESS; |
| 10044 | if (HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10045 | { |
| 10046 | roamInfo.nBeaconLength = (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd)); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10047 | vos_mem_copy(roamInfo.pbFrames, |
| 10048 | ((tANI_U8 *)pIbssPeerInd) + sizeof(tSmeIbssPeerInd), |
| 10049 | roamInfo.nBeaconLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10050 | } |
| 10051 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 10052 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 10053 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10054 | roamInfo.pBssDesc = vos_mem_malloc(pSession->pConnectBssDesc->length); |
| 10055 | if ( NULL == roamInfo.pBssDesc ) |
| 10056 | status = eHAL_STATUS_FAILURE; |
| 10057 | else |
| 10058 | status = eHAL_STATUS_SUCCESS; |
| 10059 | if (HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10060 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10061 | vos_mem_copy(roamInfo.pBssDesc, |
| 10062 | pSession->pConnectBssDesc, |
| 10063 | pSession->pConnectBssDesc->length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10064 | } |
| 10065 | if(HAL_STATUS_SUCCESS(status)) |
| 10066 | { |
| 10067 | pRoamInfo = &roamInfo; |
| 10068 | } |
| 10069 | else |
| 10070 | { |
| 10071 | if(roamInfo.pbFrames) |
| 10072 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10073 | vos_mem_free(roamInfo.pbFrames); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10074 | } |
| 10075 | if(roamInfo.pBssDesc) |
| 10076 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10077 | vos_mem_free(roamInfo.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10078 | } |
| 10079 | } |
| 10080 | } |
| 10081 | else |
| 10082 | { |
| 10083 | pRoamInfo = &roamInfo; |
| 10084 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 10085 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 10086 | pSession->connectedProfile.EncryptionType )) |
| 10087 | { |
| 10088 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 10089 | pSession->connectedProfile.EncryptionType, |
| 10090 | pSession->pConnectBssDesc, |
| 10091 | &(pIbssPeerInd->peerAddr), |
| 10092 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 10093 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10094 | } |
| 10095 | else |
| 10096 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10097 | 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] | 10098 | } |
| 10099 | //send up the sec type for the new peer |
| 10100 | if (pRoamInfo) |
| 10101 | { |
| 10102 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 10103 | } |
| 10104 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 10105 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
| 10106 | if(pRoamInfo) |
| 10107 | { |
| 10108 | if(roamInfo.pbFrames) |
| 10109 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10110 | vos_mem_free(roamInfo.pbFrames); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10111 | } |
| 10112 | if(roamInfo.pBssDesc) |
| 10113 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10114 | vos_mem_free(roamInfo.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10115 | } |
| 10116 | } |
| 10117 | } |
| 10118 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10119 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 10120 | pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg; |
| 10121 | sessionId = csrFindIbssSession( pMac ); |
| 10122 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 10123 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10124 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10125 | { |
| 10126 | vos_log_ibss_pkt_type *pIbssLog; |
| 10127 | |
| 10128 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 10129 | if(pIbssLog) |
| 10130 | { |
| 10131 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE; |
| 10132 | if(pIbssPeerInd) |
| 10133 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10134 | vos_mem_copy(pIbssLog->peerMacAddr, |
| 10135 | &pIbssPeerInd->peerAddr, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10136 | } |
| 10137 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 10138 | } |
| 10139 | } |
| 10140 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10141 | smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10142 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 10143 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 10144 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10145 | vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, |
| 10146 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10147 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 10148 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 10149 | } |
| 10150 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10151 | case eWNI_SME_SETCONTEXT_RSP: |
| 10152 | { |
| 10153 | tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg; |
| 10154 | tListElem *pEntry; |
| 10155 | tSmeCmd *pCommand; |
| 10156 | |
| 10157 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 10158 | if ( pEntry ) |
| 10159 | { |
| 10160 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 10161 | if ( eSmeCommandSetKey == pCommand->command ) |
| 10162 | { |
Sandeep Puligilla | 9f38474 | 2014-04-11 02:27:04 +0530 | [diff] [blame] | 10163 | sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10164 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10165 | |
| 10166 | if(!pSession) |
| 10167 | { |
| 10168 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10169 | return; |
| 10170 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10171 | |
| 10172 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10173 | if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType) |
| 10174 | { |
| 10175 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10176 | vos_mem_set(&setKeyEvent, |
| 10177 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10178 | if( pRsp->peerMacAddr[0] & 0x01 ) |
| 10179 | { |
| 10180 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 10181 | } |
| 10182 | else |
| 10183 | { |
| 10184 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 10185 | } |
| 10186 | setKeyEvent.encryptionModeMulticast = |
| 10187 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 10188 | setKeyEvent.encryptionModeUnicast = |
| 10189 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10190 | vos_mem_copy(setKeyEvent.bssid, |
| 10191 | pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10192 | setKeyEvent.authMode = |
| 10193 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 10194 | if( eSIR_SME_SUCCESS != pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10195 | { |
| 10196 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 10197 | } |
| 10198 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 10199 | } |
| 10200 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10201 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 10202 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10203 | csrRoamStopWaitForKeyTimer( pMac ); |
| 10204 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10205 | //We are done with authentication, whethere succeed or not |
| 10206 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10207 | //We do it here because this linkup function is not called after association |
| 10208 | //when a key needs to be set. |
| 10209 | if( csrIsConnStateConnectedInfra(pMac, sessionId) ) |
| 10210 | { |
| 10211 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 10212 | } |
| 10213 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 10214 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10215 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10216 | vos_mem_copy(&roamInfo.peerMac, |
| 10217 | &pRsp->peerMacAddr, sizeof(tCsrBssid)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10218 | //Make sure we install the GTK before indicating to HDD as authenticated |
| 10219 | //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] | 10220 | if ( vos_mem_compare( &Broadcastaddr, pRsp->peerMacAddr, |
| 10221 | sizeof(tSirMacAddr) ) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10222 | { |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 10223 | #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE |
| 10224 | if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE) |
| 10225 | { |
| 10226 | tpSirSetActiveModeSetBncFilterReq pMsg; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10227 | pMsg = vos_mem_malloc(sizeof(tSirSetActiveModeSetBncFilterReq)); |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 10228 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_BCN_FILTER_REQ); |
| 10229 | pMsg->length = pal_cpu_to_be16(sizeof( tANI_U8)); |
| 10230 | pMsg->seesionId = sessionId; |
| 10231 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 10232 | } |
| 10233 | #endif |
Sandeep Puligilla | 9f38474 | 2014-04-11 02:27:04 +0530 | [diff] [blame] | 10234 | /* OBSS SCAN Indication will be sent to Firmware to start OBSS Scan */ |
Sandeep Puligilla | 332ea91 | 2014-02-04 00:16:24 +0530 | [diff] [blame] | 10235 | if( CSR_IS_CHANNEL_24GHZ(pSession->connectedProfile.operationChannel) |
Hardik Kantilal Patel | db19a09 | 2014-11-21 17:01:42 +0530 | [diff] [blame] | 10236 | && IS_HT40_OBSS_SCAN_FEATURE_ENABLE |
| 10237 | && (VOS_P2P_GO_MODE != |
| 10238 | pSession->pCurRoamProfile->csrPersona |
| 10239 | && VOS_STA_SAP_MODE != |
| 10240 | pSession->pCurRoamProfile->csrPersona)) |
Sandeep Puligilla | 332ea91 | 2014-02-04 00:16:24 +0530 | [diff] [blame] | 10241 | { |
| 10242 | tpSirSmeHT40OBSSScanInd pMsg; |
| 10243 | pMsg = vos_mem_malloc(sizeof(tSirSmeHT40OBSSScanInd)); |
| 10244 | pMsg->messageType = |
| 10245 | pal_cpu_to_be16((tANI_U16)eWNI_SME_HT40_OBSS_SCAN_IND); |
| 10246 | pMsg->length = |
Sandeep Puligilla | 9f38474 | 2014-04-11 02:27:04 +0530 | [diff] [blame] | 10247 | pal_cpu_to_be16(sizeof( tSirSmeHT40OBSSScanInd)); |
| 10248 | vos_mem_copy(pMsg->peerMacAddr, |
| 10249 | pSession->connectedProfile.bssid, |
| 10250 | sizeof(tSirMacAddr)); |
Sandeep Puligilla | 332ea91 | 2014-02-04 00:16:24 +0530 | [diff] [blame] | 10251 | status = palSendMBMessage(pMac->hHdd, |
| 10252 | pMsg ); |
| 10253 | } |
| 10254 | result = eCSR_ROAM_RESULT_AUTHENTICATED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10255 | } |
| 10256 | else |
| 10257 | { |
| 10258 | result = eCSR_ROAM_RESULT_NONE; |
| 10259 | } |
Sandeep Puligilla | 9f38474 | 2014-04-11 02:27:04 +0530 | [diff] [blame] | 10260 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10261 | } |
| 10262 | else |
| 10263 | { |
| 10264 | result = eCSR_ROAM_RESULT_FAILURE; |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 10265 | smsLog(pMac, LOGE, "CSR: Roam Completion setkey " |
| 10266 | "command failed(%d) PeerMac "MAC_ADDRESS_STR, |
| 10267 | pRsp->statusCode, MAC_ADDR_ARRAY(pRsp->peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10268 | } |
| 10269 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 10270 | eCSR_ROAM_SET_KEY_COMPLETE, result); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10271 | // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS |
| 10272 | // can go ahead and initiate the TSPEC if any are pending |
| 10273 | 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] | 10274 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10275 | //Send Adjacent AP repot to new AP. |
| 10276 | if (result == eCSR_ROAM_RESULT_AUTHENTICATED && |
| 10277 | pSession->isPrevApInfoValid && |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10278 | pSession->connectedProfile.isESEAssoc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10279 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10280 | #ifdef FEATURE_WLAN_ESE_UPLOAD |
| 10281 | csrSendEseAdjacentApRepInd(pMac, pSession); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 10282 | #else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10283 | csrEseSendAdjacentApRepMsg(pMac, pSession); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10284 | #endif |
| 10285 | pSession->isPrevApInfoValid = FALSE; |
| 10286 | } |
| 10287 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10288 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10289 | { |
| 10290 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 10291 | } |
| 10292 | } |
| 10293 | else |
| 10294 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10295 | 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] | 10296 | } |
| 10297 | } |
| 10298 | else |
| 10299 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10300 | smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10301 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10302 | smeProcessPendingQueue( pMac ); |
| 10303 | } |
| 10304 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10305 | case eWNI_SME_REMOVEKEY_RSP: |
| 10306 | { |
| 10307 | tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg; |
| 10308 | tListElem *pEntry; |
| 10309 | tSmeCmd *pCommand; |
| 10310 | |
| 10311 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 10312 | if ( pEntry ) |
| 10313 | { |
| 10314 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 10315 | if ( eSmeCommandRemoveKey == pCommand->command ) |
| 10316 | { |
| 10317 | sessionId = pCommand->sessionId; |
| 10318 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10319 | |
| 10320 | if(!pSession) |
| 10321 | { |
| 10322 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10323 | return; |
| 10324 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10325 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10326 | { |
| 10327 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10328 | vos_mem_set(&removeKeyEvent, |
| 10329 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10330 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
| 10331 | removeKeyEvent.encryptionModeMulticast = |
| 10332 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 10333 | removeKeyEvent.encryptionModeUnicast = |
| 10334 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10335 | vos_mem_copy( removeKeyEvent.bssid, |
| 10336 | pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10337 | removeKeyEvent.authMode = |
| 10338 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 10339 | if( eSIR_SME_SUCCESS != pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10340 | { |
| 10341 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 10342 | } |
| 10343 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 10344 | } |
| 10345 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 10346 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10347 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10348 | vos_mem_copy(&roamInfo.peerMac, &pRsp->peerMacAddr, |
| 10349 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10350 | result = eCSR_ROAM_RESULT_NONE; |
| 10351 | pRoamInfo = &roamInfo; |
| 10352 | } |
| 10353 | else |
| 10354 | { |
| 10355 | result = eCSR_ROAM_RESULT_FAILURE; |
| 10356 | } |
| 10357 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 10358 | eCSR_ROAM_REMOVE_KEY_COMPLETE, result); |
| 10359 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10360 | { |
| 10361 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 10362 | } |
| 10363 | } |
| 10364 | else |
| 10365 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10366 | 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] | 10367 | } |
| 10368 | } |
| 10369 | else |
| 10370 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10371 | smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10372 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10373 | smeProcessPendingQueue( pMac ); |
| 10374 | } |
| 10375 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10376 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10377 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10378 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 10379 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10380 | #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] | 10381 | case eWNI_SME_GET_ROAM_RSSI_RSP: |
| 10382 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
| 10383 | csrRoamRssiRspProcessor( pMac, pSirMsg ); |
| 10384 | break; |
| 10385 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10386 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 10387 | case eWNI_SME_GET_TSM_STATS_RSP: |
| 10388 | smsLog( pMac, LOG2, FL("TSM Stats rsp from PE")); |
| 10389 | csrTsmStatsRspProcessor( pMac, pSirMsg ); |
| 10390 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 10391 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10392 | case eWNI_SME_GET_RSSI_REQ: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10393 | smsLog( pMac, LOG2, FL("GetRssiReq from self")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10394 | csrUpdateRssi( pMac, pSirMsg ); |
| 10395 | break; |
| 10396 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 10397 | case eWNI_SME_GET_SNR_REQ: |
| 10398 | smsLog( pMac, LOG2, FL("GetSnrReq from self")); |
| 10399 | csrUpdateSnr(pMac, pSirMsg); |
| 10400 | break; |
| 10401 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10402 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10403 | case eWNI_SME_FT_PRE_AUTH_RSP: |
| 10404 | csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg ); |
| 10405 | break; |
| 10406 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10407 | case eWNI_SME_MAX_ASSOC_EXCEEDED: |
| 10408 | pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10409 | 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] | 10410 | sessionId = pSmeMaxAssocInd->sessionId; |
| 10411 | roamInfo.sessionId = sessionId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10412 | vos_mem_copy(&roamInfo.peerMac, pSmeMaxAssocInd->peerMac, |
| 10413 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10414 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 10415 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 10416 | break; |
| 10417 | |
| 10418 | case eWNI_SME_BTAMP_LOG_LINK_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10419 | 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] | 10420 | btampEstablishLogLinkHdlr( pSirMsg ); |
| 10421 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10422 | case eWNI_SME_RSSI_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10423 | smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10424 | csrRoamRssiIndHdlr( pMac, pSirMsg ); |
| 10425 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 10426 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 10427 | case eWNI_SME_CANDIDATE_FOUND_IND: |
| 10428 | smsLog( pMac, LOG2, FL("Candidate found indication from PE")); |
| 10429 | csrNeighborRoamCandidateFoundIndHdlr( pMac, pSirMsg ); |
| 10430 | break; |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 10431 | case eWNI_SME_HANDOFF_REQ: |
| 10432 | smsLog( pMac, LOG2, FL("Handoff Req from self")); |
| 10433 | csrNeighborRoamHandoffReqHdlr( pMac, pSirMsg ); |
| 10434 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 10435 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10436 | |
| 10437 | default: |
| 10438 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10439 | } // end switch on message type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10440 | } |
| 10441 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10442 | void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, |
| 10443 | tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult) |
| 10444 | { |
| 10445 | if(pSession) |
| 10446 | { |
| 10447 | if(pSession->bRefAssocStartCnt) |
| 10448 | { |
| 10449 | pSession->bRefAssocStartCnt--; |
| 10450 | VOS_ASSERT( pSession->bRefAssocStartCnt == 0); |
| 10451 | //Need to call association_completion because there is an assoc_start pending. |
| 10452 | csrRoamCallCallback(pMac, pSession->sessionId, NULL, roamId, |
| 10453 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 10454 | eCSR_ROAM_RESULT_FAILURE); |
| 10455 | } |
| 10456 | csrRoamCallCallback(pMac, pSession->sessionId, pRoamInfo, roamId, eCSR_ROAM_ROAMING_COMPLETION, roamResult); |
| 10457 | } |
| 10458 | else |
| 10459 | { |
| 10460 | smsLog(pMac, LOGW, FL(" pSession is NULL")); |
| 10461 | } |
| 10462 | } |
| 10463 | |
| 10464 | |
| 10465 | eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason) |
| 10466 | { |
| 10467 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10468 | if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && |
| 10469 | (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming)) |
| 10470 | { |
| 10471 | status = csrScanRequestLostLink1( pMac, sessionId ); |
| 10472 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10473 | return(status); |
| 10474 | } |
| 10475 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10476 | //return a boolean to indicate whether roaming completed or continue. |
| 10477 | tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 10478 | tANI_BOOLEAN fForce, eCsrRoamResult roamResult) |
| 10479 | { |
| 10480 | tANI_BOOLEAN fCompleted = eANI_BOOLEAN_TRUE; |
| 10481 | tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND); |
| 10482 | tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 10483 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10484 | if(!pSession) |
| 10485 | { |
| 10486 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10487 | return eANI_BOOLEAN_FALSE; |
| 10488 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10489 | //Check whether time is up |
| 10490 | if(pSession->fCancelRoaming || fForce || |
| 10491 | ((curTime - pSession->roamingStartTime) > roamTime) || |
| 10492 | eCsrReassocRoaming == pSession->roamingReason || |
| 10493 | eCsrDynamicRoaming == pSession->roamingReason) |
| 10494 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10495 | smsLog(pMac, LOGW, FL(" indicates roaming completion")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10496 | if(pSession->fCancelRoaming && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason)) |
| 10497 | { |
| 10498 | //roaming is cancelled, tell HDD to indicate disconnect |
| 10499 | //Because LIM overload deauth_ind for both deauth frame and missed beacon |
| 10500 | //we need to use this logic to detinguish it. For missed beacon, LIM set reason |
| 10501 | //to be eSIR_BEACON_MISSED |
| 10502 | if(eSIR_BEACON_MISSED == pSession->roamingStatusCode) |
| 10503 | { |
| 10504 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 10505 | } |
| 10506 | else if(eCsrLostlinkRoamingDisassoc == pSession->roamingReason) |
| 10507 | { |
| 10508 | roamResult = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 10509 | } |
| 10510 | else if(eCsrLostlinkRoamingDeauth == pSession->roamingReason) |
| 10511 | { |
| 10512 | roamResult = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 10513 | } |
| 10514 | else |
| 10515 | { |
| 10516 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 10517 | } |
| 10518 | } |
| 10519 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 10520 | pSession->roamingReason = eCsrNotRoaming; |
| 10521 | } |
| 10522 | else |
| 10523 | { |
| 10524 | pSession->roamResult = roamResult; |
| 10525 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoamingTimer(pMac, sessionId, PAL_TIMER_TO_SEC_UNIT))) |
| 10526 | { |
| 10527 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 10528 | pSession->roamingReason = eCsrNotRoaming; |
| 10529 | } |
| 10530 | else |
| 10531 | { |
| 10532 | fCompleted = eANI_BOOLEAN_FALSE; |
| 10533 | } |
| 10534 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10535 | return(fCompleted); |
| 10536 | } |
| 10537 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10538 | void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10539 | { |
| 10540 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10541 | |
| 10542 | if(!pSession) |
| 10543 | { |
| 10544 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10545 | return; |
| 10546 | } |
| 10547 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10548 | if(CSR_IS_ROAMING(pSession)) |
| 10549 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10550 | smsLog(pMac, LOGW, " Cancelling roaming"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10551 | pSession->fCancelRoaming = eANI_BOOLEAN_TRUE; |
| 10552 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 10553 | { |
| 10554 | //No need to do anything in here because the handler takes care of it |
| 10555 | } |
| 10556 | else |
| 10557 | { |
| 10558 | eCsrRoamResult roamResult = CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason) ? |
| 10559 | eCSR_ROAM_RESULT_LOSTLINK : eCSR_ROAM_RESULT_NONE; |
| 10560 | //Roaming is stopped after here |
| 10561 | csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_TRUE, roamResult); |
| 10562 | //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] | 10563 | csrScanAbortMacScan(pMac, sessionId, eCSR_SCAN_ABORT_DEFAULT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10564 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 10565 | } |
| 10566 | } |
| 10567 | } |
| 10568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10569 | void csrRoamRoamingTimerHandler(void *pv) |
| 10570 | { |
| 10571 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 10572 | tpAniSirGlobal pMac = pInfo->pMac; |
| 10573 | tANI_U32 sessionId = pInfo->sessionId; |
| 10574 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10575 | |
| 10576 | if(!pSession) |
| 10577 | { |
| 10578 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10579 | return; |
| 10580 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10581 | |
| 10582 | if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) |
| 10583 | { |
| 10584 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoaming(pMac, sessionId, pSession->roamingReason))) |
| 10585 | { |
| 10586 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, pSession->roamResult); |
| 10587 | pSession->roamingReason = eCsrNotRoaming; |
| 10588 | } |
| 10589 | } |
| 10590 | } |
| 10591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10592 | eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 10593 | { |
| 10594 | eHalStatus status; |
| 10595 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10596 | |
| 10597 | if(!pSession) |
| 10598 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10599 | smsLog(pMac, LOGE, FL(" session %d not found"), sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10600 | return eHAL_STATUS_FAILURE; |
| 10601 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10602 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10603 | smsLog(pMac, LOG1, " csrScanStartRoamingTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10604 | pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10605 | status = vos_timer_start(&pSession->hTimerRoaming, interval/PAL_TIMER_TO_MS_UNIT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10606 | |
| 10607 | return (status); |
| 10608 | } |
| 10609 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10610 | eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10611 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10612 | return (vos_timer_stop(&pMac->roam.roamSession[sessionId].hTimerRoaming)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10613 | } |
| 10614 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10615 | void csrRoamWaitForKeyTimeOutHandler(void *pv) |
| 10616 | { |
| 10617 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 10618 | tpAniSirGlobal pMac = pInfo->pMac; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10619 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pInfo->sessionId ); |
Leela Venkata Kiran Kumar Reddy Chirala | ecc44b9 | 2013-12-13 20:14:35 -0800 | [diff] [blame] | 10620 | eHalStatus status = eHAL_STATUS_FAILURE; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10621 | |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 10622 | smsLog(pMac, LOGW, FL("WaitForKey timer expired in state=%s sub-state=%s"), |
| 10623 | macTraceGetNeighbourRoamState( |
| 10624 | pMac->roam.neighborRoamInfo.neighborRoamState), |
| 10625 | macTraceGetcsrRoamSubState( |
| 10626 | pMac->roam.curSubState[pInfo->sessionId])); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10627 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10628 | if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) ) |
| 10629 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10630 | #ifdef FEATURE_WLAN_LFR |
| 10631 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 10632 | { |
| 10633 | /* |
| 10634 | * Enable heartbeat timer when hand-off is in progress |
| 10635 | * and Key Wait timer expired. |
| 10636 | */ |
| 10637 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey expiry" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10638 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10639 | pMac->roam.configParam.HeartbeatThresh24); |
| 10640 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 10641 | pMac->roam.configParam.HeartbeatThresh24, |
| 10642 | NULL, eANI_BOOLEAN_FALSE); |
| 10643 | } |
| 10644 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10645 | smsLog(pMac, LOGW, " SME pre-auth state timeout. "); |
Praveen Kumar Sirisilla | 8bdfac4 | 2013-10-10 17:20:48 -0700 | [diff] [blame] | 10646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10647 | //Change the substate so command queue is unblocked. |
Praveen Kumar Sirisilla | 8bdfac4 | 2013-10-10 17:20:48 -0700 | [diff] [blame] | 10648 | if (CSR_ROAM_SESSION_MAX > pInfo->sessionId) |
| 10649 | { |
| 10650 | csrRoamSubstateChange(pMac, eCSR_ROAM_SUBSTATE_NONE, |
| 10651 | pInfo->sessionId); |
| 10652 | } |
| 10653 | |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10654 | if (pSession) |
| 10655 | { |
| 10656 | if( csrIsConnStateConnectedInfra(pMac, pInfo->sessionId) ) |
| 10657 | { |
| 10658 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 10659 | smeProcessPendingQueue(pMac); |
Leela Venkata Kiran Kumar Reddy Chirala | ecc44b9 | 2013-12-13 20:14:35 -0800 | [diff] [blame] | 10660 | if( (pSession->connectedProfile.AuthType == |
| 10661 | eCSR_AUTH_TYPE_SHARED_KEY) && |
| 10662 | ( (pSession->connectedProfile.EncryptionType == |
| 10663 | eCSR_ENCRYPT_TYPE_WEP40) || |
| 10664 | (pSession->connectedProfile.EncryptionType == |
| 10665 | eCSR_ENCRYPT_TYPE_WEP104) )) |
| 10666 | { |
| 10667 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 10668 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 10669 | { |
| 10670 | csrRoamDisconnect( pMac, pInfo->sessionId, |
| 10671 | eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 10672 | sme_ReleaseGlobalLock( &pMac->sme ); |
| 10673 | } |
| 10674 | } |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10675 | } |
| 10676 | else |
| 10677 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10678 | smsLog(pMac, LOGW, "%s: could not post link up", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10679 | __func__); |
| 10680 | } |
| 10681 | } |
| 10682 | else |
| 10683 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10684 | smsLog(pMac, LOGW, "%s: session not found", __func__); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10685 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10686 | } |
| 10687 | |
| 10688 | } |
| 10689 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10690 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval) |
| 10691 | { |
| 10692 | eHalStatus status; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10693 | #ifdef FEATURE_WLAN_LFR |
| 10694 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 10695 | { |
| 10696 | /* Disable heartbeat timer when hand-off is in progress */ |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 10697 | smsLog(pMac, LOG2, FL("disabling HB timer in state=%s sub-state=%s"), |
| 10698 | macTraceGetNeighbourRoamState( |
| 10699 | pMac->roam.neighborRoamInfo.neighborRoamState), |
| 10700 | macTraceGetcsrRoamSubState( |
| 10701 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId] |
| 10702 | )); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10703 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE); |
| 10704 | } |
| 10705 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10706 | smsLog(pMac, LOG1, " csrScanStartWaitForKeyTimer"); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10707 | 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] | 10708 | |
| 10709 | return (status); |
| 10710 | } |
| 10711 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10712 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac) |
| 10713 | { |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 10714 | smsLog(pMac, LOG2, FL("WaitForKey timer stopped in state=%s sub-state=%s"), |
| 10715 | macTraceGetNeighbourRoamState( |
| 10716 | pMac->roam.neighborRoamInfo.neighborRoamState), |
| 10717 | macTraceGetcsrRoamSubState( |
| 10718 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId])); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10719 | #ifdef FEATURE_WLAN_LFR |
| 10720 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 10721 | { |
| 10722 | /* |
| 10723 | * Enable heartbeat timer when hand-off is in progress |
| 10724 | * and Key Wait timer got stopped for some reason |
| 10725 | */ |
| 10726 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey stop" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10727 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10728 | pMac->roam.configParam.HeartbeatThresh24); |
| 10729 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 10730 | pMac->roam.configParam.HeartbeatThresh24, |
| 10731 | NULL, eANI_BOOLEAN_FALSE); |
| 10732 | } |
| 10733 | #endif |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10734 | return (vos_timer_stop(&pMac->roam.hTimerWaitForKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10735 | } |
| 10736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10737 | void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, |
| 10738 | eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess) |
| 10739 | { |
| 10740 | eRoamCmdStatus roamStatus = csrGetRoamCompleteStatus(pMac, sessionId); |
| 10741 | tANI_U32 roamId = 0; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10742 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10743 | /* To silence the KW tool Null chaeck is added */ |
| 10744 | if(!pSession) |
| 10745 | { |
| 10746 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10747 | return; |
| 10748 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10749 | |
| 10750 | if(pCommand) |
| 10751 | { |
| 10752 | roamId = pCommand->u.roamCmd.roamId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10753 | VOS_ASSERT( sessionId == pCommand->sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10754 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10755 | if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus) |
| 10756 | { |
| 10757 | //if success, force roaming completion |
| 10758 | csrRoamCompleteRoaming(pMac, sessionId, fSuccess, roamResult); |
| 10759 | } |
| 10760 | else |
| 10761 | { |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10762 | VOS_ASSERT(pSession->bRefAssocStartCnt == 0); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10763 | smsLog(pMac, LOGW, FL(" indicates association completion. roamResult = %d"), roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10764 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, roamId, roamStatus, roamResult); |
| 10765 | } |
| 10766 | } |
| 10767 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10768 | eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg) |
| 10769 | { |
| 10770 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10771 | tSirSmeDeauthInd *pDeauthIndMsg = NULL; |
| 10772 | tSirSmeDisassocInd *pDisassocIndMsg = NULL; |
| 10773 | eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; |
| 10774 | tCsrRoamInfo *pRoamInfo = NULL; |
| 10775 | tCsrRoamInfo roamInfo; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10776 | tANI_BOOLEAN fToRoam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10777 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10778 | /* To silence the KW tool Null chaeck is added */ |
| 10779 | if(!pSession) |
| 10780 | { |
| 10781 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10782 | return eHAL_STATUS_FAILURE; |
| 10783 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10784 | //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] | 10785 | fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10786 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
| 10787 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 10788 | { |
| 10789 | result = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 10790 | pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg; |
| 10791 | pSession->roamingStatusCode = pDisassocIndMsg->statusCode; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 10792 | pSession->joinFailStatusCode.reasonCode = pDisassocIndMsg->reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10793 | } |
| 10794 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 10795 | { |
| 10796 | result = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 10797 | pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg; |
| 10798 | pSession->roamingStatusCode = pDeauthIndMsg->statusCode; |
Madan Mohan Koyyalamudi | 6a80893 | 2012-11-06 16:05:54 -0800 | [diff] [blame] | 10799 | /* Convert into proper reason code */ |
| 10800 | pSession->joinFailStatusCode.reasonCode = |
| 10801 | (pDeauthIndMsg->reasonCode == eSIR_BEACON_MISSED) ? |
Agarwal Ashish | 838f1f3 | 2013-03-11 20:54:52 +0530 | [diff] [blame] | 10802 | 0 : pDeauthIndMsg->reasonCode; |
| 10803 | /* cfg layer expects 0 as reason code if |
| 10804 | the driver dosent know the reason code |
| 10805 | eSIR_BEACON_MISSED is defined as locally */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10806 | } |
| 10807 | else |
| 10808 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10809 | smsLog(pMac, LOGW, FL("gets an unknown type (%d)"), type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10810 | result = eCSR_ROAM_RESULT_NONE; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 10811 | pSession->joinFailStatusCode.reasonCode = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10812 | } |
| 10813 | |
| 10814 | // call profile lost link routine here |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10815 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10816 | { |
| 10817 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_LOSTLINK_DETECTED, result); |
| 10818 | } |
| 10819 | |
| 10820 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 10821 | { |
| 10822 | status = csrSendMBDisassocCnfMsg(pMac, pDisassocIndMsg); |
| 10823 | } |
| 10824 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 10825 | { |
| 10826 | status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg); |
| 10827 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10828 | if(!HAL_STATUS_SUCCESS(status)) |
| 10829 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10830 | //If fail to send confirmation to PE, not to trigger roaming |
| 10831 | fToRoam = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10832 | } |
| 10833 | |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10834 | //prepare to tell HDD to disconnect |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10835 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10836 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 10837 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10838 | if( eWNI_SME_DISASSOC_IND == type) |
| 10839 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10840 | //staMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10841 | vos_mem_copy(roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, |
| 10842 | sizeof(tSirMacAddr)); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10843 | roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId; |
| 10844 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10845 | else if( eWNI_SME_DEAUTH_IND == type ) |
| 10846 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10847 | //staMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10848 | vos_mem_copy(roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, |
| 10849 | sizeof(tSirMacAddr)); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10850 | roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId; |
| 10851 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10852 | smsLog(pMac, LOGW, FL("roamInfo.staId (%d)"), roamInfo.staId); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10853 | |
| 10854 | /* See if we can possibly roam. If so, start the roaming process and notify HDD |
| 10855 | that we are roaming. But if we cannot possibly roam, or if we are unable to |
| 10856 | currently roam, then notify HDD of the lost link */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10857 | if(fToRoam) |
| 10858 | { |
| 10859 | //Only remove the connected BSS in infrastructure mode |
| 10860 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 10861 | //Not to do anying for lostlink with WDS |
| 10862 | if( pMac->roam.configParam.nRoamingTime ) |
| 10863 | { |
| 10864 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac, sessionId, |
| 10865 | ( eWNI_SME_DEAUTH_IND == type ) ? |
| 10866 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc))) |
| 10867 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10868 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10869 | //For IBSS, we need to give some more info to HDD |
| 10870 | if(csrIsBssTypeIBSS(pSession->connectedProfile.BSSType)) |
| 10871 | { |
| 10872 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 10873 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 10874 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 10875 | } |
| 10876 | else |
| 10877 | { |
| 10878 | roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink; |
| 10879 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10880 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10881 | pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? |
| 10882 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc; |
| 10883 | pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 10884 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_LOSTLINK); |
| 10885 | } |
| 10886 | else |
| 10887 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10888 | smsLog(pMac, LOGW, " %s Fail to start roaming, status = %d", __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10889 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10890 | } |
| 10891 | } |
| 10892 | else |
| 10893 | { |
| 10894 | //We are told not to roam, indicate lostlink |
| 10895 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10896 | } |
| 10897 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10898 | if(!fToRoam) |
| 10899 | { |
Madan Mohan Koyyalamudi | af854cf | 2012-10-30 17:56:25 -0700 | [diff] [blame] | 10900 | //Tell HDD about the lost link |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10901 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10902 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10903 | /* Don't call csrRoamCallCallback for GO/SoftAp case as this indication |
| 10904 | * was already given as part of eWNI_SME_DISASSOC_IND msg handling in |
| 10905 | * csrRoamCheckForLinkStatusChange API. |
| 10906 | */ |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10907 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result); |
| 10908 | } |
| 10909 | |
| 10910 | /*No need to start idle scan in case of IBSS/SAP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10911 | Still enable idle scan for polling in case concurrent sessions are running */ |
| 10912 | if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile)) |
| 10913 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10914 | csrScanStartIdleScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10915 | } |
| 10916 | } |
| 10917 | |
| 10918 | return (status); |
| 10919 | } |
| 10920 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10921 | eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId) |
| 10922 | { |
| 10923 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10924 | tListElem *pEntry = NULL; |
| 10925 | tSmeCmd *pCommand = NULL; |
| 10926 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10927 | |
| 10928 | if(!pSession) |
| 10929 | { |
| 10930 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10931 | return eHAL_STATUS_FAILURE; |
| 10932 | } |
| 10933 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10934 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10935 | //Only remove the connected BSS in infrastructure mode |
| 10936 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 10937 | if(pMac->roam.configParam.nRoamingTime) |
| 10938 | { |
| 10939 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac,sessionId, pSession->roamingReason))) |
| 10940 | { |
| 10941 | //before starting the lost link logic release the roam command for handoff |
| 10942 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 10943 | if(pEntry) |
| 10944 | { |
| 10945 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 10946 | } |
| 10947 | if(pCommand) |
| 10948 | { |
| 10949 | if (( eSmeCommandRoam == pCommand->command ) && |
| 10950 | ( eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)) |
| 10951 | { |
| 10952 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10953 | { |
| 10954 | csrReleaseCommandRoam( pMac, pCommand ); |
| 10955 | } |
| 10956 | } |
| 10957 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10958 | smsLog( pMac, LOGW, "Lost link roaming started ..."); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10959 | } |
| 10960 | } |
| 10961 | else |
| 10962 | { |
| 10963 | //We are told not to roam, indicate lostlink |
| 10964 | status = eHAL_STATUS_FAILURE; |
| 10965 | } |
| 10966 | |
| 10967 | return (status); |
| 10968 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10969 | void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac ) |
| 10970 | { |
| 10971 | tListElem *pEntry; |
| 10972 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10973 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 10974 | if ( pEntry ) |
| 10975 | { |
| 10976 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 10977 | if ( eSmeCommandWmStatusChange == pCommand->command ) |
| 10978 | { |
| 10979 | // Nothing to process in a Lost Link completion.... It just kicks off a |
| 10980 | // roaming sequence. |
| 10981 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10982 | { |
| 10983 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 10984 | } |
| 10985 | else |
| 10986 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10987 | smsLog( pMac, LOGE, " ******csrRoamWmStatusChangeComplete fail to release command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10988 | } |
| 10989 | |
| 10990 | } |
| 10991 | else |
| 10992 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10993 | 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] | 10994 | } |
| 10995 | } |
| 10996 | else |
| 10997 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10998 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10999 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11000 | smeProcessPendingQueue( pMac ); |
| 11001 | } |
| 11002 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11003 | void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 11004 | { |
| 11005 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 11006 | tSirSmeRsp *pSirSmeMsg; |
| 11007 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11008 | |
| 11009 | if(!pSession) |
| 11010 | { |
| 11011 | smsLog(pMac, LOGE, FL(" session %d not found "), pCommand->sessionId); |
| 11012 | return; |
| 11013 | } |
| 11014 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11015 | switch ( pCommand->u.wmStatusChangeCmd.Type ) |
| 11016 | { |
| 11017 | case eCsrDisassociated: |
| 11018 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg; |
| 11019 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg); |
| 11020 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11021 | case eCsrDeauthenticated: |
| 11022 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg; |
| 11023 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg); |
| 11024 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11025 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11026 | 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] | 11027 | break; |
| 11028 | } |
| 11029 | //For WDS, we want to stop BSS as well when it is indicated that it is disconnected. |
| 11030 | if( CSR_IS_CONN_WDS(&pSession->connectedProfile) ) |
| 11031 | { |
| 11032 | if( !HAL_STATUS_SUCCESS(csrRoamIssueStopBssCmd( pMac, pCommand->sessionId, eANI_BOOLEAN_TRUE )) ) |
| 11033 | { |
| 11034 | //This is not good |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11035 | smsLog(pMac, LOGE, FL(" failed to issue stopBSS command")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11036 | } |
| 11037 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11038 | // Lost Link just triggers a roaming sequence. We can complte the Lost Link |
| 11039 | // command here since there is nothing else to do. |
| 11040 | csrRoamWmStatusChangeComplete( pMac ); |
| 11041 | } |
| 11042 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11043 | //This function returns band and mode information. |
| 11044 | //The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B |
| 11045 | //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] | 11046 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 11047 | tANI_U8 operationChn, eCsrBand *pBand ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11048 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11049 | eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode; |
| 11050 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, |
| 11051 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11052 | eCsrBand eBand; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 11053 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11054 | //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] | 11055 | if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && |
| 11056 | ((eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 11057 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode))) || |
| 11058 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11059 | { |
| 11060 | switch( pMac->roam.configParam.uCfgDot11Mode ) |
| 11061 | { |
| 11062 | case eCSR_CFG_DOT11_MODE_11A: |
| 11063 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 11064 | eBand = eCSR_BAND_5G; |
| 11065 | break; |
| 11066 | case eCSR_CFG_DOT11_MODE_11B: |
| 11067 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 11068 | eBand = eCSR_BAND_24; |
| 11069 | break; |
| 11070 | case eCSR_CFG_DOT11_MODE_11G: |
| 11071 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 11072 | eBand = eCSR_BAND_24; |
| 11073 | break; |
| 11074 | case eCSR_CFG_DOT11_MODE_11N: |
| 11075 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11076 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 11077 | break; |
| 11078 | #ifdef WLAN_FEATURE_11AC |
| 11079 | case eCSR_CFG_DOT11_MODE_11AC: |
| 11080 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 11081 | { |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 11082 | /* If the operating channel is in 2.4 GHz band, check for |
| 11083 | * INI item to disable VHT operation in 2.4 GHz band |
| 11084 | */ |
| 11085 | if (CSR_IS_CHANNEL_24GHZ(operationChn) && |
| 11086 | !pMac->roam.configParam.enableVhtFor24GHz) |
| 11087 | { |
| 11088 | /* Disable 11AC operation */ |
| 11089 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 11090 | } |
| 11091 | else |
| 11092 | { |
| 11093 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 11094 | } |
| 11095 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11096 | } |
| 11097 | else |
| 11098 | { |
| 11099 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 11100 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 11101 | } |
| 11102 | break; |
| 11103 | case eCSR_CFG_DOT11_MODE_11AC_ONLY: |
| 11104 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 11105 | { |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 11106 | /* If the operating channel is in 2.4 GHz band, check for |
| 11107 | * INI item to disable VHT operation in 2.4 GHz band |
| 11108 | */ |
| 11109 | if (CSR_IS_CHANNEL_24GHZ(operationChn) && |
| 11110 | !pMac->roam.configParam.enableVhtFor24GHz) |
| 11111 | { |
| 11112 | /* Disable 11AC operation */ |
| 11113 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 11114 | } |
| 11115 | else |
| 11116 | { |
| 11117 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC_ONLY; |
| 11118 | } |
| 11119 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11120 | } |
| 11121 | else |
| 11122 | { |
| 11123 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 11124 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 11125 | } |
| 11126 | break; |
| 11127 | #endif |
| 11128 | case eCSR_CFG_DOT11_MODE_AUTO: |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11129 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 03c3942 | 2014-09-24 10:52:30 +0530 | [diff] [blame] | 11130 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 11131 | { |
| 11132 | /* If the operating channel is in 2.4 GHz band, check for |
| 11133 | * INI item to disable VHT operation in 2.4 GHz band |
| 11134 | */ |
| 11135 | if (CSR_IS_CHANNEL_24GHZ(operationChn) && |
| 11136 | !pMac->roam.configParam.enableVhtFor24GHz) |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11137 | { |
Abhishek Singh | 03c3942 | 2014-09-24 10:52:30 +0530 | [diff] [blame] | 11138 | /* Disable 11AC operation */ |
| 11139 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11140 | } |
| 11141 | else |
| 11142 | { |
Abhishek Singh | 03c3942 | 2014-09-24 10:52:30 +0530 | [diff] [blame] | 11143 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 11144 | } |
| 11145 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 11146 | } |
| 11147 | else |
| 11148 | { |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11149 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 11150 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11151 | } |
Abhishek Singh | 03c3942 | 2014-09-24 10:52:30 +0530 | [diff] [blame] | 11152 | #else |
| 11153 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 11154 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 11155 | #endif |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11156 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11157 | default: |
| 11158 | // Global dot11 Mode setting is 11a/b/g. |
| 11159 | // use the channel number to determine the Mode setting. |
| 11160 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 11161 | { |
| 11162 | eBand = pMac->roam.configParam.eBand; |
| 11163 | if(eCSR_BAND_24 == eBand) |
| 11164 | { |
| 11165 | //See reason in else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) to pick 11B |
| 11166 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 11167 | } |
| 11168 | else |
| 11169 | { |
| 11170 | //prefer 5GHz |
| 11171 | eBand = eCSR_BAND_5G; |
| 11172 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 11173 | } |
| 11174 | } |
| 11175 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 11176 | { |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11177 | // WiFi tests require IBSS networks to start in 11b mode |
| 11178 | // without any change to the default parameter settings |
| 11179 | // on the adapter. We use ACU to start an IBSS through |
| 11180 | // creation of a startIBSS profile. This startIBSS profile |
| 11181 | // has Auto MACProtocol and the adapter property setting |
| 11182 | // for dot11Mode is also AUTO. So in this case, let's |
| 11183 | // start the IBSS network in 11b mode instead of 11g mode. |
| 11184 | // So this is for Auto=profile->MacProtocol && Auto=Global. |
| 11185 | // dot11Mode && profile->channel is < 14, then start the IBSS |
| 11186 | // in b mode. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11187 | // |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11188 | // Note: we used to have this start as an 11g IBSS for best |
| 11189 | // performance... now to specify that the user will have to |
| 11190 | // set the do11Mode in the property page to 11g to force it. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11191 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 11192 | eBand = eCSR_BAND_24; |
| 11193 | } |
| 11194 | else |
| 11195 | { |
| 11196 | // else, it's a 5.0GHz channel. Set mode to 11a. |
| 11197 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 11198 | eBand = eCSR_BAND_5G; |
| 11199 | } |
| 11200 | break; |
| 11201 | }//switch |
| 11202 | }//if( eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 11203 | else |
| 11204 | { |
| 11205 | //dot11 mode is set, lets pick the band |
| 11206 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 11207 | { |
| 11208 | // channel is Auto also. |
| 11209 | eBand = pMac->roam.configParam.eBand; |
| 11210 | if(eCSR_BAND_ALL == eBand) |
| 11211 | { |
| 11212 | //prefer 5GHz |
| 11213 | eBand = eCSR_BAND_5G; |
| 11214 | } |
| 11215 | } |
| 11216 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 11217 | { |
| 11218 | eBand = eCSR_BAND_24; |
| 11219 | } |
| 11220 | else |
| 11221 | { |
| 11222 | eBand = eCSR_BAND_5G; |
| 11223 | } |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 11224 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11225 | if(pBand) |
| 11226 | { |
| 11227 | *pBand = eBand; |
| 11228 | } |
| 11229 | |
| 11230 | if (operationChn == 14){ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11231 | smsLog(pMac, LOGE, FL(" Switching to Dot11B mode ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11232 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 11233 | } |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 11234 | |
Madan Mohan Koyyalamudi | 5ec4b18 | 2012-11-28 16:15:17 -0800 | [diff] [blame] | 11235 | /* Incase of WEP Security encryption type is coming as part of add key. So while STart BSS dont have information */ |
| 11236 | 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] | 11237 | ((eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 11238 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 11239 | (eCSR_CFG_DOT11_MODE_11AC == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 11240 | #endif |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 11241 | (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode)) ) |
| 11242 | { |
| 11243 | //We cannot do 11n here |
| 11244 | if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 11245 | { |
| 11246 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 11247 | } |
| 11248 | else |
| 11249 | { |
| 11250 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 11251 | } |
| 11252 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11253 | return( cfgDot11Mode ); |
| 11254 | } |
| 11255 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11256 | eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 11257 | { |
| 11258 | eHalStatus status; |
| 11259 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11260 | |
| 11261 | if(!pSession) |
| 11262 | { |
| 11263 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11264 | return eHAL_STATUS_FAILURE; |
| 11265 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11266 | |
| 11267 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11268 | { |
| 11269 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11270 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 11271 | if(pIbssLog) |
| 11272 | { |
| 11273 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ; |
| 11274 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 11275 | } |
| 11276 | } |
| 11277 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11278 | // Set the roaming substate to 'stop Bss request'... |
| 11279 | csrRoamSubstateChange( pMac, NewSubstate, sessionId ); |
| 11280 | |
| 11281 | // attempt to stop the Bss (reason code is ignored...) |
| 11282 | status = csrSendMBStopBssReqMsg( pMac, sessionId ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 11283 | if(!HAL_STATUS_SUCCESS(status)) |
| 11284 | { |
| 11285 | smsLog(pMac, LOGW, FL("csrSendMBStopBssReqMsg failed with status %d"), status); |
| 11286 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11287 | return (status); |
| 11288 | } |
| 11289 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11290 | //pNumChan is a caller allocated space with the sizeof pChannels |
| 11291 | eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan) |
| 11292 | { |
| 11293 | |
| 11294 | return (ccmCfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 11295 | (tANI_U8 *)pChannels, |
| 11296 | pNumChan)); |
| 11297 | } |
| 11298 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11299 | tPowerdBm csrGetCfgMaxTxPower (tpAniSirGlobal pMac, tANI_U8 channel) |
| 11300 | { |
| 11301 | tANI_U32 cfgLength = 0; |
| 11302 | tANI_U16 cfgId = 0; |
| 11303 | tPowerdBm maxTxPwr = 0; |
| 11304 | tANI_U8 *pCountryInfo = NULL; |
| 11305 | eHalStatus status; |
| 11306 | tANI_U8 count = 0; |
| 11307 | tANI_U8 firstChannel; |
| 11308 | tANI_U8 maxChannels; |
| 11309 | |
| 11310 | if (CSR_IS_CHANNEL_5GHZ(channel)) |
| 11311 | { |
| 11312 | cfgId = WNI_CFG_MAX_TX_POWER_5; |
| 11313 | cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN; |
| 11314 | } |
| 11315 | else if (CSR_IS_CHANNEL_24GHZ(channel)) |
| 11316 | { |
| 11317 | cfgId = WNI_CFG_MAX_TX_POWER_2_4; |
| 11318 | cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN; |
| 11319 | } |
| 11320 | else |
| 11321 | return maxTxPwr; |
| 11322 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11323 | pCountryInfo = vos_mem_malloc(cfgLength); |
| 11324 | if ( NULL == pCountryInfo ) |
| 11325 | status = eHAL_STATUS_FAILURE; |
| 11326 | else |
| 11327 | status = eHAL_STATUS_SUCCESS; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11328 | if (status != eHAL_STATUS_SUCCESS) |
| 11329 | { |
| 11330 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11331 | FL("%s: failed to allocate memory, status = %d"), |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11332 | __FUNCTION__, status); |
| 11333 | goto error; |
| 11334 | } |
| 11335 | status = ccmCfgGetStr(pMac, cfgId, (tANI_U8 *)pCountryInfo, &cfgLength); |
| 11336 | if (status != eHAL_STATUS_SUCCESS) |
| 11337 | { |
| 11338 | goto error; |
| 11339 | } |
| 11340 | /* Identify the channel and maxtxpower */ |
| 11341 | while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) |
| 11342 | { |
| 11343 | firstChannel = pCountryInfo[count++]; |
| 11344 | maxChannels = pCountryInfo[count++]; |
| 11345 | maxTxPwr = pCountryInfo[count++]; |
| 11346 | |
| 11347 | if ((channel >= firstChannel) && |
| 11348 | (channel < (firstChannel + maxChannels))) |
| 11349 | { |
| 11350 | break; |
| 11351 | } |
| 11352 | } |
| 11353 | |
| 11354 | error: |
| 11355 | if (NULL != pCountryInfo) |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11356 | vos_mem_free(pCountryInfo); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 11357 | |
| 11358 | return maxTxPwr; |
| 11359 | } |
| 11360 | |
| 11361 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11362 | tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel ) |
| 11363 | { |
| 11364 | tANI_BOOLEAN fValid = FALSE; |
| 11365 | tANI_U32 idxValidChannels; |
| 11366 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 11367 | |
| 11368 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len))) |
| 11369 | { |
| 11370 | for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ ) |
| 11371 | { |
| 11372 | if ( channel == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 11373 | { |
| 11374 | fValid = TRUE; |
| 11375 | break; |
| 11376 | } |
| 11377 | } |
| 11378 | } |
| 11379 | pMac->roam.numValidChannels = len; |
| 11380 | return fValid; |
| 11381 | } |
| 11382 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11383 | tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel) |
| 11384 | { |
| 11385 | tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE; |
| 11386 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11387 | for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++) |
| 11388 | { |
| 11389 | if(channel == pMac->scan.base40MHzChannels.channelList[i]) |
| 11390 | { |
| 11391 | fValid = eANI_BOOLEAN_TRUE; |
| 11392 | break; |
| 11393 | } |
| 11394 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11395 | return (fValid); |
| 11396 | } |
| 11397 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11398 | //This function check and validate whether the NIC can do CB (40MHz) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11399 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11400 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11401 | ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11402 | tANI_U8 centerChn; |
| 11403 | tANI_U32 ChannelBondingMode; |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 11404 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11405 | if(CSR_IS_CHANNEL_24GHZ(primaryChn)) |
| 11406 | { |
| 11407 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 11408 | } |
| 11409 | else |
| 11410 | { |
| 11411 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 11412 | } |
| 11413 | //Figure what the other side's CB mode |
| 11414 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 11415 | { |
| 11416 | if(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == pIes->HTCaps.supportedChannelWidthSet)) |
| 11417 | { |
Agrawal Ashish | f187d51 | 2014-04-03 17:01:52 +0530 | [diff] [blame] | 11418 | // In Case WPA2 and TKIP is the only one cipher suite in Pairwise. |
| 11419 | if ((pIes->RSN.present && (pIes->RSN.pwise_cipher_suite_count == 1) && |
| 11420 | !memcmp(&(pIes->RSN.pwise_cipher_suites[0][0]), |
| 11421 | "\x00\x0f\xac\x02",4)) |
Abhishek Singh | fd8afeb | 2014-10-15 11:55:45 +0530 | [diff] [blame] | 11422 | //In Case only WPA1 is supported and TKIP is the only one cipher suite in Unicast. |
| 11423 | ||( !pIes->RSN.present && (pIes->WPA.present && (pIes->WPA.unicast_cipher_count == 1) && |
Agrawal Ashish | f187d51 | 2014-04-03 17:01:52 +0530 | [diff] [blame] | 11424 | !memcmp(&(pIes->WPA.unicast_ciphers[0][0]), |
Abhishek Singh | fd8afeb | 2014-10-15 11:55:45 +0530 | [diff] [blame] | 11425 | "\x00\x50\xf2\x02",4)))) |
Agrawal Ashish | f187d51 | 2014-04-03 17:01:52 +0530 | [diff] [blame] | 11426 | |
Leela Venkata Kiran Kumar Reddy Chirala | 10c5a2e | 2013-12-18 14:41:28 -0800 | [diff] [blame] | 11427 | { |
| 11428 | smsLog(pMac, LOGW, " No channel bonding in TKIP mode "); |
| 11429 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 11430 | } |
| 11431 | |
| 11432 | else if(pIes->HTInfo.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11433 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11434 | /* This is called during INFRA STA/CLIENT and should use the merged value of |
| 11435 | * supported channel width and recommended tx width as per standard |
| 11436 | */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11437 | smsLog(pMac, LOG1, "scws %u rtws %u sco %u", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11438 | pIes->HTCaps.supportedChannelWidthSet, |
| 11439 | pIes->HTInfo.recommendedTxWidthSet, |
| 11440 | pIes->HTInfo.secondaryChannelOffset); |
| 11441 | |
| 11442 | if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ) |
| 11443 | eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11444 | else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11445 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 11446 | switch (eRet) { |
| 11447 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 11448 | centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET; |
| 11449 | break; |
| 11450 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 11451 | centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET; |
| 11452 | break; |
| 11453 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 11454 | default: |
| 11455 | centerChn = primaryChn; |
| 11456 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11457 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11458 | if((PHY_SINGLE_CHANNEL_CENTERED != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11459 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11460 | smsLog(pMac, LOGE, " Invalid center channel (%d), disable 40MHz mode", centerChn); |
Abhishek Singh | 25144bb | 2014-05-01 16:03:21 +0530 | [diff] [blame] | 11461 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11462 | } |
| 11463 | } |
| 11464 | } |
| 11465 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11466 | return eRet; |
| 11467 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11468 | tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType ) |
| 11469 | { |
| 11470 | tANI_BOOLEAN fFound = FALSE; |
| 11471 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11472 | for( idx = 0; idx < pCipherList->numEntries; idx++ ) |
| 11473 | { |
| 11474 | if( pCipherList->encryptionType[idx] == encryptionType ) |
| 11475 | { |
| 11476 | fFound = TRUE; |
| 11477 | break; |
| 11478 | } |
| 11479 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11480 | return fFound; |
| 11481 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11482 | tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType ) |
| 11483 | { |
| 11484 | tANI_BOOLEAN fFound = FALSE; |
| 11485 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11486 | for( idx = 0; idx < pAuthList->numEntries; idx++ ) |
| 11487 | { |
| 11488 | if( pAuthList->authType[idx] == authType ) |
| 11489 | { |
| 11490 | fFound = TRUE; |
| 11491 | break; |
| 11492 | } |
| 11493 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11494 | return fFound; |
| 11495 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11496 | tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2) |
| 11497 | { |
| 11498 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 11499 | tCsrScanResultFilter *pScanFilter = NULL; |
| 11500 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11501 | |
| 11502 | if(pProfile1 && pProfile2) |
| 11503 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11504 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 11505 | if ( NULL == pScanFilter ) |
| 11506 | status = eHAL_STATUS_FAILURE; |
| 11507 | else |
| 11508 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11509 | if(HAL_STATUS_SUCCESS(status)) |
| 11510 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11511 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11512 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile2, pScanFilter); |
| 11513 | if(HAL_STATUS_SUCCESS(status)) |
| 11514 | { |
| 11515 | fCheck = eANI_BOOLEAN_FALSE; |
| 11516 | do |
| 11517 | { |
| 11518 | tANI_U32 i; |
| 11519 | for(i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++) |
| 11520 | { |
| 11521 | fCheck = csrIsSsidMatch( pMac, pScanFilter->SSIDs.SSIDList[i].SSID.ssId, |
| 11522 | pScanFilter->SSIDs.SSIDList[i].SSID.length, |
| 11523 | pProfile1->SSID.ssId, pProfile1->SSID.length, eANI_BOOLEAN_FALSE ); |
| 11524 | if ( fCheck ) break; |
| 11525 | } |
| 11526 | if(!fCheck) |
| 11527 | { |
| 11528 | break; |
| 11529 | } |
| 11530 | if( !csrIsAuthInList( pMac, &pProfile2->AuthType, pProfile1->AuthType) |
| 11531 | || pProfile2->BSSType != pProfile1->BSSType |
| 11532 | || !csrIsEncryptionInList( pMac, &pProfile2->EncryptionType, pProfile1->EncryptionType ) |
| 11533 | ) |
| 11534 | { |
| 11535 | fCheck = eANI_BOOLEAN_FALSE; |
| 11536 | break; |
| 11537 | } |
| 11538 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11539 | if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent) |
| 11540 | { |
| 11541 | if (pProfile1->MDID.mobilityDomain != pProfile2->MDID.mobilityDomain) |
| 11542 | { |
| 11543 | fCheck = eANI_BOOLEAN_FALSE; |
| 11544 | break; |
| 11545 | } |
| 11546 | } |
| 11547 | #endif |
| 11548 | //Match found |
| 11549 | fCheck = eANI_BOOLEAN_TRUE; |
| 11550 | }while(0); |
| 11551 | csrFreeScanFilter(pMac, pScanFilter); |
| 11552 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11553 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11554 | } |
| 11555 | } |
| 11556 | |
| 11557 | return (fCheck); |
| 11558 | } |
| 11559 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11560 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2) |
| 11561 | { |
| 11562 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 11563 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11564 | do |
| 11565 | { |
| 11566 | //Only check for static WEP |
| 11567 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) && |
| 11568 | !csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) |
| 11569 | { |
| 11570 | fCheck = eANI_BOOLEAN_TRUE; |
| 11571 | break; |
| 11572 | } |
| 11573 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, pConnProfile->EncryptionType)) break; |
| 11574 | if(pConnProfile->Keys.defaultIndex != pProfile2->Keys.defaultIndex) break; |
| 11575 | for(i = 0; i < CSR_MAX_NUM_KEY; i++) |
| 11576 | { |
| 11577 | if(pConnProfile->Keys.KeyLength[i] != pProfile2->Keys.KeyLength[i]) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11578 | if (!vos_mem_compare(&pConnProfile->Keys.KeyMaterial[i], |
| 11579 | &pProfile2->Keys.KeyMaterial[i], pProfile2->Keys.KeyLength[i])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11580 | { |
| 11581 | break; |
| 11582 | } |
| 11583 | } |
| 11584 | if( i == CSR_MAX_NUM_KEY) |
| 11585 | { |
| 11586 | fCheck = eANI_BOOLEAN_TRUE; |
| 11587 | } |
| 11588 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11589 | return (fCheck); |
| 11590 | } |
| 11591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11592 | //IBSS |
| 11593 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11594 | tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac ) |
| 11595 | { |
| 11596 | tANI_U8 channel = 0; |
| 11597 | tANI_U32 idx; |
| 11598 | tANI_U32 idxValidChannels; |
| 11599 | tANI_BOOLEAN fFound = FALSE; |
| 11600 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 11601 | |
| 11602 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel5G) |
| 11603 | { |
| 11604 | channel = pMac->roam.configParam.AdHocChannel5G; |
| 11605 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 11606 | { |
| 11607 | channel = 0; |
| 11608 | } |
| 11609 | } |
| 11610 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 11611 | { |
| 11612 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_50 ) && !fFound; idx++ ) |
| 11613 | { |
| 11614 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 11615 | { |
| 11616 | if ( csrStartIbssChannels50[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 11617 | { |
| 11618 | fFound = TRUE; |
| 11619 | channel = csrStartIbssChannels50[ idx ]; |
| 11620 | } |
| 11621 | } |
| 11622 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11623 | // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found! |
| 11624 | if (!fFound) |
| 11625 | { |
| 11626 | for ( idxValidChannels = 0; idxValidChannels < len ; idxValidChannels++ ) |
| 11627 | { |
Girish Gowli | 386e76c | 2014-10-20 22:00:29 +0530 | [diff] [blame] | 11628 | if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idxValidChannels ]) ) // the max channel# in 11g is 14 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11629 | { |
Girish Gowli | 386e76c | 2014-10-20 22:00:29 +0530 | [diff] [blame] | 11630 | channel = pMac->roam.validChannelList[ idxValidChannels ]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11631 | break; |
| 11632 | } |
| 11633 | } |
| 11634 | } |
| 11635 | }//if |
| 11636 | |
| 11637 | return( channel ); |
| 11638 | } |
| 11639 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11640 | tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac ) |
| 11641 | { |
| 11642 | tANI_U8 channel = 1; |
| 11643 | tANI_U32 idx; |
| 11644 | tANI_U32 idxValidChannels; |
| 11645 | tANI_BOOLEAN fFound = FALSE; |
| 11646 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 11647 | |
| 11648 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel24) |
| 11649 | { |
| 11650 | channel = pMac->roam.configParam.AdHocChannel24; |
| 11651 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 11652 | { |
| 11653 | channel = 0; |
| 11654 | } |
| 11655 | } |
| 11656 | |
| 11657 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 11658 | { |
| 11659 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_24 ) && !fFound; idx++ ) |
| 11660 | { |
| 11661 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 11662 | { |
| 11663 | if ( csrStartIbssChannels24[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 11664 | { |
| 11665 | fFound = TRUE; |
| 11666 | channel = csrStartIbssChannels24[ idx ]; |
| 11667 | } |
| 11668 | } |
| 11669 | } |
| 11670 | } |
| 11671 | |
| 11672 | return( channel ); |
| 11673 | } |
| 11674 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11675 | static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 11676 | tCsrRoamStartBssParams *pParam ) |
| 11677 | { |
| 11678 | eCsrCfgDot11Mode cfgDot11Mode; |
| 11679 | eCsrBand eBand; |
| 11680 | tANI_U8 channel = 0; |
| 11681 | tSirNwType nwType; |
| 11682 | tANI_U8 operationChannel = 0; |
| 11683 | |
| 11684 | if(pProfile->ChannelInfo.numOfChannels && pProfile->ChannelInfo.ChannelList) |
| 11685 | { |
| 11686 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 11687 | } |
| 11688 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11689 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11690 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11691 | if( ( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 11692 | (pProfile->csrPersona == VOS_P2P_GO_MODE) ) |
| 11693 | && ( cfgDot11Mode == eCSR_CFG_DOT11_MODE_11B) |
| 11694 | ) |
| 11695 | { |
| 11696 | /* This should never happen */ |
| 11697 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11698 | FL("For P2PClient/P2P-GO (persona %d) cfgDot11Mode is 11B"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11699 | pProfile->csrPersona); |
| 11700 | VOS_ASSERT(0); |
| 11701 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11702 | switch( cfgDot11Mode ) |
| 11703 | { |
| 11704 | case eCSR_CFG_DOT11_MODE_11G: |
| 11705 | nwType = eSIR_11G_NW_TYPE; |
| 11706 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11707 | case eCSR_CFG_DOT11_MODE_11B: |
| 11708 | nwType = eSIR_11B_NW_TYPE; |
| 11709 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11710 | case eCSR_CFG_DOT11_MODE_11A: |
| 11711 | nwType = eSIR_11A_NW_TYPE; |
| 11712 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11713 | default: |
| 11714 | case eCSR_CFG_DOT11_MODE_11N: |
| 11715 | case eCSR_CFG_DOT11_MODE_TAURUS: |
| 11716 | //Because LIM only verifies it against 11a, 11b or 11g, set only 11g or 11a here |
| 11717 | if(eCSR_BAND_24 == eBand) |
| 11718 | { |
| 11719 | nwType = eSIR_11G_NW_TYPE; |
| 11720 | } |
| 11721 | else |
| 11722 | { |
| 11723 | nwType = eSIR_11A_NW_TYPE; |
| 11724 | } |
| 11725 | break; |
| 11726 | } |
| 11727 | |
| 11728 | pParam->extendedRateSet.numRates = 0; |
| 11729 | |
| 11730 | switch ( nwType ) |
| 11731 | { |
| 11732 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11733 | smsLog(pMac, LOGE, FL("sees an unknown pSirNwType (%d)"), nwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11734 | case eSIR_11A_NW_TYPE: |
| 11735 | |
| 11736 | pParam->operationalRateSet.numRates = 8; |
| 11737 | |
| 11738 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 11739 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11740 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 11741 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11742 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 11743 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11744 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11745 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11746 | |
| 11747 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11748 | { |
| 11749 | channel = csrRoamGetIbssStartChannelNumber50( pMac ); |
| 11750 | if( 0 == channel && |
| 11751 | CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && |
| 11752 | CSR_IS_PHY_MODE_DUAL_BAND(pMac->roam.configParam.phyMode) |
| 11753 | ) |
| 11754 | { |
| 11755 | //We could not find a 5G channel by auto pick, let's try 2.4G channels |
| 11756 | //We only do this here because csrRoamGetPhyModeBandForBss always picks 11a for AUTO |
| 11757 | nwType = eSIR_11B_NW_TYPE; |
| 11758 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11759 | pParam->operationalRateSet.numRates = 4; |
| 11760 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 11761 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 11762 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 11763 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 11764 | } |
| 11765 | } |
| 11766 | else |
| 11767 | { |
| 11768 | channel = operationChannel; |
| 11769 | } |
| 11770 | break; |
| 11771 | |
| 11772 | case eSIR_11B_NW_TYPE: |
| 11773 | pParam->operationalRateSet.numRates = 4; |
| 11774 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 11775 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 11776 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 11777 | 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] | 11778 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11779 | { |
| 11780 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11781 | } |
| 11782 | else |
| 11783 | { |
| 11784 | channel = operationChannel; |
| 11785 | } |
| 11786 | |
| 11787 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11788 | case eSIR_11G_NW_TYPE: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11789 | /* For P2P Client and P2P GO, disable 11b rates */ |
| 11790 | if( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 11791 | (pProfile->csrPersona == VOS_P2P_GO_MODE) |
| 11792 | ) |
| 11793 | { |
| 11794 | pParam->operationalRateSet.numRates = 8; |
| 11795 | |
| 11796 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 11797 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11798 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 11799 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11800 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 11801 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11802 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11803 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11804 | } |
| 11805 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11806 | { |
| 11807 | pParam->operationalRateSet.numRates = 4; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11808 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 11809 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 11810 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 11811 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 11812 | |
| 11813 | pParam->extendedRateSet.numRates = 8; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11814 | pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6; |
| 11815 | pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11816 | pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12; |
| 11817 | pParam->extendedRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11818 | pParam->extendedRateSet.rate[4] = SIR_MAC_RATE_24; |
| 11819 | pParam->extendedRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11820 | pParam->extendedRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11821 | pParam->extendedRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11822 | } |
| 11823 | |
| 11824 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11825 | { |
| 11826 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11827 | } |
| 11828 | else |
| 11829 | { |
| 11830 | channel = operationChannel; |
| 11831 | } |
| 11832 | |
| 11833 | break; |
| 11834 | } |
| 11835 | pParam->operationChn = channel; |
| 11836 | pParam->sirNwType = nwType; |
| 11837 | } |
| 11838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11839 | static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, |
| 11840 | tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam ) |
| 11841 | { |
| 11842 | |
| 11843 | if( pParam ) |
| 11844 | { |
| 11845 | pParam->sirNwType = pBssDesc->nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11846 | pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11847 | pParam->operationChn = pBssDesc->channelId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11848 | vos_mem_copy(&pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11849 | |
| 11850 | if( pIes ) |
| 11851 | { |
| 11852 | if(pIes->SuppRates.present) |
| 11853 | { |
| 11854 | pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates; |
| 11855 | if(pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
| 11856 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11857 | 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] | 11858 | pIes->SuppRates.num_rates); |
| 11859 | pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 11860 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11861 | vos_mem_copy(pParam->operationalRateSet.rate, pIes->SuppRates.rates, |
| 11862 | sizeof(*pIes->SuppRates.rates) * pIes->SuppRates.num_rates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11863 | } |
Praveen Kumar Sirisilla | 1f6b649 | 2013-10-15 18:25:06 -0700 | [diff] [blame] | 11864 | if (pIes->ExtSuppRates.present) |
| 11865 | { |
| 11866 | pParam->extendedRateSet.numRates = pIes->ExtSuppRates.num_rates; |
Kaushik, Sushant | d39915b | 2014-04-23 15:12:28 +0530 | [diff] [blame] | 11867 | if(pIes->ExtSuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
Praveen Kumar Sirisilla | 1f6b649 | 2013-10-15 18:25:06 -0700 | [diff] [blame] | 11868 | { |
| 11869 | smsLog(pMac, LOGE, FL("num_rates :%d is more than \ |
| 11870 | SIR_MAC_RATESET_EID_MAX, resetting to \ |
| 11871 | SIR_MAC_RATESET_EID_MAX"), |
| 11872 | pIes->ExtSuppRates.num_rates); |
Kaushik, Sushant | d39915b | 2014-04-23 15:12:28 +0530 | [diff] [blame] | 11873 | pIes->ExtSuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
Praveen Kumar Sirisilla | 1f6b649 | 2013-10-15 18:25:06 -0700 | [diff] [blame] | 11874 | } |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 11875 | vos_mem_copy(pParam->extendedRateSet.rate, |
Praveen Kumar Sirisilla | 1f6b649 | 2013-10-15 18:25:06 -0700 | [diff] [blame] | 11876 | pIes->ExtSuppRates.rates, |
| 11877 | sizeof(*pIes->ExtSuppRates.rates) * pIes->ExtSuppRates.num_rates); |
| 11878 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11879 | if( pIes->SSID.present ) |
| 11880 | { |
| 11881 | pParam->ssId.length = pIes->SSID.num_ssid; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11882 | vos_mem_copy(pParam->ssId.ssId, pIes->SSID.ssid, |
| 11883 | pParam->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11884 | } |
| 11885 | pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11886 | } |
| 11887 | else |
| 11888 | { |
| 11889 | pParam->ssId.length = 0; |
| 11890 | pParam->operationalRateSet.numRates = 0; |
| 11891 | } |
| 11892 | } |
| 11893 | } |
| 11894 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11895 | static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet ) |
| 11896 | { |
| 11897 | tANI_U8 MaxRate = 0; |
| 11898 | tANI_U32 i; |
| 11899 | tANI_U8 *pRate; |
| 11900 | |
| 11901 | pRate = pSirRateSet->rate; |
| 11902 | for ( i = 0; i < pSirRateSet->numRates; i++ ) |
| 11903 | { |
| 11904 | MaxRate = CSR_MAX( MaxRate, ( pRate[ i ] & (~CSR_DOT11_BASIC_RATE_MASK) ) ); |
| 11905 | } |
| 11906 | |
| 11907 | // Save the max rate in the connected state information... |
| 11908 | |
| 11909 | // modify LastRates variable as well |
| 11910 | |
| 11911 | return; |
| 11912 | } |
| 11913 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11914 | eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, |
| 11915 | tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId ) |
| 11916 | { |
| 11917 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11918 | eCsrBand eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11919 | // Set the roaming substate to 'Start BSS attempt'... |
| 11920 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11921 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11922 | //Need to figure out whether we need to log WDS??? |
| 11923 | if( CSR_IS_IBSS( pProfile ) ) |
| 11924 | { |
| 11925 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11926 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 11927 | if(pIbssLog) |
| 11928 | { |
| 11929 | if(pBssDesc) |
| 11930 | { |
| 11931 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_REQ; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11932 | vos_mem_copy(pIbssLog->bssid, pBssDesc->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11933 | } |
| 11934 | else |
| 11935 | { |
| 11936 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_REQ; |
| 11937 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11938 | vos_mem_copy(pIbssLog->ssid, pParam->ssId.ssId, pParam->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11939 | if(pProfile->ChannelInfo.numOfChannels == 0) |
| 11940 | { |
| 11941 | pIbssLog->channelSetting = AUTO_PICK; |
| 11942 | } |
| 11943 | else |
| 11944 | { |
| 11945 | pIbssLog->channelSetting = SPECIFIED; |
| 11946 | } |
| 11947 | pIbssLog->operatingChannel = pParam->operationChn; |
| 11948 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 11949 | } |
| 11950 | } |
| 11951 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11952 | //Put RSN information in for Starting BSS |
Abhishek Singh | 00e4653 | 2014-11-13 05:34:55 -0800 | [diff] [blame] | 11953 | pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength; |
| 11954 | pParam->pRSNIE = pProfile->pRSNReqIE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11955 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11956 | pParam->privacy = pProfile->privacy; |
| 11957 | pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq; |
| 11958 | pParam->authType = pProfile->csr80211AuthType; |
| 11959 | pParam->beaconInterval = pProfile->beaconInterval; |
| 11960 | pParam->dtimPeriod = pProfile->dtimPeriod; |
| 11961 | pParam->ApUapsdEnable = pProfile->ApUapsdEnable; |
| 11962 | pParam->ssidHidden = pProfile->SSIDs.SSIDList[0].ssidHidden; |
| 11963 | if (CSR_IS_INFRA_AP(pProfile)&& (pParam->operationChn != 0)) |
| 11964 | { |
| 11965 | if (csrIsValidChannel(pMac, pParam->operationChn) != eHAL_STATUS_SUCCESS) |
| 11966 | { |
| 11967 | pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL; |
| 11968 | } |
| 11969 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11970 | pParam->protEnabled = pProfile->protEnabled; |
| 11971 | pParam->obssProtEnabled = pProfile->obssProtEnabled; |
| 11972 | pParam->ht_protection = pProfile->cfg_protection; |
| 11973 | pParam->wps_state = pProfile->wps_state; |
Jeff Johnson | 96fbeeb | 2013-02-26 21:23:00 -0800 | [diff] [blame] | 11974 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11975 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, |
| 11976 | &eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11977 | pParam->bssPersona = pProfile->csrPersona; |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 11978 | |
| 11979 | #ifdef WLAN_FEATURE_11W |
| 11980 | pParam->mfpCapable = (0 != pProfile->MFPCapable); |
| 11981 | pParam->mfpRequired = (0 != pProfile->MFPRequired); |
| 11982 | #endif |
| 11983 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11984 | // When starting an IBSS, start on the channel from the Profile. |
| 11985 | status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11986 | return (status); |
| 11987 | } |
| 11988 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11989 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11990 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11991 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11992 | tANI_U8 Channel; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11993 | ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11994 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11995 | |
| 11996 | if(!pSession) |
| 11997 | { |
| 11998 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11999 | return; |
| 12000 | } |
| 12001 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12002 | if( pBssDesc ) |
| 12003 | { |
| 12004 | csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams ); |
| 12005 | //Since csrRoamGetBssStartParmsFromBssDesc fills in the bssid for pSession->bssParams |
| 12006 | //The following code has to be do after that. |
| 12007 | //For WDS station, use selfMac as the self BSSID |
| 12008 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 12009 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12010 | vos_mem_copy(&pSession->bssParams.bssid, &pSession->selfMacAddr, |
| 12011 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12012 | } |
| 12013 | } |
| 12014 | else |
| 12015 | { |
| 12016 | csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12017 | //Use the first SSID |
| 12018 | if(pProfile->SSIDs.numOfSSIDs) |
| 12019 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12020 | vos_mem_copy(&pSession->bssParams.ssId, pProfile->SSIDs.SSIDList, |
| 12021 | sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12022 | } |
| 12023 | //For WDS station, use selfMac as the self BSSID |
| 12024 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 12025 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12026 | vos_mem_copy(&pSession->bssParams.bssid, &pSession->selfMacAddr, |
| 12027 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12028 | } |
| 12029 | //Use the first BSSID |
| 12030 | else if( pProfile->BSSIDs.numOfBSSIDs ) |
| 12031 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12032 | vos_mem_copy(&pSession->bssParams.bssid, pProfile->BSSIDs.bssid, |
| 12033 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12034 | } |
| 12035 | else |
| 12036 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12037 | vos_mem_set(&pSession->bssParams.bssid, sizeof(tCsrBssid), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12038 | } |
| 12039 | } |
| 12040 | Channel = pSession->bssParams.operationChn; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12041 | //Set operating channel in pProfile which will be used |
| 12042 | //in csrRoamSetBssConfigCfg() to determine channel bonding |
| 12043 | //mode and will be configured in CFG later |
| 12044 | pProfile->operationChannel = Channel; |
| 12045 | |
| 12046 | if(Channel == 0) |
| 12047 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 12048 | smsLog(pMac, LOGE, " CSR cannot find a channel to start IBSS"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12049 | } |
| 12050 | else |
| 12051 | { |
| 12052 | |
| 12053 | csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet ); |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 12054 | if (CSR_IS_INFRA_AP(pProfile) || CSR_IS_START_IBSS( pProfile ) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12055 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 12056 | if(CSR_IS_CHANNEL_24GHZ(Channel) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12057 | { |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 12058 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 12059 | if (CSR_IS_INFRA_AP(pProfile)) |
| 12060 | cbMode = pMac->roam.configParam.channelBondingAPMode24GHz; |
| 12061 | else |
| 12062 | cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
| 12063 | #else |
Sandeep Puligilla | e3f239f | 2014-04-17 02:11:46 +0530 | [diff] [blame] | 12064 | cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 12065 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12066 | } |
| 12067 | else |
| 12068 | { |
| 12069 | cbMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 12070 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 12071 | smsLog(pMac, LOG1, "## cbMode %d", cbMode); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12072 | pBssConfig->cbMode = cbMode; |
| 12073 | pSession->bssParams.cbMode = cbMode; |
| 12074 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12075 | } |
| 12076 | } |
| 12077 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12078 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 12079 | tANI_BOOLEAN *pfSameIbss ) |
| 12080 | { |
| 12081 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12082 | tANI_BOOLEAN fSameIbss = FALSE; |
| 12083 | |
| 12084 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 12085 | { |
| 12086 | // Check if any profile parameter has changed ? If any profile parameter |
| 12087 | // has changed then stop old BSS and start a new one with new parameters |
| 12088 | if ( csrIsSameProfile( pMac, &pMac->roam.roamSession[sessionId].connectedProfile, pProfile ) ) |
| 12089 | { |
| 12090 | fSameIbss = TRUE; |
| 12091 | } |
| 12092 | else |
| 12093 | { |
| 12094 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 12095 | } |
| 12096 | } |
| 12097 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 12098 | { |
| 12099 | // Disassociate from the connected Infrastructure network... |
| 12100 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 12101 | } |
| 12102 | else |
| 12103 | { |
| 12104 | tBssConfigParam *pBssConfig; |
| 12105 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12106 | pBssConfig = vos_mem_malloc(sizeof(tBssConfigParam)); |
| 12107 | if ( NULL == pBssConfig ) |
| 12108 | status = eHAL_STATUS_FAILURE; |
| 12109 | else |
| 12110 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12111 | if(HAL_STATUS_SUCCESS(status)) |
| 12112 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12113 | vos_mem_set(pBssConfig, sizeof(tBssConfigParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12114 | // there is no Bss description before we start an IBSS so we need to adopt |
| 12115 | // all Bss configuration parameters from the Profile. |
| 12116 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, pBssConfig, NULL); |
| 12117 | if(HAL_STATUS_SUCCESS(status)) |
| 12118 | { |
| 12119 | //save dotMode |
| 12120 | pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 12121 | //Prepare some more parameters for this IBSS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12122 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12123 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 12124 | NULL, pBssConfig, |
| 12125 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12126 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12127 | |
| 12128 | vos_mem_free(pBssConfig); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12129 | }//Allocate memory |
| 12130 | } |
| 12131 | |
| 12132 | if(pfSameIbss) |
| 12133 | { |
| 12134 | *pfSameIbss = fSameIbss; |
| 12135 | } |
| 12136 | return( status ); |
| 12137 | } |
| 12138 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12139 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 12140 | tSirSmeNewBssInfo *pNewBss ) |
| 12141 | { |
| 12142 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12143 | |
| 12144 | if(!pSession) |
| 12145 | { |
| 12146 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12147 | return; |
| 12148 | } |
| 12149 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12150 | if( pNewBss ) |
| 12151 | { |
| 12152 | // Set the operating channel. |
| 12153 | pSession->connectedProfile.operationChannel = pNewBss->channelNumber; |
| 12154 | // move the BSSId from the BSS description into the connected state information. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12155 | vos_mem_copy(&pSession->connectedProfile.bssid, &(pNewBss->bssId), |
| 12156 | sizeof( tCsrBssid )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12157 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12158 | return; |
| 12159 | } |
| 12160 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12161 | #ifdef FEATURE_WLAN_WAPI |
| 12162 | eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 12163 | tANI_U32 numItems ) |
| 12164 | { |
| 12165 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12166 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12167 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12168 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12169 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12170 | return status; |
| 12171 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12172 | smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12173 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12174 | if(numItems <= CSR_MAX_BKID_ALLOWED) |
| 12175 | { |
| 12176 | status = eHAL_STATUS_SUCCESS; |
| 12177 | //numItems may be 0 to clear the cache |
| 12178 | pSession->NumBkidCache = (tANI_U16)numItems; |
| 12179 | if(numItems && pBKIDCache) |
| 12180 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12181 | vos_mem_copy(pSession->BkidCacheInfo, pBKIDCache, |
| 12182 | sizeof(tBkidCacheInfo) * numItems); |
| 12183 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12184 | } |
| 12185 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12186 | return (status); |
| 12187 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12188 | eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, |
| 12189 | tBkidCacheInfo *pBkidCache) |
| 12190 | { |
| 12191 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12192 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12193 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12194 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12195 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12196 | return status; |
| 12197 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12198 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12199 | if(pNum && pBkidCache) |
| 12200 | { |
| 12201 | if(pSession->NumBkidCache == 0) |
| 12202 | { |
| 12203 | *pNum = 0; |
| 12204 | status = eHAL_STATUS_SUCCESS; |
| 12205 | } |
| 12206 | else if(*pNum >= pSession->NumBkidCache) |
| 12207 | { |
Girish Gowli | 2c26e90 | 2014-10-20 22:18:17 +0530 | [diff] [blame] | 12208 | if(pSession->NumBkidCache > CSR_MAX_BKID_ALLOWED) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12209 | { |
Girish Gowli | 2c26e90 | 2014-10-20 22:18:17 +0530 | [diff] [blame] | 12210 | smsLog(pMac, LOGE, FL("NumBkidCache :%d is more than CSR_MAX_BKID_ALLOWED, resetting to CSR_MAX_BKID_ALLOWED"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12211 | pSession->NumBkidCache); |
Girish Gowli | 2c26e90 | 2014-10-20 22:18:17 +0530 | [diff] [blame] | 12212 | pSession->NumBkidCache = CSR_MAX_BKID_ALLOWED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12213 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12214 | vos_mem_copy(pBkidCache, pSession->BkidCacheInfo, |
| 12215 | sizeof(tBkidCacheInfo) * pSession->NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12216 | *pNum = pSession->NumBkidCache; |
| 12217 | status = eHAL_STATUS_SUCCESS; |
| 12218 | } |
| 12219 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12220 | return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12221 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12222 | tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12223 | { |
| 12224 | return (pMac->roam.roamSession[sessionId].NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12225 | } |
| 12226 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12227 | eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12228 | tPmkidCacheInfo *pPMKIDCache, |
| 12229 | tANI_U32 numItems, |
| 12230 | tANI_BOOLEAN update_entire_cache ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12231 | { |
| 12232 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12233 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12234 | |
| 12235 | if (!pSession) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12236 | { |
| 12237 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12238 | return eHAL_STATUS_FAILURE; |
| 12239 | } |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12240 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12241 | smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d", numItems); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12242 | |
| 12243 | if (numItems <= CSR_MAX_PMKID_ALLOWED) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12244 | { |
| 12245 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 12246 | { |
| 12247 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12248 | vos_mem_set(&secEvent, |
| 12249 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12250 | secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE; |
| 12251 | secEvent.encryptionModeMulticast = |
| 12252 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 12253 | secEvent.encryptionModeUnicast = |
| 12254 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12255 | vos_mem_copy(secEvent.bssid, pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12256 | secEvent.authMode = |
| 12257 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 12258 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 12259 | } |
| 12260 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12261 | status = eHAL_STATUS_SUCCESS; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12262 | if (update_entire_cache) { |
| 12263 | pSession->NumPmkidCache = (tANI_U16)numItems; |
| 12264 | if (numItems && pPMKIDCache) |
| 12265 | { |
| 12266 | vos_mem_copy(pSession->PmkidCacheInfo, pPMKIDCache, |
| 12267 | sizeof(tPmkidCacheInfo) * numItems); |
| 12268 | } |
| 12269 | } else { |
| 12270 | tANI_U32 i = 0, j = 0; |
| 12271 | tANI_U8 BSSIDMatched = 0; |
| 12272 | tPmkidCacheInfo *pmksa; |
| 12273 | |
| 12274 | for (i = 0; i < numItems; i++) { |
| 12275 | pmksa = &pPMKIDCache[i]; |
| 12276 | for (j = 0; j < CSR_MAX_PMKID_ALLOWED; j++) { |
| 12277 | if (vos_mem_compare(pSession->PmkidCacheInfo[j].BSSID, |
| 12278 | pmksa->BSSID, VOS_MAC_ADDR_SIZE)) { |
| 12279 | /* If a matching BSSID found, update it */ |
| 12280 | BSSIDMatched = 1; |
| 12281 | vos_mem_copy(pSession->PmkidCacheInfo[j].PMKID, |
| 12282 | pmksa->PMKID, CSR_RSN_PMKID_SIZE); |
| 12283 | break; |
| 12284 | } |
| 12285 | } |
| 12286 | |
| 12287 | if (!BSSIDMatched) { |
| 12288 | vos_mem_copy( |
| 12289 | pSession->PmkidCacheInfo[pSession->NumPmkidCache].BSSID, |
| 12290 | pmksa->BSSID, VOS_MAC_ADDR_SIZE); |
| 12291 | vos_mem_copy( |
| 12292 | pSession->PmkidCacheInfo[pSession->NumPmkidCache].PMKID, |
| 12293 | pmksa->PMKID, CSR_RSN_PMKID_SIZE); |
| 12294 | /* Increment the CSR local cache index */ |
| 12295 | if (pSession->NumPmkidCache < (CSR_MAX_PMKID_ALLOWED - 1)) |
| 12296 | pSession->NumPmkidCache++; |
| 12297 | else |
| 12298 | pSession->NumPmkidCache = 0; |
| 12299 | } |
| 12300 | BSSIDMatched = 0; |
| 12301 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12302 | } |
| 12303 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12304 | return (status); |
| 12305 | } |
| 12306 | |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 12307 | eHalStatus csrRoamDelPMKIDfromCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12308 | tANI_U8 *pBSSId, |
| 12309 | tANI_BOOLEAN flush_cache ) |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 12310 | { |
| 12311 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12312 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12313 | tANI_BOOLEAN fMatchFound = FALSE; |
| 12314 | tANI_U32 Index; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12315 | |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 12316 | if(!pSession) |
| 12317 | { |
| 12318 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12319 | return eHAL_STATUS_FAILURE; |
| 12320 | } |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12321 | |
| 12322 | /* Check if there are no entries to delete */ |
| 12323 | if (0 == pSession->NumPmkidCache) { |
| 12324 | smsLog(pMac, LOG1, FL("No entries to delete/Flush")); |
| 12325 | return eHAL_STATUS_SUCCESS; |
| 12326 | } |
| 12327 | |
| 12328 | if (!flush_cache) { |
| 12329 | for (Index = 0; Index < CSR_MAX_PMKID_ALLOWED; Index++) { |
| 12330 | if (vos_mem_compare(pSession->PmkidCacheInfo[Index].BSSID, |
| 12331 | pBSSId, VOS_MAC_ADDR_SIZE)) { |
| 12332 | fMatchFound = 1; |
| 12333 | |
| 12334 | /* Clear this - the matched entry */ |
| 12335 | vos_mem_zero(&pSession->PmkidCacheInfo[Index], |
| 12336 | sizeof(tPmkidCacheInfo)); |
| 12337 | status = eHAL_STATUS_SUCCESS; |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 12338 | break; |
| 12339 | } |
| 12340 | } |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12341 | |
| 12342 | if (Index == CSR_MAX_PMKID_ALLOWED && !fMatchFound) { |
| 12343 | smsLog(pMac, LOG1, FL("No such PMKSA entry exists "MAC_ADDRESS_STR), |
| 12344 | MAC_ADDR_ARRAY(pBSSId)); |
| 12345 | return status; |
| 12346 | } |
| 12347 | |
| 12348 | return status; |
| 12349 | } else { |
| 12350 | /* Flush the entire cache */ |
| 12351 | vos_mem_zero(pSession->PmkidCacheInfo, |
| 12352 | sizeof(tPmkidCacheInfo) * CSR_MAX_PMKID_ALLOWED); |
| 12353 | pSession->NumPmkidCache = 0; |
| 12354 | return eHAL_STATUS_SUCCESS; |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 12355 | } |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 12356 | } |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 12357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12358 | tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12359 | { |
| 12360 | return (pMac->roam.roamSession[sessionId].NumPmkidCache); |
| 12361 | } |
| 12362 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12363 | eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache) |
| 12364 | { |
| 12365 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12366 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12367 | |
| 12368 | if(!pSession) |
| 12369 | { |
| 12370 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12371 | return eHAL_STATUS_FAILURE; |
| 12372 | } |
| 12373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12374 | if(pNum && pPmkidCache) |
| 12375 | { |
| 12376 | if(pSession->NumPmkidCache == 0) |
| 12377 | { |
| 12378 | *pNum = 0; |
| 12379 | status = eHAL_STATUS_SUCCESS; |
| 12380 | } |
| 12381 | else if(*pNum >= pSession->NumPmkidCache) |
| 12382 | { |
| 12383 | if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) |
| 12384 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12385 | 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] | 12386 | pSession->NumPmkidCache); |
| 12387 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 12388 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12389 | vos_mem_copy(pPmkidCache, pSession->PmkidCacheInfo, |
| 12390 | sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12391 | *pNum = pSession->NumPmkidCache; |
| 12392 | status = eHAL_STATUS_SUCCESS; |
| 12393 | } |
| 12394 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12395 | return (status); |
| 12396 | } |
| 12397 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12398 | eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 12399 | { |
| 12400 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12401 | tANI_U32 len; |
| 12402 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12403 | |
| 12404 | if(!pSession) |
| 12405 | { |
| 12406 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12407 | return eHAL_STATUS_FAILURE; |
| 12408 | } |
| 12409 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12410 | if(pLen) |
| 12411 | { |
| 12412 | len = *pLen; |
| 12413 | *pLen = pSession->nWpaRsnReqIeLength; |
| 12414 | if(pBuf) |
| 12415 | { |
| 12416 | if(len >= pSession->nWpaRsnReqIeLength) |
| 12417 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12418 | vos_mem_copy(pBuf, pSession->pWpaRsnReqIE, |
| 12419 | pSession->nWpaRsnReqIeLength); |
| 12420 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12421 | } |
| 12422 | } |
| 12423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12424 | return (status); |
| 12425 | } |
| 12426 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12427 | eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 12428 | { |
| 12429 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12430 | tANI_U32 len; |
| 12431 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12432 | |
| 12433 | if(!pSession) |
| 12434 | { |
| 12435 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12436 | return eHAL_STATUS_FAILURE; |
| 12437 | } |
| 12438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12439 | if(pLen) |
| 12440 | { |
| 12441 | len = *pLen; |
| 12442 | *pLen = pSession->nWpaRsnRspIeLength; |
| 12443 | if(pBuf) |
| 12444 | { |
| 12445 | if(len >= pSession->nWpaRsnRspIeLength) |
| 12446 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12447 | vos_mem_copy(pBuf, pSession->pWpaRsnRspIE, |
| 12448 | pSession->nWpaRsnRspIeLength); |
| 12449 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12450 | } |
| 12451 | } |
| 12452 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12453 | return (status); |
| 12454 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12455 | #ifdef FEATURE_WLAN_WAPI |
| 12456 | eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 12457 | { |
| 12458 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12459 | tANI_U32 len; |
| 12460 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12461 | |
| 12462 | if(!pSession) |
| 12463 | { |
| 12464 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12465 | return eHAL_STATUS_FAILURE; |
| 12466 | } |
| 12467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12468 | if(pLen) |
| 12469 | { |
| 12470 | len = *pLen; |
| 12471 | *pLen = pSession->nWapiReqIeLength; |
| 12472 | if(pBuf) |
| 12473 | { |
| 12474 | if(len >= pSession->nWapiReqIeLength) |
| 12475 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12476 | vos_mem_copy(pBuf, pSession->pWapiReqIE, |
| 12477 | pSession->nWapiReqIeLength); |
| 12478 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12479 | } |
| 12480 | } |
| 12481 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12482 | return (status); |
| 12483 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12484 | eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 12485 | { |
| 12486 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12487 | tANI_U32 len; |
| 12488 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12489 | |
| 12490 | if(!pSession) |
| 12491 | { |
| 12492 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12493 | return eHAL_STATUS_FAILURE; |
| 12494 | } |
| 12495 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12496 | if(pLen) |
| 12497 | { |
| 12498 | len = *pLen; |
| 12499 | *pLen = pSession->nWapiRspIeLength; |
| 12500 | if(pBuf) |
| 12501 | { |
| 12502 | if(len >= pSession->nWapiRspIeLength) |
| 12503 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12504 | vos_mem_copy(pBuf, pSession->pWapiRspIE, |
| 12505 | pSession->nWapiRspIeLength); |
| 12506 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12507 | } |
| 12508 | } |
| 12509 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12510 | return (status); |
| 12511 | } |
| 12512 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12513 | eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12514 | { |
| 12515 | eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION; |
| 12516 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12517 | |
| 12518 | if(!pSession) |
| 12519 | { |
| 12520 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12521 | return (retStatus); |
| 12522 | } |
| 12523 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12524 | if(CSR_IS_ROAMING(pSession)) |
| 12525 | { |
| 12526 | retStatus = eCSR_ROAM_ROAMING_COMPLETION; |
| 12527 | pSession->fRoaming = eANI_BOOLEAN_FALSE; |
| 12528 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12529 | return (retStatus); |
| 12530 | } |
| 12531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12532 | //This function remove the connected BSS from te cached scan result |
| 12533 | eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac, |
| 12534 | tCsrRoamConnectedProfile *pConnProfile) |
| 12535 | { |
| 12536 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12537 | tCsrScanResultFilter *pScanFilter = NULL; |
| 12538 | tListElem *pEntry; |
| 12539 | tCsrScanResult *pResult; |
| 12540 | tDot11fBeaconIEs *pIes; |
| 12541 | tANI_BOOLEAN fMatch; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12542 | if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) || |
| 12543 | csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid))) |
| 12544 | { |
| 12545 | do |
| 12546 | { |
| 12547 | //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] | 12548 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 12549 | if ( NULL == pScanFilter ) |
| 12550 | status = eHAL_STATUS_FAILURE; |
| 12551 | else |
| 12552 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12553 | if(!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12554 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
| 12555 | pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tCsrBssid)); |
| 12556 | if ( NULL == pScanFilter->BSSIDs.bssid ) |
| 12557 | status = eHAL_STATUS_FAILURE; |
| 12558 | else |
| 12559 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12560 | if(!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12561 | vos_mem_copy(pScanFilter->BSSIDs.bssid, &pConnProfile->bssid, |
| 12562 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12563 | pScanFilter->BSSIDs.numOfBSSIDs = 1; |
| 12564 | if(!csrIsNULLSSID(pConnProfile->SSID.ssId, pConnProfile->SSID.length)) |
| 12565 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12566 | pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); |
| 12567 | if ( NULL == pScanFilter->SSIDs.SSIDList ) |
| 12568 | status = eHAL_STATUS_FAILURE; |
| 12569 | else |
| 12570 | status = eHAL_STATUS_SUCCESS; |
| 12571 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12572 | vos_mem_copy(&pScanFilter->SSIDs.SSIDList[0].SSID, |
| 12573 | &pConnProfile->SSID, sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12574 | } |
| 12575 | pScanFilter->authType.numEntries = 1; |
| 12576 | pScanFilter->authType.authType[0] = pConnProfile->AuthType; |
| 12577 | pScanFilter->BSSType = pConnProfile->BSSType; |
| 12578 | pScanFilter->EncryptionType.numEntries = 1; |
| 12579 | pScanFilter->EncryptionType.encryptionType[0] = pConnProfile->EncryptionType; |
| 12580 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 12581 | pScanFilter->mcEncryptionType.encryptionType[0] = pConnProfile->mcEncryptionType; |
| 12582 | //We ignore the channel for now, BSSID should be enough |
| 12583 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 12584 | //Also ignore the following fields |
| 12585 | pScanFilter->uapsd_mask = 0; |
| 12586 | pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 12587 | pScanFilter->bOSENAssociation = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12588 | pScanFilter->countryCode[0] = 0; |
| 12589 | pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12590 | csrLLLock(&pMac->scan.scanResultList); |
| 12591 | pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK ); |
| 12592 | while( pEntry ) |
| 12593 | { |
| 12594 | pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); |
| 12595 | pIes = (tDot11fBeaconIEs *)( pResult->Result.pvIes ); |
| 12596 | fMatch = csrMatchBSS(pMac, &pResult->Result.BssDescriptor, |
| 12597 | pScanFilter, NULL, NULL, NULL, &pIes); |
| 12598 | //Release the IEs allocated by csrMatchBSS is needed |
| 12599 | if( !pResult->Result.pvIes ) |
| 12600 | { |
| 12601 | //need to free the IEs since it is allocated by csrMatchBSS |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12602 | vos_mem_free(pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12603 | } |
| 12604 | if(fMatch) |
| 12605 | { |
| 12606 | //We found the one |
| 12607 | if( csrLLRemoveEntry(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK) ) |
| 12608 | { |
| 12609 | //Free the memory |
| 12610 | csrFreeScanResultEntry( pMac, pResult ); |
| 12611 | } |
| 12612 | break; |
| 12613 | } |
| 12614 | pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK); |
| 12615 | }//while |
| 12616 | csrLLUnlock(&pMac->scan.scanResultList); |
| 12617 | }while(0); |
| 12618 | if(pScanFilter) |
| 12619 | { |
| 12620 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12621 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12622 | } |
| 12623 | } |
| 12624 | return (status); |
| 12625 | } |
| 12626 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12627 | //BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12628 | eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId ) |
| 12629 | { |
| 12630 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12631 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12632 | for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 12633 | { |
| 12634 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 12635 | { |
| 12636 | if( csrIsConnStateIbss( pMac, sessionId ) || csrIsBTAMP( pMac, sessionId ) ) |
| 12637 | { |
| 12638 | //co-exist with IBSS or BT-AMP is not supported |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12639 | 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] | 12640 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 12641 | break; |
| 12642 | } |
| 12643 | if( csrIsConnStateInfra( pMac, sessionId ) ) |
| 12644 | { |
| 12645 | if( chnId && |
| 12646 | ( (tANI_U8)chnId != pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ) ) |
| 12647 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12648 | 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] | 12649 | chnId, pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ); |
| 12650 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 12651 | break; |
| 12652 | } |
| 12653 | } |
| 12654 | } |
| 12655 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12656 | return ( status ); |
| 12657 | } |
| 12658 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12659 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ) |
| 12660 | { |
| 12661 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12662 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12663 | tBssConfigParam bssConfig; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12664 | |
| 12665 | if(!pSession) |
| 12666 | { |
| 12667 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12668 | return eHAL_STATUS_FAILURE; |
| 12669 | } |
| 12670 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12671 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 12672 | { |
| 12673 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 12674 | } |
| 12675 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 12676 | { |
| 12677 | // Disassociate from the connected Infrastructure network... |
| 12678 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 12679 | } |
| 12680 | else |
| 12681 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12682 | //We don't expect Bt-AMP HDD not to disconnect the last connection first at this time. |
| 12683 | //Otherwise we need to add code to handle the |
| 12684 | //situation just like IBSS. Though for WDS station, we need to send disassoc to PE first then |
| 12685 | //send stop_bss to PE, before we can continue. |
| 12686 | VOS_ASSERT( !csrIsConnStateWds( pMac, sessionId ) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12687 | vos_mem_set(&bssConfig, sizeof(tBssConfigParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12688 | /* Assume HDD provide bssid in profile */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12689 | vos_mem_copy(&pSession->bssParams.bssid, pProfile->BSSIDs.bssid[0], |
| 12690 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12691 | // there is no Bss description before we start an WDS so we need |
| 12692 | // to adopt all Bss configuration parameters from the Profile. |
| 12693 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, &bssConfig, pBssDesc); |
| 12694 | if(HAL_STATUS_SUCCESS(status)) |
| 12695 | { |
| 12696 | //Save profile for late use |
| 12697 | csrFreeRoamProfile( pMac, sessionId ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12698 | pSession->pCurRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 12699 | if (pSession->pCurRoamProfile != NULL ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12700 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12701 | vos_mem_set(pSession->pCurRoamProfile, |
| 12702 | sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12703 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile); |
| 12704 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12705 | //Prepare some more parameters for this WDS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12706 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12707 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 12708 | NULL, &bssConfig, |
| 12709 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12710 | } |
| 12711 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12712 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12713 | return( status ); |
| 12714 | } |
| 12715 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12716 | ////////////////////Mail box |
| 12717 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12718 | //pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 12719 | //or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12720 | static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, |
| 12721 | tSirBssDescription *pBssDescription, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12722 | tANI_U8 *pBuf, tANI_U8 uapsdMask) |
| 12723 | { |
| 12724 | tCsrChannelSet channelGroup; |
| 12725 | tSirMacCapabilityInfo *pAP_capabilityInfo; |
| 12726 | tAniBool fTmp; |
| 12727 | tANI_BOOLEAN found = FALSE; |
| 12728 | tANI_U32 size = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12729 | tANI_S8 pwrLimit = 0; |
| 12730 | tANI_U16 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12731 | // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels) |
| 12732 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundPri |
| 12733 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecDown |
| 12734 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecUp |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12735 | // 802.11h |
| 12736 | //We can do this because it is in HOST CPU order for now. |
| 12737 | pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12738 | //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a |
| 12739 | if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType ) |
| 12740 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12741 | fTmp = (tAniBool)pal_cpu_to_be32(1); |
| 12742 | } |
| 12743 | else |
| 12744 | fTmp = (tAniBool)0; |
| 12745 | |
| 12746 | // corresponds to --- pMsg->spectrumMgtIndicator = ON; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12747 | vos_mem_copy(pBuf, (tANI_U8 *)&fTmp, sizeof(tAniBool)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12748 | pBuf += sizeof(tAniBool); |
| 12749 | *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12750 | found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12751 | // This is required for 11k test VoWiFi Ent: Test 2. |
| 12752 | // We need the power capabilities for Assoc Req. |
| 12753 | // This macro is provided by the halPhyCfg.h. We pick our |
| 12754 | // max and min capability by the halPhy provided macros |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12755 | pwrLimit = csrGetCfgMaxTxPower (pMac, pBssDescription->channelId); |
| 12756 | if (0 != pwrLimit) |
| 12757 | { |
| 12758 | *pBuf++ = pwrLimit; |
| 12759 | } |
| 12760 | else |
| 12761 | { |
| 12762 | *pBuf++ = MAX_STA_PWR_CAP_DBM; |
| 12763 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12764 | size = sizeof(pMac->roam.validChannelList); |
| 12765 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size))) |
| 12766 | { |
| 12767 | *pBuf++ = (tANI_U8)size; //tSirSupChnl->numChnl |
| 12768 | for ( i = 0; i < size; i++) |
| 12769 | { |
| 12770 | *pBuf++ = pMac->roam.validChannelList[ i ]; //tSirSupChnl->channelList[ i ] |
| 12771 | |
| 12772 | } |
| 12773 | } |
| 12774 | else |
| 12775 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12776 | smsLog(pMac, LOGE, FL("can not find any valid channel")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12777 | *pBuf++ = 0; //tSirSupChnl->numChnl |
| 12778 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12779 | //Check whether it is ok to enter UAPSD |
| 12780 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 12781 | if( btcIsReadyForUapsd(pMac) ) |
| 12782 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 12783 | { |
| 12784 | *pBuf++ = uapsdMask; |
| 12785 | } |
| 12786 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 12787 | else |
| 12788 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12789 | 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] | 12790 | *pBuf++ = 0; |
| 12791 | } |
| 12792 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 12793 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12794 | // move the entire BssDescription into the join request. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12795 | vos_mem_copy(pBuf, pBssDescription, |
| 12796 | pBssDescription->length + sizeof( pBssDescription->length )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12797 | pBuf += pBssDescription->length + sizeof( pBssDescription->length ); // update to new location |
| 12798 | } |
| 12799 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12800 | /* |
| 12801 | * The communication between HDD and LIM is thru mailbox (MB). |
| 12802 | * Both sides will access the data structure "tSirSmeJoinReq". |
| 12803 | * The rule is, while the components of "tSirSmeJoinReq" can be accessed in the regular way like tSirSmeJoinReq.assocType, this guideline |
| 12804 | * stops at component tSirRSNie; any acces to the components after tSirRSNie is forbidden because the space from tSirRSNie is quueezed |
| 12805 | * with the component "tSirBssDescription". And since the size of actual 'tSirBssDescription' varies, the receiving side (which is the routine |
| 12806 | * limJoinReqSerDes() of limSerDesUtils.cc) should keep in mind not to access the components DIRECTLY after tSirRSNie. |
| 12807 | */ |
| 12808 | eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12809 | tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes, tANI_U16 messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12810 | { |
| 12811 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12812 | tSirSmeJoinReq *pMsg; |
| 12813 | tANI_U8 *pBuf; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12814 | v_U8_t acm_mask = 0, uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12815 | tANI_U16 msgLen, wTmp, ieLen; |
| 12816 | tSirMacRateSet OpRateSet; |
| 12817 | tSirMacRateSet ExRateSet; |
| 12818 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12819 | tANI_U32 dwTmp; |
| 12820 | 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] | 12821 | tANI_U32 ucDot11Mode = 0; |
Abhishek Singh | cb4d15c | 2014-11-04 16:09:49 +0530 | [diff] [blame] | 12822 | tANI_U8 txBFCsnValue = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12823 | |
| 12824 | if(!pSession) |
| 12825 | { |
| 12826 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12827 | return eHAL_STATUS_FAILURE; |
| 12828 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12829 | /* To satisfy klockworks */ |
| 12830 | if (NULL == pBssDescription) |
| 12831 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12832 | smsLog(pMac, LOGE, FL(" pBssDescription is NULL")); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12833 | return eHAL_STATUS_FAILURE; |
| 12834 | } |
| 12835 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12836 | do { |
| 12837 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 12838 | pSession->joinFailStatusCode.reasonCode = 0; |
Rajesh Babu Prathipati | 20cdffa | 2014-07-01 22:24:59 +0530 | [diff] [blame] | 12839 | vos_mem_copy (&pSession->joinFailStatusCode.bssId, &pBssDescription->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12840 | // There are a number of variable length fields to consider. First, the tSirSmeJoinReq |
| 12841 | // includes a single bssDescription. bssDescription includes a single tANI_U32 for the |
| 12842 | // IE fields, but the length field in the bssDescription needs to be interpreted to |
| 12843 | // determine length of the IE fields. |
| 12844 | // |
| 12845 | // So, take the size of the JoinReq, subtract the size of the bssDescription and |
| 12846 | // add in the length from the bssDescription (then add the size of the 'length' field |
| 12847 | // itself because that is NOT included in the length field). |
| 12848 | msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + |
| 12849 | pBssDescription->length + sizeof( pBssDescription->length ) + |
| 12850 | 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] | 12851 | pMsg = vos_mem_malloc(msgLen); |
| 12852 | if (NULL == pMsg) |
| 12853 | status = eHAL_STATUS_FAILURE; |
| 12854 | else |
| 12855 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12856 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12857 | vos_mem_set(pMsg, msgLen , 0); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12858 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)messageType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12859 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 12860 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12861 | // sessionId |
| 12862 | *pBuf = (tANI_U8)sessionId; |
| 12863 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12864 | // transactionId |
| 12865 | *pBuf = 0; |
| 12866 | *( pBuf + 1 ) = 0; |
| 12867 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12868 | // ssId |
| 12869 | if( pIes->SSID.present && pIes->SSID.num_ssid ) |
| 12870 | { |
| 12871 | // ssId len |
| 12872 | *pBuf = pIes->SSID.num_ssid; |
| 12873 | pBuf++; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12874 | vos_mem_copy(pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12875 | pBuf += pIes->SSID.num_ssid; |
| 12876 | } |
| 12877 | else |
| 12878 | { |
| 12879 | *pBuf = 0; |
| 12880 | pBuf++; |
| 12881 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12882 | // selfMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12883 | vos_mem_copy((tSirMacAddr *)pBuf, &pSession->selfMacAddr, |
| 12884 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12885 | pBuf += sizeof(tSirMacAddr); |
| 12886 | // bsstype |
| 12887 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) ); |
| 12888 | 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] | 12889 | vos_mem_copy(pBuf, &dwTmp, sizeof(tSirBssType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12890 | pBuf += sizeof(tSirBssType); |
| 12891 | // dot11mode |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 12892 | ucDot11Mode = csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode ); |
| 12893 | if (pBssDescription->channelId <= 14 && |
| 12894 | FALSE == pMac->roam.configParam.enableVhtFor24GHz && |
| 12895 | WNI_CFG_DOT11_MODE_11AC == ucDot11Mode) |
| 12896 | { |
| 12897 | //Need to disable VHT operation in 2.4 GHz band |
| 12898 | ucDot11Mode = WNI_CFG_DOT11_MODE_11N; |
| 12899 | } |
| 12900 | *pBuf = (tANI_U8)ucDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12901 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12902 | //Persona |
| 12903 | *pBuf = (tANI_U8)pProfile->csrPersona; |
| 12904 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12905 | //CBMode |
| 12906 | *pBuf = (tANI_U8)pSession->bssParams.cbMode; |
| 12907 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12908 | |
| 12909 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12910 | FL("CSR PERSONA=%d CSR CbMode %d"), pProfile->csrPersona, pSession->bssParams.cbMode); |
| 12911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12912 | // uapsdPerAcBitmask |
| 12913 | *pBuf = pProfile->uapsd_mask; |
| 12914 | pBuf++; |
| 12915 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12916 | |
| 12917 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12918 | status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12919 | if (HAL_STATUS_SUCCESS(status) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12920 | { |
| 12921 | // OperationalRateSet |
| 12922 | if (OpRateSet.numRates) { |
| 12923 | *pBuf++ = OpRateSet.numRates; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12924 | vos_mem_copy(pBuf, OpRateSet.rate, OpRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12925 | pBuf += OpRateSet.numRates; |
| 12926 | } else *pBuf++ = 0; |
| 12927 | // ExtendedRateSet |
| 12928 | if (ExRateSet.numRates) { |
| 12929 | *pBuf++ = ExRateSet.numRates; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12930 | vos_mem_copy(pBuf, ExRateSet.rate, ExRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12931 | pBuf += ExRateSet.numRates; |
| 12932 | } else *pBuf++ = 0; |
| 12933 | } |
| 12934 | else |
| 12935 | { |
| 12936 | *pBuf++ = 0; |
| 12937 | *pBuf++ = 0; |
| 12938 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12939 | // rsnIE |
| 12940 | if ( csrIsProfileWpa( pProfile ) ) |
| 12941 | { |
| 12942 | // Insert the Wpa IE into the join request |
| 12943 | ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes, |
| 12944 | (tCsrWpaIe *)( wpaRsnIE ) ); |
| 12945 | } |
| 12946 | else if( csrIsProfileRSN( pProfile ) ) |
| 12947 | { |
| 12948 | // Insert the RSN IE into the join request |
| 12949 | ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 12950 | (tCsrRSNIe *)( wpaRsnIE ) ); |
| 12951 | } |
| 12952 | #ifdef FEATURE_WLAN_WAPI |
| 12953 | else if( csrIsProfileWapi( pProfile ) ) |
| 12954 | { |
| 12955 | // Insert the WAPI IE into the join request |
| 12956 | ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 12957 | (tCsrWapiIe *)( wpaRsnIE ) ); |
| 12958 | } |
| 12959 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12960 | else |
| 12961 | { |
| 12962 | ieLen = 0; |
| 12963 | } |
| 12964 | //remember the IE for future use |
| 12965 | if( ieLen ) |
| 12966 | { |
| 12967 | if(ieLen > DOT11F_IE_RSN_MAX_LEN) |
| 12968 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12969 | 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] | 12970 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 12971 | } |
| 12972 | #ifdef FEATURE_WLAN_WAPI |
| 12973 | if( csrIsProfileWapi( pProfile ) ) |
| 12974 | { |
| 12975 | //Check whether we need to allocate more memory |
| 12976 | if(ieLen > pSession->nWapiReqIeLength) |
| 12977 | { |
| 12978 | if(pSession->pWapiReqIE && pSession->nWapiReqIeLength) |
| 12979 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12980 | vos_mem_free(pSession->pWapiReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12981 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12982 | pSession->pWapiReqIE = vos_mem_malloc(ieLen); |
| 12983 | if (NULL == pSession->pWapiReqIE) |
| 12984 | status = eHAL_STATUS_FAILURE; |
| 12985 | else |
| 12986 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12987 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12988 | } |
| 12989 | pSession->nWapiReqIeLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12990 | vos_mem_copy(pSession->pWapiReqIE, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12991 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12992 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12993 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12994 | vos_mem_copy(pBuf, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12995 | pBuf += ieLen; |
| 12996 | } |
| 12997 | else//should be WPA/WPA2 otherwise |
| 12998 | #endif /* FEATURE_WLAN_WAPI */ |
| 12999 | { |
| 13000 | //Check whether we need to allocate more memory |
| 13001 | if(ieLen > pSession->nWpaRsnReqIeLength) |
| 13002 | { |
| 13003 | if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength) |
| 13004 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13005 | vos_mem_free(pSession->pWpaRsnReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13006 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13007 | pSession->pWpaRsnReqIE = vos_mem_malloc(ieLen); |
| 13008 | if (NULL == pSession->pWpaRsnReqIE) |
| 13009 | status = eHAL_STATUS_FAILURE; |
| 13010 | else |
| 13011 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13012 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 13013 | } |
| 13014 | pSession->nWpaRsnReqIeLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13015 | vos_mem_copy(pSession->pWpaRsnReqIE, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13016 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13017 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13018 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13019 | vos_mem_copy(pBuf, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13020 | pBuf += ieLen; |
| 13021 | } |
| 13022 | } |
| 13023 | else |
| 13024 | { |
| 13025 | //free whatever old info |
| 13026 | pSession->nWpaRsnReqIeLength = 0; |
| 13027 | if(pSession->pWpaRsnReqIE) |
| 13028 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13029 | vos_mem_free(pSession->pWpaRsnReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13030 | pSession->pWpaRsnReqIE = NULL; |
| 13031 | } |
| 13032 | #ifdef FEATURE_WLAN_WAPI |
| 13033 | pSession->nWapiReqIeLength = 0; |
| 13034 | if(pSession->pWapiReqIE) |
| 13035 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13036 | vos_mem_free(pSession->pWapiReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13037 | pSession->pWapiReqIE = NULL; |
| 13038 | } |
| 13039 | #endif /* FEATURE_WLAN_WAPI */ |
| 13040 | //length is two bytes |
| 13041 | *pBuf = 0; |
| 13042 | *(pBuf + 1) = 0; |
| 13043 | pBuf += 2; |
| 13044 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13045 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13046 | if( eWNI_SME_JOIN_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13047 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13048 | // Never include the cckmIE in an Join Request |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13049 | //length is two bytes |
| 13050 | *pBuf = 0; |
| 13051 | *(pBuf + 1) = 0; |
| 13052 | pBuf += 2; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13053 | } |
| 13054 | else if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13055 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13056 | // cckmIE |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13057 | if( csrIsProfileESE( pProfile ) ) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13058 | { |
| 13059 | // Insert the CCKM IE into the join request |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13060 | #ifdef FEATURE_WLAN_ESE_UPLOAD |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 13061 | ieLen = pSession->suppCckmIeInfo.cckmIeLen; |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 13062 | vos_mem_copy((void *) (wpaRsnIE), |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 13063 | pSession->suppCckmIeInfo.cckmIe, ieLen); |
| 13064 | #else |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13065 | ieLen = csrConstructEseCckmIe( pMac, |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13066 | pSession, |
| 13067 | pProfile, |
| 13068 | pBssDescription, |
| 13069 | pSession->pWpaRsnReqIE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13070 | pSession->nWpaRsnReqIeLength, |
| 13071 | (void *)( wpaRsnIE ) ); |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13072 | #endif /* FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13073 | } |
| 13074 | else |
| 13075 | { |
| 13076 | ieLen = 0; |
| 13077 | } |
| 13078 | //If present, copy the IE into the eWNI_SME_REASSOC_REQ message buffer |
| 13079 | if( ieLen ) |
| 13080 | { |
| 13081 | //Copy the CCKM IE over from the temp buffer (wpaRsnIE) |
| 13082 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13083 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13084 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13085 | vos_mem_copy(pBuf, wpaRsnIE, ieLen); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13086 | pBuf += ieLen; |
| 13087 | } |
| 13088 | else |
| 13089 | { |
| 13090 | //Indicate you have no CCKM IE |
| 13091 | //length is two bytes |
| 13092 | *pBuf = 0; |
| 13093 | *(pBuf + 1) = 0; |
| 13094 | pBuf += 2; |
| 13095 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13096 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13097 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13098 | // addIEScan |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13099 | if (pProfile->nAddIEScanLength) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13100 | { |
| 13101 | ieLen = pProfile->nAddIEScanLength; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13102 | memset(pSession->addIEScan, 0 , pSession->nAddIEScanLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13103 | pSession->nAddIEScanLength = ieLen; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13104 | vos_mem_copy(pSession->addIEScan, pProfile->addIEScan, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13105 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13106 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13107 | pBuf += sizeof(tANI_U16); |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13108 | vos_mem_copy(pBuf, pProfile->addIEScan, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13109 | pBuf += ieLen; |
| 13110 | } |
| 13111 | else |
| 13112 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13113 | memset(pSession->addIEScan, 0, pSession->nAddIEScanLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13114 | pSession->nAddIEScanLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13115 | *pBuf = 0; |
| 13116 | *(pBuf + 1) = 0; |
| 13117 | pBuf += 2; |
| 13118 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13119 | // addIEAssoc |
| 13120 | if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) |
| 13121 | { |
| 13122 | ieLen = pProfile->nAddIEAssocLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13123 | if(ieLen > pSession->nAddIEAssocLength) |
| 13124 | { |
| 13125 | if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength) |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13126 | { |
| 13127 | vos_mem_free(pSession->pAddIEAssoc); |
| 13128 | } |
| 13129 | pSession->pAddIEAssoc = vos_mem_malloc(ieLen); |
| 13130 | if (NULL == pSession->pAddIEAssoc) |
| 13131 | status = eHAL_STATUS_FAILURE; |
| 13132 | else |
| 13133 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13134 | if(!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13135 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13136 | pSession->nAddIEAssocLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13137 | vos_mem_copy(pSession->pAddIEAssoc, pProfile->pAddIEAssoc, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13138 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13139 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13140 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13141 | vos_mem_copy(pBuf, pProfile->pAddIEAssoc, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13142 | pBuf += ieLen; |
| 13143 | } |
| 13144 | else |
| 13145 | { |
| 13146 | pSession->nAddIEAssocLength = 0; |
| 13147 | if(pSession->pAddIEAssoc) |
| 13148 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13149 | vos_mem_free(pSession->pAddIEAssoc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13150 | pSession->pAddIEAssoc = NULL; |
| 13151 | } |
| 13152 | *pBuf = 0; |
| 13153 | *(pBuf + 1) = 0; |
| 13154 | pBuf += 2; |
| 13155 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13156 | |
| 13157 | if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13158 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13159 | //Unmask any AC in reassoc that is ACM-set |
| 13160 | uapsd_mask = (v_U8_t)pProfile->uapsd_mask; |
| 13161 | if( uapsd_mask && ( NULL != pBssDescription ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13162 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13163 | if( CSR_IS_QOS_BSS(pIes) && CSR_IS_UAPSD_BSS(pIes) ) |
| 13164 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13165 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13166 | acm_mask = sme_QosGetACMMask(pMac, pBssDescription, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13167 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13168 | } |
| 13169 | else |
| 13170 | { |
| 13171 | uapsd_mask = 0; |
| 13172 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13173 | } |
| 13174 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13175 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13176 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13177 | vos_mem_copy(pBuf, &dwTmp, sizeof(tANI_U32)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13178 | pBuf += sizeof(tANI_U32); |
| 13179 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13180 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13181 | vos_mem_copy(pBuf, &dwTmp, sizeof(tANI_U32)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13182 | pBuf += sizeof(tANI_U32); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 13183 | #ifdef WLAN_FEATURE_11W |
| 13184 | //MgmtEncryption |
| 13185 | if (pProfile->MFPEnabled) |
| 13186 | { |
| 13187 | dwTmp = pal_cpu_to_be32(eSIR_ED_AES_128_CMAC); |
| 13188 | } |
| 13189 | else |
| 13190 | { |
| 13191 | dwTmp = pal_cpu_to_be32(eSIR_ED_NONE); |
| 13192 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13193 | vos_mem_copy(pBuf, &dwTmp, sizeof(tANI_U32)); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 13194 | pBuf += sizeof(tANI_U32); |
| 13195 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13196 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13197 | pProfile->MDID.mdiePresent = pBssDescription->mdiePresent; |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 13198 | if (csrIsProfile11r( pProfile ) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13199 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 09dd66b | 2013-04-01 17:13:01 +0530 | [diff] [blame] | 13200 | && !((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) && |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13201 | (pIes->ESEVersion.present) && (pMac->roam.configParam.isEseIniFeatureEnabled)) |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 13202 | #endif |
| 13203 | ) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13204 | { |
| 13205 | // is11Rconnection; |
| 13206 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13207 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)) ; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13208 | pBuf += sizeof(tAniBool); |
| 13209 | } |
| 13210 | else |
| 13211 | { |
| 13212 | // is11Rconnection; |
| 13213 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13214 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13215 | pBuf += sizeof(tAniBool); |
| 13216 | } |
| 13217 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13218 | #ifdef FEATURE_WLAN_ESE |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 13219 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13220 | // isESEFeatureIniEnabled |
| 13221 | if (TRUE == pMac->roam.configParam.isEseIniFeatureEnabled) |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 13222 | { |
| 13223 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13224 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 13225 | pBuf += sizeof(tAniBool); |
| 13226 | } |
| 13227 | else |
| 13228 | { |
| 13229 | dwTmp = pal_cpu_to_be32(FALSE); |
Srinivas Girigowda | 1811278 | 2013-11-27 12:21:19 -0800 | [diff] [blame] | 13230 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 13231 | pBuf += sizeof(tAniBool); |
| 13232 | } |
| 13233 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13234 | /* A profile can not be both ESE and 11R. But an 802.11R AP |
| 13235 | * may be advertising support for ESE as well. So if we are |
| 13236 | * associating Open or explicitly ESE then we will get ESE. |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13237 | * If we are associating explictly 11R only then we will get |
| 13238 | * 11R. |
| 13239 | */ |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13240 | if ((csrIsProfileESE(pProfile) || |
| 13241 | ((pIes->ESEVersion.present) |
Sachin Ahuja | 23ff119 | 2014-10-06 22:02:45 +0530 | [diff] [blame] | 13242 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 13243 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 13244 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 13245 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
| 13246 | #ifdef WLAN_FEATURE_11W |
| 13247 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
Abhishek Singh | 83080e0 | 2014-11-07 12:04:16 +0530 | [diff] [blame] | 13248 | || (pProfile->negotiatedAuthType == |
| 13249 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) |
Sachin Ahuja | 23ff119 | 2014-10-06 22:02:45 +0530 | [diff] [blame] | 13250 | #endif |
| 13251 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13252 | && (pMac->roam.configParam.isEseIniFeatureEnabled)) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13253 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13254 | // isESEconnection; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13255 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13256 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13257 | pBuf += sizeof(tAniBool); |
| 13258 | } |
| 13259 | else |
| 13260 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13261 | //isESEconnection; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13262 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13263 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13264 | pBuf += sizeof(tAniBool); |
| 13265 | } |
| 13266 | |
| 13267 | if (eWNI_SME_JOIN_REQ == messageType) |
| 13268 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13269 | tESETspecInfo eseTspec; |
| 13270 | // ESE-Tspec IEs in the ASSOC request is presently not supported |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13271 | // so nullify the TSPEC parameters |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13272 | vos_mem_set(&eseTspec, sizeof(tESETspecInfo), 0); |
| 13273 | vos_mem_copy(pBuf, &eseTspec, sizeof(tESETspecInfo)); |
| 13274 | pBuf += sizeof(tESETspecInfo); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13275 | } |
| 13276 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 13277 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13278 | if ((csrIsProfileESE(pProfile) || |
| 13279 | ((pIes->ESEVersion.present) |
Sachin Ahuja | 23ff119 | 2014-10-06 22:02:45 +0530 | [diff] [blame] | 13280 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 13281 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 13282 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 13283 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
| 13284 | #ifdef WLAN_FEATURE_11W |
| 13285 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
Abhishek Singh | 83080e0 | 2014-11-07 12:04:16 +0530 | [diff] [blame] | 13286 | || (pProfile->negotiatedAuthType == |
| 13287 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) |
Sachin Ahuja | 23ff119 | 2014-10-06 22:02:45 +0530 | [diff] [blame] | 13288 | #endif |
| 13289 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13290 | && (pMac->roam.configParam.isEseIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13291 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13292 | tESETspecInfo eseTspec; |
| 13293 | // ESE Tspec information |
| 13294 | vos_mem_set(&eseTspec, sizeof(tESETspecInfo), 0); |
| 13295 | eseTspec.numTspecs = sme_QosESERetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &eseTspec.tspec[0]); |
| 13296 | *pBuf = eseTspec.numTspecs; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13297 | pBuf += sizeof(tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13298 | // Copy the TSPEC information only if present |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13299 | if (eseTspec.numTspecs) { |
| 13300 | vos_mem_copy(pBuf, (void*)&eseTspec.tspec[0], |
| 13301 | (eseTspec.numTspecs*sizeof(tTspecInfo))); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13302 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13303 | pBuf += sizeof(eseTspec.tspec); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13304 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13305 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13306 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13307 | tESETspecInfo eseTspec; |
| 13308 | // ESE-Tspec IEs in the ASSOC request is presently not supported |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13309 | // so nullify the TSPEC parameters |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13310 | vos_mem_set(&eseTspec, sizeof(tESETspecInfo), 0); |
| 13311 | vos_mem_copy(pBuf, &eseTspec, sizeof(tESETspecInfo)); |
| 13312 | pBuf += sizeof(tESETspecInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13313 | } |
| 13314 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13315 | #endif // FEATURE_WLAN_ESE |
| 13316 | #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] | 13317 | // Fill in isFastTransitionEnabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13318 | if (pMac->roam.configParam.isFastTransitionEnabled |
| 13319 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 13320 | || csrRoamIsFastRoamEnabled(pMac, sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 13321 | #endif |
| 13322 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13323 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13324 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13325 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13326 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13327 | } |
| 13328 | else |
| 13329 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13330 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13331 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13332 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13333 | } |
| 13334 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 13335 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 13336 | if(csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 13337 | { |
| 13338 | //legacy fast roaming enabled |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13339 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13340 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13341 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 13342 | } |
| 13343 | else |
| 13344 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13345 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13346 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13347 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 13348 | } |
| 13349 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13350 | |
| 13351 | // txLdpcIniFeatureEnabled |
| 13352 | *pBuf = (tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 13353 | pBuf++; |
| 13354 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 13355 | if ((csrIs11hSupported (pMac)) && (CSR_IS_CHANNEL_5GHZ(pBssDescription->channelId)) && |
| 13356 | (pIes->Country.present) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)) |
| 13357 | { |
| 13358 | csrSaveToChannelPower2G_5G( pMac, pIes->Country.num_triplets * sizeof(tSirMacChanInfo), |
| 13359 | (tSirMacChanInfo *)(&pIes->Country.triplets[0]) ); |
| 13360 | csrApplyPower2Current(pMac); |
| 13361 | } |
| 13362 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 13363 | #ifdef WLAN_FEATURE_11AC |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 13364 | // txBFIniFeatureEnabled |
| 13365 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFEnable; |
| 13366 | pBuf++; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 13367 | |
| 13368 | // txBFCsnValue |
Abhishek Singh | cb4d15c | 2014-11-04 16:09:49 +0530 | [diff] [blame] | 13369 | txBFCsnValue = (tANI_U8)pMac->roam.configParam.txBFCsnValue; |
| 13370 | if (pIes->VHTCaps.present) |
| 13371 | { |
| 13372 | txBFCsnValue = CSR_ROAM_MIN(txBFCsnValue, pIes->VHTCaps.numSoundingDim); |
| 13373 | } |
| 13374 | *pBuf = txBFCsnValue; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 13375 | pBuf++; |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 13376 | |
| 13377 | /* Only enable MuBf if no other MuBF session exist |
| 13378 | * and FW and HOST is MuBF capable. |
| 13379 | */ |
| 13380 | if ( IS_MUMIMO_BFORMEE_CAPABLE && (FALSE == pMac->isMuBfsessionexist) ) |
| 13381 | { |
| 13382 | *pBuf = (tANI_U8)pMac->roam.configParam.txMuBformee; |
| 13383 | pBuf++; |
| 13384 | } |
| 13385 | else |
| 13386 | { |
| 13387 | *pBuf = 0; |
| 13388 | pBuf++; |
| 13389 | } |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 13390 | #endif |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 13391 | *pBuf = (tANI_U8)pMac->roam.configParam.isAmsduSupportInAMPDU; |
| 13392 | pBuf++; |
| 13393 | |
Sandeep Puligilla | aea98a2 | 2013-12-04 13:36:32 +0530 | [diff] [blame] | 13394 | // WME |
| 13395 | if(pMac->roam.roamSession[sessionId].fWMMConnection) |
| 13396 | { |
| 13397 | //WME enabled |
| 13398 | dwTmp = pal_cpu_to_be32(TRUE); |
| 13399 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
| 13400 | pBuf += sizeof(tAniBool); |
| 13401 | } |
| 13402 | else |
| 13403 | { |
| 13404 | dwTmp = pal_cpu_to_be32(FALSE); |
| 13405 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
| 13406 | pBuf += sizeof(tAniBool); |
| 13407 | } |
| 13408 | |
| 13409 | // QOS |
| 13410 | if(pMac->roam.roamSession[sessionId].fQOSConnection) |
| 13411 | { |
| 13412 | //QOS enabled |
| 13413 | dwTmp = pal_cpu_to_be32(TRUE); |
| 13414 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
| 13415 | pBuf += sizeof(tAniBool); |
| 13416 | } |
| 13417 | else |
| 13418 | { |
| 13419 | dwTmp = pal_cpu_to_be32(FALSE); |
| 13420 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
| 13421 | pBuf += sizeof(tAniBool); |
| 13422 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13423 | //BssDesc |
| 13424 | csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, |
| 13425 | (tANI_U8)pProfile->uapsd_mask); |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 13426 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13427 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
Girish Gowli | cc337b1 | 2014-07-31 19:10:35 +0530 | [diff] [blame] | 13428 | /* Memory allocated to pMsg will get free'd in palSendMBMessage */ |
| 13429 | pMsg = NULL; |
| 13430 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13431 | if(!HAL_STATUS_SUCCESS(status)) |
| 13432 | { |
| 13433 | break; |
| 13434 | } |
| 13435 | else |
| 13436 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13437 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13438 | if (eWNI_SME_JOIN_REQ == messageType) |
| 13439 | { |
| 13440 | //Tush-QoS: notify QoS module that join happening |
| 13441 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_JOIN_REQ, NULL); |
| 13442 | } |
| 13443 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 13444 | { |
| 13445 | //Tush-QoS: notify QoS module that reassoc happening |
| 13446 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_REASSOC_REQ, NULL); |
| 13447 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13448 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 13449 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13450 | } while( 0 ); |
Girish Gowli | cc337b1 | 2014-07-31 19:10:35 +0530 | [diff] [blame] | 13451 | |
| 13452 | if (pMsg != NULL) |
| 13453 | { |
| 13454 | vos_mem_free( pMsg ); |
| 13455 | } |
| 13456 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13457 | return( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13458 | } |
| 13459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13460 | // |
| 13461 | eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 13462 | { |
| 13463 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13464 | tSirSmeDisassocReq *pMsg; |
| 13465 | tANI_U8 *pBuf; |
| 13466 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13467 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13468 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 13469 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13470 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13471 | pMsg = vos_mem_malloc(sizeof(tSirSmeDisassocReq)); |
| 13472 | if (NULL == pMsg) |
| 13473 | status = eHAL_STATUS_FAILURE; |
| 13474 | else |
| 13475 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13476 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13477 | vos_mem_set(pMsg, sizeof( tSirSmeDisassocReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13478 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ); |
| 13479 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13480 | pBuf = &pMsg->sessionId; |
| 13481 | // sessionId |
| 13482 | *pBuf++ = (tANI_U8)sessionId; |
| 13483 | // transactionId |
| 13484 | *pBuf = 0; |
| 13485 | *( pBuf + 1 ) = 0; |
| 13486 | pBuf += sizeof(tANI_U16); |
| 13487 | |
Gopichand Nakkala | 06a7b3f | 2013-03-05 17:56:50 +0530 | [diff] [blame] | 13488 | if ( (pSession->pCurRoamProfile != NULL) && |
| 13489 | ((CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
| 13490 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13491 | { |
| 13492 | // Set the bssid address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13493 | vos_mem_copy((tSirMacAddr *)pBuf, pSession->selfMacAddr, |
| 13494 | sizeof( tSirMacAddr )); |
| 13495 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13496 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13497 | // Set the peer MAC address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13498 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr )); |
| 13499 | //perMacAddr is passed as bssId for softAP |
| 13500 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13501 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 13502 | } |
| 13503 | else |
| 13504 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13505 | // Set the peer MAC address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13506 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr )); |
| 13507 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13508 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13509 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId )); |
| 13510 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13511 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13512 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13513 | if(!HAL_STATUS_SUCCESS(status)) |
| 13514 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13515 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13516 | break; |
| 13517 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13518 | // reasonCode |
| 13519 | wTmp = pal_cpu_to_be16(reasonCode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13520 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
| 13521 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13522 | if(!HAL_STATUS_SUCCESS(status)) |
| 13523 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13524 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13525 | break; |
| 13526 | } |
| 13527 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13528 | /* The state will be DISASSOC_HANDOFF only when we are doing handoff. |
| 13529 | Here we should not send the disassoc over the air to the AP */ |
| 13530 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
| 13531 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 13532 | && csrRoamIs11rAssoc(pMac) |
| 13533 | #endif |
| 13534 | ) |
| 13535 | { |
| 13536 | *pBuf = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR; /* Set DoNotSendOverTheAir flag to 1 only for handoff case */ |
| 13537 | } |
| 13538 | pBuf += sizeof(tANI_U8); |
| 13539 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13540 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13541 | return( status ); |
| 13542 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13543 | eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId ) |
| 13544 | { |
| 13545 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13546 | tSirSmeTkipCntrMeasReq *pMsg; |
| 13547 | tANI_U8 *pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13548 | do |
| 13549 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13550 | pMsg = vos_mem_malloc(sizeof( tSirSmeTkipCntrMeasReq )); |
| 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( tSirSmeTkipCntrMeasReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13557 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ); |
| 13558 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13559 | pBuf = &pMsg->sessionId; |
| 13560 | // sessionId |
| 13561 | *pBuf++ = (tANI_U8)sessionId; |
| 13562 | // transactionId |
| 13563 | *pBuf = 0; |
| 13564 | *( pBuf + 1 ) = 0; |
| 13565 | pBuf += sizeof(tANI_U16); |
| 13566 | // bssid |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13567 | vos_mem_copy(pMsg->bssId, bssId, sizeof( tSirMacAddr )); |
| 13568 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13569 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 13570 | // bEnable |
| 13571 | *pBuf = (tANI_BOOLEAN)bEnable; |
| 13572 | if(!HAL_STATUS_SUCCESS(status)) |
| 13573 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13574 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13575 | break; |
| 13576 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13577 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13578 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13579 | return( status ); |
| 13580 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13581 | eHalStatus |
| 13582 | csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13583 | VOS_MODULE_ID modId, tSirMacAddr bssId, |
| 13584 | void *pUsrContext, void *pfnSapEventCallback, |
| 13585 | tANI_U8 *pAssocStasBuf ) |
| 13586 | { |
| 13587 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13588 | tSirSmeGetAssocSTAsReq *pMsg; |
| 13589 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 13590 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13591 | do |
| 13592 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13593 | pMsg = vos_mem_malloc(sizeof( tSirSmeGetAssocSTAsReq )); |
| 13594 | if ( NULL == pMsg ) |
| 13595 | status = eHAL_STATUS_FAILURE; |
| 13596 | else |
| 13597 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13598 | if (!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13599 | vos_mem_set(pMsg, sizeof( tSirSmeGetAssocSTAsReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13600 | 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] | 13601 | pBuf = (tANI_U8 *)&pMsg->bssId; |
| 13602 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13603 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13604 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13605 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13606 | // modId |
| 13607 | dwTmp = pal_cpu_to_be16((tANI_U16)modId); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13608 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13609 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13610 | // pUsrContext |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13611 | vos_mem_copy(pBuf, (tANI_U8 *)pUsrContext, sizeof(void *)); |
| 13612 | pBuf += sizeof(void*); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13613 | // pfnSapEventCallback |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13614 | vos_mem_copy(pBuf, (tANI_U8 *)pfnSapEventCallback, sizeof(void*)); |
| 13615 | pBuf += sizeof(void*); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13616 | // pAssocStasBuf |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13617 | vos_mem_copy(pBuf, pAssocStasBuf, sizeof(void*)); |
| 13618 | pBuf += sizeof(void*); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13619 | 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] | 13620 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13621 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13622 | return( status ); |
| 13623 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13624 | eHalStatus |
| 13625 | csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13626 | tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac) |
| 13627 | { |
| 13628 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13629 | tSirSmeGetWPSPBCSessionsReq *pMsg; |
| 13630 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13631 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13632 | do |
| 13633 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13634 | pMsg = vos_mem_malloc(sizeof(tSirSmeGetWPSPBCSessionsReq)); |
| 13635 | if ( NULL == pMsg ) |
| 13636 | status = eHAL_STATUS_FAILURE; |
| 13637 | else |
| 13638 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13639 | if (!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13640 | vos_mem_set(pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13641 | 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] | 13642 | pBuf = (tANI_U8 *)&pMsg->pUsrContext; |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 13643 | VOS_ASSERT(pBuf); |
| 13644 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13645 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13646 | // pUsrContext |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13647 | vos_mem_copy(pBuf, (tANI_U8 *)pUsrContext, sizeof(void*)); |
| 13648 | pBuf += sizeof(void *); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13649 | // pSapEventCallback |
krunal soni | 4f802b2 | 2014-02-11 17:01:13 -0800 | [diff] [blame] | 13650 | vos_mem_copy(pBuf, (tANI_U8 *)pfnSapEventCallback, sizeof(void *)); |
| 13651 | pBuf += sizeof(void *); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13652 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13653 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13654 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13655 | // MAC Address of STA in WPS session |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13656 | vos_mem_copy((tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13657 | pBuf += sizeof(v_MACADDR_t); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13658 | 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] | 13659 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13660 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13661 | return( status ); |
| 13662 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13663 | |
| 13664 | eHalStatus |
| 13665 | csrSendChngMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13666 | { |
| 13667 | tpSirChangeBIParams pMsg; |
| 13668 | tANI_U16 len = 0; |
| 13669 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13670 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13671 | |
| 13672 | if(!pSession) |
| 13673 | { |
| 13674 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13675 | return eHAL_STATUS_FAILURE; |
| 13676 | } |
| 13677 | |
| 13678 | //NO need to update the Beacon Params if update beacon parameter flag is not set |
| 13679 | if(!pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval ) |
| 13680 | return eHAL_STATUS_SUCCESS; |
| 13681 | |
| 13682 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE; |
| 13683 | |
| 13684 | /* Create the message and send to lim */ |
| 13685 | len = sizeof(tSirChangeBIParams); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13686 | pMsg = vos_mem_malloc(len); |
| 13687 | if ( NULL == pMsg ) |
| 13688 | status = eHAL_STATUS_FAILURE; |
| 13689 | else |
| 13690 | status = eHAL_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13691 | if(HAL_STATUS_SUCCESS(status)) |
| 13692 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13693 | vos_mem_set(pMsg, sizeof(tSirChangeBIParams), 0); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13694 | pMsg->messageType = eWNI_SME_CHNG_MCC_BEACON_INTERVAL; |
| 13695 | pMsg->length = len; |
| 13696 | |
| 13697 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13698 | vos_mem_copy((tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, |
| 13699 | sizeof(tSirMacAddr)); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 13700 | smsLog( pMac, LOG1, FL("CSR Attempting to change BI for Bssid= "MAC_ADDRESS_STR), |
| 13701 | MAC_ADDR_ARRAY(pMsg->bssId)); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13702 | pMsg->sessionId = sessionId; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13703 | 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] | 13704 | pMsg->beaconInterval = pMac->roam.roamSession[sessionId].bssParams.beaconInterval; |
| 13705 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 13706 | } |
| 13707 | return status; |
| 13708 | } |
| 13709 | |
Hardik Kantilal Patel | 62a3a76 | 2014-11-21 12:55:57 +0530 | [diff] [blame] | 13710 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 13711 | eHalStatus csrSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 cbMode) |
| 13712 | { |
| 13713 | tpSirSetHT2040Mode pMsg; |
| 13714 | tANI_U16 len = 0; |
| 13715 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13716 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13717 | |
| 13718 | if(!pSession) |
| 13719 | { |
| 13720 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13721 | return eHAL_STATUS_FAILURE; |
| 13722 | } |
| 13723 | |
| 13724 | /* Create the message and send to lim */ |
| 13725 | len = sizeof(tSirSetHT2040Mode); |
| 13726 | pMsg = vos_mem_malloc(len); |
| 13727 | |
| 13728 | if ( NULL == pMsg ) |
| 13729 | { |
| 13730 | smsLog( pMac, LOGE, FL("Memory Allocation Fail !!!")); |
| 13731 | status = eHAL_STATUS_FAILURE; |
| 13732 | } |
| 13733 | else |
| 13734 | status = eHAL_STATUS_SUCCESS; |
| 13735 | |
| 13736 | if(HAL_STATUS_SUCCESS(status)) |
| 13737 | { |
| 13738 | vos_mem_set(pMsg, sizeof(tSirSetHT2040Mode), 0); |
| 13739 | pMsg->messageType = eWNI_SME_SET_HT_2040_MODE; |
| 13740 | pMsg->length = len; |
| 13741 | |
| 13742 | // bssId |
| 13743 | vos_mem_copy((tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, |
| 13744 | sizeof(tSirMacAddr)); |
| 13745 | |
| 13746 | smsLog( pMac, LOGW, FL("CSR Attempting to set " |
| 13747 | "HT20/40 mode for Bssid= "MAC_ADDRESS_STR), |
| 13748 | MAC_ADDR_ARRAY(pMsg->bssId)); |
| 13749 | |
| 13750 | pMsg->sessionId = sessionId; |
| 13751 | pMsg->cbMode = cbMode; |
| 13752 | |
| 13753 | smsLog(pMac, LOGW, FL("session %d Channel Bonding: %d"), |
| 13754 | sessionId, cbMode); |
| 13755 | |
| 13756 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 13757 | } |
| 13758 | return status; |
| 13759 | } |
| 13760 | #endif |
| 13761 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13762 | eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 13763 | { |
| 13764 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13765 | tSirSmeDeauthReq *pMsg; |
| 13766 | tANI_U8 *pBuf; |
| 13767 | tANI_U16 wTmp; |
| 13768 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13769 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 13770 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13771 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13772 | pMsg = vos_mem_malloc(sizeof( tSirSmeDeauthReq )); |
| 13773 | if ( NULL == pMsg ) |
| 13774 | status = eHAL_STATUS_FAILURE; |
| 13775 | else |
| 13776 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13777 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13778 | vos_mem_set(pMsg, sizeof( tSirSmeDeauthReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13779 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_REQ); |
| 13780 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthReq )); |
| 13781 | //sessionId |
| 13782 | pBuf = &pMsg->sessionId; |
| 13783 | *pBuf++ = (tANI_U8)sessionId; |
| 13784 | |
| 13785 | //tansactionId |
| 13786 | *pBuf = 0; |
| 13787 | *(pBuf + 1 ) = 0; |
| 13788 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13789 | if ((pSession->pCurRoamProfile != NULL) && ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13790 | (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13791 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))){ |
| 13792 | // Set the BSSID before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13793 | vos_mem_copy( (tSirMacAddr *)pBuf, pSession->selfMacAddr, |
| 13794 | sizeof( pMsg->peerMacAddr ) ); |
| 13795 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13796 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 13797 | } |
| 13798 | else |
| 13799 | { |
| 13800 | // Set the BSSID before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13801 | vos_mem_copy( (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 13802 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13803 | pBuf = pBuf + sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13804 | } |
| 13805 | if(!HAL_STATUS_SUCCESS(status)) |
| 13806 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13807 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13808 | break; |
| 13809 | } |
| 13810 | // Set the peer MAC address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13811 | vos_mem_copy( (tSirMacAddr *) pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 13812 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13813 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 13814 | if(!HAL_STATUS_SUCCESS(status)) |
| 13815 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13816 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13817 | break; |
| 13818 | } |
| 13819 | wTmp = pal_cpu_to_be16(reasonCode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13820 | vos_mem_copy( pBuf, &wTmp,sizeof( tANI_U16 ) ); |
| 13821 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13822 | if(!HAL_STATUS_SUCCESS(status)) |
| 13823 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13824 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13825 | break; |
| 13826 | } |
| 13827 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13828 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13829 | return( status ); |
| 13830 | } |
| 13831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13832 | eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd ) |
| 13833 | { |
| 13834 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13835 | tSirSmeDisassocCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13836 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13837 | pMsg = vos_mem_malloc(sizeof( tSirSmeDisassocCnf )); |
| 13838 | if ( NULL == pMsg ) |
| 13839 | status = eHAL_STATUS_FAILURE; |
| 13840 | else |
| 13841 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13842 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13843 | vos_mem_set(pMsg, sizeof( tSirSmeDisassocCnf), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13844 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF); |
| 13845 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13846 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf )); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13847 | vos_mem_copy(pMsg->peerMacAddr, pDisassocInd->peerMacAddr, |
| 13848 | sizeof(pMsg->peerMacAddr)); |
| 13849 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13850 | if(!HAL_STATUS_SUCCESS(status)) |
| 13851 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13852 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13853 | break; |
| 13854 | } |
| 13855 | //To test reconn |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13856 | vos_mem_copy(pMsg->bssId, pDisassocInd->bssId, sizeof(pMsg->peerMacAddr)); |
| 13857 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13858 | if(!HAL_STATUS_SUCCESS(status)) |
| 13859 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13860 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13861 | break; |
| 13862 | } |
| 13863 | //To test reconn ends |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13864 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13865 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13866 | return( status ); |
| 13867 | } |
| 13868 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13869 | eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd ) |
| 13870 | { |
| 13871 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13872 | tSirSmeDeauthCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13873 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13874 | pMsg = vos_mem_malloc(sizeof( tSirSmeDeauthCnf )); |
| 13875 | if ( NULL == pMsg ) |
| 13876 | status = eHAL_STATUS_FAILURE; |
| 13877 | else |
| 13878 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13879 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13880 | vos_mem_set(pMsg, sizeof( tSirSmeDeauthCnf ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13881 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF); |
| 13882 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13883 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf )); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13884 | vos_mem_copy(pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId)); |
| 13885 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13886 | if(!HAL_STATUS_SUCCESS(status)) |
| 13887 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13888 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13889 | break; |
| 13890 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13891 | vos_mem_copy(pMsg->peerMacAddr, pDeauthInd->peerMacAddr, |
| 13892 | sizeof(pMsg->peerMacAddr)); |
| 13893 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13894 | if(!HAL_STATUS_SUCCESS(status)) |
| 13895 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13896 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13897 | break; |
| 13898 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13899 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13900 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13901 | return( status ); |
| 13902 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13903 | eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus ) |
| 13904 | { |
| 13905 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13906 | tSirSmeAssocCnf *pMsg; |
| 13907 | tANI_U8 *pBuf; |
| 13908 | tSirResultCodes statusCode; |
| 13909 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13910 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13911 | pMsg = vos_mem_malloc(sizeof( tSirSmeAssocCnf )); |
| 13912 | if ( NULL == pMsg ) |
| 13913 | status = eHAL_STATUS_FAILURE; |
| 13914 | else |
| 13915 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13916 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13917 | vos_mem_set(pMsg, sizeof( tSirSmeAssocCnf ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13918 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF); |
| 13919 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13920 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 13921 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 13922 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13923 | else |
| 13924 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13925 | vos_mem_copy(pBuf, &statusCode, sizeof(tSirResultCodes)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13926 | pBuf += sizeof(tSirResultCodes); |
| 13927 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13928 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 13929 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13930 | pBuf += sizeof (tSirMacAddr); |
| 13931 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13932 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, |
| 13933 | sizeof(tSirMacAddr)); |
| 13934 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13935 | pBuf += sizeof (tSirMacAddr); |
| 13936 | // aid |
| 13937 | wTmp = pal_cpu_to_be16(pAssocInd->aid); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13938 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13939 | pBuf += sizeof (tANI_U16); |
| 13940 | // alternateBssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13941 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 13942 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13943 | pBuf += sizeof (tSirMacAddr); |
| 13944 | // alternateChannelId |
| 13945 | *pBuf = 11; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13946 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13947 | if(!HAL_STATUS_SUCCESS(status)) |
| 13948 | { |
| 13949 | //pMsg is freed by palSendMBMessage |
| 13950 | break; |
| 13951 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13952 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13953 | return( status ); |
| 13954 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13955 | eHalStatus csrSendAssocIndToUpperLayerCnfMsg( tpAniSirGlobal pMac, |
| 13956 | tpSirSmeAssocInd pAssocInd, |
| 13957 | eHalStatus Halstatus, |
| 13958 | tANI_U8 sessionId) |
| 13959 | { |
| 13960 | tSirMsgQ msgQ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13961 | tSirSmeAssocIndToUpperLayerCnf *pMsg; |
| 13962 | tANI_U8 *pBuf; |
| 13963 | tSirResultCodes statusCode; |
| 13964 | tANI_U16 wTmp; |
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( tSirSmeAssocIndToUpperLayerCnf )); |
| 13967 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13968 | vos_mem_set(pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf ), 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13969 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13970 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF); |
| 13971 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 13972 | |
| 13973 | pMsg->sessionId = sessionId; |
| 13974 | |
| 13975 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 13976 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 13977 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13978 | else |
| 13979 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13980 | vos_mem_copy(pBuf, &statusCode, sizeof(tSirResultCodes)) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13981 | pBuf += sizeof(tSirResultCodes); |
| 13982 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13983 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13984 | pBuf += sizeof (tSirMacAddr); |
| 13985 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13986 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, |
| 13987 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13988 | pBuf += sizeof (tSirMacAddr); |
| 13989 | // StaId |
| 13990 | wTmp = pal_cpu_to_be16(pAssocInd->staId); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13991 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13992 | pBuf += sizeof (tANI_U16); |
| 13993 | // alternateBssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13994 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13995 | pBuf += sizeof (tSirMacAddr); |
| 13996 | // alternateChannelId |
| 13997 | *pBuf = 11; |
| 13998 | pBuf += sizeof (tANI_U8); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 13999 | // Instead of copying roam Info, we just copy only WmmEnabled, RsnIE information |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14000 | //Wmm |
| 14001 | *pBuf = pAssocInd->wmmEnabledSta; |
| 14002 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14003 | //RSN IE |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14004 | vos_mem_copy((tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14005 | pBuf += sizeof (tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14006 | //Additional IE |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14007 | vos_mem_copy((void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14008 | pBuf += sizeof (tSirAddie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14009 | //reassocReq |
| 14010 | *pBuf = pAssocInd->reassocReq; |
| 14011 | pBuf += sizeof (tANI_U8); |
Hardik Kantilal Patel | 1ba630f | 2014-11-21 04:32:05 +0530 | [diff] [blame] | 14012 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 14013 | // 40 MHz Intolerant |
| 14014 | *pBuf = pAssocInd->HT40MHzIntoEnabledSta; |
| 14015 | pBuf += sizeof (tANI_U8); |
| 14016 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14017 | msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 14018 | msgQ.bodyptr = pMsg; |
| 14019 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14020 | SysProcessMmhMsg(pMac, &msgQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14021 | } while( 0 ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14022 | return( eHAL_STATUS_SUCCESS ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14023 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14024 | |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14025 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14026 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 14027 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 14028 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 14029 | tANI_U8 *pKeyRsc ) |
| 14030 | { |
| 14031 | tSirSmeSetContextReq *pMsg; |
| 14032 | tANI_U16 msgLen; |
| 14033 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14034 | tAniEdType tmpEdType; |
| 14035 | tAniKeyDirection tmpDirection; |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 14036 | tANI_U8 *pBuf = NULL; |
| 14037 | tANI_U8 *p = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14038 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Sushant Kaushik | e7de85f | 2014-06-16 17:13:30 +0530 | [diff] [blame] | 14039 | smsLog( pMac, LOG1, FL("keylength is %d, Encry type is : %d"), |
| 14040 | keyLength, edType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14041 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14042 | if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14043 | // all of these fields appear in every SET_CONTEXT message. Below we'll add in the size for each |
| 14044 | // key set. Since we only support upto one key, we always allocate memory for 1 key |
| 14045 | msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) + |
| 14046 | sizeof( tSirMacAddr ) + 1 + sizeof(tANI_U16) + |
| 14047 | sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + |
| 14048 | ( sizeof( pMsg->keyMaterial.key ) ); |
| 14049 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14050 | pMsg = vos_mem_malloc(msgLen); |
| 14051 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 14052 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14053 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ); |
| 14054 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14055 | //sessionId |
| 14056 | pBuf = &pMsg->sessionId; |
| 14057 | *pBuf = (tANI_U8)sessionId; |
| 14058 | pBuf++; |
| 14059 | // transactionId |
| 14060 | *pBuf = 0; |
| 14061 | *(pBuf + 1) = 0; |
| 14062 | pBuf += sizeof(tANI_U16); |
| 14063 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14064 | vos_mem_copy(pBuf, (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14065 | |
| 14066 | pBuf += sizeof(tSirMacAddr); |
| 14067 | |
| 14068 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14069 | vos_mem_copy(pBuf, (tANI_U8 *)&pSession->connectedProfile.bssid, |
| 14070 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14071 | |
| 14072 | pBuf += sizeof(tSirMacAddr); |
| 14073 | |
| 14074 | p = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14075 | // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field |
| 14076 | // in the tSirKeyMaterial keyMaterial; field). |
| 14077 | // |
| 14078 | // !!NOTE: This keyMaterial.length contains the length of a MAX size key, though the keyLength can be |
| 14079 | // shorter than this max size. Is LIM interpreting this ok ? |
| 14080 | 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] | 14081 | // set pMsg->keyMaterial.edType |
| 14082 | tmpEdType = (tAniEdType)pal_cpu_to_be32(edType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14083 | vos_mem_copy(p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14084 | p += sizeof( pMsg->keyMaterial.edType ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14085 | // set the pMsg->keyMaterial.numKeys field |
| 14086 | *p = numKeys; |
| 14087 | p += sizeof( pMsg->keyMaterial.numKeys ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14088 | // set pSirKey->keyId = keyId; |
| 14089 | *p = keyId; |
| 14090 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14091 | // set pSirKey->unicast = (tANI_U8)fUnicast; |
| 14092 | *p = (tANI_U8)fUnicast; |
| 14093 | p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14094 | // set pSirKey->keyDirection = aniKeyDirection; |
| 14095 | tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14096 | vos_mem_copy(p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14097 | p += sizeof(tAniKeyDirection); |
| 14098 | // pSirKey->keyRsc = ;; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14099 | vos_mem_copy(p, pKeyRsc, CSR_MAX_RSC_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14100 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14101 | // set pSirKey->paeRole |
| 14102 | *p = paeRole; // 0 is Supplicant |
| 14103 | p++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14104 | // set pSirKey->keyLength = keyLength; |
| 14105 | p = pal_set_U16( p, pal_cpu_to_be16(keyLength) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14106 | if ( keyLength && pKey ) |
| 14107 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14108 | vos_mem_copy(p, pKey, keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14109 | if(keyLength == 16) |
| 14110 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14111 | 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] | 14112 | keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4], |
| 14113 | pKey[5], pKey[6], pKey[7], pKey[8], |
| 14114 | pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]); |
| 14115 | } |
| 14116 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14117 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14118 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14119 | return( status ); |
| 14120 | } |
| 14121 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14122 | eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, |
| 14123 | tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc ) |
| 14124 | { |
| 14125 | eHalStatus status; |
| 14126 | tSirSmeStartBssReq *pMsg; |
| 14127 | tANI_U8 *pBuf = NULL; |
| 14128 | tANI_U8 *wTmpBuf = NULL; |
| 14129 | tANI_U16 msgLen, wTmp; |
| 14130 | tANI_U32 dwTmp; |
| 14131 | tSirNwType nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14132 | ePhyChanBondState cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14133 | tANI_U32 authType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14134 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 14135 | |
| 14136 | if(!pSession) |
| 14137 | { |
| 14138 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 14139 | return eHAL_STATUS_FAILURE; |
| 14140 | } |
| 14141 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14142 | do { |
| 14143 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 14144 | pSession->joinFailStatusCode.reasonCode = 0; |
| 14145 | msgLen = sizeof(tSirSmeStartBssReq); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14146 | pMsg = vos_mem_malloc(msgLen); |
| 14147 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 14148 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14149 | 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] | 14150 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14151 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14152 | //sessionId |
| 14153 | *pBuf = (tANI_U8)sessionId; |
| 14154 | pBuf++; |
| 14155 | // transactionId |
| 14156 | *pBuf = 0; |
| 14157 | *(pBuf + 1) = 0; |
| 14158 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14159 | // bssid |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14160 | vos_mem_copy(pBuf, pParam->bssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14161 | pBuf += sizeof(tSirMacAddr); |
| 14162 | // selfMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14163 | vos_mem_copy(pBuf, pSession->selfMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14164 | pBuf += sizeof(tSirMacAddr); |
| 14165 | // beaconInterval |
| 14166 | if( pBssDesc && pBssDesc->beaconInterval ) |
| 14167 | { |
| 14168 | wTmp = pal_cpu_to_be16( pBssDesc->beaconInterval ); |
| 14169 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14170 | else if(pParam->beaconInterval) |
| 14171 | { |
| 14172 | wTmp = pal_cpu_to_be16( pParam->beaconInterval ); |
| 14173 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14174 | else |
| 14175 | { |
| 14176 | wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF ); |
| 14177 | } |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame] | 14178 | if(csrIsconcurrentsessionValid (pMac, sessionId, |
| 14179 | pParam->bssPersona) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14180 | == eHAL_STATUS_SUCCESS ) |
| 14181 | { |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 14182 | csrValidateMCCBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14183 | pParam->bssPersona); |
| 14184 | //Update the beacon Interval |
| 14185 | pParam->beaconInterval = wTmp; |
| 14186 | } |
| 14187 | else |
| 14188 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14189 | smsLog( pMac,LOGE, FL("****Start BSS failed persona already exists***")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14190 | status = eHAL_STATUS_FAILURE; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14191 | vos_mem_free(pMsg); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14192 | return status; |
| 14193 | } |
| 14194 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14195 | vos_mem_copy(pBuf, &wTmp, sizeof( tANI_U16 )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14196 | pBuf += sizeof(tANI_U16); |
| 14197 | // dot11mode |
| 14198 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pParam->uCfgDot11Mode ); |
| 14199 | pBuf += 1; |
| 14200 | // bssType |
| 14201 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( bssType ) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14202 | vos_mem_copy(pBuf, &dwTmp, sizeof(tSirBssType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14203 | pBuf += sizeof(tSirBssType); |
| 14204 | // ssId |
| 14205 | if( pParam->ssId.length ) |
| 14206 | { |
| 14207 | // ssId len |
| 14208 | *pBuf = pParam->ssId.length; |
| 14209 | pBuf++; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14210 | vos_mem_copy(pBuf, pParam->ssId.ssId, pParam->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14211 | pBuf += pParam->ssId.length; |
| 14212 | } |
| 14213 | else |
| 14214 | { |
| 14215 | *pBuf = 0; |
| 14216 | pBuf++; |
| 14217 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14218 | // set the channel Id |
| 14219 | *pBuf = pParam->operationChn; |
| 14220 | pBuf++; |
| 14221 | //What should we really do for the cbmode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14222 | cbMode = (ePhyChanBondState)pal_cpu_to_be32(pParam->cbMode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14223 | vos_mem_copy(pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14224 | pBuf += sizeof(ePhyChanBondState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14225 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14226 | // Set privacy |
| 14227 | *pBuf = pParam->privacy; |
| 14228 | pBuf++; |
| 14229 | |
| 14230 | //Set Uapsd |
| 14231 | *pBuf = pParam->ApUapsdEnable; |
| 14232 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14233 | //Set SSID hidden |
| 14234 | *pBuf = pParam->ssidHidden; |
| 14235 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14236 | *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq; |
| 14237 | pBuf++; |
| 14238 | |
| 14239 | //Ht protection Enable/Disable |
| 14240 | *pBuf = (tANI_U8)pParam->protEnabled; |
| 14241 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14242 | //Enable Beacons to Receive for OBSS protection Enable/Disable |
| 14243 | *pBuf = (tANI_U8)pParam->obssProtEnabled; |
| 14244 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14245 | //set cfg related to protection |
| 14246 | wTmp = pal_cpu_to_be16( pParam->ht_protection ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14247 | vos_mem_copy(pBuf, &wTmp, sizeof( tANI_U16 )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14248 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14249 | // Set Auth type |
| 14250 | authType = pal_cpu_to_be32(pParam->authType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14251 | vos_mem_copy(pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14252 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14253 | // Set DTIM |
| 14254 | dwTmp = pal_cpu_to_be32(pParam->dtimPeriod); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14255 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14256 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14257 | // Set wps_state |
| 14258 | *pBuf = pParam->wps_state; |
| 14259 | pBuf++; |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 14260 | // set isCoalesingInIBSSAllowed |
| 14261 | *pBuf = pMac->isCoalesingInIBSSAllowed; |
| 14262 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14263 | //Persona |
| 14264 | *pBuf = (tANI_U8)pParam->bssPersona; |
| 14265 | pBuf++; |
| 14266 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 14267 | //txLdpcIniFeatureEnabled |
| 14268 | *pBuf = (tANI_U8)(tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 14269 | pBuf++; |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 14270 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 14271 | #ifdef WLAN_FEATURE_11W |
| 14272 | // Set MFP capable/required |
| 14273 | *pBuf = (tANI_U8)pParam->mfpCapable; |
| 14274 | pBuf++; |
| 14275 | *pBuf = (tANI_U8)pParam->mfpRequired; |
| 14276 | pBuf++; |
| 14277 | #endif |
| 14278 | |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 14279 | // set RSN IE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14280 | if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) ) |
| 14281 | { |
| 14282 | status = eHAL_STATUS_INVALID_PARAMETER; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14283 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14284 | break; |
| 14285 | } |
| 14286 | wTmp = pal_cpu_to_be16( pParam->nRSNIELength ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14287 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14288 | pBuf += sizeof(tANI_U16); |
| 14289 | if( wTmp ) |
| 14290 | { |
| 14291 | wTmp = pParam->nRSNIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14292 | vos_mem_copy(pBuf, pParam->pRSNIE, wTmp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14293 | pBuf += wTmp; |
| 14294 | } |
| 14295 | nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14296 | vos_mem_copy(pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14297 | pBuf += sizeof(tSirNwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14298 | *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates |
| 14299 | pBuf++; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14300 | vos_mem_copy(pBuf, pParam->operationalRateSet.rate, |
| 14301 | pParam->operationalRateSet.numRates ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14302 | pBuf += pParam->operationalRateSet.numRates ; |
| 14303 | *pBuf++ = pParam->extendedRateSet.numRates; |
| 14304 | if(0 != pParam->extendedRateSet.numRates) |
| 14305 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14306 | vos_mem_copy(pBuf, pParam->extendedRateSet.rate, |
| 14307 | pParam->extendedRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14308 | pBuf += pParam->extendedRateSet.numRates; |
| 14309 | } |
Hardik Kantilal Patel | dd10795 | 2014-11-20 15:24:52 +0530 | [diff] [blame] | 14310 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 14311 | *pBuf++ = (tANI_U8)pMac->roam.configParam.apHT40_24GEnabled; |
| 14312 | #endif |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 14313 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14314 | msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg |
| 14315 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 14316 | |
| 14317 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14318 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14319 | return( status ); |
| 14320 | } |
| 14321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14322 | eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 14323 | { |
| 14324 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14325 | tSirSmeStopBssReq *pMsg; |
| 14326 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14327 | tANI_U8 *pBuf; |
| 14328 | tANI_U16 msgLen; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 14329 | |
| 14330 | if(!pSession) |
| 14331 | { |
| 14332 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 14333 | return eHAL_STATUS_FAILURE; |
| 14334 | } |
| 14335 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14336 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14337 | pMsg = vos_mem_malloc(sizeof(tSirSmeStopBssReq)); |
| 14338 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 14339 | vos_mem_set(pMsg, sizeof( tSirSmeStopBssReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14340 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 14341 | pBuf = &pMsg->sessionId; |
| 14342 | //sessionId |
| 14343 | *pBuf = (tANI_U8)sessionId; |
| 14344 | pBuf++; |
| 14345 | // transactionId |
| 14346 | *pBuf = 0; |
| 14347 | pBuf += sizeof(tANI_U16); |
| 14348 | //reason code |
| 14349 | *pBuf = 0; |
| 14350 | pBuf += sizeof(tSirResultCodes); |
| 14351 | // bssid |
| 14352 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 14353 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 14354 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14355 | vos_mem_copy(pBuf, (tANI_U8 *)&pSession->selfMacAddr, |
| 14356 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14357 | } |
| 14358 | else |
| 14359 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14360 | vos_mem_copy(pBuf, (tANI_U8 *)&pSession->connectedProfile.bssid, |
| 14361 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14362 | } |
| 14363 | pBuf += sizeof(tSirMacAddr); |
| 14364 | msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr); |
| 14365 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14366 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 14367 | #if 0 |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14368 | pMsg = vos_mem_malloc(sizeof(tSirSmeStopBssReq)); |
| 14369 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 14370 | vos_mem_set(pMsg, sizeof( tSirSmeStopBssReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14371 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 14372 | pMsg->reasonCode = 0; |
| 14373 | // bssid |
| 14374 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 14375 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 14376 | { |
| 14377 | pbBssid = (tANI_U8 *)&pSession->selfMacAddr; |
| 14378 | } |
| 14379 | else |
| 14380 | { |
| 14381 | pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid; |
| 14382 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14383 | vos_mem_copy(&pMsg->bssId, pbBssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14384 | pMsg->transactionId = 0; |
| 14385 | pMsg->sessionId = (tANI_U8)sessionId; |
| 14386 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq )); |
| 14387 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 14388 | #endif |
| 14389 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14390 | return( status ); |
| 14391 | } |
| 14392 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14393 | eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 14394 | tCsrRoamModifyProfileFields *pModProfileFields, |
| 14395 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
| 14396 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14397 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14398 | tANI_U32 roamId = 0; |
| 14399 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14400 | if((csrIsConnStateConnected(pMac, sessionId)) && |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14401 | (fForce || (!vos_mem_compare( &pModProfileFields, |
| 14402 | &pSession->connectedProfile.modifyProfileFields, |
| 14403 | sizeof(tCsrRoamModifyProfileFields)))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14404 | { |
| 14405 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 14406 | if(pRoamId) |
| 14407 | { |
| 14408 | *pRoamId = roamId; |
| 14409 | } |
| 14410 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14411 | status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, |
| 14412 | eCsrSmeIssuedReassocToSameAP, roamId, |
| 14413 | eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14414 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14415 | return status; |
| 14416 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14417 | static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14418 | { |
| 14419 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14420 | tCsrRoamInfo roamInfo; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14421 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14422 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 14423 | eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE); |
| 14424 | return (status); |
| 14425 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14426 | eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 14427 | { |
| 14428 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14429 | tListElem *pEntry = NULL; |
| 14430 | tSmeCmd *pCommand = NULL; |
| 14431 | tSirSmeAddStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14432 | do |
| 14433 | { |
| 14434 | if(pMsg == NULL) |
| 14435 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14436 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14437 | status = eHAL_STATUS_FAILURE; |
| 14438 | break; |
| 14439 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14440 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 14441 | if(pEntry) |
| 14442 | { |
| 14443 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14444 | if(eSmeCommandAddStaSession == pCommand->command) |
| 14445 | { |
| 14446 | pRsp = (tSirSmeAddStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14447 | smsLog( pMac, LOG1, "Add Sta rsp status = %d", pRsp->status ); |
Siddharth Bhal | 85f99b1 | 2014-05-09 08:09:07 +0530 | [diff] [blame] | 14448 | if (pRsp->status == eSIR_FAILURE) { |
| 14449 | VOS_ASSERT( 0 ); |
| 14450 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14451 | //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] | 14452 | csrRoamSessionOpened(pMac, pCommand->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14453 | //Remove this command out of the active list |
| 14454 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 14455 | { |
| 14456 | //Now put this command back on the avilable command list |
| 14457 | csrReleaseCommand(pMac, pCommand); |
| 14458 | } |
| 14459 | smeProcessPendingQueue( pMac ); |
| 14460 | } |
| 14461 | else |
| 14462 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14463 | 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] | 14464 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14465 | status = eHAL_STATUS_FAILURE; |
| 14466 | break; |
| 14467 | } |
| 14468 | } |
| 14469 | else |
| 14470 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14471 | 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] | 14472 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14473 | status = eHAL_STATUS_FAILURE; |
| 14474 | break; |
| 14475 | } |
| 14476 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14477 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14478 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14479 | eHalStatus csrSendMBAddSelfStaReqMsg(tpAniSirGlobal pMac, |
| 14480 | tAddStaForSessionCmd *pAddStaReq) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14481 | { |
| 14482 | tSirSmeAddStaSelfReq *pMsg; |
| 14483 | tANI_U16 msgLen; |
| 14484 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14485 | do { |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14486 | msgLen = sizeof(tSirSmeAddStaSelfReq); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14487 | pMsg = vos_mem_malloc(msgLen); |
| 14488 | if ( NULL == pMsg ) break; |
| 14489 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14490 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ); |
| 14491 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14492 | // self station address |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14493 | vos_mem_copy((tANI_U8 *)pMsg->selfMacAddr, |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14494 | (tANI_U8 *)&pAddStaReq->selfMacAddr, sizeof(tSirMacAddr)); |
| 14495 | |
| 14496 | pMsg->currDeviceMode = pAddStaReq->currDeviceMode; |
| 14497 | |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 14498 | smsLog( pMac, LOG1, FL("selfMac="MAC_ADDRESS_STR), |
| 14499 | MAC_ADDR_ARRAY(pMsg->selfMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14500 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14501 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14502 | return( status ); |
| 14503 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14504 | eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, |
| 14505 | tANI_U32 sessionId, |
| 14506 | tSirMacAddr sessionMacAddr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14507 | { |
| 14508 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14509 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14510 | pCommand = csrGetCommandBuffer(pMac); |
| 14511 | if(NULL == pCommand) |
| 14512 | { |
| 14513 | status = eHAL_STATUS_RESOURCES; |
| 14514 | } |
| 14515 | else |
| 14516 | { |
| 14517 | pCommand->command = eSmeCommandAddStaSession; |
| 14518 | pCommand->sessionId = (tANI_U8)sessionId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14519 | vos_mem_copy(pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, |
| 14520 | sizeof( tSirMacAddr ) ); |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14521 | pCommand->u.addStaSessionCmd.currDeviceMode = pMac->sme.currDeviceMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14522 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 14523 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 14524 | { |
| 14525 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14526 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14527 | } |
| 14528 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14529 | return (status); |
| 14530 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14531 | eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 14532 | { |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14533 | return csrSendMBAddSelfStaReqMsg(pMac, &pCommand->u.addStaSessionCmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14534 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14535 | eHalStatus csrRoamOpenSession(tpAniSirGlobal pMac, |
| 14536 | csrRoamCompleteCallback callback, |
| 14537 | void *pContext, tANI_U8 *pSelfMacAddr, |
| 14538 | tANI_U8 *pbSessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14539 | { |
| 14540 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14541 | tANI_U32 i; |
| 14542 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14543 | *pbSessionId = CSR_SESSION_ID_INVALID; |
| 14544 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 14545 | { |
| 14546 | if( !CSR_IS_SESSION_VALID( pMac, i ) ) |
| 14547 | { |
| 14548 | pSession = CSR_GET_SESSION( pMac, i ); |
| 14549 | status = eHAL_STATUS_SUCCESS; |
| 14550 | pSession->sessionActive = eANI_BOOLEAN_TRUE; |
| 14551 | pSession->sessionId = (tANI_U8)i; |
| 14552 | pSession->callback = callback; |
| 14553 | pSession->pContext = pContext; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14554 | vos_mem_copy(&pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14555 | *pbSessionId = (tANI_U8)i; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14556 | status = vos_timer_init(&pSession->hTimerRoaming, VOS_TIMER_TYPE_SW, |
| 14557 | csrRoamRoamingTimerHandler, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14558 | &pSession->roamingTimerInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14559 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14560 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14561 | smsLog(pMac, LOGE, FL("cannot allocate memory for Roaming timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14562 | break; |
| 14563 | } |
| 14564 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14565 | status = vos_timer_init(&pSession->hTimerJoinRetry, VOS_TIMER_TYPE_SW, |
| 14566 | csrRoamJoinRetryTimerHandler, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14567 | &pSession->joinRetryTimerInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14568 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14569 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14570 | smsLog(pMac, LOGE, FL("cannot allocate memory for joinretry timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14571 | break; |
| 14572 | } |
| 14573 | #endif |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 14574 | status = csrIssueAddStaForSessionReq (pMac, i, pSelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14575 | break; |
| 14576 | } |
| 14577 | } |
| 14578 | if( CSR_ROAM_SESSION_MAX == i ) |
| 14579 | { |
| 14580 | //No session is available |
| 14581 | status = eHAL_STATUS_RESOURCES; |
| 14582 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14583 | return ( status ); |
| 14584 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14585 | eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 14586 | { |
| 14587 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14588 | tListElem *pEntry = NULL; |
| 14589 | tSmeCmd *pCommand = NULL; |
| 14590 | tSirSmeDelStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14591 | do |
| 14592 | { |
| 14593 | if(pMsg == NULL) |
| 14594 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14595 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14596 | status = eHAL_STATUS_FAILURE; |
| 14597 | break; |
| 14598 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14599 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 14600 | if(pEntry) |
| 14601 | { |
| 14602 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14603 | if(eSmeCommandDelStaSession == pCommand->command) |
| 14604 | { |
| 14605 | tANI_U8 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14606 | pRsp = (tSirSmeDelStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14607 | smsLog( pMac, LOG1, "Del Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14608 | //This session is done. |
| 14609 | csrCleanupSession(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14610 | if(pCommand->u.delStaSessionCmd.callback) |
| 14611 | { |
| 14612 | |
| 14613 | status = sme_ReleaseGlobalLock( &pMac->sme ); |
| 14614 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 14615 | { |
| 14616 | pCommand->u.delStaSessionCmd.callback( |
| 14617 | pCommand->u.delStaSessionCmd.pContext); |
| 14618 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 14619 | if (! HAL_STATUS_SUCCESS( status ) ) |
| 14620 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14621 | smsLog(pMac, LOGP, "%s: Failed to Acquire Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14622 | return status; |
| 14623 | } |
| 14624 | } |
| 14625 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14626 | smsLog(pMac, LOGE, "%s: Failed to Release Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14627 | } |
| 14628 | } |
| 14629 | |
| 14630 | //Remove this command out of the active list |
| 14631 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 14632 | { |
| 14633 | //Now put this command back on the avilable command list |
| 14634 | csrReleaseCommand(pMac, pCommand); |
| 14635 | } |
| 14636 | smeProcessPendingQueue( pMac ); |
| 14637 | } |
| 14638 | else |
| 14639 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14640 | 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] | 14641 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14642 | status = eHAL_STATUS_FAILURE; |
| 14643 | break; |
| 14644 | } |
| 14645 | } |
| 14646 | else |
| 14647 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14648 | 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] | 14649 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14650 | status = eHAL_STATUS_FAILURE; |
| 14651 | break; |
| 14652 | } |
| 14653 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14654 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14655 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14656 | eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 14657 | { |
| 14658 | tSirSmeDelStaSelfReq *pMsg; |
| 14659 | tANI_U16 msgLen; |
| 14660 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14661 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14662 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 14663 | sizeof( tSirBssType )*/; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14664 | pMsg = vos_mem_malloc(msgLen); |
| 14665 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 14666 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14667 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ); |
| 14668 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14669 | // self station address |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14670 | vos_mem_copy((tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, |
| 14671 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14672 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14673 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14674 | return( status ); |
| 14675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14676 | eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 14677 | tSirMacAddr sessionMacAddr, |
| 14678 | csrRoamSessionCloseCallback callback, |
| 14679 | void *pContext) |
| 14680 | { |
| 14681 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14682 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14683 | pCommand = csrGetCommandBuffer(pMac); |
| 14684 | if(NULL == pCommand) |
| 14685 | { |
| 14686 | status = eHAL_STATUS_RESOURCES; |
| 14687 | } |
| 14688 | else |
| 14689 | { |
| 14690 | pCommand->command = eSmeCommandDelStaSession; |
| 14691 | pCommand->sessionId = (tANI_U8)sessionId; |
| 14692 | pCommand->u.delStaSessionCmd.callback = callback; |
| 14693 | pCommand->u.delStaSessionCmd.pContext = pContext; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14694 | vos_mem_copy(pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, |
| 14695 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14696 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 14697 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 14698 | { |
| 14699 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14700 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14701 | } |
| 14702 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14703 | return (status); |
| 14704 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14705 | eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 14706 | { |
| 14707 | return csrSendMBDelSelfStaReqMsg( pMac, |
| 14708 | pCommand->u.delStaSessionCmd.selfMacAddr ); |
| 14709 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14710 | static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14711 | { |
| 14712 | tDblLinkList *pList = &pMac->roam.roamCmdPendingList; |
| 14713 | tListElem *pEntry, *pNext; |
| 14714 | tSmeCmd *pCommand; |
| 14715 | tDblLinkList localList; |
| 14716 | |
| 14717 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 14718 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 14719 | { |
| 14720 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 14721 | return; |
| 14722 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14723 | csrLLLock(pList); |
| 14724 | pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK); |
| 14725 | while(pEntry != NULL) |
| 14726 | { |
| 14727 | pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK); |
| 14728 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14729 | if(pCommand->sessionId == sessionId) |
| 14730 | { |
| 14731 | if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK)) |
| 14732 | { |
| 14733 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 14734 | } |
| 14735 | } |
| 14736 | pEntry = pNext; |
| 14737 | } |
| 14738 | csrLLUnlock(pList); |
| 14739 | |
| 14740 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 14741 | { |
| 14742 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14743 | csrAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 14744 | } |
| 14745 | csrLLClose(&localList); |
| 14746 | } |
| 14747 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14748 | void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14749 | { |
| 14750 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 14751 | { |
| 14752 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14753 | csrRoamStop(pMac, sessionId); |
| 14754 | csrFreeConnectBssDesc(pMac, sessionId); |
| 14755 | csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile ); |
| 14756 | csrRoamFreeConnectedInfo ( pMac, &pSession->connectedInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14757 | vos_timer_destroy(&pSession->hTimerRoaming); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14758 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14759 | vos_timer_destroy(&pSession->hTimerJoinRetry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14760 | #endif |
Madan Mohan Koyyalamudi | 2125599 | 2013-08-01 18:00:25 +0530 | [diff] [blame] | 14761 | purgeSmeSessionCmdList(pMac, sessionId, &pMac->sme.smeCmdPendingList); |
| 14762 | if (pMac->fScanOffload) |
| 14763 | { |
| 14764 | purgeSmeSessionCmdList(pMac, sessionId, |
| 14765 | &pMac->sme.smeScanCmdPendingList); |
| 14766 | } |
| 14767 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14768 | purgeCsrSessionCmdList(pMac, sessionId); |
| 14769 | csrInitSession(pMac, sessionId); |
| 14770 | } |
| 14771 | } |
| 14772 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14773 | eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 14774 | tANI_BOOLEAN fSync, |
| 14775 | csrRoamSessionCloseCallback callback, |
| 14776 | void *pContext ) |
| 14777 | { |
| 14778 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14779 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 14780 | { |
| 14781 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14782 | if(fSync) |
| 14783 | { |
| 14784 | csrCleanupSession(pMac, sessionId); |
| 14785 | } |
| 14786 | else |
| 14787 | { |
Madan Mohan Koyyalamudi | 2125599 | 2013-08-01 18:00:25 +0530 | [diff] [blame] | 14788 | purgeSmeSessionCmdList(pMac, sessionId, |
| 14789 | &pMac->sme.smeCmdPendingList); |
| 14790 | if (pMac->fScanOffload) |
| 14791 | { |
| 14792 | purgeSmeSessionCmdList(pMac, sessionId, |
| 14793 | &pMac->sme.smeScanCmdPendingList); |
| 14794 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14795 | purgeCsrSessionCmdList(pMac, sessionId); |
| 14796 | status = csrIssueDelStaForSessionReq( pMac, sessionId, |
| 14797 | pSession->selfMacAddr, callback, pContext); |
| 14798 | } |
| 14799 | } |
| 14800 | else |
| 14801 | { |
| 14802 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 14803 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14804 | return ( status ); |
| 14805 | } |
| 14806 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14807 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 14808 | { |
| 14809 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 14810 | |
| 14811 | if(!pSession) |
| 14812 | { |
| 14813 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 14814 | return; |
| 14815 | } |
| 14816 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14817 | pSession->sessionActive = eANI_BOOLEAN_FALSE; |
| 14818 | pSession->sessionId = CSR_SESSION_ID_INVALID; |
| 14819 | pSession->callback = NULL; |
| 14820 | pSession->pContext = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14821 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 14822 | // TODO : Confirm pMac->roam.fReadyForPowerSave = eANI_BOOLEAN_FALSE; |
| 14823 | csrFreeRoamProfile( pMac, sessionId ); |
| 14824 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 14825 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 14826 | csrFreeConnectBssDesc(pMac, sessionId); |
| 14827 | csrScanEnable(pMac); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14828 | vos_mem_set(&pSession->selfMacAddr, sizeof(tCsrBssid), 0); |
| 14829 | if (pSession->pWpaRsnReqIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14830 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14831 | vos_mem_free(pSession->pWpaRsnReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14832 | pSession->pWpaRsnReqIE = NULL; |
| 14833 | } |
| 14834 | pSession->nWpaRsnReqIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14835 | if (pSession->pWpaRsnRspIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14836 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14837 | vos_mem_free(pSession->pWpaRsnRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14838 | pSession->pWpaRsnRspIE = NULL; |
| 14839 | } |
| 14840 | pSession->nWpaRsnRspIeLength = 0; |
| 14841 | #ifdef FEATURE_WLAN_WAPI |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14842 | if (pSession->pWapiReqIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14843 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14844 | vos_mem_free(pSession->pWapiReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14845 | pSession->pWapiReqIE = NULL; |
| 14846 | } |
| 14847 | pSession->nWapiReqIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14848 | if (pSession->pWapiRspIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14849 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14850 | vos_mem_free(pSession->pWapiRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14851 | pSession->pWapiRspIE = NULL; |
| 14852 | } |
| 14853 | pSession->nWapiRspIeLength = 0; |
| 14854 | #endif /* FEATURE_WLAN_WAPI */ |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14855 | if (pSession->nAddIEScanLength) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14856 | { |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14857 | memset(pSession->addIEScan, 0 , SIR_MAC_MAX_IE_LENGTH); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14858 | } |
| 14859 | pSession->nAddIEScanLength = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 14860 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14861 | if (pSession->pAddIEAssoc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14862 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14863 | vos_mem_free(pSession->pAddIEAssoc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14864 | pSession->pAddIEAssoc = NULL; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14865 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14866 | pSession->nAddIEAssocLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14867 | } |
| 14868 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14869 | eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId ) |
| 14870 | { |
| 14871 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14872 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14873 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 14874 | { |
| 14875 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 14876 | { |
| 14877 | if( csrIsMacAddressEqual( pMac, bssid, &pMac->roam.roamSession[i].connectedProfile.bssid ) ) |
| 14878 | { |
| 14879 | //Found it |
| 14880 | status = eHAL_STATUS_SUCCESS; |
| 14881 | *pSessionId = i; |
| 14882 | break; |
| 14883 | } |
| 14884 | } |
| 14885 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14886 | return( status ); |
| 14887 | } |
| 14888 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14889 | //This function assumes that we only support one IBSS session. We cannot use BSSID to identify |
| 14890 | //session because for IBSS, the bssid changes. |
| 14891 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ) |
| 14892 | { |
| 14893 | tANI_U32 i, nRet = CSR_SESSION_ID_INVALID; |
| 14894 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14895 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 14896 | { |
| 14897 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 14898 | { |
| 14899 | pSession = CSR_GET_SESSION( pMac, i ); |
| 14900 | if( pSession->pCurRoamProfile && ( csrIsBssTypeIBSS( pSession->connectedProfile.BSSType ) ) ) |
| 14901 | { |
| 14902 | //Found it |
| 14903 | nRet = i; |
| 14904 | break; |
| 14905 | } |
| 14906 | } |
| 14907 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14908 | return (nRet); |
| 14909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14910 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid) |
| 14911 | { |
Mukul Sharma | 20aa658 | 2014-08-07 21:36:12 +0530 | [diff] [blame] | 14912 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 14913 | |
| 14914 | /* Update the current BSS info in ho control block based on connected |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14915 | profile info from pmac global structure */ |
| 14916 | |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 14917 | smsLog(pMac, LOGW, " csrRoamLinkUp: WLAN link UP with AP= "MAC_ADDRESS_STR, |
| 14918 | MAC_ADDR_ARRAY(bssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14919 | /* Check for user misconfig of RSSI trigger threshold */ |
| 14920 | pMac->roam.configParam.vccRssiThreshold = |
| 14921 | ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? |
| 14922 | CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold; |
| 14923 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14924 | /* Check for user misconfig of UL MAC Loss trigger threshold */ |
| 14925 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 14926 | ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? |
| 14927 | CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14928 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 14929 | { |
| 14930 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14931 | /* Indicate the neighbor roal algorithm about the connect indication */ |
| 14932 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId); |
| 14933 | csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS); |
Mukul Sharma | 20aa658 | 2014-08-07 21:36:12 +0530 | [diff] [blame] | 14934 | |
| 14935 | // Making sure we are roaming force fully to 5GHz AP only once and |
| 14936 | // only when we connected to 2.4GH AP only during initial association. |
| 14937 | if(pMac->roam.neighborRoamInfo.cfgParams.neighborInitialForcedRoamTo5GhEnable && |
| 14938 | GetRFBand(pMac->roam.neighborRoamInfo.currAPoperationChannel) == SIR_BAND_2_4_GHZ) |
| 14939 | { |
| 14940 | //Making ini value to false here only so we just roam to |
| 14941 | //only once for whole driver load to unload tenure |
| 14942 | pMac->roam.neighborRoamInfo.cfgParams.neighborInitialForcedRoamTo5GhEnable = VOS_FALSE; |
| 14943 | |
| 14944 | status = vos_timer_start(&pMac->roam.neighborRoamInfo.forcedInitialRoamTo5GHTimer, |
| 14945 | INITIAL_FORCED_ROAM_TO_5G_TIMER_PERIOD); |
| 14946 | //MUKUL TODO: change the neighborResultsRefreshPeriod to some ini value reuqired ?? |
| 14947 | if ( status != VOS_STATUS_SUCCESS ) |
| 14948 | { |
| 14949 | smsLog(pMac, LOGE, FL("%s Neighbor forcedInitialRoamTo5GHTimer start failed with status %d"), __func__, status); |
| 14950 | } |
| 14951 | smsLog(pMac, LOGE, FL("%s: Forced roam to 5G started Timer"), __func__); |
| 14952 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14953 | } |
| 14954 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14955 | } |
| 14956 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14957 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14958 | { |
| 14959 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 14960 | |
| 14961 | if(!pSession) |
| 14962 | { |
| 14963 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 14964 | return; |
| 14965 | } |
| 14966 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14967 | //Only to handle the case for Handover on infra link |
| 14968 | if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 14969 | { |
| 14970 | return; |
| 14971 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14972 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 14973 | csrRoamDeregStatisticsReq(pMac); |
| 14974 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 14975 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 14976 | /* Indicate the neighbor roal algorithm about the disconnect indication */ |
| 14977 | csrNeighborRoamIndicateDisconnect(pMac, sessionId); |
| 14978 | #endif |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 14979 | |
| 14980 | //Remove this code once SLM_Sessionization is supported |
| 14981 | //BMPS_WORKAROUND_NOT_NEEDED |
| 14982 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 14983 | csrIsInfraApStarted( pMac ) && |
| 14984 | pMac->roam.configParam.doBMPSWorkaround) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14985 | { |
| 14986 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 14987 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14988 | } |
| 14989 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14990 | void csrRoamTlStatsTimerHandler(void *pv) |
| 14991 | { |
| 14992 | tpAniSirGlobal pMac = PMAC_STRUCT( pv ); |
| 14993 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14994 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 14995 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14996 | smsLog(pMac, LOG1, FL(" TL stat timer is no-op. It needs to support multiple stations")); |
| 14997 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14998 | #if 0 |
| 14999 | // TODO Persession .??? |
| 15000 | //req TL for stats |
| 15001 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId)) |
| 15002 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15003 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:couldn't get the stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15004 | } |
| 15005 | else |
| 15006 | { |
| 15007 | //save in SME |
| 15008 | csrRoamSaveStatsFromTl(pMac, tlStats); |
| 15009 | } |
| 15010 | #endif |
| 15011 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 15012 | { |
| 15013 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 15014 | { |
| 15015 | //start timer |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15016 | status = vos_timer_start(&pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 15017 | pMac->roam.tlStatsReqInfo.periodicity); |
| 15018 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15019 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15020 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15021 | return; |
| 15022 | } |
| 15023 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 15024 | } |
| 15025 | } |
| 15026 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15027 | void csrRoamPeStatsTimerHandler(void *pv) |
| 15028 | { |
| 15029 | tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv; |
| 15030 | eHalStatus status; |
| 15031 | tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac; |
| 15032 | VOS_STATUS vosStatus; |
| 15033 | tPmcPowerState powerState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15034 | pPeStatsReqListEntry->timerRunning = FALSE; |
| 15035 | if( pPeStatsReqListEntry->timerStopFailed == TRUE ) |
| 15036 | { |
| 15037 | // If we entered here, meaning the timer could not be successfully |
| 15038 | // stopped in csrRoamRemoveEntryFromPeStatsReqList(). So do it here. |
| 15039 | |
| 15040 | /* Destroy the timer */ |
| 15041 | vosStatus = vos_timer_destroy( &pPeStatsReqListEntry->hPeStatsTimer ); |
| 15042 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15043 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15044 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15045 | } |
| 15046 | |
| 15047 | // Free the entry |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15048 | vos_mem_free(pPeStatsReqListEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15049 | pPeStatsReqListEntry = NULL; |
| 15050 | } |
| 15051 | else |
| 15052 | { |
| 15053 | if(!pPeStatsReqListEntry->rspPending) |
| 15054 | { |
| 15055 | status = csrSendMBStatsReqMsg(pMac, pPeStatsReqListEntry->statsMask & ~(1 << eCsrGlobalClassDStats), |
| 15056 | pPeStatsReqListEntry->staId); |
| 15057 | if(!HAL_STATUS_SUCCESS(status)) |
| 15058 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15059 | 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] | 15060 | } |
| 15061 | else |
| 15062 | { |
| 15063 | pPeStatsReqListEntry->rspPending = TRUE; |
| 15064 | } |
| 15065 | } |
| 15066 | |
| 15067 | //send down a req |
| 15068 | if(pPeStatsReqListEntry->periodicity && |
| 15069 | (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pPeStatsReqListEntry->hPeStatsTimer))) |
| 15070 | { |
| 15071 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 15072 | if(ePMC_FULL_POWER == powerState) |
| 15073 | { |
| 15074 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 15075 | { |
| 15076 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 15077 | } |
| 15078 | } |
| 15079 | else |
| 15080 | { |
| 15081 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 15082 | { |
| 15083 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 15084 | } |
| 15085 | } |
| 15086 | //start timer |
| 15087 | vosStatus = vos_timer_start( &pPeStatsReqListEntry->hPeStatsTimer, pPeStatsReqListEntry->periodicity ); |
| 15088 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15089 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15090 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15091 | return; |
| 15092 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15093 | pPeStatsReqListEntry->timerRunning = TRUE; |
| 15094 | |
| 15095 | } |
| 15096 | |
| 15097 | } |
| 15098 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15099 | void csrRoamStatsClientTimerHandler(void *pv) |
| 15100 | { |
| 15101 | tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15102 | if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer)) |
| 15103 | { |
| 15104 | #if 0 |
| 15105 | // TODO Stats fix for multisession |
| 15106 | //start the timer |
| 15107 | vosStatus = vos_timer_start( &pStaEntry->timer, pStaEntry->periodicity ); |
| 15108 | |
| 15109 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15110 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15111 | smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15112 | } |
| 15113 | #endif |
| 15114 | } |
| 15115 | #if 0 |
| 15116 | //send up the stats report |
| 15117 | csrRoamReportStatistics(pStaEntry->pMac, pStaEntry->statsMask, pStaEntry->callback, |
| 15118 | pStaEntry->staId, pStaEntry->pContext); |
| 15119 | #endif |
| 15120 | } |
| 15121 | |
| 15122 | |
| 15123 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15124 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId) |
| 15125 | { |
| 15126 | tAniGetPEStatsReq *pMsg; |
| 15127 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15128 | pMsg = vos_mem_malloc(sizeof(tAniGetPEStatsReq)); |
| 15129 | if ( NULL == pMsg ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15130 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 15131 | smsLog(pMac, LOGE, FL( "Failed to allocate mem for stats req ")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15132 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15133 | } |
| 15134 | // need to initiate a stats request to PE |
| 15135 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ); |
| 15136 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq); |
| 15137 | pMsg->staId = staId; |
| 15138 | pMsg->statsMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15139 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15140 | if(!HAL_STATUS_SUCCESS(status)) |
| 15141 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 15142 | smsLog(pMac, LOG1, FL("Failed to send down the stats req ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15143 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15144 | return status; |
| 15145 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15146 | void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg) |
| 15147 | { |
| 15148 | tAniGetPEStatsRsp *pSmeStatsRsp; |
| 15149 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 15150 | tListElem *pEntry = NULL; |
| 15151 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 15152 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 15153 | tANI_U32 tempMask = 0; |
| 15154 | tANI_U8 counter = 0; |
| 15155 | tANI_U8 *pStats = NULL; |
| 15156 | tANI_U32 length = 0; |
| 15157 | v_PVOID_t pvosGCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15158 | v_S7_t rssi = 0, snr = 0; |
| 15159 | tANI_U32 *pRssi = NULL, *pSnr = NULL; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 15160 | tANI_U32 linkCapacity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15161 | pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg; |
| 15162 | if(pSmeStatsRsp->rc) |
| 15163 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15164 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15165 | goto post_update; |
| 15166 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15167 | tempMask = pSmeStatsRsp->statsMask; |
| 15168 | pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15169 | /* subtract all statistics from this length, and after processing the entire |
| 15170 | * 'stat' part of the message, if the length is not zero, then rssi is piggy packed |
| 15171 | * in this 'stats' message. |
| 15172 | */ |
| 15173 | length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15174 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 15175 | while(tempMask) |
| 15176 | { |
| 15177 | if(tempMask & 1) |
| 15178 | { |
| 15179 | switch(counter) |
| 15180 | { |
| 15181 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15182 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:summary stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15183 | vos_mem_copy((tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 15184 | pStats, sizeof(tCsrSummaryStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15185 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 15186 | length -= sizeof(tCsrSummaryStatsInfo); |
| 15187 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15188 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15189 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassA stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15190 | vos_mem_copy((tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 15191 | pStats, sizeof(tCsrGlobalClassAStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15192 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
| 15193 | length -= sizeof(tCsrGlobalClassAStatsInfo); |
| 15194 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15195 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15196 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassB stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15197 | vos_mem_copy((tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 15198 | pStats, sizeof(tCsrGlobalClassBStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15199 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
| 15200 | length -= sizeof(tCsrGlobalClassBStatsInfo); |
| 15201 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15202 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15203 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassC stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15204 | vos_mem_copy((tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 15205 | pStats, sizeof(tCsrGlobalClassCStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15206 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
| 15207 | length -= sizeof(tCsrGlobalClassCStatsInfo); |
| 15208 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15209 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15210 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15211 | if( CSR_MAX_STA > pSmeStatsRsp->staId ) |
| 15212 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15213 | vos_mem_copy((tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], |
| 15214 | pStats, sizeof(tCsrPerStaStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15215 | } |
| 15216 | else |
| 15217 | { |
| 15218 | status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15219 | smsLog( pMac, LOGE, FL("csrRoamStatsRspProcessor:out bound staId:%d"), pSmeStatsRsp->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15220 | VOS_ASSERT( 0 ); |
| 15221 | } |
| 15222 | if(!HAL_STATUS_SUCCESS(status)) |
| 15223 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15224 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15225 | } |
| 15226 | pStats += sizeof(tCsrPerStaStatsInfo); |
| 15227 | length -= sizeof(tCsrPerStaStatsInfo); |
| 15228 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15229 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15230 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15231 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15232 | } |
| 15233 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15234 | tempMask >>=1; |
| 15235 | counter++; |
| 15236 | } |
| 15237 | pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 15238 | if (length != 0) |
| 15239 | { |
| 15240 | pRssi = (tANI_U32*)pStats; |
| 15241 | rssi = (v_S7_t)*pRssi; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 15242 | pStats += sizeof(tANI_U32); |
| 15243 | length -= sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15244 | } |
| 15245 | else |
| 15246 | { |
| 15247 | /* If riva is not sending rssi, continue to use the hack */ |
| 15248 | rssi = RSSI_HACK_BMPS; |
| 15249 | } |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 15250 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15251 | WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 15252 | |
| 15253 | if (length != 0) |
| 15254 | { |
| 15255 | linkCapacity = *(tANI_U32*)pStats; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15256 | pStats += sizeof(tANI_U32); |
| 15257 | length -= sizeof(tANI_U32); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 15258 | } |
| 15259 | else |
| 15260 | { |
| 15261 | linkCapacity = 0; |
| 15262 | } |
| 15263 | |
| 15264 | WDA_UpdateLinkCapacity(pvosGCtx, pSmeStatsRsp->staId, linkCapacity); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15265 | |
| 15266 | if (length != 0) |
| 15267 | { |
| 15268 | pSnr = (tANI_U32*)pStats; |
| 15269 | snr = (v_S7_t)*pSnr; |
| 15270 | } |
| 15271 | else |
| 15272 | { |
| 15273 | snr = SNR_HACK_BMPS; |
| 15274 | } |
| 15275 | |
| 15276 | WDA_UpdateSnrBmps(pvosGCtx, pSmeStatsRsp->staId, snr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15277 | post_update: |
| 15278 | //make sure to update the pe stats req list |
| 15279 | pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask); |
| 15280 | if(pEntry) |
| 15281 | { |
| 15282 | pPeStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
| 15283 | pPeStaEntry->rspPending = FALSE; |
| 15284 | |
| 15285 | } |
| 15286 | //check the one timer cases |
| 15287 | pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask); |
| 15288 | if(pEntry) |
| 15289 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15290 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15291 | if(pTempStaEntry->timerExpired) |
| 15292 | { |
| 15293 | //send up the stats report |
| 15294 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 15295 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 15296 | //also remove from the client list |
| 15297 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 15298 | pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15299 | } |
| 15300 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15301 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15302 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 15303 | { |
| 15304 | tListElem *pEntry = NULL; |
| 15305 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15306 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15307 | if(!pEntry) |
| 15308 | { |
| 15309 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15310 | smsLog(pMac, LOG2, "csrRoamFindInPeStatsReqList: List empty, no request to PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15311 | return NULL; |
| 15312 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15313 | while( pEntry ) |
| 15314 | { |
| 15315 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15316 | if(pTempStaEntry->statsMask == statsMask) |
| 15317 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15318 | smsLog(pMac, LOG3, "csrRoamFindInPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15319 | break; |
| 15320 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15321 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 15322 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15323 | return pEntry; |
| 15324 | } |
| 15325 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15326 | tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry, |
| 15327 | tANI_BOOLEAN update) |
| 15328 | { |
| 15329 | tListElem *pEntry; |
| 15330 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15331 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15332 | if(!pEntry) |
| 15333 | { |
| 15334 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 15335 | smsLog(pMac, LOG2, "csrRoamChecknUpdateClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15336 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15337 | return NULL; |
| 15338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15339 | while( pEntry ) |
| 15340 | { |
| 15341 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15342 | if((pTempStaEntry->requesterId == pStaEntry->requesterId) && |
| 15343 | (pTempStaEntry->statsMask == pStaEntry->statsMask)) |
| 15344 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15345 | smsLog(pMac, LOG3, "csrRoamChecknUpdateClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15346 | if(update) |
| 15347 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15348 | pTempStaEntry->periodicity = pStaEntry->periodicity; |
| 15349 | pTempStaEntry->callback = pStaEntry->callback; |
| 15350 | pTempStaEntry->pContext = pStaEntry->pContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15351 | } |
| 15352 | break; |
| 15353 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15354 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 15355 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15356 | return pEntry; |
| 15357 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15358 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 15359 | { |
| 15360 | tListElem *pEntry; |
| 15361 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15362 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15363 | if(!pEntry) |
| 15364 | { |
| 15365 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 15366 | smsLog(pMac, LOG2, "csrRoamCheckClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15367 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15368 | return NULL; |
| 15369 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15370 | while( pEntry ) |
| 15371 | { |
| 15372 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15373 | if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats)) == statsMask) |
| 15374 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15375 | smsLog(pMac, LOG3, "csrRoamCheckClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15376 | break; |
| 15377 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15378 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 15379 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15380 | return pEntry; |
| 15381 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15382 | eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac, |
| 15383 | csrRoamLinkQualityIndCallback callback, |
| 15384 | void *pContext) |
| 15385 | { |
| 15386 | pMac->roam.linkQualityIndInfo.callback = callback; |
| 15387 | pMac->roam.linkQualityIndInfo.context = pContext; |
| 15388 | if( NULL == callback ) |
| 15389 | { |
| 15390 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being deregistered"); |
| 15391 | } |
| 15392 | else |
| 15393 | { |
| 15394 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15395 | /* do we need to invoke the callback to notify client of initial value ?? */ |
| 15396 | } |
| 15397 | return eHAL_STATUS_SUCCESS; |
| 15398 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15399 | void csrRoamVccTrigger(tpAniSirGlobal pMac) |
| 15400 | { |
| 15401 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 15402 | tANI_U32 ul_mac_loss = 0; |
| 15403 | tANI_U32 ul_mac_loss_trigger_threshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15404 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 15405 | /*------------------------------------------------------------------------- |
| 15406 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15407 | Check for a change in link quality and notify client if necessary |
| 15408 | -------------------------------------------------------------------------*/ |
| 15409 | ul_mac_loss_trigger_threshold = |
| 15410 | pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15411 | VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15412 | smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15413 | ul_mac_loss_trigger_threshold ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15414 | if(ul_mac_loss_trigger_threshold < ul_mac_loss) |
| 15415 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15416 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15417 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 15418 | } |
| 15419 | else |
| 15420 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15421 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15422 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 15423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15424 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ", |
| 15425 | ul_mac_loss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15426 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 15427 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15428 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15429 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 15430 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15431 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15432 | newVccLinkQuality ); |
| 15433 | |
| 15434 | /* we now invoke the callback once to notify client of initial value */ |
| 15435 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 15436 | pMac->roam.linkQualityIndInfo.context ); |
| 15437 | //event: EVENT_WLAN_VCC |
| 15438 | } |
| 15439 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15440 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
| 15441 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15442 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15443 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 15444 | v_U8_t rssiNotification, |
| 15445 | void * context) |
| 15446 | { |
| 15447 | tpAniSirGlobal pMac = PMAC_STRUCT( context ); |
| 15448 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 15449 | // TODO : Session info unavailable |
| 15450 | tANI_U32 sessionId = 0; |
| 15451 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 15452 | /*------------------------------------------------------------------------- |
| 15453 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15454 | Check for a change in link quality and notify client if necessary |
| 15455 | -------------------------------------------------------------------------*/ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15456 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15457 | pMac->roam.configParam.vccRssiThreshold); |
| 15458 | if(!csrIsConnStateConnectedInfra(pMac, sessionId)) |
| 15459 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15460 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15461 | return VOS_STATUS_SUCCESS; |
| 15462 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15463 | if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification) |
| 15464 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15465 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15466 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 15467 | } |
| 15468 | else if(WLANTL_HO_THRESHOLD_UP == rssiNotification) |
| 15469 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15470 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is GOOD "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15471 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 15472 | } |
| 15473 | else |
| 15474 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15475 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d", rssiNotification); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15476 | //Set to this so the code below won't do anything |
| 15477 | newVccLinkQuality = pMac->roam.vccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15478 | VOS_ASSERT(0); |
| 15479 | } |
| 15480 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15481 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 15482 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15483 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15484 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 15485 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15486 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15487 | newVccLinkQuality); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15488 | /* we now invoke the callback once to notify client of initial value */ |
| 15489 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 15490 | pMac->roam.linkQualityIndInfo.context ); |
| 15491 | //event: EVENT_WLAN_VCC |
| 15492 | } |
| 15493 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15494 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15495 | return status; |
| 15496 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15497 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 15498 | tDblLinkList *pStaList, |
| 15499 | tCsrStatsClientReqInfo *pStaEntry) |
| 15500 | { |
| 15501 | tCsrStatsClientReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15502 | //if same entity requested for same set of stats with different periodicity & |
| 15503 | // callback update it |
| 15504 | if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE)) |
| 15505 | { |
| 15506 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15507 | pNewStaEntry = vos_mem_malloc(sizeof(tCsrStatsClientReqInfo)); |
| 15508 | if (NULL == pNewStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15509 | { |
| 15510 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15511 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15512 | return NULL; |
| 15513 | } |
| 15514 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15515 | pNewStaEntry->callback = pStaEntry->callback; |
| 15516 | pNewStaEntry->pContext = pStaEntry->pContext; |
| 15517 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 15518 | pNewStaEntry->requesterId = pStaEntry->requesterId; |
| 15519 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 15520 | pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry; |
| 15521 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 15522 | pNewStaEntry->staId = pStaEntry->staId; |
| 15523 | pNewStaEntry->timerExpired = pStaEntry->timerExpired; |
| 15524 | |
| 15525 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
| 15526 | } |
| 15527 | return pNewStaEntry; |
| 15528 | } |
| 15529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15530 | tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac, |
| 15531 | tDblLinkList *pStaList, |
| 15532 | tCsrPeStatsReqInfo *pStaEntry) |
| 15533 | { |
| 15534 | tCsrPeStatsReqInfo *pNewStaEntry = NULL; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15535 | pNewStaEntry = vos_mem_malloc(sizeof(tCsrPeStatsReqInfo)); |
| 15536 | if (NULL == pNewStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15537 | { |
| 15538 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoPeStatsReqList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15539 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15540 | return NULL; |
| 15541 | } |
| 15542 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15543 | pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer; |
| 15544 | pNewStaEntry->numClient = pStaEntry->numClient; |
| 15545 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 15546 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 15547 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 15548 | pNewStaEntry->staId = pStaEntry->staId; |
| 15549 | pNewStaEntry->timerRunning = pStaEntry->timerRunning; |
| 15550 | pNewStaEntry->rspPending = pStaEntry->rspPending; |
| 15551 | |
| 15552 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15553 | return pNewStaEntry; |
| 15554 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15555 | eHalStatus csrGetRssi(tpAniSirGlobal pMac, |
| 15556 | tCsrRssiCallback callback, |
| 15557 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 15558 | { |
| 15559 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15560 | vos_msg_t msg; |
| 15561 | tANI_U32 sessionId; |
| 15562 | |
| 15563 | tAniGetRssiReq *pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15564 | smsLog(pMac, LOG2, FL("called")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15565 | pMsg = vos_mem_malloc(sizeof(tAniGetRssiReq)); |
| 15566 | if ( NULL == pMsg ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15567 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15568 | smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15569 | return eHAL_STATUS_FAILURE; |
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 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 15572 | |
| 15573 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ); |
| 15574 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 15575 | pMsg->sessionId = sessionId; |
| 15576 | pMsg->staId = staId; |
| 15577 | pMsg->rssiCallback = callback; |
| 15578 | pMsg->pDevContext = pContext; |
| 15579 | pMsg->pVosContext = pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15580 | msg.type = eWNI_SME_GET_RSSI_REQ; |
| 15581 | msg.bodyptr = pMsg; |
| 15582 | msg.reserved = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15583 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 15584 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15585 | smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15586 | vos_mem_free((void *)pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15587 | status = eHAL_STATUS_FAILURE; |
| 15588 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15589 | smsLog(pMac, LOG2, FL("returned")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15590 | return status; |
| 15591 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15592 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 15593 | eHalStatus csrGetSnr(tpAniSirGlobal pMac, |
| 15594 | tCsrSnrCallback callback, |
| 15595 | tANI_U8 staId, tCsrBssid bssId, |
| 15596 | void *pContext) |
| 15597 | { |
| 15598 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15599 | vos_msg_t msg; |
| 15600 | tANI_U32 sessionId; |
| 15601 | |
| 15602 | tAniGetSnrReq *pMsg; |
| 15603 | |
| 15604 | smsLog(pMac, LOG2, FL("called")); |
| 15605 | |
| 15606 | pMsg =(tAniGetSnrReq *)vos_mem_malloc(sizeof(tAniGetSnrReq)); |
| 15607 | if (NULL == pMsg ) |
| 15608 | { |
| 15609 | smsLog(pMac, LOGE, "%s: failed to allocate mem for req",__func__); |
| 15610 | return status; |
| 15611 | } |
| 15612 | |
| 15613 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 15614 | |
| 15615 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_SNR_REQ); |
| 15616 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetSnrReq); |
| 15617 | pMsg->sessionId = sessionId; |
| 15618 | pMsg->staId = staId; |
| 15619 | pMsg->snrCallback = callback; |
| 15620 | pMsg->pDevContext = pContext; |
| 15621 | msg.type = eWNI_SME_GET_SNR_REQ; |
| 15622 | msg.bodyptr = pMsg; |
| 15623 | msg.reserved = 0; |
| 15624 | |
| 15625 | if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 15626 | { |
| 15627 | smsLog(pMac, LOGE, "%s failed to post msg to self", __func__); |
| 15628 | vos_mem_free((v_VOID_t *)pMsg); |
| 15629 | status = eHAL_STATUS_FAILURE; |
| 15630 | } |
| 15631 | |
| 15632 | smsLog(pMac, LOG2, FL("returned")); |
| 15633 | return status; |
| 15634 | } |
| 15635 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 15636 | #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] | 15637 | eHalStatus csrGetRoamRssi(tpAniSirGlobal pMac, |
| 15638 | tCsrRssiCallback callback, |
| 15639 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 15640 | { |
| 15641 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15642 | tAniGetRssiReq *pMsg; |
| 15643 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15644 | pMsg = vos_mem_malloc(sizeof(tAniGetRssiReq)); |
| 15645 | if ( NULL == pMsg ) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15646 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 15647 | smsLog(pMac, LOGE, FL("Failed to allocate mem for req")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15648 | return eHAL_STATUS_FAILURE; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15649 | } |
| 15650 | // need to initiate a stats request to PE |
| 15651 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_ROAM_RSSI_REQ); |
| 15652 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 15653 | pMsg->staId = staId; |
| 15654 | pMsg->rssiCallback = callback; |
| 15655 | pMsg->pDevContext = pContext; |
| 15656 | pMsg->pVosContext = pVosContext; |
| 15657 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 15658 | if(!HAL_STATUS_SUCCESS(status)) |
| 15659 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 15660 | smsLog(pMac, LOGE, FL(" Failed to send down get rssi req")); |
Tushnim Bhattacharyya | 41f7286 | 2013-04-03 21:34:01 -0700 | [diff] [blame] | 15661 | //pMsg is freed by palSendMBMessage |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15662 | status = eHAL_STATUS_FAILURE; |
| 15663 | } |
| 15664 | return status; |
| 15665 | } |
| 15666 | #endif |
| 15667 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15668 | |
| 15669 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 15670 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15671 | eHalStatus csrGetTsmStats(tpAniSirGlobal pMac, |
| 15672 | tCsrTsmStatsCallback callback, |
| 15673 | tANI_U8 staId, |
| 15674 | tCsrBssid bssId, |
| 15675 | void *pContext, |
| 15676 | void* pVosContext, |
| 15677 | tANI_U8 tid) |
| 15678 | { |
| 15679 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15680 | tAniGetTsmStatsReq *pMsg = NULL; |
| 15681 | |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 15682 | pMsg = (tAniGetTsmStatsReq*)vos_mem_malloc(sizeof(tAniGetTsmStatsReq)); |
| 15683 | if (NULL == pMsg) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15684 | { |
| 15685 | smsLog(pMac, LOGE, "csrGetTsmStats: failed to allocate mem for req"); |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 15686 | return eHAL_STATUS_FAILED_ALLOC; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15687 | } |
| 15688 | // need to initiate a stats request to PE |
| 15689 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_TSM_STATS_REQ); |
| 15690 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetTsmStatsReq); |
| 15691 | pMsg->staId = staId; |
| 15692 | pMsg->tid = tid; |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 15693 | vos_mem_copy(pMsg->bssId, bssId, sizeof(tSirMacAddr)); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15694 | pMsg->tsmStatsCallback = callback; |
| 15695 | pMsg->pDevContext = pContext; |
| 15696 | pMsg->pVosContext = pVosContext; |
| 15697 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 15698 | if(!HAL_STATUS_SUCCESS(status)) |
| 15699 | { |
| 15700 | smsLog(pMac, LOG1, " csrGetTsmStats: failed to send down the rssi req"); |
| 15701 | //pMsg is freed by palSendMBMessage |
| 15702 | status = eHAL_STATUS_FAILURE; |
| 15703 | } |
| 15704 | return status; |
| 15705 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 15706 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15707 | |
| 15708 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 15709 | /* --------------------------------------------------------------------------- |
| 15710 | \fn csrGetTLSTAState |
| 15711 | \helper function to get teh TL STA State whenever the function is called. |
| 15712 | |
| 15713 | \param staId - The staID to be passed to the TL |
| 15714 | to get the relevant TL STA State |
| 15715 | \return the state as tANI_U16 |
| 15716 | ---------------------------------------------------------------------------*/ |
| 15717 | tANI_U16 csrGetTLSTAState(tpAniSirGlobal pMac, tANI_U8 staId) |
| 15718 | { |
| 15719 | WLANTL_STAStateType tlSTAState; |
| 15720 | tlSTAState = WLANTL_STA_INIT; |
| 15721 | |
| 15722 | //request TL for STA State |
| 15723 | if ( !VOS_IS_STATUS_SUCCESS(WLANTL_GetSTAState(pMac->roam.gVosContext, staId, &tlSTAState)) ) |
| 15724 | { |
| 15725 | smsLog(pMac, LOGE, FL("csrGetTLSTAState:couldn't get the STA state from TL")); |
| 15726 | } |
| 15727 | |
| 15728 | return tlSTAState; |
| 15729 | } |
| 15730 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15731 | eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, |
| 15732 | tANI_U32 statsMask, |
| 15733 | tCsrStatsCallback callback, |
| 15734 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 15735 | tANI_U8 staId, void *pContext) |
| 15736 | { |
| 15737 | tCsrStatsClientReqInfo staEntry; |
| 15738 | tCsrStatsClientReqInfo *pStaEntry = NULL; |
| 15739 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 15740 | tListElem *pEntry = NULL; |
| 15741 | tANI_BOOLEAN found = FALSE; |
| 15742 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15743 | tANI_BOOLEAN insertInClientList = FALSE; |
| 15744 | VOS_STATUS vosStatus; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15745 | WLANTL_TRANSFER_STA_TYPE *pTlStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15746 | |
| 15747 | if( csrIsAllSessionDisconnected(pMac) ) |
| 15748 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15749 | //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] | 15750 | return eHAL_STATUS_FAILURE; |
| 15751 | } |
Hanumantha Reddy Pothula | 449aadf | 2014-02-07 13:53:35 +0530 | [diff] [blame] | 15752 | |
| 15753 | if (csrNeighborMiddleOfRoaming((tHalHandle)pMac)) |
| 15754 | { |
| 15755 | smsLog(pMac, LOG1, FL("in the middle of roaming states")); |
| 15756 | return eHAL_STATUS_FAILURE; |
| 15757 | } |
| 15758 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15759 | if((!statsMask) && (!callback)) |
| 15760 | { |
| 15761 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15762 | smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15763 | return eHAL_STATUS_FAILURE; |
| 15764 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15765 | //for the search list method for deregister |
| 15766 | staEntry.requesterId = requesterId; |
| 15767 | staEntry.statsMask = statsMask; |
| 15768 | //requester wants to deregister or just an error |
| 15769 | if((statsMask) && (!callback)) |
| 15770 | { |
| 15771 | pEntry = csrRoamChecknUpdateClientReqList(pMac, &staEntry, FALSE); |
| 15772 | if(!pEntry) |
| 15773 | { |
| 15774 | //msg |
| 15775 | 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] | 15776 | "find any existing request in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15777 | return eHAL_STATUS_FAILURE; |
| 15778 | } |
| 15779 | else |
| 15780 | { |
| 15781 | //clean up & return |
| 15782 | pStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 15783 | if(NULL != pStaEntry->pPeStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15784 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15785 | pStaEntry->pPeStaEntry->numClient--; |
| 15786 | //check if we need to delete the entry from peStatsReqList too |
| 15787 | if(!pStaEntry->pPeStaEntry->numClient) |
| 15788 | { |
| 15789 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pStaEntry->pPeStaEntry); |
| 15790 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15791 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 15792 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15793 | //check if we need to stop the tl stats timer too |
| 15794 | pMac->roam.tlStatsReqInfo.numClient--; |
| 15795 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 15796 | { |
| 15797 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 15798 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15799 | status = vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 15800 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15801 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15802 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15803 | return eHAL_STATUS_FAILURE; |
| 15804 | } |
| 15805 | } |
| 15806 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 15807 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 15808 | } |
| 15809 | vos_timer_stop( &pStaEntry->timer ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15810 | // Destroy the vos timer... |
| 15811 | vosStatus = vos_timer_destroy( &pStaEntry->timer ); |
| 15812 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15813 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15814 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15815 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15816 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 15817 | pStaEntry = NULL; |
| 15818 | return eHAL_STATUS_SUCCESS; |
| 15819 | } |
| 15820 | } |
| 15821 | |
| 15822 | if(cache && !periodicity) |
| 15823 | { |
| 15824 | //return the cached stats |
| 15825 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 15826 | } |
| 15827 | else |
| 15828 | { |
| 15829 | //add the request in the client req list |
| 15830 | staEntry.callback = callback; |
| 15831 | staEntry.pContext = pContext; |
| 15832 | staEntry.periodicity = periodicity; |
| 15833 | staEntry.pPeStaEntry = NULL; |
| 15834 | staEntry.staId = staId; |
| 15835 | staEntry.pMac = pMac; |
| 15836 | staEntry.timerExpired = FALSE; |
| 15837 | |
| 15838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15839 | //if periodic report requested with non cached result from PE/TL |
| 15840 | if(periodicity) |
| 15841 | { |
| 15842 | |
| 15843 | //if looking for stats from PE |
| 15844 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 15845 | { |
| 15846 | |
| 15847 | //check if same request made already & waiting for rsp |
| 15848 | pPeStaEntry = csrRoamCheckPeStatsReqList(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), |
| 15849 | periodicity, &found, staId); |
| 15850 | if(!pPeStaEntry) |
| 15851 | { |
| 15852 | //bail out, maxed out on number of req for PE |
| 15853 | return eHAL_STATUS_FAILURE; |
| 15854 | } |
| 15855 | else |
| 15856 | { |
| 15857 | staEntry.pPeStaEntry = pPeStaEntry; |
| 15858 | } |
| 15859 | |
| 15860 | } |
| 15861 | //request stats from TL rightaway if requested by client, update tlStatsReqInfo if needed |
| 15862 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 15863 | { |
| 15864 | if(cache && pMac->roam.tlStatsReqInfo.numClient) |
| 15865 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15866 | smsLog(pMac, LOGE, FL("csrGetStatistics:Looking for cached stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15867 | } |
| 15868 | else |
| 15869 | { |
| 15870 | |
| 15871 | //update periodicity |
| 15872 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 15873 | { |
| 15874 | pMac->roam.tlStatsReqInfo.periodicity = |
| 15875 | CSR_ROAM_MIN(periodicity, pMac->roam.tlStatsReqInfo.periodicity); |
| 15876 | } |
| 15877 | else |
| 15878 | { |
| 15879 | pMac->roam.tlStatsReqInfo.periodicity = periodicity; |
| 15880 | } |
| 15881 | if(pMac->roam.tlStatsReqInfo.periodicity < CSR_MIN_TL_STAT_QUERY_PERIOD) |
| 15882 | { |
| 15883 | pMac->roam.tlStatsReqInfo.periodicity = CSR_MIN_TL_STAT_QUERY_PERIOD; |
| 15884 | } |
| 15885 | |
| 15886 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 15887 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15888 | 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] | 15889 | if (NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15890 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15891 | //req TL for class D stats |
| 15892 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId)) |
| 15893 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15894 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15895 | } |
| 15896 | else |
| 15897 | { |
| 15898 | //save in SME |
| 15899 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 15900 | } |
| 15901 | vos_mem_free(pTlStats); |
| 15902 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15903 | } |
| 15904 | else |
| 15905 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15906 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15907 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15908 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15909 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 15910 | { |
| 15911 | //start timer |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15912 | status = vos_timer_start(&pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 15913 | pMac->roam.tlStatsReqInfo.periodicity); |
| 15914 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15915 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15916 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15917 | return eHAL_STATUS_FAILURE; |
| 15918 | } |
| 15919 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 15920 | } |
| 15921 | } |
| 15922 | } |
| 15923 | pMac->roam.tlStatsReqInfo.numClient++; |
| 15924 | } |
| 15925 | |
| 15926 | insertInClientList = TRUE; |
| 15927 | } |
| 15928 | //if one time report requested with non cached result from PE/TL |
| 15929 | else if(!cache && !periodicity) |
| 15930 | { |
| 15931 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 15932 | { |
| 15933 | //send down a req |
| 15934 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 15935 | if(!HAL_STATUS_SUCCESS(status)) |
| 15936 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15937 | 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] | 15938 | } |
| 15939 | //so that when the stats rsp comes back from PE we respond to upper layer |
| 15940 | //right away |
| 15941 | staEntry.timerExpired = TRUE; |
| 15942 | insertInClientList = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15943 | } |
| 15944 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 15945 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15946 | 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] | 15947 | if (NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15948 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15949 | //req TL for class D stats |
| 15950 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId))) |
| 15951 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15952 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15953 | } |
| 15954 | else |
| 15955 | { |
| 15956 | //save in SME |
| 15957 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 15958 | } |
| 15959 | vos_mem_free(pTlStats); |
| 15960 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15961 | } |
| 15962 | else |
| 15963 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15964 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15965 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15966 | |
| 15967 | } |
| 15968 | //if looking for stats from TL only |
| 15969 | if(!insertInClientList) |
| 15970 | { |
| 15971 | //return the stats |
| 15972 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 15973 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15974 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15975 | if(insertInClientList) |
| 15976 | { |
| 15977 | pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); |
| 15978 | if(!pStaEntry) |
| 15979 | { |
| 15980 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15981 | smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15982 | return eHAL_STATUS_FAILURE; |
| 15983 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15984 | pStaEntry->periodicity = periodicity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15985 | //Init & start timer if needed |
| 15986 | if(periodicity) |
| 15987 | { |
| 15988 | vosStatus = vos_timer_init( &pStaEntry->timer, VOS_TIMER_TYPE_SW, |
| 15989 | csrRoamStatsClientTimerHandler, pStaEntry ); |
| 15990 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15991 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15992 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot init StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15993 | return eHAL_STATUS_FAILURE; |
| 15994 | } |
| 15995 | vosStatus = vos_timer_start( &pStaEntry->timer, periodicity ); |
| 15996 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15997 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15998 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15999 | return eHAL_STATUS_FAILURE; |
| 16000 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16001 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16002 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16003 | } |
| 16004 | return eHAL_STATUS_SUCCESS; |
| 16005 | } |
| 16006 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16007 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 16008 | |
| 16009 | static tSirRetStatus |
| 16010 | csrRoamScanOffloadPopulateMacHeader(tpAniSirGlobal pMac, |
| 16011 | tANI_U8* pBD, |
| 16012 | tANI_U8 type, |
| 16013 | tANI_U8 subType, |
| 16014 | tSirMacAddr peerAddr, |
| 16015 | tSirMacAddr selfMacAddr) |
| 16016 | { |
| 16017 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 16018 | tpSirMacMgmtHdr pMacHdr; |
| 16019 | |
| 16020 | /* Prepare MAC management header */ |
| 16021 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 16022 | |
| 16023 | /* Prepare FC */ |
| 16024 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 16025 | pMacHdr->fc.type = type; |
| 16026 | pMacHdr->fc.subType = subType; |
| 16027 | |
| 16028 | /* Prepare Address 1 */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16029 | vos_mem_copy((tANI_U8 *) pMacHdr->da, (tANI_U8 *) peerAddr, |
| 16030 | sizeof( tSirMacAddr )); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16031 | |
| 16032 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 16033 | |
| 16034 | /* Prepare Address 3 */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16035 | vos_mem_copy((tANI_U8 *) pMacHdr->bssId, (tANI_U8 *) peerAddr, |
| 16036 | sizeof( tSirMacAddr )); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16037 | return statusCode; |
| 16038 | } /*** csrRoamScanOffloadPopulateMacHeader() ***/ |
| 16039 | |
| 16040 | static tSirRetStatus |
| 16041 | csrRoamScanOffloadPrepareProbeReqTemplate(tpAniSirGlobal pMac, |
| 16042 | tANI_U8 nChannelNum, |
| 16043 | tANI_U32 dot11mode, |
| 16044 | tSirMacAddr selfMacAddr, |
| 16045 | tANI_U8 *pFrame, |
| 16046 | tANI_U16 *pusLen) |
| 16047 | { |
| 16048 | tDot11fProbeRequest pr; |
| 16049 | tANI_U32 nStatus, nBytes, nPayload; |
| 16050 | tSirRetStatus nSirStatus; |
| 16051 | /*Bcast tx*/ |
| 16052 | tSirMacAddr bssId = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 16053 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 16054 | |
| 16055 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16056 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16057 | |
| 16058 | PopulateDot11fSuppRates( pMac, nChannelNum, &pr.SuppRates,NULL); |
| 16059 | |
| 16060 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 16061 | { |
| 16062 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 16063 | } |
| 16064 | |
| 16065 | |
| 16066 | if (IS_DOT11_MODE_HT(dot11mode)) |
| 16067 | { |
| 16068 | PopulateDot11fHTCaps( pMac, NULL, &pr.HTCaps ); |
| 16069 | } |
| 16070 | |
| 16071 | |
| 16072 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 16073 | if ( DOT11F_FAILED( nStatus ) ) |
| 16074 | { |
| 16075 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16076 | "Failed to calculate the packed size f" |
| 16077 | "or a Probe Request (0x%08x).\n", nStatus ); |
| 16078 | |
| 16079 | |
| 16080 | nPayload = sizeof( tDot11fProbeRequest ); |
| 16081 | } |
| 16082 | else if ( DOT11F_WARNED( nStatus ) ) |
| 16083 | { |
| 16084 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16085 | "There were warnings while calculating" |
| 16086 | "the packed size for a Probe Request (" |
| 16087 | "0x%08x).\n", nStatus ); |
| 16088 | } |
| 16089 | |
| 16090 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 16091 | |
| 16092 | /* Prepare outgoing frame*/ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16093 | vos_mem_set(pFrame, nBytes , 0); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16094 | |
| 16095 | |
| 16096 | nSirStatus = csrRoamScanOffloadPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 16097 | SIR_MAC_MGMT_PROBE_REQ, bssId,selfMacAddr); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16098 | |
| 16099 | if ( eSIR_SUCCESS != nSirStatus ) |
| 16100 | { |
| 16101 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16102 | "Failed to populate the buffer descriptor for a Probe Request (%d).\n", |
| 16103 | nSirStatus ); |
| 16104 | return nSirStatus; |
| 16105 | } |
| 16106 | |
| 16107 | |
| 16108 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 16109 | sizeof( tSirMacMgmtHdr ), |
| 16110 | nPayload, &nPayload ); |
| 16111 | if ( DOT11F_FAILED( nStatus ) ) |
| 16112 | { |
| 16113 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16114 | "Failed to pack a Probe Request (0x%08x).\n", nStatus ); |
| 16115 | return eSIR_FAILURE; |
| 16116 | } |
| 16117 | else if ( DOT11F_WARNED( nStatus ) ) |
| 16118 | { |
| 16119 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | ce8ad51 | 2013-10-30 12:34:42 -0700 | [diff] [blame] | 16120 | "There were warnings while packing a Probe Request (0x%08x).\n", |
| 16121 | nStatus ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16122 | } |
| 16123 | |
| 16124 | *pusLen = nPayload + sizeof(tSirMacMgmtHdr); |
| 16125 | return eSIR_SUCCESS; |
| 16126 | } |
| 16127 | |
| 16128 | eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 command, tANI_U8 reason) |
| 16129 | { |
| 16130 | vos_msg_t msg; |
| 16131 | tSirRoamOffloadScanReq *pRequestBuf; |
| 16132 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 16133 | tCsrRoamSession *pSession; |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16134 | tANI_U8 i,j,num_channels = 0, ucDot11Mode; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16135 | tANI_U8 *ChannelList = NULL; |
| 16136 | tANI_U32 sessionId; |
| 16137 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16138 | tpCsrChannelInfo currChannelListInfo; |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16139 | tANI_U32 host_channels = 0; |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16140 | tANI_U8 ChannelCacheStr[128] = {0}; |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16141 | eCsrBand eBand; |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 16142 | tSirBssDescription *pBssDesc = NULL; |
| 16143 | tDot11fBeaconIEs *pIes = NULL; |
| 16144 | tANI_U8 minRate = 0, dataRate; |
Varun Reddy Yeturu | 52231ea | 2014-02-06 12:00:56 -0800 | [diff] [blame] | 16145 | tANI_U8 operationChannel = 0; |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 16146 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16147 | currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 16148 | |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 16149 | if (0 == csrRoamIsRoamOffloadScanEnabled(pMac)) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16150 | { |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 16151 | smsLog( pMac, LOGE,"isRoamOffloadScanEnabled not set"); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16152 | return eHAL_STATUS_FAILURE; |
| 16153 | } |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 16154 | |
| 16155 | if ((VOS_TRUE == bRoamScanOffloadStarted) && (ROAM_SCAN_OFFLOAD_START == command)) |
| 16156 | { |
| 16157 | smsLog( pMac, LOGE,"Roam Scan Offload is already started"); |
| 16158 | return eHAL_STATUS_FAILURE; |
| 16159 | } |
Abhishek Singh | 3e91563 | 2014-11-01 17:14:50 +0530 | [diff] [blame] | 16160 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16161 | /*The Dynamic Config Items Update may happen even if the state is in INIT. |
| 16162 | * It is important to ensure that the command is passed down to the FW only |
| 16163 | * if the Infra Station is in a connected state.A connected station could also be |
| 16164 | * in a PREAUTH or REASSOC states.So, consider not sending the command down in INIT state. |
| 16165 | * We also have to ensure that if there is a STOP command we always have to inform Riva, |
| 16166 | * irrespective of whichever state we are in.*/ |
| 16167 | if ((pMac->roam.neighborRoamInfo.neighborRoamState == eCSR_NEIGHBOR_ROAM_STATE_INIT) && |
| 16168 | (command != ROAM_SCAN_OFFLOAD_STOP)) |
| 16169 | { |
Mahesh A Saptasagar | 14addb6 | 2014-02-17 17:17:51 +0530 | [diff] [blame] | 16170 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 16171 | FL("Scan Command not sent to FW with state = %s and cmd=%d\n"), |
| 16172 | macTraceGetNeighbourRoamState( |
| 16173 | pMac->roam.neighborRoamInfo.neighborRoamState), command); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16174 | return eHAL_STATUS_FAILURE; |
| 16175 | } |
| 16176 | |
Abhishek Singh | 3e91563 | 2014-11-01 17:14:50 +0530 | [diff] [blame] | 16177 | /* We dont need psession during ROAM_SCAN_OFFLOAD_STOP |
| 16178 | * Also there are cases where pNeighborRoamInfo->currAPbssid |
| 16179 | * is set to 0 during disconnect and so we might return without stopping |
| 16180 | * the roam scan. So no need to find the session if command is |
| 16181 | * ROAM_SCAN_OFFLOAD_STOP. |
| 16182 | */ |
| 16183 | if( ROAM_SCAN_OFFLOAD_STOP != command ) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16184 | { |
Abhishek Singh | 3e91563 | 2014-11-01 17:14:50 +0530 | [diff] [blame] | 16185 | status = csrRoamGetSessionIdFromBSSID(pMac, |
| 16186 | (tCsrBssid *)pNeighborRoamInfo->currAPbssid, |
| 16187 | &sessionId); |
| 16188 | |
| 16189 | if ( !HAL_STATUS_SUCCESS( status ) ) |
| 16190 | { |
| 16191 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16192 | "%s: Not able to find the sessionId for Roam Offload scan request", __func__); |
| 16193 | return eHAL_STATUS_FAILURE; |
| 16194 | } |
| 16195 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 16196 | if (NULL == pSession) |
| 16197 | { |
| 16198 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
krunal soni | 587bf01 | 2014-02-04 12:35:11 -0800 | [diff] [blame] | 16199 | "%s:pSession is null", __func__); |
Abhishek Singh | 3e91563 | 2014-11-01 17:14:50 +0530 | [diff] [blame] | 16200 | return eHAL_STATUS_FAILURE; |
| 16201 | } |
| 16202 | pBssDesc = pSession->pConnectBssDesc; |
| 16203 | if (pBssDesc == NULL) |
| 16204 | { |
| 16205 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16206 | "%s: pBssDesc not found for current session", __func__); |
| 16207 | return eHAL_STATUS_FAILURE; |
| 16208 | } |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 16209 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16210 | pRequestBuf = vos_mem_malloc(sizeof(tSirRoamOffloadScanReq)); |
| 16211 | if (NULL == pRequestBuf) |
| 16212 | { |
Abhishek Singh | 3e91563 | 2014-11-01 17:14:50 +0530 | [diff] [blame] | 16213 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16214 | "%s: Not able to allocate memory for Roam Offload scan request", __func__); |
| 16215 | return eHAL_STATUS_FAILED_ALLOC; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16216 | } |
| 16217 | |
Abhishek Singh | 3e91563 | 2014-11-01 17:14:50 +0530 | [diff] [blame] | 16218 | vos_mem_zero(pRequestBuf, sizeof(tSirRoamOffloadScanReq)); |
| 16219 | /* If command is STOP, then pass down ScanOffloadEnabled as Zero.This will handle the case of |
| 16220 | * host driver reloads, but Riva still up and running*/ |
| 16221 | pRequestBuf->Command = command; |
| 16222 | if(command == ROAM_SCAN_OFFLOAD_STOP) |
| 16223 | { |
| 16224 | pRequestBuf->RoamScanOffloadEnabled = 0; |
| 16225 | /*For a STOP Command, there is no need to |
| 16226 | * go through filling up all the below parameters |
| 16227 | * since they are not required for the STOP command*/ |
| 16228 | goto send_roam_scan_offload_cmd; |
| 16229 | } |
| 16230 | else |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16231 | pRequestBuf->RoamScanOffloadEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16232 | vos_mem_copy(pRequestBuf->ConnectedNetwork.currAPbssid, |
| 16233 | pNeighborRoamInfo->currAPbssid, |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16234 | sizeof(tCsrBssid)); |
| 16235 | pRequestBuf->ConnectedNetwork.ssId.length = |
| 16236 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.length; |
| 16237 | vos_mem_copy(pRequestBuf->ConnectedNetwork.ssId.ssId, |
| 16238 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.ssId, |
| 16239 | pRequestBuf->ConnectedNetwork.ssId.length); |
| 16240 | pRequestBuf->ConnectedNetwork.authentication = |
| 16241 | pMac->roam.roamSession[sessionId].connectedProfile.AuthType; |
| 16242 | pRequestBuf->ConnectedNetwork.encryption = |
| 16243 | pMac->roam.roamSession[sessionId].connectedProfile.EncryptionType; |
| 16244 | pRequestBuf->ConnectedNetwork.mcencryption = |
| 16245 | pMac->roam.roamSession[sessionId].connectedProfile.mcEncryptionType; |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 16246 | if (pNeighborRoamInfo->cfgParams.neighborLookupThreshold) |
| 16247 | { |
| 16248 | pRequestBuf->LookupThreshold = |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16249 | (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1); |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 16250 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_DEFAULT; |
| 16251 | } |
| 16252 | else |
| 16253 | { |
| 16254 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Calculate Adaptive Threshold"); |
| 16255 | operationChannel = pSession->connectedProfile.operationChannel; |
| 16256 | |
| 16257 | if (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 16258 | { |
| 16259 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16260 | "%s: csrGetParsedBssDescriptionIEs failed", __func__); |
| 16261 | vos_mem_free(pRequestBuf); |
| 16262 | return eHAL_STATUS_FAILURE; |
| 16263 | } |
Kaushik, Sushant | 5874d03 | 2014-02-20 17:22:36 +0530 | [diff] [blame] | 16264 | if(NULL == pIes) |
| 16265 | { |
| 16266 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16267 | "%s : pIes is Null", __func__); |
Mukul Sharma | d2b8186 | 2014-07-01 21:01:04 +0530 | [diff] [blame] | 16268 | vos_mem_free(pRequestBuf); |
Kaushik, Sushant | 5874d03 | 2014-02-20 17:22:36 +0530 | [diff] [blame] | 16269 | return eHAL_STATUS_FAILURE; |
| 16270 | } |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 16271 | if (pIes->SuppRates.present) |
| 16272 | { |
| 16273 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Number \t Rate"); |
| 16274 | /*Check for both basic rates and extended rates.*/ |
| 16275 | for (i = 0; i < pIes->SuppRates.num_rates; i++) |
| 16276 | { |
| 16277 | /*Check if the Rate is Mandatory or Not*/ |
| 16278 | if (csrRatesIsDot11RateSupported(pMac, pIes->SuppRates.rates[i]) |
| 16279 | && (pIes->SuppRates.rates[i] & 0x80)) |
| 16280 | { |
| 16281 | /*Retrieve the actual data rate*/ |
| 16282 | dataRate = (pIes->SuppRates.rates[i] & 0x7F)/2; |
| 16283 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%d \t\t %d", i, dataRate); |
| 16284 | if (minRate == 0) |
| 16285 | minRate = dataRate; |
| 16286 | else |
| 16287 | minRate = (minRate < dataRate) ? minRate:dataRate; |
| 16288 | } |
| 16289 | } |
| 16290 | |
| 16291 | if (pIes->ExtSuppRates.present) |
| 16292 | { |
| 16293 | for (i = 0; i < pIes->ExtSuppRates.num_rates; i++) |
| 16294 | { |
| 16295 | /*Check if the Rate is Mandatory or Not*/ |
| 16296 | if (csrRatesIsDot11RateSupported(pMac, pIes->ExtSuppRates.rates[i]) |
| 16297 | && (pIes->ExtSuppRates.rates[i] & 0x80)) |
| 16298 | { |
| 16299 | /*Retrieve the actual data rate*/ |
| 16300 | dataRate = (pIes->ExtSuppRates.rates[i] & 0x7F)/2; |
| 16301 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%d \t\t %d", i, dataRate); |
| 16302 | if (minRate == 0) |
| 16303 | minRate = dataRate; |
| 16304 | else |
| 16305 | minRate = (minRate < dataRate) ? minRate:dataRate; |
| 16306 | } |
| 16307 | } |
| 16308 | } |
| 16309 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "MinRate = %d", minRate); |
| 16310 | } |
| 16311 | else |
| 16312 | { |
| 16313 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16314 | "%s: Supp Rates not present in pIes", __func__); |
| 16315 | vos_mem_free(pRequestBuf); |
| 16316 | return eHAL_STATUS_FAILURE; |
| 16317 | } |
| 16318 | if (NULL != pIes) |
| 16319 | { |
| 16320 | vos_mem_free(pIes); |
| 16321 | pIes = NULL; |
| 16322 | } |
| 16323 | switch (minRate) |
| 16324 | { |
| 16325 | case 1: |
| 16326 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_1MBPS; |
| 16327 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_1MBPS; |
| 16328 | break; |
| 16329 | case 2: |
| 16330 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_2MBPS; |
| 16331 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_2MBPS; |
| 16332 | break; |
| 16333 | case 5: |
| 16334 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_5_5MBPS; |
| 16335 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_5_5MBPS; |
| 16336 | break; |
| 16337 | case 6: |
| 16338 | if (CSR_IS_CHANNEL_24GHZ(operationChannel)) |
| 16339 | { |
| 16340 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_6MBPS_2G; |
| 16341 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_6MBPS_2G; |
| 16342 | } |
| 16343 | else |
| 16344 | { |
| 16345 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_6MBPS_5G; |
| 16346 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_6MBPS_5G; |
| 16347 | } |
| 16348 | break; |
| 16349 | case 11: |
| 16350 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_11MBPS; |
| 16351 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_11MBPS; |
| 16352 | break; |
| 16353 | case 12: |
| 16354 | if (CSR_IS_CHANNEL_24GHZ(operationChannel)) |
| 16355 | { |
| 16356 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_12MBPS_2G; |
| 16357 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_12MBPS_2G; |
| 16358 | } |
| 16359 | else |
| 16360 | { |
| 16361 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_12MBPS_5G; |
| 16362 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_12MBPS_5G; |
| 16363 | } |
| 16364 | break; |
| 16365 | case 24: |
| 16366 | if (CSR_IS_CHANNEL_24GHZ(operationChannel)) |
| 16367 | { |
| 16368 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_24MBPS_2G; |
| 16369 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_24MBPS_2G; |
| 16370 | } |
| 16371 | else |
| 16372 | { |
| 16373 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_24MBPS_5G; |
| 16374 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_24MBPS_5G; |
| 16375 | } |
| 16376 | break; |
| 16377 | default: |
| 16378 | pRequestBuf->LookupThreshold = LFR_LOOKUP_THR_DEFAULT; |
| 16379 | pRequestBuf->RxSensitivityThreshold = LFR_SENSITIVITY_THR_DEFAULT; |
| 16380 | break; |
| 16381 | } |
| 16382 | } |
| 16383 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 16384 | "Chnl=%d,MinRate=%d,RxSenThr=%d,LookupThr=%d", |
| 16385 | operationChannel, minRate, |
| 16386 | pRequestBuf->RxSensitivityThreshold, |
| 16387 | pRequestBuf->LookupThreshold); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16388 | pRequestBuf->RoamRssiDiff = |
| 16389 | pMac->roam.configParam.RoamRssiDiff; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16390 | pRequestBuf->StartScanReason = reason; |
| 16391 | pRequestBuf->NeighborScanTimerPeriod = |
| 16392 | pNeighborRoamInfo->cfgParams.neighborScanPeriod; |
| 16393 | pRequestBuf->NeighborRoamScanRefreshPeriod = |
| 16394 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod; |
| 16395 | pRequestBuf->NeighborScanChannelMinTime = |
| 16396 | pNeighborRoamInfo->cfgParams.minChannelScanTime; |
| 16397 | pRequestBuf->NeighborScanChannelMaxTime = |
| 16398 | pNeighborRoamInfo->cfgParams.maxChannelScanTime; |
| 16399 | pRequestBuf->EmptyRefreshScanPeriod = |
| 16400 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod; |
Sameer Thalappil | 4ae66ec | 2013-11-05 14:17:35 -0800 | [diff] [blame] | 16401 | /* MAWC feature */ |
| 16402 | pRequestBuf->MAWCEnabled = |
| 16403 | pMac->roam.configParam.MAWCEnabled; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16404 | #ifdef FEATURE_WLAN_ESE |
| 16405 | pRequestBuf->IsESEEnabled = pMac->roam.configParam.isEseIniFeatureEnabled; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16406 | #endif |
| 16407 | if ( |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16408 | #ifdef FEATURE_WLAN_ESE |
| 16409 | ((pNeighborRoamInfo->isESEAssoc) && |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16410 | (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == |
| 16411 | eANI_BOOLEAN_FALSE)) || |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16412 | (pNeighborRoamInfo->isESEAssoc == eANI_BOOLEAN_FALSE) || |
| 16413 | #endif // ESE |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16414 | currChannelListInfo->numOfChannels == 0) |
| 16415 | { |
| 16416 | |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16417 | /*Retrieve the Channel Cache either from ini or from the Occupied Channels list. |
| 16418 | * Give Preference to INI Channels.*/ |
| 16419 | if (pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) |
| 16420 | { |
| 16421 | ChannelList = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 16422 | /*The INI channels need to be filtered with respect to the current |
| 16423 | * band that is supported.*/ |
| 16424 | eBand = pMac->roam.configParam.bandCapability; |
| 16425 | 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] | 16426 | { |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16427 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16428 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 16429 | vos_mem_free(pRequestBuf); |
| 16430 | return eHAL_STATUS_FAILURE; |
| 16431 | } |
| 16432 | for (i=0; i<pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++) |
| 16433 | { |
| 16434 | if(((eCSR_BAND_24 == eBand) && CSR_IS_CHANNEL_24GHZ(*ChannelList)) || |
| 16435 | ((eCSR_BAND_5G == eBand) && CSR_IS_CHANNEL_5GHZ(*ChannelList)) || |
| 16436 | (eCSR_BAND_ALL == eBand)) |
| 16437 | { |
| 16438 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && |
| 16439 | csrRoamIsChannelValid(pMac, *ChannelList) && |
| 16440 | *ChannelList && (num_channels < SIR_ROAM_MAX_CHANNELS)) |
| 16441 | { |
| 16442 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 16443 | } |
| 16444 | } |
| 16445 | ChannelList++; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16446 | } |
| 16447 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 16448 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_STATIC; |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16449 | } |
| 16450 | else |
| 16451 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16452 | ChannelList = pMac->scan.occupiedChannels.channelList; |
| 16453 | for(i=0; i<pMac->scan.occupiedChannels.numChannels; i++) |
| 16454 | { |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 16455 | /*Allow DFS channels only if the DFS channel roam flag is enabled */ |
| 16456 | if(((pMac->roam.configParam.allowDFSChannelRoam) || |
| 16457 | (!CSR_IS_CHANNEL_DFS(*ChannelList))) && |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16458 | *ChannelList && (num_channels < SIR_ROAM_MAX_CHANNELS)) |
| 16459 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16460 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16461 | } |
| 16462 | ChannelList++; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16463 | } |
| 16464 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 16465 | /* If the profile changes as to what it was earlier, inform the FW through |
| 16466 | * FLUSH as ChannelCacheType in which case, the FW will flush the occupied channels |
| 16467 | * for the earlier profile and try to learn them afresh.*/ |
| 16468 | if (reason == REASON_FLUSH_CHANNEL_LIST) |
| 16469 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_FLUSH; |
| 16470 | else { |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16471 | if (csrNeighborRoamIsNewConnectedProfile(pMac)) |
| 16472 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_INIT; |
| 16473 | else |
| 16474 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16475 | } |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16476 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16477 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16478 | #ifdef FEATURE_WLAN_ESE |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16479 | else |
| 16480 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16481 | /* If ESE is enabled, and a neighbor Report is received,then |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16482 | * Ignore the INI Channels or the Occupied Channel List. Consider |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 16483 | * the channels in the neighbor list sent by the ESE AP.*/ |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16484 | if (currChannelListInfo->numOfChannels != 0) |
| 16485 | { |
| 16486 | ChannelList = currChannelListInfo->ChannelList; |
| 16487 | for (i=0;i<currChannelListInfo->numOfChannels;i++) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16488 | { |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 16489 | if(((pMac->roam.configParam.allowDFSChannelRoam) || |
| 16490 | (!CSR_IS_CHANNEL_DFS(*ChannelList))) && *ChannelList) |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16491 | { |
| 16492 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 16493 | } |
| 16494 | ChannelList++; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16495 | } |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16496 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 16497 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
| 16498 | } |
| 16499 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16500 | #endif |
Kaushik, Sushant | 5ed8ab6 | 2014-03-05 11:21:11 +0530 | [diff] [blame] | 16501 | 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] | 16502 | { |
Kaushik, Sushant | d39915b | 2014-04-23 15:12:28 +0530 | [diff] [blame] | 16503 | if (j < sizeof(ChannelCacheStr)) |
| 16504 | { |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16505 | j += snprintf(ChannelCacheStr + j, sizeof(ChannelCacheStr) - j," %d", |
| 16506 | pRequestBuf->ConnectedNetwork.ChannelCache[i]); |
Kaushik, Sushant | d39915b | 2014-04-23 15:12:28 +0530 | [diff] [blame] | 16507 | } |
| 16508 | else |
| 16509 | { |
| 16510 | break; |
| 16511 | } |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 16512 | } |
| 16513 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 16514 | "ChnlCacheType:%d, No of Chnls:%d,Channels: %s", |
| 16515 | pRequestBuf->ChannelCacheType, |
| 16516 | pRequestBuf->ConnectedNetwork.ChannelCount, |
| 16517 | ChannelCacheStr); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16518 | num_channels = 0; |
| 16519 | ChannelList = NULL; |
| 16520 | |
| 16521 | /* Maintain the Valid Channels List*/ |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16522 | host_channels = sizeof(pMac->roam.validChannelList); |
| 16523 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &host_channels))) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16524 | { |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16525 | ChannelList = pMac->roam.validChannelList; |
| 16526 | pMac->roam.numValidChannels = host_channels; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16527 | } |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16528 | else |
| 16529 | { |
| 16530 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16531 | "%s:Failed to get the valid channel list", __func__); |
Praveen Kumar Sirisilla | 16c6377 | 2013-10-23 19:31:58 -0700 | [diff] [blame] | 16532 | vos_mem_free(pRequestBuf); |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16533 | return eHAL_STATUS_FAILURE; |
| 16534 | } |
| 16535 | for(i=0; i<pMac->roam.numValidChannels; i++) |
| 16536 | { |
Sandeep Puligilla | c80f26e | 2014-03-11 18:36:10 +0530 | [diff] [blame] | 16537 | if(((pMac->roam.configParam.allowDFSChannelRoam) || |
| 16538 | (!CSR_IS_CHANNEL_DFS(*ChannelList))) && *ChannelList) |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 16539 | { |
| 16540 | pRequestBuf->ValidChannelList[num_channels++] = *ChannelList; |
| 16541 | } |
| 16542 | ChannelList++; |
| 16543 | } |
| 16544 | pRequestBuf->ValidChannelCount = num_channels; |
| 16545 | |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 16546 | pRequestBuf->MDID.mdiePresent = |
| 16547 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent; |
| 16548 | pRequestBuf->MDID.mobilityDomain = |
| 16549 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mobilityDomain; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 16550 | pRequestBuf->nProbes = pMac->roam.configParam.nProbes; |
| 16551 | |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 16552 | pRequestBuf->HomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime; |
Varun Reddy Yeturu | 9d4102c | 2013-12-02 15:47:03 -0800 | [diff] [blame] | 16553 | /* Home Away Time should be at least equal to (MaxDwell time + (2*RFS)), |
| 16554 | * where RFS is the RF Switching time. It is twice RFS to consider the |
| 16555 | * time to go off channel and return to the home channel. */ |
| 16556 | if (pRequestBuf->HomeAwayTime < (pRequestBuf->NeighborScanChannelMaxTime + (2 * CSR_ROAM_SCAN_CHANNEL_SWITCH_TIME))) |
| 16557 | { |
| 16558 | VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 16559 | "%s: Invalid config, Home away time(%d) is less than (twice RF switching time + channel max time)(%d)" |
| 16560 | " Hence enforcing home away time to disable (0)", |
| 16561 | __func__, pRequestBuf->HomeAwayTime, |
| 16562 | (pRequestBuf->NeighborScanChannelMaxTime + (2 * CSR_ROAM_SCAN_CHANNEL_SWITCH_TIME))); |
| 16563 | pRequestBuf->HomeAwayTime = 0; |
| 16564 | } |
| 16565 | 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] | 16566 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16567 | /*Prepare a probe request for 2.4GHz band and one for 5GHz band*/ |
| 16568 | ucDot11Mode = (tANI_U8) csrTranslateToWNICfgDot11Mode(pMac, |
| 16569 | csrFindBestPhyMode( pMac, pMac->roam.configParam.phyMode )); |
| 16570 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_24G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 16571 | pRequestBuf->p24GProbeTemplate, &pRequestBuf->us24GProbeTemplateLen); |
| 16572 | |
| 16573 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_5G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 16574 | pRequestBuf->p5GProbeTemplate, &pRequestBuf->us5GProbeTemplateLen); |
Varun Reddy Yeturu | 6c5e25c | 2014-01-09 21:55:37 -0800 | [diff] [blame] | 16575 | send_roam_scan_offload_cmd: |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 16576 | msg.type = WDA_ROAM_SCAN_OFFLOAD_REQ; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16577 | msg.reserved = 0; |
| 16578 | msg.bodyptr = pRequestBuf; |
| 16579 | if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))) |
| 16580 | { |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 16581 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_ROAM_SCAN_OFFLOAD_REQ message to WDA", __func__); |
| 16582 | vos_mem_free(pRequestBuf); |
| 16583 | return eHAL_STATUS_FAILURE; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16584 | } |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 16585 | else |
| 16586 | { |
| 16587 | if (ROAM_SCAN_OFFLOAD_START == command) |
| 16588 | bRoamScanOffloadStarted = VOS_TRUE; |
| 16589 | else if (ROAM_SCAN_OFFLOAD_STOP == command) |
| 16590 | bRoamScanOffloadStarted = VOS_FALSE; |
| 16591 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16592 | |
| 16593 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Roam Scan Offload Command %d, Reason %d", command, reason); |
| 16594 | return status; |
| 16595 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16596 | |
| 16597 | eHalStatus csrRoamOffloadScanRspHdlr(tpAniSirGlobal pMac, tANI_U8 reason) |
| 16598 | { |
| 16599 | switch(reason) |
| 16600 | { |
| 16601 | case 0: |
| 16602 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Rsp for Roam Scan Offload with failure status"); |
| 16603 | break; |
| 16604 | case REASON_OS_REQUESTED_ROAMING_NOW: |
| 16605 | csrNeighborRoamProceedWithHandoffReq(pMac); |
| 16606 | break; |
Mukul Sharma | 20aa658 | 2014-08-07 21:36:12 +0530 | [diff] [blame] | 16607 | case REASON_INITIAL_FORCED_ROAM_TO_5G: |
| 16608 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "%s recevied REASON_INITIAL_FORCED_ROAM_TO_5G", __func__); |
| 16609 | break; |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16610 | default: |
Tushnim Bhattacharyya | 5128d75 | 2013-06-26 23:23:18 -0700 | [diff] [blame] | 16611 | 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] | 16612 | } |
| 16613 | return eHAL_STATUS_SUCCESS; |
| 16614 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16615 | #endif |
| 16616 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16617 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 16618 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId) |
| 16619 | { |
| 16620 | tANI_BOOLEAN found = FALSE; |
| 16621 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16622 | tCsrPeStatsReqInfo staEntry; |
| 16623 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
| 16624 | tListElem *pStaEntry = NULL; |
| 16625 | VOS_STATUS vosStatus; |
| 16626 | tPmcPowerState powerState; |
| 16627 | *pFound = FALSE; |
| 16628 | |
| 16629 | pStaEntry = csrRoamFindInPeStatsReqList(pMac, statsMask); |
| 16630 | if(pStaEntry) |
| 16631 | { |
| 16632 | pTempStaEntry = GET_BASE_ADDR( pStaEntry, tCsrPeStatsReqInfo, link ); |
| 16633 | if(pTempStaEntry->periodicity) |
| 16634 | { |
| 16635 | pTempStaEntry->periodicity = |
| 16636 | CSR_ROAM_MIN(periodicity, pTempStaEntry->periodicity); |
| 16637 | } |
| 16638 | else |
| 16639 | { |
| 16640 | pTempStaEntry->periodicity = periodicity; |
| 16641 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16642 | pTempStaEntry->numClient++; |
| 16643 | found = TRUE; |
| 16644 | } |
| 16645 | else |
| 16646 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16647 | vos_mem_set(&staEntry, sizeof(tCsrPeStatsReqInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16648 | staEntry.numClient = 1; |
| 16649 | staEntry.periodicity = periodicity; |
| 16650 | staEntry.pMac = pMac; |
| 16651 | staEntry.rspPending = FALSE; |
| 16652 | staEntry.staId = staId; |
| 16653 | staEntry.statsMask = statsMask; |
| 16654 | staEntry.timerRunning = FALSE; |
| 16655 | pTempStaEntry = csrRoamInsertEntryIntoPeStatsReqList(pMac, &pMac->roam.peStatsReqList, &staEntry); |
| 16656 | if(!pTempStaEntry) |
| 16657 | { |
| 16658 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16659 | smsLog(pMac, LOGW, "csrRoamCheckPeStatsReqList: Failed to insert req in peStatsReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16660 | return NULL; |
| 16661 | } |
| 16662 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16663 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 16664 | if(ePMC_FULL_POWER == powerState) |
| 16665 | { |
| 16666 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 16667 | { |
| 16668 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 16669 | } |
| 16670 | } |
| 16671 | else |
| 16672 | { |
| 16673 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 16674 | { |
| 16675 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 16676 | } |
| 16677 | } |
| 16678 | if(!pTempStaEntry->timerRunning) |
| 16679 | { |
| 16680 | //send down a req in case of one time req, for periodic ones wait for timer to expire |
| 16681 | if(!pTempStaEntry->rspPending && |
| 16682 | !pTempStaEntry->periodicity) |
| 16683 | { |
| 16684 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 16685 | if(!HAL_STATUS_SUCCESS(status)) |
| 16686 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16687 | 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] | 16688 | } |
| 16689 | else |
| 16690 | { |
| 16691 | pTempStaEntry->rspPending = TRUE; |
| 16692 | } |
| 16693 | } |
| 16694 | if(pTempStaEntry->periodicity) |
| 16695 | { |
| 16696 | if(!found) |
| 16697 | { |
| 16698 | |
| 16699 | vosStatus = vos_timer_init( &pTempStaEntry->hPeStatsTimer, VOS_TIMER_TYPE_SW, |
| 16700 | csrRoamPeStatsTimerHandler, pTempStaEntry ); |
| 16701 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 16702 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16703 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16704 | return NULL; |
| 16705 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16706 | } |
| 16707 | //start timer |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16708 | smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d", pTempStaEntry->periodicity); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16709 | vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity ); |
| 16710 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 16711 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16712 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16713 | return NULL; |
| 16714 | } |
| 16715 | pTempStaEntry->timerRunning = TRUE; |
| 16716 | } |
| 16717 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16718 | *pFound = found; |
| 16719 | return pTempStaEntry; |
| 16720 | } |
| 16721 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16722 | /* |
| 16723 | pStaEntry is no longer invalid upon the return of this function. |
| 16724 | */ |
| 16725 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry) |
| 16726 | { |
| 16727 | if(pEntry) |
| 16728 | { |
| 16729 | if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK)) |
| 16730 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16731 | vos_mem_free(GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16733 | } |
| 16734 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16735 | |
| 16736 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry) |
| 16737 | { |
| 16738 | tListElem *pEntry; |
| 16739 | tCsrPeStatsReqInfo *pTempStaEntry; |
| 16740 | VOS_STATUS vosStatus; |
| 16741 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16742 | if(!pEntry) |
| 16743 | { |
| 16744 | //list empty |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16745 | smsLog(pMac, LOGE, FL(" List empty, no stats req for PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16746 | return; |
| 16747 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16748 | while( pEntry ) |
| 16749 | { |
| 16750 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16751 | if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask) |
| 16752 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16753 | smsLog(pMac, LOGW, FL("Match found")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16754 | if(pTempStaEntry->timerRunning) |
| 16755 | { |
| 16756 | vosStatus = vos_timer_stop( &pTempStaEntry->hPeStatsTimer ); |
| 16757 | /* If we are not able to stop the timer here, just remove |
| 16758 | * the entry from the linked list. Destroy the timer object |
| 16759 | * and free the memory in the timer CB |
| 16760 | */ |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 16761 | if ( vosStatus == VOS_STATUS_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16762 | { |
| 16763 | /* the timer is successfully stopped */ |
| 16764 | pTempStaEntry->timerRunning = FALSE; |
| 16765 | |
| 16766 | /* Destroy the timer */ |
| 16767 | vosStatus = vos_timer_destroy( &pTempStaEntry->hPeStatsTimer ); |
| 16768 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 16769 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16770 | smsLog(pMac, LOGE, FL("csrRoamRemoveEntryFromPeStatsReqList:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16771 | } |
| 16772 | } |
| 16773 | else |
| 16774 | { |
| 16775 | // the timer could not be stopped. Hence destroy and free the |
| 16776 | // memory for the PE stat entry in the timer CB. |
| 16777 | pTempStaEntry->timerStopFailed = TRUE; |
| 16778 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16779 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16780 | |
| 16781 | if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK)) |
| 16782 | { |
| 16783 | // Only free the memory if we could stop the timer successfully |
| 16784 | if(!pTempStaEntry->timerStopFailed) |
| 16785 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16786 | vos_mem_free(pTempStaEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16787 | pTempStaEntry = NULL; |
| 16788 | } |
| 16789 | break; |
| 16790 | } |
| 16791 | |
| 16792 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 16793 | } |
| 16794 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16795 | return; |
| 16796 | } |
| 16797 | |
| 16798 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16799 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16800 | { |
| 16801 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16802 | pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = pTlStats->rxBcntCRCok; |
| 16803 | pMac->roam.classDStatsInfo.rx_bc_byte_cnt = pTlStats->rxBCBcnt; |
| 16804 | pMac->roam.classDStatsInfo.rx_bc_frm_cnt = pTlStats->rxBCFcnt; |
| 16805 | pMac->roam.classDStatsInfo.rx_byte_cnt = pTlStats->rxBcnt; |
| 16806 | pMac->roam.classDStatsInfo.rx_mc_byte_cnt = pTlStats->rxMCBcnt; |
| 16807 | pMac->roam.classDStatsInfo.rx_mc_frm_cnt = pTlStats->rxMCFcnt; |
| 16808 | pMac->roam.classDStatsInfo.rx_rate = pTlStats->rxRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16809 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16810 | pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = pTlStats->rxUCBcnt; |
| 16811 | pMac->roam.classDStatsInfo.rx_uc_frm_cnt = pTlStats->rxUCFcnt; |
| 16812 | pMac->roam.classDStatsInfo.tx_bc_byte_cnt = pTlStats->txBCBcnt; |
| 16813 | pMac->roam.classDStatsInfo.tx_bc_frm_cnt = pTlStats->txBCFcnt; |
| 16814 | pMac->roam.classDStatsInfo.tx_mc_byte_cnt = pTlStats->txMCBcnt; |
| 16815 | pMac->roam.classDStatsInfo.tx_mc_frm_cnt = pTlStats->txMCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16816 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16817 | pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = pTlStats->txUCBcnt; |
| 16818 | pMac->roam.classDStatsInfo.tx_uc_frm_cnt = pTlStats->txUCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16819 | |
| 16820 | } |
| 16821 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16822 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 16823 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext) |
| 16824 | { |
| 16825 | tANI_U8 stats[500]; |
| 16826 | tANI_U8 *pStats = NULL; |
| 16827 | tANI_U32 tempMask = 0; |
| 16828 | tANI_U8 counter = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16829 | if(!callback) |
| 16830 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16831 | smsLog(pMac, LOGE, FL("Cannot report callback NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16832 | return; |
| 16833 | } |
| 16834 | if(!statsMask) |
| 16835 | { |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16836 | smsLog(pMac, LOGE, FL("Cannot report statsMask is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16837 | return; |
| 16838 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16839 | pStats = stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16840 | tempMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16841 | while(tempMask) |
| 16842 | { |
| 16843 | if(tempMask & 1) |
| 16844 | { |
| 16845 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 16846 | switch(counter) |
| 16847 | { |
| 16848 | case eCsrSummaryStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16849 | smsLog( pMac, LOG2, FL("Summary stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16850 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 16851 | sizeof(tCsrSummaryStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16852 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 16853 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16854 | case eCsrGlobalClassAStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16855 | smsLog( pMac, LOG2, FL("ClassA stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16856 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 16857 | sizeof(tCsrGlobalClassAStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16858 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16859 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16860 | case eCsrGlobalClassBStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16861 | smsLog( pMac, LOG2, FL("ClassB stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16862 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 16863 | sizeof(tCsrGlobalClassBStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16864 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16865 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16866 | case eCsrGlobalClassCStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16867 | smsLog( pMac, LOG2, FL("ClassC stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16868 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 16869 | sizeof(tCsrGlobalClassCStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16870 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16871 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16872 | case eCsrGlobalClassDStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16873 | smsLog( pMac, LOG2, FL("ClassD stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16874 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, |
| 16875 | sizeof(tCsrGlobalClassDStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16876 | pStats += sizeof(tCsrGlobalClassDStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16877 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16878 | case eCsrPerStaStats: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16879 | smsLog( pMac, LOG2, FL("PerSta stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16880 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], |
| 16881 | sizeof(tCsrPerStaStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16882 | pStats += sizeof(tCsrPerStaStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16883 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16884 | default: |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 16885 | smsLog( pMac, LOGE, FL("Unknown stats type and counter %d"), counter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16886 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16887 | } |
| 16888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16889 | tempMask >>=1; |
| 16890 | counter++; |
| 16891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16892 | callback(stats, pContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16893 | } |
| 16894 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16895 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac) |
| 16896 | { |
| 16897 | tListElem *pEntry = NULL; |
| 16898 | tListElem *pPrevEntry = NULL; |
| 16899 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 16900 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16901 | VOS_STATUS vosStatus; |
| 16902 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16903 | if(!pEntry) |
| 16904 | { |
| 16905 | //list empty |
| 16906 | smsLog(pMac, LOGW, "csrRoamDeregStatisticsReq: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16907 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16908 | return status; |
| 16909 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16910 | while( pEntry ) |
| 16911 | { |
| 16912 | if(pPrevEntry) |
| 16913 | { |
| 16914 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 16915 | //send up the stats report |
| 16916 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 16917 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 16918 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 16919 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16920 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16921 | if (pTempStaEntry->pPeStaEntry) //pPeStaEntry can be NULL |
| 16922 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16923 | pTempStaEntry->pPeStaEntry->numClient--; |
| 16924 | //check if we need to delete the entry from peStatsReqList too |
| 16925 | if(!pTempStaEntry->pPeStaEntry->numClient) |
| 16926 | { |
| 16927 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry); |
| 16928 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16929 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16930 | //check if we need to stop the tl stats timer too |
| 16931 | pMac->roam.tlStatsReqInfo.numClient--; |
| 16932 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 16933 | { |
| 16934 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 16935 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 16936 | status = vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 16937 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16938 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16939 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16940 | //we will continue |
| 16941 | } |
| 16942 | } |
| 16943 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 16944 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 16945 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16946 | if (pTempStaEntry->periodicity) |
| 16947 | { |
| 16948 | //While creating StaEntry in csrGetStatistics, |
| 16949 | //Initializing and starting timer only when periodicity is set. |
| 16950 | //So Stop and Destroy timer only when periodicity is set. |
| 16951 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16952 | vos_timer_stop( &pTempStaEntry->timer ); |
| 16953 | // Destroy the vos timer... |
| 16954 | vosStatus = vos_timer_destroy( &pTempStaEntry->timer ); |
| 16955 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 16956 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16957 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16958 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16959 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16960 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16961 | |
| 16962 | pPrevEntry = pEntry; |
| 16963 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 16964 | } |
| 16965 | //the last one |
| 16966 | if(pPrevEntry) |
| 16967 | { |
| 16968 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 16969 | //send up the stats report |
| 16970 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 16971 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 16972 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 16973 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16974 | return status; |
| 16975 | |
| 16976 | } |
| 16977 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16978 | eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 16979 | tRequestFullPowerReason *pReason, |
| 16980 | tANI_BOOLEAN *pfNeedPower ) |
| 16981 | { |
| 16982 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 16983 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
| 16984 | tPmcState pmcState; |
| 16985 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16986 | // TODO : Session info unavailable |
| 16987 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16988 | if( pfNeedPower ) |
| 16989 | { |
| 16990 | *pfNeedPower = eANI_BOOLEAN_FALSE; |
| 16991 | } |
| 16992 | //We only handle CSR commands |
| 16993 | if( !(eSmeCsrCommandMask & pCommand->command) ) |
| 16994 | { |
| 16995 | return eHAL_STATUS_SUCCESS; |
| 16996 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16997 | //Check PMC state first |
| 16998 | pmcState = pmcGetPmcState( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16999 | switch( pmcState ) |
| 17000 | { |
| 17001 | case REQUEST_IMPS: |
| 17002 | case IMPS: |
| 17003 | if( eSmeCommandScan == pCommand->command ) |
| 17004 | { |
| 17005 | switch( pCommand->u.scanCmd.reason ) |
| 17006 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 17007 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 17008 | case eCsrScanGetLfrResult: |
| 17009 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17010 | case eCsrScanGetResult: |
| 17011 | case eCsrScanBGScanAbort: |
| 17012 | case eCsrScanBGScanEnable: |
| 17013 | case eCsrScanGetScanChnInfo: |
| 17014 | //Internal process, no need for full power |
| 17015 | fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 17016 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17017 | default: |
| 17018 | //Other scans are real scan, ask for power |
| 17019 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 17020 | break; |
| 17021 | } //switch |
| 17022 | } |
| 17023 | else |
| 17024 | { |
| 17025 | //ask for power for roam and status change |
| 17026 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 17027 | } |
| 17028 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17029 | case REQUEST_BMPS: |
| 17030 | case BMPS: |
| 17031 | case REQUEST_START_UAPSD: |
| 17032 | case UAPSD: |
| 17033 | //We treat WOWL same as BMPS |
| 17034 | case REQUEST_ENTER_WOWL: |
| 17035 | case WOWL: |
| 17036 | if( eSmeCommandRoam == pCommand->command ) |
| 17037 | { |
| 17038 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 17039 | tCsrScanResult *pScanResult; |
| 17040 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17041 | switch ( pCommand->u.roamCmd.roamReason ) |
| 17042 | { |
| 17043 | case eCsrForcedDisassoc: |
| 17044 | case eCsrForcedDisassocMICFailure: |
| 17045 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 17046 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 17047 | break; |
| 17048 | case eCsrSmeIssuedDisassocForHandoff: |
| 17049 | case eCsrForcedDeauth: |
| 17050 | case eCsrHddIssuedReassocToSameAP: |
| 17051 | case eCsrSmeIssuedReassocToSameAP: |
| 17052 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 17053 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17054 | case eCsrCapsChange: |
| 17055 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 17056 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17057 | default: |
| 17058 | //Check whether the profile is already connected. If so, no need for full power |
| 17059 | //Note: IBSS is ignored for now because we don't support powersave in IBSS |
| 17060 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && pBSSList ) |
| 17061 | { |
| 17062 | //Only need to check the first one |
| 17063 | pEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 17064 | if( pEntry ) |
| 17065 | { |
| 17066 | pScanResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link); |
| 17067 | #if 0 |
| 17068 | // TODO : Session Specific info pConnectBssDesc |
| 17069 | if( csrIsBssIdEqual( pMac, &pScanResult->Result.BssDescriptor, pMac->roam.pConnectBssDesc ) && |
| 17070 | csrIsSsidEqual( pMac, pMac->roam.pConnectBssDesc, |
| 17071 | &pScanResult->Result.BssDescriptor, (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ) ) ) |
| 17072 | { |
| 17073 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 17074 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 17075 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 17076 | // a new Association. |
| 17077 | if(csrIsSameProfile(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 17078 | { |
| 17079 | if(csrRoamIsSameProfileKeys(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 17080 | { |
| 17081 | //Done, eventually, the command reaches eCsrReassocToSelfNoCapChange; |
| 17082 | //No need for full power |
| 17083 | //Set the flag so the code later can avoid to do the above |
| 17084 | //check again. |
| 17085 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_TRUE; |
| 17086 | break; |
| 17087 | } |
| 17088 | } |
| 17089 | } |
| 17090 | #endif |
| 17091 | } |
| 17092 | } |
| 17093 | //If we are here, full power is needed |
| 17094 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 17095 | break; |
| 17096 | } |
| 17097 | } |
| 17098 | else if( eSmeCommandWmStatusChange == pCommand->command ) |
| 17099 | { |
| 17100 | //need full power for all |
| 17101 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 17102 | reason = eSME_LINK_DISCONNECTED_BY_OTHER; |
| 17103 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17104 | #ifdef FEATURE_WLAN_TDLS |
| 17105 | else if( eSmeCommandTdlsAddPeer == pCommand->command ) |
| 17106 | { |
| 17107 | //TDLS link is getting established. need full power |
| 17108 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 17109 | reason = eSME_FULL_PWR_NEEDED_BY_TDLS_PEER_SETUP; |
| 17110 | } |
| 17111 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17112 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17113 | case REQUEST_STOP_UAPSD: |
| 17114 | case REQUEST_EXIT_WOWL: |
| 17115 | if( eSmeCommandRoam == pCommand->command ) |
| 17116 | { |
| 17117 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 17118 | switch ( pCommand->u.roamCmd.roamReason ) |
| 17119 | { |
| 17120 | case eCsrForcedDisassoc: |
| 17121 | case eCsrForcedDisassocMICFailure: |
| 17122 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 17123 | break; |
| 17124 | default: |
| 17125 | break; |
| 17126 | } |
| 17127 | } |
| 17128 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17129 | case STOPPED: |
| 17130 | case REQUEST_STANDBY: |
| 17131 | case STANDBY: |
| 17132 | case LOW_POWER: |
| 17133 | //We are not supposed to do anything |
Sushant Kaushik | e0d2cce | 2014-04-10 14:36:07 +0530 | [diff] [blame] | 17134 | smsLog( pMac, LOGE, FL( "cannot process because PMC is in" |
| 17135 | " stopped/standby state %s (%d)" ), |
| 17136 | sme_PmcStatetoString(pmcState), pmcState ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17137 | status = eHAL_STATUS_FAILURE; |
| 17138 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17139 | case FULL_POWER: |
| 17140 | case REQUEST_FULL_POWER: |
| 17141 | default: |
| 17142 | //No need to ask for full power. This has to be FULL_POWER state |
| 17143 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17144 | } //switch |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17145 | if( pReason ) |
| 17146 | { |
| 17147 | *pReason = reason; |
| 17148 | } |
| 17149 | if( pfNeedPower ) |
| 17150 | { |
| 17151 | *pfNeedPower = fNeedFullPower; |
| 17152 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17153 | return ( status ); |
| 17154 | } |
| 17155 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17156 | static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 17157 | { |
| 17158 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17159 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 17160 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17161 | status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17162 | if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) ) |
| 17163 | { |
| 17164 | status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason); |
| 17165 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17166 | return ( status ); |
| 17167 | } |
| 17168 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17169 | tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac ) |
| 17170 | { |
| 17171 | tSmeCmd *pCmd = smeGetCommandBuffer( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17172 | if( pCmd ) |
| 17173 | { |
| 17174 | pMac->roam.sPendingCommands++; |
| 17175 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17176 | return ( pCmd ); |
| 17177 | } |
| 17178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17179 | void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 17180 | { |
| 17181 | if (pMac->roam.sPendingCommands > 0) |
| 17182 | { |
| 17183 | //All command allocated through csrGetCommandBuffer need to |
| 17184 | //decrement the pending count when releasing. |
| 17185 | pMac->roam.sPendingCommands--; |
| 17186 | smeReleaseCommand( pMac, pCommand ); |
| 17187 | } |
| 17188 | else |
| 17189 | { |
| 17190 | smsLog(pMac, LOGE, FL( "no pending commands")); |
| 17191 | VOS_ASSERT(0); |
| 17192 | } |
| 17193 | } |
| 17194 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17195 | //Return SUCCESS is the command is queued, failed |
| 17196 | eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority ) |
| 17197 | { |
| 17198 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17199 | if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd ) |
| 17200 | { |
| 17201 | smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"), |
| 17202 | pCommand->u.scanCmd.reason); |
| 17203 | return eHAL_STATUS_CSR_WRONG_STATE; |
| 17204 | } |
| 17205 | |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 17206 | if ((pMac->fScanOffload) && (pCommand->command == eSmeCommandScan)) |
| 17207 | { |
| 17208 | csrLLInsertTail(&pMac->sme.smeScanCmdPendingList, |
| 17209 | &pCommand->Link, LL_ACCESS_LOCK); |
| 17210 | // process the command queue... |
| 17211 | smeProcessPendingQueue(pMac); |
| 17212 | status = eHAL_STATUS_SUCCESS; |
| 17213 | goto end; |
| 17214 | } |
| 17215 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17216 | //We can call request full power first before putting the command into pending Q |
| 17217 | //because we are holding SME lock at this point. |
| 17218 | status = csrRequestFullPower( pMac, pCommand ); |
| 17219 | if( HAL_STATUS_SUCCESS( status ) ) |
| 17220 | { |
| 17221 | tANI_BOOLEAN fNoCmdPending; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17222 | //make sure roamCmdPendingList is not empty first |
| 17223 | fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE ); |
| 17224 | if( fNoCmdPending ) |
| 17225 | { |
| 17226 | smePushCommand( pMac, pCommand, fHighPriority ); |
| 17227 | } |
| 17228 | else |
| 17229 | { |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 17230 | //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] | 17231 | //no list lock is needed since SME lock is held |
| 17232 | if( !fHighPriority ) |
| 17233 | { |
| 17234 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 17235 | } |
| 17236 | else { |
| 17237 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 17238 | } |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 17239 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17240 | } |
| 17241 | else if( eHAL_STATUS_PMC_PENDING == status ) |
| 17242 | { |
| 17243 | //no list lock is needed since SME lock is held |
| 17244 | if( !fHighPriority ) |
| 17245 | { |
| 17246 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 17247 | } |
| 17248 | else { |
| 17249 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 17250 | } |
| 17251 | //Let caller know the command is queue |
| 17252 | status = eHAL_STATUS_SUCCESS; |
| 17253 | } |
| 17254 | else |
| 17255 | { |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 17256 | //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] | 17257 | //release the command. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17258 | smsLog( pMac, LOGE, FL( " cannot queue command %d" ), pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17259 | } |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 17260 | end: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17261 | return ( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17262 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17263 | eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES ) |
| 17264 | { |
| 17265 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17266 | tSirUpdateAPWPSIEsReq *pMsg; |
| 17267 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 17268 | |
| 17269 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 17270 | if (NULL == pSession) |
| 17271 | { |
| 17272 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 17273 | return eHAL_STATUS_FAILURE; |
| 17274 | } |
| 17275 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17276 | do |
| 17277 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17278 | pMsg = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq)); |
| 17279 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 17280 | vos_mem_set(pMsg, sizeof(tSirUpdateAPWPSIEsReq), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17281 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPDATE_APWPSIE_REQ); |
| 17282 | |
| 17283 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 17284 | VOS_ASSERT(pBuf); |
| 17285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17286 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17287 | // transactionId |
| 17288 | *pBuf = 0; |
| 17289 | *( pBuf + 1 ) = 0; |
| 17290 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17291 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17292 | vos_mem_copy((tSirMacAddr *)pBuf, &pSession->selfMacAddr, |
| 17293 | sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17294 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17295 | //sessionId |
| 17296 | *pBuf++ = (tANI_U8)sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17297 | // APWPSIEs |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17298 | vos_mem_copy((tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17299 | pBuf += sizeof(tSirAPWPSIEs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17300 | 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] | 17301 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17302 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17303 | return ( status ); |
| 17304 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17305 | eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie) |
| 17306 | { |
| 17307 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17308 | tSirUpdateAPWPARSNIEsReq *pMsg; |
| 17309 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17310 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 17311 | if (NULL == pSession) |
| 17312 | { |
| 17313 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 17314 | return eHAL_STATUS_FAILURE; |
| 17315 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17316 | do |
| 17317 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17318 | pMsg = vos_mem_malloc(sizeof(tSirUpdateAPWPARSNIEsReq)); |
| 17319 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 17320 | vos_mem_set(pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17321 | 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] | 17322 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 17323 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17324 | // transactionId |
| 17325 | *pBuf = 0; |
| 17326 | *( pBuf + 1 ) = 0; |
| 17327 | pBuf += sizeof(tANI_U16); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 17328 | VOS_ASSERT(pBuf); |
| 17329 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17330 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17331 | vos_mem_copy((tSirMacAddr *)pBuf, &pSession->selfMacAddr, |
| 17332 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17333 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17334 | // sessionId |
| 17335 | *pBuf++ = (tANI_U8)sessionId; |
| 17336 | |
| 17337 | // APWPARSNIEs |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17338 | vos_mem_copy((tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17339 | pBuf += sizeof(tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17340 | 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] | 17341 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17342 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17343 | return ( status ); |
| 17344 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17345 | |
| 17346 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 17347 | //eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId) |
| 17348 | eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription) |
| 17349 | { |
| 17350 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 17351 | tpSirFTPreAuthReq pftPreAuthReq; |
| 17352 | tANI_U16 auth_req_len = 0; |
| 17353 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17354 | auth_req_len = sizeof(tSirFTPreAuthReq); |
| 17355 | pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17356 | if (NULL == pftPreAuthReq) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17357 | { |
| 17358 | smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed")); |
| 17359 | return eHAL_STATUS_RESOURCES; |
| 17360 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17361 | // Save the SME Session ID here. We need it while processing the preauth response |
| 17362 | pMac->ft.ftSmeContext.smeSessionId = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17363 | vos_mem_zero(pftPreAuthReq, auth_req_len); |
| 17364 | |
| 17365 | pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc( |
| 17366 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 17367 | |
| 17368 | pftPreAuthReq->messageType = pal_cpu_to_be16(eWNI_SME_FT_PRE_AUTH_REQ); |
| 17369 | |
| 17370 | pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId; |
| 17371 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17372 | vos_mem_copy((void *)&pftPreAuthReq->currbssId, |
| 17373 | (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
| 17374 | vos_mem_copy((void *)&pftPreAuthReq->preAuthbssId, |
| 17375 | (void *)pBssDescription->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17377 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 17378 | if (csrRoamIs11rAssoc(pMac) && |
| 17379 | (pMac->roam.roamSession[sessionId].connectedProfile.AuthType != eCSR_AUTH_TYPE_OPEN_SYSTEM)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17380 | { |
| 17381 | 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] | 17382 | vos_mem_copy(pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies, |
| 17383 | pMac->ft.ftSmeContext.auth_ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17384 | } |
| 17385 | else |
| 17386 | #endif |
| 17387 | { |
| 17388 | pftPreAuthReq->ft_ies_length = 0; |
| 17389 | } |
Madan Mohan Koyyalamudi | 613b0a4 | 2012-10-31 15:55:53 -0700 | [diff] [blame] | 17390 | vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, |
| 17391 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 17392 | pftPreAuthReq->length = pal_cpu_to_be16(auth_req_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17393 | return palSendMBMessage(pMac->hHdd, pftPreAuthReq); |
| 17394 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17395 | /*-------------------------------------------------------------------------- |
| 17396 | * This will receive and process the FT Pre Auth Rsp from the current |
| 17397 | * associated ap. |
| 17398 | * |
| 17399 | * This will invoke the hdd call back. This is so that hdd can now |
| 17400 | * send the FTIEs from the Auth Rsp (Auth Seq 2) to the supplicant. |
| 17401 | ------------------------------------------------------------------------*/ |
| 17402 | void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp ) |
| 17403 | { |
| 17404 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 17405 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 17406 | #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] | 17407 | tCsrRoamInfo roamInfo; |
| 17408 | #endif |
Kanchanapally, Vidyullatha | 4f84f68 | 2014-04-29 20:40:34 +0530 | [diff] [blame] | 17409 | eCsrAuthType conn_Auth_type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17410 | |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 17411 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 17412 | status = csrNeighborRoamPreauthRspHandler(pMac, pFTPreAuthRsp->status); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 17413 | if (status != eHAL_STATUS_SUCCESS) { |
| 17414 | /* |
| 17415 | * Bail out if pre-auth was not even processed. |
| 17416 | */ |
Agarwal Ashish | e3cca2a | 2013-07-21 03:01:48 +0530 | [diff] [blame] | 17417 | smsLog(pMac, LOGE,FL("Preauth was not processed: %d SessionID: %d"), |
| 17418 | status, pFTPreAuthRsp->smeSessionId); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 17419 | return; |
| 17420 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17421 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17422 | /* The below function calls/timers should be invoked only if the pre-auth is successful */ |
| 17423 | if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status) |
| 17424 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17425 | // Implies a success |
| 17426 | pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17427 | // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs |
| 17428 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp; |
Sandeep Puligilla | 0c486ca | 2014-05-24 02:40:49 +0530 | [diff] [blame] | 17429 | /* No need to notify qos module if this is a non 11r & ESE roam*/ |
| 17430 | if (csrRoamIs11rAssoc(pMac) |
| 17431 | #if defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_ESE_UPLOAD) |
| 17432 | || csrRoamIsESEAssoc(pMac) |
| 17433 | #endif |
| 17434 | ) |
Tushnim Bhattacharyya | 8436d77 | 2013-06-26 23:03:29 -0700 | [diff] [blame] | 17435 | { |
| 17436 | sme_QosCsrEventInd(pMac, pMac->ft.ftSmeContext.smeSessionId, SME_QOS_CSR_PREAUTH_SUCCESS_IND, NULL); |
| 17437 | } |
Mukul Sharma | be91e2f | 2014-06-29 22:09:20 +0530 | [diff] [blame] | 17438 | #ifdef DEBUG_ROAM_DELAY |
| 17439 | vos_record_roam_event(e_CACHE_ROAM_DELAY_DATA, NULL, 0); |
| 17440 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17441 | /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, |
| 17442 | * actual transition from the current to handoff AP is triggered */ |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 17443 | status = vos_timer_start(&pMac->ft.ftSmeContext.preAuthReassocIntvlTimer, |
| 17444 | 60); |
Mukul Sharma | be91e2f | 2014-06-29 22:09:20 +0530 | [diff] [blame] | 17445 | #ifdef DEBUG_ROAM_DELAY |
| 17446 | vos_record_roam_event(e_SME_PREAUTH_REASSOC_START, NULL, 0); |
| 17447 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17448 | if (eHAL_STATUS_SUCCESS != status) |
| 17449 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17450 | 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] | 17451 | return; |
| 17452 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17453 | // Save the received response |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17454 | vos_mem_copy((void *)&pMac->ft.ftSmeContext.preAuthbssId, |
| 17455 | (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17456 | if (csrRoamIs11rAssoc(pMac)) |
| 17457 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, NULL, 0, |
| 17458 | eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE); |
| 17459 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 17460 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
| 17461 | if (csrRoamIsESEAssoc(pMac)) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17462 | { |
| 17463 | /* read TSF */ |
| 17464 | csrRoamReadTSF(pMac, (tANI_U8 *)roamInfo.timestamp); |
| 17465 | |
| 17466 | // Save the bssid from the received response |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 17467 | vos_mem_copy((void *)&roamInfo.bssid, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17468 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_CCKM_PREAUTH_NOTIFY, 0); |
| 17469 | } |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 17470 | #endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17471 | #ifdef FEATURE_WLAN_LFR |
| 17472 | // If Legacy Fast Roaming is enabled, signal the supplicant |
| 17473 | // 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] | 17474 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17475 | { |
| 17476 | // Save the bssid from the received response |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17477 | vos_mem_copy((void *)&roamInfo.bssid, |
| 17478 | (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 17479 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_PMK_NOTIFY, 0); |
| 17480 | } |
| 17481 | |
| 17482 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17483 | |
Kanchanapally, Vidyullatha | 4f84f68 | 2014-04-29 20:40:34 +0530 | [diff] [blame] | 17484 | // If its an Open Auth, FT IEs are not provided by supplicant |
| 17485 | // Hence populate them here |
| 17486 | conn_Auth_type = pMac->roam.roamSession[pMac->ft.ftSmeContext.smeSessionId].connectedProfile.AuthType; |
| 17487 | pMac->ft.ftSmeContext.addMDIE = FALSE; |
| 17488 | if( csrRoamIs11rAssoc(pMac) && |
| 17489 | (conn_Auth_type == eCSR_AUTH_TYPE_OPEN_SYSTEM)) |
| 17490 | { |
| 17491 | tANI_U16 ft_ies_length; |
| 17492 | ft_ies_length = pFTPreAuthRsp->ric_ies_length; |
| 17493 | |
| 17494 | if ( (pMac->ft.ftSmeContext.reassoc_ft_ies) && |
| 17495 | (pMac->ft.ftSmeContext.reassoc_ft_ies_length)) |
| 17496 | { |
| 17497 | vos_mem_free(pMac->ft.ftSmeContext.reassoc_ft_ies); |
| 17498 | pMac->ft.ftSmeContext.reassoc_ft_ies_length = 0; |
| 17499 | } |
| 17500 | |
| 17501 | pMac->ft.ftSmeContext.reassoc_ft_ies = vos_mem_malloc(ft_ies_length); |
| 17502 | if ( NULL == pMac->ft.ftSmeContext.reassoc_ft_ies ) |
| 17503 | { |
| 17504 | smsLog( pMac, LOGE, FL("Memory allocation failed for ft_ies")); |
| 17505 | } |
| 17506 | else |
| 17507 | { |
| 17508 | // Copy the RIC IEs to reassoc IEs |
| 17509 | vos_mem_copy(((tANI_U8 *)pMac->ft.ftSmeContext.reassoc_ft_ies), |
| 17510 | (tANI_U8 *)pFTPreAuthRsp->ric_ies, |
| 17511 | pFTPreAuthRsp->ric_ies_length); |
| 17512 | pMac->ft.ftSmeContext.reassoc_ft_ies_length = ft_ies_length; |
| 17513 | pMac->ft.ftSmeContext.addMDIE = TRUE; |
| 17514 | } |
| 17515 | } |
| 17516 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17517 | // Done with it, init it. |
| 17518 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL; |
| 17519 | } |
| 17520 | #endif |
Kanchanapally, Vidyullatha | 4f84f68 | 2014-04-29 20:40:34 +0530 | [diff] [blame] | 17521 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17522 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 17523 | void csrRoamJoinRetryTimerHandler(void *pv) |
| 17524 | { |
| 17525 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 17526 | tpAniSirGlobal pMac = pInfo->pMac; |
| 17527 | tANI_U32 sessionId = pInfo->sessionId; |
| 17528 | tCsrRoamSession *pSession; |
| 17529 | |
| 17530 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 17531 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17532 | 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] | 17533 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 17534 | if(pSession->pCurRoamProfile && csrIsConnStateDisconnected(pMac, sessionId)) |
| 17535 | { |
| 17536 | if( !HAL_STATUS_SUCCESS(csrRoamJoinLastProfile(pMac, sessionId)) ) |
| 17537 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17538 | smsLog( pMac, LOGE, FL( " fail to retry the last roam profile" ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17539 | } |
| 17540 | } |
| 17541 | } |
| 17542 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17543 | eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 17544 | { |
| 17545 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 17546 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 17547 | |
| 17548 | if(pSession->pCurRoamProfile && pSession->maxRetryCount) |
| 17549 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17550 | 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] | 17551 | pSession->maxRetryCount--; |
| 17552 | pSession->joinRetryTimerInfo.pMac = pMac; |
| 17553 | pSession->joinRetryTimerInfo.sessionId = (tANI_U8)sessionId; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 17554 | status = vos_timer_start(&pSession->hTimerJoinRetry, interval/PAL_TIMER_TO_MS_UNIT); |
| 17555 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17556 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17557 | smsLog(pMac, LOGE, FL(" fail to start timer status %s"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17558 | } |
| 17559 | } |
| 17560 | else |
| 17561 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17562 | 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] | 17563 | pSession->maxRetryCount); |
| 17564 | } |
| 17565 | |
| 17566 | return (status); |
| 17567 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17568 | eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 17569 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 17570 | smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17571 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 17572 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 17573 | return (vos_timer_stop(&pMac->roam.roamSession[sessionId].hTimerJoinRetry)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 17574 | } |
| 17575 | |
| 17576 | return eHAL_STATUS_SUCCESS; |
| 17577 | } |
| 17578 | #endif |
| 17579 | |
| 17580 | |
| 17581 | /* |
| 17582 | pBuf points to the beginning of the message |
| 17583 | LIM packs disassoc rsp as below, |
| 17584 | messageType - 2 bytes |
| 17585 | messageLength - 2 bytes |
| 17586 | sessionId - 1 byte |
| 17587 | transactionId - 2 bytes (tANI_U16) |
| 17588 | reasonCode - 4 bytes (sizeof(tSirResultCodes)) |
| 17589 | peerMacAddr - 6 bytes |
| 17590 | The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) and not used |
| 17591 | */ |
| 17592 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp) |
| 17593 | { |
| 17594 | if(pBuf && pRsp) |
| 17595 | { |
| 17596 | pBuf += 4; //skip type and length |
| 17597 | pRsp->sessionId = *pBuf++; |
| 17598 | pal_get_U16( pBuf, (tANI_U16 *)&pRsp->transactionId ); |
| 17599 | pBuf += 2; |
| 17600 | pal_get_U32( pBuf, (tANI_U32 *)&pRsp->statusCode ); |
| 17601 | pBuf += 4; |
| 17602 | vos_mem_copy(pRsp->peerMacAddr, pBuf, 6); |
| 17603 | } |
| 17604 | } |
| 17605 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 17606 | eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 17607 | { |
| 17608 | static uNvTables nvTables; |
| 17609 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17610 | VOS_STATUS vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 17611 | |
| 17612 | /* read the country code from NV and use it */ |
| 17613 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 17614 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17615 | vos_mem_copy(pCountry, nvTables.defaultCountryTable.countryCode, |
| 17616 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 17617 | return status; |
| 17618 | } |
| 17619 | else |
| 17620 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17621 | vos_mem_copy(pCountry, "XXX", WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 17622 | status = eHAL_STATUS_FAILURE; |
| 17623 | return status; |
| 17624 | } |
| 17625 | } |
| 17626 | |
| 17627 | eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 17628 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17629 | vos_mem_copy(pCountry, pMac->scan.countryCode11d, WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 17630 | return eHAL_STATUS_SUCCESS; |
| 17631 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 17632 | |
| 17633 | eHalStatus csrSetTxPower(tpAniSirGlobal pMac, v_U8_t sessionId, v_U8_t mW) |
| 17634 | { |
| 17635 | tSirSetTxPowerReq *pMsg = NULL; |
| 17636 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17637 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 17638 | |
| 17639 | if (!pSession) |
| 17640 | { |
| 17641 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 17642 | return eHAL_STATUS_FAILURE; |
| 17643 | } |
| 17644 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17645 | pMsg = vos_mem_malloc(sizeof(tSirSetTxPowerReq)); |
| 17646 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 17647 | vos_mem_set((void *)pMsg, sizeof(tSirSetTxPowerReq), 0); |
| 17648 | pMsg->messageType = eWNI_SME_SET_TX_POWER_REQ; |
| 17649 | pMsg->length = sizeof(tSirSetTxPowerReq); |
| 17650 | pMsg->mwPower = mW; |
| 17651 | vos_mem_copy((tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, |
| 17652 | sizeof(tSirMacAddr)); |
| 17653 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 17654 | if (!HAL_STATUS_SUCCESS(status)) |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 17655 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17656 | smsLog(pMac, LOGE, FL(" csr set TX Power Post MSG Fail %d "), status); |
| 17657 | //pMsg is freed by palSendMBMessage |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 17658 | } |
| 17659 | return status; |
| 17660 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 17661 | |
Sandeep Puligilla | 332ea91 | 2014-02-04 00:16:24 +0530 | [diff] [blame] | 17662 | eHalStatus csrHT40StopOBSSScan(tpAniSirGlobal pMac, v_U8_t sessionId) |
| 17663 | { |
| 17664 | tSirSmeHT40OBSSStopScanInd *pMsg = NULL; |
| 17665 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17666 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 17667 | |
| 17668 | if (!pSession) |
| 17669 | { |
| 17670 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 17671 | return eHAL_STATUS_FAILURE; |
| 17672 | } |
| 17673 | if(IS_HT40_OBSS_SCAN_FEATURE_ENABLE) |
| 17674 | { |
| 17675 | pMsg = vos_mem_malloc(sizeof(tSirSmeHT40OBSSStopScanInd)); |
Abhishek Singh | 11aa290 | 2014-05-05 11:52:52 +0530 | [diff] [blame] | 17676 | |
| 17677 | if( NULL == pMsg ) |
| 17678 | { |
| 17679 | smsLog(pMac, LOGE, FL("PMsg is NULL ")); |
| 17680 | return eHAL_STATUS_FAILURE; |
| 17681 | } |
Sandeep Puligilla | 332ea91 | 2014-02-04 00:16:24 +0530 | [diff] [blame] | 17682 | vos_mem_zero((void *)pMsg, sizeof(tSirSmeHT40OBSSStopScanInd)); |
| 17683 | pMsg->messageType = eWNI_SME_HT40_STOP_OBSS_SCAN_IND; |
| 17684 | pMsg->length = sizeof(tANI_U8); |
| 17685 | pMsg->seesionId = sessionId; |
| 17686 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 17687 | if (!HAL_STATUS_SUCCESS(status)) |
| 17688 | { |
| 17689 | smsLog(pMac, LOGE, FL(" csr STOP OBSS SCAN Fail %d "), status); |
| 17690 | //pMsg is freed by palSendMBMessage |
| 17691 | } |
| 17692 | } |
| 17693 | else |
| 17694 | { |
| 17695 | smsLog(pMac, LOGE, FL(" OBSS STOP OBSS SCAN is not supported")); |
| 17696 | status = eHAL_STATUS_FAILURE; |
| 17697 | } |
| 17698 | return status; |
| 17699 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 17700 | /* Returns whether a session is in VOS_STA_MODE...or not */ |
| 17701 | tANI_BOOLEAN csrRoamIsStaMode(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 17702 | { |
| 17703 | tCsrRoamSession *pSession = NULL; |
| 17704 | pSession = CSR_GET_SESSION ( pMac, sessionId ); |
| 17705 | if(!pSession) |
| 17706 | { |
| 17707 | smsLog(pMac, LOGE, FL(" %s: session %d not found "), __func__, sessionId); |
| 17708 | return eANI_BOOLEAN_FALSE; |
| 17709 | } |
| 17710 | if ( !CSR_IS_SESSION_VALID ( pMac, sessionId ) ) |
| 17711 | { |
| 17712 | smsLog(pMac, LOGE, FL(" %s: Inactive session"), __func__); |
| 17713 | return eANI_BOOLEAN_FALSE; |
| 17714 | } |
| 17715 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 17716 | { |
| 17717 | return eANI_BOOLEAN_FALSE; |
| 17718 | } |
| 17719 | /* There is a possibility that the above check may fail,because |
| 17720 | * P2P CLI also uses the same BSSType (eCSR_BSS_TYPE_INFRASTRUCTURE) |
| 17721 | * when it is connected.So,we may sneak through the above check even |
| 17722 | * if we are not a STA mode INFRA station. So, if we sneak through |
| 17723 | * the above condition, we can use the following check if we are |
| 17724 | * really in STA Mode.*/ |
| 17725 | |
| 17726 | if ( NULL != pSession->pCurRoamProfile ) |
| 17727 | { |
| 17728 | if ( pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE ) |
| 17729 | { |
| 17730 | return eANI_BOOLEAN_TRUE; |
| 17731 | } else { |
| 17732 | smsLog(pMac, LOGE, FL(" %s: pCurRoamProfile is NULL\n"), __func__); |
| 17733 | return eANI_BOOLEAN_FALSE; |
| 17734 | } |
| 17735 | } |
| 17736 | |
| 17737 | return eANI_BOOLEAN_FALSE; |
| 17738 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17739 | |
| 17740 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 17741 | eHalStatus csrHandoffRequest(tpAniSirGlobal pMac, |
| 17742 | tCsrHandoffRequest *pHandoffInfo) |
| 17743 | { |
| 17744 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17745 | vos_msg_t msg; |
| 17746 | |
| 17747 | tAniHandoffReq *pMsg; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17748 | pMsg = vos_mem_malloc(sizeof(tAniHandoffReq)); |
| 17749 | if ( NULL == pMsg ) |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17750 | { |
| 17751 | smsLog(pMac, LOGE, " csrHandoffRequest: failed to allocate mem for req "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17752 | return eHAL_STATUS_FAILURE; |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17753 | } |
| 17754 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_HANDOFF_REQ); |
| 17755 | pMsg->msgLen = (tANI_U16)sizeof(tAniHandoffReq); |
| 17756 | pMsg->sessionId = pMac->roam.neighborRoamInfo.csrSessionId; |
| 17757 | pMsg->channel = pHandoffInfo->channel; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17758 | vos_mem_copy(pMsg->bssid, |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17759 | pHandoffInfo->bssid, |
| 17760 | 6); |
| 17761 | msg.type = eWNI_SME_HANDOFF_REQ; |
| 17762 | msg.bodyptr = pMsg; |
| 17763 | msg.reserved = 0; |
| 17764 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 17765 | { |
| 17766 | smsLog(pMac, LOGE, " csrHandoffRequest failed to post msg to self "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 17767 | vos_mem_free((void *)pMsg); |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 17768 | status = eHAL_STATUS_FAILURE; |
| 17769 | } |
| 17770 | return status; |
| 17771 | } |
| 17772 | #endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17773 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 17774 | |
| 17775 | #if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD) |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17776 | /* --------------------------------------------------------------------------- |
| 17777 | \fn csrSetCCKMIe |
| 17778 | \brief This function stores the CCKM IE passed by the supplicant in a place holder |
| 17779 | data structure and this IE will be packed inside reassociation request |
| 17780 | \param pMac - pMac global structure |
| 17781 | \param sessionId - Current session id |
| 17782 | \param pCckmIe - pointer to CCKM IE data |
| 17783 | \param ccKmIeLen - length of the CCKM IE |
| 17784 | \- return Success or failure |
| 17785 | -------------------------------------------------------------------------*/ |
| 17786 | VOS_STATUS csrSetCCKMIe(tpAniSirGlobal pMac, const tANI_U8 sessionId, |
| 17787 | const tANI_U8 *pCckmIe, |
| 17788 | const tANI_U8 ccKmIeLen) |
| 17789 | { |
| 17790 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17791 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 17792 | |
| 17793 | if (!pSession) |
| 17794 | { |
| 17795 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 17796 | return eHAL_STATUS_FAILURE; |
| 17797 | } |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 17798 | vos_mem_copy(pSession->suppCckmIeInfo.cckmIe, pCckmIe, ccKmIeLen); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17799 | pSession->suppCckmIeInfo.cckmIeLen = ccKmIeLen; |
| 17800 | return status; |
| 17801 | } |
| 17802 | |
| 17803 | /* --------------------------------------------------------------------------- |
| 17804 | \fn csrRoamReadTSF |
| 17805 | \brief This function reads the TSF; and also add the time elapsed since last beacon or |
| 17806 | probe response reception from the hand off AP to arrive at the latest TSF value. |
| 17807 | \param pMac - pMac global structure |
| 17808 | \param pTimestamp - output TSF timestamp |
| 17809 | \- return Success or failure |
| 17810 | -------------------------------------------------------------------------*/ |
| 17811 | VOS_STATUS csrRoamReadTSF(tpAniSirGlobal pMac, tANI_U8 *pTimestamp) |
| 17812 | { |
| 17813 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 17814 | tCsrNeighborRoamBSSInfo handoffNode; |
| 17815 | tANI_U32 timer_diff = 0; |
| 17816 | tANI_U32 timeStamp[2]; |
| 17817 | tpSirBssDescription pBssDescription = NULL; |
| 17818 | |
| 17819 | csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode); |
| 17820 | pBssDescription = handoffNode.pBssDescription; |
| 17821 | |
| 17822 | // Get the time diff in milli seconds |
| 17823 | timer_diff = vos_timer_get_system_time() - pBssDescription->scanSysTimeMsec; |
| 17824 | // Convert msec to micro sec timer |
| 17825 | timer_diff = (tANI_U32)(timer_diff * SYSTEM_TIME_MSEC_TO_USEC); |
| 17826 | |
| 17827 | timeStamp[0] = pBssDescription->timeStamp[0]; |
| 17828 | timeStamp[1] = pBssDescription->timeStamp[1]; |
| 17829 | |
| 17830 | UpdateCCKMTSF(&(timeStamp[0]), &(timeStamp[1]), &timer_diff); |
| 17831 | |
Kiet Lam | f2f201e | 2013-11-16 21:24:16 +0530 | [diff] [blame] | 17832 | vos_mem_copy(pTimestamp, (void *) &timeStamp[0], |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17833 | sizeof (tANI_U32) * 2); |
| 17834 | return status; |
| 17835 | } |
| 17836 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 17837 | #endif /*FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 17838 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 17839 | /* --------------------------------------------------------------------------- |
| 17840 | \fn csrDisableDfsChannel |
| 17841 | \brief This function will call csrApplyChannelPowerCountryInfo to |
| 17842 | \ to trim the list on basis of NO_DFS flag. |
| 17843 | \param pMac - pMac global structure |
| 17844 | \- return void |
| 17845 | -------------------------------------------------------------------------*/ |
| 17846 | void csrDisableDfsChannel(tpAniSirGlobal pMac) |
| 17847 | { |
| 17848 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, |
| 17849 | pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE); |
| 17850 | } |