Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /** ------------------------------------------------------------------------- * |
| 43 | ------------------------------------------------------------------------- * |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 44 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 45 | |
| 46 | \file csrApiRoam.c |
| 47 | |
| 48 | Implementation for the Common Roaming interfaces. |
| 49 | |
| 50 | Copyright (C) 2008 Qualcomm, Incorporated |
| 51 | |
| 52 | |
| 53 | ========================================================================== */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 54 | /*=========================================================================== |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | EDIT HISTORY FOR FILE |
| 56 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | This section contains comments describing changes made to the module. |
| 58 | Notice that changes are listed in reverse chronological order. |
| 59 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | when who what, where, why |
| 61 | ---------- --- -------------------------------------------------------- |
| 62 | 06/03/10 js Added support to hostapd driven |
| 63 | * deauth/disassoc/mic failure |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 64 | ===========================================================================*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 65 | #include "aniGlobal.h" //for tpAniSirGlobal |
| 66 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 67 | #include "halMsgApi.h" //for HAL_STA_INVALID_IDX. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 68 | #include "limUtils.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 69 | #include "palApi.h" |
| 70 | #include "csrInsideApi.h" |
| 71 | #include "smsDebug.h" |
| 72 | #include "logDump.h" |
| 73 | #include "smeQosInternal.h" |
| 74 | #include "wlan_qct_tl.h" |
| 75 | #include "smeInside.h" |
| 76 | #include "vos_diag_core_event.h" |
| 77 | #include "vos_diag_core_log.h" |
| 78 | #include "csrApi.h" |
| 79 | #include "pmc.h" |
| 80 | #include "vos_nvitem.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 81 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 82 | #include "csrNeighborRoam.h" |
| 83 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 84 | #if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 85 | #include "csrCcx.h" |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 86 | #endif /* FEATURE_WLAN_CCX && !FEATURE_WLAN_CCX_UPLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | #define CSR_NUM_IBSS_START_CHANNELS_50 4 |
| 88 | #define CSR_NUM_IBSS_START_CHANNELS_24 3 |
| 89 | #define CSR_DEF_IBSS_START_CHANNEL_50 36 |
| 90 | #define CSR_DEF_IBSS_START_CHANNEL_24 1 |
Srikant Kuppa | 2062aaf | 2012-12-27 17:36:41 -0800 | [diff] [blame] | 91 | #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] | 92 | #define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD ( 120 * PAL_TIMER_TO_SEC_UNIT ) // 120 seconds, for WPS |
| 93 | /*--------------------------------------------------------------------------- |
| 94 | OBIWAN recommends [8 10]% : pick 9% |
| 95 | ---------------------------------------------------------------------------*/ |
| 96 | #define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 97 | /*--------------------------------------------------------------------------- |
| 98 | OBIWAN recommends -85dBm |
| 99 | ---------------------------------------------------------------------------*/ |
| 100 | #define CSR_VCC_RSSI_THRESHOLD 80 |
| 101 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD 500 //ms |
| 102 | #define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 //ms |
| 103 | #define CSR_MIN_TL_STAT_QUERY_PERIOD 500 //ms |
| 104 | #define CSR_DIAG_LOG_STAT_PERIOD 3000 //ms |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | //We use constatnt 4 here |
| 106 | //This macro returns true when higher AC parameter is bigger than lower AC for a difference |
| 107 | //The bigger the number, the less chance of TX |
| 108 | //It must put lower AC as the first parameter. |
| 109 | #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] | 110 | //Flag to send/do not send disassoc frame over the air |
| 111 | #define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 112 | #define RSSI_HACK_BMPS (-40) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 113 | #define MAX_CB_VALUE_IN_INI (2) |
| 114 | |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 115 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 116 | static tANI_BOOLEAN bRoamScanOffloadStarted = VOS_FALSE; |
| 117 | #endif |
| 118 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 119 | /*-------------------------------------------------------------------------- |
| 120 | Static Type declarations |
| 121 | ------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 122 | static tCsrRoamSession csrRoamRoamSession[CSR_ROAM_SESSION_MAX]; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 123 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 124 | /*-------------------------------------------------------------------------- |
| 125 | Type declarations |
| 126 | ------------------------------------------------------------------------*/ |
| 127 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 128 | int diagAuthTypeFromCSRType(eCsrAuthType authType) |
| 129 | { |
| 130 | int n = AUTH_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 131 | switch(authType) |
| 132 | { |
| 133 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 134 | n = AUTH_SHARED; |
| 135 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 136 | case eCSR_AUTH_TYPE_WPA: |
| 137 | n = AUTH_WPA_EAP; |
| 138 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 139 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 140 | n = AUTH_WPA_PSK; |
| 141 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 142 | case eCSR_AUTH_TYPE_RSN: |
| 143 | n = AUTH_WPA2_EAP; |
| 144 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 145 | case eCSR_AUTH_TYPE_RSN_PSK: |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 146 | #ifdef WLAN_FEATURE_11W |
| 147 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 148 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 149 | n = AUTH_WPA2_PSK; |
| 150 | break; |
| 151 | #ifdef FEATURE_WLAN_WAPI |
| 152 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 153 | n = AUTH_WAPI_CERT; |
| 154 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 155 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 156 | n = AUTH_WAPI_PSK; |
| 157 | break; |
| 158 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 159 | default: |
| 160 | break; |
| 161 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 162 | return (n); |
| 163 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 164 | int diagEncTypeFromCSRType(eCsrEncryptionType encType) |
| 165 | { |
| 166 | int n = ENC_MODE_OPEN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 167 | switch(encType) |
| 168 | { |
| 169 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 170 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 171 | n = ENC_MODE_WEP40; |
| 172 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 173 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 174 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 175 | n = ENC_MODE_WEP104; |
| 176 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 177 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 178 | n = ENC_MODE_TKIP; |
| 179 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 180 | case eCSR_ENCRYPT_TYPE_AES: |
| 181 | n = ENC_MODE_AES; |
| 182 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 183 | #ifdef FEATURE_WLAN_WAPI |
| 184 | case eCSR_ENCRYPT_TYPE_WPI: |
| 185 | n = ENC_MODE_SMS4; |
| 186 | break; |
| 187 | #endif /* FEATURE_WLAN_WAPI */ |
| 188 | default: |
| 189 | break; |
| 190 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 191 | return (n); |
| 192 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 194 | static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40, 44, 48}; |
| 195 | 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] | 196 | static void initConfigParam(tpAniSirGlobal pMac); |
| 197 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 198 | eCsrRoamCompleteResult Result, void *Context ); |
| 199 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 200 | tCsrRoamProfile *pProfile, |
| 201 | tANI_BOOLEAN *pfSameIbss ); |
| 202 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss ); |
| 203 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 204 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes); |
| 205 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 206 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac); |
| 207 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ); |
| 208 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac); |
| 209 | eHalStatus csrRoamClose(tpAniSirGlobal pMac); |
| 210 | void csrRoamMICErrorTimerHandler(void *pv); |
| 211 | void csrRoamTKIPCounterMeasureTimerHandler(void *pv); |
| 212 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2); |
| 213 | |
| 214 | static eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval); |
| 215 | static eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 216 | static void csrRoamRoamingTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 217 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval); |
| 218 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac); |
| 219 | static void csrRoamWaitForKeyTimeOutHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 220 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 221 | static eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 222 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ); |
| 223 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 224 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 225 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 226 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 227 | tANI_U8 *pKeyRsc ); |
| 228 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 229 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, |
| 230 | tCsrRoamProfile *pProfile ); |
| 231 | void csrRoamStatisticsTimerHandler(void *pv); |
| 232 | void csrRoamStatsGlobalClassDTimerHandler(void *pv); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 233 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid); |
| 234 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 235 | v_U8_t rssiNotification, |
| 236 | void * context); |
| 237 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId); |
| 238 | void csrRoamVccTrigger(tpAniSirGlobal pMac); |
| 239 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId); |
| 240 | /* |
| 241 | pStaEntry is no longer invalid upon the return of this function. |
| 242 | */ |
| 243 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 244 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 245 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 246 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 247 | tDblLinkList *pStaList, |
| 248 | tCsrStatsClientReqInfo *pStaEntry); |
| 249 | void csrRoamStatsClientTimerHandler(void *pv); |
| 250 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 251 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId); |
| 252 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 253 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 254 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 255 | void csrRoamTlStatsTimerHandler(void *pv); |
| 256 | void csrRoamPeStatsTimerHandler(void *pv); |
| 257 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 258 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry); |
| 259 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask); |
| 260 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac); |
| 261 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ); |
| 262 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ); |
| 263 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ); |
| 264 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 265 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ); |
| 266 | //static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ); |
| 267 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc); |
| 268 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac); |
| 269 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 270 | void csrRoamJoinRetryTimerHandler(void *pv); |
| 271 | #endif |
| 272 | extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 273 | extern void btampEstablishLogLinkHdlr(void* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 274 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 275 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 276 | |
| 277 | //Initialize global variables |
| 278 | static void csrRoamInitGlobals(tpAniSirGlobal pMac) |
| 279 | { |
| 280 | if(pMac) |
| 281 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 282 | vos_mem_zero(&csrRoamRoamSession, sizeof(csrRoamRoamSession)); |
| 283 | pMac->roam.roamSession = csrRoamRoamSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 284 | } |
| 285 | return; |
| 286 | } |
| 287 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 288 | static void csrRoamDeInitGlobals(tpAniSirGlobal pMac) |
| 289 | { |
| 290 | if(pMac) |
| 291 | { |
Madan Mohan Koyyalamudi | 84b7f0a | 2012-11-28 15:15:14 -0800 | [diff] [blame] | 292 | pMac->roam.roamSession = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | } |
| 294 | return; |
| 295 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 296 | eHalStatus csrOpen(tpAniSirGlobal pMac) |
| 297 | { |
| 298 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 299 | static uNvTables nvTables; |
| 300 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 301 | v_REGDOMAIN_t regId; |
| 302 | tANI_U32 i; |
| 303 | |
| 304 | do |
| 305 | { |
| 306 | /* Initialize CSR Roam Globals */ |
| 307 | csrRoamInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 308 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 309 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i); |
| 310 | |
| 311 | initConfigParam(pMac); |
| 312 | if(!HAL_STATUS_SUCCESS((status = csrScanOpen(pMac)))) |
| 313 | break; |
| 314 | if(!HAL_STATUS_SUCCESS((status = csrRoamOpen(pMac)))) |
| 315 | break; |
| 316 | pMac->roam.nextRoamId = 1; //Must not be 0 |
| 317 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.statsClientReqList))) |
| 318 | break; |
| 319 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.peStatsReqList))) |
| 320 | break; |
| 321 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList))) |
| 322 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 323 | vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 324 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 325 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 326 | vos_mem_copy(pMac->scan.countryCodeDefault, nvTables.defaultCountryTable.countryCode, |
| 327 | WNI_CFG_COUNTRY_CODE_LEN); |
| 328 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 329 | } |
| 330 | else |
| 331 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 332 | smsLog( pMac, LOGE, FL(" fail to get NV_FIELD_IMAGE") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 333 | //hardcoded for now |
| 334 | pMac->scan.countryCodeDefault[0] = 'U'; |
| 335 | pMac->scan.countryCodeDefault[1] = 'S'; |
| 336 | pMac->scan.countryCodeDefault[2] = 'I'; |
| 337 | //status = eHAL_STATUS_SUCCESS; |
| 338 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 339 | smsLog( pMac, LOG1, FL(" country Code from nvRam %.2s"), pMac->scan.countryCodeDefault ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 340 | csrGetRegulatoryDomainForCountry(pMac, pMac->scan.countryCodeDefault, ®Id); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 341 | WDA_SetRegDomain(pMac, regId); |
| 342 | pMac->scan.domainIdDefault = regId; |
| 343 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 344 | vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault, |
| 345 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 346 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 347 | }while(0); |
| 348 | |
| 349 | return (status); |
| 350 | } |
| 351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | eHalStatus csrSetRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode) |
| 353 | { |
| 354 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 355 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 356 | v_REGDOMAIN_t regId; |
| 357 | v_U8_t cntryCodeLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 358 | if(NULL == apCntryCode) |
| 359 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 360 | smsLog( pMac, LOGW, FL(" Invalid country Code Pointer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 361 | return eHAL_STATUS_FAILURE; |
| 362 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 363 | smsLog( pMac, LOGW, FL(" country Code %.2s"), apCntryCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 364 | /* To get correct Regulatory domain from NV table |
| 365 | * 2 character Country code should be used |
| 366 | * 3rd charater is optional for indoor/outdoor setting */ |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 367 | cntryCodeLength = WNI_CFG_COUNTRY_CODE_LEN; |
| 368 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 369 | cntryCodeLength = strlen(apCntryCode); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 370 | |
| 371 | if (cntryCodeLength > WNI_CFG_COUNTRY_CODE_LEN) |
| 372 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 373 | smsLog( pMac, LOGW, FL(" Invalid Country Code Length") ); |
Madan Mohan Koyyalamudi | b666eb1 | 2012-09-18 17:29:47 -0700 | [diff] [blame] | 374 | return eHAL_STATUS_FAILURE; |
| 375 | } |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 376 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 377 | status = csrGetRegulatoryDomainForCountry(pMac, apCntryCode, ®Id); |
| 378 | if (status != eHAL_STATUS_SUCCESS) |
| 379 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 380 | 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] | 381 | return status; |
| 382 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 383 | status = WDA_SetRegDomain(hHal, regId); |
| 384 | if (status != eHAL_STATUS_SUCCESS) |
| 385 | { |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 386 | 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] | 387 | return status; |
| 388 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 389 | pMac->scan.domainIdDefault = regId; |
| 390 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 391 | /* Clear CC field */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 392 | vos_mem_set(pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN, 0); |
| 393 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 394 | /* Copy 2 or 3 bytes country code */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 395 | vos_mem_copy(pMac->scan.countryCodeDefault, apCntryCode, cntryCodeLength); |
| 396 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 397 | /* If 2 bytes country code, 3rd byte must be filled with space */ |
| 398 | if((WNI_CFG_COUNTRY_CODE_LEN - 1) == cntryCodeLength) |
| 399 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 400 | vos_mem_set(pMac->scan.countryCodeDefault + 2, 1, 0x20); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 402 | vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault, |
| 403 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 404 | status = csrInitGetChannels( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 405 | return status; |
| 406 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 407 | eHalStatus csrSetChannels(tHalHandle hHal, tCsrConfigParam *pParam ) |
| 408 | { |
| 409 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 410 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 411 | tANI_U8 index = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 412 | vos_mem_copy(pParam->Csr11dinfo.countryCode, pMac->scan.countryCodeCurrent, |
| 413 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 414 | for ( index = 0; index < pMac->scan.base20MHzChannels.numChannels ; index++) |
| 415 | { |
| 416 | pParam->Csr11dinfo.Channels.channelList[index] = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 417 | pParam->Csr11dinfo.ChnPower[index].firstChannel = pMac->scan.base20MHzChannels.channelList[ index ]; |
| 418 | pParam->Csr11dinfo.ChnPower[index].numChannels = 1; |
| 419 | pParam->Csr11dinfo.ChnPower[index].maxtxPower = pMac->scan.defaultPowerTable[index].pwr; |
| 420 | } |
| 421 | pParam->Csr11dinfo.Channels.numChannels = pMac->scan.base20MHzChannels.numChannels; |
| 422 | |
| 423 | return status; |
| 424 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 425 | eHalStatus csrClose(tpAniSirGlobal pMac) |
| 426 | { |
| 427 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 428 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 429 | csrRoamClose(pMac); |
| 430 | csrScanClose(pMac); |
| 431 | csrLLClose(&pMac->roam.statsClientReqList); |
| 432 | csrLLClose(&pMac->roam.peStatsReqList); |
| 433 | csrLLClose(&pMac->roam.roamCmdPendingList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 434 | /* DeInit Globals */ |
| 435 | csrRoamDeInitGlobals(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 436 | return (status); |
| 437 | } |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 438 | |
| 439 | eHalStatus csrUpdateChannelList(tCsrScanStruct *pScan) |
| 440 | { |
| 441 | tSirUpdateChanList *pChanList; |
| 442 | tANI_U8 numChan = pScan->base20MHzChannels.numChannels; |
| 443 | tANI_U32 bufLen = sizeof(tSirUpdateChanList) + |
| 444 | (sizeof(tSirUpdateChanParam) * (numChan - 1)); |
| 445 | vos_msg_t msg; |
| 446 | tANI_U8 i; |
| 447 | |
| 448 | pChanList = (tSirUpdateChanList *) vos_mem_malloc(bufLen); |
| 449 | if (!pChanList) |
| 450 | { |
| 451 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 452 | "Failed to allocate memory for tSirUpdateChanList"); |
| 453 | return eHAL_STATUS_FAILED_ALLOC; |
| 454 | } |
| 455 | |
| 456 | msg.type = WDA_UPDATE_CHAN_LIST_REQ; |
| 457 | msg.reserved = 0; |
| 458 | msg.bodyptr = pChanList; |
| 459 | pChanList->numChan = numChan; |
| 460 | for (i = 0; i < pChanList->numChan; i++) |
| 461 | { |
| 462 | pChanList->chanParam[i].chanId = pScan->defaultPowerTable[i].chanId; |
| 463 | pChanList->chanParam[i].pwr = pScan->defaultPowerTable[i].pwr; |
| 464 | } |
| 465 | |
| 466 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) |
| 467 | { |
| 468 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
| 469 | "%s: Failed to post msg to WDA", __func__); |
| 470 | vos_mem_free(pChanList); |
| 471 | return eHAL_STATUS_FAILURE; |
| 472 | } |
| 473 | |
| 474 | return eHAL_STATUS_SUCCESS; |
| 475 | } |
| 476 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | eHalStatus csrStart(tpAniSirGlobal pMac) |
| 478 | { |
| 479 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 480 | tANI_U32 i; |
| 481 | |
| 482 | do |
| 483 | { |
| 484 | //save the global vos context |
| 485 | pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 486 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 487 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i ); |
| 488 | |
| 489 | status = csrRoamStart(pMac); |
| 490 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 491 | pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE; |
| 492 | status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac); |
| 493 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 494 | pMac->roam.sPendingCommands = 0; |
| 495 | csrScanEnable(pMac); |
| 496 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 497 | status = csrNeighborRoamInit(pMac); |
| 498 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 499 | pMac->roam.tlStatsReqInfo.numClient = 0; |
| 500 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 501 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 502 | //init the link quality indication also |
| 503 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND; |
| 504 | if(!HAL_STATUS_SUCCESS(status)) |
| 505 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 506 | smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 507 | break; |
| 508 | } |
Gopichand Nakkala | f72a387 | 2013-06-11 17:51:13 +0530 | [diff] [blame] | 509 | |
| 510 | if (pMac->fScanOffload) |
| 511 | { |
| 512 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 513 | "Scan offload is enabled, update default chan list"); |
| 514 | status = csrUpdateChannelList(&pMac->scan); |
| 515 | } |
| 516 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 517 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 518 | #if defined(ANI_LOGDUMP) |
| 519 | csrDumpInit(pMac); |
| 520 | #endif //#if defined(ANI_LOGDUMP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 521 | return (status); |
| 522 | } |
| 523 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 524 | eHalStatus csrStop(tpAniSirGlobal pMac) |
| 525 | { |
| 526 | tANI_U32 sessionId; |
| 527 | tANI_U32 i; |
| 528 | |
| 529 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 530 | { |
| 531 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 532 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 533 | csrScanDisable(pMac); |
| 534 | pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE; |
| 535 | pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 536 | csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE ); |
| 537 | |
| 538 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 539 | csrNeighborRoamClose(pMac); |
| 540 | #endif |
| 541 | csrScanFlushResult(pMac); //Do we want to do this? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 542 | // deregister from PMC since we register during csrStart() |
| 543 | // (ignore status since there is nothing we can do if it fails) |
| 544 | (void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 545 | //Reset the domain back to the deault |
| 546 | pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault; |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 547 | csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 548 | |
| 549 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 550 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 551 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 552 | pMac->roam.curSubState[i] = eCSR_ROAM_SUBSTATE_NONE; |
| 553 | } |
| 554 | |
| 555 | return (eHAL_STATUS_SUCCESS); |
| 556 | } |
| 557 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 558 | eHalStatus csrReady(tpAniSirGlobal pMac) |
| 559 | { |
| 560 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 561 | csrScanGetSupportedChannels( pMac ); |
| 562 | //WNI_CFG_VALID_CHANNEL_LIST should be set by this time |
| 563 | //use it to init the background scan list |
| 564 | csrInitBGScanChannelList(pMac); |
| 565 | /* HDD issues the init scan */ |
| 566 | csrScanStartResultAgingTimer(pMac); |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 567 | /* If the gScanAgingTime is set to '0' then scan results aging timeout |
| 568 | based on timer feature is not enabled*/ |
| 569 | if(0 != pMac->scan.scanResultCfgAgingTime ) |
| 570 | { |
| 571 | csrScanStartResultCfgAgingTimer(pMac); |
| 572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 573 | //Store the AC weights in TL for later use |
| 574 | WLANTL_GetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 575 | status = csrInitChannelList( pMac ); |
| 576 | if ( ! HAL_STATUS_SUCCESS( status ) ) |
| 577 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 578 | smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 579 | status ); |
| 580 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 581 | return (status); |
| 582 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 583 | void csrSetDefaultDot11Mode( tpAniSirGlobal pMac ) |
| 584 | { |
| 585 | v_U32_t wniDot11mode = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 586 | wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode); |
| 587 | ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE); |
| 588 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 589 | void csrSetGlobalCfgs( tpAniSirGlobal pMac ) |
| 590 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 592 | ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 593 | ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 594 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 595 | ((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled), |
| 596 | NULL, eANI_BOOLEAN_FALSE); |
| 597 | 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] | 598 | /* 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 |
| 599 | * Once session is established we will use the session related params stored in PE session for CB mode |
| 600 | */ |
| 601 | 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] | 602 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE); |
| 603 | |
| 604 | //Update the operating mode to configured value during initialization, |
| 605 | //So that client can advertise full capabilities in Probe request frame. |
| 606 | csrSetDefaultDot11Mode( pMac ); |
| 607 | } |
| 608 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 609 | eHalStatus csrRoamOpen(tpAniSirGlobal pMac) |
| 610 | { |
| 611 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 612 | tANI_U32 i; |
| 613 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 614 | do |
| 615 | { |
| 616 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 617 | { |
| 618 | pSession = CSR_GET_SESSION( pMac, i ); |
| 619 | pSession->roamingTimerInfo.pMac = pMac; |
| 620 | pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 621 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 622 | pMac->roam.WaitForKeyTimerInfo.pMac = pMac; |
| 623 | pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 624 | status = vos_timer_init(&pMac->roam.hTimerWaitForKey, VOS_TIMER_TYPE_SW, |
| 625 | csrRoamWaitForKeyTimeOutHandler, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 626 | &pMac->roam.WaitForKeyTimerInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 627 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 628 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 629 | smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 630 | break; |
| 631 | } |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 632 | status = vos_timer_init(&pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 633 | VOS_TIMER_TYPE_SW, csrRoamTlStatsTimerHandler, pMac); |
| 634 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 635 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 636 | smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 637 | return eHAL_STATUS_FAILURE; |
| 638 | } |
| 639 | }while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 640 | return (status); |
| 641 | } |
| 642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 643 | eHalStatus csrRoamClose(tpAniSirGlobal pMac) |
| 644 | { |
| 645 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 646 | for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) |
| 647 | { |
| 648 | csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL); |
| 649 | } |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 650 | vos_timer_stop(&pMac->roam.hTimerWaitForKey); |
| 651 | vos_timer_destroy(&pMac->roam.hTimerWaitForKey); |
| 652 | vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 653 | vos_timer_destroy(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 654 | return (eHAL_STATUS_SUCCESS); |
| 655 | } |
| 656 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 657 | eHalStatus csrRoamStart(tpAniSirGlobal pMac) |
| 658 | { |
| 659 | (void)pMac; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 660 | return (eHAL_STATUS_SUCCESS); |
| 661 | } |
| 662 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 663 | void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 664 | { |
| 665 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 666 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 667 | csrRoamDeregStatisticsReq(pMac); |
| 668 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 669 | eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState) |
| 670 | { |
| 671 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Srinivas Girigowda | c84c57c | 2013-02-19 17:41:56 -0800 | [diff] [blame] | 672 | if ( CSR_IS_SESSION_VALID(pMac, sessionId) && (NULL != pState) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 673 | { |
| 674 | status = eHAL_STATUS_SUCCESS; |
| 675 | *pState = pMac->roam.roamSession[sessionId].connectState; |
| 676 | } |
| 677 | return (status); |
| 678 | } |
| 679 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 680 | eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 681 | { |
| 682 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 683 | tANI_U32 size = 0; |
| 684 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 685 | |
| 686 | if(!pSession) |
| 687 | { |
| 688 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 689 | return eHAL_STATUS_FAILURE; |
| 690 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | |
| 692 | if(pProfile) |
| 693 | { |
| 694 | if(pSession->pConnectBssDesc) |
| 695 | { |
| 696 | do |
| 697 | { |
| 698 | size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length); |
| 699 | if(size) |
| 700 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 701 | pProfile->pBssDesc = vos_mem_malloc(size); |
| 702 | if ( NULL != pProfile->pBssDesc ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 703 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 704 | vos_mem_copy(pProfile->pBssDesc, |
| 705 | pSession->pConnectBssDesc, size); |
| 706 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 707 | } |
| 708 | else |
| 709 | break; |
| 710 | } |
| 711 | else |
| 712 | { |
| 713 | pProfile->pBssDesc = NULL; |
| 714 | } |
| 715 | pProfile->AuthType = pSession->connectedProfile.AuthType; |
| 716 | pProfile->EncryptionType = pSession->connectedProfile.EncryptionType; |
| 717 | pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType; |
| 718 | pProfile->BSSType = pSession->connectedProfile.BSSType; |
| 719 | pProfile->operationChannel = pSession->connectedProfile.operationChannel; |
| 720 | pProfile->CBMode = pSession->connectedProfile.CBMode; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 721 | vos_mem_copy(&pProfile->bssid, &pSession->connectedProfile.bssid, |
| 722 | sizeof(tCsrBssid)); |
| 723 | vos_mem_copy(&pProfile->SSID, &pSession->connectedProfile.SSID, |
| 724 | sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 725 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 726 | if (pSession->connectedProfile.MDID.mdiePresent) |
| 727 | { |
| 728 | pProfile->MDID.mdiePresent = 1; |
| 729 | pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain; |
| 730 | } |
| 731 | else |
| 732 | { |
| 733 | pProfile->MDID.mdiePresent = 0; |
| 734 | pProfile->MDID.mobilityDomain = 0; |
| 735 | } |
| 736 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 737 | #ifdef FEATURE_WLAN_CCX |
| 738 | pProfile->isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 739 | if (csrIsAuthTypeCCX(pSession->connectedProfile.AuthType)) |
| 740 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 741 | vos_mem_copy (pProfile->ccxCckmInfo.krk, |
| 742 | pSession->connectedProfile.ccxCckmInfo.krk, |
| 743 | CSR_KRK_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 744 | pProfile->ccxCckmInfo.reassoc_req_num= |
| 745 | pSession->connectedProfile.ccxCckmInfo.reassoc_req_num; |
| 746 | pProfile->ccxCckmInfo.krk_plumbed = |
| 747 | pSession->connectedProfile.ccxCckmInfo.krk_plumbed; |
| 748 | } |
| 749 | #endif |
| 750 | }while(0); |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | return (status); |
| 755 | } |
| 756 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 757 | eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile) |
| 758 | { |
| 759 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 760 | |
| 761 | if((csrIsConnStateConnected(pMac, sessionId)) || |
| 762 | (csrIsConnStateIbss(pMac, sessionId))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 763 | { |
| 764 | if(pProfile) |
| 765 | { |
| 766 | status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile); |
| 767 | } |
| 768 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 769 | return (status); |
| 770 | } |
Jeff Johnson | fec1ecb | 2013-05-03 08:10:33 -0700 | [diff] [blame] | 771 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 772 | eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile) |
| 773 | { |
| 774 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 775 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 776 | if (pProfile->pBssDesc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 777 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 778 | vos_mem_free(pProfile->pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 779 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 780 | if (pProfile->pAddIEAssoc) |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 781 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 782 | vos_mem_free(pProfile->pAddIEAssoc); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 783 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 784 | vos_mem_set(pProfile, sizeof(tCsrRoamConnectedProfile), 0); |
| 785 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 786 | pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 787 | return (status); |
| 788 | } |
| 789 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 790 | static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo ) |
| 791 | { |
| 792 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 793 | if( pConnectedInfo->pbFrames ) |
| 794 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 795 | vos_mem_free(pConnectedInfo->pbFrames); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 796 | pConnectedInfo->pbFrames = NULL; |
| 797 | } |
| 798 | pConnectedInfo->nBeaconLength = 0; |
| 799 | pConnectedInfo->nAssocReqLength = 0; |
| 800 | pConnectedInfo->nAssocRspLength = 0; |
| 801 | pConnectedInfo->staId = 0; |
| 802 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 803 | pConnectedInfo->nRICRspLength = 0; |
| 804 | #endif |
| 805 | #ifdef FEATURE_WLAN_CCX |
| 806 | pConnectedInfo->nTspecIeLength = 0; |
| 807 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 808 | return ( status ); |
| 809 | } |
| 810 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 811 | |
| 812 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 813 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 814 | void csrReleaseCommandPreauth(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 815 | { |
| 816 | csrReinitPreauthCmd(pMac, pCommand); |
| 817 | csrReleaseCommand( pMac, pCommand ); |
| 818 | } |
| 819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 820 | void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 821 | { |
| 822 | csrReinitRoamCmd(pMac, pCommand); |
| 823 | csrReleaseCommand( pMac, pCommand ); |
| 824 | } |
| 825 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 826 | void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 827 | { |
| 828 | csrReinitScanCmd(pMac, pCommand); |
| 829 | csrReleaseCommand( pMac, pCommand ); |
| 830 | } |
| 831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 832 | void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 833 | { |
| 834 | csrReinitWmStatusChangeCmd(pMac, pCommand); |
| 835 | csrReleaseCommand( pMac, pCommand ); |
| 836 | } |
| 837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 838 | void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 839 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 840 | vos_mem_set(&pCommand->u.setKeyCmd, sizeof(tSetKeyCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 841 | } |
| 842 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 843 | void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 844 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 845 | vos_mem_set(&pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 846 | } |
| 847 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 848 | void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 849 | { |
| 850 | csrReinitSetKeyCmd(pMac, pCommand); |
| 851 | csrReleaseCommand( pMac, pCommand ); |
| 852 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 853 | void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 854 | { |
| 855 | csrReinitRemoveKeyCmd(pMac, pCommand); |
| 856 | csrReleaseCommand( pMac, pCommand ); |
| 857 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 858 | void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping ) |
| 859 | { |
| 860 | |
| 861 | if( eSmeCsrCommandMask & pCommand->command ) |
| 862 | { |
| 863 | switch (pCommand->command) |
| 864 | { |
| 865 | case eSmeCommandScan: |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 866 | // We need to inform the requester before dropping the scan command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 867 | smsLog( pMac, LOGW, "%s: Drop scan reason %d callback 0x%X", |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 868 | __func__, pCommand->u.scanCmd.reason, (unsigned int)pCommand->u.scanCmd.callback); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 869 | if (NULL != pCommand->u.scanCmd.callback) |
| 870 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 871 | smsLog( pMac, LOGW, "%s callback scan requester", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 872 | csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT); |
| 873 | } |
| 874 | csrReleaseCommandScan( pMac, pCommand ); |
| 875 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 876 | case eSmeCommandRoam: |
| 877 | csrReleaseCommandRoam( pMac, pCommand ); |
| 878 | break; |
| 879 | |
| 880 | case eSmeCommandWmStatusChange: |
| 881 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 882 | break; |
| 883 | |
| 884 | case eSmeCommandSetKey: |
| 885 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 886 | break; |
| 887 | |
| 888 | case eSmeCommandRemoveKey: |
| 889 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 890 | break; |
| 891 | |
| 892 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 893 | smsLog( pMac, LOGW, " CSR abort standard command %d", pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 894 | csrReleaseCommand( pMac, pCommand ); |
| 895 | break; |
| 896 | } |
| 897 | } |
| 898 | } |
| 899 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 900 | void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId) |
| 901 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 902 | smsLog( pMac, LOG1, " CSR RoamSubstate: [ %d <== %d ]", NewSubstate, pMac->roam.curSubState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 903 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 904 | if(pMac->roam.curSubState[sessionId] == NewSubstate) |
| 905 | { |
| 906 | return; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 907 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 908 | pMac->roam.curSubState[sessionId] = NewSubstate; |
| 909 | } |
| 910 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 911 | eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId) |
| 912 | { |
| 913 | eCsrRoamState PreviousState; |
| 914 | |
Madan Mohan Koyyalamudi | 2125599 | 2013-08-01 18:00:25 +0530 | [diff] [blame] | 915 | smsLog( pMac, LOG1, "CSR RoamState[%hu]: [ %d <== %d ]", sessionId, |
| 916 | NewRoamState, pMac->roam.curState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 917 | |
| 918 | PreviousState = pMac->roam.curState[sessionId]; |
| 919 | |
| 920 | if ( NewRoamState != pMac->roam.curState[sessionId] ) |
| 921 | { |
| 922 | // Whenever we transition OUT of the Roaming state, clear the Roaming substate... |
| 923 | if ( CSR_IS_ROAM_JOINING(pMac, sessionId) ) |
| 924 | { |
| 925 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 926 | } |
| 927 | |
| 928 | pMac->roam.curState[sessionId] = NewRoamState; |
| 929 | } |
| 930 | return( PreviousState ); |
| 931 | } |
| 932 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 933 | void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_U8 catOffset) |
| 934 | { |
| 935 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 936 | if(catOffset) |
| 937 | { |
| 938 | pMac->roam.configParam.bCatRssiOffset = catOffset; |
| 939 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 940 | { |
| 941 | pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)CSR_BEST_RSSI_VALUE - (int)(i * catOffset); |
| 942 | } |
| 943 | } |
| 944 | } |
| 945 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 946 | static void initConfigParam(tpAniSirGlobal pMac) |
| 947 | { |
| 948 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 949 | pMac->roam.configParam.agingCount = CSR_AGING_COUNT; |
| 950 | pMac->roam.configParam.channelBondingMode24GHz = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 951 | pMac->roam.configParam.channelBondingMode5GHz = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 952 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 953 | pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_TAURUS; |
| 954 | pMac->roam.configParam.eBand = eCSR_BAND_ALL; |
| 955 | pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 956 | pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT; |
| 957 | pMac->roam.configParam.HeartbeatThresh24 = 40; |
| 958 | pMac->roam.configParam.HeartbeatThresh50 = 40; |
| 959 | pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE; |
| 960 | pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE; |
| 961 | pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 962 | pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 963 | pMac->roam.configParam.RTSThreshold = 2346; |
| 964 | pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE; |
| 965 | pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto; |
| 966 | pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE; |
| 967 | pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO; |
| 968 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 969 | pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS; |
| 970 | pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS; |
| 971 | pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS; |
| 972 | pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS; |
| 973 | for(i = 0; i < CSR_NUM_RSSI_CAT; i++) |
| 974 | { |
| 975 | pMac->roam.configParam.BssPreferValue[i] = i; |
| 976 | } |
| 977 | csrAssignRssiForCategory(pMac, CSR_DEFAULT_RSSI_DB_GAP); |
| 978 | pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; |
| 979 | pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE; |
| 980 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 981 | pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE; |
| 982 | pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE; |
| 983 | pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; |
| 984 | pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; |
| 985 | pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME; |
| 986 | pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME; |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 987 | pMac->roam.configParam.nActiveMaxChnTimeBtc = CSR_ACTIVE_MAX_CHANNEL_TIME_BTC; |
| 988 | pMac->roam.configParam.nActiveMinChnTimeBtc = CSR_ACTIVE_MIN_CHANNEL_TIME_BTC; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 989 | pMac->roam.configParam.disableAggWithBtc = eANI_BOOLEAN_TRUE; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 990 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 991 | pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC; |
| 992 | pMac->roam.configParam.nActiveMinChnTimeConc = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC; |
| 993 | pMac->roam.configParam.nPassiveMaxChnTimeConc = CSR_PASSIVE_MAX_CHANNEL_TIME_CONC; |
| 994 | pMac->roam.configParam.nPassiveMinChnTimeConc = CSR_PASSIVE_MIN_CHANNEL_TIME_CONC; |
| 995 | pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 996 | pMac->roam.configParam.nNumStaChanCombinedConc = CSR_NUM_STA_CHAN_COMBINED_CONC; |
| 997 | pMac->roam.configParam.nNumP2PChanCombinedConc = CSR_NUM_P2P_CHAN_COMBINED_CONC; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 998 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 999 | pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default |
| 1000 | pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; |
| 1001 | pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; |
| 1002 | pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1003 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1004 | pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0; |
| 1005 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1006 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 1007 | pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3; |
| 1008 | pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120; |
| 1009 | pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125; |
| 1010 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20; |
| 1011 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40; |
| 1012 | pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200; |
| 1013 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3; |
| 1014 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1; |
| 1015 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6; |
| 1016 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11; |
| 1017 | pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1018 | pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1019 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1020 | #ifdef WLAN_FEATURE_11AC |
| 1021 | pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1; |
| 1022 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1023 | |
| 1024 | pMac->roam.configParam.addTSWhenACMIsOff = 0; |
| 1025 | pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE; |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1026 | |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1027 | //Remove this code once SLM_Sessionization is supported |
| 1028 | //BMPS_WORKAROUND_NOT_NEEDED |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1029 | pMac->roam.configParam.doBMPSWorkaround = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1030 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1031 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | eCsrBand csrGetCurrentBand(tHalHandle hHal) |
| 1033 | { |
| 1034 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1035 | return pMac->roam.configParam.bandCapability; |
| 1036 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1037 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1038 | |
| 1039 | #if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD) |
| 1040 | /* |
| 1041 | This function flushes the roam scan cache |
| 1042 | */ |
| 1043 | eHalStatus csrFlushRoamScanRoamChannelList(tpAniSirGlobal pMac) |
| 1044 | { |
| 1045 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1046 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1047 | |
| 1048 | /* Free up the memory first (if required) */ |
| 1049 | if (NULL != pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 1050 | { |
| 1051 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 1052 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 1053 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
| 1054 | } |
| 1055 | return status; |
| 1056 | } |
| 1057 | #endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */ |
| 1058 | |
| 1059 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1060 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1061 | /* |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1062 | This function flushes the roam scan cache |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1063 | */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1064 | eHalStatus csrFlushCfgBgScanRoamChannelList(tpAniSirGlobal pMac) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1065 | { |
| 1066 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1067 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1068 | |
| 1069 | /* Free up the memory first (if required) */ |
| 1070 | if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1071 | { |
| 1072 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 1073 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1074 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1075 | } |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1076 | return status; |
| 1077 | } |
| 1078 | |
| 1079 | |
| 1080 | |
| 1081 | /* |
| 1082 | This function flushes the roam scan cache and creates fresh cache |
| 1083 | based on the input channel list |
| 1084 | */ |
| 1085 | eHalStatus csrCreateBgScanRoamChannelList(tpAniSirGlobal pMac, |
| 1086 | const tANI_U8 *pChannelList, |
| 1087 | const tANI_U8 numChannels) |
| 1088 | { |
| 1089 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1090 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1091 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1092 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = numChannels; |
| 1093 | |
| 1094 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = |
| 1095 | vos_mem_malloc(pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
| 1096 | |
| 1097 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1098 | { |
| 1099 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 1100 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0; |
| 1101 | return eHAL_STATUS_RESOURCES; |
| 1102 | } |
| 1103 | |
| 1104 | /* Update the roam global structure */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1105 | vos_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
| 1106 | pChannelList, |
| 1107 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1108 | return status; |
| 1109 | } |
| 1110 | |
| 1111 | /* This function modifies the bgscan channel list set via config ini or |
| 1112 | runtime, whenever the band changes. |
| 1113 | if the band is auto, then no operation is performed on the channel list |
| 1114 | if the band is 2.4G, then make sure channel list contains only 2.4G valid channels |
| 1115 | if the band is 5G, then make sure channel list contains only 5G valid channels |
| 1116 | */ |
| 1117 | eHalStatus csrUpdateBgScanConfigIniChannelList(tpAniSirGlobal pMac, |
| 1118 | eCsrBand eBand) |
| 1119 | { |
| 1120 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1121 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1122 | tANI_U8 outNumChannels = 0; |
| 1123 | tANI_U8 inNumChannels = 0; |
| 1124 | tANI_U8 *inPtr = NULL; |
| 1125 | tANI_U8 i = 0; |
| 1126 | tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1127 | |
| 1128 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 1129 | |
| 1130 | { |
| 1131 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1132 | "No update required for channel list " |
| 1133 | "either cfg.ini channel list is not set up or " |
| 1134 | "auto band (Band %d)", eBand); |
| 1135 | return status; |
| 1136 | } |
| 1137 | |
| 1138 | inNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; |
| 1139 | inPtr = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 1140 | if (eCSR_BAND_24 == eBand) |
| 1141 | { |
| 1142 | for (i = 0; i < inNumChannels; i++) |
| 1143 | { |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 1144 | if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrRoamIsChannelValid(pMac, inPtr[i])) |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1145 | { |
| 1146 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1147 | } |
| 1148 | } |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1149 | csrFlushCfgBgScanRoamChannelList(pMac); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1150 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1151 | } |
| 1152 | else if (eCSR_BAND_5G == eBand) |
| 1153 | { |
| 1154 | for (i = 0; i < inNumChannels; i++) |
| 1155 | { |
| 1156 | /* Add 5G Non-DFS channel */ |
| 1157 | if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) && |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 1158 | csrRoamIsChannelValid(pMac, inPtr[i]) && |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1159 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1160 | { |
| 1161 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1162 | } |
| 1163 | } |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1164 | csrFlushCfgBgScanRoamChannelList(pMac); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1165 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1166 | } |
| 1167 | else if (eCSR_BAND_ALL == eBand) |
| 1168 | { |
| 1169 | for (i = 0; i < inNumChannels; i++) |
| 1170 | { |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 1171 | if (csrRoamIsChannelValid(pMac, inPtr[i]) && |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1172 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1173 | { |
| 1174 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1175 | } |
| 1176 | } |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1177 | csrFlushCfgBgScanRoamChannelList(pMac); |
Srinivas Girigowda | 100eb32 | 2013-03-15 16:48:20 -0700 | [diff] [blame] | 1178 | csrCreateBgScanRoamChannelList(pMac, ChannelList, outNumChannels); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1179 | } |
| 1180 | else |
| 1181 | { |
| 1182 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 1183 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 1184 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 1185 | } |
| 1186 | |
| 1187 | return status; |
| 1188 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1189 | #endif |
| 1190 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 1191 | #if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD) |
| 1192 | /* This function modifies the roam scan channel list as per AP neighbor |
| 1193 | report; AP neighbor report may be empty or may include only other AP |
| 1194 | channels; in any case, we merge the channel list with the learned occupied |
| 1195 | channels list. |
| 1196 | if the band is 2.4G, then make sure channel list contains only 2.4G valid channels |
| 1197 | if the band is 5G, then make sure channel list contains only 5G valid channels |
| 1198 | */ |
| 1199 | eHalStatus csrCreateRoamScanChannelList(tpAniSirGlobal pMac, |
| 1200 | tANI_U8 *pChannelList, |
| 1201 | tANI_U8 numChannels, |
| 1202 | const eCsrBand eBand) |
| 1203 | { |
| 1204 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1205 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1206 | tANI_U8 outNumChannels = 0; |
| 1207 | tANI_U8 inNumChannels = numChannels; |
| 1208 | tANI_U8 *inPtr = pChannelList; |
| 1209 | tANI_U8 i = 0; |
| 1210 | tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1211 | tANI_U8 tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 1212 | tANI_U8 mergedOutputNumOfChannels = 0; |
| 1213 | tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 1214 | |
| 1215 | /* Create a Union of occupied channel list learnt by the DUT along with the Neighbor |
| 1216 | * report Channels. This increases the chances of the DUT to get a candidate AP while |
| 1217 | * roaming even if the Neighbor Report is not able to provide sufficient information. */ |
| 1218 | if (pMac->scan.occupiedChannels.numChannels) |
| 1219 | { |
| 1220 | csrNeighborRoamMergeChannelLists(pMac, |
| 1221 | &pMac->scan.occupiedChannels.channelList[0], |
| 1222 | pMac->scan.occupiedChannels.numChannels, |
| 1223 | inPtr, |
| 1224 | inNumChannels, |
| 1225 | &mergedOutputNumOfChannels); |
| 1226 | inNumChannels = mergedOutputNumOfChannels; |
| 1227 | } |
| 1228 | |
| 1229 | if (eCSR_BAND_24 == eBand) |
| 1230 | { |
| 1231 | for (i = 0; i < inNumChannels; i++) |
| 1232 | { |
| 1233 | if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrRoamIsChannelValid(pMac, inPtr[i])) |
| 1234 | { |
| 1235 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1236 | } |
| 1237 | } |
| 1238 | } |
| 1239 | else if (eCSR_BAND_5G == eBand) |
| 1240 | { |
| 1241 | for (i = 0; i < inNumChannels; i++) |
| 1242 | { |
| 1243 | /* Add 5G Non-DFS channel */ |
| 1244 | if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) && |
| 1245 | csrRoamIsChannelValid(pMac, inPtr[i]) && |
| 1246 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1247 | { |
| 1248 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1249 | } |
| 1250 | } |
| 1251 | } |
| 1252 | else if (eCSR_BAND_ALL == eBand) |
| 1253 | { |
| 1254 | for (i = 0; i < inNumChannels; i++) |
| 1255 | { |
| 1256 | if (csrRoamIsChannelValid(pMac, inPtr[i]) && |
| 1257 | !CSR_IS_CHANNEL_DFS(inPtr[i])) |
| 1258 | { |
| 1259 | ChannelList[outNumChannels++] = inPtr[i]; |
| 1260 | } |
| 1261 | } |
| 1262 | } |
| 1263 | else |
| 1264 | { |
| 1265 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, |
| 1266 | "Invalid band, No operation carried out (Band %d)", eBand); |
| 1267 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1268 | } |
| 1269 | |
| 1270 | /* if roaming within band is enabled, then select only the |
| 1271 | in band channels . |
| 1272 | This is required only if the band capability is set to ALL, |
| 1273 | E.g., if band capability is only 2.4G then all the channels in the |
| 1274 | list are already filtered for 2.4G channels, hence ignore this check*/ |
| 1275 | |
| 1276 | if ((eCSR_BAND_ALL == eBand) && CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac)) |
| 1277 | { |
| 1278 | csrNeighborRoamChannelsFilterByCurrentBand( |
| 1279 | pMac, |
| 1280 | ChannelList, |
| 1281 | outNumChannels, |
| 1282 | tmpChannelList, |
| 1283 | &outNumChannels); |
| 1284 | palCopyMemory(pMac->hHdd, ChannelList, |
| 1285 | tmpChannelList, outNumChannels); |
| 1286 | } |
| 1287 | |
| 1288 | /* Prepare final roam scan channel list */ |
| 1289 | if(outNumChannels) |
| 1290 | { |
| 1291 | /* Clear the channel list first */ |
| 1292 | if (NULL != currChannelListInfo->ChannelList) |
| 1293 | { |
| 1294 | vos_mem_free(currChannelListInfo->ChannelList); |
| 1295 | currChannelListInfo->ChannelList = NULL; |
| 1296 | currChannelListInfo->numOfChannels = 0; |
| 1297 | } |
| 1298 | |
| 1299 | currChannelListInfo->ChannelList = vos_mem_malloc(outNumChannels * sizeof(tANI_U8)); |
| 1300 | if (NULL == currChannelListInfo->ChannelList) |
| 1301 | { |
| 1302 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
| 1303 | "Failed to allocate memory for roam scan channel list"); |
| 1304 | currChannelListInfo->numOfChannels = 0; |
| 1305 | return VOS_STATUS_E_RESOURCES; |
| 1306 | } |
| 1307 | palCopyMemory(pMac->hHdd, currChannelListInfo->ChannelList, |
| 1308 | ChannelList, outNumChannels); |
| 1309 | } |
| 1310 | return status; |
| 1311 | } |
| 1312 | #endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */ |
| 1313 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1314 | eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand) |
| 1315 | { |
| 1316 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1317 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1318 | if (CSR_IS_PHY_MODE_A_ONLY(pMac) && |
| 1319 | (eBand == eCSR_BAND_24)) |
| 1320 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1321 | /* DOT11 mode configured to 11a only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1322 | request to change the band to 2.4 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1323 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1324 | "failed to set band cfg80211 = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1325 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1326 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1327 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | if ((CSR_IS_PHY_MODE_B_ONLY(pMac) || |
| 1329 | CSR_IS_PHY_MODE_G_ONLY(pMac)) && |
| 1330 | (eBand == eCSR_BAND_5G)) |
| 1331 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1332 | /* DOT11 mode configured to 11b/11g only and received |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1333 | request to change the band to 5 GHz */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1334 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1335 | "failed to set band dot11mode = %u, band = %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1336 | pMac->roam.configParam.uCfgDot11Mode, eBand); |
| 1337 | return eHAL_STATUS_INVALID_PARAMETER; |
| 1338 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1339 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1340 | "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] | 1341 | pMac->roam.configParam.eBand = eBand; |
| 1342 | pMac->roam.configParam.bandCapability = eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1343 | csrScanGetSupportedChannels( pMac ); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1344 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1345 | csrUpdateBgScanConfigIniChannelList( pMac, eBand ); |
| 1346 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1347 | status = csrInitGetChannels( pMac ); |
| 1348 | if (eHAL_STATUS_SUCCESS == status) |
| 1349 | csrInitChannelList( hHal ); |
| 1350 | return status; |
| 1351 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1352 | |
| 1353 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1354 | /* The funcns csrConvertCBIniValueToPhyCBState and csrConvertPhyCBStateToIniValue have been |
| 1355 | * introduced to convert the ini value to the ENUM used in csr and MAC for CB state |
| 1356 | * Ideally we should have kept the ini value and enum value same and representing the same |
| 1357 | * cb values as in 11n standard i.e. |
| 1358 | * Set to 1 (SCA) if the secondary channel is above the primary channel |
| 1359 | * Set to 3 (SCB) if the secondary channel is below the primary channel |
| 1360 | * Set to 0 (SCN) if no secondary channel is present |
| 1361 | * However, since our driver is already distributed we will keep the ini definition as it is which is: |
| 1362 | * 0 - secondary none |
| 1363 | * 1 - secondary LOW |
| 1364 | * 2 - secondary HIGH |
| 1365 | * and convert to enum value used within the driver in csrChangeDefaultConfigParam using this funcn |
| 1366 | * The enum values are as follows: |
| 1367 | * PHY_SINGLE_CHANNEL_CENTERED = 0 |
| 1368 | * PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1 |
| 1369 | * PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 1370 | */ |
| 1371 | ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue) |
| 1372 | { |
| 1373 | |
| 1374 | ePhyChanBondState phyCbState; |
| 1375 | switch (cbIniValue) { |
| 1376 | // secondary none |
| 1377 | case 0: |
| 1378 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1379 | break; |
| 1380 | // secondary LOW |
| 1381 | case 1: |
| 1382 | phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 1383 | break; |
| 1384 | // secondary HIGH |
| 1385 | case 2: |
| 1386 | phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 1387 | break; |
| 1388 | #ifdef WLAN_FEATURE_11AC |
| 1389 | case 3: |
| 1390 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
| 1391 | break; |
| 1392 | case 4: |
| 1393 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1394 | break; |
| 1395 | case 5: |
| 1396 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED; |
| 1397 | break; |
| 1398 | case 6: |
| 1399 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
| 1400 | break; |
| 1401 | case 7: |
| 1402 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
| 1403 | break; |
| 1404 | case 8: |
| 1405 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 1406 | break; |
| 1407 | case 9: |
| 1408 | phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 1409 | break; |
| 1410 | #endif |
| 1411 | default: |
| 1412 | // If an invalid value is passed, disable CHANNEL BONDING |
| 1413 | phyCbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 1414 | break; |
| 1415 | } |
| 1416 | return phyCbState; |
| 1417 | } |
| 1418 | |
| 1419 | v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState) |
| 1420 | { |
| 1421 | |
| 1422 | v_U32_t cbIniValue; |
| 1423 | switch (phyCbState) { |
| 1424 | // secondary none |
| 1425 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 1426 | cbIniValue = 0; |
| 1427 | break; |
| 1428 | // secondary LOW |
| 1429 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 1430 | cbIniValue = 1; |
| 1431 | break; |
| 1432 | // secondary HIGH |
| 1433 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 1434 | cbIniValue = 2; |
| 1435 | break; |
| 1436 | #ifdef WLAN_FEATURE_11AC |
| 1437 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 1438 | cbIniValue = 3; |
| 1439 | break; |
| 1440 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 1441 | cbIniValue = 4; |
| 1442 | break; |
| 1443 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 1444 | cbIniValue = 5; |
| 1445 | break; |
| 1446 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 1447 | cbIniValue = 6; |
| 1448 | break; |
| 1449 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 1450 | cbIniValue = 7; |
| 1451 | break; |
| 1452 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 1453 | cbIniValue = 8; |
| 1454 | break; |
| 1455 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 1456 | cbIniValue = 9; |
| 1457 | break; |
| 1458 | #endif |
| 1459 | default: |
| 1460 | // return some invalid value |
| 1461 | cbIniValue = 10; |
| 1462 | break; |
| 1463 | } |
| 1464 | return cbIniValue; |
| 1465 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1466 | |
| 1467 | eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1468 | { |
| 1469 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1470 | |
| 1471 | if(pParam) |
| 1472 | { |
| 1473 | pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode; |
| 1474 | pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled; |
| 1475 | pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold; |
| 1476 | pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled; |
| 1477 | pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled; |
| 1478 | pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled; |
| 1479 | |
| 1480 | pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode; |
Mohit Khanna | 7ed53f0 | 2012-09-11 17:52:10 -0700 | [diff] [blame] | 1481 | pMac->roam.configParam.fAllowMCCGODiffBI = pParam->fAllowMCCGODiffBI; |
| 1482 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1483 | /* channelBondingMode5GHz plays a dual role right now |
| 1484 | * 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 |
| 1485 | * This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change |
| 1486 | */ |
| 1487 | if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI) |
| 1488 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1489 | 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] | 1490 | } |
| 1491 | pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz); |
| 1492 | if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI) |
| 1493 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1494 | 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] | 1495 | } |
| 1496 | pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1497 | pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold; |
| 1498 | pMac->roam.configParam.phyMode = pParam->phyMode; |
| 1499 | pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime; |
| 1500 | pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24; |
| 1501 | pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50; |
| 1502 | pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled; |
| 1503 | pMac->roam.configParam.TxRate = pParam->TxRate; |
| 1504 | pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24; |
| 1505 | pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G; |
| 1506 | pMac->roam.configParam.bandCapability = pParam->bandCapability; |
| 1507 | pMac->roam.configParam.cbChoice = pParam->cbChoice; |
| 1508 | pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1509 | pMac->roam.configParam.disableAggWithBtc = pParam->disableAggWithBtc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1510 | //if HDD passed down non zero values then only update, |
| 1511 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1512 | if (pParam->nActiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1513 | { |
| 1514 | pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime; |
| 1515 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1516 | if (pParam->nActiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1517 | { |
| 1518 | pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime; |
| 1519 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1520 | if (pParam->nPassiveMaxChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1521 | { |
| 1522 | pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime; |
| 1523 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1524 | if (pParam->nPassiveMinChnTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1525 | { |
| 1526 | pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime; |
| 1527 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1528 | if (pParam->nActiveMaxChnTimeBtc) |
| 1529 | { |
| 1530 | pMac->roam.configParam.nActiveMaxChnTimeBtc = pParam->nActiveMaxChnTimeBtc; |
| 1531 | } |
| 1532 | if (pParam->nActiveMinChnTimeBtc) |
| 1533 | { |
| 1534 | pMac->roam.configParam.nActiveMinChnTimeBtc = pParam->nActiveMinChnTimeBtc; |
| 1535 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1536 | #ifdef WLAN_AP_STA_CONCURRENCY |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1537 | if (pParam->nActiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1538 | { |
| 1539 | pMac->roam.configParam.nActiveMaxChnTimeConc = pParam->nActiveMaxChnTimeConc; |
| 1540 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1541 | if (pParam->nActiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1542 | { |
| 1543 | pMac->roam.configParam.nActiveMinChnTimeConc = pParam->nActiveMinChnTimeConc; |
| 1544 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1545 | if (pParam->nPassiveMaxChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1546 | { |
| 1547 | pMac->roam.configParam.nPassiveMaxChnTimeConc = pParam->nPassiveMaxChnTimeConc; |
| 1548 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1549 | if (pParam->nPassiveMinChnTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1550 | { |
| 1551 | pMac->roam.configParam.nPassiveMinChnTimeConc = pParam->nPassiveMinChnTimeConc; |
| 1552 | } |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1553 | if (pParam->nRestTimeConc) |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1554 | { |
| 1555 | pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc; |
| 1556 | } |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1557 | if (pParam->nNumStaChanCombinedConc) |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1558 | { |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1559 | pMac->roam.configParam.nNumStaChanCombinedConc = pParam->nNumStaChanCombinedConc; |
| 1560 | } |
| 1561 | if (pParam->nNumP2PChanCombinedConc) |
| 1562 | { |
| 1563 | pMac->roam.configParam.nNumP2PChanCombinedConc = pParam->nNumP2PChanCombinedConc; |
Vinay Malekal | 05fdc81 | 2012-12-17 13:04:30 -0800 | [diff] [blame] | 1564 | } |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1565 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1566 | //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] | 1567 | if (pParam->impsSleepTime) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | { |
| 1569 | //Change the unit from second to microsecond |
| 1570 | tANI_U32 impsSleepTime = pParam->impsSleepTime * PAL_TIMER_TO_SEC_UNIT; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1571 | if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime) |
| 1572 | { |
| 1573 | pMac->roam.configParam.impsSleepTime = impsSleepTime; |
| 1574 | } |
| 1575 | else |
| 1576 | { |
| 1577 | pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL; |
| 1578 | } |
| 1579 | } |
| 1580 | else |
| 1581 | { |
| 1582 | pMac->roam.configParam.impsSleepTime = 0; |
| 1583 | } |
| 1584 | pMac->roam.configParam.eBand = pParam->eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1585 | pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode, |
| 1586 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1587 | //if HDD passed down non zero values for age params, then only update, |
| 1588 | //otherwise keep using the defaults |
Kiran Kumar Lokere | 3527f0c | 2013-02-24 22:21:28 -0800 | [diff] [blame] | 1589 | if (pParam->nScanResultAgeCount) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1590 | { |
| 1591 | pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount; |
| 1592 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1593 | if(pParam->scanAgeTimeNCNPS) |
| 1594 | { |
| 1595 | pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS; |
| 1596 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1597 | if(pParam->scanAgeTimeNCPS) |
| 1598 | { |
| 1599 | pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS; |
| 1600 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1601 | if(pParam->scanAgeTimeCNPS) |
| 1602 | { |
| 1603 | pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS; |
| 1604 | } |
| 1605 | if(pParam->scanAgeTimeCPS) |
| 1606 | { |
| 1607 | pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS; |
| 1608 | } |
| 1609 | |
| 1610 | csrAssignRssiForCategory(pMac, pParam->bCatRssiOffset); |
| 1611 | pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; |
| 1612 | pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels; |
| 1613 | pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; |
| 1614 | pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch; |
| 1615 | pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1616 | pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold; |
| 1617 | pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1618 | pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled; |
| 1619 | pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity; |
| 1620 | pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS; |
| 1621 | //Assign this before calling CsrInit11dInfo |
| 1622 | pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1623 | if( csrIs11dSupported( pMac ) ) |
| 1624 | { |
| 1625 | status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo); |
| 1626 | } |
| 1627 | else |
| 1628 | { |
| 1629 | pMac->scan.curScanType = eSIR_ACTIVE_SCAN; |
| 1630 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1631 | |
| 1632 | /* Initialize the power + channel information if 11h is enabled. |
| 1633 | If 11d is enabled this information has already been initialized */ |
| 1634 | if( csrIs11hSupported( pMac ) && !csrIs11dSupported( pMac ) ) |
| 1635 | { |
| 1636 | csrInitChannelPowerList(pMac, &pParam->Csr11dinfo); |
| 1637 | } |
| 1638 | |
| 1639 | |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 1640 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1641 | vos_mem_copy(&pMac->roam.configParam.csr11rConfig, |
| 1642 | &pParam->csr11rConfig, sizeof(tCsr11rConfigParams)); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1643 | smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1644 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1645 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1646 | pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1647 | pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1648 | pMac->roam.configParam.nImmediateRoamRssiDiff = pParam->nImmediateRoamRssiDiff; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1649 | smsLog( pMac, LOG1, "nImmediateRoamRssiDiff = %d", |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1650 | pMac->roam.configParam.nImmediateRoamRssiDiff ); |
Madan Mohan Koyyalamudi | d502607 | 2012-11-30 14:56:21 -0800 | [diff] [blame] | 1651 | pMac->roam.configParam.nRoamPrefer5GHz = pParam->nRoamPrefer5GHz; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 1652 | pMac->roam.configParam.nRoamIntraBand = pParam->nRoamIntraBand; |
Srinivas Girigowda | ad34ca9 | 2013-10-22 10:54:29 -0700 | [diff] [blame] | 1653 | pMac->roam.configParam.isWESModeEnabled = pParam->isWESModeEnabled; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 1654 | pMac->roam.configParam.nProbes = pParam->nProbes; |
| 1655 | pMac->roam.configParam.nRoamScanHomeAwayTime = pParam->nRoamScanHomeAwayTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1656 | #endif |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1657 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1658 | pMac->roam.configParam.isRoamOffloadScanEnabled = pParam->isRoamOffloadScanEnabled; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1659 | pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = pParam->bFastRoamInConIniFeatureEnabled; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1660 | #endif |
| 1661 | #ifdef FEATURE_WLAN_LFR |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1662 | pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled; |
| 1663 | #endif |
| 1664 | |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 1665 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1666 | pMac->roam.configParam.isCcxIniFeatureEnabled = pParam->isCcxIniFeatureEnabled; |
| 1667 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1668 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1669 | vos_mem_copy(&pMac->roam.configParam.neighborRoamConfig, |
| 1670 | &pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams)); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1671 | smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod); |
| 1672 | smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold); |
| 1673 | smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold); |
| 1674 | smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime); |
| 1675 | smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime); |
| 1676 | smsLog( pMac, LOG1, "nMaxNeighborRetries = %d", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries); |
| 1677 | smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod); |
| 1678 | smsLog( pMac, LOG1, "nEmptyScanRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1679 | { |
| 1680 | int i; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1681 | 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] | 1682 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1683 | { |
| 1684 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1685 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1686 | smsLog( pMac, LOG1, ""); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1687 | } |
| 1688 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1689 | pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff; |
| 1690 | pMac->scan.fValidateList = pParam->fValidateList; |
| 1691 | pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d; |
| 1692 | pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan; |
Sandeep Puligilla | 2b6dc63 | 2012-12-17 14:44:16 -0800 | [diff] [blame] | 1693 | pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1694 | pMac->roam.configParam.fScanTwice = pParam->fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1695 | pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl; |
| 1696 | /* This parameter is not available in cfg and not passed from upper layers. Instead it is initialized here |
| 1697 | * This paramtere is used in concurrency to determine if there are concurrent active sessions. |
| 1698 | * Is used as a temporary fix to disconnect all active sessions when BMPS enabled so the active session if Infra STA |
| 1699 | * will automatically connect back and resume BMPS since resume BMPS is not working when moving from concurrent to |
| 1700 | * single session |
| 1701 | */ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 1702 | //Remove this code once SLM_Sessionization is supported |
| 1703 | //BMPS_WORKAROUND_NOT_NEEDED |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 1704 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 1705 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1706 | #ifdef WLAN_FEATURE_11AC |
| 1707 | pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1708 | pMac->roam.configParam.txBFEnable= pParam->enableTxBF; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1709 | pMac->roam.configParam.txBFCsnValue = pParam->txBFCsnValue; |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 1710 | pMac->roam.configParam.enableVhtFor24GHz = pParam->enableVhtFor24GHz; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1711 | #endif |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1712 | pMac->roam.configParam.txLdpcEnable = pParam->enableTxLdpc; |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1713 | |
| 1714 | pMac->roam.configParam.isAmsduSupportInAMPDU = pParam->isAmsduSupportInAMPDU; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1715 | } |
| 1716 | |
| 1717 | return status; |
| 1718 | } |
| 1719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1720 | eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam) |
| 1721 | { |
| 1722 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1723 | if(pParam) |
| 1724 | { |
| 1725 | pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode; |
| 1726 | pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled; |
| 1727 | pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold; |
| 1728 | pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled; |
| 1729 | pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal; |
| 1730 | pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1731 | pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz); |
| 1732 | pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1733 | pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold; |
| 1734 | pParam->phyMode = pMac->roam.configParam.phyMode; |
| 1735 | pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 1736 | pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24; |
| 1737 | pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50; |
| 1738 | pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled; |
| 1739 | pParam->TxRate = pMac->roam.configParam.TxRate; |
| 1740 | pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24; |
| 1741 | pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G; |
| 1742 | pParam->bandCapability = pMac->roam.configParam.bandCapability; |
| 1743 | pParam->cbChoice = pMac->roam.configParam.cbChoice; |
| 1744 | pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1745 | pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime; |
| 1746 | pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime; |
| 1747 | pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime; |
| 1748 | pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime; |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 1749 | pParam->nActiveMaxChnTimeBtc = pMac->roam.configParam.nActiveMaxChnTimeBtc; |
| 1750 | pParam->nActiveMinChnTimeBtc = pMac->roam.configParam.nActiveMinChnTimeBtc; |
| 1751 | pParam->disableAggWithBtc = pMac->roam.configParam.disableAggWithBtc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1752 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 1753 | pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc; |
| 1754 | pParam->nActiveMinChnTimeConc = pMac->roam.configParam.nActiveMinChnTimeConc; |
| 1755 | pParam->nPassiveMaxChnTimeConc = pMac->roam.configParam.nPassiveMaxChnTimeConc; |
| 1756 | pParam->nPassiveMinChnTimeConc = pMac->roam.configParam.nPassiveMinChnTimeConc; |
| 1757 | pParam->nRestTimeConc = pMac->roam.configParam.nRestTimeConc; |
Sudhir Sattayappa Kohalli | eb97d50 | 2013-05-22 23:16:42 -0700 | [diff] [blame] | 1758 | pParam->nNumStaChanCombinedConc = pMac->roam.configParam.nNumStaChanCombinedConc; |
| 1759 | pParam->nNumP2PChanCombinedConc = pMac->roam.configParam.nNumP2PChanCombinedConc; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 1760 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1761 | //Change the unit from microsecond to second |
| 1762 | pParam->impsSleepTime = pMac->roam.configParam.impsSleepTime / PAL_TIMER_TO_SEC_UNIT; |
| 1763 | pParam->eBand = pMac->roam.configParam.eBand; |
| 1764 | pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount; |
| 1765 | pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS; |
| 1766 | pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS; |
| 1767 | pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS; |
| 1768 | pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS; |
| 1769 | pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset; |
| 1770 | pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime; |
| 1771 | pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels; |
| 1772 | pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority; |
| 1773 | pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch; |
| 1774 | pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain; |
| 1775 | pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold; |
| 1776 | pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1777 | pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled; |
| 1778 | pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap; |
| 1779 | pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 1780 | pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1781 | pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff; |
| 1782 | pParam->fValidateList = pMac->roam.configParam.fValidateList; |
| 1783 | pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d; |
| 1784 | pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan; |
| 1785 | pParam->fScanTwice = pMac->roam.configParam.fScanTwice; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1786 | pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl; |
Madan Mohan Koyyalamudi | ed41951 | 2012-11-29 15:53:46 -0800 | [diff] [blame] | 1787 | pParam->fEnableMCCMode = pMac->roam.configParam.fenableMCCMode; |
Madan Mohan Koyyalamudi | 057bd80 | 2012-11-29 16:02:39 -0800 | [diff] [blame] | 1788 | pParam->fAllowMCCGODiffBI = pMac->roam.configParam.fAllowMCCGODiffBI; |
Sunil Ravi | 39b2e53 | 2013-01-20 23:45:53 -0800 | [diff] [blame] | 1789 | pParam->scanCfgAgingTime = pMac->scan.scanResultCfgAgingTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1790 | |
| 1791 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1792 | vos_mem_copy(&pParam->neighborRoamConfig, |
| 1793 | &pMac->roam.configParam.neighborRoamConfig, |
| 1794 | sizeof(tCsrNeighborRoamConfigParams)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1795 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1796 | #ifdef WLAN_FEATURE_11AC |
| 1797 | pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1798 | pParam->enableTxBF = pMac->roam.configParam.txBFEnable; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 1799 | pParam->txBFCsnValue = pMac->roam.configParam.txBFCsnValue; |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 1800 | pParam->enableVhtFor24GHz = pMac->roam.configParam.enableVhtFor24GHz; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1801 | #endif |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1802 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1803 | vos_mem_copy(&pMac->roam.configParam.csr11rConfig, |
| 1804 | &pParam->csr11rConfig, sizeof(tCsr11rConfigParams)); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1805 | #endif |
| 1806 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1807 | pParam->isFastTransitionEnabled = pMac->roam.configParam.isFastTransitionEnabled; |
| 1808 | pParam->RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff; |
| 1809 | pParam->nImmediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff; |
| 1810 | pParam->nRoamPrefer5GHz = pMac->roam.configParam.nRoamPrefer5GHz; |
| 1811 | pParam->nRoamIntraBand = pMac->roam.configParam.nRoamIntraBand; |
Srinivas Girigowda | ad34ca9 | 2013-10-22 10:54:29 -0700 | [diff] [blame] | 1812 | pParam->isWESModeEnabled = pMac->roam.configParam.isWESModeEnabled; |
Srinivas Girigowda | 6cf0b82 | 2013-06-27 14:00:20 -0700 | [diff] [blame] | 1813 | pParam->nProbes = pMac->roam.configParam.nProbes; |
| 1814 | pParam->nRoamScanHomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime; |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1815 | #endif |
| 1816 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1817 | pParam->isRoamOffloadScanEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled; |
| 1818 | pParam->bFastRoamInConIniFeatureEnabled = pMac->roam.configParam.bFastRoamInConIniFeatureEnabled; |
| 1819 | #endif |
| 1820 | #ifdef FEATURE_WLAN_LFR |
| 1821 | pParam->isFastRoamIniFeatureEnabled = pMac->roam.configParam.isFastRoamIniFeatureEnabled; |
| 1822 | #endif |
| 1823 | |
| 1824 | #ifdef FEATURE_WLAN_CCX |
| 1825 | pParam->isCcxIniFeatureEnabled = pMac->roam.configParam.isCcxIniFeatureEnabled; |
| 1826 | #endif |
| 1827 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 1828 | vos_mem_copy(&pParam->neighborRoamConfig, |
| 1829 | &pMac->roam.configParam.neighborRoamConfig, |
| 1830 | sizeof(tCsrNeighborRoamConfigParams)); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 1831 | { |
| 1832 | int i; |
| 1833 | smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
| 1834 | for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++) |
| 1835 | { |
| 1836 | smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] ); |
| 1837 | } |
| 1838 | smsLog( pMac, LOG1, ""); |
| 1839 | } |
| 1840 | #endif |
| 1841 | |
Venkata Prathyusha Kuntupalli | f2695c1 | 2013-04-17 15:41:23 -0700 | [diff] [blame] | 1842 | pParam->enableTxLdpc = pMac->roam.configParam.txLdpcEnable; |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 1843 | |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 1844 | pParam->isAmsduSupportInAMPDU = pMac->roam.configParam.isAmsduSupportInAMPDU; |
| 1845 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1846 | csrSetChannels(pMac, pParam); |
| 1847 | |
| 1848 | status = eHAL_STATUS_SUCCESS; |
| 1849 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1850 | return (status); |
| 1851 | } |
| 1852 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1853 | eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded) |
| 1854 | { |
| 1855 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 1856 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1857 | tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE; |
| 1858 | eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1859 | do |
| 1860 | { |
| 1861 | if(eCSR_BAND_24 == eBand) |
| 1862 | { |
| 1863 | if(CSR_IS_RADIO_A_ONLY(pMac)) break; |
| 1864 | if((eCSR_DOT11_MODE_11a & phyMode) || (eCSR_DOT11_MODE_11a_ONLY & phyMode)) break; |
| 1865 | } |
| 1866 | if(eCSR_BAND_5G == eBand) |
| 1867 | { |
| 1868 | if(CSR_IS_RADIO_BG_ONLY(pMac)) break; |
| 1869 | if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) || |
| 1870 | (eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1871 | ) |
| 1872 | { |
| 1873 | break; |
| 1874 | } |
| 1875 | } |
| 1876 | if((0 == phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)) |
| 1877 | { |
| 1878 | newPhyMode = eCSR_DOT11_MODE_TAURUS; |
| 1879 | } |
| 1880 | else if(eCSR_DOT11_MODE_AUTO & phyMode) |
| 1881 | { |
| 1882 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1883 | } |
| 1884 | else |
| 1885 | { |
| 1886 | //Check for dual band and higher capability first |
| 1887 | if(eCSR_DOT11_MODE_11n_ONLY & phyMode) |
| 1888 | { |
| 1889 | if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break; |
| 1890 | newPhyMode = eCSR_DOT11_MODE_11n_ONLY; |
| 1891 | } |
| 1892 | else if(eCSR_DOT11_MODE_11a_ONLY & phyMode) |
| 1893 | { |
| 1894 | if(eCSR_DOT11_MODE_11a_ONLY != phyMode) break; |
| 1895 | if(eCSR_BAND_24 == eBand) break; |
| 1896 | newPhyMode = eCSR_DOT11_MODE_11a_ONLY; |
| 1897 | eBand = eCSR_BAND_5G; |
| 1898 | } |
| 1899 | else if(eCSR_DOT11_MODE_11g_ONLY & phyMode) |
| 1900 | { |
| 1901 | if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break; |
| 1902 | if(eCSR_BAND_5G == eBand) break; |
| 1903 | newPhyMode = eCSR_DOT11_MODE_11g_ONLY; |
| 1904 | eBand = eCSR_BAND_24; |
| 1905 | } |
| 1906 | else if(eCSR_DOT11_MODE_11b_ONLY & phyMode) |
| 1907 | { |
| 1908 | if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break; |
| 1909 | if(eCSR_BAND_5G == eBand) break; |
| 1910 | newPhyMode = eCSR_DOT11_MODE_11b_ONLY; |
| 1911 | eBand = eCSR_BAND_24; |
| 1912 | } |
| 1913 | else if(eCSR_DOT11_MODE_11n & phyMode) |
| 1914 | { |
| 1915 | newPhyMode = eCSR_DOT11_MODE_11n; |
| 1916 | } |
| 1917 | else if(eCSR_DOT11_MODE_abg & phyMode) |
| 1918 | { |
| 1919 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1920 | } |
| 1921 | else if(eCSR_DOT11_MODE_11a & phyMode) |
| 1922 | { |
| 1923 | if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode)) |
| 1924 | { |
| 1925 | if(eCSR_BAND_ALL == eBand) |
| 1926 | { |
| 1927 | newPhyMode = eCSR_DOT11_MODE_abg; |
| 1928 | } |
| 1929 | else |
| 1930 | { |
| 1931 | //bad setting |
| 1932 | break; |
| 1933 | } |
| 1934 | } |
| 1935 | else |
| 1936 | { |
| 1937 | newPhyMode = eCSR_DOT11_MODE_11a; |
| 1938 | eBand = eCSR_BAND_5G; |
| 1939 | } |
| 1940 | } |
| 1941 | else if(eCSR_DOT11_MODE_11g & phyMode) |
| 1942 | { |
| 1943 | newPhyMode = eCSR_DOT11_MODE_11g; |
| 1944 | eBand = eCSR_BAND_24; |
| 1945 | } |
| 1946 | else if(eCSR_DOT11_MODE_11b & phyMode) |
| 1947 | { |
| 1948 | newPhyMode = eCSR_DOT11_MODE_11b; |
| 1949 | eBand = eCSR_BAND_24; |
| 1950 | } |
| 1951 | else |
| 1952 | { |
| 1953 | //We will never be here |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1954 | smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X"), phyMode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1955 | newPhyMode = eCSR_DOT11_MODE_AUTO; |
| 1956 | } |
| 1957 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1958 | //Done validating |
| 1959 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1960 | //Now we need to check whether a restart is needed. |
| 1961 | if(eBand != pMac->roam.configParam.eBand) |
| 1962 | { |
| 1963 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1964 | break; |
| 1965 | } |
| 1966 | if(newPhyMode != pMac->roam.configParam.phyMode) |
| 1967 | { |
| 1968 | fRestartNeeded = eANI_BOOLEAN_TRUE; |
| 1969 | break; |
| 1970 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1971 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1972 | if(HAL_STATUS_SUCCESS(status)) |
| 1973 | { |
| 1974 | pMac->roam.configParam.eBand = eBand; |
| 1975 | pMac->roam.configParam.phyMode = newPhyMode; |
| 1976 | if(pfRestartNeeded) |
| 1977 | { |
| 1978 | *pfRestartNeeded = fRestartNeeded; |
| 1979 | } |
| 1980 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1981 | return (status); |
| 1982 | } |
| 1983 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1984 | void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList ) |
| 1985 | { |
| 1986 | tANI_U8 Index; |
| 1987 | tANI_U8 cChannels; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1988 | // for dual band NICs, don't need to trim the channel list.... |
| 1989 | if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) ) |
| 1990 | { |
| 1991 | // 2.4 GHz band operation requires the channel list to be trimmed to |
| 1992 | // the 2.4 GHz channels only... |
| 1993 | if ( CSR_IS_24_BAND_ONLY( pMac ) ) |
| 1994 | { |
| 1995 | for( Index = 0, cChannels = 0; Index < pChannelList->numChannels; |
| 1996 | Index++ ) |
| 1997 | { |
| 1998 | if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) ) |
| 1999 | { |
| 2000 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 2001 | cChannels++; |
| 2002 | } |
| 2003 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2004 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 2005 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 2006 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 2007 | // only if we need to. |
| 2008 | // |
| 2009 | // The amount of memory to clear is the number of channesl that we trimmed |
| 2010 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 2011 | |
| 2012 | if ( pChannelList->numChannels > cChannels ) |
| 2013 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2014 | vos_mem_set(&pChannelList->channelList[ cChannels ], |
| 2015 | sizeof( pChannelList->channelList[ 0 ] ) * |
| 2016 | ( pChannelList->numChannels - cChannels ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2017 | } |
| 2018 | |
| 2019 | pChannelList->numChannels = cChannels; |
| 2020 | } |
| 2021 | else if ( CSR_IS_5G_BAND_ONLY( pMac ) ) |
| 2022 | { |
| 2023 | for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ ) |
| 2024 | { |
| 2025 | if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) ) |
| 2026 | { |
| 2027 | pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ]; |
| 2028 | cChannels++; |
| 2029 | } |
| 2030 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2031 | // Cleanup the rest of channels. Note we only need to clean up the channels if we had |
| 2032 | // to trim the list. Calling palZeroMemory() with a 0 size is going to throw asserts on |
| 2033 | // the debug builds so let's be a bit smarter about that. Zero out the reset of the channels |
| 2034 | // only if we need to. |
| 2035 | // |
| 2036 | // The amount of memory to clear is the number of channesl that we trimmed |
| 2037 | // (pChannelList->numChannels - cChannels) times the size of a channel in the structure. |
| 2038 | if ( pChannelList->numChannels > cChannels ) |
| 2039 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2040 | vos_mem_set(&pChannelList->channelList[ cChannels ], |
| 2041 | sizeof( pChannelList->channelList[ 0 ] ) * |
| 2042 | ( pChannelList->numChannels - cChannels ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2043 | } |
| 2044 | |
| 2045 | pChannelList->numChannels = cChannels; |
| 2046 | } |
| 2047 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2048 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2049 | #define INFRA_AP_DEFAULT_CHANNEL 6 |
| 2050 | eHalStatus csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum) |
| 2051 | { |
| 2052 | tANI_U8 index= 0; |
| 2053 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2054 | for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++) |
| 2055 | { |
| 2056 | if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){ |
| 2057 | status = eHAL_STATUS_SUCCESS; |
| 2058 | break; |
| 2059 | } |
| 2060 | } |
| 2061 | return status; |
| 2062 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2063 | |
| 2064 | eHalStatus csrGet5GChannels(tpAniSirGlobal pMac) |
| 2065 | { |
| 2066 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2067 | tANI_U8 num20MHzChannelsFound = 0; |
| 2068 | VOS_STATUS vosStatus; |
| 2069 | tANI_U8 num40MHzChannelsFound = 0; |
| 2070 | tANI_U8 Index = 0; |
| 2071 | tANI_U8 channelList = 0; |
| 2072 | |
| 2073 | // Updating the defaultpower Table for changed Domain Id |
| 2074 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 2075 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 2076 | |
| 2077 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 2078 | { |
| 2079 | smsLog( pMac, LOGE, FL("failed to get channels")); |
| 2080 | status = eHAL_STATUS_FAILURE; |
| 2081 | } |
| 2082 | else |
| 2083 | { |
| 2084 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 2085 | { |
| 2086 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2087 | } |
| 2088 | |
| 2089 | // Move the only 5GHZ channel list to the global data, |
| 2090 | // As 2.4GHZ list coming from the AP for the changed domain |
| 2091 | // structure -- this will be used as the scan list |
| 2092 | for(channelList = 0; channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN; channelList++) |
| 2093 | { |
| 2094 | // If Channel is 5GHz just break the for loop |
| 2095 | if(!(pMac->scan.base20MHzChannels.channelList[ channelList ] > 0 && pMac->scan.base20MHzChannels.channelList[ channelList ] <= 14)) |
| 2096 | break; |
| 2097 | } |
| 2098 | // Update the 5G channels from nv.bin |
| 2099 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 2100 | { |
| 2101 | if(pMac->scan.defaultPowerTable[Index].chanId >= 36 && pMac->scan.defaultPowerTable[Index].chanId <= 165) |
| 2102 | { |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 2103 | if (channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2104 | { |
| 2105 | pMac->scan.base20MHzChannels.channelList[ channelList ] = pMac->scan.defaultPowerTable[Index].chanId; |
| 2106 | channelList++; |
| 2107 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2108 | } |
| 2109 | } |
| 2110 | |
| 2111 | pMac->scan.numChannelsDefault = (num20MHzChannelsFound > channelList) ? num20MHzChannelsFound : channelList; |
| 2112 | pMac->scan.base20MHzChannels.numChannels = (num20MHzChannelsFound > channelList) ? num20MHzChannelsFound : channelList; |
| 2113 | // Filling the remaining index as Zero Just for causion |
| 2114 | for(Index = pMac->scan.base20MHzChannels.numChannels; Index < WNI_CFG_VALID_CHANNEL_LIST_LEN; Index++) |
| 2115 | pMac->scan.base20MHzChannels.channelList[ Index ] = 0; |
| 2116 | } |
| 2117 | return status; |
| 2118 | } |
| 2119 | |
| 2120 | eHalStatus csrGet24GChannels(tpAniSirGlobal pMac) |
| 2121 | { |
| 2122 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2123 | tANI_U8 num20MHzChannelsFound = 0; |
| 2124 | VOS_STATUS vosStatus; |
| 2125 | tANI_U8 Index = 0; |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2126 | tANI_U8 numChan = 0; |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2127 | tANI_U8 num40MHzChannelsFound = 0; |
| 2128 | tANI_U8 channelList5GBackup[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}, nuum5GchannelListBackup; |
| 2129 | tANI_U8 channelList = 0; |
| 2130 | |
| 2131 | // Read the scan channel list (including the power limit) from EEPROM |
| 2132 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 2133 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 2134 | |
| 2135 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 2136 | { |
| 2137 | smsLog( pMac, LOGE, FL("failed to get channels \n")); |
| 2138 | status = eHAL_STATUS_FAILURE; |
| 2139 | } |
| 2140 | else |
| 2141 | { |
| 2142 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 2143 | { |
| 2144 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2145 | } |
| 2146 | |
| 2147 | // Move the 2.4GHZ channel list only to the global data, |
| 2148 | // As 5GHz list been provided by AP as part of 11d IE |
| 2149 | // structure -- this will be used as the scan list |
| 2150 | for(channelList = 0, nuum5GchannelListBackup = 0; channelList < WNI_CFG_VALID_CHANNEL_LIST_LEN; channelList++) |
| 2151 | { |
| 2152 | if(pMac->scan.base20MHzChannels.channelList[ channelList ] >= 36 && pMac->scan.base20MHzChannels.channelList[ channelList ] <= 165) |
| 2153 | { |
| 2154 | // First taking the 5GHz channel list backup |
| 2155 | channelList5GBackup[nuum5GchannelListBackup] = pMac->scan.base20MHzChannels.channelList[ channelList ]; |
| 2156 | nuum5GchannelListBackup++; |
| 2157 | } |
| 2158 | } |
| 2159 | // Updating the 2.4GHz list |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2160 | for ( Index = 0, numChan = 0; Index < num20MHzChannelsFound; Index++) |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2161 | { |
| 2162 | if(pMac->scan.defaultPowerTable[Index].chanId > 0 && pMac->scan.defaultPowerTable[Index].chanId <= 14) |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2163 | { |
| 2164 | pMac->scan.base20MHzChannels.channelList[ numChan ] = pMac->scan.defaultPowerTable[Index].chanId; |
| 2165 | numChan++; |
| 2166 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2167 | } |
| 2168 | // Restoring the Backed up 5 GHZ channels |
| 2169 | for(channelList = 0;channelList < nuum5GchannelListBackup; channelList++ ) |
| 2170 | { |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2171 | if (numChan < WNI_CFG_VALID_CHANNEL_LIST_LEN) |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 2172 | { |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2173 | pMac->scan.base20MHzChannels.channelList[ numChan ] = channelList5GBackup[channelList]; |
| 2174 | numChan++; |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 2175 | } |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2176 | } |
| 2177 | |
Gopichand Nakkala | c8d06aa | 2013-06-27 12:35:23 +0530 | [diff] [blame] | 2178 | pMac->scan.numChannelsDefault = (num20MHzChannelsFound > numChan) ? num20MHzChannelsFound : numChan; |
| 2179 | pMac->scan.base20MHzChannels.numChannels = (num20MHzChannelsFound > numChan) ? num20MHzChannelsFound : numChan; |
Venkata Prathyusha Kuntupalli | 316247e | 2013-03-15 17:45:25 -0700 | [diff] [blame] | 2180 | } |
| 2181 | return (status); |
| 2182 | } |
| 2183 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2184 | eHalStatus csrInitGetChannels(tpAniSirGlobal pMac) |
| 2185 | { |
| 2186 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2187 | tANI_U8 num20MHzChannelsFound = 0; |
| 2188 | VOS_STATUS vosStatus; |
| 2189 | tANI_U8 Index = 0; |
| 2190 | tANI_U8 num40MHzChannelsFound = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2191 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2192 | |
| 2193 | //TODO: this interface changed to include the 40MHz channel list |
| 2194 | // this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation |
| 2195 | // Read the scan channel list (including the power limit) from EEPROM |
| 2196 | vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound, |
| 2197 | pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound); |
| 2198 | if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) ) |
| 2199 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2200 | smsLog( pMac, LOGE, FL("failed to get channels ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2201 | status = eHAL_STATUS_FAILURE; |
| 2202 | } |
| 2203 | else |
| 2204 | { |
| 2205 | if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN ) |
| 2206 | { |
| 2207 | num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2208 | } |
| 2209 | pMac->scan.numChannelsDefault = num20MHzChannelsFound; |
| 2210 | // Move the channel list to the global data |
| 2211 | // structure -- this will be used as the scan list |
| 2212 | for ( Index = 0; Index < num20MHzChannelsFound; Index++) |
| 2213 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2214 | pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2215 | } |
| 2216 | pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound; |
| 2217 | if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2218 | { |
| 2219 | num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 2220 | } |
| 2221 | for ( Index = 0; Index < num40MHzChannelsFound; Index++) |
| 2222 | { |
| 2223 | pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId; |
| 2224 | } |
| 2225 | pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound; |
| 2226 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2227 | return (status); |
| 2228 | } |
| 2229 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2230 | eHalStatus csrInitChannelList( tHalHandle hHal ) |
| 2231 | { |
| 2232 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2233 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2234 | csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels); |
| 2235 | csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 2236 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_FALSE); |
| 2237 | csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2238 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2239 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2240 | |
| 2241 | return (status); |
| 2242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2243 | eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac, |
| 2244 | tCsrUpdateConfigParam *pUpdateConfigParam) |
| 2245 | { |
| 2246 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2247 | tCsr11dinfo *ps11dinfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2248 | ps11dinfo = &pUpdateConfigParam->Csr11dinfo; |
| 2249 | status = CsrInit11dInfo(pMac, ps11dinfo); |
| 2250 | return status; |
| 2251 | } |
| 2252 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2253 | static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2254 | { |
| 2255 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2256 | tANI_U8 index; |
| 2257 | tANI_U32 count=0; |
| 2258 | tSirMacChanInfo *pChanInfo; |
| 2259 | tSirMacChanInfo *pChanInfoStart; |
| 2260 | tANI_BOOLEAN applyConfig = TRUE; |
| 2261 | |
| 2262 | if(!ps11dinfo) |
| 2263 | { |
| 2264 | return (status); |
| 2265 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2266 | if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) ) |
| 2267 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2268 | pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels; |
| 2269 | vos_mem_copy(pMac->scan.base20MHzChannels.channelList, |
| 2270 | ps11dinfo->Channels.channelList, |
| 2271 | ps11dinfo->Channels.numChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2272 | } |
| 2273 | else |
| 2274 | { |
| 2275 | //No change |
| 2276 | return (eHAL_STATUS_SUCCESS); |
| 2277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2278 | //legacy maintenance |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2279 | |
| 2280 | vos_mem_copy(pMac->scan.countryCodeDefault, ps11dinfo->countryCode, |
| 2281 | WNI_CFG_COUNTRY_CODE_LEN); |
| 2282 | |
| 2283 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2284 | //Tush: at csropen get this initialized with default, during csr reset if this |
| 2285 | // already set with some value no need initilaize with default again |
| 2286 | if(0 == pMac->scan.countryCodeCurrent[0]) |
| 2287 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2288 | vos_mem_copy(pMac->scan.countryCodeCurrent, ps11dinfo->countryCode, |
| 2289 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2290 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2291 | // need to add the max power channel list |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2292 | pChanInfo = vos_mem_malloc(sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2293 | if (pChanInfo != NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2294 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2295 | vos_mem_set(pChanInfo, |
| 2296 | sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN , |
| 2297 | 0); |
| 2298 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2299 | pChanInfoStart = pChanInfo; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2300 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2301 | { |
| 2302 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2303 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2304 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2305 | pChanInfo++; |
| 2306 | count++; |
| 2307 | } |
| 2308 | if(count) |
| 2309 | { |
| 2310 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2311 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2312 | vos_mem_free(pChanInfoStart); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2313 | } |
| 2314 | //Only apply them to CFG when not in STOP state. Otherwise they will be applied later |
| 2315 | if( HAL_STATUS_SUCCESS(status) ) |
| 2316 | { |
| 2317 | for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ ) |
| 2318 | { |
| 2319 | if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index)) |
| 2320 | { |
| 2321 | applyConfig = FALSE; |
| 2322 | } |
| 2323 | } |
| 2324 | |
| 2325 | if(TRUE == applyConfig) |
| 2326 | { |
| 2327 | // Apply the base channel list, power info, and set the Country code... |
Gopichand Nakkala | b9185f2 | 2012-12-21 08:03:42 -0800 | [diff] [blame] | 2328 | csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2329 | } |
| 2330 | |
| 2331 | } |
| 2332 | return (status); |
| 2333 | } |
| 2334 | /* Initialize the Channel + Power List in the local cache and in the CFG */ |
| 2335 | eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo) |
| 2336 | { |
| 2337 | tANI_U8 index; |
| 2338 | tANI_U32 count=0; |
| 2339 | tSirMacChanInfo *pChanInfo; |
| 2340 | tSirMacChanInfo *pChanInfoStart; |
| 2341 | |
| 2342 | if(!ps11dinfo || !pMac) |
| 2343 | { |
| 2344 | return eHAL_STATUS_FAILURE; |
| 2345 | } |
| 2346 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2347 | pChanInfo = vos_mem_malloc(sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN); |
| 2348 | if (pChanInfo != NULL) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2349 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2350 | vos_mem_set(pChanInfo, |
| 2351 | sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN, |
| 2352 | 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2353 | pChanInfoStart = pChanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2354 | |
| 2355 | for(index = 0; index < ps11dinfo->Channels.numChannels; index++) |
| 2356 | { |
| 2357 | pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel; |
| 2358 | pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels; |
| 2359 | pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap ); |
| 2360 | pChanInfo++; |
| 2361 | count++; |
| 2362 | } |
| 2363 | if(count) |
| 2364 | { |
| 2365 | csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart ); |
| 2366 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2367 | vos_mem_free(pChanInfoStart); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2368 | } |
| 2369 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2370 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2371 | } |
| 2372 | |
| 2373 | //pCommand may be NULL |
| 2374 | //Pass in sessionId in case pCommand is NULL. sessionId is not used in case pCommand is not NULL. |
| 2375 | void csrRoamRemoveDuplicateCommand(tpAniSirGlobal pMac, tANI_U32 sessionId, tSmeCmd *pCommand, eCsrRoamReason eRoamReason) |
| 2376 | { |
| 2377 | tListElem *pEntry, *pNextEntry; |
| 2378 | tSmeCmd *pDupCommand; |
| 2379 | tDblLinkList localList; |
| 2380 | |
| 2381 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 2382 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 2383 | { |
| 2384 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 2385 | return; |
| 2386 | } |
| 2387 | csrLLLock( &pMac->sme.smeCmdPendingList ); |
| 2388 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK ); |
| 2389 | while( pEntry ) |
| 2390 | { |
| 2391 | pNextEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK ); |
| 2392 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2393 | // Remove the previous command if.. |
| 2394 | // - the new roam command is for the same RoamReason... |
| 2395 | // - the new roam command is a NewProfileList. |
| 2396 | // - the new roam command is a Forced Dissoc |
| 2397 | // - the new roam command is from an 802.11 OID (OID_SSID or OID_BSSID). |
| 2398 | if ( |
| 2399 | (pCommand && ( pCommand->sessionId == pDupCommand->sessionId ) && |
| 2400 | ((pCommand->command == pDupCommand->command) && |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 2401 | /* This peermac check is requried for Softap/GO scenarios |
| 2402 | * For STA scenario below OR check will suffice as pCommand will |
| 2403 | * always be NULL for STA scenarios |
| 2404 | */ |
| 2405 | (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] | 2406 | (pCommand->u.roamCmd.roamReason == pDupCommand->u.roamCmd.roamReason || |
| 2407 | eCsrForcedDisassoc == pCommand->u.roamCmd.roamReason || |
| 2408 | eCsrHddIssued == pCommand->u.roamCmd.roamReason))) |
| 2409 | || |
| 2410 | //below the pCommand is NULL |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2411 | ( (sessionId == pDupCommand->sessionId) && |
| 2412 | (eSmeCommandRoam == pDupCommand->command) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2413 | ((eCsrForcedDisassoc == eRoamReason) || |
| 2414 | (eCsrHddIssued == eRoamReason)) |
| 2415 | ) |
| 2416 | ) |
| 2417 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2418 | smsLog(pMac, LOGW, FL(" roamReason = %d"), pDupCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2419 | // Remove the 'stale' roam command from the pending list... |
| 2420 | if(csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK )) |
| 2421 | { |
| 2422 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 2423 | } |
| 2424 | } |
| 2425 | pEntry = pNextEntry; |
| 2426 | } |
| 2427 | csrLLUnlock( &pMac->sme.smeCmdPendingList ); |
| 2428 | |
| 2429 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 2430 | { |
| 2431 | pDupCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 2432 | //Tell caller that the command is cancelled |
| 2433 | csrRoamCallCallback(pMac, pDupCommand->sessionId, NULL, pDupCommand->u.roamCmd.roamId, |
| 2434 | eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE); |
| 2435 | csrReleaseCommandRoam(pMac, pDupCommand); |
| 2436 | } |
| 2437 | csrLLClose(&localList); |
| 2438 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2439 | eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, |
| 2440 | tANI_U32 roamId, eRoamCmdStatus u1, eCsrRoamResult u2) |
| 2441 | { |
| 2442 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2443 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2444 | WLAN_VOS_DIAG_EVENT_DEF(connectionStatus, vos_event_wlan_status_payload_type); |
| 2445 | #endif |
| 2446 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2447 | if( CSR_IS_SESSION_VALID( pMac, sessionId) ) |
| 2448 | { |
| 2449 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2450 | } |
| 2451 | else |
| 2452 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2453 | smsLog(pMac, LOGE, "Session ID:%d is not valid", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2454 | VOS_ASSERT(0); |
| 2455 | return eHAL_STATUS_FAILURE; |
| 2456 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2457 | if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo) |
| 2458 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2459 | 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] | 2460 | } |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 2461 | if ((u1 == eCSR_ROAM_FT_REASSOC_FAILED) && (pSession->bRefAssocStartCnt)) { |
| 2462 | /* |
| 2463 | * Decrement bRefAssocStartCnt for FT reassoc failure. |
| 2464 | * Reason: For FT reassoc failures, we first call |
| 2465 | * csrRoamCallCallback before notifying a failed roam |
| 2466 | * completion through csrRoamComplete. The latter in |
| 2467 | * turn calls csrRoamProcessResults which tries to |
| 2468 | * once again call csrRoamCallCallback if bRefAssocStartCnt |
| 2469 | * is non-zero. Since this is redundant for FT reassoc |
| 2470 | * failure, decrement bRefAssocStartCnt. |
| 2471 | */ |
| 2472 | pSession->bRefAssocStartCnt--; |
| 2473 | } |
| 2474 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2475 | if ( (pSession == NULL) || |
| 2476 | (eANI_BOOLEAN_FALSE == pSession->sessionActive) ) |
| 2477 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2478 | smsLog(pMac, LOG1, "Session ID is not valid"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2479 | return eHAL_STATUS_FAILURE; |
| 2480 | } |
| 2481 | |
| 2482 | if(NULL != pSession->callback) |
| 2483 | { |
| 2484 | if( pRoamInfo ) |
| 2485 | { |
| 2486 | pRoamInfo->sessionId = (tANI_U8)sessionId; |
| 2487 | } |
| 2488 | |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 2489 | /* avoid holding the global lock when making the roaming callback, original change came |
| 2490 | from a raised CR (CR304874). Since this callback is in HDD a potential deadlock |
| 2491 | is possible on other OS ports where the callback may need to take locks to protect |
| 2492 | HDD state |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2493 | UPDATE : revert this change but keep the comments here. Need to revisit as there are callbacks |
| 2494 | that may actually depend on the lock being held */ |
| 2495 | // TODO: revisit: sme_ReleaseGlobalLock( &pMac->sme ); |
| 2496 | status = pSession->callback(pSession->pContext, pRoamInfo, roamId, u1, u2); |
| 2497 | // TODO: revisit: sme_AcquireGlobalLock( &pMac->sme ); |
| 2498 | } |
| 2499 | //EVENT_WLAN_STATUS: eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 2500 | // eCSR_ROAM_LOSTLINK, eCSR_ROAM_DISASSOCIATED, |
| 2501 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2502 | vos_mem_set(&connectionStatus, |
| 2503 | sizeof(vos_event_wlan_status_payload_type), 0); |
| 2504 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2505 | if((eCSR_ROAM_ASSOCIATION_COMPLETION == u1) && (eCSR_ROAM_RESULT_ASSOCIATED == u2)) |
| 2506 | { |
| 2507 | connectionStatus.eventId = eCSR_WLAN_STATUS_CONNECT; |
| 2508 | connectionStatus.bssType = pRoamInfo->u.pConnectedProfile->BSSType; |
| 2509 | if(NULL != pRoamInfo->pBssDesc) |
| 2510 | { |
| 2511 | connectionStatus.rssi = pRoamInfo->pBssDesc->rssi * (-1); |
| 2512 | connectionStatus.channel = pRoamInfo->pBssDesc->channelId; |
| 2513 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2514 | connectionStatus.qosCapability = pRoamInfo->u.pConnectedProfile->qosConnection; |
| 2515 | connectionStatus.authType = (v_U8_t)diagAuthTypeFromCSRType(pRoamInfo->u.pConnectedProfile->AuthType); |
| 2516 | connectionStatus.encryptionType = (v_U8_t)diagEncTypeFromCSRType(pRoamInfo->u.pConnectedProfile->EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2517 | vos_mem_copy(connectionStatus.ssid, |
| 2518 | pRoamInfo->u.pConnectedProfile->SSID.ssId, 6); |
| 2519 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2520 | connectionStatus.reason = eCSR_REASON_UNSPECIFIED; |
| 2521 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2522 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2523 | if((eCSR_ROAM_MIC_ERROR_IND == u1) || (eCSR_ROAM_RESULT_MIC_FAILURE == u2)) |
| 2524 | { |
| 2525 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2526 | connectionStatus.reason = eCSR_REASON_MIC_ERROR; |
| 2527 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2528 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2529 | if(eCSR_ROAM_RESULT_FORCED == u2) |
| 2530 | { |
| 2531 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2532 | connectionStatus.reason = eCSR_REASON_USER_REQUESTED; |
| 2533 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2534 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2535 | if(eCSR_ROAM_RESULT_DISASSOC_IND == u2) |
| 2536 | { |
| 2537 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2538 | connectionStatus.reason = eCSR_REASON_DISASSOC; |
| 2539 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2540 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2541 | if(eCSR_ROAM_RESULT_DEAUTH_IND == u2) |
| 2542 | { |
| 2543 | connectionStatus.eventId = eCSR_WLAN_STATUS_DISCONNECT; |
| 2544 | connectionStatus.reason = eCSR_REASON_DEAUTH; |
| 2545 | WLAN_VOS_DIAG_EVENT_REPORT(&connectionStatus, EVENT_WLAN_STATUS); |
| 2546 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2547 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 2548 | |
| 2549 | return (status); |
| 2550 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2551 | // Returns whether handoff is currently in progress or not |
| 2552 | tANI_BOOLEAN csrRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 2553 | { |
| 2554 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 2555 | return csrNeighborRoamIsHandoffInProgress(pMac); |
| 2556 | #else |
| 2557 | return eANI_BOOLEAN_FALSE; |
| 2558 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2559 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2560 | eHalStatus csrRoamIssueDisassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2561 | eCsrRoamSubState NewSubstate, tANI_BOOLEAN fMICFailure ) |
| 2562 | { |
| 2563 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2564 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2565 | tANI_U16 reasonCode; |
| 2566 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2567 | |
| 2568 | if(!pSession) |
| 2569 | { |
| 2570 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2571 | return eHAL_STATUS_FAILURE; |
| 2572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2573 | |
| 2574 | //Restore AC weight in case we change it |
| 2575 | if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 2576 | { |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 2577 | 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] | 2578 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 2579 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 2580 | } |
| 2581 | |
| 2582 | if ( fMICFailure ) |
| 2583 | { |
| 2584 | reasonCode = eSIR_MAC_MIC_FAILURE_REASON; |
| 2585 | } |
| 2586 | else if (NewSubstate == eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF) |
| 2587 | { |
| 2588 | reasonCode = eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2589 | } |
| 2590 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2591 | { |
| 2592 | reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 2593 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2594 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2595 | if ( (csrRoamIsHandoffInProgress(pMac)) && |
| 2596 | (NewSubstate != eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF)) |
| 2597 | { |
| 2598 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2599 | vos_mem_copy(&bssId, |
| 2600 | pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, |
| 2601 | sizeof(tSirMacAddr)); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2602 | } |
| 2603 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2604 | #endif |
| 2605 | if(pSession->pConnectBssDesc) |
| 2606 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2607 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2608 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2609 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2610 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 2611 | smsLog( pMac, LOG2, "CSR Attempting to Disassociate Bssid=%02x-%02x-%02x-%02x-%02x-%02x" |
| 2612 | "subState = %d reason=%d", bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], bssId[ 3 ], |
| 2613 | bssId[ 4 ], bssId[ 5 ], NewSubstate, reasonCode); |
| 2614 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2615 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2616 | |
| 2617 | status = csrSendMBDisassocReqMsg( pMac, sessionId, bssId, reasonCode ); |
| 2618 | |
| 2619 | if(HAL_STATUS_SUCCESS(status)) |
| 2620 | { |
| 2621 | csrRoamLinkDown(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2622 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 2623 | //no need to tell QoS that we are disassociating, it will be taken care off in assoc req for HO |
| 2624 | if(eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF != NewSubstate) |
| 2625 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2626 | //notify QoS module that disassoc happening |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2627 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 2628 | } |
| 2629 | #endif |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2630 | } |
| 2631 | else |
| 2632 | { |
| 2633 | smsLog(pMac, LOGW, FL("csrSendMBDisassocReqMsg failed with status %d"), status); |
| 2634 | } |
| 2635 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2636 | return (status); |
| 2637 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2638 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2639 | /* --------------------------------------------------------------------------- |
| 2640 | \fn csrRoamIssueDisassociateStaCmd |
| 2641 | \brief csr function that HDD calls to disassociate a associated station |
| 2642 | \param sessionId - session Id for Soft AP |
| 2643 | \param pPeerMacAddr - MAC of associated station to delete |
| 2644 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2645 | \return eHalStatus |
| 2646 | ---------------------------------------------------------------------------*/ |
| 2647 | eHalStatus csrRoamIssueDisassociateStaCmd( tpAniSirGlobal pMac, |
| 2648 | tANI_U32 sessionId, |
| 2649 | tANI_U8 *pPeerMacAddr, |
| 2650 | tANI_U32 reason) |
| 2651 | { |
| 2652 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2653 | tSmeCmd *pCommand; |
| 2654 | |
| 2655 | do |
| 2656 | { |
| 2657 | pCommand = csrGetCommandBuffer( pMac ); |
| 2658 | if ( !pCommand ) |
| 2659 | { |
| 2660 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2661 | status = eHAL_STATUS_RESOURCES; |
| 2662 | break; |
| 2663 | } |
| 2664 | pCommand->command = eSmeCommandRoam; |
| 2665 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2666 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocSta; |
| 2667 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2668 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2669 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2670 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2671 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2672 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2673 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2674 | } |
| 2675 | }while(0); |
| 2676 | |
| 2677 | return status; |
| 2678 | } |
| 2679 | |
| 2680 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2681 | /* --------------------------------------------------------------------------- |
| 2682 | \fn csrRoamIssueDeauthSta |
| 2683 | \brief csr function that HDD calls to delete a associated station |
| 2684 | \param sessionId - session Id for Soft AP |
| 2685 | \param pPeerMacAddr - MAC of associated station to delete |
| 2686 | \param reason - reason code, be one of the tSirMacReasonCodes |
| 2687 | \return eHalStatus |
| 2688 | ---------------------------------------------------------------------------*/ |
| 2689 | eHalStatus csrRoamIssueDeauthStaCmd( tpAniSirGlobal pMac, |
| 2690 | tANI_U32 sessionId, |
| 2691 | tANI_U8 *pPeerMacAddr, |
| 2692 | tANI_U32 reason) |
| 2693 | { |
| 2694 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2695 | tSmeCmd *pCommand; |
| 2696 | |
| 2697 | do |
| 2698 | { |
| 2699 | pCommand = csrGetCommandBuffer( pMac ); |
| 2700 | if ( !pCommand ) |
| 2701 | { |
| 2702 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
| 2703 | status = eHAL_STATUS_RESOURCES; |
| 2704 | break; |
| 2705 | } |
| 2706 | pCommand->command = eSmeCommandRoam; |
| 2707 | pCommand->sessionId = (tANI_U8)sessionId; |
| 2708 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauthSta; |
| 2709 | vos_mem_copy(pCommand->u.roamCmd.peerMac, pPeerMacAddr, 6); |
| 2710 | pCommand->u.roamCmd.reason = (tSirMacReasonCodes)reason; |
| 2711 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_FALSE); |
| 2712 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 2713 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2714 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2715 | csrReleaseCommandRoam( pMac, pCommand ); |
| 2716 | } |
| 2717 | }while(0); |
| 2718 | |
| 2719 | return status; |
| 2720 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2721 | eHalStatus |
| 2722 | csrRoamIssueTkipCounterMeasures( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2723 | tANI_BOOLEAN bEnable ) |
| 2724 | { |
| 2725 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2726 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2727 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2728 | if (!pSession) |
| 2729 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2730 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2731 | return (status); |
| 2732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2733 | if (pSession->pConnectBssDesc) |
| 2734 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2735 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2736 | } |
| 2737 | else |
| 2738 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2739 | smsLog( pMac, LOGE, "csrRoamIssueTkipCounterMeasures:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2740 | return (status); |
| 2741 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2742 | smsLog( pMac, LOG2, "CSR issuing tkip counter measures for Bssid = %02x-%02x-%02x-%02x-%02x-%02x, Enable = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2743 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 2744 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ], bEnable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2745 | status = csrSendMBTkipCounterMeasuresReqMsg( pMac, sessionId, bEnable, bssId ); |
| 2746 | return (status); |
| 2747 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2748 | eHalStatus |
| 2749 | csrRoamGetAssociatedStas( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2750 | VOS_MODULE_ID modId, void *pUsrContext, |
| 2751 | void *pfnSapEventCallback, v_U8_t *pAssocStasBuf ) |
| 2752 | { |
| 2753 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2754 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2755 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2756 | if (!pSession) |
| 2757 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2758 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2759 | return (status); |
| 2760 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2761 | if(pSession->pConnectBssDesc) |
| 2762 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2763 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2764 | } |
| 2765 | else |
| 2766 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2767 | smsLog( pMac, LOGE, "csrRoamGetAssociatedStas:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2768 | return (status); |
| 2769 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2770 | smsLog( pMac, LOG2, "CSR getting associated stations for Bssid = %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2771 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2772 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2773 | status = csrSendMBGetAssociatedStasReqMsg( pMac, sessionId, modId, bssId, pUsrContext, pfnSapEventCallback, pAssocStasBuf ); |
| 2774 | return (status); |
| 2775 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2776 | eHalStatus |
| 2777 | csrRoamGetWpsSessionOverlap( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 2778 | void *pUsrContext, void *pfnSapEventCallback, v_MACADDR_t pRemoveMac ) |
| 2779 | { |
| 2780 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2781 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2782 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2783 | |
| 2784 | if (!pSession) |
| 2785 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2786 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2787 | return (status); |
| 2788 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2789 | if(pSession->pConnectBssDesc) |
| 2790 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2791 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2792 | } |
| 2793 | else |
| 2794 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2795 | smsLog( pMac, LOGE, "csrRoamGetWpsSessionOverlap:Connected BSS Description in CSR Session not found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2796 | return (status); |
| 2797 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2798 | smsLog( pMac, LOG2, "CSR getting WPS Session Overlap for Bssid = %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2799 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2800 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
| 2801 | |
| 2802 | status = csrSendMBGetWPSPBCSessions( pMac, sessionId, bssId, pUsrContext, pfnSapEventCallback, pRemoveMac); |
| 2803 | |
| 2804 | return (status); |
| 2805 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2806 | eHalStatus csrRoamIssueDeauth( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 2807 | { |
| 2808 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2809 | tCsrBssid bssId = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 2810 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2811 | |
| 2812 | if (!pSession) |
| 2813 | { |
| 2814 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2815 | return eHAL_STATUS_FAILURE; |
| 2816 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2817 | |
| 2818 | if(pSession->pConnectBssDesc) |
| 2819 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2820 | vos_mem_copy(&bssId, pSession->pConnectBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2821 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2822 | smsLog( pMac, LOG2, "CSR Attempting to Deauth Bssid= %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2823 | bssId[ 0 ], bssId[ 1 ], bssId[ 2 ], |
| 2824 | bssId[ 3 ], bssId[ 4 ], bssId[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2825 | csrRoamSubstateChange( pMac, NewSubstate, sessionId); |
| 2826 | |
Madan Mohan Koyyalamudi | 299b486 | 2013-01-30 19:59:23 +0530 | [diff] [blame] | 2827 | status = csrSendMBDeauthReqMsg( pMac, sessionId, bssId, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 2828 | if(!HAL_STATUS_SUCCESS(status)) |
| 2829 | { |
| 2830 | smsLog(pMac, LOGW, FL("csrSendMBDeauthReqMsg failed with status %d"), status); |
| 2831 | } |
| 2832 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2833 | return (status); |
| 2834 | } |
| 2835 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2836 | eHalStatus csrRoamSaveConnectedBssDesc( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDesc ) |
| 2837 | { |
| 2838 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2839 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 2840 | tANI_U32 size; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2841 | |
| 2842 | if(!pSession) |
| 2843 | { |
| 2844 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 2845 | return eHAL_STATUS_FAILURE; |
| 2846 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2847 | |
| 2848 | // If no BSS description was found in this connection (happens with start IBSS), then |
| 2849 | // nix the BSS description that we keep around for the connected BSS) and get out... |
| 2850 | if(NULL == pBssDesc) |
| 2851 | { |
| 2852 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2853 | } |
| 2854 | else |
| 2855 | { |
| 2856 | size = pBssDesc->length + sizeof( pBssDesc->length ); |
| 2857 | if(NULL != pSession->pConnectBssDesc) |
| 2858 | { |
| 2859 | if(((pSession->pConnectBssDesc->length) + sizeof(pSession->pConnectBssDesc->length)) < size) |
| 2860 | { |
| 2861 | //not enough room for the new BSS, pMac->roam.pConnectBssDesc is freed inside |
| 2862 | csrFreeConnectBssDesc(pMac, sessionId); |
| 2863 | } |
| 2864 | } |
| 2865 | if(NULL == pSession->pConnectBssDesc) |
| 2866 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2867 | pSession->pConnectBssDesc = vos_mem_malloc(size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2868 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2869 | if (NULL == pSession->pConnectBssDesc) |
| 2870 | status = eHAL_STATUS_FAILURE; |
| 2871 | else |
| 2872 | vos_mem_copy(pSession->pConnectBssDesc, pBssDesc, size); |
| 2873 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2874 | return (status); |
| 2875 | } |
| 2876 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2877 | eHalStatus csrRoamPrepareBssConfig(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 2878 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
| 2879 | tDot11fBeaconIEs *pIes) |
| 2880 | { |
| 2881 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2882 | eCsrCfgDot11Mode cfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2883 | VOS_ASSERT( pIes != NULL ); |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 2884 | if (pIes == NULL) |
| 2885 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2886 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2887 | do |
| 2888 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2889 | vos_mem_copy(&pBssConfig->BssCap, &pBssDesc->capabilityInfo, |
| 2890 | sizeof(tSirMacCapabilityInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2891 | //get qos |
| 2892 | pBssConfig->qosType = csrGetQoSFromBssDesc(pMac, pBssDesc, pIes); |
| 2893 | //get SSID |
| 2894 | if(pIes->SSID.present) |
| 2895 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 2896 | 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] | 2897 | pBssConfig->SSID.length = pIes->SSID.num_ssid; |
| 2898 | } |
| 2899 | else |
| 2900 | pBssConfig->SSID.length = 0; |
| 2901 | if(csrIsNULLSSID(pBssConfig->SSID.ssId, pBssConfig->SSID.length)) |
| 2902 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2903 | smsLog(pMac, LOGW, " BSS desc SSID is a wildcard"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2904 | //Return failed if profile doesn't have an SSID either. |
| 2905 | if(pProfile->SSIDs.numOfSSIDs == 0) |
| 2906 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2907 | smsLog(pMac, LOGW, " Both BSS desc and profile doesn't have SSID"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2908 | status = eHAL_STATUS_FAILURE; |
| 2909 | break; |
| 2910 | } |
| 2911 | } |
| 2912 | if(CSR_IS_CHANNEL_5GHZ(pBssDesc->channelId)) |
| 2913 | { |
| 2914 | pBssConfig->eBand = eCSR_BAND_5G; |
| 2915 | } |
| 2916 | else |
| 2917 | { |
| 2918 | pBssConfig->eBand = eCSR_BAND_24; |
| 2919 | } |
| 2920 | //phymode |
| 2921 | if(csrIsPhyModeMatch( pMac, pProfile->phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes )) |
| 2922 | { |
| 2923 | pBssConfig->uCfgDot11Mode = cfgDot11Mode; |
| 2924 | } |
| 2925 | else |
| 2926 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2927 | smsLog(pMac, LOGW, " Can not find match phy mode"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2928 | //force it |
| 2929 | if(eCSR_BAND_24 == pBssConfig->eBand) |
| 2930 | { |
| 2931 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2932 | } |
| 2933 | else |
| 2934 | { |
| 2935 | pBssConfig->uCfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2936 | } |
| 2937 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2938 | //Qos |
| 2939 | if ((pBssConfig->uCfgDot11Mode != eCSR_CFG_DOT11_MODE_11N) && |
| 2940 | (pMac->roam.configParam.WMMSupportMode == eCsrRoamWmmNoQos)) |
| 2941 | { |
| 2942 | //Joining BSS is not 11n capable and WMM is disabled on client. |
| 2943 | //Disable QoS and WMM |
| 2944 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 2945 | } |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2946 | |
| 2947 | if (((pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11N) || |
Pratik Bhalgat | 8d46164 | 2012-11-22 16:55:42 +0530 | [diff] [blame] | 2948 | (pBssConfig->uCfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC)) && |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 2949 | ((pBssConfig->qosType != eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP) || |
| 2950 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_HCF) || |
| 2951 | (pBssConfig->qosType != eCSR_MEDIUM_ACCESS_11e_eDCF) )) |
| 2952 | { |
| 2953 | //Joining BSS is 11n capable and WMM is disabled on AP. |
| 2954 | //Assume all HT AP's are QOS AP's and enable WMM |
| 2955 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 2956 | } |
| 2957 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2958 | //auth type |
| 2959 | switch( pProfile->negotiatedAuthType ) |
| 2960 | { |
| 2961 | default: |
| 2962 | case eCSR_AUTH_TYPE_WPA: |
| 2963 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2964 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2965 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 2966 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 2967 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2968 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 2969 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 2970 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2971 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 2972 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 2973 | break; |
| 2974 | } |
| 2975 | //short slot time |
| 2976 | if( eCSR_CFG_DOT11_MODE_11B != cfgDot11Mode ) |
| 2977 | { |
| 2978 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 2979 | } |
| 2980 | else |
| 2981 | { |
| 2982 | pBssConfig->uShortSlotTime = 0; |
| 2983 | } |
| 2984 | if(pBssConfig->BssCap.ibss) |
| 2985 | { |
| 2986 | //We don't support 11h on IBSS |
| 2987 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 2988 | } |
| 2989 | else |
| 2990 | { |
| 2991 | pBssConfig->f11hSupport = pMac->roam.configParam.Is11hSupportEnabled; |
| 2992 | } |
| 2993 | //power constraint |
| 2994 | pBssConfig->uPowerLimit = csrGet11hPowerConstraint(pMac, &pIes->PowerConstraints); |
| 2995 | //heartbeat |
| 2996 | if ( CSR_IS_11A_BSS( pBssDesc ) ) |
| 2997 | { |
| 2998 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 2999 | } |
| 3000 | else |
| 3001 | { |
| 3002 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 3003 | } |
| 3004 | //Join timeout |
| 3005 | // 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] | 3006 | // be 10 x the BeaconInterval. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3007 | if ( pBssDesc->beaconInterval ) |
| 3008 | { |
| 3009 | //Make sure it is bigger than the minimal |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3010 | 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] | 3011 | } |
| 3012 | else |
| 3013 | { |
| 3014 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
| 3015 | } |
| 3016 | //validate CB |
| 3017 | pBssConfig->cbMode = csrGetCBModeFromIes(pMac, pBssDesc->channelId, pIes); |
| 3018 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3019 | return (status); |
| 3020 | } |
| 3021 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3022 | static eHalStatus csrRoamPrepareBssConfigFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 3023 | tBssConfigParam *pBssConfig, tSirBssDescription *pBssDesc) |
| 3024 | { |
| 3025 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3026 | tANI_U8 operationChannel = 0; |
| 3027 | tANI_U8 qAPisEnabled = FALSE; |
| 3028 | //SSID |
| 3029 | pBssConfig->SSID.length = 0; |
| 3030 | if(pProfile->SSIDs.numOfSSIDs) |
| 3031 | { |
| 3032 | //only use the first one |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3033 | vos_mem_copy(&pBssConfig->SSID, &pProfile->SSIDs.SSIDList[0].SSID, |
| 3034 | sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3035 | } |
| 3036 | else |
| 3037 | { |
| 3038 | //SSID must present |
| 3039 | return eHAL_STATUS_FAILURE; |
| 3040 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3041 | //Settomg up the capabilities |
| 3042 | if( csrIsBssTypeIBSS(pProfile->BSSType) ) |
| 3043 | { |
| 3044 | pBssConfig->BssCap.ibss = 1; |
| 3045 | } |
| 3046 | else |
| 3047 | { |
| 3048 | pBssConfig->BssCap.ess = 1; |
| 3049 | } |
| 3050 | if( eCSR_ENCRYPT_TYPE_NONE != pProfile->EncryptionType.encryptionType[0] ) |
| 3051 | { |
| 3052 | pBssConfig->BssCap.privacy = 1; |
| 3053 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3054 | pBssConfig->eBand = pMac->roam.configParam.eBand; |
| 3055 | //phymode |
| 3056 | if(pProfile->ChannelInfo.ChannelList) |
| 3057 | { |
| 3058 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3059 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3060 | pBssConfig->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, operationChannel, |
| 3061 | &pBssConfig->eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3062 | //QOS |
| 3063 | //Is this correct to always set to this //*** |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3064 | if ( pBssConfig->BssCap.ess == 1 ) |
| 3065 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3066 | /*For Softap case enable WMM*/ |
| 3067 | if(CSR_IS_INFRA_AP(pProfile) && (eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode )){ |
| 3068 | qAPisEnabled = TRUE; |
| 3069 | } |
| 3070 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3071 | if (csrRoamGetQosInfoFromBss(pMac, pBssDesc) == eHAL_STATUS_SUCCESS) { |
| 3072 | qAPisEnabled = TRUE; |
| 3073 | } else { |
| 3074 | qAPisEnabled = FALSE; |
| 3075 | } |
| 3076 | } else { |
| 3077 | qAPisEnabled = TRUE; |
| 3078 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3079 | if (( eCsrRoamWmmNoQos != pMac->roam.configParam.WMMSupportMode && qAPisEnabled) || |
| 3080 | (( eCSR_CFG_DOT11_MODE_11N == pBssConfig->uCfgDot11Mode && qAPisEnabled) || |
| 3081 | ( eCSR_CFG_DOT11_MODE_TAURUS == pBssConfig->uCfgDot11Mode ) ) //For 11n, need QoS |
| 3082 | ) |
| 3083 | { |
| 3084 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 3085 | } else { |
| 3086 | pBssConfig->qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 3087 | } |
| 3088 | |
| 3089 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 3090 | switch( pProfile->AuthType.authType[0] ) //Take the preferred Auth type. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3091 | { |
| 3092 | default: |
| 3093 | case eCSR_AUTH_TYPE_WPA: |
| 3094 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 3095 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 3096 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3097 | pBssConfig->authType = eSIR_OPEN_SYSTEM; |
| 3098 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3099 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 3100 | pBssConfig->authType = eSIR_SHARED_KEY; |
| 3101 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3102 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 3103 | pBssConfig->authType = eSIR_AUTO_SWITCH; |
| 3104 | break; |
| 3105 | } |
| 3106 | //short slot time |
| 3107 | if( WNI_CFG_PHY_MODE_11B != pBssConfig->uCfgDot11Mode ) |
| 3108 | { |
| 3109 | pBssConfig->uShortSlotTime = pMac->roam.configParam.shortSlotTime; |
| 3110 | } |
| 3111 | else |
| 3112 | { |
| 3113 | pBssConfig->uShortSlotTime = 0; |
| 3114 | } |
| 3115 | //power constraint. We don't support 11h on IBSS |
| 3116 | pBssConfig->f11hSupport = eANI_BOOLEAN_FALSE; |
| 3117 | pBssConfig->uPowerLimit = 0; |
| 3118 | //heartbeat |
| 3119 | if ( eCSR_BAND_5G == pBssConfig->eBand ) |
| 3120 | { |
| 3121 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh50; |
| 3122 | } |
| 3123 | else |
| 3124 | { |
| 3125 | pBssConfig->uHeartBeatThresh = pMac->roam.configParam.HeartbeatThresh24; |
| 3126 | } |
| 3127 | //Join timeout |
| 3128 | pBssConfig->uJoinTimeOut = CSR_JOIN_FAILURE_TIMEOUT_DEFAULT; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3129 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3130 | return (status); |
| 3131 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3132 | static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc) |
| 3133 | { |
| 3134 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3135 | tDot11fBeaconIEs *pIes = NULL; |
| 3136 | |
| 3137 | do |
| 3138 | { |
| 3139 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 3140 | { |
| 3141 | //err msg |
| 3142 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3143 | "csrRoamGetQosInfoFromBss() failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3144 | break; |
| 3145 | } |
| 3146 | //check if the AP is QAP & it supports APSD |
| 3147 | if( CSR_IS_QOS_BSS(pIes) ) |
| 3148 | { |
| 3149 | return eHAL_STATUS_SUCCESS; |
| 3150 | } |
| 3151 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3152 | return status; |
| 3153 | } |
| 3154 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3155 | void csrSetCfgPrivacy( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, tANI_BOOLEAN fPrivacy ) |
| 3156 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3157 | // !! Note: the only difference between this function and the csrSetCfgPrivacyFromProfile() is the |
| 3158 | // setting of the privacy CFG based on the advertised privacy setting from the AP for WPA associations. |
| 3159 | // See !!Note: below in this function... |
| 3160 | tANI_U32 PrivacyEnabled = 0; |
| 3161 | tANI_U32 RsnEnabled = 0; |
| 3162 | tANI_U32 WepDefaultKeyId = 0; |
| 3163 | tANI_U32 WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; /* default 40 bits */ |
| 3164 | tANI_U32 Key0Length = 0; |
| 3165 | tANI_U32 Key1Length = 0; |
| 3166 | tANI_U32 Key2Length = 0; |
| 3167 | tANI_U32 Key3Length = 0; |
| 3168 | |
| 3169 | // Reserve for the biggest key |
| 3170 | tANI_U8 Key0[ WNI_CFG_WEP_DEFAULT_KEY_1_LEN ]; |
| 3171 | tANI_U8 Key1[ WNI_CFG_WEP_DEFAULT_KEY_2_LEN ]; |
| 3172 | tANI_U8 Key2[ WNI_CFG_WEP_DEFAULT_KEY_3_LEN ]; |
| 3173 | tANI_U8 Key3[ WNI_CFG_WEP_DEFAULT_KEY_4_LEN ]; |
| 3174 | |
| 3175 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 3176 | { |
| 3177 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3178 | |
| 3179 | // for NO encryption, turn off Privacy and Rsn. |
| 3180 | PrivacyEnabled = 0; |
| 3181 | RsnEnabled = 0; |
| 3182 | |
| 3183 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3184 | |
| 3185 | // clear out the WEP keys that may be hanging around. |
| 3186 | Key0Length = 0; |
| 3187 | Key1Length = 0; |
| 3188 | Key2Length = 0; |
| 3189 | Key3Length = 0; |
| 3190 | |
| 3191 | break; |
| 3192 | |
| 3193 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3194 | case eCSR_ENCRYPT_TYPE_WEP40: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3195 | |
| 3196 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3197 | PrivacyEnabled = 1; |
| 3198 | RsnEnabled = 0; |
| 3199 | |
| 3200 | // Set the Wep default key ID. |
| 3201 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3202 | // Wep key size if 5 bytes (40 bits). |
| 3203 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3204 | |
| 3205 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3206 | if ( pProfile->Keys.KeyLength[0] ) |
| 3207 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3208 | vos_mem_copy(Key0, pProfile->Keys.KeyMaterial[0], |
| 3209 | WNI_CFG_WEP_KEY_LENGTH_5); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3210 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3211 | } |
| 3212 | else |
| 3213 | { |
| 3214 | Key0Length = 0; |
| 3215 | } |
| 3216 | |
| 3217 | if ( pProfile->Keys.KeyLength[1] ) |
| 3218 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3219 | vos_mem_copy(Key1, pProfile->Keys.KeyMaterial[1], |
| 3220 | WNI_CFG_WEP_KEY_LENGTH_5); |
| 3221 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_5; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3222 | } |
| 3223 | else |
| 3224 | { |
| 3225 | Key1Length = 0; |
| 3226 | } |
| 3227 | |
| 3228 | if ( pProfile->Keys.KeyLength[2] ) |
| 3229 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3230 | vos_mem_copy(Key2, pProfile->Keys.KeyMaterial[2], |
| 3231 | WNI_CFG_WEP_KEY_LENGTH_5); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3232 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3233 | } |
| 3234 | else |
| 3235 | { |
| 3236 | Key2Length = 0; |
| 3237 | } |
| 3238 | |
| 3239 | if ( pProfile->Keys.KeyLength[3] ) |
| 3240 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3241 | vos_mem_copy(Key3, pProfile->Keys.KeyMaterial[3], |
| 3242 | WNI_CFG_WEP_KEY_LENGTH_5); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3243 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_5; |
| 3244 | } |
| 3245 | else |
| 3246 | { |
| 3247 | Key3Length = 0; |
| 3248 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3249 | break; |
| 3250 | |
| 3251 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 3252 | case eCSR_ENCRYPT_TYPE_WEP104: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3253 | |
| 3254 | // Privacy is ON. NO RSN for Wep40 static key. |
| 3255 | PrivacyEnabled = 1; |
| 3256 | RsnEnabled = 0; |
| 3257 | |
| 3258 | // Set the Wep default key ID. |
| 3259 | WepDefaultKeyId = pProfile->Keys.defaultIndex; |
| 3260 | |
| 3261 | // Wep key size if 13 bytes (104 bits). |
| 3262 | WepKeyLength = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3263 | |
| 3264 | // set encryption keys in the CFG database or clear those that are not present in this profile. |
| 3265 | if ( pProfile->Keys.KeyLength[0] ) |
| 3266 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3267 | vos_mem_copy(Key0, pProfile->Keys.KeyMaterial[ 0 ], |
| 3268 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3269 | Key0Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3270 | } |
| 3271 | else |
| 3272 | { |
| 3273 | Key0Length = 0; |
| 3274 | } |
| 3275 | |
| 3276 | if ( pProfile->Keys.KeyLength[1] ) |
| 3277 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3278 | vos_mem_copy(Key1, pProfile->Keys.KeyMaterial[ 1 ], |
| 3279 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3280 | Key1Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3281 | } |
| 3282 | else |
| 3283 | { |
| 3284 | Key1Length = 0; |
| 3285 | } |
| 3286 | |
| 3287 | if ( pProfile->Keys.KeyLength[2] ) |
| 3288 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3289 | vos_mem_copy(Key2, pProfile->Keys.KeyMaterial[ 2 ], |
| 3290 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3291 | Key2Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3292 | } |
| 3293 | else |
| 3294 | { |
| 3295 | Key2Length = 0; |
| 3296 | } |
| 3297 | |
| 3298 | if ( pProfile->Keys.KeyLength[3] ) |
| 3299 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3300 | vos_mem_copy(Key3, pProfile->Keys.KeyMaterial[ 3 ], |
| 3301 | WNI_CFG_WEP_KEY_LENGTH_13); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3302 | Key3Length = WNI_CFG_WEP_KEY_LENGTH_13; |
| 3303 | } |
| 3304 | else |
| 3305 | { |
| 3306 | Key3Length = 0; |
| 3307 | } |
| 3308 | |
| 3309 | break; |
| 3310 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3311 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3312 | case eCSR_ENCRYPT_TYPE_AES: |
| 3313 | #ifdef FEATURE_WLAN_WAPI |
| 3314 | case eCSR_ENCRYPT_TYPE_WPI: |
| 3315 | #endif /* FEATURE_WLAN_WAPI */ |
| 3316 | // !! Note: this is the only difference between this function and the csrSetCfgPrivacyFromProfile() |
| 3317 | // (setting of the privacy CFG based on the advertised privacy setting from the AP for WPA/WAPI associations ). |
| 3318 | PrivacyEnabled = (0 != fPrivacy); |
| 3319 | |
| 3320 | // turn on RSN enabled for WPA associations |
| 3321 | RsnEnabled = 1; |
| 3322 | |
| 3323 | // WEP key length and Wep Default Key ID don't matter in this case.... |
| 3324 | |
| 3325 | // clear out the static WEP keys that may be hanging around. |
| 3326 | Key0Length = 0; |
| 3327 | Key1Length = 0; |
| 3328 | Key2Length = 0; |
| 3329 | Key3Length = 0; |
| 3330 | |
| 3331 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3332 | default: |
| 3333 | PrivacyEnabled = 0; |
| 3334 | RsnEnabled = 0; |
| 3335 | break; |
| 3336 | } |
| 3337 | |
| 3338 | ccmCfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, PrivacyEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3339 | ccmCfgSetInt(pMac, WNI_CFG_RSN_ENABLED, RsnEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3340 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_1, Key0, Key0Length, NULL, eANI_BOOLEAN_FALSE); |
| 3341 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_2, Key1, Key1Length, NULL, eANI_BOOLEAN_FALSE); |
| 3342 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_3, Key2, Key2Length, NULL, eANI_BOOLEAN_FALSE); |
| 3343 | ccmCfgSetStr(pMac, WNI_CFG_WEP_DEFAULT_KEY_4, Key3, Key3Length, NULL, eANI_BOOLEAN_FALSE); |
| 3344 | ccmCfgSetInt(pMac, WNI_CFG_WEP_KEY_LENGTH, WepKeyLength, NULL, eANI_BOOLEAN_FALSE); |
| 3345 | ccmCfgSetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, WepDefaultKeyId, NULL, eANI_BOOLEAN_FALSE); |
| 3346 | } |
| 3347 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3348 | static void csrSetCfgSsid( tpAniSirGlobal pMac, tSirMacSSid *pSSID ) |
| 3349 | { |
| 3350 | tANI_U32 len = 0; |
| 3351 | if(pSSID->length <= WNI_CFG_SSID_LEN) |
| 3352 | { |
| 3353 | len = pSSID->length; |
| 3354 | } |
| 3355 | ccmCfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *)pSSID->ssId, len, NULL, eANI_BOOLEAN_FALSE); |
| 3356 | } |
| 3357 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3358 | eHalStatus csrSetQosToCfg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrMediaAccessType qosType ) |
| 3359 | { |
| 3360 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3361 | tANI_U32 QoSEnabled; |
| 3362 | tANI_U32 WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3363 | // set the CFG enable/disable variables based on the qosType being configured... |
| 3364 | switch( qosType ) |
| 3365 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3366 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_802dot1p: |
| 3367 | QoSEnabled = FALSE; |
| 3368 | WmeEnabled = TRUE; |
| 3369 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3370 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP: |
| 3371 | QoSEnabled = FALSE; |
| 3372 | WmeEnabled = TRUE; |
| 3373 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3374 | case eCSR_MEDIUM_ACCESS_WMM_eDCF_NoClassify: |
| 3375 | QoSEnabled = FALSE; |
| 3376 | WmeEnabled = TRUE; |
| 3377 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3378 | case eCSR_MEDIUM_ACCESS_11e_eDCF: |
| 3379 | QoSEnabled = TRUE; |
| 3380 | WmeEnabled = FALSE; |
| 3381 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3382 | case eCSR_MEDIUM_ACCESS_11e_HCF: |
| 3383 | QoSEnabled = TRUE; |
| 3384 | WmeEnabled = FALSE; |
| 3385 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3386 | default: |
| 3387 | case eCSR_MEDIUM_ACCESS_DCF: |
| 3388 | QoSEnabled = FALSE; |
| 3389 | WmeEnabled = FALSE; |
| 3390 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3391 | } |
| 3392 | //save the WMM setting for later use |
| 3393 | pMac->roam.roamSession[sessionId].fWMMConnection = (tANI_BOOLEAN)WmeEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3394 | status = ccmCfgSetInt(pMac, WNI_CFG_QOS_ENABLED, QoSEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3395 | status = ccmCfgSetInt(pMac, WNI_CFG_WME_ENABLED, WmeEnabled, NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3396 | return (status); |
| 3397 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3398 | static eHalStatus csrGetRateSet( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tSirBssDescription *pBssDesc, |
| 3399 | tDot11fBeaconIEs *pIes, tSirMacRateSet *pOpRateSet, tSirMacRateSet *pExRateSet) |
| 3400 | { |
| 3401 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 3402 | int i; |
| 3403 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3404 | tANI_U8 *pDstRate; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3405 | vos_mem_set(pOpRateSet, sizeof(tSirMacRateSet), 0); |
| 3406 | vos_mem_set(pExRateSet, sizeof(tSirMacRateSet), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3407 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3408 | |
| 3409 | if( NULL != pIes ) |
| 3410 | { |
| 3411 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3412 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3413 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3414 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3415 | // would blindly put the rates we support into our Operational Rate set |
| 3416 | // (including the basic rates, which we have already verified are |
| 3417 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3418 | // However, it turns out that this is not always the case. Some AP's |
| 3419 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3420 | // too. Now, we're a little more careful: |
| 3421 | pDstRate = pOpRateSet->rate; |
| 3422 | if(pIes->SuppRates.present) |
| 3423 | { |
| 3424 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3425 | { |
| 3426 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) ) |
| 3427 | { |
| 3428 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 3429 | pOpRateSet->numRates++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3430 | } |
| 3431 | } |
| 3432 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3433 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3434 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3435 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3436 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3437 | { |
| 3438 | // If there are Extended Rates in the beacon, we will reflect those |
| 3439 | // extended rates that we support in out Extended Operational Rate |
| 3440 | // set: |
| 3441 | pDstRate = pExRateSet->rate; |
| 3442 | if(pIes->ExtSuppRates.present) |
| 3443 | { |
| 3444 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3445 | { |
| 3446 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) ) |
| 3447 | { |
| 3448 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3449 | pExRateSet->numRates++; |
| 3450 | } |
| 3451 | } |
| 3452 | } |
| 3453 | } |
| 3454 | }//Parsing BSSDesc |
| 3455 | else |
| 3456 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3457 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3458 | } |
| 3459 | if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0) status = eHAL_STATUS_SUCCESS; |
| 3460 | return status; |
| 3461 | } |
| 3462 | |
| 3463 | static void csrSetCfgRateSet( tpAniSirGlobal pMac, eCsrPhyMode phyMode, tCsrRoamProfile *pProfile, |
| 3464 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3465 | { |
| 3466 | int i; |
| 3467 | tANI_U8 *pDstRate; |
| 3468 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3469 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3470 | tANI_U32 OperationalRatesLength = 0; |
| 3471 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3472 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3473 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3474 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3475 | tANI_U32 PropRatesEnable = 0; |
| 3476 | tANI_U8 MCSRateIdxSet[ SIZE_OF_SUPPORTED_MCS_SET ]; |
| 3477 | tANI_U32 MCSRateLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3478 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3479 | if( NULL != pIes ) |
| 3480 | { |
| 3481 | csrIsPhyModeMatch( pMac, phyMode, pBssDesc, pProfile, &cfgDot11Mode, pIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3482 | // Originally, we thought that for 11a networks, the 11a rates are always |
| 3483 | // in the Operational Rate set & for 11b and 11g networks, the 11b rates |
| 3484 | // appear in the Operational Rate set. Consequently, in either case, we |
| 3485 | // would blindly put the rates we support into our Operational Rate set |
| 3486 | // (including the basic rates, which we have already verified are |
| 3487 | // supported earlier in the roaming decision). |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3488 | // However, it turns out that this is not always the case. Some AP's |
| 3489 | // (e.g. D-Link DI-784) ram 11g rates into the Operational Rate set, |
| 3490 | // too. Now, we're a little more careful: |
| 3491 | pDstRate = OperationalRates; |
| 3492 | if(pIes->SuppRates.present) |
| 3493 | { |
| 3494 | for ( i = 0; i < pIes->SuppRates.num_rates; i++ ) |
| 3495 | { |
| 3496 | if ( csrRatesIsDot11RateSupported( pMac, pIes->SuppRates.rates[ i ] ) && |
| 3497 | ( OperationalRatesLength < CSR_DOT11_SUPPORTED_RATES_MAX )) |
| 3498 | { |
| 3499 | *pDstRate++ = pIes->SuppRates.rates[ i ]; |
| 3500 | OperationalRatesLength++; |
| 3501 | } |
| 3502 | } |
| 3503 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3504 | if ( eCSR_CFG_DOT11_MODE_11G == cfgDot11Mode || |
| 3505 | eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode || |
| 3506 | eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode || |
| 3507 | eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 3508 | { |
| 3509 | // If there are Extended Rates in the beacon, we will reflect those |
| 3510 | // extended rates that we support in out Extended Operational Rate |
| 3511 | // set: |
| 3512 | pDstRate = ExtendedOperationalRates; |
| 3513 | if(pIes->ExtSuppRates.present) |
| 3514 | { |
| 3515 | for ( i = 0; i < pIes->ExtSuppRates.num_rates; i++ ) |
| 3516 | { |
| 3517 | if ( csrRatesIsDot11RateSupported( pMac, pIes->ExtSuppRates.rates[ i ] ) && |
| 3518 | ( ExtendedOperationalRatesLength < CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX )) |
| 3519 | { |
| 3520 | *pDstRate++ = pIes->ExtSuppRates.rates[ i ]; |
| 3521 | ExtendedOperationalRatesLength++; |
| 3522 | } |
| 3523 | } |
| 3524 | } |
| 3525 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3526 | // Enable proprietary MAC features if peer node is Airgo node and STA |
| 3527 | // user wants to use them |
| 3528 | if( pIes->Airgo.present && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3529 | { |
| 3530 | PropRatesEnable = 1; |
| 3531 | } |
| 3532 | else |
| 3533 | { |
| 3534 | PropRatesEnable = 0; |
| 3535 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3536 | // For ANI network companions, we need to populate the proprietary rate |
| 3537 | // set with any proprietary rates we found in the beacon, only if user |
| 3538 | // allows them... |
| 3539 | if ( PropRatesEnable && pIes->Airgo.PropSuppRates.present && |
| 3540 | ( pIes->Airgo.PropSuppRates.num_rates > 0 )) |
| 3541 | { |
| 3542 | ProprietaryOperationalRatesLength = pIes->Airgo.PropSuppRates.num_rates; |
| 3543 | if ( ProprietaryOperationalRatesLength > sizeof(ProprietaryOperationalRates) ) |
| 3544 | { |
| 3545 | ProprietaryOperationalRatesLength = sizeof (ProprietaryOperationalRates); |
| 3546 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3547 | vos_mem_copy(ProprietaryOperationalRates, |
| 3548 | pIes->Airgo.PropSuppRates.rates, |
| 3549 | ProprietaryOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3550 | } |
| 3551 | else { |
| 3552 | // No proprietary modes... |
| 3553 | ProprietaryOperationalRatesLength = 0; |
| 3554 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3555 | /* Get MCS Rate */ |
| 3556 | pDstRate = MCSRateIdxSet; |
| 3557 | if ( pIes->HTCaps.present ) |
| 3558 | { |
| 3559 | for ( i = 0; i < VALID_MAX_MCS_INDEX; i++ ) |
| 3560 | { |
| 3561 | if ( (unsigned int)pIes->HTCaps.supportedMCSSet[0] & (1 << i) ) |
| 3562 | { |
| 3563 | MCSRateLength++; |
| 3564 | *pDstRate++ = i; |
| 3565 | } |
| 3566 | } |
| 3567 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3568 | // Set the operational rate set CFG variables... |
| 3569 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3570 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3571 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3572 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3573 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3574 | ProprietaryOperationalRates, |
| 3575 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3576 | ccmCfgSetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, PropRatesEnable, NULL, eANI_BOOLEAN_FALSE); |
| 3577 | ccmCfgSetStr(pMac, WNI_CFG_CURRENT_MCS_SET, MCSRateIdxSet, |
| 3578 | MCSRateLength, NULL, eANI_BOOLEAN_FALSE); |
| 3579 | }//Parsing BSSDesc |
| 3580 | else |
| 3581 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3582 | smsLog(pMac, LOGE, FL("failed to parse BssDesc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3583 | } |
| 3584 | } |
| 3585 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3586 | static void csrSetCfgRateSetFromProfile( tpAniSirGlobal pMac, |
| 3587 | tCsrRoamProfile *pProfile ) |
| 3588 | { |
| 3589 | tSirMacRateSetIE DefaultSupportedRates11a = { SIR_MAC_RATESET_EID, |
| 3590 | { 8, |
| 3591 | { SIR_MAC_RATE_6, |
| 3592 | SIR_MAC_RATE_9, |
| 3593 | SIR_MAC_RATE_12, |
| 3594 | SIR_MAC_RATE_18, |
| 3595 | SIR_MAC_RATE_24, |
| 3596 | SIR_MAC_RATE_36, |
| 3597 | SIR_MAC_RATE_48, |
| 3598 | SIR_MAC_RATE_54 } } }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3599 | tSirMacRateSetIE DefaultSupportedRates11b = { SIR_MAC_RATESET_EID, |
| 3600 | { 4, |
| 3601 | { SIR_MAC_RATE_1, |
| 3602 | SIR_MAC_RATE_2, |
| 3603 | SIR_MAC_RATE_5_5, |
| 3604 | SIR_MAC_RATE_11 } } }; |
| 3605 | |
| 3606 | |
| 3607 | tSirMacPropRateSet DefaultSupportedPropRates = { 3, |
| 3608 | { SIR_MAC_RATE_72, |
| 3609 | SIR_MAC_RATE_96, |
| 3610 | SIR_MAC_RATE_108 } }; |
| 3611 | eCsrCfgDot11Mode cfgDot11Mode; |
| 3612 | eCsrBand eBand; |
| 3613 | tANI_U8 OperationalRates[ CSR_DOT11_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3614 | tANI_U32 OperationalRatesLength = 0; |
| 3615 | tANI_U8 ExtendedOperationalRates[ CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX ]; // leave enough room for the max number of rates |
| 3616 | tANI_U32 ExtendedOperationalRatesLength = 0; |
| 3617 | tANI_U8 ProprietaryOperationalRates[ 4 ]; // leave enough room for the max number of proprietary rates |
| 3618 | tANI_U32 ProprietaryOperationalRatesLength = 0; |
| 3619 | tANI_U32 PropRatesEnable = 0; |
| 3620 | tANI_U8 operationChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3621 | if(pProfile->ChannelInfo.ChannelList) |
| 3622 | { |
| 3623 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 3624 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3625 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3626 | // For 11a networks, the 11a rates go into the Operational Rate set. For 11b and 11g |
| 3627 | // networks, the 11b rates appear in the Operational Rate set. In either case, |
| 3628 | // we can blindly put the rates we support into our Operational Rate set |
| 3629 | // (including the basic rates, which we have already verified are supported |
| 3630 | // earlier in the roaming decision). |
| 3631 | if ( eCSR_BAND_5G == eBand ) |
| 3632 | { |
| 3633 | // 11a rates into the Operational Rate Set. |
| 3634 | OperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3635 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3636 | vos_mem_copy(OperationalRates, |
| 3637 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3638 | OperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3639 | |
| 3640 | // Nothing in the Extended rate set. |
| 3641 | ExtendedOperationalRatesLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3642 | // populate proprietary rates if user allows them |
| 3643 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3644 | { |
| 3645 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3646 | sizeof(*DefaultSupportedPropRates.propRate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3647 | vos_mem_copy(ProprietaryOperationalRates, |
| 3648 | DefaultSupportedPropRates.propRate, |
| 3649 | ProprietaryOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3650 | } |
| 3651 | else |
| 3652 | { |
| 3653 | // No proprietary modes |
| 3654 | ProprietaryOperationalRatesLength = 0; |
| 3655 | } |
| 3656 | } |
| 3657 | else if ( eCSR_CFG_DOT11_MODE_11B == cfgDot11Mode ) |
| 3658 | { |
| 3659 | // 11b rates into the Operational Rate Set. |
| 3660 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3661 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3662 | vos_mem_copy(OperationalRates, |
| 3663 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3664 | OperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3665 | // Nothing in the Extended rate set. |
| 3666 | ExtendedOperationalRatesLength = 0; |
| 3667 | // No proprietary modes |
| 3668 | ProprietaryOperationalRatesLength = 0; |
| 3669 | } |
| 3670 | else |
| 3671 | { |
| 3672 | // 11G |
| 3673 | |
| 3674 | // 11b rates into the Operational Rate Set. |
| 3675 | OperationalRatesLength = DefaultSupportedRates11b.supportedRateSet.numRates * |
| 3676 | sizeof(*DefaultSupportedRates11b.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3677 | vos_mem_copy(OperationalRates, |
| 3678 | DefaultSupportedRates11b.supportedRateSet.rate, |
| 3679 | OperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3680 | |
| 3681 | // 11a rates go in the Extended rate set. |
| 3682 | ExtendedOperationalRatesLength = DefaultSupportedRates11a.supportedRateSet.numRates * |
| 3683 | sizeof(*DefaultSupportedRates11a.supportedRateSet.rate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3684 | vos_mem_copy(ExtendedOperationalRates, |
| 3685 | DefaultSupportedRates11a.supportedRateSet.rate, |
| 3686 | ExtendedOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3687 | |
| 3688 | // populate proprietary rates if user allows them |
| 3689 | if ( pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3690 | { |
| 3691 | ProprietaryOperationalRatesLength = DefaultSupportedPropRates.numPropRates * |
| 3692 | sizeof(*DefaultSupportedPropRates.propRate); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3693 | vos_mem_copy(ProprietaryOperationalRates, |
| 3694 | DefaultSupportedPropRates.propRate, |
| 3695 | ProprietaryOperationalRatesLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3696 | } |
| 3697 | else |
| 3698 | { |
| 3699 | // No proprietary modes |
| 3700 | ProprietaryOperationalRatesLength = 0; |
| 3701 | } |
| 3702 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3703 | // set this to 1 if prop. rates need to be advertised in to the IBSS beacon and user wants to use them |
| 3704 | if ( ProprietaryOperationalRatesLength && pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 3705 | { |
| 3706 | PropRatesEnable = 1; |
| 3707 | } |
| 3708 | else |
| 3709 | { |
| 3710 | PropRatesEnable = 0; |
| 3711 | } |
| 3712 | |
| 3713 | // Set the operational rate set CFG variables... |
| 3714 | ccmCfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, OperationalRates, |
| 3715 | OperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3716 | ccmCfgSetStr(pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, ExtendedOperationalRates, |
| 3717 | ExtendedOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3718 | ccmCfgSetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, |
| 3719 | ProprietaryOperationalRates, |
| 3720 | ProprietaryOperationalRatesLength, NULL, eANI_BOOLEAN_FALSE); |
| 3721 | 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] | 3722 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3723 | void csrRoamCcmCfgSetCallback(tHalHandle hHal, tANI_S32 result) |
| 3724 | { |
| 3725 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3726 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3727 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 3728 | tANI_U32 sessionId; |
| 3729 | tSmeCmd *pCommand = NULL; |
| 3730 | |
| 3731 | if(NULL == pEntry) |
| 3732 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3733 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3734 | return; |
| 3735 | } |
| 3736 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 3737 | sessionId = pCommand->sessionId; |
| 3738 | |
| 3739 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 3740 | { |
| 3741 | csrRoamingStateConfigCnfProcessor(pMac, (tANI_U32)result); |
| 3742 | } |
| 3743 | } |
| 3744 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3745 | //This function is very dump. It is here because PE still need WNI_CFG_PHY_MODE |
| 3746 | tANI_U32 csrRoamGetPhyModeFromDot11Mode(eCsrCfgDot11Mode dot11Mode, eCsrBand band) |
| 3747 | { |
| 3748 | if(eCSR_CFG_DOT11_MODE_11B == dot11Mode) |
| 3749 | { |
| 3750 | return (WNI_CFG_PHY_MODE_11B); |
| 3751 | } |
| 3752 | else |
| 3753 | { |
| 3754 | if(eCSR_BAND_24 == band) |
| 3755 | return (WNI_CFG_PHY_MODE_11G); |
| 3756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3757 | return (WNI_CFG_PHY_MODE_11A); |
| 3758 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3759 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3760 | |
| 3761 | #ifdef WLAN_FEATURE_11AC |
| 3762 | ePhyChanBondState csrGetHTCBStateFromVHTCBState(ePhyChanBondState aniCBMode) |
| 3763 | { |
| 3764 | switch ( aniCBMode ) |
| 3765 | { |
| 3766 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 3767 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 3768 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
| 3769 | return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
| 3770 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 3771 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 3772 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
| 3773 | return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
| 3774 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3775 | default : |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3776 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 3777 | } |
| 3778 | } |
| 3779 | #endif |
| 3780 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3781 | //pIes may be NULL |
| 3782 | eHalStatus csrRoamSetBssConfigCfg(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3783 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3784 | tDot11fBeaconIEs *pIes, tANI_BOOLEAN resetCountry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3785 | { |
| 3786 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3787 | tANI_U32 cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3788 | tANI_U8 channel = 0; |
| 3789 | //Make sure we have the domain info for the BSS we try to connect to. |
| 3790 | //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] | 3791 | if (pBssDesc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3792 | { |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3793 | if (csrLearnCountryInformation(pMac, pBssDesc, pIes, eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3794 | { |
| 3795 | //Make sure the 11d info from this BSSDesc can be applied |
| 3796 | pMac->scan.fAmbiguous11dInfoFound = eANI_BOOLEAN_FALSE; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3797 | if (VOS_TRUE == resetCountry) |
| 3798 | { |
| 3799 | csrApplyCountryInformation(pMac, FALSE); |
| 3800 | } |
| 3801 | else |
| 3802 | { |
| 3803 | csrApplyCountryInformation(pMac, TRUE); |
| 3804 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3805 | } |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 3806 | if ((csrIs11dSupported (pMac)) && pIes) |
| 3807 | { |
| 3808 | if (!pIes->Country.present) |
| 3809 | csrResetCountryInformation(pMac, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE ); |
| 3810 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3811 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3812 | //Qos |
| 3813 | csrSetQosToCfg( pMac, sessionId, pBssConfig->qosType ); |
| 3814 | //SSID |
| 3815 | csrSetCfgSsid(pMac, &pBssConfig->SSID ); |
| 3816 | //fragment threshold |
| 3817 | //ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3818 | //RTS threshold |
| 3819 | //ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE); |
| 3820 | |
| 3821 | //ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, csrTranslateToWNICfgDot11Mode(pMac, pBssConfig->uCfgDot11Mode), NULL, eANI_BOOLEAN_FALSE); |
| 3822 | |
| 3823 | //Auth type |
| 3824 | ccmCfgSetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE, pBssConfig->authType, NULL, eANI_BOOLEAN_FALSE); |
| 3825 | //encryption type |
| 3826 | csrSetCfgPrivacy(pMac, pProfile, (tANI_BOOLEAN)pBssConfig->BssCap.privacy ); |
| 3827 | //short slot time |
| 3828 | 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] | 3829 | //11d |
| 3830 | ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED, |
| 3831 | ((pBssConfig->f11hSupport) ? pBssConfig->f11hSupport : pProfile->ieee80211d), |
| 3832 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3833 | /*//11h |
| 3834 | ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE); |
| 3835 | */ |
| 3836 | ccmCfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, pBssConfig->uPowerLimit, NULL, eANI_BOOLEAN_FALSE); |
| 3837 | //CB |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3838 | |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 3839 | 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] | 3840 | { |
| 3841 | channel = pProfile->operationChannel; |
| 3842 | } |
| 3843 | else |
| 3844 | { |
| 3845 | if(pBssDesc) |
| 3846 | { |
| 3847 | channel = pBssDesc->channelId; |
| 3848 | } |
| 3849 | } |
| 3850 | if(0 != channel) |
| 3851 | { |
| 3852 | if(CSR_IS_CHANNEL_24GHZ(channel)) |
| 3853 | {//for now if we are on 2.4 Ghz, CB will be always disabled |
| 3854 | cfgCb = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; |
| 3855 | } |
| 3856 | else |
| 3857 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3858 | cfgCb = pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3859 | } |
| 3860 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3861 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | a0d8893 | 2012-11-13 10:51:26 -0800 | [diff] [blame] | 3862 | // cbMode = 1 in cfg.ini is mapped to PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3 |
| 3863 | // in function csrConvertCBIniValueToPhyCBState() |
| 3864 | // So, max value for cbMode in 40MHz mode is 3 (MAC\src\include\sirParams.h) |
| 3865 | if(cfgCb > PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3866 | { |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3867 | if(!WDA_getFwWlanFeatCaps(DOT11AC)) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3868 | cfgCb = csrGetHTCBStateFromVHTCBState(cfgCb); |
Madan Mohan Koyyalamudi | 2c112c5 | 2012-10-30 17:59:49 -0700 | [diff] [blame] | 3869 | } |
| 3870 | else |
| 3871 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3872 | 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] | 3873 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3874 | } |
| 3875 | else |
| 3876 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3877 | ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, cfgCb, NULL, eANI_BOOLEAN_FALSE); |
| 3878 | //Rate |
| 3879 | //Fixed Rate |
| 3880 | if(pBssDesc) |
| 3881 | { |
| 3882 | csrSetCfgRateSet(pMac, (eCsrPhyMode)pProfile->phyMode, pProfile, pBssDesc, pIes); |
| 3883 | } |
| 3884 | else |
| 3885 | { |
| 3886 | csrSetCfgRateSetFromProfile(pMac, pProfile); |
| 3887 | } |
| 3888 | //Make this the last CFG to set. The callback will trigger a join_req |
| 3889 | //Join time out |
| 3890 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_CONFIG, sessionId ); |
| 3891 | |
| 3892 | 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] | 3893 | return (status); |
| 3894 | } |
| 3895 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3896 | eHalStatus csrRoamStopNetwork( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3897 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 3898 | { |
| 3899 | eHalStatus status; |
| 3900 | tBssConfigParam *pBssConfig; |
| 3901 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3902 | |
| 3903 | if(!pSession) |
| 3904 | { |
| 3905 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3906 | return eHAL_STATUS_FAILURE; |
| 3907 | } |
| 3908 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3909 | pBssConfig = vos_mem_malloc(sizeof(tBssConfigParam)); |
| 3910 | if ( NULL == pBssConfig ) |
| 3911 | status = eHAL_STATUS_FAILURE; |
| 3912 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3913 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3914 | vos_mem_set(pBssConfig, sizeof(tBssConfigParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3915 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, pBssConfig, pIes); |
| 3916 | if(HAL_STATUS_SUCCESS(status)) |
| 3917 | { |
| 3918 | pSession->bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3919 | /* This will allow to pass cbMode during join req */ |
| 3920 | pSession->bssParams.cbMode= pBssConfig->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3921 | //For IBSS, we need to prepare some more information |
| 3922 | if( csrIsBssTypeIBSS(pProfile->BSSType) || CSR_IS_WDS( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3923 | || CSR_IS_INFRA_AP(pProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3924 | ) |
| 3925 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3926 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, pBssDesc, pBssConfig, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3927 | } |
| 3928 | // If we are in an IBSS, then stop the IBSS... |
| 3929 | ////Not worry about WDS connection for now |
| 3930 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 3931 | { |
| 3932 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 3933 | } |
| 3934 | else |
| 3935 | { |
| 3936 | // if we are in an Infrastructure association.... |
| 3937 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 3938 | { |
| 3939 | // and the new Bss is an Ibss OR we are roaming from Infra to Infra |
| 3940 | // across SSIDs (roaming to a new SSID)... // |
| 3941 | //Not worry about WDS connection for now |
| 3942 | if ( pBssDesc && ( ( csrIsIbssBssDesc( pBssDesc ) ) || |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3943 | !csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIes ) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3944 | { |
| 3945 | // then we need to disassociate from the Infrastructure network... |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3946 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 3947 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3948 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3949 | else |
| 3950 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3951 | // In an Infrastucture and going to an Infrastructure network with the same SSID. This |
| 3952 | // 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] | 3953 | if ( pBssDesc ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3954 | { |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3955 | // Set parameters for this Bss. |
| 3956 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 3957 | pBssDesc, pBssConfig, |
| 3958 | pIes, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3959 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3960 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3961 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3962 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3963 | { |
| 3964 | // Neiher in IBSS nor in Infra. We can go ahead and set the CFG for tne new network... |
| 3965 | // Nothing to stop. |
| 3966 | if ( pBssDesc || CSR_IS_WDS_AP( pProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3967 | || CSR_IS_INFRA_AP(pProfile) |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 3968 | ) |
| 3969 | { |
| 3970 | tANI_BOOLEAN is11rRoamingFlag = eANI_BOOLEAN_FALSE; |
| 3971 | is11rRoamingFlag = csrRoamIs11rAssoc(pMac); |
| 3972 | // Set parameters for this Bss. |
| 3973 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 3974 | pBssDesc, pBssConfig, |
| 3975 | pIes, is11rRoamingFlag); |
| 3976 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3977 | } |
| 3978 | } |
| 3979 | }//Success getting BSS config info |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 3980 | vos_mem_free(pBssConfig); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3981 | }//Allocate memory |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3982 | return (status); |
| 3983 | } |
| 3984 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3985 | eCsrJoinState csrRoamJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 3986 | tCsrScanResultInfo *pScanResult, tCsrRoamProfile *pProfile ) |
| 3987 | { |
| 3988 | eCsrJoinState eRoamState = eCsrContinueRoaming; |
| 3989 | eHalStatus status; |
| 3990 | tSirBssDescription *pBssDesc = &pScanResult->BssDescriptor; |
| 3991 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)( pScanResult->pvIes ); //This may be NULL |
| 3992 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3993 | |
| 3994 | if(!pSession) |
| 3995 | { |
| 3996 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3997 | return (eCsrStopRoaming); |
| 3998 | } |
| 3999 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4000 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 4001 | { |
| 4002 | status = csrRoamStartWds( pMac, sessionId, pProfile, pBssDesc ); |
| 4003 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 4004 | { |
| 4005 | eRoamState = eCsrStopRoaming; |
| 4006 | } |
| 4007 | } |
| 4008 | else |
| 4009 | { |
| 4010 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 4011 | { |
| 4012 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
| 4013 | return (eCsrStopRoaming); |
| 4014 | } |
| 4015 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 4016 | { |
| 4017 | // If we are connected in infrastructure mode and the Join Bss description is for the same BssID, then we are |
| 4018 | // attempting to join the AP we are already connected with. In that case, see if the Bss or Sta capabilities |
| 4019 | // have changed and handle the changes (without disturbing the current association). |
| 4020 | |
| 4021 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && |
| 4022 | csrIsBssIdEqual( pMac, pBssDesc, pSession->pConnectBssDesc ) && |
| 4023 | csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, pIesLocal ) |
| 4024 | ) |
| 4025 | { |
| 4026 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 4027 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 4028 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 4029 | // a new Association. |
| 4030 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 4031 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4032 | smsLog(pMac, LOGW, FL(" detect same profile authType = %d encryType = %d"), pProfile->AuthType, pProfile->EncryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4033 | if(csrRoamIsSameProfileKeys(pMac, &pSession->connectedProfile, pProfile)) |
| 4034 | { |
| 4035 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 4036 | } |
| 4037 | else |
| 4038 | { |
| 4039 | tBssConfigParam bssConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4040 | //The key changes |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4041 | vos_mem_set(&bssConfig, sizeof(bssConfig), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4042 | status = csrRoamPrepareBssConfig(pMac, pProfile, pBssDesc, &bssConfig, pIesLocal); |
| 4043 | if(HAL_STATUS_SUCCESS(status)) |
| 4044 | { |
| 4045 | pSession->bssParams.uCfgDot11Mode = bssConfig.uCfgDot11Mode; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4046 | pSession->bssParams.cbMode = bssConfig.cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4047 | //Reapply the config including Keys so reassoc is happening. |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4048 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 4049 | pBssDesc, &bssConfig, |
| 4050 | pIesLocal, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4051 | if(!HAL_STATUS_SUCCESS(status)) |
| 4052 | { |
| 4053 | eRoamState = eCsrStopRoaming; |
| 4054 | } |
| 4055 | } |
| 4056 | else |
| 4057 | { |
| 4058 | eRoamState = eCsrStopRoaming; |
| 4059 | } |
| 4060 | }//same profile |
| 4061 | } |
| 4062 | else |
| 4063 | { |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4064 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, sessionId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4065 | eCSR_ROAM_SUBSTATE_DISASSOC_REQ, FALSE ))) |
| 4066 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4067 | smsLog(pMac, LOGW, FL(" fail to issue disassociate")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4068 | eRoamState = eCsrStopRoaming; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4069 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4070 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4071 | } |
| 4072 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4073 | { |
| 4074 | // note: we used to pre-auth here with open authentication networks but that was not working so well. |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4075 | // we had a lot of join timeouts when testing at Samsung. removing this step helped associations |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4076 | // work much better. |
| 4077 | // |
| 4078 | // |
| 4079 | // stop the existing network before attempting to join the new network... |
| 4080 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 4081 | { |
| 4082 | eRoamState = eCsrStopRoaming; |
| 4083 | } |
| 4084 | } |
| 4085 | }//Infra |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 4086 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4087 | { |
| 4088 | if(!HAL_STATUS_SUCCESS(csrRoamStopNetwork(pMac, sessionId, pProfile, pBssDesc, pIesLocal))) |
| 4089 | { |
| 4090 | eRoamState = eCsrStopRoaming; |
| 4091 | } |
| 4092 | } |
| 4093 | if( pIesLocal && !pScanResult->pvIes ) |
| 4094 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4095 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4096 | } |
| 4097 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4098 | return( eRoamState ); |
| 4099 | } |
| 4100 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4101 | eHalStatus csrRoamShouldRoam(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 4102 | tSirBssDescription *pBssDesc, tANI_U32 roamId) |
| 4103 | { |
| 4104 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4105 | tCsrRoamInfo roamInfo; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4106 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4107 | roamInfo.pBssDesc = pBssDesc; |
| 4108 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, roamId, eCSR_ROAM_SHOULD_ROAM, eCSR_ROAM_RESULT_NONE); |
| 4109 | return (status); |
| 4110 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4111 | //In case no matching BSS is found, use whatever default we can find |
| 4112 | static void csrRoamAssignDefaultParam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4113 | { |
| 4114 | //Need to get all negotiated types in place first |
| 4115 | //auth type |
Jeff Johnson | feddb2d | 2012-12-10 14:41:22 -0800 | [diff] [blame] | 4116 | 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] | 4117 | { |
| 4118 | default: |
| 4119 | case eCSR_AUTH_TYPE_WPA: |
| 4120 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 4121 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 4122 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 4123 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4124 | break; |
| 4125 | |
| 4126 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 4127 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 4128 | break; |
| 4129 | |
| 4130 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 4131 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 4132 | break; |
| 4133 | } |
| 4134 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = |
| 4135 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 4136 | //In this case, the multicast encryption needs to follow the uncast ones. |
| 4137 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = |
| 4138 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0]; |
| 4139 | } |
| 4140 | |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4141 | |
| 4142 | static void csrSetAbortRoamingCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4143 | { |
| 4144 | switch(pCommand->u.roamCmd.roamReason) |
| 4145 | { |
| 4146 | case eCsrLostLink1: |
| 4147 | pCommand->u.roamCmd.roamReason = eCsrLostLink1Abort; |
| 4148 | break; |
| 4149 | case eCsrLostLink2: |
| 4150 | pCommand->u.roamCmd.roamReason = eCsrLostLink2Abort; |
| 4151 | break; |
| 4152 | case eCsrLostLink3: |
| 4153 | pCommand->u.roamCmd.roamReason = eCsrLostLink3Abort; |
| 4154 | break; |
| 4155 | default: |
| 4156 | smsLog(pMac, LOGE, FL(" aborting roaming reason %d not recognized"), |
| 4157 | pCommand->u.roamCmd.roamReason); |
| 4158 | break; |
| 4159 | } |
| 4160 | } |
| 4161 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4162 | static eCsrJoinState csrRoamJoinNextBss( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fUseSameBss ) |
| 4163 | { |
| 4164 | eHalStatus status; |
| 4165 | tCsrScanResult *pScanResult = NULL; |
| 4166 | eCsrJoinState eRoamState = eCsrStopRoaming; |
| 4167 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 4168 | tANI_BOOLEAN fDone = eANI_BOOLEAN_FALSE; |
| 4169 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 4170 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 4171 | v_U8_t acm_mask = 0; |
| 4172 | #endif |
| 4173 | tANI_U32 sessionId = pCommand->sessionId; |
| 4174 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4175 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4176 | tANI_U8 concurrentChannel = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4177 | |
| 4178 | if(!pSession) |
| 4179 | { |
| 4180 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4181 | return (eCsrStopRoaming); |
| 4182 | } |
| 4183 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4184 | do |
| 4185 | { |
| 4186 | // Check for Cardbus eject condition, before trying to Roam to any BSS |
| 4187 | //***if( !balIsCardPresent(pAdapter) ) break; |
| 4188 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4189 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 4190 | memcpy (&roamInfo.bssid, &pSession->joinFailStatusCode.bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4191 | if(NULL != pBSSList) |
| 4192 | { |
| 4193 | // When handling AP's capability change, continue to associate to |
| 4194 | // same BSS and make sure pRoamBssEntry is not Null. |
| 4195 | if((eANI_BOOLEAN_FALSE == fUseSameBss) || (pCommand->u.roamCmd.pRoamBssEntry == NULL)) |
| 4196 | { |
| 4197 | if(pCommand->u.roamCmd.pRoamBssEntry == NULL) |
| 4198 | { |
| 4199 | //Try the first BSS |
| 4200 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4201 | pCommand->u.roamCmd.pRoamBssEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 4202 | } |
| 4203 | else |
| 4204 | { |
| 4205 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4206 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4207 | { |
| 4208 | //Done with all the BSSs |
| 4209 | //In this case, will tell HDD the completion |
| 4210 | break; |
| 4211 | } |
| 4212 | else |
| 4213 | { |
| 4214 | //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] | 4215 | //vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4216 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; //this shall not be NULL |
| 4217 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 4218 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 4219 | pRoamInfo = &roamInfo; |
| 4220 | } |
| 4221 | } |
| 4222 | while(pCommand->u.roamCmd.pRoamBssEntry) |
| 4223 | { |
| 4224 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4225 | /*If concurrency enabled take the concurrent connected channel first. */ |
| 4226 | /* Valid multichannel concurrent sessions exempted */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4227 | if (vos_concurrent_sessions_running() && |
| 4228 | !csrIsValidMcConcurrentSession(pMac, sessionId, &pScanResult->Result.BssDescriptor)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4229 | { |
| 4230 | concurrentChannel = |
| 4231 | csrGetConcurrentOperationChannel(pMac); |
| 4232 | 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] | 4233 | " csr Concurrent Channel = %d", __func__, concurrentChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4234 | if ((concurrentChannel) && |
| 4235 | (concurrentChannel == |
| 4236 | pScanResult->Result.BssDescriptor.channelId)) |
| 4237 | { |
| 4238 | //make this 0 because we do not want the |
| 4239 | //below check to pass as we don't want to |
| 4240 | //connect on other channel |
| 4241 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 4242 | FL("Concurrent channel match =%d"), |
| 4243 | concurrentChannel); |
| 4244 | concurrentChannel = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4245 | } |
| 4246 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4247 | |
| 4248 | if (!concurrentChannel) |
| 4249 | { |
| 4250 | |
| 4251 | if(HAL_STATUS_SUCCESS(csrRoamShouldRoam(pMac, |
| 4252 | sessionId, &pScanResult->Result.BssDescriptor, |
| 4253 | pCommand->u.roamCmd.roamId))) |
| 4254 | { |
| 4255 | //Ok to roam this |
| 4256 | break; |
| 4257 | } |
| 4258 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4259 | else |
| 4260 | { |
| 4261 | eRoamState = eCsrStopRoamingDueToConcurrency; |
| 4262 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4263 | pCommand->u.roamCmd.pRoamBssEntry = csrLLNext(&pBSSList->List, pCommand->u.roamCmd.pRoamBssEntry, LL_ACCESS_LOCK); |
| 4264 | if(NULL == pCommand->u.roamCmd.pRoamBssEntry) |
| 4265 | { |
| 4266 | //Done with all the BSSs |
| 4267 | fDone = eANI_BOOLEAN_TRUE; |
| 4268 | break; |
| 4269 | } |
| 4270 | } |
| 4271 | if(fDone) |
| 4272 | { |
| 4273 | break; |
| 4274 | } |
| 4275 | } |
| 4276 | } |
| 4277 | //We have something to roam, tell HDD when it is infra. |
| 4278 | //For IBSS, the indication goes back to HDD via eCSR_ROAM_IBSS_IND |
| 4279 | //For WDS, the indication is eCSR_ROAM_WDS_IND |
| 4280 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 4281 | { |
| 4282 | if(pRoamInfo) |
| 4283 | { |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4284 | if(pSession->bRefAssocStartCnt) |
| 4285 | { |
| 4286 | pSession->bRefAssocStartCnt--; |
| 4287 | //Complete the last association attemp because a new one is about to be tried |
| 4288 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4289 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4290 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 4291 | } |
| 4292 | } |
| 4293 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 4294 | if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 4295 | { |
| 4296 | //No need to complete roaming here as it already completes |
| 4297 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed"), |
| 4298 | pCommand->u.roamCmd.roamReason); |
| 4299 | eRoamState = eCsrStopRoaming; |
| 4300 | csrSetAbortRoamingCommand(pMac, pCommand); |
| 4301 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4302 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4303 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4304 | if(pScanResult) |
| 4305 | { |
| 4306 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4307 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, &pScanResult->Result.BssDescriptor, &pIesLocal))) ) |
| 4308 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4309 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4310 | fDone = eANI_BOOLEAN_TRUE; |
| 4311 | eRoamState = eCsrStopRoaming; |
| 4312 | break; |
| 4313 | } |
| 4314 | roamInfo.pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4315 | pCommand->u.roamCmd.pLastRoamBss = roamInfo.pBssDesc; |
| 4316 | //No need to put uapsd_mask in if the BSS doesn't support uAPSD |
| 4317 | if( pCommand->u.roamCmd.roamProfile.uapsd_mask && |
| 4318 | CSR_IS_QOS_BSS(pIesLocal) && |
| 4319 | CSR_IS_UAPSD_BSS(pIesLocal) ) |
| 4320 | { |
| 4321 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4322 | acm_mask = sme_QosGetACMMask(pMac, &pScanResult->Result.BssDescriptor, |
| 4323 | pIesLocal); |
| 4324 | pCommand->u.roamCmd.roamProfile.uapsd_mask &= ~(acm_mask); |
| 4325 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4326 | } |
| 4327 | else |
| 4328 | { |
| 4329 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4330 | } |
| 4331 | if( pIesLocal && !pScanResult->Result.pvIes) |
| 4332 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4333 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4334 | } |
| 4335 | } |
| 4336 | else |
| 4337 | { |
| 4338 | pCommand->u.roamCmd.roamProfile.uapsd_mask = 0; |
| 4339 | } |
| 4340 | roamInfo.pProfile = pProfile; |
| 4341 | pSession->bRefAssocStartCnt++; |
| 4342 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4343 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4344 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4345 | if ( NULL == pCommand->u.roamCmd.pRoamBssEntry ) |
| 4346 | { |
| 4347 | // If this is a start IBSS profile, then we need to start the IBSS. |
| 4348 | if ( CSR_IS_START_IBSS(pProfile) ) |
| 4349 | { |
| 4350 | tANI_BOOLEAN fSameIbss = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4351 | // Attempt to start this IBSS... |
| 4352 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4353 | status = csrRoamStartIbss( pMac, sessionId, pProfile, &fSameIbss ); |
| 4354 | if(HAL_STATUS_SUCCESS(status)) |
| 4355 | { |
| 4356 | if ( fSameIbss ) |
| 4357 | { |
| 4358 | eRoamState = eCsrStartIbssSameIbss; |
| 4359 | } |
| 4360 | else |
| 4361 | { |
| 4362 | eRoamState = eCsrContinueRoaming; |
| 4363 | } |
| 4364 | } |
| 4365 | else |
| 4366 | { |
| 4367 | //it somehow fail need to stop |
| 4368 | eRoamState = eCsrStopRoaming; |
| 4369 | } |
| 4370 | break; |
| 4371 | } |
| 4372 | else if ( (CSR_IS_WDS_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4373 | || (CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4374 | ) |
| 4375 | { |
| 4376 | // Attempt to start this WDS... |
| 4377 | csrRoamAssignDefaultParam( pMac, pCommand ); |
| 4378 | /* For AP WDS, we dont have any BSSDescription */ |
| 4379 | status = csrRoamStartWds( pMac, sessionId, pProfile, NULL ); |
| 4380 | if(HAL_STATUS_SUCCESS(status)) |
| 4381 | { |
| 4382 | eRoamState = eCsrContinueRoaming; |
| 4383 | } |
| 4384 | else |
| 4385 | { |
| 4386 | //it somehow fail need to stop |
| 4387 | eRoamState = eCsrStopRoaming; |
| 4388 | } |
| 4389 | } |
| 4390 | else |
| 4391 | { |
| 4392 | //Nothing we can do |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4393 | smsLog(pMac, LOGW, FL("cannot continue without BSS list")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4394 | eRoamState = eCsrStopRoaming; |
| 4395 | break; |
| 4396 | } |
| 4397 | } |
| 4398 | else //We have BSS |
| 4399 | { |
| 4400 | //Need to assign these value because they are used in csrIsSameProfile |
| 4401 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4402 | pCommand->u.roamCmd.roamProfile.negotiatedUCEncryptionType = pScanResult->ucEncryptionType; //Negotiated while building scan result. |
| 4403 | pCommand->u.roamCmd.roamProfile.negotiatedMCEncryptionType = pScanResult->mcEncryptionType; |
| 4404 | pCommand->u.roamCmd.roamProfile.negotiatedAuthType = pScanResult->authType; |
| 4405 | if ( CSR_IS_START_IBSS(&pCommand->u.roamCmd.roamProfile) ) |
| 4406 | { |
| 4407 | if(csrIsSameProfile(pMac, &pSession->connectedProfile, pProfile)) |
| 4408 | { |
| 4409 | eRoamState = eCsrStartIbssSameIbss; |
| 4410 | break; |
| 4411 | } |
| 4412 | } |
| 4413 | if( pCommand->u.roamCmd.fReassocToSelfNoCapChange ) |
| 4414 | { |
| 4415 | //trying to connect to the one already connected |
| 4416 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_FALSE; |
| 4417 | eRoamState = eCsrReassocToSelfNoCapChange; |
| 4418 | break; |
| 4419 | } |
| 4420 | // Attempt to Join this Bss... |
| 4421 | eRoamState = csrRoamJoin( pMac, sessionId, &pScanResult->Result, pProfile ); |
| 4422 | break; |
| 4423 | } |
| 4424 | |
| 4425 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4426 | if( (eCsrStopRoaming == eRoamState) && (CSR_IS_INFRASTRUCTURE( pProfile )) ) |
| 4427 | { |
| 4428 | //Need to indicate association_completion if association_start has been done |
| 4429 | if(pSession->bRefAssocStartCnt > 0) |
| 4430 | { |
| 4431 | pSession->bRefAssocStartCnt--; |
| 4432 | //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] | 4433 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4434 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, pCommand->u.roamCmd.roamId, |
| 4435 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 4436 | eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 4437 | } |
| 4438 | } |
| 4439 | |
| 4440 | return( eRoamState ); |
| 4441 | } |
| 4442 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4443 | static eHalStatus csrRoam( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4444 | { |
| 4445 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4446 | eCsrJoinState RoamState; |
| 4447 | tANI_U32 sessionId = pCommand->sessionId; |
| 4448 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4449 | //***if( hddIsRadioStateOn( pAdapter ) ) |
| 4450 | { |
| 4451 | // Attept to join a Bss... |
| 4452 | RoamState = csrRoamJoinNextBss( pMac, pCommand, eANI_BOOLEAN_FALSE ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4453 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4454 | // if nothing to join.. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4455 | if (( eCsrStopRoaming == RoamState ) || ( eCsrStopRoamingDueToConcurrency == RoamState)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4456 | { |
| 4457 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4458 | // and if connected in Infrastructure mode... |
| 4459 | if ( csrIsConnStateInfra(pMac, sessionId) ) |
| 4460 | { |
| 4461 | //... then we need to issue a disassociation |
| 4462 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISASSOC_NOTHING_TO_JOIN, FALSE ); |
| 4463 | if(!HAL_STATUS_SUCCESS(status)) |
| 4464 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4465 | smsLog(pMac, LOGW, FL(" failed to issue disassociate, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4466 | //roam command is completed by caller in the failed case |
| 4467 | fComplete = eANI_BOOLEAN_TRUE; |
| 4468 | } |
| 4469 | } |
| 4470 | else if( csrIsConnStateIbss(pMac, sessionId) ) |
| 4471 | { |
| 4472 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4473 | if(!HAL_STATUS_SUCCESS(status)) |
| 4474 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4475 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4476 | //roam command is completed by caller in the failed case |
| 4477 | fComplete = eANI_BOOLEAN_TRUE; |
| 4478 | } |
| 4479 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4480 | else if (csrIsConnStateConnectedInfraAp(pMac, sessionId)) |
| 4481 | { |
| 4482 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4483 | if(!HAL_STATUS_SUCCESS(status)) |
| 4484 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4485 | smsLog(pMac, LOGW, FL(" failed to issue stop bss, status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4486 | //roam command is completed by caller in the failed case |
| 4487 | fComplete = eANI_BOOLEAN_TRUE; |
| 4488 | } |
| 4489 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4490 | else |
| 4491 | { |
| 4492 | fComplete = eANI_BOOLEAN_TRUE; |
| 4493 | } |
| 4494 | if(fComplete) |
| 4495 | { |
| 4496 | // ... otherwise, we can complete the Roam command here. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4497 | if(eCsrStopRoamingDueToConcurrency == RoamState) |
| 4498 | { |
| 4499 | csrRoamComplete( pMac, eCsrJoinFailureDueToConcurrency, NULL ); |
| 4500 | } |
| 4501 | else |
| 4502 | { |
| 4503 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 4504 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4505 | } |
| 4506 | } |
| 4507 | else if ( eCsrReassocToSelfNoCapChange == RoamState ) |
| 4508 | { |
| 4509 | csrRoamComplete( pMac, eCsrSilentlyStopRoamingSaveState, NULL ); |
| 4510 | } |
| 4511 | else if ( eCsrStartIbssSameIbss == RoamState ) |
| 4512 | { |
| 4513 | csrRoamComplete( pMac, eCsrSilentlyStopRoaming, NULL ); |
| 4514 | } |
| 4515 | }//hddIsRadioStateOn |
| 4516 | |
| 4517 | return status; |
| 4518 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4519 | eHalStatus csrProcessFTReassocRoamCommand ( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4520 | { |
| 4521 | tANI_U32 sessionId; |
| 4522 | tCsrRoamSession *pSession; |
| 4523 | tCsrScanResult *pScanResult = NULL; |
| 4524 | tSirBssDescription *pBssDesc = NULL; |
| 4525 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4526 | sessionId = pCommand->sessionId; |
| 4527 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4528 | |
| 4529 | if(!pSession) |
| 4530 | { |
| 4531 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4532 | return eHAL_STATUS_FAILURE; |
| 4533 | } |
| 4534 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4535 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 4536 | { |
| 4537 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4538 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4539 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4540 | return eHAL_STATUS_FAILURE; |
| 4541 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4542 | if (pCommand->u.roamCmd.pRoamBssEntry) |
| 4543 | { |
| 4544 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 4545 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 4546 | } |
| 4547 | else |
| 4548 | { |
| 4549 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4550 | smsLog(pMac, LOG1, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4551 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 4552 | return eHAL_STATUS_FAILURE; |
| 4553 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4554 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 4555 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 4556 | return status; |
| 4557 | } |
| 4558 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4559 | eHalStatus csrRoamProcessCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 4560 | { |
| 4561 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4562 | tCsrRoamInfo roamInfo; |
| 4563 | tANI_U32 sessionId = pCommand->sessionId; |
| 4564 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4565 | |
| 4566 | if(!pSession) |
| 4567 | { |
| 4568 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4569 | return eHAL_STATUS_FAILURE; |
| 4570 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4571 | |
| 4572 | switch ( pCommand->u.roamCmd.roamReason ) |
| 4573 | { |
| 4574 | case eCsrForcedDisassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4575 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4576 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4577 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4578 | case eCsrSmeIssuedDisassocForHandoff: |
| 4579 | //Not to free pMac->roam.pCurRoamProfile (via csrFreeRoamProfile) because it is needed after disconnect |
| 4580 | #if 0 // TODO : Confirm this change |
| 4581 | status = csrRoamProcessDisassociate( pMac, pCommand, FALSE ); |
| 4582 | #else |
| 4583 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, FALSE ); |
| 4584 | #endif |
| 4585 | |
| 4586 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4587 | case eCsrForcedDisassocMICFailure: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4588 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, TRUE, TRUE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4589 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4590 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4591 | case eCsrForcedDeauth: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4592 | status = csrRoamProcessDisassocDeauth( pMac, pCommand, FALSE, FALSE ); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4593 | csrFreeRoamProfile(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4594 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4595 | case eCsrHddIssuedReassocToSameAP: |
| 4596 | case eCsrSmeIssuedReassocToSameAP: |
| 4597 | { |
| 4598 | tDot11fBeaconIEs *pIes = NULL; |
| 4599 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4600 | if( pSession->pConnectBssDesc ) |
| 4601 | { |
| 4602 | status = csrGetParsedBssDescriptionIEs(pMac, pSession->pConnectBssDesc, &pIes); |
| 4603 | if(!HAL_STATUS_SUCCESS(status) ) |
| 4604 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4605 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4606 | } |
| 4607 | else |
| 4608 | { |
| 4609 | roamInfo.reasonCode = eCsrRoamReasonStaCapabilityChanged; |
| 4610 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 4611 | pSession->roamingReason = eCsrReassocRoaming; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4612 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 4613 | roamInfo.pProfile = &pCommand->u.roamCmd.roamProfile; |
| 4614 | pSession->bRefAssocStartCnt++; |
| 4615 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 4616 | eCSR_ROAM_ASSOCIATION_START, eCSR_ROAM_RESULT_NONE ); |
| 4617 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4618 | smsLog(pMac, LOG1, FL(" calling csrRoamIssueReassociate")); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4619 | status = csrRoamIssueReassociate( pMac, sessionId, pSession->pConnectBssDesc, pIes, |
| 4620 | &pCommand->u.roamCmd.roamProfile ); |
| 4621 | if(!HAL_STATUS_SUCCESS(status)) |
| 4622 | { |
| 4623 | smsLog(pMac, LOGE, FL("csrRoamIssueReassociate failed with status %d"), status); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 4624 | csrReleaseCommandRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4625 | } |
| 4626 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4627 | vos_mem_free(pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4628 | pIes = NULL; |
| 4629 | } |
| 4630 | } |
| 4631 | break; |
| 4632 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4633 | case eCsrCapsChange: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4634 | smsLog(pMac, LOGE, FL("received eCsrCapsChange ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4635 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4636 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE); |
| 4637 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4638 | case eCsrSmeIssuedFTReassoc: |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 4639 | smsLog(pMac, LOG1, FL("received FT Reassoc Req ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4640 | status = csrProcessFTReassocRoamCommand(pMac, pCommand); |
| 4641 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4643 | case eCsrStopBss: |
| 4644 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4645 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 4646 | break; |
| 4647 | |
| 4648 | case eCsrForcedDisassocSta: |
| 4649 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4650 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId); |
| 4651 | status = csrSendMBDisassocReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4652 | pCommand->u.roamCmd.reason); |
| 4653 | break; |
| 4654 | |
| 4655 | case eCsrForcedDeauthSta: |
| 4656 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
| 4657 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId); |
| 4658 | status = csrSendMBDeauthReqMsg( pMac, sessionId, pCommand->u.roamCmd.peerMac, |
| 4659 | pCommand->u.roamCmd.reason); |
| 4660 | break; |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4661 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4662 | case eCsrPerformPreauth: |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 4663 | smsLog(pMac, LOG1, FL("Attempting FT PreAuth Req")); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4664 | status = csrRoamIssueFTPreauthReq(pMac, sessionId, |
| 4665 | pCommand->u.roamCmd.pLastRoamBss); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4666 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4667 | |
| 4668 | default: |
| 4669 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 4670 | |
| 4671 | if( pCommand->u.roamCmd.fUpdateCurRoamProfile ) |
| 4672 | { |
| 4673 | //Remember the roaming profile |
| 4674 | csrFreeRoamProfile(pMac, sessionId); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4675 | pSession->pCurRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 4676 | if ( NULL != pSession->pCurRoamProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4677 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4678 | vos_mem_set(pSession->pCurRoamProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4679 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, &pCommand->u.roamCmd.roamProfile); |
| 4680 | } |
| 4681 | } |
| 4682 | |
| 4683 | //At this point, original uapsd_mask is saved in pCurRoamProfile |
| 4684 | //uapsd_mask in the pCommand may change from this point on. |
| 4685 | |
| 4686 | // Attempt to roam with the new scan results (if we need to..) |
| 4687 | status = csrRoam( pMac, pCommand ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4688 | if(!HAL_STATUS_SUCCESS(status)) |
| 4689 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4690 | smsLog(pMac, LOGW, FL("csrRoam() failed with status = 0x%08X"), status); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4691 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4692 | break; |
| 4693 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4694 | return (status); |
| 4695 | } |
| 4696 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4697 | void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4698 | { |
| 4699 | pCommand->u.roamCmd.pLastRoamBss = NULL; |
| 4700 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4701 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4702 | vos_mem_set(&pCommand->u.roamCmd, sizeof(tRoamCmd), 0); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 4703 | } |
| 4704 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4705 | void csrReinitRoamCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4706 | { |
| 4707 | if(pCommand->u.roamCmd.fReleaseBssList) |
| 4708 | { |
| 4709 | csrScanResultPurge(pMac, pCommand->u.roamCmd.hBSSList); |
| 4710 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 4711 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 4712 | } |
| 4713 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 4714 | { |
| 4715 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 4716 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 4717 | } |
| 4718 | pCommand->u.roamCmd.pRoamBssEntry = NULL; |
| 4719 | //Because u.roamCmd is union and share with scanCmd and StatusChange |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4720 | vos_mem_set(&pCommand->u.roamCmd, sizeof(tRoamCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4721 | } |
| 4722 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4723 | void csrReinitWmStatusChangeCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 4724 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4725 | vos_mem_set(&pCommand->u.wmStatusChangeCmd, sizeof(tWmStatusChangeCmd), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4726 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4727 | void csrRoamComplete( tpAniSirGlobal pMac, eCsrRoamCompleteResult Result, void *Context ) |
| 4728 | { |
| 4729 | tListElem *pEntry; |
| 4730 | tSmeCmd *pCommand; |
| 4731 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4732 | smsLog( pMac, LOG2, "Roam Completion ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4733 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 4734 | if ( pEntry ) |
| 4735 | { |
| 4736 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4737 | // If the head of the queue is Active and it is a ROAM command, remove |
| 4738 | // and put this on the Free queue. |
| 4739 | if ( eSmeCommandRoam == pCommand->command ) |
| 4740 | { |
| 4741 | //we need to process the result first before removing it from active list because state changes |
| 4742 | //still happening insides roamQProcessRoamResults so no other roam command should be issued |
| 4743 | fReleaseCommand = csrRoamProcessResults( pMac, pCommand, Result, Context ); |
| 4744 | if( fReleaseCommand ) |
| 4745 | { |
| 4746 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 4747 | { |
| 4748 | csrReleaseCommandRoam( pMac, pCommand ); |
| 4749 | } |
| 4750 | else |
| 4751 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4752 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4753 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4754 | } |
| 4755 | } |
| 4756 | else |
| 4757 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4758 | smsLog( pMac, LOGE, " **********csrRoamComplete fail to release command reason %d", |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 4759 | pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4760 | } |
| 4761 | } |
| 4762 | else |
| 4763 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4764 | 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] | 4765 | } |
| 4766 | } |
| 4767 | else |
| 4768 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4769 | smsLog( pMac, LOGW, "CSR: Roam Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4770 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4771 | if( fReleaseCommand ) |
| 4772 | { |
| 4773 | smeProcessPendingQueue( pMac ); |
| 4774 | } |
| 4775 | } |
| 4776 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4777 | void csrResetPMKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4778 | { |
| 4779 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4780 | if(!pSession) |
| 4781 | { |
| 4782 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4783 | return; |
| 4784 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4785 | vos_mem_set(&(pSession->PmkidCandidateInfo[0]), |
| 4786 | sizeof(tPmkidCandidateInfo) * CSR_MAX_PMKID_ALLOWED, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4787 | pSession->NumPmkidCandidate = 0; |
| 4788 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4789 | #ifdef FEATURE_WLAN_WAPI |
| 4790 | void csrResetBKIDCandidateList( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 4791 | { |
| 4792 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4793 | if(!pSession) |
| 4794 | { |
| 4795 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4796 | return; |
| 4797 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4798 | vos_mem_set(&(pSession->BkidCandidateInfo[0]), |
| 4799 | sizeof(tBkidCandidateInfo) * CSR_MAX_BKID_ALLOWED, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4800 | pSession->NumBkidCandidate = 0; |
| 4801 | } |
| 4802 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4803 | extern tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ]; |
| 4804 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4805 | static eHalStatus csrRoamSaveSecurityRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrAuthType authType, |
| 4806 | tSirBssDescription *pSirBssDesc, |
| 4807 | tDot11fBeaconIEs *pIes) |
| 4808 | { |
| 4809 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4810 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 4811 | tDot11fBeaconIEs *pIesLocal = pIes; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 4812 | |
| 4813 | if(!pSession) |
| 4814 | { |
| 4815 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 4816 | return eHAL_STATUS_FAILURE; |
| 4817 | } |
| 4818 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4819 | if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4820 | (eCSR_AUTH_TYPE_WPA_PSK == authType) || |
| 4821 | (eCSR_AUTH_TYPE_RSN == authType) || |
| 4822 | (eCSR_AUTH_TYPE_RSN_PSK == authType) |
| 4823 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4824 | || |
| 4825 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4826 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) |
| 4827 | #endif /* FEATURE_WLAN_WAPI */ |
| 4828 | #ifdef FEATURE_WLAN_WAPI |
| 4829 | || |
| 4830 | (eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4831 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType) |
| 4832 | #endif /* FEATURE_WLAN_WAPI */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4833 | #ifdef WLAN_FEATURE_11W |
| 4834 | || |
| 4835 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) |
| 4836 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4837 | ) |
| 4838 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4839 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4840 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4841 | smsLog(pMac, LOGE, FL(" cannot parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4842 | } |
| 4843 | if( pIesLocal ) |
| 4844 | { |
| 4845 | tANI_U32 nIeLen; |
| 4846 | tANI_U8 *pIeBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4847 | if((eCSR_AUTH_TYPE_RSN == authType) || |
| 4848 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 4849 | (eCSR_AUTH_TYPE_FT_RSN == authType) || |
| 4850 | (eCSR_AUTH_TYPE_FT_RSN_PSK == authType) || |
| 4851 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 4852 | #if defined WLAN_FEATURE_11W |
| 4853 | (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == authType) || |
| 4854 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4855 | (eCSR_AUTH_TYPE_RSN_PSK == authType)) |
| 4856 | { |
| 4857 | if(pIesLocal->RSN.present) |
| 4858 | { |
| 4859 | //Calculate the actual length |
| 4860 | nIeLen = 8 //version + gp_cipher_suite + pwise_cipher_suite_count |
| 4861 | + pIesLocal->RSN.pwise_cipher_suite_count * 4 //pwise_cipher_suites |
| 4862 | + 2 //akm_suite_count |
| 4863 | + pIesLocal->RSN.akm_suite_count * 4 //akm_suites |
| 4864 | + 2; //reserved |
| 4865 | if( pIesLocal->RSN.pmkid_count ) |
| 4866 | { |
| 4867 | nIeLen += 2 + pIesLocal->RSN.pmkid_count * 4; //pmkid |
| 4868 | } |
| 4869 | //nIeLen doesn't count EID and length fields |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4870 | pSession->pWpaRsnRspIE = vos_mem_malloc(nIeLen + 2); |
| 4871 | if (NULL == pSession->pWpaRsnRspIE) |
| 4872 | status = eHAL_STATUS_FAILURE; |
| 4873 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4874 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4875 | vos_mem_set(pSession->pWpaRsnRspIE, nIeLen + 2, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4876 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_RSN; |
| 4877 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4878 | //copy upto akm_suites |
| 4879 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4880 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.version, |
| 4881 | sizeof(pIesLocal->RSN.version)); |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4882 | pIeBuf += sizeof(pIesLocal->RSN.version); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4883 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.gp_cipher_suite, |
| 4884 | sizeof(pIesLocal->RSN.gp_cipher_suite)); |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4885 | pIeBuf += sizeof(pIesLocal->RSN.gp_cipher_suite); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4886 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.pwise_cipher_suite_count, |
| 4887 | sizeof(pIesLocal->RSN.pwise_cipher_suite_count)); |
Gopichand Nakkala | 114718f | 2013-03-25 19:19:46 -0700 | [diff] [blame] | 4888 | pIeBuf += sizeof(pIesLocal->RSN.pwise_cipher_suite_count ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4889 | if( pIesLocal->RSN.pwise_cipher_suite_count ) |
| 4890 | { |
| 4891 | //copy pwise_cipher_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4892 | vos_mem_copy(pIeBuf, |
| 4893 | pIesLocal->RSN.pwise_cipher_suites, |
| 4894 | pIesLocal->RSN.pwise_cipher_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4895 | pIeBuf += pIesLocal->RSN.pwise_cipher_suite_count * 4; |
| 4896 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4897 | vos_mem_copy(pIeBuf, &pIesLocal->RSN.akm_suite_count, 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4898 | pIeBuf += 2; |
| 4899 | if( pIesLocal->RSN.akm_suite_count ) |
| 4900 | { |
| 4901 | //copy akm_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4902 | vos_mem_copy(pIeBuf, |
| 4903 | pIesLocal->RSN.akm_suites, |
| 4904 | pIesLocal->RSN.akm_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4905 | pIeBuf += pIesLocal->RSN.akm_suite_count * 4; |
| 4906 | } |
| 4907 | //copy the rest |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4908 | vos_mem_copy(pIeBuf, |
| 4909 | pIesLocal->RSN.akm_suites + pIesLocal->RSN.akm_suite_count * 4, |
| 4910 | 2 + pIesLocal->RSN.pmkid_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4911 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4912 | } |
| 4913 | } |
| 4914 | } |
| 4915 | else if((eCSR_AUTH_TYPE_WPA == authType) || |
| 4916 | (eCSR_AUTH_TYPE_WPA_PSK == authType)) |
| 4917 | { |
| 4918 | if(pIesLocal->WPA.present) |
| 4919 | { |
| 4920 | //Calculate the actual length |
| 4921 | nIeLen = 12 //OUI + version + multicast_cipher + unicast_cipher_count |
| 4922 | + pIesLocal->WPA.unicast_cipher_count * 4 //unicast_ciphers |
| 4923 | + 2 //auth_suite_count |
| 4924 | + pIesLocal->WPA.auth_suite_count * 4; //auth_suites |
| 4925 | // The WPA capabilities follows the Auth Suite (two octects)-- |
| 4926 | // this field is optional, and we always "send" zero, so just |
| 4927 | // remove it. This is consistent with our assumptions in the |
| 4928 | // frames compiler; c.f. bug 15234: |
| 4929 | //nIeLen doesn't count EID and length fields |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4930 | |
| 4931 | pSession->pWpaRsnRspIE = vos_mem_malloc(nIeLen + 2); |
| 4932 | if ( NULL == pSession->pWpaRsnRspIE ) |
| 4933 | status = eHAL_STATUS_FAILURE; |
| 4934 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4935 | { |
| 4936 | pSession->pWpaRsnRspIE[0] = DOT11F_EID_WPA; |
| 4937 | pSession->pWpaRsnRspIE[1] = (tANI_U8)nIeLen; |
| 4938 | pIeBuf = pSession->pWpaRsnRspIE + 2; |
| 4939 | //Copy WPA OUI |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4940 | vos_mem_copy(pIeBuf, &csrWpaOui[1], 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4941 | pIeBuf += 4; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4942 | vos_mem_copy(pIeBuf, &pIesLocal->WPA.version, |
| 4943 | 8 + pIesLocal->WPA.unicast_cipher_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4944 | pIeBuf += 8 + pIesLocal->WPA.unicast_cipher_count * 4; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4945 | vos_mem_copy(pIeBuf, &pIesLocal->WPA.auth_suite_count, |
| 4946 | 2 + pIesLocal->WPA.auth_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4947 | pIeBuf += pIesLocal->WPA.auth_suite_count * 4; |
| 4948 | pSession->nWpaRsnRspIeLength = nIeLen + 2; |
| 4949 | } |
| 4950 | } |
| 4951 | } |
| 4952 | #ifdef FEATURE_WLAN_WAPI |
| 4953 | else if((eCSR_AUTH_TYPE_WAPI_WAI_PSK == authType) || |
| 4954 | (eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE == authType)) |
| 4955 | { |
| 4956 | if(pIesLocal->WAPI.present) |
| 4957 | { |
| 4958 | //Calculate the actual length |
| 4959 | nIeLen = 4 //version + akm_suite_count |
| 4960 | + pIesLocal->WAPI.akm_suite_count * 4 // akm_suites |
| 4961 | + 2 //pwise_cipher_suite_count |
| 4962 | + pIesLocal->WAPI.unicast_cipher_suite_count * 4 //pwise_cipher_suites |
| 4963 | + 6; //gp_cipher_suite + preauth + reserved |
| 4964 | if( pIesLocal->WAPI.bkid_count ) |
| 4965 | { |
| 4966 | nIeLen += 2 + pIesLocal->WAPI.bkid_count * 4; //bkid |
| 4967 | } |
| 4968 | |
| 4969 | //nIeLen doesn't count EID and length fields |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4970 | pSession->pWapiRspIE = vos_mem_malloc(nIeLen + 2); |
| 4971 | if ( NULL == pSession->pWapiRspIE ) |
| 4972 | status = eHAL_STATUS_FAILURE; |
| 4973 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4974 | { |
| 4975 | pSession->pWapiRspIE[0] = DOT11F_EID_WAPI; |
| 4976 | pSession->pWapiRspIE[1] = (tANI_U8)nIeLen; |
| 4977 | pIeBuf = pSession->pWapiRspIE + 2; |
| 4978 | //copy upto akm_suite_count |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4979 | vos_mem_copy(pIeBuf, &pIesLocal->WAPI.version, 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4980 | pIeBuf += 4; |
| 4981 | if( pIesLocal->WAPI.akm_suite_count ) |
| 4982 | { |
| 4983 | //copy akm_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4984 | vos_mem_copy(pIeBuf, pIesLocal->WAPI.akm_suites, |
| 4985 | pIesLocal->WAPI.akm_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4986 | pIeBuf += pIesLocal->WAPI.akm_suite_count * 4; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4987 | } |
| 4988 | vos_mem_copy(pIeBuf, |
| 4989 | &pIesLocal->WAPI.unicast_cipher_suite_count, |
| 4990 | 2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4991 | pIeBuf += 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4992 | if( pIesLocal->WAPI.unicast_cipher_suite_count ) |
| 4993 | { |
| 4994 | //copy pwise_cipher_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 4995 | vos_mem_copy( pIeBuf, |
| 4996 | pIesLocal->WAPI.unicast_cipher_suites, |
| 4997 | pIesLocal->WAPI.unicast_cipher_suite_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4998 | pIeBuf += pIesLocal->WAPI.unicast_cipher_suite_count * 4; |
| 4999 | } |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 5000 | //gp_cipher_suite |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5001 | vos_mem_copy(pIeBuf, |
| 5002 | pIesLocal->WAPI.multicast_cipher_suite, |
| 5003 | 4); |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 5004 | //preauth + reserved |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5005 | vos_mem_copy(pIeBuf, |
| 5006 | pIesLocal->WAPI.multicast_cipher_suite + 4, |
| 5007 | 2); |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 5008 | //bkid_count |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5009 | vos_mem_copy(pIeBuf, &pIesLocal->WAPI.bkid_count, 2); |
| 5010 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5011 | pIeBuf += 8; |
| 5012 | if( pIesLocal->WAPI.bkid_count ) |
| 5013 | { |
| 5014 | //copy akm_suites |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5015 | vos_mem_copy(pIeBuf, pIesLocal->WAPI.bkid, |
| 5016 | pIesLocal->WAPI.bkid_count * 4); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5017 | pIeBuf += pIesLocal->WAPI.bkid_count * 4; |
| 5018 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 5019 | pSession->nWapiRspIeLength = nIeLen + 2; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5020 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5021 | } |
| 5022 | } |
| 5023 | #endif /* FEATURE_WLAN_WAPI */ |
| 5024 | if( !pIes ) |
| 5025 | { |
| 5026 | //locally allocated |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5027 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5028 | } |
| 5029 | } |
| 5030 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5031 | return (status); |
| 5032 | } |
| 5033 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5034 | static void csrCheckAndUpdateACWeight( tpAniSirGlobal pMac, tDot11fBeaconIEs *pIEs ) |
| 5035 | { |
| 5036 | v_U8_t bACWeights[WLANTL_MAX_AC]; |
| 5037 | v_U8_t paramBk, paramBe, paramVi, paramVo; |
| 5038 | v_BOOL_t fWeightChange = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5039 | //Compare two ACs' EDCA parameters, from low to high (BK, BE, VI, VO) |
| 5040 | //The "formula" is, if lower AC's AIFSN+CWMin is bigger than a fixed amount |
| 5041 | //of the higher AC one, make the higher AC has the same weight as the lower AC. |
| 5042 | //This doesn't address the case where the lower AC needs a real higher weight |
| 5043 | if( pIEs->WMMParams.present ) |
| 5044 | { |
| 5045 | //no change to the lowest ones |
| 5046 | bACWeights[WLANTL_AC_BK] = pMac->roam.ucACWeights[WLANTL_AC_BK]; |
| 5047 | bACWeights[WLANTL_AC_BE] = pMac->roam.ucACWeights[WLANTL_AC_BE]; |
| 5048 | bACWeights[WLANTL_AC_VI] = pMac->roam.ucACWeights[WLANTL_AC_VI]; |
| 5049 | bACWeights[WLANTL_AC_VO] = pMac->roam.ucACWeights[WLANTL_AC_VO]; |
| 5050 | paramBk = pIEs->WMMParams.acbk_aifsn + pIEs->WMMParams.acbk_acwmin; |
| 5051 | paramBe = pIEs->WMMParams.acbe_aifsn + pIEs->WMMParams.acbe_acwmin; |
| 5052 | paramVi = pIEs->WMMParams.acvi_aifsn + pIEs->WMMParams.acvi_acwmin; |
| 5053 | paramVo = pIEs->WMMParams.acvo_aifsn + pIEs->WMMParams.acvo_acwmin; |
| 5054 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramBe) ) |
| 5055 | { |
| 5056 | bACWeights[WLANTL_AC_BE] = bACWeights[WLANTL_AC_BK]; |
| 5057 | fWeightChange = VOS_TRUE; |
| 5058 | } |
| 5059 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVi) ) |
| 5060 | { |
| 5061 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BK]; |
| 5062 | fWeightChange = VOS_TRUE; |
| 5063 | } |
| 5064 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVi) ) |
| 5065 | { |
| 5066 | bACWeights[WLANTL_AC_VI] = bACWeights[WLANTL_AC_BE]; |
| 5067 | fWeightChange = VOS_TRUE; |
| 5068 | } |
| 5069 | if( SME_DETECT_AC_WEIGHT_DIFF(paramBk, paramVo) ) |
| 5070 | { |
| 5071 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BK]; |
| 5072 | fWeightChange = VOS_TRUE; |
| 5073 | } |
| 5074 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramBe, paramVo) ) |
| 5075 | { |
| 5076 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_BE]; |
| 5077 | fWeightChange = VOS_TRUE; |
| 5078 | } |
| 5079 | else if( SME_DETECT_AC_WEIGHT_DIFF(paramVi, paramVo) ) |
| 5080 | { |
| 5081 | bACWeights[WLANTL_AC_VO] = bACWeights[WLANTL_AC_VI]; |
| 5082 | fWeightChange = VOS_TRUE; |
| 5083 | } |
| 5084 | if(fWeightChange) |
| 5085 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5086 | 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] | 5087 | bACWeights[2], bACWeights[3]); |
| 5088 | WLANTL_SetACWeights(pMac->roam.gVosContext, bACWeights); |
| 5089 | } |
| 5090 | } |
| 5091 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5092 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5093 | //Returns whether the current association is a 11r assoc or not |
| 5094 | tANI_BOOLEAN csrRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 5095 | { |
| 5096 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5097 | return csrNeighborRoamIs11rAssoc(pMac); |
| 5098 | #else |
| 5099 | return eANI_BOOLEAN_FALSE; |
| 5100 | #endif |
| 5101 | } |
| 5102 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5103 | #ifdef FEATURE_WLAN_CCX |
| 5104 | //Returns whether the current association is a CCX assoc or not |
| 5105 | tANI_BOOLEAN csrRoamIsCCXAssoc(tpAniSirGlobal pMac) |
| 5106 | { |
| 5107 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5108 | return csrNeighborRoamIsCCXAssoc(pMac); |
| 5109 | #else |
| 5110 | return eANI_BOOLEAN_FALSE; |
| 5111 | #endif |
| 5112 | } |
| 5113 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5114 | #ifdef FEATURE_WLAN_LFR |
| 5115 | //Returns whether "Legacy Fast Roaming" is currently enabled...or not |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 5116 | tANI_BOOLEAN csrRoamIsFastRoamEnabled(tpAniSirGlobal pMac, tANI_U32 sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5117 | { |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 5118 | tCsrRoamSession *pSession = NULL; |
| 5119 | |
| 5120 | if (CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 5121 | { |
| 5122 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 5123 | if (NULL != pSession->pCurRoamProfile) |
| 5124 | { |
| 5125 | if (pSession->pCurRoamProfile->csrPersona != VOS_STA_MODE) |
| 5126 | { |
| 5127 | return eANI_BOOLEAN_FALSE; |
| 5128 | } |
| 5129 | } |
| 5130 | } |
| 5131 | |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5132 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 5133 | if (eANI_BOOLEAN_TRUE == CSR_IS_FASTROAM_IN_CONCURRENCY_INI_FEATURE_ENABLED(pMac)) |
| 5134 | { |
| 5135 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled); |
| 5136 | } |
| 5137 | else |
| 5138 | #endif |
| 5139 | { |
| 5140 | return (pMac->roam.configParam.isFastRoamIniFeatureEnabled && |
Madan Mohan Koyyalamudi | 393a434 | 2012-10-15 16:07:09 -0700 | [diff] [blame] | 5141 | (!csrIsConcurrentSessionRunning(pMac))); |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5142 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5143 | } |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 5144 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5145 | #ifdef FEATURE_WLAN_CCX |
| 5146 | /* --------------------------------------------------------------------------- |
| 5147 | |
| 5148 | \fn csrNeighborRoamIsCCXAssoc |
| 5149 | |
| 5150 | \brief This function returns whether the current association is a CCX assoc or not |
| 5151 | |
| 5152 | \param pMac - The handle returned by macOpen. |
| 5153 | |
| 5154 | \return eANI_BOOLEAN_TRUE if current assoc is CCX, eANI_BOOLEAN_FALSE otherwise |
| 5155 | |
| 5156 | ---------------------------------------------------------------------------*/ |
| 5157 | tANI_BOOLEAN csrNeighborRoamIsCCXAssoc(tpAniSirGlobal pMac) |
| 5158 | { |
| 5159 | return pMac->roam.neighborRoamInfo.isCCXAssoc; |
| 5160 | } |
| 5161 | #endif /* FEATURE_WLAN_CCX */ |
| 5162 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 5163 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 5164 | //Returns whether "FW based BG scan" is currently enabled...or not |
| 5165 | tANI_BOOLEAN csrRoamIsRoamOffloadScanEnabled(tpAniSirGlobal pMac) |
| 5166 | { |
| 5167 | return (pMac->roam.configParam.isRoamOffloadScanEnabled); |
| 5168 | } |
| 5169 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 5170 | #endif |
| 5171 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 5172 | #if defined(FEATURE_WLAN_CCX) |
| 5173 | tANI_BOOLEAN csrRoamIsCcxIniFeatureEnabled(tpAniSirGlobal pMac) |
| 5174 | { |
| 5175 | return pMac->roam.configParam.isCcxIniFeatureEnabled; |
| 5176 | } |
| 5177 | #endif /*FEATURE_WLAN_CCX*/ |
| 5178 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5179 | //Return true means the command can be release, else not |
| 5180 | static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 5181 | eCsrRoamCompleteResult Result, void *Context ) |
| 5182 | { |
| 5183 | tANI_BOOLEAN fReleaseCommand = eANI_BOOLEAN_TRUE; |
| 5184 | tSirBssDescription *pSirBssDesc = NULL; |
| 5185 | tSirMacAddr BroadcastMac = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
| 5186 | tCsrScanResult *pScanResult = NULL; |
| 5187 | tCsrRoamInfo roamInfo; |
| 5188 | sme_QosAssocInfo assocInfo; |
| 5189 | sme_QosCsrEventIndType ind_qos;//indication for QoS module in SME |
| 5190 | tANI_U8 acm_mask = 0; //HDD needs the ACM mask in the assoc rsp callback |
| 5191 | tDot11fBeaconIEs *pIes = NULL; |
| 5192 | tANI_U32 sessionId = pCommand->sessionId; |
| 5193 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 5194 | tCsrRoamProfile *pProfile = &pCommand->u.roamCmd.roamProfile; |
| 5195 | eRoamCmdStatus roamStatus; |
| 5196 | eCsrRoamResult roamResult; |
| 5197 | eHalStatus status; |
| 5198 | tANI_U32 key_timeout_interval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5199 | tSirSmeStartBssRsp *pSmeStartBssRsp = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5200 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 5201 | if(!pSession) |
| 5202 | { |
| 5203 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 5204 | return eANI_BOOLEAN_FALSE; |
| 5205 | } |
| 5206 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5207 | smsLog( pMac, LOG1, FL("Processing ROAM results...")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5208 | switch( Result ) |
| 5209 | { |
| 5210 | case eCsrJoinSuccess: |
| 5211 | // reset the IDLE timer |
| 5212 | // !! |
| 5213 | // !! fall through to the next CASE statement here is intentional !! |
| 5214 | // !! |
| 5215 | case eCsrReassocSuccess: |
| 5216 | if(eCsrReassocSuccess == Result) |
| 5217 | { |
| 5218 | ind_qos = SME_QOS_CSR_REASSOC_COMPLETE; |
| 5219 | } |
| 5220 | else |
| 5221 | { |
| 5222 | ind_qos = SME_QOS_CSR_ASSOC_COMPLETE; |
| 5223 | } |
| 5224 | // Success Join Response from LIM. Tell NDIS we are connected and save the |
| 5225 | // Connected state... |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5226 | smsLog(pMac, LOGW, FL("receives association indication")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5227 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5228 | //always free the memory here |
| 5229 | if(pSession->pWpaRsnRspIE) |
| 5230 | { |
| 5231 | pSession->nWpaRsnRspIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5232 | vos_mem_free(pSession->pWpaRsnRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5233 | pSession->pWpaRsnRspIE = NULL; |
| 5234 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5235 | #ifdef FEATURE_WLAN_WAPI |
| 5236 | if(pSession->pWapiRspIE) |
| 5237 | { |
| 5238 | pSession->nWapiRspIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5239 | vos_mem_free(pSession->pWapiRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5240 | pSession->pWapiRspIE = NULL; |
| 5241 | } |
| 5242 | #endif /* FEATURE_WLAN_WAPI */ |
| 5243 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5244 | //Reset counter so no join retry is needed. |
| 5245 | pSession->maxRetryCount = 0; |
| 5246 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 5247 | #endif |
| 5248 | /* This creates problem since we have not saved the connected profile. |
| 5249 | So moving this after saving the profile |
| 5250 | */ |
| 5251 | //csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED ); |
| 5252 | if( CSR_IS_INFRASTRUCTURE( pProfile ) ) |
| 5253 | { |
| 5254 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED; |
| 5255 | } |
| 5256 | else |
| 5257 | { |
| 5258 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED; |
| 5259 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5260 | //Use the last connected bssdesc for reassoc-ing to the same AP. |
| 5261 | //NOTE: What to do when reassoc to a different AP??? |
| 5262 | if( (eCsrHddIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) || |
| 5263 | (eCsrSmeIssuedReassocToSameAP == pCommand->u.roamCmd.roamReason) ) |
| 5264 | { |
| 5265 | pSirBssDesc = pSession->pConnectBssDesc; |
| 5266 | if(pSirBssDesc) |
| 5267 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5268 | vos_mem_copy(&roamInfo.bssid, &pSirBssDesc->bssId, |
| 5269 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5270 | } |
| 5271 | } |
| 5272 | else |
| 5273 | { |
| 5274 | |
| 5275 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5276 | { |
| 5277 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 5278 | if(pScanResult != NULL) |
| 5279 | { |
| 5280 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5281 | //this can be NULL |
| 5282 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5283 | vos_mem_copy(&roamInfo.bssid, &pSirBssDesc->bssId, |
| 5284 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5285 | } |
| 5286 | } |
| 5287 | } |
| 5288 | if( pSirBssDesc ) |
| 5289 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5290 | roamInfo.staId = HAL_STA_INVALID_IDX; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5291 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
| 5292 | //Save WPA/RSN IE |
| 5293 | csrRoamSaveSecurityRspIE(pMac, sessionId, pProfile->negotiatedAuthType, pSirBssDesc, pIes); |
| 5294 | #ifdef FEATURE_WLAN_CCX |
| 5295 | roamInfo.isCCXAssoc = pSession->connectedProfile.isCCXAssoc; |
| 5296 | #endif |
| 5297 | |
| 5298 | // csrRoamStateChange also affects sub-state. Hence, csrRoamStateChange happens first and then |
| 5299 | // substate change. |
| 5300 | // Moving even save profile above so that below mentioned conditon is also met. |
| 5301 | // JEZ100225: Moved to after saving the profile. Fix needed in main/latest |
| 5302 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5303 | // Make sure the Set Context is issued before link indication to NDIS. After link indication is |
| 5304 | // made to NDIS, frames could start flowing. If we have not set context with LIM, the frames |
| 5305 | // will be dropped for the security context may not be set properly. |
| 5306 | // |
| 5307 | // this was causing issues in the 2c_wlan_wep WHQL test when the SetContext was issued after the link |
| 5308 | // indication. (Link Indication happens in the profFSMSetConnectedInfra call). |
| 5309 | // |
| 5310 | // this reordering was done on titan_prod_usb branch and is being replicated here. |
| 5311 | // |
| 5312 | |
| 5313 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && |
| 5314 | !pProfile->bWPSAssociation) |
| 5315 | { |
| 5316 | // Issue the set Context request to LIM to establish the Unicast STA context |
| 5317 | if( !HAL_STATUS_SUCCESS( csrRoamIssueSetContextReq( pMac, sessionId, |
| 5318 | pProfile->negotiatedUCEncryptionType, |
| 5319 | pSirBssDesc, &(pSirBssDesc->bssId), |
| 5320 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ) ) ) // NO keys... these key parameters don't matter. |
| 5321 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5322 | smsLog( pMac, LOGE, FL(" Set context for unicast fail") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5323 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 5324 | } |
| 5325 | // Issue the set Context request to LIM to establish the Broadcast STA context |
| 5326 | csrRoamIssueSetContextReq( pMac, sessionId, pProfile->negotiatedMCEncryptionType, |
| 5327 | pSirBssDesc, &BroadcastMac, |
| 5328 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5329 | } |
| 5330 | else |
| 5331 | { |
| 5332 | //Need to wait for supplicant authtication |
| 5333 | roamInfo.fAuthRequired = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5334 | //Set the subestate to WaitForKey in case authentiation is needed |
| 5335 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId ); |
| 5336 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5337 | if(pProfile->bWPSAssociation) |
| 5338 | { |
| 5339 | key_timeout_interval = CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD; |
| 5340 | } |
| 5341 | else |
| 5342 | { |
| 5343 | key_timeout_interval = CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD; |
| 5344 | } |
| 5345 | |
| 5346 | //Save sessionId in case of timeout |
| 5347 | pMac->roam.WaitForKeyTimerInfo.sessionId = (tANI_U8)sessionId; |
| 5348 | //This time should be long enough for the rest of the process plus setting key |
| 5349 | if(!HAL_STATUS_SUCCESS( csrRoamStartWaitForKeyTimer( pMac, key_timeout_interval ) ) ) |
| 5350 | { |
| 5351 | //Reset our state so nothting is blocked. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5352 | smsLog( pMac, LOGE, FL(" Failed to start pre-auth timer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5353 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 5354 | } |
| 5355 | } |
| 5356 | |
| 5357 | assocInfo.pBssDesc = pSirBssDesc; //could be NULL |
| 5358 | assocInfo.pProfile = pProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5359 | if(Context) |
| 5360 | { |
| 5361 | tSirSmeJoinRsp *pJoinRsp = (tSirSmeJoinRsp *)Context; |
| 5362 | tANI_U32 len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5363 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5364 | len = pJoinRsp->assocReqLength + pJoinRsp->assocRspLength + pJoinRsp->beaconLength; |
| 5365 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5366 | len += pJoinRsp->parsedRicRspLen; |
| 5367 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 5368 | #ifdef FEATURE_WLAN_CCX |
| 5369 | len += pJoinRsp->tspecIeLen; |
| 5370 | #endif |
| 5371 | if(len) |
| 5372 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5373 | pSession->connectedInfo.pbFrames = vos_mem_malloc(len); |
| 5374 | if ( pSession->connectedInfo.pbFrames != NULL ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5375 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5376 | vos_mem_copy(pSession->connectedInfo.pbFrames, |
| 5377 | pJoinRsp->frames, len); |
| 5378 | pSession->connectedInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5379 | pSession->connectedInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5380 | pSession->connectedInfo.nBeaconLength = pJoinRsp->beaconLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5381 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5382 | pSession->connectedInfo.nRICRspLength = pJoinRsp->parsedRicRspLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5383 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 5384 | #ifdef FEATURE_WLAN_CCX |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5385 | pSession->connectedInfo.nTspecIeLength = pJoinRsp->tspecIeLen; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5386 | #endif |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5387 | roamInfo.nAssocReqLength = pJoinRsp->assocReqLength; |
| 5388 | roamInfo.nAssocRspLength = pJoinRsp->assocRspLength; |
| 5389 | roamInfo.nBeaconLength = pJoinRsp->beaconLength; |
| 5390 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5391 | } |
| 5392 | } |
| 5393 | if(pCommand->u.roamCmd.fReassoc) |
| 5394 | { |
| 5395 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5396 | } |
| 5397 | pSession->connectedInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5398 | roamInfo.staId = ( tANI_U8 )pJoinRsp->staId; |
| 5399 | roamInfo.ucastSig = ( tANI_U8 )pJoinRsp->ucastSig; |
| 5400 | roamInfo.bcastSig = ( tANI_U8 )pJoinRsp->bcastSig; |
| 5401 | } |
| 5402 | else |
| 5403 | { |
| 5404 | if(pCommand->u.roamCmd.fReassoc) |
| 5405 | { |
| 5406 | roamInfo.fReassocReq = roamInfo.fReassocRsp = eANI_BOOLEAN_TRUE; |
| 5407 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5408 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5409 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5410 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5411 | } |
| 5412 | } |
| 5413 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5414 | // Indicate SME-QOS with reassoc success event, only after |
| 5415 | // copying the frames |
| 5416 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, ind_qos, &assocInfo); |
| 5417 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5418 | roamInfo.pBssDesc = pSirBssDesc; |
| 5419 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5420 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5421 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5422 | acm_mask = sme_QosGetACMMask(pMac, pSirBssDesc, NULL); |
| 5423 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 5424 | pSession->connectedProfile.acm_mask = acm_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5425 | //start UAPSD if uapsd_mask is not 0 because HDD will configure for trigger frame |
| 5426 | //It may be better to let QoS do this???? |
| 5427 | if( pSession->connectedProfile.modifyProfileFields.uapsd_mask ) |
| 5428 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5429 | smsLog(pMac, LOGE, " uapsd_mask (0x%X) set, request UAPSD now", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5430 | pSession->connectedProfile.modifyProfileFields.uapsd_mask); |
| 5431 | pmcStartUapsd( pMac, NULL, NULL ); |
| 5432 | } |
Gopichand Nakkala | dacbcb5 | 2013-04-18 16:41:54 +0530 | [diff] [blame] | 5433 | pSession->connectedProfile.dot11Mode = pSession->bssParams.uCfgDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5434 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 5435 | if( pSession->bRefAssocStartCnt > 0 ) |
| 5436 | { |
| 5437 | pSession->bRefAssocStartCnt--; |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5438 | //Remove this code once SLM_Sessionization is supported |
| 5439 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5440 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5441 | { |
| 5442 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5443 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5444 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5445 | } |
| 5446 | |
| 5447 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_NONE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5448 | // reset the PMKID candidate list |
| 5449 | csrResetPMKIDCandidateList( pMac, sessionId ); |
| 5450 | //Update TL's AC weight base on the current EDCA parameters |
| 5451 | //These parameters may change in the course of the connection, that sictuation |
| 5452 | //is not taken care here. This change is mainly to address a WIFI WMM test where |
| 5453 | //BE has a equal or higher TX priority than VI. |
| 5454 | //We only do this for infra link |
| 5455 | if( csrIsConnStateConnectedInfra(pMac, sessionId ) && pIes ) |
| 5456 | { |
| 5457 | csrCheckAndUpdateACWeight(pMac, pIes); |
| 5458 | } |
| 5459 | #ifdef FEATURE_WLAN_WAPI |
| 5460 | // reset the BKID candidate list |
| 5461 | csrResetBKIDCandidateList( pMac, sessionId ); |
| 5462 | #endif /* FEATURE_WLAN_WAPI */ |
| 5463 | } |
| 5464 | else |
| 5465 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5466 | smsLog(pMac, LOGW, " Roam command doesn't have a BSS desc"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5467 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5468 | csrScanCancelIdleScan(pMac); |
| 5469 | //Not to signal link up because keys are yet to be set. |
| 5470 | //The linkup function will overwrite the sub-state that we need to keep at this point. |
| 5471 | if( !CSR_IS_WAIT_FOR_KEY(pMac, sessionId) ) |
| 5472 | { |
| 5473 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 5474 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5475 | //Check if BMPS is required and start the BMPS retry timer. Timer period is large |
| 5476 | //enough to let security and DHCP handshake succeed before entry into BMPS |
| 5477 | if (pmcShouldBmpsTimerRun(pMac)) |
| 5478 | { |
| 5479 | if (pmcStartTrafficTimer(pMac, BMPS_TRAFFIC_TIMER_ALLOW_SECURITY_DHCP) |
| 5480 | != eHAL_STATUS_SUCCESS) |
| 5481 | { |
| 5482 | smsLog(pMac, LOGP, FL("Cannot start BMPS Retry timer")); |
| 5483 | } |
| 5484 | smsLog(pMac, LOG2, FL("BMPS Retry Timer already running or started")); |
| 5485 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5486 | break; |
| 5487 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5488 | case eCsrStartBssSuccess: |
| 5489 | // on the StartBss Response, LIM is returning the Bss Description that we |
| 5490 | // are beaconing. Add this Bss Description to our scan results and |
| 5491 | // chain the Profile to this Bss Description. On a Start BSS, there was no |
| 5492 | // detected Bss description (no partner) so we issued the Start Bss to |
| 5493 | // start the Ibss without any Bss description. Lim was kind enough to return |
| 5494 | // 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] | 5495 | smsLog(pMac, LOG2, FL("receives start BSS ok indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5496 | status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5497 | pSmeStartBssRsp = (tSirSmeStartBssRsp *)Context; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5498 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5499 | if( CSR_IS_IBSS( pProfile ) ) |
| 5500 | { |
| 5501 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 5502 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5503 | else if (CSR_IS_INFRA_AP(pProfile)) |
| 5504 | { |
| 5505 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 5506 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5507 | else |
| 5508 | { |
| 5509 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 5510 | } |
| 5511 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 5512 | { |
| 5513 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5514 | pSirBssDesc = &pSmeStartBssRsp->bssDescription; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5515 | if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs( pMac, pSirBssDesc, &pIes )) ) |
| 5516 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5517 | smsLog(pMac, LOG2, FL("cannot parse IBSS IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5518 | roamInfo.pBssDesc = pSirBssDesc; |
| 5519 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5520 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5521 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_START_FAILED ); |
| 5522 | break; |
| 5523 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5524 | if (!CSR_IS_INFRA_AP(pProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5525 | { |
Tushnim Bhattacharyya | 5128d75 | 2013-06-26 23:23:18 -0700 | [diff] [blame] | 5526 | pScanResult = csrScanAppendBssDescription( pMac, pSirBssDesc, pIes, FALSE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5527 | } |
| 5528 | csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
| 5529 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5530 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5531 | if(pSirBssDesc) |
| 5532 | { |
| 5533 | csrRoamSaveConnectedInfomation(pMac, sessionId, pProfile, pSirBssDesc, pIes); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5534 | vos_mem_copy(&roamInfo.bssid, &pSirBssDesc->bssId, |
| 5535 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5536 | } |
| 5537 | //We are doen with the IEs so free it |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5538 | vos_mem_free(pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5539 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5540 | { |
| 5541 | vos_log_ibss_pkt_type *pIbssLog; |
| 5542 | tANI_U32 bi; |
| 5543 | |
| 5544 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5545 | if(pIbssLog) |
| 5546 | { |
| 5547 | if(CSR_INVALID_SCANRESULT_HANDLE == pCommand->u.roamCmd.hBSSList) |
| 5548 | { |
| 5549 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5550 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_RSP; |
| 5551 | } |
| 5552 | else |
| 5553 | { |
| 5554 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_RSP; |
| 5555 | } |
| 5556 | if(pSirBssDesc) |
| 5557 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5558 | vos_mem_copy(pIbssLog->bssid, pSirBssDesc->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5559 | pIbssLog->operatingChannel = pSirBssDesc->channelId; |
| 5560 | } |
| 5561 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 5562 | { |
| 5563 | //***U8 is not enough for beacon interval |
| 5564 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 5565 | } |
| 5566 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5567 | } |
| 5568 | } |
| 5569 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5570 | //Only set context for non-WDS_STA. We don't even need it for WDS_AP. But since the encryption |
| 5571 | //is WPA2-PSK so it won't matter. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5572 | if( CSR_IS_ENC_TYPE_STATIC( pProfile->negotiatedUCEncryptionType ) && !CSR_IS_INFRA_AP( pSession->pCurRoamProfile )) |
| 5573 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5574 | // Issue the set Context request to LIM to establish the Broadcast STA context for the Ibss. |
| 5575 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 5576 | pProfile->negotiatedMCEncryptionType, |
| 5577 | pSirBssDesc, &BroadcastMac, |
| 5578 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 5579 | } |
| 5580 | } |
| 5581 | else |
| 5582 | { |
| 5583 | //Keep the state to eCSR_ROAMING_STATE_JOINING |
| 5584 | //Need to send join_req. |
| 5585 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 5586 | { |
| 5587 | if((pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link))) |
| 5588 | { |
| 5589 | pSirBssDesc = &pScanResult->Result.BssDescriptor; |
| 5590 | pIes = (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ); |
| 5591 | // Set the roaming substate to 'join attempt'... |
| 5592 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 5593 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5594 | } |
| 5595 | } |
| 5596 | else |
| 5597 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5598 | smsLog( pMac, LOGE, " StartBSS for WDS station with no BssDesc" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5599 | VOS_ASSERT( 0 ); |
| 5600 | } |
| 5601 | } |
| 5602 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5603 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5604 | //trigger the connection start indication in Vista |
| 5605 | if( !CSR_IS_JOIN_TO_IBSS( pProfile ) ) |
| 5606 | { |
| 5607 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5608 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5609 | if( CSR_IS_WDS( pProfile ) ) |
| 5610 | { |
| 5611 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5612 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5613 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5614 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5615 | { |
| 5616 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5617 | roamResult = eCSR_ROAM_RESULT_INFRA_STARTED; |
| 5618 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5619 | |
| 5620 | //Only tell upper layer is we start the BSS because Vista doesn't like multiple connection |
| 5621 | //indications. If we don't start the BSS ourself, handler of eSIR_SME_JOINED_NEW_BSS will |
| 5622 | //trigger the connection start indication in Vista |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5623 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5624 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5625 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
krunal soni | 3fc2664 | 2013-10-08 22:41:42 -0700 | [diff] [blame] | 5626 | //We start the IBSS (didn't find any matched IBSS out there) |
| 5627 | roamInfo.pBssDesc = pSirBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5628 | roamInfo.staId = (tANI_U8)pSmeStartBssRsp->staId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5629 | vos_mem_copy(roamInfo.bssid, pSirBssDesc->bssId, |
| 5630 | sizeof(tCsrBssid)); |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 5631 | //Remove this code once SLM_Sessionization is supported |
| 5632 | //BMPS_WORKAROUND_NOT_NEEDED |
| 5633 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5634 | ( csrIsConcurrentSessionRunning( pMac ))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5635 | { |
| 5636 | pMac->roam.configParam.doBMPSWorkaround = 1; |
| 5637 | } |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 5638 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5639 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5640 | } |
| 5641 | |
| 5642 | csrScanCancelIdleScan(pMac); |
Ravi Joshi | 414b14c | 2013-10-04 16:33:26 -0700 | [diff] [blame] | 5643 | |
| 5644 | if( CSR_IS_WDS_STA( pProfile ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5645 | { |
| 5646 | //need to send stop BSS because we fail to send join_req |
| 5647 | csrRoamIssueDisassociateCmd( pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED ); |
| 5648 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5649 | eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_STOPPED ); |
| 5650 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5651 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5652 | case eCsrStartBssFailure: |
| 5653 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 5654 | { |
| 5655 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5656 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 5657 | if(pIbssLog) |
| 5658 | { |
| 5659 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 5660 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 5661 | } |
| 5662 | } |
| 5663 | #endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5664 | roamStatus = eCSR_ROAM_IBSS_IND; |
| 5665 | roamResult = eCSR_ROAM_RESULT_IBSS_STARTED; |
| 5666 | if( CSR_IS_WDS( pProfile ) ) |
| 5667 | { |
| 5668 | roamStatus = eCSR_ROAM_WDS_IND; |
| 5669 | roamResult = eCSR_ROAM_RESULT_WDS_STARTED; |
| 5670 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5671 | if( CSR_IS_INFRA_AP( pProfile ) ) |
| 5672 | { |
| 5673 | roamStatus = eCSR_ROAM_INFRA_IND; |
| 5674 | roamResult = eCSR_ROAM_RESULT_INFRA_START_FAILED; |
| 5675 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5676 | if(Context) |
| 5677 | { |
| 5678 | pSirBssDesc = (tSirBssDescription *)Context; |
| 5679 | } |
| 5680 | else |
| 5681 | { |
| 5682 | pSirBssDesc = NULL; |
| 5683 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5684 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5685 | roamInfo.pBssDesc = pSirBssDesc; |
| 5686 | //We need to associate_complete it first, becasue Associate_start already indicated. |
| 5687 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, roamStatus, roamResult ); |
| 5688 | csrSetDefaultDot11Mode( pMac ); |
| 5689 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5690 | case eCsrSilentlyStopRoaming: |
| 5691 | // We are here because we try to start the same IBSS |
| 5692 | //No message to PE |
| 5693 | // return the roaming state to Joined. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5694 | smsLog(pMac, LOGW, FL("receives silently roaming indication")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5695 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId ); |
| 5696 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5697 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5698 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5699 | if( roamInfo.pBssDesc ) |
| 5700 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5701 | vos_mem_copy(&roamInfo.bssid, &roamInfo.pBssDesc->bssId, |
| 5702 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5703 | } |
| 5704 | //Since there is no change in the current state, simply pass back no result otherwise |
| 5705 | //HDD may be mistakenly mark to disconnected state. |
| 5706 | csrRoamCallCallback( pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5707 | eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_NONE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5708 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5709 | case eCsrSilentlyStopRoamingSaveState: |
| 5710 | //We are here because we try to connect to the same AP |
| 5711 | //No message to PE |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5712 | smsLog(pMac, LOGW, FL("receives silently stop roaming indication")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5713 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5714 | |
| 5715 | //to aviod resetting the substate to NONE |
| 5716 | pMac->roam.curState[sessionId] = eCSR_ROAMING_STATE_JOINED; |
| 5717 | //No need to change substate to wai_for_key because there is no state change |
| 5718 | roamInfo.pBssDesc = pSession->pConnectBssDesc; |
| 5719 | if( roamInfo.pBssDesc ) |
| 5720 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5721 | vos_mem_copy(&roamInfo.bssid, &roamInfo.pBssDesc->bssId, |
| 5722 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5723 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5724 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5725 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5726 | roamInfo.nBeaconLength = pSession->connectedInfo.nBeaconLength; |
| 5727 | roamInfo.nAssocReqLength = pSession->connectedInfo.nAssocReqLength; |
| 5728 | roamInfo.nAssocRspLength = pSession->connectedInfo.nAssocRspLength; |
| 5729 | roamInfo.pbFrames = pSession->connectedInfo.pbFrames; |
| 5730 | roamInfo.staId = pSession->connectedInfo.staId; |
| 5731 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5732 | VOS_ASSERT( roamInfo.staId != 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5733 | pSession->bRefAssocStartCnt--; |
| 5734 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5735 | eCSR_ROAM_ASSOCIATION_COMPLETION, eCSR_ROAM_RESULT_ASSOCIATED); |
| 5736 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_ASSOCIATED, eANI_BOOLEAN_TRUE); |
| 5737 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5738 | case eCsrReassocFailure: |
| 5739 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5740 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_REASSOC_FAILURE, NULL); |
| 5741 | #endif |
| 5742 | case eCsrJoinWdsFailure: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5743 | smsLog(pMac, LOGW, FL("failed to join WDS")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5744 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5745 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5746 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5747 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5748 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5749 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5750 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 5751 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5752 | eCSR_ROAM_WDS_IND, |
| 5753 | eCSR_ROAM_RESULT_WDS_NOT_ASSOCIATED); |
| 5754 | //Need to issue stop_bss |
| 5755 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5756 | case eCsrJoinFailure: |
| 5757 | case eCsrNothingToJoin: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5758 | case eCsrJoinFailureDueToConcurrency: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5759 | default: |
| 5760 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5761 | smsLog(pMac, LOGW, FL("receives no association indication")); |
| 5762 | smsLog(pMac, LOG1, FL("Assoc ref count %d"), |
Madan Mohan Koyyalamudi | 85d140a | 2012-10-18 20:23:01 -0700 | [diff] [blame] | 5763 | pSession->bRefAssocStartCnt); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5764 | if( CSR_IS_INFRASTRUCTURE( &pSession->connectedProfile ) || |
| 5765 | CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, sessionId ) ) |
| 5766 | { |
| 5767 | //do not free for the other profiles as we need to send down stop BSS later |
| 5768 | csrFreeConnectBssDesc(pMac, sessionId); |
| 5769 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 5770 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 5771 | csrSetDefaultDot11Mode( pMac ); |
| 5772 | } |
| 5773 | |
| 5774 | switch( pCommand->u.roamCmd.roamReason ) |
| 5775 | { |
| 5776 | // If this transition is because of an 802.11 OID, then we transition |
| 5777 | // back to INIT state so we sit waiting for more OIDs to be issued and |
| 5778 | // we don't start the IDLE timer. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5779 | case eCsrSmeIssuedFTReassoc: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5780 | case eCsrSmeIssuedAssocToSimilarAP: |
| 5781 | case eCsrHddIssued: |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 5782 | case eCsrSmeIssuedDisassocForHandoff: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5783 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5784 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5785 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 5786 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 5787 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5788 | vos_mem_copy(&roamInfo.bssid, |
| 5789 | &pSession->joinFailStatusCode.bssId, |
| 5790 | sizeof(tCsrBssid)); |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 5791 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5792 | /* Defeaturize this later if needed */ |
| 5793 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 5794 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 5795 | if (csrRoamIsHandoffInProgress(pMac)) |
| 5796 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5797 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 5798 | csrNeighborRoamIndicateConnect(pMac, (tANI_U8)sessionId, VOS_STATUS_E_FAILURE); |
| 5799 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5800 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5801 | if(pSession->bRefAssocStartCnt > 0) |
| 5802 | { |
| 5803 | pSession->bRefAssocStartCnt--; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5804 | if(eCsrJoinFailureDueToConcurrency == Result) |
| 5805 | { |
| 5806 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 5807 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5808 | eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
| 5809 | } |
| 5810 | else |
| 5811 | { |
| 5812 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5813 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 5814 | eCSR_ROAM_RESULT_FAILURE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5815 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5816 | } |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5817 | else |
| 5818 | { |
| 5819 | /* bRefAssocStartCnt is not incremented when |
| 5820 | * eRoamState == eCsrStopRoamingDueToConcurrency |
| 5821 | * in csrRoamJoinNextBss API. so handle this in |
| 5822 | * else case by sending assoc failure |
| 5823 | */ |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 5824 | csrRoamCallCallback(pMac, sessionId, &roamInfo, |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 5825 | pCommand->u.scanCmd.roamId, |
| 5826 | eCSR_ROAM_ASSOCIATION_FAILURE, |
| 5827 | eCSR_ROAM_RESULT_FAILURE); |
| 5828 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 5829 | smsLog(pMac, LOG1, FL(" roam(reason %d) failed"), pCommand->u.roamCmd.roamReason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5830 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5831 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5832 | #endif |
| 5833 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5834 | csrScanStartIdleScan(pMac); |
| 5835 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 5836 | //For WDS STA. To fix the issue where the WDS AP side may be too busy by |
| 5837 | //BT activity and not able to recevie WLAN traffic. Retry the join |
| 5838 | if( CSR_IS_WDS_STA(pProfile) ) |
| 5839 | { |
| 5840 | csrRoamStartJoinRetryTimer(pMac, sessionId, CSR_JOIN_RETRY_TIMEOUT_PERIOD); |
| 5841 | } |
| 5842 | #endif |
| 5843 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5844 | case eCsrHddIssuedReassocToSameAP: |
| 5845 | case eCsrSmeIssuedReassocToSameAP: |
| 5846 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5847 | |
| 5848 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5849 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5850 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5851 | #endif |
| 5852 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 5853 | csrScanStartIdleScan(pMac); |
| 5854 | break; |
| 5855 | case eCsrForcedDisassoc: |
| 5856 | case eCsrForcedDeauth: |
| 5857 | case eCsrSmeIssuedIbssJoinFailure: |
| 5858 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId); |
| 5859 | |
| 5860 | if(eCsrSmeIssuedIbssJoinFailure == pCommand->u.roamCmd.roamReason) |
| 5861 | { |
| 5862 | // Notify HDD that IBSS join failed |
| 5863 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_IBSS_IND, eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
| 5864 | } |
| 5865 | else |
| 5866 | { |
| 5867 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5868 | pCommand->u.roamCmd.roamId, |
| 5869 | eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 5870 | } |
| 5871 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5872 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 5873 | #endif |
| 5874 | csrRoamLinkDown(pMac, sessionId); |
| 5875 | csrScanStartIdleScan(pMac); |
| 5876 | break; |
| 5877 | case eCsrForcedIbssLeave: |
| 5878 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5879 | pCommand->u.roamCmd.roamId, |
| 5880 | eCSR_ROAM_IBSS_LEAVE, |
| 5881 | eCSR_ROAM_RESULT_IBSS_STOP); |
| 5882 | break; |
| 5883 | case eCsrForcedDisassocMICFailure: |
| 5884 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5885 | |
| 5886 | csrRoamCallCallback(pMac, sessionId, NULL, pCommand->u.roamCmd.roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_MIC_FAILURE); |
| 5887 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 5888 | sme_QosCsrEventInd(pMac, (tANI_U8)sessionId, SME_QOS_CSR_DISCONNECT_REQ, NULL); |
| 5889 | #endif |
| 5890 | csrScanStartIdleScan(pMac); |
| 5891 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5892 | case eCsrStopBss: |
| 5893 | csrRoamCallCallback(pMac, sessionId, NULL, |
| 5894 | pCommand->u.roamCmd.roamId, |
| 5895 | eCSR_ROAM_INFRA_IND, |
| 5896 | eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 5897 | break; |
| 5898 | case eCsrForcedDisassocSta: |
| 5899 | case eCsrForcedDeauthSta: |
| 5900 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINED, sessionId); |
| 5901 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 5902 | { |
| 5903 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 5904 | if (!pSession) |
| 5905 | break; |
| 5906 | |
| 5907 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 5908 | { |
| 5909 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5910 | vos_mem_copy(roamInfo.peerMac, |
| 5911 | pCommand->u.roamCmd.peerMac, |
| 5912 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5913 | roamInfo.reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 5914 | roamInfo.statusCode = eSIR_SME_SUCCESS; |
| 5915 | status = csrRoamCallCallback(pMac, sessionId, |
| 5916 | &roamInfo, pCommand->u.roamCmd.roamId, |
| 5917 | eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 5918 | } |
| 5919 | } |
| 5920 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5921 | case eCsrLostLink1: |
| 5922 | // if lost link roam1 failed, then issue lost link Scan2 ... |
| 5923 | csrScanRequestLostLink2(pMac, sessionId); |
| 5924 | break; |
| 5925 | case eCsrLostLink2: |
| 5926 | // if lost link roam2 failed, then issue lost link scan3 ... |
| 5927 | csrScanRequestLostLink3(pMac, sessionId); |
| 5928 | break; |
| 5929 | case eCsrLostLink3: |
| 5930 | default: |
| 5931 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, sessionId ); |
| 5932 | |
| 5933 | //We are done with one round of lostlink roaming here |
| 5934 | csrScanHandleFailedLostlink3(pMac, sessionId); |
| 5935 | break; |
| 5936 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5937 | break; |
| 5938 | } |
| 5939 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5940 | return ( fReleaseCommand ); |
| 5941 | } |
| 5942 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5943 | eHalStatus csrRoamRegisterCallback(tpAniSirGlobal pMac, csrRoamCompleteCallback callback, void *pContext) |
| 5944 | { |
| 5945 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5946 | return (status); |
| 5947 | } |
| 5948 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5949 | eHalStatus csrRoamCopyProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pDstProfile, tCsrRoamProfile *pSrcProfile) |
| 5950 | { |
| 5951 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 5952 | tANI_U32 size = 0; |
| 5953 | |
| 5954 | do |
| 5955 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5956 | vos_mem_set(pDstProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5957 | if(pSrcProfile->BSSIDs.numOfBSSIDs) |
| 5958 | { |
| 5959 | size = sizeof(tCsrBssid) * pSrcProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5960 | pDstProfile->BSSIDs.bssid = vos_mem_malloc(size); |
| 5961 | if ( NULL == pDstProfile->BSSIDs.bssid ) |
| 5962 | status = eHAL_STATUS_FAILURE; |
| 5963 | else |
| 5964 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5965 | if(!HAL_STATUS_SUCCESS(status)) |
| 5966 | { |
| 5967 | break; |
| 5968 | } |
| 5969 | pDstProfile->BSSIDs.numOfBSSIDs = pSrcProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5970 | vos_mem_copy(pDstProfile->BSSIDs.bssid, |
| 5971 | pSrcProfile->BSSIDs.bssid, size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5972 | } |
| 5973 | if(pSrcProfile->SSIDs.numOfSSIDs) |
| 5974 | { |
| 5975 | size = sizeof(tCsrSSIDInfo) * pSrcProfile->SSIDs.numOfSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5976 | pDstProfile->SSIDs.SSIDList = vos_mem_malloc(size); |
| 5977 | if ( NULL == pDstProfile->SSIDs.SSIDList ) |
| 5978 | status = eHAL_STATUS_FAILURE; |
| 5979 | else |
| 5980 | status = eHAL_STATUS_SUCCESS; |
| 5981 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5982 | { |
| 5983 | break; |
| 5984 | } |
| 5985 | pDstProfile->SSIDs.numOfSSIDs = pSrcProfile->SSIDs.numOfSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5986 | vos_mem_copy(pDstProfile->SSIDs.SSIDList, |
| 5987 | pSrcProfile->SSIDs.SSIDList, size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5988 | } |
| 5989 | if(pSrcProfile->nWPAReqIELength) |
| 5990 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 5991 | pDstProfile->pWPAReqIE = vos_mem_malloc(pSrcProfile->nWPAReqIELength); |
| 5992 | if ( NULL == pDstProfile->pWPAReqIE ) |
| 5993 | status = eHAL_STATUS_FAILURE; |
| 5994 | else |
| 5995 | status = eHAL_STATUS_SUCCESS; |
| 5996 | |
| 5997 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5998 | { |
| 5999 | break; |
| 6000 | } |
| 6001 | pDstProfile->nWPAReqIELength = pSrcProfile->nWPAReqIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6002 | vos_mem_copy(pDstProfile->pWPAReqIE, pSrcProfile->pWPAReqIE, |
| 6003 | pSrcProfile->nWPAReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6004 | } |
| 6005 | if(pSrcProfile->nRSNReqIELength) |
| 6006 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6007 | pDstProfile->pRSNReqIE = vos_mem_malloc(pSrcProfile->nRSNReqIELength); |
| 6008 | if ( NULL == pDstProfile->pRSNReqIE ) |
| 6009 | status = eHAL_STATUS_FAILURE; |
| 6010 | else |
| 6011 | status = eHAL_STATUS_SUCCESS; |
| 6012 | |
| 6013 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6014 | { |
| 6015 | break; |
| 6016 | } |
| 6017 | pDstProfile->nRSNReqIELength = pSrcProfile->nRSNReqIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6018 | vos_mem_copy(pDstProfile->pRSNReqIE, pSrcProfile->pRSNReqIE, |
| 6019 | pSrcProfile->nRSNReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6020 | } |
| 6021 | #ifdef FEATURE_WLAN_WAPI |
| 6022 | if(pSrcProfile->nWAPIReqIELength) |
| 6023 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6024 | pDstProfile->pWAPIReqIE = vos_mem_malloc(pSrcProfile->nWAPIReqIELength); |
| 6025 | if ( NULL == pDstProfile->pWAPIReqIE ) |
| 6026 | status = eHAL_STATUS_FAILURE; |
| 6027 | else |
| 6028 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6029 | if(!HAL_STATUS_SUCCESS(status)) |
| 6030 | { |
| 6031 | break; |
| 6032 | } |
| 6033 | pDstProfile->nWAPIReqIELength = pSrcProfile->nWAPIReqIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6034 | vos_mem_copy(pDstProfile->pWAPIReqIE, pSrcProfile->pWAPIReqIE, |
| 6035 | pSrcProfile->nWAPIReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6036 | } |
| 6037 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6038 | if(pSrcProfile->nAddIEScanLength) |
| 6039 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6040 | pDstProfile->pAddIEScan = vos_mem_malloc(pSrcProfile->nAddIEScanLength); |
| 6041 | if ( NULL == pDstProfile->pAddIEScan ) |
| 6042 | status = eHAL_STATUS_FAILURE; |
| 6043 | else |
| 6044 | status = eHAL_STATUS_SUCCESS; |
| 6045 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6046 | if(!HAL_STATUS_SUCCESS(status)) |
| 6047 | { |
| 6048 | break; |
| 6049 | } |
| 6050 | pDstProfile->nAddIEScanLength = pSrcProfile->nAddIEScanLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6051 | vos_mem_copy(pDstProfile->pAddIEScan, pSrcProfile->pAddIEScan, |
| 6052 | pSrcProfile->nAddIEScanLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6053 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6054 | if(pSrcProfile->nAddIEAssocLength) |
| 6055 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6056 | pDstProfile->pAddIEAssoc = vos_mem_malloc(pSrcProfile->nAddIEAssocLength); |
| 6057 | if ( NULL == pDstProfile->pAddIEAssoc ) |
| 6058 | status = eHAL_STATUS_FAILURE; |
| 6059 | else |
| 6060 | status = eHAL_STATUS_SUCCESS; |
| 6061 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6062 | if(!HAL_STATUS_SUCCESS(status)) |
| 6063 | { |
| 6064 | break; |
| 6065 | } |
| 6066 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6067 | vos_mem_copy(pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 6068 | pSrcProfile->nAddIEAssocLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6069 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6070 | if(pSrcProfile->ChannelInfo.ChannelList) |
| 6071 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6072 | pDstProfile->ChannelInfo.ChannelList = vos_mem_malloc( |
| 6073 | pSrcProfile->ChannelInfo.numOfChannels); |
| 6074 | if ( NULL == pDstProfile->ChannelInfo.ChannelList ) |
| 6075 | status = eHAL_STATUS_FAILURE; |
| 6076 | else |
| 6077 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6078 | if(!HAL_STATUS_SUCCESS(status)) |
| 6079 | { |
| 6080 | break; |
| 6081 | } |
| 6082 | pDstProfile->ChannelInfo.numOfChannels = pSrcProfile->ChannelInfo.numOfChannels; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6083 | vos_mem_copy(pDstProfile->ChannelInfo.ChannelList, |
| 6084 | pSrcProfile->ChannelInfo.ChannelList, |
| 6085 | pSrcProfile->ChannelInfo.numOfChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6086 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6087 | pDstProfile->AuthType = pSrcProfile->AuthType; |
| 6088 | pDstProfile->EncryptionType = pSrcProfile->EncryptionType; |
| 6089 | pDstProfile->mcEncryptionType = pSrcProfile->mcEncryptionType; |
| 6090 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->negotiatedUCEncryptionType; |
| 6091 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->negotiatedMCEncryptionType; |
| 6092 | pDstProfile->negotiatedAuthType = pSrcProfile->negotiatedAuthType; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 6093 | #ifdef WLAN_FEATURE_11W |
| 6094 | pDstProfile->MFPEnabled = pSrcProfile->MFPEnabled; |
| 6095 | pDstProfile->MFPRequired = pSrcProfile->MFPRequired; |
| 6096 | pDstProfile->MFPCapable = pSrcProfile->MFPCapable; |
| 6097 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6098 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 6099 | pDstProfile->phyMode = pSrcProfile->phyMode; |
| 6100 | pDstProfile->csrPersona = pSrcProfile->csrPersona; |
| 6101 | |
| 6102 | #ifdef FEATURE_WLAN_WAPI |
| 6103 | if(csrIsProfileWapi(pSrcProfile)) |
| 6104 | { |
| 6105 | if(pDstProfile->phyMode & eCSR_DOT11_MODE_11n) |
| 6106 | { |
| 6107 | pDstProfile->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 6108 | } |
| 6109 | } |
| 6110 | #endif /* FEATURE_WLAN_WAPI */ |
| 6111 | pDstProfile->CBMode = pSrcProfile->CBMode; |
| 6112 | /*Save the WPS info*/ |
| 6113 | pDstProfile->bWPSAssociation = pSrcProfile->bWPSAssociation; |
| 6114 | pDstProfile->uapsd_mask = pSrcProfile->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6115 | pDstProfile->beaconInterval = pSrcProfile->beaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6116 | pDstProfile->privacy = pSrcProfile->privacy; |
| 6117 | pDstProfile->fwdWPSPBCProbeReq = pSrcProfile->fwdWPSPBCProbeReq; |
| 6118 | pDstProfile->csr80211AuthType = pSrcProfile->csr80211AuthType; |
| 6119 | pDstProfile->dtimPeriod = pSrcProfile->dtimPeriod; |
| 6120 | pDstProfile->ApUapsdEnable = pSrcProfile->ApUapsdEnable; |
| 6121 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->SSIDs.SSIDList[0].ssidHidden; |
| 6122 | pDstProfile->protEnabled = pSrcProfile->protEnabled; |
| 6123 | pDstProfile->obssProtEnabled = pSrcProfile->obssProtEnabled; |
| 6124 | pDstProfile->cfg_protection = pSrcProfile->cfg_protection; |
| 6125 | pDstProfile->wps_state = pSrcProfile->wps_state; |
| 6126 | pDstProfile->ieee80211d = pSrcProfile->ieee80211d; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6127 | vos_mem_copy(&pDstProfile->Keys, &pSrcProfile->Keys, |
| 6128 | sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6129 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6130 | if (pSrcProfile->MDID.mdiePresent) |
| 6131 | { |
| 6132 | pDstProfile->MDID.mdiePresent = 1; |
| 6133 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 6134 | } |
| 6135 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6136 | }while(0); |
| 6137 | |
| 6138 | if(!HAL_STATUS_SUCCESS(status)) |
| 6139 | { |
| 6140 | csrReleaseProfile(pMac, pDstProfile); |
| 6141 | pDstProfile = NULL; |
| 6142 | } |
| 6143 | |
| 6144 | return (status); |
| 6145 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6146 | eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile ) |
| 6147 | { |
| 6148 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6149 | tCsrRoamConnectedProfile *pSrcProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 6150 | do |
| 6151 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6152 | vos_mem_set(pDstProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6153 | if(pSrcProfile->bssid) |
| 6154 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6155 | pDstProfile->BSSIDs.bssid = vos_mem_malloc(sizeof(tCsrBssid)); |
| 6156 | if ( NULL == pDstProfile->BSSIDs.bssid ) |
| 6157 | status = eHAL_STATUS_FAILURE; |
| 6158 | else |
| 6159 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6160 | if(!HAL_STATUS_SUCCESS(status)) |
| 6161 | { |
| 6162 | break; |
| 6163 | } |
| 6164 | pDstProfile->BSSIDs.numOfBSSIDs = 1; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6165 | vos_mem_copy(pDstProfile->BSSIDs.bssid, pSrcProfile->bssid, |
| 6166 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6167 | } |
| 6168 | if(pSrcProfile->SSID.ssId) |
| 6169 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6170 | pDstProfile->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); |
| 6171 | if ( NULL == pDstProfile->SSIDs.SSIDList ) |
| 6172 | status = eHAL_STATUS_FAILURE; |
| 6173 | else |
| 6174 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6175 | if(!HAL_STATUS_SUCCESS(status)) |
| 6176 | { |
| 6177 | break; |
| 6178 | } |
| 6179 | pDstProfile->SSIDs.numOfSSIDs = 1; |
| 6180 | pDstProfile->SSIDs.SSIDList[0].handoffPermitted = pSrcProfile->handoffPermitted; |
| 6181 | pDstProfile->SSIDs.SSIDList[0].ssidHidden = pSrcProfile->ssidHidden; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6182 | vos_mem_copy(&pDstProfile->SSIDs.SSIDList[0].SSID, |
| 6183 | &pSrcProfile->SSID, sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6184 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6185 | if(pSrcProfile->nAddIEAssocLength) |
| 6186 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6187 | pDstProfile->pAddIEAssoc = vos_mem_malloc(pSrcProfile->nAddIEAssocLength); |
| 6188 | if ( NULL == pDstProfile->pAddIEAssoc) |
| 6189 | status = eHAL_STATUS_FAILURE; |
| 6190 | else |
| 6191 | status = eHAL_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6192 | if(!HAL_STATUS_SUCCESS(status)) |
| 6193 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6194 | smsLog( pMac, LOGE, FL(" failed to allocate memory for additional IEs ") ); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6195 | break; |
| 6196 | } |
| 6197 | pDstProfile->nAddIEAssocLength = pSrcProfile->nAddIEAssocLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6198 | vos_mem_copy(pDstProfile->pAddIEAssoc, pSrcProfile->pAddIEAssoc, |
| 6199 | pSrcProfile->nAddIEAssocLength); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 6200 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6201 | pDstProfile->ChannelInfo.ChannelList = vos_mem_malloc(1); |
| 6202 | if ( NULL == pDstProfile->ChannelInfo.ChannelList ) |
| 6203 | status = eHAL_STATUS_FAILURE; |
| 6204 | else |
| 6205 | status = eHAL_STATUS_SUCCESS; |
| 6206 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6207 | if(!HAL_STATUS_SUCCESS(status)) |
| 6208 | { |
| 6209 | break; |
| 6210 | } |
| 6211 | pDstProfile->ChannelInfo.numOfChannels = 1; |
| 6212 | pDstProfile->ChannelInfo.ChannelList[0] = pSrcProfile->operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6213 | pDstProfile->AuthType.numEntries = 1; |
| 6214 | pDstProfile->AuthType.authType[0] = pSrcProfile->AuthType; |
| 6215 | pDstProfile->negotiatedAuthType = pSrcProfile->AuthType; |
| 6216 | pDstProfile->EncryptionType.numEntries = 1; |
| 6217 | pDstProfile->EncryptionType.encryptionType[0] = pSrcProfile->EncryptionType; |
| 6218 | pDstProfile->negotiatedUCEncryptionType = pSrcProfile->EncryptionType; |
| 6219 | pDstProfile->mcEncryptionType.numEntries = 1; |
| 6220 | pDstProfile->mcEncryptionType.encryptionType[0] = pSrcProfile->mcEncryptionType; |
| 6221 | pDstProfile->negotiatedMCEncryptionType = pSrcProfile->mcEncryptionType; |
| 6222 | pDstProfile->BSSType = pSrcProfile->BSSType; |
| 6223 | pDstProfile->CBMode = pSrcProfile->CBMode; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6224 | vos_mem_copy(&pDstProfile->Keys, &pSrcProfile->Keys, |
| 6225 | sizeof(pDstProfile->Keys)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6226 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 6227 | if (pSrcProfile->MDID.mdiePresent) |
| 6228 | { |
| 6229 | pDstProfile->MDID.mdiePresent = 1; |
| 6230 | pDstProfile->MDID.mobilityDomain = pSrcProfile->MDID.mobilityDomain; |
| 6231 | } |
| 6232 | #endif |
| 6233 | |
| 6234 | }while(0); |
| 6235 | |
| 6236 | if(!HAL_STATUS_SUCCESS(status)) |
| 6237 | { |
| 6238 | csrReleaseProfile(pMac, pDstProfile); |
| 6239 | pDstProfile = NULL; |
| 6240 | } |
| 6241 | |
| 6242 | return (status); |
| 6243 | } |
| 6244 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6245 | eHalStatus csrRoamIssueConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6246 | tScanResultHandle hBSSList, |
| 6247 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate, |
| 6248 | tANI_BOOLEAN fClearScan) |
| 6249 | { |
| 6250 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6251 | tSmeCmd *pCommand; |
| 6252 | |
| 6253 | pCommand = csrGetCommandBuffer(pMac); |
| 6254 | if(NULL == pCommand) |
| 6255 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6256 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6257 | status = eHAL_STATUS_RESOURCES; |
| 6258 | } |
| 6259 | else |
| 6260 | { |
| 6261 | if( fClearScan ) |
| 6262 | { |
| 6263 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6264 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6265 | } |
| 6266 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6267 | if(NULL == pProfile) |
| 6268 | { |
| 6269 | //We can roam now |
| 6270 | //Since pProfile is NULL, we need to build our own profile, set everything to default |
| 6271 | //We can only support open and no encryption |
| 6272 | pCommand->u.roamCmd.roamProfile.AuthType.numEntries = 1; |
| 6273 | pCommand->u.roamCmd.roamProfile.AuthType.authType[0] = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6274 | pCommand->u.roamCmd.roamProfile.EncryptionType.numEntries = 1; |
| 6275 | pCommand->u.roamCmd.roamProfile.EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 6276 | pCommand->u.roamCmd.roamProfile.csrPersona = VOS_STA_MODE; |
| 6277 | } |
| 6278 | else |
| 6279 | { |
| 6280 | //make a copy of the profile |
| 6281 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 6282 | if(HAL_STATUS_SUCCESS(status)) |
| 6283 | { |
| 6284 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 6285 | } |
| 6286 | } |
| 6287 | pCommand->command = eSmeCommandRoam; |
| 6288 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6289 | pCommand->u.roamCmd.hBSSList = hBSSList; |
| 6290 | pCommand->u.roamCmd.roamId = roamId; |
| 6291 | pCommand->u.roamCmd.roamReason = reason; |
| 6292 | //We need to free the BssList when the command is done |
| 6293 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_TRUE; |
| 6294 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6295 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 6296 | FL("CSR PERSONA=%d"), |
| 6297 | pCommand->u.roamCmd.roamProfile.csrPersona); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6298 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 6299 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6300 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6301 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6302 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6303 | } |
| 6304 | } |
| 6305 | |
| 6306 | return (status); |
| 6307 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6308 | eHalStatus csrRoamIssueReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6309 | tCsrRoamModifyProfileFields *pMmodProfileFields, |
| 6310 | eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
| 6311 | { |
| 6312 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6313 | tSmeCmd *pCommand; |
| 6314 | |
| 6315 | pCommand = csrGetCommandBuffer(pMac); |
| 6316 | if(NULL == pCommand) |
| 6317 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6318 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6319 | status = eHAL_STATUS_RESOURCES; |
| 6320 | } |
| 6321 | else |
| 6322 | { |
| 6323 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6324 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6325 | if(pProfile) |
| 6326 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6327 | //This is likely trying to reassoc to different profile |
| 6328 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 6329 | //make a copy of the profile |
| 6330 | status = csrRoamCopyProfile(pMac, &pCommand->u.roamCmd.roamProfile, pProfile); |
| 6331 | pCommand->u.roamCmd.fUpdateCurRoamProfile = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6332 | } |
| 6333 | else |
| 6334 | { |
| 6335 | status = csrRoamCopyConnectedProfile(pMac, sessionId, &pCommand->u.roamCmd.roamProfile); |
| 6336 | //how to update WPA/WPA2 info in roamProfile?? |
| 6337 | pCommand->u.roamCmd.roamProfile.uapsd_mask = pMmodProfileFields->uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6339 | if(HAL_STATUS_SUCCESS(status)) |
| 6340 | { |
| 6341 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_TRUE; |
| 6342 | } |
| 6343 | pCommand->command = eSmeCommandRoam; |
| 6344 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6345 | pCommand->u.roamCmd.roamId = roamId; |
| 6346 | pCommand->u.roamCmd.roamReason = reason; |
| 6347 | //We need to free the BssList when the command is done |
| 6348 | //For reassoc there is no BSS list, so the boolean set to false |
| 6349 | pCommand->u.roamCmd.hBSSList = CSR_INVALID_SCANRESULT_HANDLE; |
| 6350 | pCommand->u.roamCmd.fReleaseBssList = eANI_BOOLEAN_FALSE; |
| 6351 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6352 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 6353 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6354 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6355 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6356 | csrRoamCompletion(pMac, sessionId, NULL, pCommand, eCSR_ROAM_RESULT_FAILURE, eANI_BOOLEAN_FALSE); |
| 6357 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6358 | } |
| 6359 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6360 | return (status); |
| 6361 | } |
| 6362 | |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6363 | eHalStatus csrRoamEnqueuePreauth(tpAniSirGlobal pMac, tANI_U32 sessionId, tpSirBssDescription pBssDescription, |
| 6364 | eCsrRoamReason reason, tANI_BOOLEAN fImmediate) |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 6365 | // , eCsrRoamReason reason, tANI_U32 roamId, tANI_BOOLEAN fImediate) |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6366 | { |
| 6367 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6368 | tSmeCmd *pCommand; |
| 6369 | |
| 6370 | pCommand = csrGetCommandBuffer(pMac); |
| 6371 | if(NULL == pCommand) |
| 6372 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6373 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6374 | status = eHAL_STATUS_RESOURCES; |
| 6375 | } |
| 6376 | else |
| 6377 | { |
| 6378 | if(pBssDescription) |
| 6379 | { |
| 6380 | //copy over the parameters we need later |
| 6381 | pCommand->command = eSmeCommandRoam; |
| 6382 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6383 | pCommand->u.roamCmd.roamReason = reason; |
| 6384 | //this is the important parameter |
| 6385 | //in this case we are using this field for the "next" BSS |
| 6386 | pCommand->u.roamCmd.pLastRoamBss = pBssDescription; |
| 6387 | status = csrQueueSmeCommand(pMac, pCommand, fImmediate); |
| 6388 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6389 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6390 | smsLog( pMac, LOGE, FL(" fail to enqueue preauth command, status = %d"), status ); |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6391 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6392 | } |
| 6393 | } |
| 6394 | else |
| 6395 | { |
| 6396 | //Return failure |
| 6397 | status = eHAL_STATUS_RESOURCES; |
| 6398 | } |
| 6399 | } |
| 6400 | return (status); |
| 6401 | } |
| 6402 | |
| 6403 | eHalStatus csrRoamDequeuePreauth(tpAniSirGlobal pMac) |
| 6404 | { |
| 6405 | tListElem *pEntry; |
| 6406 | tSmeCmd *pCommand; |
| 6407 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 6408 | if ( pEntry ) |
| 6409 | { |
| 6410 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 6411 | if ( (eSmeCommandRoam == pCommand->command) && |
| 6412 | (eCsrPerformPreauth == pCommand->u.roamCmd.roamReason)) |
| 6413 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6414 | smsLog( pMac, LOG1, FL("DQ-Command = %d, Reason = %d"), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6415 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6416 | if (csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK )) { |
| 6417 | csrReleaseCommandPreauth( pMac, pCommand ); |
| 6418 | } |
| 6419 | } else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6420 | smsLog( pMac, LOGE, FL("Command = %d, Reason = %d "), |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 6421 | pCommand->command, pCommand->u.roamCmd.roamReason); |
| 6422 | } |
| 6423 | } |
| 6424 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6425 | 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] | 6426 | } |
| 6427 | smeProcessPendingQueue( pMac ); |
| 6428 | return eHAL_STATUS_SUCCESS; |
| 6429 | } |
| 6430 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6431 | eHalStatus csrRoamConnectWithBSSList(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6432 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6433 | { |
| 6434 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6435 | tScanResultHandle hBSSList; |
| 6436 | tANI_U32 roamId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6437 | status = csrScanCopyResultList(pMac, hBssListIn, &hBSSList); |
| 6438 | if(HAL_STATUS_SUCCESS(status)) |
| 6439 | { |
| 6440 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6441 | if(pRoamId) |
| 6442 | { |
| 6443 | *pRoamId = roamId; |
| 6444 | } |
| 6445 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6446 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6447 | if(!HAL_STATUS_SUCCESS(status)) |
| 6448 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6449 | smsLog(pMac, LOGE, FL("failed to start a join process")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6450 | csrScanResultPurge(pMac, hBSSList); |
| 6451 | } |
| 6452 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6453 | return (status); |
| 6454 | } |
| 6455 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6456 | eHalStatus csrRoamConnect(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6457 | tScanResultHandle hBssListIn, tANI_U32 *pRoamId) |
| 6458 | { |
| 6459 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6460 | tScanResultHandle hBSSList; |
| 6461 | tCsrScanResultFilter *pScanFilter; |
| 6462 | tANI_U32 roamId = 0; |
| 6463 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_FALSE; |
| 6464 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6465 | if (NULL == pProfile) |
| 6466 | { |
| 6467 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6468 | return eHAL_STATUS_FAILURE; |
| 6469 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6470 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6471 | pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6472 | if( CSR_IS_WDS( pProfile ) && |
| 6473 | !HAL_STATUS_SUCCESS( status = csrIsBTAMPAllowed( pMac, pProfile->operationChannel ) ) ) |
| 6474 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6475 | 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] | 6476 | pProfile->operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6477 | return status; |
| 6478 | } |
| 6479 | csrRoamCancelRoaming(pMac, sessionId); |
| 6480 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6481 | csrScanCancelIdleScan(pMac); |
| 6482 | //Only abort the scan if it is not used for other roam/connect purpose |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6483 | csrScanAbortMacScan(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6484 | if (!vos_concurrent_sessions_running() && (VOS_STA_SAP_MODE == pProfile->csrPersona))//In case of AP mode we do not want idle mode scan |
| 6485 | { |
| 6486 | csrScanDisable(pMac); |
| 6487 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6488 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6489 | //Check whether ssid changes |
| 6490 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6491 | { |
| 6492 | if(pProfile->SSIDs.numOfSSIDs && !csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6493 | { |
| 6494 | csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6495 | } |
| 6496 | } |
| 6497 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 6498 | pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; |
| 6499 | #endif |
| 6500 | if(CSR_INVALID_SCANRESULT_HANDLE != hBssListIn) |
| 6501 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6502 | smsLog(pMac, LOG1, FL("is called with BSSList")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6503 | status = csrRoamConnectWithBSSList(pMac, sessionId, pProfile, hBssListIn, pRoamId); |
| 6504 | if(pRoamId) |
| 6505 | { |
| 6506 | roamId = *pRoamId; |
| 6507 | } |
| 6508 | if(!HAL_STATUS_SUCCESS(status)) |
| 6509 | { |
| 6510 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6511 | } |
| 6512 | } |
| 6513 | else |
| 6514 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6515 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 6516 | if ( NULL == pScanFilter ) |
| 6517 | status = eHAL_STATUS_FAILURE; |
| 6518 | else |
| 6519 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6520 | if(HAL_STATUS_SUCCESS(status)) |
| 6521 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6522 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6523 | //Try to connect to any BSS |
| 6524 | if(NULL == pProfile) |
| 6525 | { |
| 6526 | //No encryption |
| 6527 | pScanFilter->EncryptionType.numEntries = 1; |
| 6528 | pScanFilter->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_NONE; |
| 6529 | }//we don't have a profile |
| 6530 | else |
| 6531 | { |
| 6532 | //Here is the profile we need to connect to |
| 6533 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6534 | }//We have a profile |
| 6535 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6536 | if(pRoamId) |
| 6537 | { |
| 6538 | *pRoamId = roamId; |
| 6539 | } |
| 6540 | |
| 6541 | if(HAL_STATUS_SUCCESS(status)) |
| 6542 | { |
| 6543 | /*Save the WPS info*/ |
| 6544 | if(NULL != pProfile) |
| 6545 | { |
| 6546 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
| 6547 | } |
| 6548 | else |
| 6549 | { |
| 6550 | pScanFilter->bWPSAssociation = 0; |
| 6551 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6552 | do |
| 6553 | { |
| 6554 | if( (pProfile && CSR_IS_WDS_AP( pProfile ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6555 | || (pProfile && CSR_IS_INFRA_AP ( pProfile )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6556 | ) |
| 6557 | { |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6558 | //This can be started right away |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6559 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6560 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6561 | if(!HAL_STATUS_SUCCESS(status)) |
| 6562 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6563 | 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] | 6564 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6565 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6566 | else |
| 6567 | { |
| 6568 | smsLog(pMac, LOG1, FL("Connect request to proceed for AMP/SoftAP mode")); |
| 6569 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6570 | break; |
| 6571 | } |
| 6572 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6573 | smsLog(pMac, LOG1, "************ csrScanGetResult Status ********* %d", status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6574 | if(HAL_STATUS_SUCCESS(status)) |
| 6575 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6576 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6577 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6578 | if(!HAL_STATUS_SUCCESS(status)) |
| 6579 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6580 | 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] | 6581 | csrScanResultPurge(pMac, hBSSList); |
| 6582 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6583 | } |
| 6584 | }//Have scan result |
| 6585 | else if(NULL != pProfile) |
| 6586 | { |
| 6587 | //Check whether it is for start ibss |
| 6588 | if(CSR_IS_START_IBSS(pProfile)) |
| 6589 | { |
| 6590 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, NULL, eCsrHddIssued, |
| 6591 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6592 | if(!HAL_STATUS_SUCCESS(status)) |
| 6593 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6594 | 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] | 6595 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6596 | } |
| 6597 | } |
| 6598 | else |
| 6599 | { |
| 6600 | //scan for this SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6601 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6602 | if(!HAL_STATUS_SUCCESS(status)) |
| 6603 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6604 | 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] | 6605 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6606 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6607 | else |
| 6608 | { |
| 6609 | smsLog(pMac, LOG1, FL("SSID scan requested for Infra connect req")); |
| 6610 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6611 | } |
| 6612 | } |
| 6613 | else |
| 6614 | { |
| 6615 | fCallCallback = eANI_BOOLEAN_TRUE; |
| 6616 | } |
| 6617 | } while (0); |
| 6618 | if(NULL != pProfile) |
| 6619 | { |
| 6620 | //we need to free memory for filter if profile exists |
| 6621 | csrFreeScanFilter(pMac, pScanFilter); |
| 6622 | } |
| 6623 | }//Got the scan filter from profile |
| 6624 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6625 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6626 | }//allocated memory for pScanFilter |
| 6627 | }//No Bsslist coming in |
| 6628 | //tell the caller if we fail to trigger a join request |
| 6629 | if( fCallCallback ) |
| 6630 | { |
| 6631 | csrRoamCallCallback(pMac, sessionId, NULL, roamId, eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6632 | } |
| 6633 | |
| 6634 | return (status); |
| 6635 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6636 | eHalStatus csrRoamReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 6637 | tCsrRoamModifyProfileFields modProfileFields, |
| 6638 | tANI_U32 *pRoamId) |
| 6639 | { |
| 6640 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6641 | tANI_BOOLEAN fCallCallback = eANI_BOOLEAN_TRUE; |
| 6642 | tANI_U32 roamId = 0; |
| 6643 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6644 | if (NULL == pProfile) |
| 6645 | { |
| 6646 | smsLog(pMac, LOGP, FL("No profile specified")); |
| 6647 | return eHAL_STATUS_FAILURE; |
| 6648 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6649 | smsLog(pMac, LOG1, FL("called BSSType = %d authtype = %d encryType = %d"), pProfile->BSSType, pProfile->AuthType.authType[0], pProfile->EncryptionType.encryptionType[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6650 | csrRoamCancelRoaming(pMac, sessionId); |
| 6651 | csrScanRemoveFreshScanCommand(pMac, sessionId); |
| 6652 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6653 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6654 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssuedReassocToSameAP); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6655 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6656 | { |
| 6657 | if(pProfile) |
| 6658 | { |
| 6659 | if(pProfile->SSIDs.numOfSSIDs && |
| 6660 | csrIsSsidInList(pMac, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) |
| 6661 | { |
| 6662 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6663 | } |
| 6664 | else |
| 6665 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6666 | 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] | 6667 | } |
| 6668 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6669 | else if (!vos_mem_compare(&modProfileFields, |
| 6670 | &pSession->connectedProfile.modifyProfileFields, |
| 6671 | sizeof(tCsrRoamModifyProfileFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6672 | { |
| 6673 | fCallCallback = eANI_BOOLEAN_FALSE; |
| 6674 | } |
| 6675 | else |
| 6676 | { |
| 6677 | 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] | 6678 | "in tCsrRoamModifyProfileFields got modified")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6679 | } |
| 6680 | } |
| 6681 | else |
| 6682 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6683 | smsLog(pMac, LOG1, FL("Not connected! No need to reassoc")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6684 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6685 | if(!fCallCallback) |
| 6686 | { |
| 6687 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6688 | if(pRoamId) |
| 6689 | { |
| 6690 | *pRoamId = roamId; |
| 6691 | } |
| 6692 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6693 | status = csrRoamIssueReassoc(pMac, sessionId, pProfile, &modProfileFields, |
| 6694 | eCsrHddIssuedReassocToSameAP, roamId, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6695 | } |
| 6696 | else |
| 6697 | { |
| 6698 | status = csrRoamCallCallback(pMac, sessionId, NULL, roamId, |
| 6699 | eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); |
| 6700 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6701 | return status; |
| 6702 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6703 | eHalStatus csrRoamJoinLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6704 | { |
| 6705 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6706 | tScanResultHandle hBSSList = NULL; |
| 6707 | tCsrScanResultFilter *pScanFilter = NULL; |
| 6708 | tANI_U32 roamId; |
| 6709 | tCsrRoamProfile *pProfile = NULL; |
| 6710 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 6711 | |
| 6712 | if(!pSession) |
| 6713 | { |
| 6714 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 6715 | return eHAL_STATUS_FAILURE; |
| 6716 | } |
| 6717 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6718 | do |
| 6719 | { |
| 6720 | if(pSession->pCurRoamProfile) |
| 6721 | { |
| 6722 | csrScanCancelIdleScan(pMac); |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 6723 | csrScanAbortMacScanNotForConnect(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6724 | //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] | 6725 | pProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 6726 | if ( NULL == pProfile ) |
| 6727 | status = eHAL_STATUS_FAILURE; |
| 6728 | else |
| 6729 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6730 | if(!HAL_STATUS_SUCCESS(status)) |
| 6731 | break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6732 | vos_mem_set(pProfile, sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6733 | status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6734 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6735 | break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6736 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 6737 | if ( NULL == pScanFilter ) |
| 6738 | status = eHAL_STATUS_FAILURE; |
| 6739 | else |
| 6740 | status = eHAL_STATUS_SUCCESS; |
| 6741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6742 | if(!HAL_STATUS_SUCCESS(status)) |
| 6743 | { |
| 6744 | break; |
| 6745 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6746 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6747 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile, pScanFilter); |
| 6748 | if(!HAL_STATUS_SUCCESS(status)) |
| 6749 | { |
| 6750 | break; |
| 6751 | } |
| 6752 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 6753 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 6754 | if(HAL_STATUS_SUCCESS(status)) |
| 6755 | { |
| 6756 | //we want to put the last connected BSS to the very beginning, if possible |
| 6757 | csrMoveBssToHeadFromBSSID(pMac, &pSession->connectedProfile.bssid, hBSSList); |
| 6758 | status = csrRoamIssueConnect(pMac, sessionId, pProfile, hBSSList, eCsrHddIssued, |
| 6759 | roamId, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE); |
| 6760 | if(!HAL_STATUS_SUCCESS(status)) |
| 6761 | { |
| 6762 | csrScanResultPurge(pMac, hBSSList); |
| 6763 | break; |
| 6764 | } |
| 6765 | } |
| 6766 | else |
| 6767 | { |
| 6768 | //Do a scan on this profile |
| 6769 | //scan for this SSID only in case the AP suppresses SSID |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 6770 | status = csrScanForSSID(pMac, sessionId, pProfile, roamId, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6771 | if(!HAL_STATUS_SUCCESS(status)) |
| 6772 | { |
| 6773 | break; |
| 6774 | } |
| 6775 | } |
| 6776 | }//We have a profile |
| 6777 | else |
| 6778 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6779 | smsLog(pMac, LOGW, FL("cannot find a roaming profile")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6780 | break; |
| 6781 | } |
| 6782 | }while(0); |
| 6783 | if(pScanFilter) |
| 6784 | { |
| 6785 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6786 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6787 | } |
| 6788 | if(NULL != pProfile) |
| 6789 | { |
| 6790 | csrReleaseProfile(pMac, pProfile); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 6791 | vos_mem_free(pProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6792 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6793 | return (status); |
| 6794 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6795 | eHalStatus csrRoamReconnect(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6796 | { |
| 6797 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6798 | if(csrIsConnStateConnected(pMac, sessionId)) |
| 6799 | { |
| 6800 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6801 | if(HAL_STATUS_SUCCESS(status)) |
| 6802 | { |
| 6803 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6804 | } |
| 6805 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6806 | return (status); |
| 6807 | } |
| 6808 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6809 | eHalStatus csrRoamConnectToLastProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6810 | { |
| 6811 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6812 | smsLog(pMac, LOGW, FL("is called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6813 | csrRoamCancelRoaming(pMac, sessionId); |
| 6814 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrHddIssued); |
| 6815 | if(csrIsConnStateDisconnected(pMac, sessionId)) |
| 6816 | { |
| 6817 | status = csrRoamJoinLastProfile(pMac, sessionId); |
| 6818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6819 | return (status); |
| 6820 | } |
| 6821 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6822 | eHalStatus csrRoamProcessDisassocDeauth( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fDisassoc, tANI_BOOLEAN fMICFailure ) |
| 6823 | { |
| 6824 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6825 | tANI_BOOLEAN fComplete = eANI_BOOLEAN_FALSE; |
| 6826 | eCsrRoamSubState NewSubstate; |
| 6827 | tANI_U32 sessionId = pCommand->sessionId; |
| 6828 | |
| 6829 | // change state to 'Roaming'... |
| 6830 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId ); |
| 6831 | |
| 6832 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 6833 | { |
| 6834 | // If we are in an IBSS, then stop the IBSS... |
| 6835 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6836 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6837 | } |
| 6838 | else if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6839 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6840 | 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] | 6841 | pMac->roam.ucACWeights[2], pMac->roam.ucACWeights[3]); |
| 6842 | //Restore AC weight in case we change it |
| 6843 | WLANTL_SetACWeights(pMac->roam.gVosContext, pMac->roam.ucACWeights); |
| 6844 | // in Infrasturcture, we need to disassociate from the Infrastructure network... |
| 6845 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_FORCED; |
| 6846 | if(eCsrSmeIssuedDisassocForHandoff == pCommand->u.roamCmd.roamReason) |
| 6847 | { |
| 6848 | NewSubstate = eCSR_ROAM_SUBSTATE_DISASSOC_HANDOFF; |
| 6849 | } |
| 6850 | if( fDisassoc ) |
| 6851 | { |
| 6852 | status = csrRoamIssueDisassociate( pMac, sessionId, NewSubstate, fMICFailure ); |
| 6853 | } |
| 6854 | else |
| 6855 | { |
| 6856 | status = csrRoamIssueDeauth( pMac, sessionId, eCSR_ROAM_SUBSTATE_DEAUTH_REQ ); |
| 6857 | } |
| 6858 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6859 | } |
| 6860 | else if ( csrIsConnStateWds( pMac, sessionId ) ) |
| 6861 | { |
| 6862 | if( CSR_IS_WDS_AP( &pMac->roam.roamSession[sessionId].connectedProfile ) ) |
| 6863 | { |
| 6864 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
| 6865 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6866 | } |
| 6867 | //This has to be WDS station |
| 6868 | else if( csrIsConnStateConnectedWds( pMac, sessionId ) ) //This has to be WDS station |
| 6869 | { |
| 6870 | |
| 6871 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 6872 | if( fDisassoc ) |
| 6873 | { |
| 6874 | status = csrRoamIssueDisassociate( pMac, sessionId, |
| 6875 | eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, fMICFailure ); |
| 6876 | fComplete = (!HAL_STATUS_SUCCESS(status)); |
| 6877 | } |
| 6878 | } |
| 6879 | } else { |
| 6880 | // we got a dis-assoc request while not connected to any peer |
| 6881 | // just complete the command |
| 6882 | fComplete = eANI_BOOLEAN_TRUE; |
| 6883 | status = eHAL_STATUS_FAILURE; |
| 6884 | } |
| 6885 | if(fComplete) |
| 6886 | { |
| 6887 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 6888 | } |
| 6889 | |
| 6890 | if(HAL_STATUS_SUCCESS(status)) |
| 6891 | { |
| 6892 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 6893 | { |
| 6894 | //Set the state to disconnect here |
| 6895 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 6896 | } |
| 6897 | } |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 6898 | else |
| 6899 | { |
| 6900 | smsLog(pMac, LOGW, FL(" failed with status %d"), status); |
| 6901 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6902 | return (status); |
| 6903 | } |
| 6904 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6905 | /* This is been removed from latest code base */ |
| 6906 | /* |
| 6907 | static eHalStatus csrRoamProcessStopBss( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 6908 | { |
| 6909 | eHalStatus status; |
| 6910 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6911 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING ); |
| 6912 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6913 | return ( status ); |
| 6914 | } |
| 6915 | */ |
| 6916 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6917 | eHalStatus csrRoamIssueDisassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason ) |
| 6918 | { |
| 6919 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6920 | tSmeCmd *pCommand; |
| 6921 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6922 | do |
| 6923 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 6924 | smsLog( pMac, LOG1, FL(" reason = %d"), reason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6925 | pCommand = csrGetCommandBuffer( pMac ); |
| 6926 | if ( !pCommand ) |
| 6927 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6928 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6929 | status = eHAL_STATUS_RESOURCES; |
| 6930 | break; |
| 6931 | } |
| 6932 | //Change the substate in case it is wait-for-key |
| 6933 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 6934 | { |
| 6935 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6936 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6937 | } |
| 6938 | pCommand->command = eSmeCommandRoam; |
| 6939 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6940 | switch ( reason ) |
| 6941 | { |
| 6942 | case eCSR_DISCONNECT_REASON_MIC_ERROR: |
| 6943 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassocMICFailure; |
| 6944 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6945 | case eCSR_DISCONNECT_REASON_DEAUTH: |
| 6946 | pCommand->u.roamCmd.roamReason = eCsrForcedDeauth; |
| 6947 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6948 | case eCSR_DISCONNECT_REASON_HANDOFF: |
| 6949 | fHighPriority = eANI_BOOLEAN_TRUE; |
| 6950 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedDisassocForHandoff; |
| 6951 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6952 | case eCSR_DISCONNECT_REASON_UNSPECIFIED: |
| 6953 | case eCSR_DISCONNECT_REASON_DISASSOC: |
| 6954 | pCommand->u.roamCmd.roamReason = eCsrForcedDisassoc; |
| 6955 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6956 | case eCSR_DISCONNECT_REASON_IBSS_JOIN_FAILURE: |
| 6957 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedIbssJoinFailure; |
| 6958 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6959 | case eCSR_DISCONNECT_REASON_IBSS_LEAVE: |
| 6960 | pCommand->u.roamCmd.roamReason = eCsrForcedIbssLeave; |
| 6961 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6962 | default: |
| 6963 | break; |
| 6964 | } |
| 6965 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6966 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6967 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6968 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6969 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6970 | } |
| 6971 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6972 | return( status ); |
| 6973 | } |
| 6974 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6975 | eHalStatus csrRoamIssueStopBssCmd( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN fHighPriority ) |
| 6976 | { |
| 6977 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6978 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6979 | pCommand = csrGetCommandBuffer( pMac ); |
| 6980 | if ( NULL != pCommand ) |
| 6981 | { |
| 6982 | //Change the substate in case it is wait-for-key |
| 6983 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 6984 | { |
| 6985 | csrRoamStopWaitForKeyTimer( pMac ); |
| 6986 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 6987 | } |
| 6988 | pCommand->command = eSmeCommandRoam; |
| 6989 | pCommand->sessionId = (tANI_U8)sessionId; |
| 6990 | pCommand->u.roamCmd.roamReason = eCsrStopBss; |
| 6991 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 6992 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6993 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6994 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6995 | csrReleaseCommandRoam( pMac, pCommand ); |
| 6996 | } |
| 6997 | } |
| 6998 | else |
| 6999 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7000 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7001 | status = eHAL_STATUS_RESOURCES; |
| 7002 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7003 | return ( status ); |
| 7004 | } |
| 7005 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7006 | eHalStatus csrRoamDisconnectInternal(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 7007 | { |
| 7008 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7009 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7010 | |
| 7011 | if(!pSession) |
| 7012 | { |
| 7013 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7014 | return eHAL_STATUS_FAILURE; |
| 7015 | } |
| 7016 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7017 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 7018 | //Stop te retry |
| 7019 | pSession->maxRetryCount = 0; |
| 7020 | csrRoamStopJoinRetryTimer(pMac, sessionId); |
| 7021 | #endif |
| 7022 | //Not to call cancel roaming here |
| 7023 | //Only issue disconnect when necessary |
| 7024 | if(csrIsConnStateConnected(pMac, sessionId) || csrIsBssTypeIBSS(pSession->connectedProfile.BSSType) |
| 7025 | || csrIsBssTypeWDS(pSession->connectedProfile.BSSType) |
| 7026 | || csrIsRoamCommandWaitingForSession(pMac, sessionId) ) |
| 7027 | |
| 7028 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7029 | smsLog(pMac, LOG2, FL("called")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7030 | status = csrRoamIssueDisassociateCmd(pMac, sessionId, reason); |
| 7031 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7032 | return (status); |
| 7033 | } |
| 7034 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7035 | eHalStatus csrRoamDisconnect(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamDisconnectReason reason) |
| 7036 | { |
| 7037 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7038 | |
| 7039 | if(!pSession) |
| 7040 | { |
| 7041 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7042 | return eHAL_STATUS_FAILURE; |
| 7043 | } |
| 7044 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7045 | csrRoamCancelRoaming(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7046 | csrRoamRemoveDuplicateCommand(pMac, sessionId, NULL, eCsrForcedDisassoc); |
| 7047 | |
| 7048 | return (csrRoamDisconnectInternal(pMac, sessionId, reason)); |
| 7049 | } |
| 7050 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7051 | eHalStatus csrRoamSaveConnectedInfomation(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 7052 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes) |
| 7053 | { |
| 7054 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7055 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 7056 | tANI_U8 index; |
| 7057 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 7058 | tCsrRoamConnectedProfile *pConnectProfile = &pSession->connectedProfile; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7059 | |
| 7060 | if(!pSession) |
| 7061 | { |
| 7062 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7063 | return eHAL_STATUS_FAILURE; |
| 7064 | } |
Madan Mohan Koyyalamudi | d02b594 | 2013-07-19 18:35:59 +0800 | [diff] [blame] | 7065 | if(pConnectProfile->pAddIEAssoc) |
| 7066 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7067 | vos_mem_free(pConnectProfile->pAddIEAssoc); |
Madan Mohan Koyyalamudi | d02b594 | 2013-07-19 18:35:59 +0800 | [diff] [blame] | 7068 | pConnectProfile->pAddIEAssoc = NULL; |
| 7069 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7070 | vos_mem_set(&pSession->connectedProfile, sizeof(tCsrRoamConnectedProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7071 | pConnectProfile->AuthType = pProfile->negotiatedAuthType; |
| 7072 | pConnectProfile->AuthInfo = pProfile->AuthType; |
| 7073 | pConnectProfile->CBMode = pProfile->CBMode; //*** this may not be valid |
| 7074 | pConnectProfile->EncryptionType = pProfile->negotiatedUCEncryptionType; |
| 7075 | pConnectProfile->EncryptionInfo = pProfile->EncryptionType; |
| 7076 | pConnectProfile->mcEncryptionType = pProfile->negotiatedMCEncryptionType; |
| 7077 | pConnectProfile->mcEncryptionInfo = pProfile->mcEncryptionType; |
| 7078 | pConnectProfile->BSSType = pProfile->BSSType; |
| 7079 | pConnectProfile->modifyProfileFields.uapsd_mask = pProfile->uapsd_mask; |
| 7080 | pConnectProfile->operationChannel = pSirBssDesc->channelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7081 | pConnectProfile->beaconInterval = pSirBssDesc->beaconInterval; |
| 7082 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7083 | vos_mem_copy(&pConnectProfile->Keys, &pProfile->Keys, sizeof(tCsrKeys)); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 7084 | /* saving the addional IE`s like Hot spot indication element and extended capabilities */ |
| 7085 | if(pProfile->nAddIEAssocLength) |
| 7086 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7087 | pConnectProfile->pAddIEAssoc = vos_mem_malloc(pProfile->nAddIEAssocLength); |
| 7088 | if ( NULL == pConnectProfile->pAddIEAssoc ) |
| 7089 | status = eHAL_STATUS_FAILURE; |
| 7090 | else |
| 7091 | status = eHAL_STATUS_SUCCESS; |
| 7092 | if (!HAL_STATUS_SUCCESS(status)) |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 7093 | { |
| 7094 | smsLog(pMac, LOGE, FL("Failed to allocate memory for additional IEs")) ; |
| 7095 | return eHAL_STATUS_FAILURE; |
| 7096 | } |
| 7097 | pConnectProfile->nAddIEAssocLength = pProfile->nAddIEAssocLength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7098 | vos_mem_copy(pConnectProfile->pAddIEAssoc, pProfile->pAddIEAssoc, |
| 7099 | pProfile->nAddIEAssocLength); |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 7100 | } |
| 7101 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7102 | //Save bssid |
| 7103 | csrGetBssIdBssDesc(pMac, pSirBssDesc, &pConnectProfile->bssid); |
| 7104 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7105 | if (pSirBssDesc->mdiePresent) |
| 7106 | { |
| 7107 | pConnectProfile->MDID.mdiePresent = 1; |
| 7108 | pConnectProfile->MDID.mobilityDomain = (pSirBssDesc->mdie[1] << 8) | (pSirBssDesc->mdie[0]); |
| 7109 | } |
| 7110 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | d48e327 | 2013-04-12 14:21:07 -0700 | [diff] [blame] | 7111 | if( NULL == pIesTemp ) |
| 7112 | { |
| 7113 | status = csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp); |
| 7114 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7115 | #ifdef FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7116 | if ((csrIsProfileCCX(pProfile) || |
| 7117 | ((pIesTemp->CCXVersion.present) |
| 7118 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
| 7119 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 7120 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 7121 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 7122 | #ifdef WLAN_FEATURE_11W |
| 7123 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 7124 | #endif |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 7125 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7126 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7127 | { |
| 7128 | pConnectProfile->isCCXAssoc = 1; |
| 7129 | } |
| 7130 | #endif |
| 7131 | //save ssid |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7132 | if(HAL_STATUS_SUCCESS(status)) |
| 7133 | { |
| 7134 | if(pIesTemp->SSID.present) |
| 7135 | { |
| 7136 | pConnectProfile->SSID.length = pIesTemp->SSID.num_ssid; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7137 | vos_mem_copy(pConnectProfile->SSID.ssId, pIesTemp->SSID.ssid, |
| 7138 | pIesTemp->SSID.num_ssid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7139 | } |
| 7140 | |
| 7141 | //Save the bss desc |
| 7142 | status = csrRoamSaveConnectedBssDesc(pMac, sessionId, pSirBssDesc); |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 7143 | |
| 7144 | if( CSR_IS_QOS_BSS(pIesTemp) || pIesTemp->HTCaps.present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7145 | { |
Pratik Bhalgat | b5b19b0 | 2012-11-22 16:28:19 +0530 | [diff] [blame] | 7146 | //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] | 7147 | pConnectProfile->qap = TRUE; |
| 7148 | } |
| 7149 | else |
| 7150 | { |
| 7151 | pConnectProfile->qap = FALSE; |
| 7152 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7153 | if ( NULL == pIes ) |
| 7154 | { |
| 7155 | //Free memory if it allocated locally |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7156 | vos_mem_free(pIesTemp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7157 | } |
| 7158 | } |
| 7159 | //Save Qos connection |
| 7160 | pConnectProfile->qosConnection = pMac->roam.roamSession[sessionId].fWMMConnection; |
| 7161 | |
| 7162 | if(!HAL_STATUS_SUCCESS(status)) |
| 7163 | { |
| 7164 | csrFreeConnectBssDesc(pMac, sessionId); |
| 7165 | } |
| 7166 | for(index = 0; index < pProfile->SSIDs.numOfSSIDs; index++) |
| 7167 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7168 | if ((pProfile->SSIDs.SSIDList[index].SSID.length == pConnectProfile->SSID.length) && |
| 7169 | vos_mem_compare(pProfile->SSIDs.SSIDList[index].SSID.ssId, |
| 7170 | pConnectProfile->SSID.ssId, |
| 7171 | pConnectProfile->SSID.length)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7172 | { |
| 7173 | pConnectProfile->handoffPermitted = pProfile->SSIDs.SSIDList[index].handoffPermitted; |
| 7174 | break; |
| 7175 | } |
| 7176 | pConnectProfile->handoffPermitted = FALSE; |
| 7177 | } |
| 7178 | |
| 7179 | return (status); |
| 7180 | } |
| 7181 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7182 | static void csrRoamJoinRspProcessor( tpAniSirGlobal pMac, tSirSmeJoinRsp *pSmeJoinRsp ) |
| 7183 | { |
| 7184 | tListElem *pEntry = NULL; |
| 7185 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7186 | //The head of the active list is the request we sent |
| 7187 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7188 | if(pEntry) |
| 7189 | { |
| 7190 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7191 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7192 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 7193 | { |
| 7194 | if(pCommand && eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason) |
| 7195 | { |
| 7196 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 7197 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 7198 | #endif |
| 7199 | } |
| 7200 | csrRoamComplete( pMac, eCsrJoinSuccess, (void *)pSmeJoinRsp ); |
| 7201 | } |
| 7202 | else |
| 7203 | { |
| 7204 | tANI_U32 roamId = 0; |
| 7205 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pSmeJoinRsp->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7206 | if(!pSession) |
| 7207 | { |
| 7208 | smsLog(pMac, LOGE, FL(" session %d not found "), pSmeJoinRsp->sessionId); |
| 7209 | return; |
| 7210 | } |
| 7211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7212 | |
| 7213 | //The head of the active list is the request we sent |
| 7214 | //Try to get back the same profile and roam again |
| 7215 | if(pCommand) |
| 7216 | { |
| 7217 | roamId = pCommand->u.roamCmd.roamId; |
| 7218 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7219 | pSession->joinFailStatusCode.statusCode = pSmeJoinRsp->statusCode; |
| 7220 | pSession->joinFailStatusCode.reasonCode = pSmeJoinRsp->protStatusCode; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7221 | smsLog( pMac, LOGW, "SmeJoinReq failed with statusCode= 0x%08lX [%d]", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7222 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7223 | /* If Join fails while Handoff is in progress, indicate disassociated event to supplicant to reconnect */ |
| 7224 | if (csrRoamIsHandoffInProgress(pMac)) |
| 7225 | { |
| 7226 | csrRoamCallCallback(pMac, pSmeJoinRsp->sessionId, NULL, roamId, eCSR_ROAM_DISASSOCIATED, eCSR_ROAM_RESULT_FORCED); |
| 7227 | /* Should indicate neighbor roam algorithm about the connect failure here */ |
| 7228 | csrNeighborRoamIndicateConnect(pMac, pSmeJoinRsp->sessionId, VOS_STATUS_E_FAILURE); |
| 7229 | } |
| 7230 | #endif |
| 7231 | if (pCommand) |
| 7232 | { |
| 7233 | if(CSR_IS_WDS_STA( &pCommand->u.roamCmd.roamProfile )) |
| 7234 | { |
| 7235 | pCommand->u.roamCmd.fStopWds = eANI_BOOLEAN_TRUE; |
| 7236 | pSession->connectedProfile.BSSType = eCSR_BSS_TYPE_WDS_STA; |
| 7237 | csrRoamReissueRoamCommand(pMac); |
| 7238 | } |
| 7239 | else if( CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) ) |
| 7240 | { |
| 7241 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7242 | } |
| 7243 | else |
| 7244 | { |
| 7245 | csrRoam(pMac, pCommand); |
| 7246 | } |
| 7247 | } |
| 7248 | else |
| 7249 | { |
| 7250 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7251 | } |
| 7252 | } /*else: ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) */ |
| 7253 | } |
| 7254 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7255 | eHalStatus csrRoamIssueJoin( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 7256 | tDot11fBeaconIEs *pIes, |
| 7257 | tCsrRoamProfile *pProfile, tANI_U32 roamId ) |
| 7258 | { |
| 7259 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7260 | smsLog( pMac, LOG1, "Attempting to Join Bssid= %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7261 | pSirBssDesc->bssId[ 0 ],pSirBssDesc->bssId[ 1 ],pSirBssDesc->bssId[ 2 ], |
| 7262 | pSirBssDesc->bssId[ 3 ],pSirBssDesc->bssId[ 4 ],pSirBssDesc->bssId[ 5 ] ); |
| 7263 | |
| 7264 | // Set the roaming substate to 'join attempt'... |
| 7265 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_JOIN_REQ, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7266 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 7267 | status = csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_JOIN_REQ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7268 | return (status); |
| 7269 | } |
| 7270 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7271 | static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pSirBssDesc, |
| 7272 | tDot11fBeaconIEs *pIes, tCsrRoamProfile *pProfile) |
| 7273 | { |
| 7274 | csrRoamStateChange( pMac, eCSR_ROAMING_STATE_JOINING, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7275 | // Set the roaming substate to 'join attempt'... |
| 7276 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_REASSOC_REQ, sessionId ); |
| 7277 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7278 | smsLog(pMac, LOGE, FL(" calling csrSendJoinReqMsg (eWNI_SME_REASSOC_REQ)")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7279 | |
| 7280 | // attempt to Join this BSS... |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 7281 | return csrSendJoinReqMsg( pMac, sessionId, pSirBssDesc, pProfile, pIes, eWNI_SME_REASSOC_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7282 | } |
| 7283 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7284 | void csrRoamReissueRoamCommand(tpAniSirGlobal pMac) |
| 7285 | { |
| 7286 | tListElem *pEntry; |
| 7287 | tSmeCmd *pCommand; |
| 7288 | tCsrRoamInfo roamInfo; |
| 7289 | tANI_U32 sessionId; |
| 7290 | tCsrRoamSession *pSession; |
| 7291 | |
| 7292 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7293 | if(pEntry) |
| 7294 | { |
| 7295 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7296 | if ( eSmeCommandRoam == pCommand->command ) |
| 7297 | { |
| 7298 | sessionId = pCommand->sessionId; |
| 7299 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7300 | |
| 7301 | if(!pSession) |
| 7302 | { |
| 7303 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7304 | return; |
| 7305 | } |
| 7306 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7307 | if( pCommand->u.roamCmd.fStopWds ) |
| 7308 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7309 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7310 | roamInfo.pBssDesc = pCommand->u.roamCmd.pLastRoamBss; |
| 7311 | roamInfo.statusCode = pSession->joinFailStatusCode.statusCode; |
| 7312 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7313 | if (CSR_IS_WDS(&pSession->connectedProfile)){ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7314 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED; |
| 7315 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 7316 | eCSR_ROAM_WDS_IND, |
| 7317 | eCSR_ROAM_RESULT_WDS_DISASSOCIATED); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7318 | }else if (CSR_IS_INFRA_AP(&pSession->connectedProfile)){ |
| 7319 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED; |
| 7320 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.roamCmd.roamId, |
| 7321 | eCSR_ROAM_INFRA_IND, |
| 7322 | eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
| 7323 | } |
| 7324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7325 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7326 | if( !HAL_STATUS_SUCCESS( csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_STOP_BSS_REQ ) ) ) |
| 7327 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7328 | 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] | 7329 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7330 | } |
| 7331 | } |
| 7332 | else if(eCsrStopRoaming == csrRoamJoinNextBss(pMac, pCommand, eANI_BOOLEAN_TRUE)) |
| 7333 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7334 | smsLog(pMac, LOGW, " Failed to reissue join command after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7335 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7336 | } |
| 7337 | } |
| 7338 | else |
| 7339 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7340 | smsLog(pMac, LOGW, " Command is not roaming after disassociated"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7341 | } |
| 7342 | } |
| 7343 | else |
| 7344 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7345 | smsLog(pMac, LOGE, " Disassoc rsp cannot continue because no command is available"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7346 | } |
| 7347 | } |
| 7348 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7349 | tANI_BOOLEAN csrIsRoamCommandWaitingForSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 7350 | { |
| 7351 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7352 | tListElem *pEntry; |
| 7353 | tSmeCmd *pCommand = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7354 | //alwasy lock active list before locking pending list |
| 7355 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7356 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7357 | if(pEntry) |
| 7358 | { |
| 7359 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7360 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7361 | { |
| 7362 | fRet = eANI_BOOLEAN_TRUE; |
| 7363 | } |
| 7364 | } |
| 7365 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7366 | { |
| 7367 | csrLLLock(&pMac->sme.smeCmdPendingList); |
| 7368 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK); |
| 7369 | while(pEntry) |
| 7370 | { |
| 7371 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7372 | if( ( eSmeCommandRoam == pCommand->command ) && ( sessionId == pCommand->sessionId ) ) |
| 7373 | { |
| 7374 | fRet = eANI_BOOLEAN_TRUE; |
| 7375 | break; |
| 7376 | } |
| 7377 | pEntry = csrLLNext(&pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK); |
| 7378 | } |
| 7379 | csrLLUnlock(&pMac->sme.smeCmdPendingList); |
| 7380 | } |
| 7381 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7382 | return (fRet); |
| 7383 | } |
| 7384 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7385 | tANI_BOOLEAN csrIsRoamCommandWaiting(tpAniSirGlobal pMac) |
| 7386 | { |
| 7387 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7388 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7389 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 7390 | { |
| 7391 | if( CSR_IS_SESSION_VALID( pMac, i ) && ( fRet = csrIsRoamCommandWaitingForSession( pMac, i ) ) ) |
| 7392 | { |
| 7393 | break; |
| 7394 | } |
| 7395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7396 | return ( fRet ); |
| 7397 | } |
| 7398 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7399 | tANI_BOOLEAN csrIsCommandWaiting(tpAniSirGlobal pMac) |
| 7400 | { |
| 7401 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7402 | //alwasy lock active list before locking pending list |
| 7403 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7404 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7405 | if(eANI_BOOLEAN_FALSE == fRet) |
| 7406 | { |
| 7407 | fRet = csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK); |
| 7408 | } |
| 7409 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7410 | return (fRet); |
| 7411 | } |
| 7412 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7413 | tANI_BOOLEAN csrIsScanForRoamCommandActive( tpAniSirGlobal pMac ) |
| 7414 | { |
| 7415 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 7416 | tListElem *pEntry; |
| 7417 | tCsrCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7418 | //alwasy lock active list before locking pending list |
| 7419 | csrLLLock( &pMac->sme.smeCmdActiveList ); |
| 7420 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK); |
| 7421 | if( pEntry ) |
| 7422 | { |
| 7423 | pCommand = GET_BASE_ADDR(pEntry, tCsrCmd, Link); |
| 7424 | if( ( eCsrRoamCommandScan == pCommand->command ) && |
| 7425 | ( ( eCsrScanForSsid == pCommand->u.scanCmd.reason ) || |
| 7426 | ( eCsrScanForCapsChange == pCommand->u.scanCmd.reason ) || |
| 7427 | ( eCsrScanP2PFindPeer == pCommand->u.scanCmd.reason ) ) ) |
| 7428 | { |
| 7429 | fRet = eANI_BOOLEAN_TRUE; |
| 7430 | } |
| 7431 | } |
| 7432 | csrLLUnlock( &pMac->sme.smeCmdActiveList ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7433 | return (fRet); |
| 7434 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7435 | eHalStatus csrRoamIssueReassociateCmd( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 7436 | { |
| 7437 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7438 | tSmeCmd *pCommand = NULL; |
| 7439 | tANI_BOOLEAN fHighPriority = eANI_BOOLEAN_TRUE; |
| 7440 | tANI_BOOLEAN fRemoveCmd = FALSE; |
| 7441 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7442 | // Delete the old assoc command. All is setup for reassoc to be serialized |
| 7443 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7444 | if ( pEntry ) |
| 7445 | { |
| 7446 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 7447 | if ( !pCommand ) |
| 7448 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7449 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7450 | return eHAL_STATUS_RESOURCES; |
| 7451 | } |
| 7452 | if ( eSmeCommandRoam == pCommand->command ) |
| 7453 | { |
| 7454 | if (pCommand->u.roamCmd.roamReason == eCsrSmeIssuedAssocToSimilarAP) |
| 7455 | { |
| 7456 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7457 | } |
| 7458 | else |
| 7459 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7460 | smsLog( pMac, LOGE, FL(" Unexpected active roam command present ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7461 | } |
| 7462 | if (fRemoveCmd == FALSE) |
| 7463 | { |
| 7464 | // Implies we did not get the serialized assoc command we |
| 7465 | // were expecting |
| 7466 | pCommand = NULL; |
| 7467 | } |
| 7468 | } |
| 7469 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7470 | if(NULL == pCommand) |
| 7471 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7472 | 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] | 7473 | return eHAL_STATUS_RESOURCES; |
| 7474 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7475 | do |
| 7476 | { |
| 7477 | //Change the substate in case it is wait-for-key |
| 7478 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 7479 | { |
| 7480 | csrRoamStopWaitForKeyTimer( pMac ); |
| 7481 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId ); |
| 7482 | } |
| 7483 | pCommand->command = eSmeCommandRoam; |
| 7484 | pCommand->sessionId = (tANI_U8)sessionId; |
| 7485 | pCommand->u.roamCmd.roamReason = eCsrSmeIssuedFTReassoc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7486 | status = csrQueueSmeCommand(pMac, pCommand, fHighPriority); |
| 7487 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 7488 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7489 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7490 | csrReleaseCommandRoam( pMac, pCommand ); |
| 7491 | } |
| 7492 | } while( 0 ); |
| 7493 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7494 | return( status ); |
| 7495 | } |
| 7496 | static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result ) |
| 7497 | { |
| 7498 | tListElem *pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 7499 | tCsrScanResult *pScanResult = NULL; |
| 7500 | tSirBssDescription *pBssDesc = NULL; |
| 7501 | tSmeCmd *pCommand = NULL; |
| 7502 | tANI_U32 sessionId; |
| 7503 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7504 | if(NULL == pEntry) |
| 7505 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7506 | smsLog(pMac, LOGW, " CFG_CNF with active list empty"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7507 | return; |
| 7508 | } |
| 7509 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 7510 | sessionId = pCommand->sessionId; |
| 7511 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7512 | |
| 7513 | if(!pSession) |
| 7514 | { |
| 7515 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7516 | return; |
| 7517 | } |
| 7518 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7519 | if(CSR_IS_ROAMING(pSession) && pSession->fCancelRoaming) |
| 7520 | { |
| 7521 | //the roaming is cancelled. Simply complete the command |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7522 | smsLog(pMac, LOGW, FL(" Roam command cancelled")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7523 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7524 | } |
Venkata Prathyusha Kuntupalli | 239278b | 2013-03-26 15:58:18 -0700 | [diff] [blame] | 7525 | /* If the roaming has stopped, not to continue the roaming command*/ |
| 7526 | else if ( !CSR_IS_ROAMING(pSession) && CSR_IS_ROAMING_COMMAND(pCommand) ) |
| 7527 | { |
| 7528 | //No need to complete roaming here as it already completes |
| 7529 | smsLog(pMac, LOGW, FL(" Roam command (reason %d) aborted due to roaming completed\n"), |
| 7530 | pCommand->u.roamCmd.roamReason); |
| 7531 | csrSetAbortRoamingCommand( pMac, pCommand ); |
| 7532 | csrRoamComplete(pMac, eCsrNothingToJoin, NULL); |
| 7533 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7534 | else |
| 7535 | { |
| 7536 | if ( CCM_IS_RESULT_SUCCESS(result) ) |
| 7537 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7538 | smsLog(pMac, LOG2, "Cfg sequence complete"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7539 | // Successfully set the configuration parameters for the new Bss. Attempt to |
| 7540 | // join the roaming Bss. |
| 7541 | if(pCommand->u.roamCmd.pRoamBssEntry) |
| 7542 | { |
| 7543 | pScanResult = GET_BASE_ADDR(pCommand->u.roamCmd.pRoamBssEntry, tCsrScanResult, Link); |
| 7544 | pBssDesc = &pScanResult->Result.BssDescriptor; |
| 7545 | } |
| 7546 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) || |
| 7547 | CSR_IS_WDS( &pCommand->u.roamCmd.roamProfile ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7548 | || CSR_IS_INFRA_AP(&pCommand->u.roamCmd.roamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7549 | ) |
| 7550 | { |
| 7551 | if(!HAL_STATUS_SUCCESS(csrRoamIssueStartBss( pMac, sessionId, |
| 7552 | &pSession->bssParams, &pCommand->u.roamCmd.roamProfile, |
| 7553 | pBssDesc, pCommand->u.roamCmd.roamId ))) |
| 7554 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7555 | smsLog(pMac, LOGW, " CSR start BSS failed"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7556 | //We need to complete the command |
| 7557 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7558 | } |
| 7559 | } |
| 7560 | else |
| 7561 | { |
| 7562 | if (!pCommand->u.roamCmd.pRoamBssEntry) |
| 7563 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7564 | smsLog(pMac, LOGW, " pRoamBssEntry is NULL"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7565 | //We need to complete the command |
| 7566 | csrRoamComplete(pMac, eCsrJoinFailure, NULL); |
| 7567 | return; |
| 7568 | } |
| 7569 | // If we are roaming TO an Infrastructure BSS... |
| 7570 | VOS_ASSERT(pScanResult != NULL); |
| 7571 | if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7572 | { |
| 7573 | tDot11fBeaconIEs *pIesLocal = (tDot11fBeaconIEs *)pScanResult->Result.pvIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7574 | if(pIesLocal || (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) ) |
| 7575 | { |
| 7576 | // ..and currently in an Infrastructure connection.... |
| 7577 | if( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 7578 | { |
| 7579 | // ...and the SSIDs are equal, then we Reassoc. |
| 7580 | if ( csrIsSsidEqual( pMac, pSession->pConnectBssDesc, pBssDesc, |
| 7581 | pIesLocal ) ) |
| 7582 | // ..and currently in an infrastructure connection |
| 7583 | { |
| 7584 | // then issue a Reassoc. |
| 7585 | pCommand->u.roamCmd.fReassoc = eANI_BOOLEAN_TRUE; |
| 7586 | csrRoamIssueReassociate( pMac, sessionId, pBssDesc, pIesLocal, |
| 7587 | &pCommand->u.roamCmd.roamProfile ); |
| 7588 | } |
| 7589 | else |
| 7590 | { |
| 7591 | |
| 7592 | // otherwise, we have to issue a new Join request to LIM because we disassociated from the |
| 7593 | // previously associated AP. |
| 7594 | if(!HAL_STATUS_SUCCESS(csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7595 | pIesLocal, |
| 7596 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ))) |
| 7597 | { |
| 7598 | //try something else |
| 7599 | csrRoam( pMac, pCommand ); |
| 7600 | } |
| 7601 | } |
| 7602 | } |
| 7603 | else |
| 7604 | { |
| 7605 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 7606 | |
| 7607 | /* We need to come with other way to figure out that this is because of HO in BMP |
| 7608 | The below API will be only available for Android as it uses a different HO algorithm */ |
| 7609 | /* Reassoc request will be used only for CCX and 11r handoff whereas other legacy roaming should |
| 7610 | * use join request */ |
| 7611 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7612 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7613 | csrRoamIs11rAssoc(pMac)) |
| 7614 | { |
| 7615 | status = csrRoamIssueReassociate(pMac, sessionId, pBssDesc, |
| 7616 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), &pCommand->u.roamCmd.roamProfile); |
| 7617 | } |
| 7618 | else |
| 7619 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7620 | #ifdef FEATURE_WLAN_CCX |
| 7621 | if (csrRoamIsHandoffInProgress(pMac) && |
| 7622 | csrRoamIsCCXAssoc(pMac)) |
| 7623 | { |
| 7624 | // Now serialize the reassoc command. |
| 7625 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7626 | } |
| 7627 | else |
| 7628 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7629 | #ifdef FEATURE_WLAN_LFR |
| 7630 | if (csrRoamIsHandoffInProgress(pMac) && |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 7631 | csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7632 | { |
| 7633 | // Now serialize the reassoc command. |
| 7634 | status = csrRoamIssueReassociateCmd(pMac, sessionId); |
| 7635 | } |
| 7636 | else |
| 7637 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7638 | // else we are not connected and attempting to Join. Issue the |
| 7639 | // Join request. |
| 7640 | { |
| 7641 | status = csrRoamIssueJoin( pMac, sessionId, pBssDesc, |
| 7642 | (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ), |
| 7643 | &pCommand->u.roamCmd.roamProfile, pCommand->u.roamCmd.roamId ); |
| 7644 | } |
| 7645 | if(!HAL_STATUS_SUCCESS(status)) |
| 7646 | { |
| 7647 | //try something else |
| 7648 | csrRoam( pMac, pCommand ); |
| 7649 | } |
| 7650 | } |
| 7651 | if( !pScanResult->Result.pvIes ) |
| 7652 | { |
| 7653 | //Locally allocated |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7654 | vos_mem_free(pIesLocal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7655 | } |
| 7656 | } |
| 7657 | }//if ( csrIsInfraBssDesc( pBssDesc ) ) |
| 7658 | else |
| 7659 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7660 | smsLog(pMac, LOGW, FL(" found BSSType mismatching the one in BSS description")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7661 | } |
| 7662 | }//else |
| 7663 | }//if ( WNI_CFG_SUCCESS == result ) |
| 7664 | else |
| 7665 | { |
| 7666 | // In the event the configuration failed, for infra let the roam processor |
| 7667 | //attempt to join something else... |
| 7668 | if( pCommand->u.roamCmd.pRoamBssEntry && CSR_IS_INFRASTRUCTURE( &pCommand->u.roamCmd.roamProfile ) ) |
| 7669 | { |
| 7670 | csrRoam(pMac, pCommand); |
| 7671 | } |
| 7672 | else |
| 7673 | { |
| 7674 | //We need to complete the command |
| 7675 | if ( csrIsBssTypeIBSS( pCommand->u.roamCmd.roamProfile.BSSType ) ) |
| 7676 | { |
| 7677 | csrRoamComplete(pMac, eCsrStartBssFailure, NULL); |
| 7678 | } |
| 7679 | else |
| 7680 | { |
| 7681 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7682 | } |
| 7683 | } |
| 7684 | } |
| 7685 | }//we have active entry |
| 7686 | } |
| 7687 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7688 | static void csrRoamRoamingStateAuthRspProcessor( tpAniSirGlobal pMac, tSirSmeAuthRsp *pSmeAuthRsp ) |
| 7689 | { |
| 7690 | //No one is sending eWNI_SME_AUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7691 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7692 | if ( eSIR_SME_SUCCESS == pSmeAuthRsp->statusCode ) |
| 7693 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7694 | smsLog( pMac, LOGW, "CSR SmeAuthReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7695 | // Successfully authenticated with a new Bss. Attempt to stop the current Bss and |
| 7696 | // join the new one... |
| 7697 | /***pBssDesc = profGetRoamingBssDesc( pAdapter, &pHddProfile ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7698 | roamStopNetwork( pAdapter, &pBssDesc->SirBssDescription );***/ |
| 7699 | } |
| 7700 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7701 | smsLog( pMac, LOGW, "CSR SmeAuthReq failed with statusCode= 0x%08lX [%d]", pSmeAuthRsp->statusCode, pSmeAuthRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7702 | /***profHandleLostLinkAfterReset(pAdapter); |
| 7703 | // In the event the authenticate fails, let the roam processor attempt to join something else... |
| 7704 | roamRoam( pAdapter );***/ |
| 7705 | } |
| 7706 | } |
| 7707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7708 | static void csrRoamRoamingStateReassocRspProcessor( tpAniSirGlobal pMac, tpSirSmeJoinRsp pSmeJoinRsp ) |
| 7709 | { |
| 7710 | eCsrRoamCompleteResult result; |
| 7711 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 7712 | tCsrRoamInfo roamInfo; |
| 7713 | tANI_U32 roamId = 0; |
| 7714 | |
| 7715 | if ( eSIR_SME_SUCCESS == pSmeJoinRsp->statusCode ) |
| 7716 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7717 | smsLog( pMac, LOGW, "CSR SmeReassocReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7718 | result = eCsrReassocSuccess; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7719 | /* Defeaturize this part later if needed */ |
| 7720 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7721 | /* Since the neighbor roam algorithm uses reassoc req for handoff instead of join, |
| 7722 | * we need the response contents while processing the result in csrRoamProcessResults() */ |
| 7723 | if (csrRoamIsHandoffInProgress(pMac)) |
| 7724 | { |
| 7725 | /* Need to dig more on indicating events to SME QoS module */ |
| 7726 | sme_QosCsrEventInd(pMac, pSmeJoinRsp->sessionId, SME_QOS_CSR_HANDOFF_COMPLETE, NULL); |
| 7727 | csrRoamComplete( pMac, result, pSmeJoinRsp); |
| 7728 | } |
| 7729 | else |
| 7730 | #endif |
| 7731 | { |
| 7732 | csrRoamComplete( pMac, result, NULL ); |
| 7733 | } |
| 7734 | } |
| 7735 | /* Should we handle this similar to handling the join failure? Is it ok |
| 7736 | * to call csrRoamComplete() with state as CsrJoinFailure */ |
| 7737 | else |
| 7738 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7739 | smsLog( pMac, LOGW, "CSR SmeReassocReq failed with statusCode= 0x%08lX [%d]", pSmeJoinRsp->statusCode, pSmeJoinRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7740 | result = eCsrReassocFailure; |
| 7741 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 7742 | if ((eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE == pSmeJoinRsp->statusCode) || |
| 7743 | (eSIR_SME_FT_REASSOC_FAILURE == pSmeJoinRsp->statusCode)) |
| 7744 | { |
| 7745 | // Inform HDD to turn off FT flag in HDD |
| 7746 | if (pNeighborRoamInfo) |
| 7747 | { |
| 7748 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7749 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, |
| 7750 | &roamInfo, roamId, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
Madan Mohan Koyyalamudi | 5777216 | 2012-10-18 19:46:14 -0700 | [diff] [blame] | 7751 | /* |
| 7752 | * Since the above callback sends a disconnect |
| 7753 | * to HDD, we should clean-up our state |
| 7754 | * machine as well to be in sync with the upper |
| 7755 | * layers. There is no need to send a disassoc |
| 7756 | * since: 1) we will never reassoc to the current |
| 7757 | * AP in LFR, and 2) there is no need to issue a |
| 7758 | * disassoc to the AP with which we were trying |
| 7759 | * to reassoc. |
| 7760 | */ |
| 7761 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7762 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7763 | } |
| 7764 | } |
| 7765 | #endif |
| 7766 | // In the event that the Reassociation fails, then we need to Disassociate the current association and keep |
| 7767 | // roaming. Note that we will attempt to Join the AP instead of a Reassoc since we may have attempted a |
| 7768 | // 'Reassoc to self', which AP's that don't support Reassoc will force a Disassoc. |
| 7769 | //The disassoc rsp message will remove the command from active list |
| 7770 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate( pMac, pSmeJoinRsp->sessionId, |
| 7771 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE ))) |
| 7772 | { |
| 7773 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 7774 | } |
| 7775 | } |
| 7776 | } |
| 7777 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7778 | static void csrRoamRoamingStateStopBssRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSmeRsp) |
| 7779 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7780 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 7781 | { |
| 7782 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7783 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 7784 | if(pIbssLog) |
| 7785 | { |
| 7786 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_RSP; |
| 7787 | if(eSIR_SME_SUCCESS != pSmeRsp->statusCode) |
| 7788 | { |
| 7789 | pIbssLog->status = WLAN_IBSS_STATUS_FAILURE; |
| 7790 | } |
| 7791 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 7792 | } |
| 7793 | } |
| 7794 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7795 | pMac->roam.roamSession[pSmeRsp->sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7796 | if(CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ( pMac, pSmeRsp->sessionId)) |
| 7797 | { |
| 7798 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7799 | } |
| 7800 | else if(CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId)) |
| 7801 | { |
| 7802 | csrRoamReissueRoamCommand(pMac); |
| 7803 | } |
| 7804 | } |
| 7805 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7806 | void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeRsp ) |
| 7807 | { |
| 7808 | tSirResultCodes statusCode; |
| 7809 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 7810 | tScanResultHandle hBSSList; |
| 7811 | tANI_BOOLEAN fCallCallback, fRemoveCmd; |
| 7812 | eHalStatus status; |
| 7813 | tCsrRoamInfo roamInfo; |
| 7814 | tCsrScanResultFilter *pScanFilter = NULL; |
| 7815 | tANI_U32 roamId = 0; |
| 7816 | tCsrRoamProfile *pCurRoamProfile = NULL; |
| 7817 | tListElem *pEntry = NULL; |
| 7818 | tSmeCmd *pCommand = NULL; |
| 7819 | #endif |
| 7820 | tANI_U32 sessionId; |
| 7821 | tCsrRoamSession *pSession; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7822 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7823 | tSirSmeDisassocRsp SmeDisassocRsp; |
| 7824 | |
| 7825 | csrSerDesUnpackDiassocRsp((tANI_U8 *)pSmeRsp, &SmeDisassocRsp); |
| 7826 | sessionId = SmeDisassocRsp.sessionId; |
| 7827 | statusCode = SmeDisassocRsp.statusCode; |
| 7828 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7829 | smsLog( pMac, LOG2, "csrRoamRoamingStateDisassocRspProcessor sessionId %d", sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7830 | |
| 7831 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 7832 | { |
| 7833 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 7834 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7835 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 7836 | |
| 7837 | if(!pSession) |
| 7838 | { |
| 7839 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 7840 | return; |
| 7841 | } |
| 7842 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7843 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, sessionId ) ) |
| 7844 | { |
| 7845 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7846 | } |
| 7847 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, sessionId ) || |
| 7848 | CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, sessionId ) ) |
| 7849 | { |
| 7850 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 7851 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7852 | smsLog( pMac, LOG2, "CSR SmeDisassocReq force disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7853 | //A callback to HDD will be issued from csrRoamComplete so no need to do anything here |
| 7854 | } |
| 7855 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 7856 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7857 | else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId ) ) |
| 7858 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7859 | smsLog( pMac, LOGE, "CSR SmeDisassocReq due to HO on session %d", sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7860 | #if defined (WLAN_FEATURE_NEIGHBOR_ROAMING) |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7861 | /* |
| 7862 | * First ensure if the roam profile is in the scan cache. |
| 7863 | * If not, post a reassoc failure and disconnect. |
| 7864 | */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7865 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 7866 | if ( NULL == pScanFilter ) |
| 7867 | status = eHAL_STATUS_FAILURE; |
| 7868 | else |
| 7869 | status = eHAL_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7870 | if(HAL_STATUS_SUCCESS(status)) |
| 7871 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7872 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7873 | status = csrRoamPrepareFilterFromProfile(pMac, |
| 7874 | &pMac->roam.neighborRoamInfo.csrNeighborRoamProfile, pScanFilter); |
| 7875 | if(!HAL_STATUS_SUCCESS(status)) |
| 7876 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7877 | 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] | 7878 | __func__, status); |
| 7879 | goto POST_ROAM_FAILURE; |
| 7880 | } |
| 7881 | else |
| 7882 | { |
| 7883 | status = csrScanGetResult(pMac, pScanFilter, &hBSSList); |
| 7884 | if (!HAL_STATUS_SUCCESS(status)) |
| 7885 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7886 | smsLog( pMac, LOGE,"%s: csrScanGetResult failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7887 | __func__, status); |
| 7888 | goto POST_ROAM_FAILURE; |
| 7889 | } |
| 7890 | } |
| 7891 | } |
| 7892 | else |
| 7893 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7894 | smsLog( pMac, LOGE,"%s: alloc for pScanFilter failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7895 | __func__, status); |
| 7896 | goto POST_ROAM_FAILURE; |
| 7897 | } |
| 7898 | |
| 7899 | /* |
| 7900 | * After ensuring that the roam profile is in the scan result list, |
| 7901 | * dequeue the command from the active list. |
| 7902 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7903 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 7904 | if ( pEntry ) |
| 7905 | { |
| 7906 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7907 | /* If the head of the queue is Active and it is a ROAM command, remove |
| 7908 | * and put this on the Free queue. |
| 7909 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7910 | if ( eSmeCommandRoam == pCommand->command ) |
| 7911 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7912 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7913 | /* |
| 7914 | * we need to process the result first before removing it from active list |
| 7915 | * because state changes still happening insides roamQProcessRoamResults so |
| 7916 | * no other roam command should be issued. |
| 7917 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7918 | fRemoveCmd = csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ); |
| 7919 | if(pCommand->u.roamCmd.fReleaseProfile) |
| 7920 | { |
| 7921 | csrReleaseProfile(pMac, &pCommand->u.roamCmd.roamProfile); |
| 7922 | pCommand->u.roamCmd.fReleaseProfile = eANI_BOOLEAN_FALSE; |
| 7923 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7924 | if( fRemoveCmd ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7925 | csrReleaseCommandRoam( pMac, pCommand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7926 | else |
| 7927 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7928 | smsLog( pMac, LOGE, "%s: fail to remove cmd reason %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7929 | __func__, pCommand->u.roamCmd.roamReason ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7930 | } |
| 7931 | } |
| 7932 | else |
| 7933 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7934 | smsLog( pMac, LOGE, "%s: roam command not active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7935 | } |
| 7936 | } |
| 7937 | else |
| 7938 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7939 | smsLog( pMac, LOGE, "%s: NO commands are active", __func__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7940 | } |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7941 | |
| 7942 | /* Notify HDD about handoff and provide the BSSID too */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7943 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 7944 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7945 | vos_mem_copy(roamInfo.bssid, |
| 7946 | pMac->roam.neighborRoamInfo.csrNeighborRoamProfile.BSSIDs.bssid, |
| 7947 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7948 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7949 | csrRoamCallCallback(pMac,sessionId, &roamInfo, 0, |
| 7950 | eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7951 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7952 | /* 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] | 7953 | pCurRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 7954 | if ( pCurRoamProfile != NULL ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7955 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7956 | vos_mem_set(pCurRoamProfile, sizeof(tCsrRoamProfile), 0); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7957 | csrRoamCopyProfile(pMac, pCurRoamProfile, pSession->pCurRoamProfile); |
| 7958 | //make sure to put it at the head of the cmd queue |
| 7959 | status = csrRoamIssueConnect(pMac, sessionId, pCurRoamProfile, |
| 7960 | hBSSList, eCsrSmeIssuedAssocToSimilarAP, |
| 7961 | roamId, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_FALSE); |
| 7962 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7963 | if(!HAL_STATUS_SUCCESS(status)) |
| 7964 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 7965 | smsLog( pMac, LOGE,"%s: csrRoamIssueConnect failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7966 | __func__, status); |
| 7967 | fCallCallback = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7968 | } |
| 7969 | |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7970 | /* Notify sub-modules like QoS etc. that handoff happening */ |
| 7971 | sme_QosCsrEventInd(pMac, sessionId, SME_QOS_CSR_HANDOFF_ASSOC_REQ, NULL); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 7972 | csrReleaseProfile(pMac, pCurRoamProfile); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7973 | vos_mem_free(pCurRoamProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7974 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7975 | vos_mem_free(pScanFilter); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7976 | return; |
| 7977 | } |
| 7978 | |
| 7979 | POST_ROAM_FAILURE: |
| 7980 | if (pScanFilter) |
| 7981 | { |
| 7982 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7983 | vos_mem_free(pScanFilter); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7984 | } |
| 7985 | if (pCurRoamProfile) |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 7986 | vos_mem_free(pCurRoamProfile); |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 7987 | |
| 7988 | /* Inform the upper layers that the reassoc failed */ |
| 7989 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 7990 | csrRoamCallCallback(pMac, sessionId, |
| 7991 | &roamInfo, 0, eCSR_ROAM_FT_REASSOC_FAILED, eSIR_SME_SUCCESS); |
| 7992 | |
| 7993 | /* |
| 7994 | * Issue a disassoc request so that PE/LIM uses this to clean-up the FT session. |
| 7995 | * Upon success, we would re-enter this routine after receiving the disassoc |
| 7996 | * response and will fall into the reassoc fail sub-state. And, eventually |
| 7997 | * call csrRoamComplete which would remove the roam command from SME active |
| 7998 | * queue. |
| 7999 | */ |
| 8000 | if (!HAL_STATUS_SUCCESS(csrRoamIssueDisassociate(pMac, sessionId, |
| 8001 | eCSR_ROAM_SUBSTATE_DISASSOC_REASSOC_FAILURE, FALSE))) |
| 8002 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8003 | smsLog( pMac, LOGE,"%s: csrRoamIssueDisassociate failed with status %d", |
Madan Mohan Koyyalamudi | 397f085 | 2012-11-27 16:27:38 -0800 | [diff] [blame] | 8004 | __func__, status); |
| 8005 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8006 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8007 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8008 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8009 | } //else if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac ) ) |
| 8010 | else if ( CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, sessionId ) ) |
| 8011 | { |
| 8012 | // Disassoc due to Reassoc failure falls into this codepath.... |
| 8013 | csrRoamComplete( pMac, eCsrJoinFailure, NULL ); |
| 8014 | } |
| 8015 | else |
| 8016 | { |
| 8017 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 8018 | { |
| 8019 | // Successfully disassociated from the 'old' Bss... |
| 8020 | // |
| 8021 | // We get Disassociate response in three conditions. |
| 8022 | // - First is the case where we are disasociating from an Infra Bss to start an IBSS. |
| 8023 | // - Second is the when we are disassociating from an Infra Bss to join an IBSS or a new |
| 8024 | // Infrastructure network. |
| 8025 | // - Third is where we are doing an Infra to Infra roam between networks with different |
| 8026 | // SSIDs. In all cases, we set the new Bss configuration here and attempt to join |
| 8027 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8028 | smsLog( pMac, LOG2, "CSR SmeDisassocReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8029 | } |
| 8030 | else |
| 8031 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8032 | smsLog( pMac, LOGE, "SmeDisassocReq failed with statusCode= 0x%08lX", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8033 | } |
| 8034 | //We are not done yet. Get the data and continue roaming |
| 8035 | csrRoamReissueRoamCommand(pMac); |
| 8036 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8037 | } |
| 8038 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8039 | static void csrRoamRoamingStateDeauthRspProcessor( tpAniSirGlobal pMac, tSirSmeDeauthRsp *pSmeRsp ) |
| 8040 | { |
| 8041 | tSirResultCodes statusCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8042 | //No one is sending eWNI_SME_DEAUTH_REQ to PE. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8043 | smsLog(pMac, LOGW, FL("is no-op")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8044 | statusCode = csrGetDeAuthRspStatusCode( pSmeRsp ); |
| 8045 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 8046 | { |
| 8047 | csrRoamComplete( pMac, eCsrNothingToJoin, NULL ); |
| 8048 | } |
| 8049 | else |
| 8050 | { |
| 8051 | if ( eSIR_SME_SUCCESS == statusCode ) |
| 8052 | { |
| 8053 | // Successfully deauth from the 'old' Bss... |
| 8054 | // |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8055 | smsLog( pMac, LOG2, "CSR SmeDeauthReq disassociated Successfully" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8056 | } |
| 8057 | else |
| 8058 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8059 | smsLog( pMac, LOGW, "SmeDeauthReq failed with statusCode= 0x%08lX", statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8060 | } |
| 8061 | //We are not done yet. Get the data and continue roaming |
| 8062 | csrRoamReissueRoamCommand(pMac); |
| 8063 | } |
| 8064 | } |
| 8065 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8066 | static void csrRoamRoamingStateStartBssRspProcessor( tpAniSirGlobal pMac, tSirSmeStartBssRsp *pSmeStartBssRsp ) |
| 8067 | { |
| 8068 | eCsrRoamCompleteResult result; |
| 8069 | |
| 8070 | if ( eSIR_SME_SUCCESS == pSmeStartBssRsp->statusCode ) |
| 8071 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8072 | smsLog( pMac, LOGW, "SmeStartBssReq Successful" ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8073 | result = eCsrStartBssSuccess; |
| 8074 | } |
| 8075 | else |
| 8076 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8077 | smsLog( pMac, LOGW, "SmeStartBssReq failed with statusCode= 0x%08lX", pSmeStartBssRsp->statusCode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8078 | //Let csrRoamComplete decide what to do |
| 8079 | result = eCsrStartBssFailure; |
| 8080 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8081 | csrRoamComplete( pMac, result, pSmeStartBssRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8082 | } |
| 8083 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8084 | /* |
| 8085 | We need to be careful on whether to cast pMsgBuf (pSmeRsp) to other type of strucutres. |
| 8086 | It depends on how the message is constructed. If the message is sent by limSendSmeRsp, |
| 8087 | the pMsgBuf is only a generic response and can only be used as pointer to tSirSmeRsp. |
| 8088 | For the messages where sender allocates memory for specific structures, then it can be |
| 8089 | cast accordingly. |
| 8090 | */ |
| 8091 | void csrRoamingStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 8092 | { |
| 8093 | tSirSmeRsp *pSmeRsp; |
| 8094 | tSmeIbssPeerInd *pIbssPeerInd; |
| 8095 | tCsrRoamInfo roamInfo; |
| 8096 | // TODO Session Id need to be acquired in this function |
| 8097 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8098 | pSmeRsp = (tSirSmeRsp *)pMsgBuf; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8099 | smsLog( pMac, LOG2, "Message %d[0x%04X] received in substate %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8100 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 8101 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8102 | pSmeRsp->messageType = (pSmeRsp->messageType); |
| 8103 | pSmeRsp->length = (pSmeRsp->length); |
| 8104 | pSmeRsp->statusCode = (pSmeRsp->statusCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8105 | switch (pSmeRsp->messageType) |
| 8106 | { |
| 8107 | |
| 8108 | case eWNI_SME_JOIN_RSP: // in Roaming state, process the Join response message... |
| 8109 | if (CSR_IS_ROAM_SUBSTATE_JOIN_REQ(pMac, pSmeRsp->sessionId)) |
| 8110 | { |
| 8111 | //We sent a JOIN_REQ |
| 8112 | csrRoamJoinRspProcessor( pMac, (tSirSmeJoinRsp *)pSmeRsp ); |
| 8113 | } |
| 8114 | break; |
| 8115 | |
| 8116 | case eWNI_SME_AUTH_RSP: // or the Authenticate response message... |
| 8117 | if (CSR_IS_ROAM_SUBSTATE_AUTH_REQ( pMac, pSmeRsp->sessionId) ) |
| 8118 | { |
| 8119 | //We sent a AUTH_REQ |
| 8120 | csrRoamRoamingStateAuthRspProcessor( pMac, (tSirSmeAuthRsp *)pSmeRsp ); |
| 8121 | } |
| 8122 | break; |
| 8123 | |
| 8124 | case eWNI_SME_REASSOC_RSP: // or the Reassociation response message... |
| 8125 | if (CSR_IS_ROAM_SUBSTATE_REASSOC_REQ( pMac, pSmeRsp->sessionId) ) |
| 8126 | { |
| 8127 | csrRoamRoamingStateReassocRspProcessor( pMac, (tpSirSmeJoinRsp )pSmeRsp ); |
| 8128 | } |
| 8129 | break; |
| 8130 | |
| 8131 | case eWNI_SME_STOP_BSS_RSP: // or the Stop Bss response message... |
| 8132 | { |
| 8133 | csrRoamRoamingStateStopBssRspProcessor(pMac, pSmeRsp); |
| 8134 | } |
| 8135 | break; |
| 8136 | |
| 8137 | case eWNI_SME_DISASSOC_RSP: // or the Disassociate response message... |
| 8138 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ( pMac, pSmeRsp->sessionId ) || |
| 8139 | CSR_IS_ROAM_SUBSTATE_DISASSOC_NO_JOIN( pMac, pSmeRsp->sessionId ) || |
| 8140 | CSR_IS_ROAM_SUBSTATE_REASSOC_FAIL( pMac, pSmeRsp->sessionId ) || |
| 8141 | CSR_IS_ROAM_SUBSTATE_DISASSOC_FORCED( pMac, pSmeRsp->sessionId ) || |
| 8142 | CSR_IS_ROAM_SUBSTATE_DISCONNECT_CONTINUE( pMac, pSmeRsp->sessionId ) || |
| 8143 | //HO |
| 8144 | CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, pSmeRsp->sessionId ) ) |
| 8145 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8146 | smsLog(pMac, LOG1, FL("eWNI_SME_DISASSOC_RSP subState = %d"), pMac->roam.curSubState[pSmeRsp->sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8147 | csrRoamRoamingStateDisassocRspProcessor( pMac, (tSirSmeDisassocRsp *)pSmeRsp ); |
| 8148 | } |
| 8149 | break; |
| 8150 | |
| 8151 | case eWNI_SME_DEAUTH_RSP: // or the Deauthentication response message... |
| 8152 | if ( CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ( pMac, pSmeRsp->sessionId ) ) |
| 8153 | { |
| 8154 | csrRoamRoamingStateDeauthRspProcessor( pMac, (tSirSmeDeauthRsp *)pSmeRsp ); |
| 8155 | } |
| 8156 | break; |
| 8157 | |
| 8158 | case eWNI_SME_START_BSS_RSP: // or the Start BSS response message... |
| 8159 | if (CSR_IS_ROAM_SUBSTATE_START_BSS_REQ( pMac, pSmeRsp->sessionId ) ) |
| 8160 | { |
| 8161 | csrRoamRoamingStateStartBssRspProcessor( pMac, (tSirSmeStartBssRsp *)pSmeRsp ); |
| 8162 | } |
| 8163 | break; |
| 8164 | |
| 8165 | case WNI_CFG_SET_CNF: // process the Config Confirm messages when we are in 'Config' substate... |
| 8166 | if ( CSR_IS_ROAM_SUBSTATE_CONFIG( pMac, pSmeRsp->sessionId ) ) |
| 8167 | { |
| 8168 | csrRoamingStateConfigCnfProcessor( pMac, ((tCsrCfgSetRsp *)pSmeRsp)->respStatus ); |
| 8169 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8170 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8171 | //In case CSR issues STOP_BSS, we need to tell HDD about peer departed becasue PE is removing them |
| 8172 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 8173 | pIbssPeerInd = (tSmeIbssPeerInd*)pSmeRsp; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8174 | smsLog(pMac, LOGE, "CSR: Peer departed notification from LIM in joining state"); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8175 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
| 8176 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8177 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 8178 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8179 | vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, |
| 8180 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8181 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 8182 | eCSR_ROAM_CONNECT_STATUS_UPDATE, |
| 8183 | eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 8184 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8185 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8186 | smsLog( pMac, LOG1, "Unexpected message type = %d[0x%X] received in substate %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8187 | pSmeRsp->messageType, pSmeRsp->messageType, |
| 8188 | pMac->roam.curSubState[pSmeRsp->sessionId] ); |
| 8189 | |
| 8190 | //If we are connected, check the link status change |
| 8191 | if(!csrIsConnStateDisconnected(pMac, sessionId)) |
| 8192 | { |
| 8193 | csrRoamCheckForLinkStatusChange( pMac, pSmeRsp ); |
| 8194 | } |
| 8195 | break; |
| 8196 | } |
| 8197 | } |
| 8198 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8199 | void csrRoamJoinedStateMsgProcessor( tpAniSirGlobal pMac, void *pMsgBuf ) |
| 8200 | { |
| 8201 | tSirSmeRsp *pSirMsg = (tSirSmeRsp *)pMsgBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8202 | switch (pSirMsg->messageType) |
| 8203 | { |
| 8204 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8205 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8206 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 8207 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8208 | case eWNI_SME_UPPER_LAYER_ASSOC_CNF: |
| 8209 | { |
| 8210 | tCsrRoamSession *pSession; |
| 8211 | tSirSmeAssocIndToUpperLayerCnf *pUpperLayerAssocCnf; |
| 8212 | tCsrRoamInfo roamInfo; |
| 8213 | tCsrRoamInfo *pRoamInfo = NULL; |
| 8214 | tANI_U32 sessionId; |
| 8215 | eHalStatus status; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8216 | smsLog( pMac, LOG1, FL("ASSOCIATION confirmation can be given to upper layer ")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8217 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8218 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8219 | pUpperLayerAssocCnf = (tSirSmeAssocIndToUpperLayerCnf *)pMsgBuf; |
| 8220 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pUpperLayerAssocCnf->bssId, &sessionId ); |
| 8221 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 8222 | |
| 8223 | if(!pSession) |
| 8224 | { |
| 8225 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 8226 | return; |
| 8227 | } |
| 8228 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8229 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 8230 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8231 | pRoamInfo->staId = (tANI_U8)pUpperLayerAssocCnf->aid; |
| 8232 | pRoamInfo->rsnIELen = (tANI_U8)pUpperLayerAssocCnf->rsnIE.length; |
| 8233 | pRoamInfo->prsnIE = pUpperLayerAssocCnf->rsnIE.rsnIEdata; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8234 | pRoamInfo->addIELen = (tANI_U8)pUpperLayerAssocCnf->addIE.length; |
| 8235 | pRoamInfo->paddIE = pUpperLayerAssocCnf->addIE.addIEdata; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8236 | vos_mem_copy(pRoamInfo->peerMac, pUpperLayerAssocCnf->peerMacAddr, |
| 8237 | sizeof(tSirMacAddr)); |
| 8238 | vos_mem_copy(&pRoamInfo->bssid, pUpperLayerAssocCnf->bssId, |
| 8239 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8240 | pRoamInfo->wmmEnabledSta = pUpperLayerAssocCnf->wmmEnabledSta; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8241 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) ) |
| 8242 | { |
| 8243 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED; |
| 8244 | pRoamInfo->fReassocReq = pUpperLayerAssocCnf->reassocReq; |
| 8245 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 8246 | } |
| 8247 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 8248 | { |
| 8249 | vos_sleep( 100 ); |
| 8250 | pMac->roam.roamSession[sessionId].connectState = eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED;//Sta |
| 8251 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_WDS_IND, eCSR_ROAM_RESULT_WDS_ASSOCIATION_IND);//Sta |
| 8252 | } |
| 8253 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8254 | } |
| 8255 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8256 | default: |
| 8257 | csrRoamCheckForLinkStatusChange( pMac, pSirMsg ); |
| 8258 | break; |
| 8259 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8260 | } |
| 8261 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8262 | eHalStatus csrRoamIssueSetContextReq( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrEncryptionType EncryptType, |
| 8263 | tSirBssDescription *pBssDescription, |
| 8264 | tSirMacAddr *bssId, tANI_BOOLEAN addKey, |
| 8265 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 8266 | tANI_U8 keyId, tANI_U16 keyLength, |
| 8267 | tANI_U8 *pKey, tANI_U8 paeRole ) |
| 8268 | { |
| 8269 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8270 | tAniEdType edType; |
| 8271 | |
| 8272 | if(eCSR_ENCRYPT_TYPE_UNKNOWN == EncryptType) |
| 8273 | { |
| 8274 | EncryptType = eCSR_ENCRYPT_TYPE_NONE; //*** |
| 8275 | } |
| 8276 | |
| 8277 | edType = csrTranslateEncryptTypeToEdType( EncryptType ); |
| 8278 | |
| 8279 | // Allow 0 keys to be set for the non-WPA encrypt types... For WPA encrypt types, the num keys must be non-zero |
| 8280 | // or LIM will reject the set context (assumes the SET_CONTEXT does not occur until the keys are distrubuted). |
| 8281 | if ( CSR_IS_ENC_TYPE_STATIC( EncryptType ) || |
| 8282 | addKey ) |
| 8283 | { |
| 8284 | tCsrRoamSetKey setKey; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8285 | setKey.encType = EncryptType; |
| 8286 | setKey.keyDirection = aniKeyDirection; //Tx, Rx or Tx-and-Rx |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8287 | vos_mem_copy(&setKey.peerMac, bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8288 | setKey.paeRole = paeRole; //0 for supplicant |
| 8289 | setKey.keyId = keyId; // Kye index |
| 8290 | setKey.keyLength = keyLength; |
| 8291 | if( keyLength ) |
| 8292 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8293 | vos_mem_copy(setKey.Key, pKey, keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8294 | } |
| 8295 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, &setKey, 0 ); |
| 8296 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8297 | return (status); |
| 8298 | } |
| 8299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8300 | static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8301 | tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8302 | { |
| 8303 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 8304 | tSmeCmd *pCommand = NULL; |
| 8305 | #ifdef FEATURE_WLAN_CCX |
| 8306 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8307 | #endif /* FEATURE_WLAN_CCX */ |
| 8308 | |
| 8309 | do |
| 8310 | { |
| 8311 | pCommand = csrGetCommandBuffer(pMac); |
| 8312 | if(NULL == pCommand) |
| 8313 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8314 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8315 | status = eHAL_STATUS_RESOURCES; |
| 8316 | break; |
| 8317 | } |
| 8318 | pCommand->command = eSmeCommandSetKey; |
| 8319 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8320 | // validate the key length, Adjust if too long... |
| 8321 | // for static WEP the keys are not set thru' SetContextReq |
| 8322 | if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) || |
| 8323 | ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ) ) |
| 8324 | { |
| 8325 | //KeyLength maybe 0 for static WEP |
| 8326 | if( pSetKey->keyLength ) |
| 8327 | { |
| 8328 | if ( pSetKey->keyLength < CSR_WEP40_KEY_LEN ) |
| 8329 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8330 | smsLog( pMac, LOGW, "Invalid WEP40 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8331 | break; |
| 8332 | } |
| 8333 | |
| 8334 | pCommand->u.setKeyCmd.keyLength = CSR_WEP40_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8335 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8336 | CSR_WEP40_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8337 | } |
| 8338 | } |
| 8339 | else if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) || |
| 8340 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ) ) |
| 8341 | { |
| 8342 | //KeyLength maybe 0 for static WEP |
| 8343 | if( pSetKey->keyLength ) |
| 8344 | { |
| 8345 | if ( pSetKey->keyLength < CSR_WEP104_KEY_LEN ) |
| 8346 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8347 | smsLog( pMac, LOGW, "Invalid WEP104 keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8348 | break; |
| 8349 | } |
| 8350 | |
| 8351 | pCommand->u.setKeyCmd.keyLength = CSR_WEP104_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8352 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8353 | CSR_WEP104_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8354 | } |
| 8355 | } |
| 8356 | else if ( eCSR_ENCRYPT_TYPE_TKIP == pSetKey->encType ) |
| 8357 | { |
| 8358 | if ( pSetKey->keyLength < CSR_TKIP_KEY_LEN ) |
| 8359 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8360 | smsLog( pMac, LOGW, "Invalid TKIP keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8361 | break; |
| 8362 | } |
| 8363 | pCommand->u.setKeyCmd.keyLength = CSR_TKIP_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8364 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8365 | CSR_TKIP_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8366 | } |
| 8367 | else if ( eCSR_ENCRYPT_TYPE_AES == pSetKey->encType ) |
| 8368 | { |
| 8369 | if ( pSetKey->keyLength < CSR_AES_KEY_LEN ) |
| 8370 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8371 | 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] | 8372 | break; |
| 8373 | } |
| 8374 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8375 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8376 | CSR_AES_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8377 | } |
| 8378 | #ifdef FEATURE_WLAN_WAPI |
| 8379 | else if ( eCSR_ENCRYPT_TYPE_WPI == pSetKey->encType ) |
| 8380 | { |
| 8381 | if ( pSetKey->keyLength < CSR_WAPI_KEY_LEN ) |
| 8382 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8383 | smsLog( pMac, LOGW, "Invalid WAPI keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8384 | break; |
| 8385 | } |
| 8386 | pCommand->u.setKeyCmd.keyLength = CSR_WAPI_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8387 | vos_mem_copy(pCommand->u.setKeyCmd.Key, pSetKey->Key, |
| 8388 | CSR_WAPI_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8389 | } |
| 8390 | #endif /* FEATURE_WLAN_WAPI */ |
| 8391 | #ifdef FEATURE_WLAN_CCX |
| 8392 | else if ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 8393 | { |
| 8394 | if ( pSetKey->keyLength < CSR_KRK_KEY_LEN ) |
| 8395 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8396 | smsLog( pMac, LOGW, "Invalid KRK keylength [= %d] in SetContext call", pSetKey->keyLength ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8397 | break; |
| 8398 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8399 | vos_mem_copy(pSession->ccxCckmInfo.krk, pSetKey->Key, |
| 8400 | CSR_KRK_KEY_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8401 | pSession->ccxCckmInfo.reassoc_req_num=1; |
| 8402 | pSession->ccxCckmInfo.krk_plumbed = eANI_BOOLEAN_TRUE; |
| 8403 | status = eHAL_STATUS_SUCCESS; |
| 8404 | break; |
| 8405 | } |
| 8406 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8407 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8408 | #ifdef WLAN_FEATURE_11W |
| 8409 | //Check for 11w BIP |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8410 | else if (eCSR_ENCRYPT_TYPE_AES_CMAC == pSetKey->encType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8411 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8412 | if (pSetKey->keyLength < CSR_AES_KEY_LEN) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8413 | { |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8414 | 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] | 8415 | break; |
| 8416 | } |
| 8417 | pCommand->u.setKeyCmd.keyLength = CSR_AES_KEY_LEN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8418 | 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] | 8419 | } |
| 8420 | #endif |
| 8421 | status = eHAL_STATUS_SUCCESS; |
| 8422 | pCommand->u.setKeyCmd.roamId = roamId; |
| 8423 | pCommand->u.setKeyCmd.encType = pSetKey->encType; |
| 8424 | pCommand->u.setKeyCmd.keyDirection = pSetKey->keyDirection; //Tx, Rx or Tx-and-Rx |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8425 | vos_mem_copy(&pCommand->u.setKeyCmd.peerMac, &pSetKey->peerMac, |
| 8426 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8427 | pCommand->u.setKeyCmd.paeRole = pSetKey->paeRole; //0 for supplicant |
| 8428 | pCommand->u.setKeyCmd.keyId = pSetKey->keyId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8429 | 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] | 8430 | //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 |
| 8431 | |
| 8432 | status = csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 8433 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8434 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8435 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8436 | } |
| 8437 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8438 | // Free the command if there has been a failure, or it is a |
| 8439 | // "local" operation like the set CCX CCKM KRK key. |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8440 | if ( ( NULL != pCommand ) && |
| 8441 | ( (!HAL_STATUS_SUCCESS( status ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8442 | #ifdef FEATURE_WLAN_CCX |
| 8443 | || ( eCSR_ENCRYPT_TYPE_KRK == pSetKey->encType ) |
| 8444 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 74b3ec5 | 2013-04-03 13:45:51 -0700 | [diff] [blame] | 8445 | ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8446 | { |
| 8447 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 8448 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8449 | return( status ); |
| 8450 | } |
| 8451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8452 | eHalStatus csrRoamIssueRemoveKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8453 | tCsrRoamRemoveKey *pRemoveKey, tANI_U32 roamId ) |
| 8454 | { |
| 8455 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 8456 | tSmeCmd *pCommand = NULL; |
| 8457 | tANI_BOOLEAN fImediate = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8458 | do |
| 8459 | { |
| 8460 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8461 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8462 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8463 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8464 | break; |
| 8465 | } |
| 8466 | pCommand = csrGetCommandBuffer(pMac); |
| 8467 | if(NULL == pCommand) |
| 8468 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8469 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8470 | status = eHAL_STATUS_RESOURCES; |
| 8471 | break; |
| 8472 | } |
| 8473 | pCommand->command = eSmeCommandRemoveKey; |
| 8474 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8475 | pCommand->u.removeKeyCmd.roamId = roamId; |
| 8476 | pCommand->u.removeKeyCmd.encType = pRemoveKey->encType; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8477 | vos_mem_copy(&pCommand->u.removeKeyCmd.peerMac, &pRemoveKey->peerMac, |
| 8478 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8479 | pCommand->u.removeKeyCmd.keyId = pRemoveKey->keyId; |
| 8480 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8481 | { |
| 8482 | //in this case, put it to the end of the Q incase there is a set key pending. |
| 8483 | fImediate = eANI_BOOLEAN_FALSE; |
| 8484 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8485 | smsLog( pMac, LOGE, FL("keyType=%d, keyId=%d, PeerMac=%02x, %02x, %02x, %02x, %02x, %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8486 | pRemoveKey->encType, pRemoveKey->keyId, |
| 8487 | pCommand->u.removeKeyCmd.peerMac[0], |
| 8488 | pCommand->u.removeKeyCmd.peerMac[1], |
| 8489 | pCommand->u.removeKeyCmd.peerMac[2], |
| 8490 | pCommand->u.removeKeyCmd.peerMac[3], |
| 8491 | pCommand->u.removeKeyCmd.peerMac[4], |
| 8492 | pCommand->u.removeKeyCmd.peerMac[5]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8493 | status = csrQueueSmeCommand(pMac, pCommand, fImediate); |
| 8494 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8495 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8496 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8497 | break; |
| 8498 | } |
| 8499 | } while (0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8500 | if( !HAL_STATUS_SUCCESS( status ) && ( NULL != pCommand ) ) |
| 8501 | { |
| 8502 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 8503 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8504 | return (status ); |
| 8505 | } |
| 8506 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8507 | eHalStatus csrRoamProcessSetKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8508 | { |
| 8509 | eHalStatus status; |
| 8510 | tANI_U8 numKeys = ( pCommand->u.setKeyCmd.keyLength ) ? 1 : 0; |
| 8511 | tAniEdType edType = csrTranslateEncryptTypeToEdType( pCommand->u.setKeyCmd.encType ); |
| 8512 | tANI_BOOLEAN fUnicast = ( pCommand->u.setKeyCmd.peerMac[0] == 0xFF ) ? eANI_BOOLEAN_FALSE : eANI_BOOLEAN_TRUE; |
| 8513 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8514 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8515 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8516 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8517 | if(eSIR_ED_NONE != edType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8518 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8519 | vos_mem_set(&setKeyEvent, |
| 8520 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8521 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8522 | { |
| 8523 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_REQ; |
| 8524 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8525 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 8526 | } |
| 8527 | else |
| 8528 | { |
| 8529 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_REQ; |
| 8530 | setKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pCommand->u.setKeyCmd.encType); |
| 8531 | setKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8532 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8533 | vos_mem_copy(setKeyEvent.bssid, pSession->connectedProfile.bssid, 6); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8534 | if(CSR_IS_ENC_TYPE_STATIC(pCommand->u.setKeyCmd.encType)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8535 | { |
| 8536 | tANI_U32 defKeyId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8537 | //It has to be static WEP here |
| 8538 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_WEP_DEFAULT_KEYID, &defKeyId))) |
| 8539 | { |
| 8540 | setKeyEvent.keyId = (v_U8_t)defKeyId; |
| 8541 | } |
| 8542 | } |
| 8543 | else |
| 8544 | { |
| 8545 | setKeyEvent.keyId = pCommand->u.setKeyCmd.keyId; |
| 8546 | } |
| 8547 | setKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8548 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8549 | } |
| 8550 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8551 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8552 | { |
| 8553 | status = csrSendMBSetContextReqMsg( pMac, sessionId, |
| 8554 | ( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac, |
| 8555 | numKeys, edType, fUnicast, pCommand->u.setKeyCmd.keyDirection, |
| 8556 | pCommand->u.setKeyCmd.keyId, pCommand->u.setKeyCmd.keyLength, |
| 8557 | pCommand->u.setKeyCmd.Key, pCommand->u.setKeyCmd.paeRole, |
| 8558 | pCommand->u.setKeyCmd.keyRsc); |
| 8559 | } |
| 8560 | else |
| 8561 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8562 | smsLog( pMac, LOGW, FL(" cannot process not connected") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8563 | //Set this status so the error handling take care of the case. |
| 8564 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8565 | } |
| 8566 | if( !HAL_STATUS_SUCCESS(status) ) |
| 8567 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8568 | smsLog( pMac, LOGE, FL(" error status %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8569 | 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] | 8570 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 8571 | if(eSIR_ED_NONE != edType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8572 | { |
| 8573 | if( *(( tANI_U8 *)&pCommand->u.setKeyCmd.peerMac) & 0x01 ) |
| 8574 | { |
| 8575 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 8576 | } |
| 8577 | else |
| 8578 | { |
| 8579 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 8580 | } |
| 8581 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 8582 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 8583 | } |
| 8584 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8585 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8586 | return ( status ); |
| 8587 | } |
| 8588 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8589 | eHalStatus csrRoamProcessRemoveKeyCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 8590 | { |
| 8591 | eHalStatus status; |
| 8592 | tpSirSmeRemoveKeyReq pMsg = NULL; |
| 8593 | tANI_U16 wMsgLen = sizeof(tSirSmeRemoveKeyReq); |
| 8594 | tANI_U8 *p; |
| 8595 | tANI_U32 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8596 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8597 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 8598 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8599 | vos_mem_set(&removeKeyEvent, |
| 8600 | sizeof(vos_event_wlan_security_payload_type),0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8601 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_REQ; |
| 8602 | removeKeyEvent.encryptionModeMulticast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 8603 | removeKeyEvent.encryptionModeUnicast = (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8604 | vos_mem_copy(removeKeyEvent.bssid, pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8605 | removeKeyEvent.keyId = pCommand->u.removeKeyCmd.keyId; |
| 8606 | removeKeyEvent.authMode = (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 8607 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8608 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8609 | if( csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8610 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8611 | pMsg = vos_mem_malloc(wMsgLen); |
| 8612 | if ( NULL == pMsg ) |
| 8613 | status = eHAL_STATUS_FAILURE; |
| 8614 | else |
| 8615 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8616 | } |
| 8617 | else |
| 8618 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8619 | smsLog( pMac, LOGW, FL(" wrong state not allowed to set key") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8620 | //Set the error status so error handling kicks in below |
| 8621 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8622 | } |
| 8623 | if( HAL_STATUS_SUCCESS( status ) ) |
| 8624 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8625 | vos_mem_set(pMsg, wMsgLen ,0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8626 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_REMOVEKEY_REQ); |
| 8627 | pMsg->length = pal_cpu_to_be16(wMsgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8628 | pMsg->sessionId = (tANI_U8)sessionId; |
| 8629 | pMsg->transactionId = 0; |
| 8630 | p = (tANI_U8 *)pMsg + sizeof(pMsg->messageType) + sizeof(pMsg->length) + |
| 8631 | sizeof(pMsg->sessionId) + sizeof(pMsg->transactionId); |
| 8632 | // bssId - copy from session Info |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8633 | vos_mem_copy(p, |
| 8634 | &pMac->roam.roamSession[sessionId].connectedProfile.bssid, |
| 8635 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8636 | p += sizeof(tSirMacAddr); |
| 8637 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8638 | vos_mem_copy(p, pCommand->u.removeKeyCmd.peerMac, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8639 | p += sizeof(tSirMacAddr); |
| 8640 | // edType |
| 8641 | *p = (tANI_U8)csrTranslateEncryptTypeToEdType( pCommand->u.removeKeyCmd.encType ); |
| 8642 | p++; |
| 8643 | // weptype |
| 8644 | if( ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pCommand->u.removeKeyCmd.encType ) || |
| 8645 | ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pCommand->u.removeKeyCmd.encType ) ) |
| 8646 | { |
| 8647 | *p = (tANI_U8)eSIR_WEP_STATIC; |
| 8648 | } |
| 8649 | else |
| 8650 | { |
| 8651 | *p = (tANI_U8)eSIR_WEP_DYNAMIC; |
| 8652 | } |
| 8653 | p++; |
| 8654 | //keyid |
| 8655 | *p = pCommand->u.removeKeyCmd.keyId; |
| 8656 | p++; |
| 8657 | *p = (pCommand->u.removeKeyCmd.peerMac[0] == 0xFF ) ? 0 : 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8658 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 8659 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8660 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 8661 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8662 | smsLog( pMac, LOGE, FL(" error status "), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8663 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 8664 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
Madan Mohan Koyyalamudi | 4e31b13 | 2012-11-02 13:13:52 -0700 | [diff] [blame] | 8665 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8666 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 8667 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8668 | csrRoamCallCallback( pMac, sessionId, NULL, pCommand->u.removeKeyCmd.roamId, eCSR_ROAM_REMOVE_KEY_COMPLETE, eCSR_ROAM_RESULT_FAILURE); |
| 8669 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8670 | return ( status ); |
| 8671 | } |
| 8672 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8673 | eHalStatus csrRoamSetKey( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 roamId ) |
| 8674 | { |
| 8675 | eHalStatus status; |
| 8676 | |
| 8677 | if( !csrIsSetKeyAllowed(pMac, sessionId) ) |
| 8678 | { |
| 8679 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 8680 | } |
| 8681 | else |
| 8682 | { |
| 8683 | status = csrRoamIssueSetKeyCommand( pMac, sessionId, pSetKey, roamId ); |
| 8684 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8685 | return ( status ); |
| 8686 | } |
| 8687 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8688 | /* |
| 8689 | Prepare a filter base on a profile for parsing the scan results. |
| 8690 | Upon successful return, caller MUST call csrFreeScanFilter on |
| 8691 | pScanFilter when it is done with the filter. |
| 8692 | */ |
| 8693 | eHalStatus csrRoamPrepareFilterFromProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 8694 | tCsrScanResultFilter *pScanFilter) |
| 8695 | { |
| 8696 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 8697 | tANI_U32 size = 0; |
| 8698 | tANI_U8 index = 0; |
| 8699 | |
| 8700 | do |
| 8701 | { |
| 8702 | if(pProfile->BSSIDs.numOfBSSIDs) |
| 8703 | { |
| 8704 | size = sizeof(tCsrBssid) * pProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8705 | pScanFilter->BSSIDs.bssid = vos_mem_malloc(size); |
| 8706 | if ( NULL == pScanFilter->BSSIDs.bssid ) |
| 8707 | status = eHAL_STATUS_FAILURE; |
| 8708 | else |
| 8709 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8710 | if(!HAL_STATUS_SUCCESS(status)) |
| 8711 | { |
| 8712 | break; |
| 8713 | } |
| 8714 | pScanFilter->BSSIDs.numOfBSSIDs = pProfile->BSSIDs.numOfBSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8715 | vos_mem_copy(pScanFilter->BSSIDs.bssid, pProfile->BSSIDs.bssid, size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8716 | } |
| 8717 | if(pProfile->SSIDs.numOfSSIDs) |
| 8718 | { |
| 8719 | if( !CSR_IS_WDS_STA( pProfile ) ) |
| 8720 | { |
| 8721 | pScanFilter->SSIDs.numOfSSIDs = pProfile->SSIDs.numOfSSIDs; |
| 8722 | } |
| 8723 | else |
| 8724 | { |
| 8725 | //For WDS station |
| 8726 | //We always use index 1 for self SSID. Index 0 for peer's SSID that we want to join |
| 8727 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 8728 | } |
| 8729 | size = sizeof(tCsrSSIDInfo) * pProfile->SSIDs.numOfSSIDs; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8730 | pScanFilter->SSIDs.SSIDList = vos_mem_malloc(size); |
| 8731 | if ( NULL == pScanFilter->SSIDs.SSIDList ) |
| 8732 | status = eHAL_STATUS_FAILURE; |
| 8733 | else |
| 8734 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8735 | if(!HAL_STATUS_SUCCESS(status)) |
| 8736 | { |
| 8737 | break; |
| 8738 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8739 | vos_mem_copy(pScanFilter->SSIDs.SSIDList, pProfile->SSIDs.SSIDList, |
| 8740 | size); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8741 | } |
| 8742 | if(!pProfile->ChannelInfo.ChannelList || (pProfile->ChannelInfo.ChannelList[0] == 0) ) |
| 8743 | { |
| 8744 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8745 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 8746 | } |
| 8747 | else if(pProfile->ChannelInfo.numOfChannels) |
| 8748 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8749 | pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc( |
| 8750 | sizeof(*pScanFilter->ChannelInfo.ChannelList) * |
| 8751 | pProfile->ChannelInfo.numOfChannels); |
| 8752 | if ( NULL == pScanFilter->ChannelInfo.ChannelList ) |
| 8753 | status = eHAL_STATUS_FAILURE; |
| 8754 | else |
| 8755 | status = eHAL_STATUS_SUCCESS; |
| 8756 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8757 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 8758 | if(HAL_STATUS_SUCCESS(status)) |
| 8759 | { |
| 8760 | for(index = 0; index < pProfile->ChannelInfo.numOfChannels; index++) |
| 8761 | { |
| 8762 | if(csrRoamIsChannelValid(pMac, pProfile->ChannelInfo.ChannelList[index])) |
| 8763 | { |
| 8764 | pScanFilter->ChannelInfo.ChannelList[pScanFilter->ChannelInfo.numOfChannels] |
| 8765 | = pProfile->ChannelInfo.ChannelList[index]; |
| 8766 | pScanFilter->ChannelInfo.numOfChannels++; |
| 8767 | } |
| 8768 | else |
| 8769 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8770 | 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] | 8771 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8772 | } |
| 8773 | } |
| 8774 | else |
| 8775 | { |
| 8776 | break; |
| 8777 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8778 | } |
| 8779 | else |
| 8780 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8781 | smsLog(pMac, LOGW, FL("Channel list empty")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8782 | status = eHAL_STATUS_FAILURE; |
| 8783 | break; |
| 8784 | } |
| 8785 | pScanFilter->uapsd_mask = pProfile->uapsd_mask; |
| 8786 | pScanFilter->authType = pProfile->AuthType; |
| 8787 | pScanFilter->EncryptionType = pProfile->EncryptionType; |
| 8788 | pScanFilter->mcEncryptionType = pProfile->mcEncryptionType; |
| 8789 | pScanFilter->BSSType = pProfile->BSSType; |
| 8790 | pScanFilter->phyMode = pProfile->phyMode; |
| 8791 | #ifdef FEATURE_WLAN_WAPI |
| 8792 | //check if user asked for WAPI with 11n or auto mode, in that case modify |
| 8793 | //the phymode to 11g |
| 8794 | if(csrIsProfileWapi(pProfile)) |
| 8795 | { |
| 8796 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_11n) |
| 8797 | { |
| 8798 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_11n; |
| 8799 | } |
| 8800 | if(pScanFilter->phyMode & eCSR_DOT11_MODE_AUTO) |
| 8801 | { |
| 8802 | pScanFilter->phyMode &= ~eCSR_DOT11_MODE_AUTO; |
| 8803 | } |
| 8804 | if(!pScanFilter->phyMode) |
| 8805 | { |
| 8806 | pScanFilter->phyMode = eCSR_DOT11_MODE_11g; |
| 8807 | } |
| 8808 | } |
| 8809 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8810 | /*Save the WPS info*/ |
| 8811 | pScanFilter->bWPSAssociation = pProfile->bWPSAssociation; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8812 | if( pProfile->countryCode[0] ) |
| 8813 | { |
| 8814 | //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] | 8815 | vos_mem_copy(pScanFilter->countryCode, pProfile->countryCode, |
| 8816 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8817 | } |
| 8818 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 8819 | if (pProfile->MDID.mdiePresent) |
| 8820 | { |
| 8821 | pScanFilter->MDID.mdiePresent = 1; |
| 8822 | pScanFilter->MDID.mobilityDomain = pProfile->MDID.mobilityDomain; |
| 8823 | } |
| 8824 | #endif |
| 8825 | |
| 8826 | }while(0); |
| 8827 | |
| 8828 | if(!HAL_STATUS_SUCCESS(status)) |
| 8829 | { |
| 8830 | csrFreeScanFilter(pMac, pScanFilter); |
| 8831 | } |
| 8832 | |
| 8833 | return(status); |
| 8834 | } |
| 8835 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8836 | tANI_BOOLEAN csrRoamIssueWmStatusChange( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 8837 | eCsrRoamWmStatusChangeTypes Type, tSirSmeRsp *pSmeRsp ) |
| 8838 | { |
| 8839 | tANI_BOOLEAN fCommandQueued = eANI_BOOLEAN_FALSE; |
| 8840 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8841 | do |
| 8842 | { |
| 8843 | // Validate the type is ok... |
| 8844 | if ( ( eCsrDisassociated != Type ) && ( eCsrDeauthenticated != Type ) ) break; |
| 8845 | pCommand = csrGetCommandBuffer( pMac ); |
| 8846 | if ( !pCommand ) |
| 8847 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8848 | smsLog( pMac, LOGE, FL(" fail to get command buffer") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8849 | break; |
| 8850 | } |
| 8851 | //Change the substate in case it is waiting for key |
| 8852 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId ) ) |
| 8853 | { |
| 8854 | csrRoamStopWaitForKeyTimer( pMac ); |
| 8855 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
| 8856 | } |
| 8857 | pCommand->command = eSmeCommandWmStatusChange; |
| 8858 | pCommand->sessionId = (tANI_U8)sessionId; |
| 8859 | pCommand->u.wmStatusChangeCmd.Type = Type; |
| 8860 | if ( eCsrDisassociated == Type ) |
| 8861 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8862 | vos_mem_copy(&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg, |
| 8863 | pSmeRsp, |
| 8864 | sizeof( pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8865 | } |
| 8866 | else |
| 8867 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 8868 | vos_mem_copy(&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg, |
| 8869 | pSmeRsp, |
| 8870 | sizeof( pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8871 | } |
| 8872 | if( HAL_STATUS_SUCCESS( csrQueueSmeCommand(pMac, pCommand, eANI_BOOLEAN_TRUE) ) ) |
| 8873 | { |
| 8874 | fCommandQueued = eANI_BOOLEAN_TRUE; |
| 8875 | } |
| 8876 | else |
| 8877 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8878 | smsLog( pMac, LOGE, FL(" fail to send message ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8879 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 8880 | } |
| 8881 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8882 | /* AP has issued Dissac/Deauth, Set the operating mode value to configured value */ |
| 8883 | csrSetDefaultDot11Mode( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8884 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8885 | return( fCommandQueued ); |
| 8886 | } |
| 8887 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8888 | static void csrUpdateRssi(tpAniSirGlobal pMac, void* pMsg) |
| 8889 | { |
| 8890 | v_S7_t rssi = 0; |
| 8891 | tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq*)pMsg; |
| 8892 | if(pGetRssiReq) |
| 8893 | { |
| 8894 | if(NULL != pGetRssiReq->pVosContext) |
| 8895 | { |
| 8896 | WLANTL_GetRssi(pGetRssiReq->pVosContext, pGetRssiReq->staId, &rssi); |
| 8897 | } |
| 8898 | else |
| 8899 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8900 | smsLog( pMac, LOGE, FL("pGetRssiReq->pVosContext is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8901 | return; |
| 8902 | } |
| 8903 | |
| 8904 | if(NULL != pGetRssiReq->rssiCallback) |
| 8905 | { |
| 8906 | ((tCsrRssiCallback)(pGetRssiReq->rssiCallback))(rssi, pGetRssiReq->staId, pGetRssiReq->pDevContext); |
| 8907 | } |
| 8908 | else |
| 8909 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8910 | smsLog( pMac, LOGE, FL("pGetRssiReq->rssiCallback is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8911 | return; |
| 8912 | } |
| 8913 | } |
| 8914 | else |
| 8915 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 8916 | smsLog( pMac, LOGE, FL("pGetRssiReq is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8917 | } |
| 8918 | return; |
| 8919 | } |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 8920 | |
| 8921 | static void csrUpdateSnr(tpAniSirGlobal pMac, void* pMsg) |
| 8922 | { |
| 8923 | tANI_S8 snr = 0; |
| 8924 | tAniGetSnrReq *pGetSnrReq = (tAniGetSnrReq*)pMsg; |
| 8925 | |
| 8926 | if (pGetSnrReq) |
| 8927 | { |
| 8928 | if (VOS_STATUS_SUCCESS != |
| 8929 | WDA_GetSnr(pGetSnrReq->staId, &snr)) |
| 8930 | { |
| 8931 | smsLog(pMac, LOGE, FL("Error in WLANTL_GetSnr")); |
| 8932 | return; |
| 8933 | } |
| 8934 | |
| 8935 | if (pGetSnrReq->snrCallback) |
| 8936 | { |
| 8937 | ((tCsrSnrCallback)(pGetSnrReq->snrCallback))(snr, pGetSnrReq->staId, |
| 8938 | pGetSnrReq->pDevContext); |
| 8939 | } |
| 8940 | else |
| 8941 | { |
| 8942 | smsLog(pMac, LOGE, FL("pGetSnrReq->snrCallback is NULL")); |
| 8943 | return; |
| 8944 | } |
| 8945 | } |
| 8946 | else |
| 8947 | { |
| 8948 | smsLog(pMac, LOGE, FL("pGetSnrReq is NULL")); |
| 8949 | } |
| 8950 | return; |
| 8951 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8952 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 8953 | void csrRoamRssiRspProcessor(tpAniSirGlobal pMac, void* pMsg) |
| 8954 | { |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8955 | tAniGetRoamRssiRsp* pRoamRssiRsp = (tAniGetRoamRssiRsp*)pMsg; |
| 8956 | |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 8957 | if (NULL != pRoamRssiRsp) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8958 | { |
Jeff Johnson | 36d483b | 2013-04-08 11:08:53 -0700 | [diff] [blame] | 8959 | /* Get roam Rssi request is backed up and passed back to the response, |
| 8960 | Extract the request message to fetch callback */ |
| 8961 | tpAniGetRssiReq reqBkp = (tAniGetRssiReq*)pRoamRssiRsp->rssiReq; |
| 8962 | v_S7_t rssi = pRoamRssiRsp->rssi; |
| 8963 | |
| 8964 | if ((NULL != reqBkp) && (NULL != reqBkp->rssiCallback)) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 8965 | { |
| 8966 | ((tCsrRssiCallback)(reqBkp->rssiCallback))(rssi, pRoamRssiRsp->staId, reqBkp->pDevContext); |
| 8967 | reqBkp->rssiCallback = NULL; |
| 8968 | vos_mem_free(reqBkp); |
| 8969 | } |
| 8970 | else |
| 8971 | { |
| 8972 | smsLog( pMac, LOGE, FL("reqBkp->rssiCallback is NULL")); |
| 8973 | if (NULL != reqBkp) |
| 8974 | { |
| 8975 | vos_mem_free(reqBkp); |
| 8976 | } |
| 8977 | } |
| 8978 | } |
| 8979 | else |
| 8980 | { |
| 8981 | smsLog( pMac, LOGE, FL("pRoamRssiRsp is NULL")); |
| 8982 | } |
| 8983 | return; |
| 8984 | } |
| 8985 | #endif |
| 8986 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 8987 | |
| 8988 | #if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD) |
| 8989 | void csrTsmStatsRspProcessor(tpAniSirGlobal pMac, void* pMsg) |
| 8990 | { |
| 8991 | tAniGetTsmStatsRsp* pTsmStatsRsp = (tAniGetTsmStatsRsp*)pMsg; |
| 8992 | |
| 8993 | if (NULL != pTsmStatsRsp) |
| 8994 | { |
| 8995 | /* Get roam Rssi request is backed up and passed back to the response, |
| 8996 | Extract the request message to fetch callback */ |
| 8997 | tpAniGetTsmStatsReq reqBkp = (tAniGetTsmStatsReq*)pTsmStatsRsp->tsmStatsReq; |
| 8998 | |
| 8999 | if (NULL != reqBkp) |
| 9000 | { |
| 9001 | if (NULL != reqBkp->tsmStatsCallback) |
| 9002 | { |
| 9003 | ((tCsrTsmStatsCallback)(reqBkp->tsmStatsCallback))(pTsmStatsRsp->tsmMetrics, |
| 9004 | pTsmStatsRsp->staId, reqBkp->pDevContext); |
| 9005 | reqBkp->tsmStatsCallback = NULL; |
| 9006 | } |
| 9007 | vos_mem_free(reqBkp); |
| 9008 | } |
| 9009 | else |
| 9010 | { |
| 9011 | smsLog( pMac, LOGE, FL("reqBkp is NULL")); |
| 9012 | if (NULL != reqBkp) |
| 9013 | { |
| 9014 | vos_mem_free(reqBkp); |
| 9015 | } |
| 9016 | } |
| 9017 | } |
| 9018 | else |
| 9019 | { |
| 9020 | smsLog( pMac, LOGE, FL("pTsmStatsRsp is NULL")); |
| 9021 | } |
| 9022 | return; |
| 9023 | } |
| 9024 | |
| 9025 | void csrSendCcxAdjacentApRepInd(tpAniSirGlobal pMac, tCsrRoamSession *pSession) |
| 9026 | { |
| 9027 | tANI_U32 roamTS2 = 0; |
| 9028 | tCsrRoamInfo roamInfo; |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame^] | 9029 | tpPESession pSessionEntry = NULL; |
| 9030 | tANI_U8 sessionId = CSR_SESSION_ID_INVALID; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9031 | |
| 9032 | if (NULL == pSession) |
| 9033 | { |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame^] | 9034 | smsLog(pMac, LOGE, FL("pSession is NULL")); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9035 | return; |
| 9036 | } |
| 9037 | |
| 9038 | roamTS2 = vos_timer_get_system_time(); |
| 9039 | roamInfo.tsmRoamDelay = roamTS2 - pSession->roamTS1; |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame^] | 9040 | smsLog(pMac, LOG1, "Bssid(%02X:%02X:%02X:%02X:%02X:%02X) Roaming Delay(%u ms)", |
| 9041 | pSession->connectedProfile.bssid[0], pSession->connectedProfile.bssid[1], |
| 9042 | pSession->connectedProfile.bssid[2], pSession->connectedProfile.bssid[3], |
| 9043 | pSession->connectedProfile.bssid[4], pSession->connectedProfile.bssid[5], |
| 9044 | roamInfo.tsmRoamDelay); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9045 | |
Srinivas Girigowda | 026433f | 2013-10-28 11:51:55 -0700 | [diff] [blame^] | 9046 | pSessionEntry = peFindSessionByBssid(pMac, pSession->connectedProfile.bssid, &sessionId); |
| 9047 | if (NULL == pSessionEntry) |
| 9048 | { |
| 9049 | smsLog(pMac, LOGE, FL("session %d not found"), sessionId); |
| 9050 | return; |
| 9051 | } |
| 9052 | pSessionEntry->ccxContext.tsm.tsmMetrics.RoamingDly = roamInfo.tsmRoamDelay; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9053 | csrRoamCallCallback(pMac, pSession->sessionId, &roamInfo, |
| 9054 | 0, eCSR_ROAM_CCX_ADJ_AP_REPORT_IND, 0); |
| 9055 | } |
| 9056 | #endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */ |
| 9057 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9058 | static void csrRoamRssiIndHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 9059 | { |
| 9060 | WLANTL_TlIndicationReq *pTlRssiInd = (WLANTL_TlIndicationReq*)pMsg; |
| 9061 | if(pTlRssiInd) |
| 9062 | { |
| 9063 | if(NULL != pTlRssiInd->tlCallback) |
| 9064 | { |
| 9065 | ((WLANTL_RSSICrossThresholdCBType)(pTlRssiInd->tlCallback)) |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 9066 | (pTlRssiInd->pAdapter, pTlRssiInd->rssiNotification, pTlRssiInd->pUserCtxt, pTlRssiInd->avgRssi); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9067 | } |
| 9068 | else |
| 9069 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9070 | smsLog( pMac, LOGE, FL("pTlRssiInd->tlCallback is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9071 | } |
| 9072 | } |
| 9073 | else |
| 9074 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9075 | smsLog( pMac, LOGE, FL("pTlRssiInd is NULL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9076 | } |
| 9077 | return; |
| 9078 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9079 | |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9080 | eHalStatus csrSendResetApCapsChanged(tpAniSirGlobal pMac, tSirMacAddr *bssId) |
| 9081 | { |
| 9082 | tpSirResetAPCapsChange pMsg; |
| 9083 | tANI_U16 len; |
| 9084 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 9085 | |
| 9086 | /* Create the message and send to lim */ |
| 9087 | len = sizeof(tSirResetAPCapsChange); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9088 | pMsg = vos_mem_malloc(len); |
| 9089 | if ( NULL == pMsg ) |
| 9090 | status = eHAL_STATUS_FAILURE; |
| 9091 | else |
| 9092 | status = eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9093 | if (HAL_STATUS_SUCCESS(status)) |
| 9094 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9095 | vos_mem_set(pMsg, sizeof(tSirResetAPCapsChange), 0); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9096 | pMsg->messageType = eWNI_SME_RESET_AP_CAPS_CHANGED; |
| 9097 | pMsg->length = len; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9098 | vos_mem_copy(pMsg->bssId, bssId, sizeof(tSirMacAddr)); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9099 | smsLog( pMac, LOG1, FL("CSR reset caps change for Bssid= %02x-%02x-%02x-%02x-%02x-%02x"), |
| 9100 | pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ], |
| 9101 | pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ]); |
| 9102 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 9103 | } |
| 9104 | else |
| 9105 | { |
| 9106 | smsLog( pMac, LOGE, FL("Memory allocation failed\n")); |
| 9107 | } |
| 9108 | return status; |
| 9109 | } |
| 9110 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9111 | void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) |
| 9112 | { |
| 9113 | tSirSmeAssocInd *pAssocInd; |
| 9114 | tSirSmeDisassocInd *pDisassocInd; |
| 9115 | tSirSmeDeauthInd *pDeauthInd; |
| 9116 | tSirSmeWmStatusChangeNtf *pStatusChangeMsg; |
| 9117 | tSirSmeNewBssInfo *pNewBss; |
| 9118 | tSmeIbssPeerInd *pIbssPeerInd; |
| 9119 | tSirMacAddr Broadcastaddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 9120 | tSirSmeApNewCaps *pApNewCaps; |
| 9121 | eCsrRoamResult result = eCSR_ROAM_RESULT_NONE; |
| 9122 | eRoamCmdStatus roamStatus = eCSR_ROAM_FAILED; |
| 9123 | tCsrRoamInfo *pRoamInfo = NULL; |
| 9124 | tCsrRoamInfo roamInfo; |
| 9125 | eHalStatus status; |
| 9126 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
| 9127 | tCsrRoamSession *pSession = NULL; |
| 9128 | tpSirSmeSwitchChannelInd pSwitchChnInd; |
| 9129 | tSmeMaxAssocInd *pSmeMaxAssocInd; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9130 | tSmeCmd pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9131 | pSirMsg->messageType = (pSirMsg->messageType); |
| 9132 | pSirMsg->length = (pSirMsg->length); |
| 9133 | pSirMsg->statusCode = (pSirMsg->statusCode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9134 | vos_mem_set(&roamInfo, sizeof(roamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9135 | switch( pSirMsg->messageType ) |
| 9136 | { |
| 9137 | case eWNI_SME_ASSOC_IND: |
| 9138 | { |
| 9139 | tCsrRoamSession *pSession; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9140 | smsLog( pMac, LOG1, FL("ASSOCIATION Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9141 | pAssocInd = (tSirSmeAssocInd *)pSirMsg; |
| 9142 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pAssocInd->bssId, &sessionId ); |
| 9143 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9144 | { |
| 9145 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 9146 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9147 | if(!pSession) |
| 9148 | { |
| 9149 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9150 | return; |
| 9151 | } |
| 9152 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9153 | pRoamInfo = &roamInfo; |
| 9154 | |
| 9155 | // Required for indicating the frames to upper layer |
| 9156 | pRoamInfo->assocReqLength = pAssocInd->assocReqLength; |
| 9157 | pRoamInfo->assocReqPtr = pAssocInd->assocReqPtr; |
| 9158 | |
| 9159 | pRoamInfo->beaconPtr = pAssocInd->beaconPtr; |
| 9160 | pRoamInfo->beaconLength = pAssocInd->beaconLength; |
| 9161 | pRoamInfo->statusCode = eSIR_SME_SUCCESS; //send the status code as Success |
| 9162 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9163 | |
| 9164 | pRoamInfo->staId = (tANI_U8)pAssocInd->staId; |
| 9165 | pRoamInfo->rsnIELen = (tANI_U8)pAssocInd->rsnIE.length; |
| 9166 | pRoamInfo->prsnIE = pAssocInd->rsnIE.rsnIEdata; |
| 9167 | |
| 9168 | pRoamInfo->addIELen = (tANI_U8)pAssocInd->addIE.length; |
| 9169 | pRoamInfo->paddIE = pAssocInd->addIE.addIEdata; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9170 | vos_mem_copy(pRoamInfo->peerMac, pAssocInd->peerMacAddr, |
| 9171 | sizeof(tSirMacAddr)); |
| 9172 | vos_mem_copy(&pRoamInfo->bssid, pAssocInd->bssId, |
| 9173 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9174 | pRoamInfo->wmmEnabledSta = pAssocInd->wmmEnabledSta; |
| 9175 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9176 | 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] | 9177 | if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile)) |
| 9178 | { |
| 9179 | if( CSR_IS_ENC_TYPE_STATIC( pSession->pCurRoamProfile->negotiatedUCEncryptionType )) |
| 9180 | { |
| 9181 | csrRoamIssueSetContextReq( pMac, sessionId, pSession->pCurRoamProfile->negotiatedUCEncryptionType, |
| 9182 | pSession->pConnectBssDesc, |
| 9183 | &(pRoamInfo->peerMac), |
| 9184 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 9185 | pRoamInfo->fAuthRequired = FALSE; |
| 9186 | } |
| 9187 | else |
| 9188 | { |
| 9189 | pRoamInfo->fAuthRequired = TRUE; |
| 9190 | } |
| 9191 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
| 9192 | if (!HAL_STATUS_SUCCESS(status)) |
| 9193 | pRoamInfo->statusCode = eSIR_SME_ASSOC_REFUSED;// Refused due to Mac filtering |
| 9194 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9195 | /* Send Association completion message to PE */ |
| 9196 | status = csrSendAssocCnfMsg( pMac, pAssocInd, status );//Sta |
| 9197 | |
| 9198 | /* send a message to CSR itself just to avoid the EAPOL frames going |
| 9199 | * OTA before association response */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9200 | if(CSR_IS_WDS_AP( pRoamInfo->u.pConnectedProfile)) |
| 9201 | { |
| 9202 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 9203 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9204 | else if(CSR_IS_INFRA_AP(pRoamInfo->u.pConnectedProfile) && (pRoamInfo->statusCode != eSIR_SME_ASSOC_REFUSED)) |
| 9205 | { |
| 9206 | pRoamInfo->fReassocReq = pAssocInd->reassocReq; |
| 9207 | //status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 9208 | status = csrSendAssocIndToUpperLayerCnfMsg(pMac, pAssocInd, status, sessionId); |
| 9209 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9210 | } |
| 9211 | } |
| 9212 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9213 | case eWNI_SME_DISASSOC_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9214 | smsLog( pMac, LOGE, FL("DISASSOCIATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9215 | // Check if AP dis-associated us because of MIC failure. If so, |
| 9216 | // then we need to take action immediately and not wait till the |
| 9217 | // the WmStatusChange requests is pushed and processed |
| 9218 | pDisassocInd = (tSirSmeDisassocInd *)pSirMsg; |
| 9219 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDisassocInd->bssId, &sessionId ); |
| 9220 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9221 | { |
| 9222 | // If we are in neighbor preauth done state then on receiving |
| 9223 | // disassoc or deauth we dont roam instead we just disassoc |
| 9224 | // from current ap and then go to disconnected state |
| 9225 | // This happens for CCX and 11r FT connections ONLY. |
| 9226 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9227 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9228 | { |
| 9229 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9230 | } |
| 9231 | #endif |
| 9232 | #ifdef FEATURE_WLAN_CCX |
| 9233 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9234 | { |
| 9235 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9236 | } |
| 9237 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9238 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 9239 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9240 | { |
| 9241 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9242 | } |
| 9243 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9244 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 9245 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9246 | if(!pSession) |
| 9247 | { |
| 9248 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9249 | return; |
| 9250 | } |
| 9251 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9252 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 9253 | { |
| 9254 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 9255 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9256 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 9257 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 9258 | #endif |
| 9259 | csrRoamLinkDown(pMac, sessionId); |
| 9260 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDisassociated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9261 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 9262 | { |
| 9263 | |
| 9264 | pRoamInfo = &roamInfo; |
| 9265 | |
| 9266 | pRoamInfo->statusCode = pDisassocInd->statusCode; |
| 9267 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9268 | |
| 9269 | pRoamInfo->staId = (tANI_U8)pDisassocInd->staId; |
| 9270 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9271 | vos_mem_copy(pRoamInfo->peerMac, pDisassocInd->peerMacAddr, |
| 9272 | sizeof(tSirMacAddr)); |
| 9273 | vos_mem_copy(&pRoamInfo->bssid, pDisassocInd->bssId, |
| 9274 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9275 | |
| 9276 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DISASSOC_IND); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9277 | |
| 9278 | /* |
| 9279 | * STA/P2P client got disassociated so remove any pending deauth |
| 9280 | * commands in sme pending list |
| 9281 | */ |
| 9282 | pCommand.command = eSmeCommandRoam; |
| 9283 | pCommand.sessionId = (tANI_U8)sessionId; |
| 9284 | pCommand.u.roamCmd.roamReason = eCsrForcedDeauthSta; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9285 | vos_mem_copy(pCommand.u.roamCmd.peerMac, |
| 9286 | pDisassocInd->peerMacAddr, |
| 9287 | sizeof(tSirMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 9288 | csrRoamRemoveDuplicateCommand(pMac, sessionId, &pCommand, eCsrForcedDeauthSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9289 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9290 | } |
| 9291 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9292 | case eWNI_SME_DEAUTH_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9293 | smsLog( pMac, LOG1, FL("DEAUTHENTICATION Indication from MAC")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9294 | pDeauthInd = (tpSirSmeDeauthInd)pSirMsg; |
| 9295 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pDeauthInd->bssId, &sessionId ); |
| 9296 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9297 | { |
| 9298 | // If we are in neighbor preauth done state then on receiving |
| 9299 | // disassoc or deauth we dont roam instead we just disassoc |
| 9300 | // from current ap and then go to disconnected state |
| 9301 | // This happens for CCX and 11r FT connections ONLY. |
| 9302 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 9303 | if (csrRoamIs11rAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9304 | { |
| 9305 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9306 | } |
| 9307 | #endif |
| 9308 | #ifdef FEATURE_WLAN_CCX |
| 9309 | if (csrRoamIsCCXAssoc(pMac) && (csrNeighborRoamStatePreauthDone(pMac))) |
| 9310 | { |
| 9311 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9312 | } |
| 9313 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9314 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 9315 | if (csrRoamIsFastRoamEnabled(pMac, sessionId) && (csrNeighborRoamStatePreauthDone(pMac))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9316 | { |
| 9317 | csrNeighborRoamTranistionPreauthDoneToDisconnected(pMac); |
| 9318 | } |
| 9319 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9320 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 9321 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9322 | if(!pSession) |
| 9323 | { |
| 9324 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9325 | return; |
| 9326 | } |
| 9327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9328 | if ( csrIsConnStateInfra( pMac, sessionId ) ) |
| 9329 | { |
| 9330 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 9331 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9332 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 9333 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_DISCONNECT_IND, NULL); |
| 9334 | #endif |
| 9335 | csrRoamLinkDown(pMac, sessionId); |
| 9336 | csrRoamIssueWmStatusChange( pMac, sessionId, eCsrDeauthenticated, pSirMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9337 | if(CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 9338 | { |
| 9339 | |
| 9340 | pRoamInfo = &roamInfo; |
| 9341 | |
| 9342 | pRoamInfo->statusCode = pDeauthInd->statusCode; |
| 9343 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9344 | |
| 9345 | pRoamInfo->staId = (tANI_U8)pDeauthInd->staId; |
| 9346 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9347 | vos_mem_copy(pRoamInfo->peerMac, pDeauthInd->peerMacAddr, |
| 9348 | sizeof(tSirMacAddr)); |
| 9349 | vos_mem_copy(&pRoamInfo->bssid, pDeauthInd->bssId, |
| 9350 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9351 | |
| 9352 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_DEAUTH_IND); |
| 9353 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9354 | } |
| 9355 | break; |
| 9356 | |
| 9357 | 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] | 9358 | smsLog( pMac, LOGW, FL("eWNI_SME_SWITCH_CHL_REQ from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9359 | pSwitchChnInd = (tpSirSmeSwitchChannelInd)pSirMsg; |
| 9360 | //Update with the new channel id. |
| 9361 | //The channel id is hidden in the statusCode. |
| 9362 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pSwitchChnInd->bssId, &sessionId ); |
| 9363 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9364 | { |
| 9365 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9366 | if(!pSession) |
| 9367 | { |
| 9368 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9369 | return; |
| 9370 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9371 | pSession->connectedProfile.operationChannel = (tANI_U8)pSwitchChnInd->newChannelId; |
| 9372 | if(pSession->pConnectBssDesc) |
| 9373 | { |
| 9374 | pSession->pConnectBssDesc->channelId = (tANI_U8)pSwitchChnInd->newChannelId; |
| 9375 | } |
| 9376 | } |
| 9377 | break; |
| 9378 | |
| 9379 | case eWNI_SME_DEAUTH_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9380 | smsLog( pMac, LOGW, FL("eWNI_SME_DEAUTH_RSP from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9381 | { |
| 9382 | tSirSmeDeauthRsp* pDeauthRsp = (tSirSmeDeauthRsp *)pSirMsg; |
| 9383 | sessionId = pDeauthRsp->sessionId; |
| 9384 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 9385 | { |
| 9386 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9387 | if(!pSession) |
| 9388 | { |
| 9389 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9390 | return; |
| 9391 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9392 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 9393 | { |
| 9394 | pRoamInfo = &roamInfo; |
| 9395 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9396 | vos_mem_copy(pRoamInfo->peerMac, pDeauthRsp->peerMacAddr, |
| 9397 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9398 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 9399 | pRoamInfo->statusCode = pDeauthRsp->statusCode; |
| 9400 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 9401 | } |
| 9402 | } |
| 9403 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9404 | break; |
| 9405 | |
| 9406 | case eWNI_SME_DISASSOC_RSP: |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 9407 | /* 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] | 9408 | smsLog( pMac, LOGW, FL("eWNI_SME_DISASSOC_RSP from SME ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9409 | { |
| 9410 | tSirSmeDisassocRsp *pDisassocRsp = (tSirSmeDisassocRsp *)pSirMsg; |
| 9411 | sessionId = pDisassocRsp->sessionId; |
| 9412 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 9413 | { |
| 9414 | pSession = CSR_GET_SESSION(pMac, sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9415 | if(!pSession) |
| 9416 | { |
| 9417 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9418 | return; |
| 9419 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9420 | if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) |
| 9421 | { |
| 9422 | pRoamInfo = &roamInfo; |
| 9423 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9424 | vos_mem_copy(pRoamInfo->peerMac, pDisassocRsp->peerMacAddr, |
| 9425 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9426 | pRoamInfo->reasonCode = eCSR_ROAM_RESULT_FORCED; |
| 9427 | pRoamInfo->statusCode = pDisassocRsp->statusCode; |
| 9428 | status = csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_LOSTLINK, eCSR_ROAM_RESULT_FORCED); |
| 9429 | } |
| 9430 | } |
| 9431 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9432 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9433 | case eWNI_SME_MIC_FAILURE_IND: |
| 9434 | { |
| 9435 | tpSirSmeMicFailureInd pMicInd = (tpSirSmeMicFailureInd)pSirMsg; |
| 9436 | tCsrRoamInfo roamInfo, *pRoamInfo = NULL; |
| 9437 | eCsrRoamResult result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
Leo Chang | 9b01ad9 | 2013-09-12 17:26:56 -0700 | [diff] [blame] | 9438 | |
| 9439 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pMicInd->bssId, &sessionId ); |
| 9440 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9441 | { |
| 9442 | palZeroMemory(pMac->hHdd, &roamInfo, sizeof(tCsrRoamInfo)); |
| 9443 | roamInfo.u.pMICFailureInfo = &pMicInd->info; |
| 9444 | pRoamInfo = &roamInfo; |
| 9445 | if(pMicInd->info.multicast) |
| 9446 | { |
| 9447 | result = eCSR_ROAM_RESULT_MIC_ERROR_GROUP; |
| 9448 | } |
| 9449 | else |
| 9450 | { |
| 9451 | result = eCSR_ROAM_RESULT_MIC_ERROR_UNICAST; |
| 9452 | } |
| 9453 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_MIC_ERROR_IND, result); |
| 9454 | } |
| 9455 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9456 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9457 | { |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9458 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9459 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9460 | if(!pSession) |
| 9461 | { |
| 9462 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9463 | return; |
| 9464 | } |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9465 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9466 | vos_mem_set(&secEvent, sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9467 | secEvent.eventId = WLAN_SECURITY_EVENT_MIC_ERROR; |
| 9468 | secEvent.encryptionModeMulticast = |
| 9469 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9470 | secEvent.encryptionModeUnicast = |
| 9471 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
| 9472 | secEvent.authMode = |
| 9473 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9474 | vos_mem_copy(secEvent.bssid, |
| 9475 | pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9476 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 9477 | } |
| 9478 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9479 | } |
| 9480 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9481 | case eWNI_SME_WPS_PBC_PROBE_REQ_IND: |
| 9482 | { |
| 9483 | tpSirSmeProbeReqInd pProbeReqInd = (tpSirSmeProbeReqInd)pSirMsg; |
| 9484 | tCsrRoamInfo roamInfo; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9485 | smsLog( pMac, LOG1, FL("WPS PBC Probe request Indication from SME")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9486 | |
| 9487 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pProbeReqInd->bssId, &sessionId ); |
| 9488 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9489 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9490 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9491 | roamInfo.u.pWPSPBCProbeReq = &pProbeReqInd->WPSPBCProbeReq; |
| 9492 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_WPS_PBC_PROBE_REQ_IND, |
| 9493 | eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 9494 | } |
| 9495 | } |
| 9496 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9497 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9498 | case eWNI_SME_WM_STATUS_CHANGE_NTF: |
| 9499 | pStatusChangeMsg = (tSirSmeWmStatusChangeNtf *)pSirMsg; |
| 9500 | switch( pStatusChangeMsg->statusChangeCode ) |
| 9501 | { |
| 9502 | case eSIR_SME_IBSS_ACTIVE: |
| 9503 | sessionId = csrFindIbssSession( pMac ); |
| 9504 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9505 | { |
| 9506 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9507 | if(!pSession) |
| 9508 | { |
| 9509 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9510 | return; |
| 9511 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9512 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED; |
| 9513 | if(pSession->pConnectBssDesc) |
| 9514 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9515 | vos_mem_copy(&roamInfo.bssid, |
| 9516 | pSession->pConnectBssDesc->bssId, |
| 9517 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9518 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 9519 | pRoamInfo = &roamInfo; |
| 9520 | } |
| 9521 | else |
| 9522 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9523 | 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] | 9524 | } |
| 9525 | result = eCSR_ROAM_RESULT_IBSS_CONNECT; |
| 9526 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9527 | } |
| 9528 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9529 | case eSIR_SME_IBSS_INACTIVE: |
| 9530 | sessionId = csrFindIbssSession( pMac ); |
| 9531 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9532 | { |
| 9533 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9534 | if(!pSession) |
| 9535 | { |
| 9536 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9537 | return; |
| 9538 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9539 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED; |
| 9540 | result = eCSR_ROAM_RESULT_IBSS_INACTIVE; |
| 9541 | roamStatus = eCSR_ROAM_CONNECT_STATUS_UPDATE; |
| 9542 | } |
| 9543 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9544 | case eSIR_SME_JOINED_NEW_BSS: // IBSS coalescing. |
| 9545 | sessionId = csrFindIbssSession( pMac ); |
| 9546 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9547 | { |
| 9548 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9549 | if(!pSession) |
| 9550 | { |
| 9551 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9552 | return; |
| 9553 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9554 | // update the connection state information |
| 9555 | pNewBss = &pStatusChangeMsg->statusChangeInfo.newBssInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9556 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9557 | { |
| 9558 | vos_log_ibss_pkt_type *pIbssLog; |
| 9559 | tANI_U32 bi; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9560 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9561 | if(pIbssLog) |
| 9562 | { |
| 9563 | pIbssLog->eventId = WLAN_IBSS_EVENT_COALESCING; |
| 9564 | if(pNewBss) |
| 9565 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9566 | vos_mem_copy(pIbssLog->bssid, pNewBss->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9567 | if(pNewBss->ssId.length) |
| 9568 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9569 | vos_mem_copy(pIbssLog->ssid, pNewBss->ssId.ssId, |
| 9570 | pNewBss->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9571 | } |
| 9572 | pIbssLog->operatingChannel = pNewBss->channelNumber; |
| 9573 | } |
| 9574 | if(HAL_STATUS_SUCCESS(ccmCfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL, &bi))) |
| 9575 | { |
| 9576 | //***U8 is not enough for beacon interval |
| 9577 | pIbssLog->beaconInterval = (v_U8_t)bi; |
| 9578 | } |
| 9579 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9580 | } |
| 9581 | } |
| 9582 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9583 | csrRoamUpdateConnectedProfileFromNewBss( pMac, sessionId, pNewBss ); |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9584 | |
| 9585 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 9586 | pSession->connectedProfile.EncryptionType )) |
| 9587 | { |
| 9588 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 9589 | pSession->connectedProfile.EncryptionType, |
| 9590 | pSession->pConnectBssDesc, |
| 9591 | &Broadcastaddr, |
| 9592 | FALSE, FALSE, eSIR_TX_RX, 0, 0, NULL, 0 ); |
| 9593 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9594 | result = eCSR_ROAM_RESULT_IBSS_COALESCED; |
| 9595 | roamStatus = eCSR_ROAM_IBSS_IND; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9596 | vos_mem_copy(&roamInfo.bssid, &pNewBss->bssId, |
| 9597 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9598 | pRoamInfo = &roamInfo; |
| 9599 | //This BSSID is th ereal BSSID, let's save it |
| 9600 | if(pSession->pConnectBssDesc) |
| 9601 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9602 | vos_mem_copy(pSession->pConnectBssDesc->bssId, |
| 9603 | &pNewBss->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9604 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9605 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9606 | smsLog(pMac, LOGW, "CSR: eSIR_SME_JOINED_NEW_BSS received from PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9607 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9608 | // detection by LIM that the capabilities of the associated AP have changed. |
| 9609 | case eSIR_SME_AP_CAPS_CHANGED: |
| 9610 | pApNewCaps = &pStatusChangeMsg->statusChangeInfo.apNewCaps; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9611 | smsLog(pMac, LOGW, "CSR handling eSIR_SME_AP_CAPS_CHANGED"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9612 | status = csrRoamGetSessionIdFromBSSID( pMac, (tCsrBssid *)pApNewCaps->bssId, &sessionId ); |
| 9613 | if( HAL_STATUS_SUCCESS( status ) ) |
| 9614 | { |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9615 | if ((eCSR_ROAMING_STATE_JOINED == pMac->roam.curState[sessionId]) && |
| 9616 | ((eCSR_ROAM_SUBSTATE_JOINED_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9617 | (eCSR_ROAM_SUBSTATE_NONE == pMac->roam.curSubState[sessionId]) || |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9618 | (eCSR_ROAM_SUBSTATE_JOINED_NON_REALTIME_TRAFFIC == pMac->roam.curSubState[sessionId]) || |
| 9619 | (eCSR_ROAM_SUBSTATE_JOINED_NO_TRAFFIC == pMac->roam.curSubState[sessionId])) |
| 9620 | ) |
| 9621 | { |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9622 | smsLog(pMac, LOGW, "Calling csrRoamDisconnectInternal"); |
| 9623 | csrRoamDisconnectInternal(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9624 | } |
| 9625 | else |
| 9626 | { |
| 9627 | smsLog(pMac, LOGW, |
| 9628 | "Skipping csrScanForCapabilityChange as " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9629 | "CSR is in state %d and sub-state %d", |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9630 | pMac->roam.curState[sessionId], |
| 9631 | pMac->roam.curSubState[sessionId]); |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9632 | /* We ignore the caps change event if CSR is not in full connected state. |
| 9633 | * Send one event to PE to reset limSentCapsChangeNtf |
| 9634 | * Once limSentCapsChangeNtf set 0, lim can send sub sequent CAPS change event |
| 9635 | * otherwise lim cannot send any CAPS change events to SME */ |
| 9636 | csrSendResetApCapsChanged(pMac, &pApNewCaps->bssId); |
Madan Mohan Koyyalamudi | 3074390 | 2012-11-27 15:41:45 -0800 | [diff] [blame] | 9637 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9638 | } |
| 9639 | break; |
Gopichand Nakkala | cca24d1 | 2013-03-07 17:05:07 +0530 | [diff] [blame] | 9640 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9641 | default: |
| 9642 | roamStatus = eCSR_ROAM_FAILED; |
| 9643 | result = eCSR_ROAM_RESULT_NONE; |
| 9644 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9645 | } // end switch on statusChangeCode |
| 9646 | if(eCSR_ROAM_RESULT_NONE != result) |
| 9647 | { |
| 9648 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, roamStatus, result); |
| 9649 | } |
| 9650 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9651 | case eWNI_SME_IBSS_NEW_PEER_IND: |
| 9652 | pIbssPeerInd = (tSmeIbssPeerInd *)pSirMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9653 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9654 | { |
| 9655 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9656 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9657 | if(pIbssLog) |
| 9658 | { |
| 9659 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_JOIN; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9660 | vos_mem_copy(pIbssLog->peerMacAddr, &pIbssPeerInd->peerAddr, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9661 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9662 | } |
| 9663 | } |
| 9664 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9665 | sessionId = csrFindIbssSession( pMac ); |
| 9666 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9667 | { |
| 9668 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9669 | |
| 9670 | if(!pSession) |
| 9671 | { |
| 9672 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9673 | return; |
| 9674 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9675 | // Issue the set Context request to LIM to establish the Unicast STA context for the new peer... |
| 9676 | if(pSession->pConnectBssDesc) |
| 9677 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9678 | vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, |
| 9679 | sizeof(tCsrBssid)); |
| 9680 | vos_mem_copy(&roamInfo.bssid, pSession->pConnectBssDesc->bssId, |
| 9681 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9682 | if(pIbssPeerInd->mesgLen > sizeof(tSmeIbssPeerInd)) |
| 9683 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9684 | roamInfo.pbFrames = vos_mem_malloc((pIbssPeerInd->mesgLen |
| 9685 | - sizeof(tSmeIbssPeerInd))); |
| 9686 | if ( NULL == roamInfo.pbFrames ) |
| 9687 | status = eHAL_STATUS_FAILURE; |
| 9688 | else |
| 9689 | status = eHAL_STATUS_SUCCESS; |
| 9690 | if (HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9691 | { |
| 9692 | roamInfo.nBeaconLength = (pIbssPeerInd->mesgLen - sizeof(tSmeIbssPeerInd)); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9693 | vos_mem_copy(roamInfo.pbFrames, |
| 9694 | ((tANI_U8 *)pIbssPeerInd) + sizeof(tSmeIbssPeerInd), |
| 9695 | roamInfo.nBeaconLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9696 | } |
| 9697 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 9698 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 9699 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9700 | roamInfo.pBssDesc = vos_mem_malloc(pSession->pConnectBssDesc->length); |
| 9701 | if ( NULL == roamInfo.pBssDesc ) |
| 9702 | status = eHAL_STATUS_FAILURE; |
| 9703 | else |
| 9704 | status = eHAL_STATUS_SUCCESS; |
| 9705 | if (HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9706 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9707 | vos_mem_copy(roamInfo.pBssDesc, |
| 9708 | pSession->pConnectBssDesc, |
| 9709 | pSession->pConnectBssDesc->length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9710 | } |
| 9711 | if(HAL_STATUS_SUCCESS(status)) |
| 9712 | { |
| 9713 | pRoamInfo = &roamInfo; |
| 9714 | } |
| 9715 | else |
| 9716 | { |
| 9717 | if(roamInfo.pbFrames) |
| 9718 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9719 | vos_mem_free(roamInfo.pbFrames); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9720 | } |
| 9721 | if(roamInfo.pBssDesc) |
| 9722 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9723 | vos_mem_free(roamInfo.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9724 | } |
| 9725 | } |
| 9726 | } |
| 9727 | else |
| 9728 | { |
| 9729 | pRoamInfo = &roamInfo; |
| 9730 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 9731 | if ((eCSR_ENCRYPT_TYPE_NONE == |
| 9732 | pSession->connectedProfile.EncryptionType )) |
| 9733 | { |
| 9734 | csrRoamIssueSetContextReq( pMac, sessionId, |
| 9735 | pSession->connectedProfile.EncryptionType, |
| 9736 | pSession->pConnectBssDesc, |
| 9737 | &(pIbssPeerInd->peerAddr), |
| 9738 | FALSE, TRUE, eSIR_TX_RX, 0, 0, NULL, 0 ); // NO keys... these key parameters don't matter. |
| 9739 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9740 | } |
| 9741 | else |
| 9742 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9743 | 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] | 9744 | } |
| 9745 | //send up the sec type for the new peer |
| 9746 | if (pRoamInfo) |
| 9747 | { |
| 9748 | pRoamInfo->u.pConnectedProfile = &pSession->connectedProfile; |
| 9749 | } |
| 9750 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, |
| 9751 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
| 9752 | if(pRoamInfo) |
| 9753 | { |
| 9754 | if(roamInfo.pbFrames) |
| 9755 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9756 | vos_mem_free(roamInfo.pbFrames); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9757 | } |
| 9758 | if(roamInfo.pBssDesc) |
| 9759 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9760 | vos_mem_free(roamInfo.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9761 | } |
| 9762 | } |
| 9763 | } |
| 9764 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9765 | case eWNI_SME_IBSS_PEER_DEPARTED_IND: |
| 9766 | pIbssPeerInd = (tSmeIbssPeerInd*)pSirMsg; |
| 9767 | sessionId = csrFindIbssSession( pMac ); |
| 9768 | if( CSR_SESSION_ID_INVALID != sessionId ) |
| 9769 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9770 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9771 | { |
| 9772 | vos_log_ibss_pkt_type *pIbssLog; |
| 9773 | |
| 9774 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 9775 | if(pIbssLog) |
| 9776 | { |
| 9777 | pIbssLog->eventId = WLAN_IBSS_EVENT_PEER_LEAVE; |
| 9778 | if(pIbssPeerInd) |
| 9779 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9780 | vos_mem_copy(pIbssLog->peerMacAddr, |
| 9781 | &pIbssPeerInd->peerAddr, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9782 | } |
| 9783 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 9784 | } |
| 9785 | } |
| 9786 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9787 | smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9788 | roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; |
| 9789 | roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; |
| 9790 | roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9791 | vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, |
| 9792 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9793 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 9794 | eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
| 9795 | } |
| 9796 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9797 | case eWNI_SME_SETCONTEXT_RSP: |
| 9798 | { |
| 9799 | tSirSmeSetContextRsp *pRsp = (tSirSmeSetContextRsp *)pSirMsg; |
| 9800 | tListElem *pEntry; |
| 9801 | tSmeCmd *pCommand; |
| 9802 | |
| 9803 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9804 | if ( pEntry ) |
| 9805 | { |
| 9806 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9807 | if ( eSmeCommandSetKey == pCommand->command ) |
| 9808 | { |
| 9809 | sessionId = pCommand->sessionId; |
| 9810 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9811 | |
| 9812 | if(!pSession) |
| 9813 | { |
| 9814 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9815 | return; |
| 9816 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9817 | |
| 9818 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9819 | if(eCSR_ENCRYPT_TYPE_NONE != pSession->connectedProfile.EncryptionType) |
| 9820 | { |
| 9821 | WLAN_VOS_DIAG_EVENT_DEF(setKeyEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9822 | vos_mem_set(&setKeyEvent, |
| 9823 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9824 | if( pRsp->peerMacAddr[0] & 0x01 ) |
| 9825 | { |
| 9826 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_GTK_RSP; |
| 9827 | } |
| 9828 | else |
| 9829 | { |
| 9830 | setKeyEvent.eventId = WLAN_SECURITY_EVENT_SET_PTK_RSP; |
| 9831 | } |
| 9832 | setKeyEvent.encryptionModeMulticast = |
| 9833 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9834 | setKeyEvent.encryptionModeUnicast = |
| 9835 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9836 | vos_mem_copy(setKeyEvent.bssid, |
| 9837 | pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9838 | setKeyEvent.authMode = |
| 9839 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9840 | if( eSIR_SME_SUCCESS != pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9841 | { |
| 9842 | setKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9843 | } |
| 9844 | WLAN_VOS_DIAG_EVENT_REPORT(&setKeyEvent, EVENT_WLAN_SECURITY); |
| 9845 | } |
| 9846 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9847 | if( CSR_IS_WAIT_FOR_KEY( pMac, sessionId) ) |
| 9848 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 9849 | csrRoamStopWaitForKeyTimer( pMac ); |
| 9850 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9851 | //We are done with authentication, whethere succeed or not |
| 9852 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9853 | //We do it here because this linkup function is not called after association |
| 9854 | //when a key needs to be set. |
| 9855 | if( csrIsConnStateConnectedInfra(pMac, sessionId) ) |
| 9856 | { |
| 9857 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 9858 | } |
| 9859 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9860 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9861 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9862 | vos_mem_copy(&roamInfo.peerMac, |
| 9863 | &pRsp->peerMacAddr, sizeof(tCsrBssid)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9864 | //Make sure we install the GTK before indicating to HDD as authenticated |
| 9865 | //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] | 9866 | if ( vos_mem_compare( &Broadcastaddr, pRsp->peerMacAddr, |
| 9867 | sizeof(tSirMacAddr) ) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9868 | { |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 9869 | #ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE |
| 9870 | if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE) |
| 9871 | { |
| 9872 | tpSirSetActiveModeSetBncFilterReq pMsg; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9873 | pMsg = vos_mem_malloc(sizeof(tSirSetActiveModeSetBncFilterReq)); |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 9874 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SET_BCN_FILTER_REQ); |
| 9875 | pMsg->length = pal_cpu_to_be16(sizeof( tANI_U8)); |
| 9876 | pMsg->seesionId = sessionId; |
| 9877 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 9878 | } |
| 9879 | #endif |
| 9880 | result = eCSR_ROAM_RESULT_AUTHENTICATED; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9881 | } |
| 9882 | else |
| 9883 | { |
| 9884 | result = eCSR_ROAM_RESULT_NONE; |
| 9885 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9886 | pRoamInfo = &roamInfo; |
| 9887 | } |
| 9888 | else |
| 9889 | { |
| 9890 | result = eCSR_ROAM_RESULT_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9891 | smsLog( pMac, LOGE, "CSR: Roam Completion setkey command failed(%d) PeerMac %02X-%02X-%02X-%02X-%02X-%02X...", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9892 | pRsp->statusCode, pRsp->peerMacAddr[0], pRsp->peerMacAddr[1], pRsp->peerMacAddr[2], |
| 9893 | pRsp->peerMacAddr[3], pRsp->peerMacAddr[4], pRsp->peerMacAddr[5] ); |
| 9894 | } |
| 9895 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 9896 | eCSR_ROAM_SET_KEY_COMPLETE, result); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9897 | // Indicate SME_QOS that the SET_KEY is completed, so that SME_QOS |
| 9898 | // can go ahead and initiate the TSPEC if any are pending |
| 9899 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_SET_KEY_SUCCESS_IND, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9900 | #ifdef FEATURE_WLAN_CCX |
| 9901 | //Send Adjacent AP repot to new AP. |
| 9902 | if (result == eCSR_ROAM_RESULT_AUTHENTICATED && |
| 9903 | pSession->isPrevApInfoValid && |
| 9904 | pSession->connectedProfile.isCCXAssoc) |
| 9905 | { |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 9906 | #ifdef FEATURE_WLAN_CCX_UPLOAD |
| 9907 | csrSendCcxAdjacentApRepInd(pMac, pSession); |
| 9908 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9909 | csrCcxSendAdjacentApRepMsg(pMac, pSession); |
| 9910 | #endif |
| 9911 | pSession->isPrevApInfoValid = FALSE; |
| 9912 | } |
| 9913 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9914 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9915 | { |
| 9916 | csrReleaseCommandSetKey( pMac, pCommand ); |
| 9917 | } |
| 9918 | } |
| 9919 | else |
| 9920 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9921 | 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] | 9922 | } |
| 9923 | } |
| 9924 | else |
| 9925 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9926 | smsLog( pMac, LOGE, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9927 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9928 | smeProcessPendingQueue( pMac ); |
| 9929 | } |
| 9930 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9931 | case eWNI_SME_REMOVEKEY_RSP: |
| 9932 | { |
| 9933 | tSirSmeRemoveKeyRsp *pRsp = (tSirSmeRemoveKeyRsp *)pSirMsg; |
| 9934 | tListElem *pEntry; |
| 9935 | tSmeCmd *pCommand; |
| 9936 | |
| 9937 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 9938 | if ( pEntry ) |
| 9939 | { |
| 9940 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 9941 | if ( eSmeCommandRemoveKey == pCommand->command ) |
| 9942 | { |
| 9943 | sessionId = pCommand->sessionId; |
| 9944 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9945 | |
| 9946 | if(!pSession) |
| 9947 | { |
| 9948 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 9949 | return; |
| 9950 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9951 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 9952 | { |
| 9953 | WLAN_VOS_DIAG_EVENT_DEF(removeKeyEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9954 | vos_mem_set(&removeKeyEvent, |
| 9955 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9956 | removeKeyEvent.eventId = WLAN_SECURITY_EVENT_REMOVE_KEY_RSP; |
| 9957 | removeKeyEvent.encryptionModeMulticast = |
| 9958 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 9959 | removeKeyEvent.encryptionModeUnicast = |
| 9960 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9961 | vos_mem_copy( removeKeyEvent.bssid, |
| 9962 | pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9963 | removeKeyEvent.authMode = |
| 9964 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 9965 | if( eSIR_SME_SUCCESS != pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9966 | { |
| 9967 | removeKeyEvent.status = WLAN_SECURITY_STATUS_FAILURE; |
| 9968 | } |
| 9969 | WLAN_VOS_DIAG_EVENT_REPORT(&removeKeyEvent, EVENT_WLAN_SECURITY); |
| 9970 | } |
| 9971 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 9972 | if( eSIR_SME_SUCCESS == pRsp->statusCode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9973 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 9974 | vos_mem_copy(&roamInfo.peerMac, &pRsp->peerMacAddr, |
| 9975 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9976 | result = eCSR_ROAM_RESULT_NONE; |
| 9977 | pRoamInfo = &roamInfo; |
| 9978 | } |
| 9979 | else |
| 9980 | { |
| 9981 | result = eCSR_ROAM_RESULT_FAILURE; |
| 9982 | } |
| 9983 | csrRoamCallCallback(pMac, sessionId, &roamInfo, pCommand->u.setKeyCmd.roamId, |
| 9984 | eCSR_ROAM_REMOVE_KEY_COMPLETE, result); |
| 9985 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 9986 | { |
| 9987 | csrReleaseCommandRemoveKey( pMac, pCommand ); |
| 9988 | } |
| 9989 | } |
| 9990 | else |
| 9991 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9992 | 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] | 9993 | } |
| 9994 | } |
| 9995 | else |
| 9996 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 9997 | smsLog( pMac, LOGW, "CSR: SetKey Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9998 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9999 | smeProcessPendingQueue( pMac ); |
| 10000 | } |
| 10001 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10002 | case eWNI_SME_GET_STATISTICS_RSP: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10003 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10004 | csrRoamStatsRspProcessor( pMac, pSirMsg ); |
| 10005 | break; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 10006 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 10007 | case eWNI_SME_GET_ROAM_RSSI_RSP: |
| 10008 | smsLog( pMac, LOG2, FL("Stats rsp from PE")); |
| 10009 | csrRoamRssiRspProcessor( pMac, pSirMsg ); |
| 10010 | break; |
| 10011 | #endif |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 10012 | #if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD) |
| 10013 | case eWNI_SME_GET_TSM_STATS_RSP: |
| 10014 | smsLog( pMac, LOG2, FL("TSM Stats rsp from PE")); |
| 10015 | csrTsmStatsRspProcessor( pMac, pSirMsg ); |
| 10016 | break; |
| 10017 | #endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10018 | case eWNI_SME_GET_RSSI_REQ: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10019 | smsLog( pMac, LOG2, FL("GetRssiReq from self")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10020 | csrUpdateRssi( pMac, pSirMsg ); |
| 10021 | break; |
| 10022 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 10023 | case eWNI_SME_GET_SNR_REQ: |
| 10024 | smsLog( pMac, LOG2, FL("GetSnrReq from self")); |
| 10025 | csrUpdateSnr(pMac, pSirMsg); |
| 10026 | break; |
| 10027 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10028 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 10029 | case eWNI_SME_FT_PRE_AUTH_RSP: |
| 10030 | csrRoamFTPreAuthRspProcessor( pMac, (tpSirFTPreAuthRsp)pSirMsg ); |
| 10031 | break; |
| 10032 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10033 | case eWNI_SME_MAX_ASSOC_EXCEEDED: |
| 10034 | pSmeMaxAssocInd = (tSmeMaxAssocInd*)pSirMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10035 | 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] | 10036 | sessionId = pSmeMaxAssocInd->sessionId; |
| 10037 | roamInfo.sessionId = sessionId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10038 | vos_mem_copy(&roamInfo.peerMac, pSmeMaxAssocInd->peerMac, |
| 10039 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10040 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 10041 | eCSR_ROAM_INFRA_IND, eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 10042 | break; |
| 10043 | |
| 10044 | case eWNI_SME_BTAMP_LOG_LINK_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10045 | 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] | 10046 | btampEstablishLogLinkHdlr( pSirMsg ); |
| 10047 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10048 | case eWNI_SME_RSSI_IND: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10049 | smsLog( pMac, LOG1, FL("RSSI indication from TL serialized through MC thread")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10050 | csrRoamRssiIndHdlr( pMac, pSirMsg ); |
| 10051 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 10052 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 10053 | case eWNI_SME_CANDIDATE_FOUND_IND: |
| 10054 | smsLog( pMac, LOG2, FL("Candidate found indication from PE")); |
| 10055 | csrNeighborRoamCandidateFoundIndHdlr( pMac, pSirMsg ); |
| 10056 | break; |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 10057 | case eWNI_SME_HANDOFF_REQ: |
| 10058 | smsLog( pMac, LOG2, FL("Handoff Req from self")); |
| 10059 | csrNeighborRoamHandoffReqHdlr( pMac, pSirMsg ); |
| 10060 | break; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 10061 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10062 | |
| 10063 | default: |
| 10064 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10065 | } // end switch on message type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10066 | } |
| 10067 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10068 | void csrCallRoamingCompletionCallback(tpAniSirGlobal pMac, tCsrRoamSession *pSession, |
| 10069 | tCsrRoamInfo *pRoamInfo, tANI_U32 roamId, eCsrRoamResult roamResult) |
| 10070 | { |
| 10071 | if(pSession) |
| 10072 | { |
| 10073 | if(pSession->bRefAssocStartCnt) |
| 10074 | { |
| 10075 | pSession->bRefAssocStartCnt--; |
| 10076 | VOS_ASSERT( pSession->bRefAssocStartCnt == 0); |
| 10077 | //Need to call association_completion because there is an assoc_start pending. |
| 10078 | csrRoamCallCallback(pMac, pSession->sessionId, NULL, roamId, |
| 10079 | eCSR_ROAM_ASSOCIATION_COMPLETION, |
| 10080 | eCSR_ROAM_RESULT_FAILURE); |
| 10081 | } |
| 10082 | csrRoamCallCallback(pMac, pSession->sessionId, pRoamInfo, roamId, eCSR_ROAM_ROAMING_COMPLETION, roamResult); |
| 10083 | } |
| 10084 | else |
| 10085 | { |
| 10086 | smsLog(pMac, LOGW, FL(" pSession is NULL")); |
| 10087 | } |
| 10088 | } |
| 10089 | |
| 10090 | |
| 10091 | eHalStatus csrRoamStartRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamingReason roamingReason) |
| 10092 | { |
| 10093 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10094 | if(CSR_IS_LOSTLINK_ROAMING(roamingReason) && |
| 10095 | (eANI_BOOLEAN_FALSE == pMac->roam.roamSession[sessionId].fCancelRoaming)) |
| 10096 | { |
| 10097 | status = csrScanRequestLostLink1( pMac, sessionId ); |
| 10098 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10099 | return(status); |
| 10100 | } |
| 10101 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10102 | //return a boolean to indicate whether roaming completed or continue. |
| 10103 | tANI_BOOLEAN csrRoamCompleteRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 10104 | tANI_BOOLEAN fForce, eCsrRoamResult roamResult) |
| 10105 | { |
| 10106 | tANI_BOOLEAN fCompleted = eANI_BOOLEAN_TRUE; |
| 10107 | tANI_TIMESTAMP roamTime = (tANI_TIMESTAMP)(pMac->roam.configParam.nRoamingTime * PAL_TICKS_PER_SECOND); |
| 10108 | tANI_TIMESTAMP curTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 10109 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10110 | if(!pSession) |
| 10111 | { |
| 10112 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10113 | return eANI_BOOLEAN_FALSE; |
| 10114 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10115 | //Check whether time is up |
| 10116 | if(pSession->fCancelRoaming || fForce || |
| 10117 | ((curTime - pSession->roamingStartTime) > roamTime) || |
| 10118 | eCsrReassocRoaming == pSession->roamingReason || |
| 10119 | eCsrDynamicRoaming == pSession->roamingReason) |
| 10120 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10121 | smsLog(pMac, LOGW, FL(" indicates roaming completion")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10122 | if(pSession->fCancelRoaming && CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason)) |
| 10123 | { |
| 10124 | //roaming is cancelled, tell HDD to indicate disconnect |
| 10125 | //Because LIM overload deauth_ind for both deauth frame and missed beacon |
| 10126 | //we need to use this logic to detinguish it. For missed beacon, LIM set reason |
| 10127 | //to be eSIR_BEACON_MISSED |
| 10128 | if(eSIR_BEACON_MISSED == pSession->roamingStatusCode) |
| 10129 | { |
| 10130 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 10131 | } |
| 10132 | else if(eCsrLostlinkRoamingDisassoc == pSession->roamingReason) |
| 10133 | { |
| 10134 | roamResult = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 10135 | } |
| 10136 | else if(eCsrLostlinkRoamingDeauth == pSession->roamingReason) |
| 10137 | { |
| 10138 | roamResult = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 10139 | } |
| 10140 | else |
| 10141 | { |
| 10142 | roamResult = eCSR_ROAM_RESULT_LOSTLINK; |
| 10143 | } |
| 10144 | } |
| 10145 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 10146 | pSession->roamingReason = eCsrNotRoaming; |
| 10147 | } |
| 10148 | else |
| 10149 | { |
| 10150 | pSession->roamResult = roamResult; |
| 10151 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoamingTimer(pMac, sessionId, PAL_TIMER_TO_SEC_UNIT))) |
| 10152 | { |
| 10153 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, roamResult); |
| 10154 | pSession->roamingReason = eCsrNotRoaming; |
| 10155 | } |
| 10156 | else |
| 10157 | { |
| 10158 | fCompleted = eANI_BOOLEAN_FALSE; |
| 10159 | } |
| 10160 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10161 | return(fCompleted); |
| 10162 | } |
| 10163 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10164 | void csrRoamCancelRoaming(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10165 | { |
| 10166 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10167 | |
| 10168 | if(!pSession) |
| 10169 | { |
| 10170 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10171 | return; |
| 10172 | } |
| 10173 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10174 | if(CSR_IS_ROAMING(pSession)) |
| 10175 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10176 | smsLog(pMac, LOGW, " Cancelling roaming"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10177 | pSession->fCancelRoaming = eANI_BOOLEAN_TRUE; |
| 10178 | if(CSR_IS_ROAM_JOINING(pMac, sessionId) && CSR_IS_ROAM_SUBSTATE_CONFIG(pMac, sessionId)) |
| 10179 | { |
| 10180 | //No need to do anything in here because the handler takes care of it |
| 10181 | } |
| 10182 | else |
| 10183 | { |
| 10184 | eCsrRoamResult roamResult = CSR_IS_LOSTLINK_ROAMING(pSession->roamingReason) ? |
| 10185 | eCSR_ROAM_RESULT_LOSTLINK : eCSR_ROAM_RESULT_NONE; |
| 10186 | //Roaming is stopped after here |
| 10187 | csrRoamCompleteRoaming(pMac, sessionId, eANI_BOOLEAN_TRUE, roamResult); |
| 10188 | //Since CSR may be in lostlink roaming situation, abort all roaming related activities |
Madan Mohan Koyyalamudi | ff3a715 | 2013-06-13 14:47:55 +0530 | [diff] [blame] | 10189 | csrScanAbortMacScan(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10190 | csrRoamStopRoamingTimer(pMac, sessionId); |
| 10191 | } |
| 10192 | } |
| 10193 | } |
| 10194 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10195 | void csrRoamRoamingTimerHandler(void *pv) |
| 10196 | { |
| 10197 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 10198 | tpAniSirGlobal pMac = pInfo->pMac; |
| 10199 | tANI_U32 sessionId = pInfo->sessionId; |
| 10200 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10201 | |
| 10202 | if(!pSession) |
| 10203 | { |
| 10204 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10205 | return; |
| 10206 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10207 | |
| 10208 | if(eANI_BOOLEAN_FALSE == pSession->fCancelRoaming) |
| 10209 | { |
| 10210 | if(!HAL_STATUS_SUCCESS(csrRoamStartRoaming(pMac, sessionId, pSession->roamingReason))) |
| 10211 | { |
| 10212 | csrCallRoamingCompletionCallback(pMac, pSession, NULL, 0, pSession->roamResult); |
| 10213 | pSession->roamingReason = eCsrNotRoaming; |
| 10214 | } |
| 10215 | } |
| 10216 | } |
| 10217 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10218 | eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 10219 | { |
| 10220 | eHalStatus status; |
| 10221 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10222 | |
| 10223 | if(!pSession) |
| 10224 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10225 | smsLog(pMac, LOGE, FL(" session %d not found"), sessionId); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10226 | return eHAL_STATUS_FAILURE; |
| 10227 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10228 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10229 | smsLog(pMac, LOG1, " csrScanStartRoamingTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10230 | pSession->roamingTimerInfo.sessionId = (tANI_U8)sessionId; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10231 | status = vos_timer_start(&pSession->hTimerRoaming, interval/PAL_TIMER_TO_MS_UNIT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10232 | |
| 10233 | return (status); |
| 10234 | } |
| 10235 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10236 | eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 10237 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10238 | return (vos_timer_stop(&pMac->roam.roamSession[sessionId].hTimerRoaming)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10239 | } |
| 10240 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10241 | void csrRoamWaitForKeyTimeOutHandler(void *pv) |
| 10242 | { |
| 10243 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 10244 | tpAniSirGlobal pMac = pInfo->pMac; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10245 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pInfo->sessionId ); |
| 10246 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10247 | smsLog(pMac, LOGW, "WaitForKey timer expired in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10248 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 10249 | pMac->roam.curSubState[pInfo->sessionId]); |
| 10250 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10251 | if( CSR_IS_WAIT_FOR_KEY( pMac, pInfo->sessionId ) ) |
| 10252 | { |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10253 | #ifdef FEATURE_WLAN_LFR |
| 10254 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 10255 | { |
| 10256 | /* |
| 10257 | * Enable heartbeat timer when hand-off is in progress |
| 10258 | * and Key Wait timer expired. |
| 10259 | */ |
| 10260 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey expiry" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10261 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10262 | pMac->roam.configParam.HeartbeatThresh24); |
| 10263 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 10264 | pMac->roam.configParam.HeartbeatThresh24, |
| 10265 | NULL, eANI_BOOLEAN_FALSE); |
| 10266 | } |
| 10267 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10268 | smsLog(pMac, LOGW, " SME pre-auth state timeout. "); |
Praveen Kumar Sirisilla | 8bdfac4 | 2013-10-10 17:20:48 -0700 | [diff] [blame] | 10269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10270 | //Change the substate so command queue is unblocked. |
Praveen Kumar Sirisilla | 8bdfac4 | 2013-10-10 17:20:48 -0700 | [diff] [blame] | 10271 | if (CSR_ROAM_SESSION_MAX > pInfo->sessionId) |
| 10272 | { |
| 10273 | csrRoamSubstateChange(pMac, eCSR_ROAM_SUBSTATE_NONE, |
| 10274 | pInfo->sessionId); |
| 10275 | } |
| 10276 | |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10277 | if (pSession) |
| 10278 | { |
| 10279 | if( csrIsConnStateConnectedInfra(pMac, pInfo->sessionId) ) |
| 10280 | { |
| 10281 | csrRoamLinkUp(pMac, pSession->connectedProfile.bssid); |
| 10282 | smeProcessPendingQueue(pMac); |
| 10283 | } |
| 10284 | else |
| 10285 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10286 | smsLog(pMac, LOGW, "%s: could not post link up", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10287 | __func__); |
| 10288 | } |
| 10289 | } |
| 10290 | else |
| 10291 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10292 | smsLog(pMac, LOGW, "%s: session not found", __func__); |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10293 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10294 | } |
| 10295 | |
| 10296 | } |
| 10297 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10298 | eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval) |
| 10299 | { |
| 10300 | eHalStatus status; |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10301 | #ifdef FEATURE_WLAN_LFR |
| 10302 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 10303 | { |
| 10304 | /* Disable heartbeat timer when hand-off is in progress */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10305 | smsLog(pMac, LOG2, "%s: disabling HB timer in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10306 | __func__, |
| 10307 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 10308 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 10309 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, 0, NULL, eANI_BOOLEAN_FALSE); |
| 10310 | } |
| 10311 | #endif |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10312 | smsLog(pMac, LOG1, " csrScanStartWaitForKeyTimer"); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10313 | 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] | 10314 | |
| 10315 | return (status); |
| 10316 | } |
| 10317 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10318 | eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac) |
| 10319 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10320 | smsLog(pMac, LOG2, "WaitForKey timer stopped in state=%d sub-state=%d", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10321 | pMac->roam.neighborRoamInfo.neighborRoamState, |
| 10322 | pMac->roam.curSubState[pMac->roam.WaitForKeyTimerInfo.sessionId]); |
| 10323 | #ifdef FEATURE_WLAN_LFR |
| 10324 | if (csrNeighborRoamIsHandoffInProgress(pMac)) |
| 10325 | { |
| 10326 | /* |
| 10327 | * Enable heartbeat timer when hand-off is in progress |
| 10328 | * and Key Wait timer got stopped for some reason |
| 10329 | */ |
| 10330 | smsLog(pMac, LOG2, "Enabling HB timer after WaitKey stop" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10331 | " (nHBCount=%d)", |
Srikant Kuppa | e6812eb | 2012-12-27 17:34:52 -0800 | [diff] [blame] | 10332 | pMac->roam.configParam.HeartbeatThresh24); |
| 10333 | ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, |
| 10334 | pMac->roam.configParam.HeartbeatThresh24, |
| 10335 | NULL, eANI_BOOLEAN_FALSE); |
| 10336 | } |
| 10337 | #endif |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 10338 | return (vos_timer_stop(&pMac->roam.hTimerWaitForKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10339 | } |
| 10340 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10341 | void csrRoamCompletion(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamInfo *pRoamInfo, tSmeCmd *pCommand, |
| 10342 | eCsrRoamResult roamResult, tANI_BOOLEAN fSuccess) |
| 10343 | { |
| 10344 | eRoamCmdStatus roamStatus = csrGetRoamCompleteStatus(pMac, sessionId); |
| 10345 | tANI_U32 roamId = 0; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10346 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 10347 | /* To silence the KW tool Null chaeck is added */ |
| 10348 | if(!pSession) |
| 10349 | { |
| 10350 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10351 | return; |
| 10352 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10353 | |
| 10354 | if(pCommand) |
| 10355 | { |
| 10356 | roamId = pCommand->u.roamCmd.roamId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10357 | VOS_ASSERT( sessionId == pCommand->sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10358 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10359 | if(eCSR_ROAM_ROAMING_COMPLETION == roamStatus) |
| 10360 | { |
| 10361 | //if success, force roaming completion |
| 10362 | csrRoamCompleteRoaming(pMac, sessionId, fSuccess, roamResult); |
| 10363 | } |
| 10364 | else |
| 10365 | { |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10366 | VOS_ASSERT(pSession->bRefAssocStartCnt == 0); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10367 | smsLog(pMac, LOGW, FL(" indicates association completion. roamResult = %d"), roamResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10368 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, roamId, roamStatus, roamResult); |
| 10369 | } |
| 10370 | } |
| 10371 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10372 | eHalStatus csrRoamLostLink( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 type, tSirSmeRsp *pSirMsg) |
| 10373 | { |
| 10374 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10375 | tSirSmeDeauthInd *pDeauthIndMsg = NULL; |
| 10376 | tSirSmeDisassocInd *pDisassocIndMsg = NULL; |
| 10377 | eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; |
| 10378 | tCsrRoamInfo *pRoamInfo = NULL; |
| 10379 | tCsrRoamInfo roamInfo; |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10380 | tANI_BOOLEAN fToRoam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10381 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 10382 | /* To silence the KW tool Null chaeck is added */ |
| 10383 | if(!pSession) |
| 10384 | { |
| 10385 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10386 | return eHAL_STATUS_FAILURE; |
| 10387 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10388 | //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] | 10389 | fToRoam = CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10390 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
| 10391 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 10392 | { |
| 10393 | result = eCSR_ROAM_RESULT_DISASSOC_IND; |
| 10394 | pDisassocIndMsg = (tSirSmeDisassocInd *)pSirMsg; |
| 10395 | pSession->roamingStatusCode = pDisassocIndMsg->statusCode; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 10396 | pSession->joinFailStatusCode.reasonCode = pDisassocIndMsg->reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10397 | } |
| 10398 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 10399 | { |
| 10400 | result = eCSR_ROAM_RESULT_DEAUTH_IND; |
| 10401 | pDeauthIndMsg = (tSirSmeDeauthInd *)pSirMsg; |
| 10402 | pSession->roamingStatusCode = pDeauthIndMsg->statusCode; |
Madan Mohan Koyyalamudi | 6a80893 | 2012-11-06 16:05:54 -0800 | [diff] [blame] | 10403 | /* Convert into proper reason code */ |
| 10404 | pSession->joinFailStatusCode.reasonCode = |
| 10405 | (pDeauthIndMsg->reasonCode == eSIR_BEACON_MISSED) ? |
Agarwal Ashish | 838f1f3 | 2013-03-11 20:54:52 +0530 | [diff] [blame] | 10406 | 0 : pDeauthIndMsg->reasonCode; |
| 10407 | /* cfg layer expects 0 as reason code if |
| 10408 | the driver dosent know the reason code |
| 10409 | eSIR_BEACON_MISSED is defined as locally */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10410 | } |
| 10411 | else |
| 10412 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10413 | smsLog(pMac, LOGW, FL("gets an unknown type (%d)"), type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10414 | result = eCSR_ROAM_RESULT_NONE; |
Mohit Khanna | 99d5fd0 | 2012-09-11 14:51:20 -0700 | [diff] [blame] | 10415 | pSession->joinFailStatusCode.reasonCode = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10416 | } |
| 10417 | |
| 10418 | // call profile lost link routine here |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10419 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10420 | { |
| 10421 | csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_LOSTLINK_DETECTED, result); |
| 10422 | } |
| 10423 | |
| 10424 | if ( eWNI_SME_DISASSOC_IND == type ) |
| 10425 | { |
| 10426 | status = csrSendMBDisassocCnfMsg(pMac, pDisassocIndMsg); |
| 10427 | } |
| 10428 | else if ( eWNI_SME_DEAUTH_IND == type ) |
| 10429 | { |
| 10430 | status = csrSendMBDeauthCnfMsg(pMac, pDeauthIndMsg); |
| 10431 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10432 | if(!HAL_STATUS_SUCCESS(status)) |
| 10433 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10434 | //If fail to send confirmation to PE, not to trigger roaming |
| 10435 | fToRoam = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10436 | } |
| 10437 | |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10438 | //prepare to tell HDD to disconnect |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10439 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10440 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 10441 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10442 | if( eWNI_SME_DISASSOC_IND == type) |
| 10443 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10444 | //staMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10445 | vos_mem_copy(roamInfo.peerMac, pDisassocIndMsg->peerMacAddr, |
| 10446 | sizeof(tSirMacAddr)); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10447 | roamInfo.staId = (tANI_U8)pDisassocIndMsg->staId; |
| 10448 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10449 | else if( eWNI_SME_DEAUTH_IND == type ) |
| 10450 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10451 | //staMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10452 | vos_mem_copy(roamInfo.peerMac, pDeauthIndMsg->peerMacAddr, |
| 10453 | sizeof(tSirMacAddr)); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10454 | roamInfo.staId = (tANI_U8)pDeauthIndMsg->staId; |
| 10455 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10456 | smsLog(pMac, LOGW, FL("roamInfo.staId (%d)"), roamInfo.staId); |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10457 | |
| 10458 | /* See if we can possibly roam. If so, start the roaming process and notify HDD |
| 10459 | that we are roaming. But if we cannot possibly roam, or if we are unable to |
| 10460 | currently roam, then notify HDD of the lost link */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10461 | if(fToRoam) |
| 10462 | { |
| 10463 | //Only remove the connected BSS in infrastructure mode |
| 10464 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 10465 | //Not to do anying for lostlink with WDS |
| 10466 | if( pMac->roam.configParam.nRoamingTime ) |
| 10467 | { |
| 10468 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac, sessionId, |
| 10469 | ( eWNI_SME_DEAUTH_IND == type ) ? |
| 10470 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc))) |
| 10471 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10472 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10473 | //For IBSS, we need to give some more info to HDD |
| 10474 | if(csrIsBssTypeIBSS(pSession->connectedProfile.BSSType)) |
| 10475 | { |
| 10476 | roamInfo.u.pConnectedProfile = &pSession->connectedProfile; |
| 10477 | roamInfo.statusCode = (tSirResultCodes)pSession->roamingStatusCode; |
| 10478 | roamInfo.reasonCode = pSession->joinFailStatusCode.reasonCode; |
| 10479 | } |
| 10480 | else |
| 10481 | { |
| 10482 | roamInfo.reasonCode = eCsrRoamReasonSmeIssuedForLostLink; |
| 10483 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10484 | pRoamInfo = &roamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10485 | pSession->roamingReason = ( eWNI_SME_DEAUTH_IND == type ) ? |
| 10486 | eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc; |
| 10487 | pSession->roamingStartTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 10488 | csrRoamCallCallback(pMac, sessionId, pRoamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_LOSTLINK); |
| 10489 | } |
| 10490 | else |
| 10491 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 10492 | smsLog(pMac, LOGW, " %s Fail to start roaming, status = %d", __func__, status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10493 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10494 | } |
| 10495 | } |
| 10496 | else |
| 10497 | { |
| 10498 | //We are told not to roam, indicate lostlink |
| 10499 | fToRoam = eANI_BOOLEAN_FALSE; |
| 10500 | } |
| 10501 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10502 | if(!fToRoam) |
| 10503 | { |
Madan Mohan Koyyalamudi | af854cf | 2012-10-30 17:56:25 -0700 | [diff] [blame] | 10504 | //Tell HDD about the lost link |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10505 | if(!CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10506 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10507 | /* Don't call csrRoamCallCallback for GO/SoftAp case as this indication |
| 10508 | * was already given as part of eWNI_SME_DISASSOC_IND msg handling in |
| 10509 | * csrRoamCheckForLinkStatusChange API. |
| 10510 | */ |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 10511 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_LOSTLINK, result); |
| 10512 | } |
| 10513 | |
| 10514 | /*No need to start idle scan in case of IBSS/SAP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10515 | Still enable idle scan for polling in case concurrent sessions are running */ |
| 10516 | if(CSR_IS_INFRASTRUCTURE(&pSession->connectedProfile)) |
| 10517 | { |
Jeff Johnson | fff4deb | 2013-02-17 10:32:30 -0800 | [diff] [blame] | 10518 | csrScanStartIdleScan(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10519 | } |
| 10520 | } |
| 10521 | |
| 10522 | return (status); |
| 10523 | } |
| 10524 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10525 | eHalStatus csrRoamLostLinkAfterhandoffFailure( tpAniSirGlobal pMac,tANI_U32 sessionId) |
| 10526 | { |
| 10527 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 10528 | tListElem *pEntry = NULL; |
| 10529 | tSmeCmd *pCommand = NULL; |
| 10530 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10531 | |
| 10532 | if(!pSession) |
| 10533 | { |
| 10534 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10535 | return eHAL_STATUS_FAILURE; |
| 10536 | } |
| 10537 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10538 | pSession->fCancelRoaming = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10539 | //Only remove the connected BSS in infrastructure mode |
| 10540 | csrRoamRemoveConnectedBssFromScanCache(pMac, &pSession->connectedProfile); |
| 10541 | if(pMac->roam.configParam.nRoamingTime) |
| 10542 | { |
| 10543 | if(HAL_STATUS_SUCCESS(status = csrRoamStartRoaming(pMac,sessionId, pSession->roamingReason))) |
| 10544 | { |
| 10545 | //before starting the lost link logic release the roam command for handoff |
| 10546 | pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); |
| 10547 | if(pEntry) |
| 10548 | { |
| 10549 | pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); |
| 10550 | } |
| 10551 | if(pCommand) |
| 10552 | { |
| 10553 | if (( eSmeCommandRoam == pCommand->command ) && |
| 10554 | ( eCsrSmeIssuedAssocToSimilarAP == pCommand->u.roamCmd.roamReason)) |
| 10555 | { |
| 10556 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10557 | { |
| 10558 | csrReleaseCommandRoam( pMac, pCommand ); |
| 10559 | } |
| 10560 | } |
| 10561 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10562 | smsLog( pMac, LOGW, "Lost link roaming started ..."); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10563 | } |
| 10564 | } |
| 10565 | else |
| 10566 | { |
| 10567 | //We are told not to roam, indicate lostlink |
| 10568 | status = eHAL_STATUS_FAILURE; |
| 10569 | } |
| 10570 | |
| 10571 | return (status); |
| 10572 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10573 | void csrRoamWmStatusChangeComplete( tpAniSirGlobal pMac ) |
| 10574 | { |
| 10575 | tListElem *pEntry; |
| 10576 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10577 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 10578 | if ( pEntry ) |
| 10579 | { |
| 10580 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 10581 | if ( eSmeCommandWmStatusChange == pCommand->command ) |
| 10582 | { |
| 10583 | // Nothing to process in a Lost Link completion.... It just kicks off a |
| 10584 | // roaming sequence. |
| 10585 | if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK ) ) |
| 10586 | { |
| 10587 | csrReleaseCommandWmStatusChange( pMac, pCommand ); |
| 10588 | } |
| 10589 | else |
| 10590 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10591 | smsLog( pMac, LOGE, " ******csrRoamWmStatusChangeComplete fail to release command"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10592 | } |
| 10593 | |
| 10594 | } |
| 10595 | else |
| 10596 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10597 | 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] | 10598 | } |
| 10599 | } |
| 10600 | else |
| 10601 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10602 | smsLog( pMac, LOGW, "CSR: WmStatusChange Completion called but NO commands are ACTIVE ..." ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10603 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10604 | smeProcessPendingQueue( pMac ); |
| 10605 | } |
| 10606 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10607 | void csrRoamProcessWmStatusChangeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 10608 | { |
| 10609 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 10610 | tSirSmeRsp *pSirSmeMsg; |
| 10611 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pCommand->sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10612 | |
| 10613 | if(!pSession) |
| 10614 | { |
| 10615 | smsLog(pMac, LOGE, FL(" session %d not found "), pCommand->sessionId); |
| 10616 | return; |
| 10617 | } |
| 10618 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10619 | switch ( pCommand->u.wmStatusChangeCmd.Type ) |
| 10620 | { |
| 10621 | case eCsrDisassociated: |
| 10622 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DisassocIndMsg; |
| 10623 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DISASSOC_IND, pSirSmeMsg); |
| 10624 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10625 | case eCsrDeauthenticated: |
| 10626 | pSirSmeMsg = (tSirSmeRsp *)&pCommand->u.wmStatusChangeCmd.u.DeauthIndMsg; |
| 10627 | status = csrRoamLostLink(pMac, pCommand->sessionId, eWNI_SME_DEAUTH_IND, pSirSmeMsg); |
| 10628 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10629 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10630 | 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] | 10631 | break; |
| 10632 | } |
| 10633 | //For WDS, we want to stop BSS as well when it is indicated that it is disconnected. |
| 10634 | if( CSR_IS_CONN_WDS(&pSession->connectedProfile) ) |
| 10635 | { |
| 10636 | if( !HAL_STATUS_SUCCESS(csrRoamIssueStopBssCmd( pMac, pCommand->sessionId, eANI_BOOLEAN_TRUE )) ) |
| 10637 | { |
| 10638 | //This is not good |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10639 | smsLog(pMac, LOGE, FL(" failed to issue stopBSS command")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10640 | } |
| 10641 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10642 | // Lost Link just triggers a roaming sequence. We can complte the Lost Link |
| 10643 | // command here since there is nothing else to do. |
| 10644 | csrRoamWmStatusChangeComplete( pMac ); |
| 10645 | } |
| 10646 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10647 | //This function returns band and mode information. |
| 10648 | //The only tricky part is that if phyMode is set to 11abg, this function may return eCSR_CFG_DOT11_MODE_11B |
| 10649 | //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] | 10650 | static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 10651 | tANI_U8 operationChn, eCsrBand *pBand ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10652 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10653 | eCsrPhyMode phyModeIn = (eCsrPhyMode)pProfile->phyMode; |
| 10654 | eCsrCfgDot11Mode cfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(pProfile, phyModeIn, |
| 10655 | pMac->roam.configParam.ProprietaryRatesEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10656 | eCsrBand eBand; |
Madan Mohan Koyyalamudi | 4ff9cd6 | 2012-10-30 17:48:57 -0700 | [diff] [blame] | 10657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10658 | //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] | 10659 | if( ((!CSR_IS_INFRA_AP(pProfile )&& !CSR_IS_WDS(pProfile )) && |
| 10660 | ((eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) || |
| 10661 | (eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode))) || |
| 10662 | (eCSR_CFG_DOT11_MODE_AUTO == cfgDot11Mode) || (eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10663 | { |
| 10664 | switch( pMac->roam.configParam.uCfgDot11Mode ) |
| 10665 | { |
| 10666 | case eCSR_CFG_DOT11_MODE_11A: |
| 10667 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10668 | eBand = eCSR_BAND_5G; |
| 10669 | break; |
| 10670 | case eCSR_CFG_DOT11_MODE_11B: |
| 10671 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10672 | eBand = eCSR_BAND_24; |
| 10673 | break; |
| 10674 | case eCSR_CFG_DOT11_MODE_11G: |
| 10675 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 10676 | eBand = eCSR_BAND_24; |
| 10677 | break; |
| 10678 | case eCSR_CFG_DOT11_MODE_11N: |
| 10679 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10680 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10681 | break; |
| 10682 | #ifdef WLAN_FEATURE_11AC |
| 10683 | case eCSR_CFG_DOT11_MODE_11AC: |
| 10684 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 10685 | { |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 10686 | /* If the operating channel is in 2.4 GHz band, check for |
| 10687 | * INI item to disable VHT operation in 2.4 GHz band |
| 10688 | */ |
| 10689 | if (CSR_IS_CHANNEL_24GHZ(operationChn) && |
| 10690 | !pMac->roam.configParam.enableVhtFor24GHz) |
| 10691 | { |
| 10692 | /* Disable 11AC operation */ |
| 10693 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10694 | } |
| 10695 | else |
| 10696 | { |
| 10697 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 10698 | } |
| 10699 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10700 | } |
| 10701 | else |
| 10702 | { |
| 10703 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10704 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10705 | } |
| 10706 | break; |
| 10707 | case eCSR_CFG_DOT11_MODE_11AC_ONLY: |
| 10708 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 10709 | { |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 10710 | /* If the operating channel is in 2.4 GHz band, check for |
| 10711 | * INI item to disable VHT operation in 2.4 GHz band |
| 10712 | */ |
| 10713 | if (CSR_IS_CHANNEL_24GHZ(operationChn) && |
| 10714 | !pMac->roam.configParam.enableVhtFor24GHz) |
| 10715 | { |
| 10716 | /* Disable 11AC operation */ |
| 10717 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10718 | } |
| 10719 | else |
| 10720 | { |
| 10721 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC_ONLY; |
| 10722 | } |
| 10723 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10724 | } |
| 10725 | else |
| 10726 | { |
| 10727 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10728 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10729 | } |
| 10730 | break; |
| 10731 | #endif |
| 10732 | case eCSR_CFG_DOT11_MODE_AUTO: |
| 10733 | eBand = pMac->roam.configParam.eBand; |
| 10734 | if (eCSR_BAND_24 == eBand) |
| 10735 | { |
| 10736 | // WiFi tests require IBSS networks to start in 11b mode |
| 10737 | // without any change to the default parameter settings |
| 10738 | // on the adapter. We use ACU to start an IBSS through |
| 10739 | // creation of a startIBSS profile. This startIBSS profile |
| 10740 | // has Auto MACProtocol and the adapter property setting |
| 10741 | // for dot11Mode is also AUTO. So in this case, let's |
| 10742 | // start the IBSS network in 11b mode instead of 11g mode. |
| 10743 | // So this is for Auto=profile->MacProtocol && Auto=Global. |
| 10744 | // dot11Mode && profile->channel is < 14, then start the IBSS |
| 10745 | // in b mode. |
| 10746 | // |
| 10747 | // Note: we used to have this start as an 11g IBSS for best |
| 10748 | // performance... now to specify that the user will have to |
| 10749 | // set the do11Mode in the property page to 11g to force it. |
| 10750 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10751 | } |
| 10752 | else |
| 10753 | { |
| 10754 | #ifdef WLAN_FEATURE_11AC |
| 10755 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 10756 | { |
Ravi Joshi | acc8182 | 2013-10-10 15:30:41 -0700 | [diff] [blame] | 10757 | /* If the operating channel is in 2.4 GHz band, check for |
| 10758 | * INI item to disable VHT operation in 2.4 GHz band |
| 10759 | */ |
| 10760 | if (CSR_IS_CHANNEL_24GHZ(operationChn) && |
| 10761 | !pMac->roam.configParam.enableVhtFor24GHz) |
| 10762 | { |
| 10763 | /* Disable 11AC operation */ |
| 10764 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10765 | } |
| 10766 | else |
| 10767 | { |
| 10768 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 10769 | } |
| 10770 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10771 | } |
| 10772 | else |
| 10773 | { |
| 10774 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10775 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10776 | } |
| 10777 | #else |
| 10778 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 10779 | eBand = CSR_IS_CHANNEL_24GHZ(operationChn) ? eCSR_BAND_24 : eCSR_BAND_5G; |
| 10780 | #endif |
| 10781 | } |
| 10782 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10783 | default: |
| 10784 | // Global dot11 Mode setting is 11a/b/g. |
| 10785 | // use the channel number to determine the Mode setting. |
| 10786 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 10787 | { |
| 10788 | eBand = pMac->roam.configParam.eBand; |
| 10789 | if(eCSR_BAND_24 == eBand) |
| 10790 | { |
| 10791 | //See reason in else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) to pick 11B |
| 10792 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10793 | } |
| 10794 | else |
| 10795 | { |
| 10796 | //prefer 5GHz |
| 10797 | eBand = eCSR_BAND_5G; |
| 10798 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10799 | } |
| 10800 | } |
| 10801 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10802 | { |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10803 | // WiFi tests require IBSS networks to start in 11b mode |
| 10804 | // without any change to the default parameter settings |
| 10805 | // on the adapter. We use ACU to start an IBSS through |
| 10806 | // creation of a startIBSS profile. This startIBSS profile |
| 10807 | // has Auto MACProtocol and the adapter property setting |
| 10808 | // for dot11Mode is also AUTO. So in this case, let's |
| 10809 | // start the IBSS network in 11b mode instead of 11g mode. |
| 10810 | // So this is for Auto=profile->MacProtocol && Auto=Global. |
| 10811 | // dot11Mode && profile->channel is < 14, then start the IBSS |
| 10812 | // in b mode. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10813 | // |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10814 | // Note: we used to have this start as an 11g IBSS for best |
| 10815 | // performance... now to specify that the user will have to |
| 10816 | // set the do11Mode in the property page to 11g to force it. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10817 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10818 | eBand = eCSR_BAND_24; |
| 10819 | } |
| 10820 | else |
| 10821 | { |
| 10822 | // else, it's a 5.0GHz channel. Set mode to 11a. |
| 10823 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10824 | eBand = eCSR_BAND_5G; |
| 10825 | } |
| 10826 | break; |
| 10827 | }//switch |
| 10828 | }//if( eCSR_CFG_DOT11_MODE_ABG == cfgDot11Mode ) |
| 10829 | else |
| 10830 | { |
| 10831 | //dot11 mode is set, lets pick the band |
| 10832 | if ( eCSR_OPERATING_CHANNEL_AUTO == operationChn ) |
| 10833 | { |
| 10834 | // channel is Auto also. |
| 10835 | eBand = pMac->roam.configParam.eBand; |
| 10836 | if(eCSR_BAND_ALL == eBand) |
| 10837 | { |
| 10838 | //prefer 5GHz |
| 10839 | eBand = eCSR_BAND_5G; |
| 10840 | } |
| 10841 | } |
| 10842 | else if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10843 | { |
| 10844 | eBand = eCSR_BAND_24; |
| 10845 | } |
| 10846 | else |
| 10847 | { |
| 10848 | eBand = eCSR_BAND_5G; |
| 10849 | } |
Ravi Joshi | a96ceb4 | 2013-05-20 18:52:39 -0700 | [diff] [blame] | 10850 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10851 | if(pBand) |
| 10852 | { |
| 10853 | *pBand = eBand; |
| 10854 | } |
| 10855 | |
| 10856 | if (operationChn == 14){ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 10857 | smsLog(pMac, LOGE, FL(" Switching to Dot11B mode ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10858 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 10859 | } |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10860 | |
Madan Mohan Koyyalamudi | 5ec4b18 | 2012-11-28 16:15:17 -0800 | [diff] [blame] | 10861 | /* Incase of WEP Security encryption type is coming as part of add key. So while STart BSS dont have information */ |
| 10862 | 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] | 10863 | ((eCSR_CFG_DOT11_MODE_11N == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10864 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 10865 | (eCSR_CFG_DOT11_MODE_11AC == cfgDot11Mode) || |
Madan Mohan Koyyalamudi | 91f8e9f | 2012-10-22 15:11:56 -0700 | [diff] [blame] | 10866 | #endif |
Madan Mohan Koyyalamudi | 84a8b2e | 2012-10-22 15:15:14 -0700 | [diff] [blame] | 10867 | (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11Mode)) ) |
| 10868 | { |
| 10869 | //We cannot do 11n here |
| 10870 | if ( CSR_IS_CHANNEL_24GHZ(operationChn) ) |
| 10871 | { |
| 10872 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 10873 | } |
| 10874 | else |
| 10875 | { |
| 10876 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 10877 | } |
| 10878 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10879 | return( cfgDot11Mode ); |
| 10880 | } |
| 10881 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10882 | eHalStatus csrRoamIssueStopBss( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamSubState NewSubstate ) |
| 10883 | { |
| 10884 | eHalStatus status; |
| 10885 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 10886 | |
| 10887 | if(!pSession) |
| 10888 | { |
| 10889 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 10890 | return eHAL_STATUS_FAILURE; |
| 10891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10892 | |
| 10893 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 10894 | { |
| 10895 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10896 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 10897 | if(pIbssLog) |
| 10898 | { |
| 10899 | pIbssLog->eventId = WLAN_IBSS_EVENT_STOP_REQ; |
| 10900 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 10901 | } |
| 10902 | } |
| 10903 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10904 | // Set the roaming substate to 'stop Bss request'... |
| 10905 | csrRoamSubstateChange( pMac, NewSubstate, sessionId ); |
| 10906 | |
| 10907 | // attempt to stop the Bss (reason code is ignored...) |
| 10908 | status = csrSendMBStopBssReqMsg( pMac, sessionId ); |
Gopichand Nakkala | 9b89a73 | 2012-12-31 16:31:46 -0800 | [diff] [blame] | 10909 | if(!HAL_STATUS_SUCCESS(status)) |
| 10910 | { |
| 10911 | smsLog(pMac, LOGW, FL("csrSendMBStopBssReqMsg failed with status %d"), status); |
| 10912 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10913 | return (status); |
| 10914 | } |
| 10915 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10916 | //pNumChan is a caller allocated space with the sizeof pChannels |
| 10917 | eHalStatus csrGetCfgValidChannels(tpAniSirGlobal pMac, tANI_U8 *pChannels, tANI_U32 *pNumChan) |
| 10918 | { |
| 10919 | |
| 10920 | return (ccmCfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 10921 | (tANI_U8 *)pChannels, |
| 10922 | pNumChan)); |
| 10923 | } |
| 10924 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 10925 | tPowerdBm csrGetCfgMaxTxPower (tpAniSirGlobal pMac, tANI_U8 channel) |
| 10926 | { |
| 10927 | tANI_U32 cfgLength = 0; |
| 10928 | tANI_U16 cfgId = 0; |
| 10929 | tPowerdBm maxTxPwr = 0; |
| 10930 | tANI_U8 *pCountryInfo = NULL; |
| 10931 | eHalStatus status; |
| 10932 | tANI_U8 count = 0; |
| 10933 | tANI_U8 firstChannel; |
| 10934 | tANI_U8 maxChannels; |
| 10935 | |
| 10936 | if (CSR_IS_CHANNEL_5GHZ(channel)) |
| 10937 | { |
| 10938 | cfgId = WNI_CFG_MAX_TX_POWER_5; |
| 10939 | cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN; |
| 10940 | } |
| 10941 | else if (CSR_IS_CHANNEL_24GHZ(channel)) |
| 10942 | { |
| 10943 | cfgId = WNI_CFG_MAX_TX_POWER_2_4; |
| 10944 | cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN; |
| 10945 | } |
| 10946 | else |
| 10947 | return maxTxPwr; |
| 10948 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10949 | pCountryInfo = vos_mem_malloc(cfgLength); |
| 10950 | if ( NULL == pCountryInfo ) |
| 10951 | status = eHAL_STATUS_FAILURE; |
| 10952 | else |
| 10953 | status = eHAL_STATUS_SUCCESS; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 10954 | if (status != eHAL_STATUS_SUCCESS) |
| 10955 | { |
| 10956 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10957 | FL("%s: failed to allocate memory, status = %d"), |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 10958 | __FUNCTION__, status); |
| 10959 | goto error; |
| 10960 | } |
| 10961 | status = ccmCfgGetStr(pMac, cfgId, (tANI_U8 *)pCountryInfo, &cfgLength); |
| 10962 | if (status != eHAL_STATUS_SUCCESS) |
| 10963 | { |
| 10964 | goto error; |
| 10965 | } |
| 10966 | /* Identify the channel and maxtxpower */ |
| 10967 | while (count <= (cfgLength - (sizeof(tSirMacChanInfo)))) |
| 10968 | { |
| 10969 | firstChannel = pCountryInfo[count++]; |
| 10970 | maxChannels = pCountryInfo[count++]; |
| 10971 | maxTxPwr = pCountryInfo[count++]; |
| 10972 | |
| 10973 | if ((channel >= firstChannel) && |
| 10974 | (channel < (firstChannel + maxChannels))) |
| 10975 | { |
| 10976 | break; |
| 10977 | } |
| 10978 | } |
| 10979 | |
| 10980 | error: |
| 10981 | if (NULL != pCountryInfo) |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 10982 | vos_mem_free(pCountryInfo); |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 10983 | |
| 10984 | return maxTxPwr; |
| 10985 | } |
| 10986 | |
| 10987 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10988 | tANI_BOOLEAN csrRoamIsChannelValid( tpAniSirGlobal pMac, tANI_U8 channel ) |
| 10989 | { |
| 10990 | tANI_BOOLEAN fValid = FALSE; |
| 10991 | tANI_U32 idxValidChannels; |
| 10992 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 10993 | |
| 10994 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &len))) |
| 10995 | { |
| 10996 | for ( idxValidChannels = 0; ( idxValidChannels < len ); idxValidChannels++ ) |
| 10997 | { |
| 10998 | if ( channel == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 10999 | { |
| 11000 | fValid = TRUE; |
| 11001 | break; |
| 11002 | } |
| 11003 | } |
| 11004 | } |
| 11005 | pMac->roam.numValidChannels = len; |
| 11006 | return fValid; |
| 11007 | } |
| 11008 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11009 | tANI_BOOLEAN csrRoamIsValid40MhzChannel(tpAniSirGlobal pMac, tANI_U8 channel) |
| 11010 | { |
| 11011 | tANI_BOOLEAN fValid = eANI_BOOLEAN_FALSE; |
| 11012 | tANI_U8 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11013 | for(i = 0; i < pMac->scan.base40MHzChannels.numChannels; i++) |
| 11014 | { |
| 11015 | if(channel == pMac->scan.base40MHzChannels.channelList[i]) |
| 11016 | { |
| 11017 | fValid = eANI_BOOLEAN_TRUE; |
| 11018 | break; |
| 11019 | } |
| 11020 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11021 | return (fValid); |
| 11022 | } |
| 11023 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11024 | //This function check and validate whether the NIC can do CB (40MHz) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11025 | static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11026 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11027 | ePhyChanBondState eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11028 | tANI_U8 centerChn; |
| 11029 | tANI_U32 ChannelBondingMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11030 | if(CSR_IS_CHANNEL_24GHZ(primaryChn)) |
| 11031 | { |
| 11032 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 11033 | } |
| 11034 | else |
| 11035 | { |
| 11036 | ChannelBondingMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 11037 | } |
| 11038 | //Figure what the other side's CB mode |
| 11039 | if(WNI_CFG_CHANNEL_BONDING_MODE_DISABLE != ChannelBondingMode) |
| 11040 | { |
| 11041 | if(pIes->HTCaps.present && (eHT_CHANNEL_WIDTH_40MHZ == pIes->HTCaps.supportedChannelWidthSet)) |
| 11042 | { |
| 11043 | if(pIes->HTInfo.present) |
| 11044 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11045 | /* This is called during INFRA STA/CLIENT and should use the merged value of |
| 11046 | * supported channel width and recommended tx width as per standard |
| 11047 | */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11048 | smsLog(pMac, LOG1, "scws %u rtws %u sco %u", |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11049 | pIes->HTCaps.supportedChannelWidthSet, |
| 11050 | pIes->HTInfo.recommendedTxWidthSet, |
| 11051 | pIes->HTInfo.secondaryChannelOffset); |
| 11052 | |
| 11053 | if (pIes->HTInfo.recommendedTxWidthSet == eHT_CHANNEL_WIDTH_40MHZ) |
| 11054 | eRet = (ePhyChanBondState)pIes->HTInfo.secondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11055 | else |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11056 | eRet = PHY_SINGLE_CHANNEL_CENTERED; |
| 11057 | switch (eRet) { |
| 11058 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 11059 | centerChn = primaryChn + CSR_CB_CENTER_CHANNEL_OFFSET; |
| 11060 | break; |
| 11061 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 11062 | centerChn = primaryChn - CSR_CB_CENTER_CHANNEL_OFFSET; |
| 11063 | break; |
| 11064 | case PHY_SINGLE_CHANNEL_CENTERED: |
| 11065 | default: |
| 11066 | centerChn = primaryChn; |
| 11067 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11068 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11069 | if((PHY_SINGLE_CHANNEL_CENTERED != eRet) && !csrRoamIsValid40MhzChannel(pMac, centerChn)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11070 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11071 | smsLog(pMac, LOGE, " Invalid center channel (%d), disable 40MHz mode", centerChn); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11072 | //eRet = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11073 | } |
| 11074 | } |
| 11075 | } |
| 11076 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11077 | return eRet; |
| 11078 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11079 | tANI_BOOLEAN csrIsEncryptionInList( tpAniSirGlobal pMac, tCsrEncryptionList *pCipherList, eCsrEncryptionType encryptionType ) |
| 11080 | { |
| 11081 | tANI_BOOLEAN fFound = FALSE; |
| 11082 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11083 | for( idx = 0; idx < pCipherList->numEntries; idx++ ) |
| 11084 | { |
| 11085 | if( pCipherList->encryptionType[idx] == encryptionType ) |
| 11086 | { |
| 11087 | fFound = TRUE; |
| 11088 | break; |
| 11089 | } |
| 11090 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11091 | return fFound; |
| 11092 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11093 | tANI_BOOLEAN csrIsAuthInList( tpAniSirGlobal pMac, tCsrAuthList *pAuthList, eCsrAuthType authType ) |
| 11094 | { |
| 11095 | tANI_BOOLEAN fFound = FALSE; |
| 11096 | tANI_U32 idx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11097 | for( idx = 0; idx < pAuthList->numEntries; idx++ ) |
| 11098 | { |
| 11099 | if( pAuthList->authType[idx] == authType ) |
| 11100 | { |
| 11101 | fFound = TRUE; |
| 11102 | break; |
| 11103 | } |
| 11104 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11105 | return fFound; |
| 11106 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11107 | tANI_BOOLEAN csrIsSameProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile1, tCsrRoamProfile *pProfile2) |
| 11108 | { |
| 11109 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 11110 | tCsrScanResultFilter *pScanFilter = NULL; |
| 11111 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11112 | |
| 11113 | if(pProfile1 && pProfile2) |
| 11114 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11115 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 11116 | if ( NULL == pScanFilter ) |
| 11117 | status = eHAL_STATUS_FAILURE; |
| 11118 | else |
| 11119 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11120 | if(HAL_STATUS_SUCCESS(status)) |
| 11121 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11122 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11123 | status = csrRoamPrepareFilterFromProfile(pMac, pProfile2, pScanFilter); |
| 11124 | if(HAL_STATUS_SUCCESS(status)) |
| 11125 | { |
| 11126 | fCheck = eANI_BOOLEAN_FALSE; |
| 11127 | do |
| 11128 | { |
| 11129 | tANI_U32 i; |
| 11130 | for(i = 0; i < pScanFilter->SSIDs.numOfSSIDs; i++) |
| 11131 | { |
| 11132 | fCheck = csrIsSsidMatch( pMac, pScanFilter->SSIDs.SSIDList[i].SSID.ssId, |
| 11133 | pScanFilter->SSIDs.SSIDList[i].SSID.length, |
| 11134 | pProfile1->SSID.ssId, pProfile1->SSID.length, eANI_BOOLEAN_FALSE ); |
| 11135 | if ( fCheck ) break; |
| 11136 | } |
| 11137 | if(!fCheck) |
| 11138 | { |
| 11139 | break; |
| 11140 | } |
| 11141 | if( !csrIsAuthInList( pMac, &pProfile2->AuthType, pProfile1->AuthType) |
| 11142 | || pProfile2->BSSType != pProfile1->BSSType |
| 11143 | || !csrIsEncryptionInList( pMac, &pProfile2->EncryptionType, pProfile1->EncryptionType ) |
| 11144 | ) |
| 11145 | { |
| 11146 | fCheck = eANI_BOOLEAN_FALSE; |
| 11147 | break; |
| 11148 | } |
| 11149 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 11150 | if (pProfile1->MDID.mdiePresent || pProfile2->MDID.mdiePresent) |
| 11151 | { |
| 11152 | if (pProfile1->MDID.mobilityDomain != pProfile2->MDID.mobilityDomain) |
| 11153 | { |
| 11154 | fCheck = eANI_BOOLEAN_FALSE; |
| 11155 | break; |
| 11156 | } |
| 11157 | } |
| 11158 | #endif |
| 11159 | //Match found |
| 11160 | fCheck = eANI_BOOLEAN_TRUE; |
| 11161 | }while(0); |
| 11162 | csrFreeScanFilter(pMac, pScanFilter); |
| 11163 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11164 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11165 | } |
| 11166 | } |
| 11167 | |
| 11168 | return (fCheck); |
| 11169 | } |
| 11170 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11171 | tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2) |
| 11172 | { |
| 11173 | tANI_BOOLEAN fCheck = eANI_BOOLEAN_FALSE; |
| 11174 | int i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11175 | do |
| 11176 | { |
| 11177 | //Only check for static WEP |
| 11178 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) && |
| 11179 | !csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) |
| 11180 | { |
| 11181 | fCheck = eANI_BOOLEAN_TRUE; |
| 11182 | break; |
| 11183 | } |
| 11184 | if(!csrIsEncryptionInList(pMac, &pProfile2->EncryptionType, pConnProfile->EncryptionType)) break; |
| 11185 | if(pConnProfile->Keys.defaultIndex != pProfile2->Keys.defaultIndex) break; |
| 11186 | for(i = 0; i < CSR_MAX_NUM_KEY; i++) |
| 11187 | { |
| 11188 | if(pConnProfile->Keys.KeyLength[i] != pProfile2->Keys.KeyLength[i]) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11189 | if (!vos_mem_compare(&pConnProfile->Keys.KeyMaterial[i], |
| 11190 | &pProfile2->Keys.KeyMaterial[i], pProfile2->Keys.KeyLength[i])) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11191 | { |
| 11192 | break; |
| 11193 | } |
| 11194 | } |
| 11195 | if( i == CSR_MAX_NUM_KEY) |
| 11196 | { |
| 11197 | fCheck = eANI_BOOLEAN_TRUE; |
| 11198 | } |
| 11199 | }while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11200 | return (fCheck); |
| 11201 | } |
| 11202 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11203 | //IBSS |
| 11204 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11205 | tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac ) |
| 11206 | { |
| 11207 | tANI_U8 channel = 0; |
| 11208 | tANI_U32 idx; |
| 11209 | tANI_U32 idxValidChannels; |
| 11210 | tANI_BOOLEAN fFound = FALSE; |
| 11211 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 11212 | |
| 11213 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel5G) |
| 11214 | { |
| 11215 | channel = pMac->roam.configParam.AdHocChannel5G; |
| 11216 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 11217 | { |
| 11218 | channel = 0; |
| 11219 | } |
| 11220 | } |
| 11221 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 11222 | { |
| 11223 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_50 ) && !fFound; idx++ ) |
| 11224 | { |
| 11225 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 11226 | { |
| 11227 | if ( csrStartIbssChannels50[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 11228 | { |
| 11229 | fFound = TRUE; |
| 11230 | channel = csrStartIbssChannels50[ idx ]; |
| 11231 | } |
| 11232 | } |
| 11233 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11234 | // this is rare, but if it does happen, we find anyone in 11a bandwidth and return the first 11a channel found! |
| 11235 | if (!fFound) |
| 11236 | { |
| 11237 | for ( idxValidChannels = 0; idxValidChannels < len ; idxValidChannels++ ) |
| 11238 | { |
| 11239 | if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idx ]) ) // the max channel# in 11g is 14 |
| 11240 | { |
| 11241 | channel = csrStartIbssChannels50[ idx ]; |
| 11242 | break; |
| 11243 | } |
| 11244 | } |
| 11245 | } |
| 11246 | }//if |
| 11247 | |
| 11248 | return( channel ); |
| 11249 | } |
| 11250 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11251 | tANI_U8 csrRoamGetIbssStartChannelNumber24( tpAniSirGlobal pMac ) |
| 11252 | { |
| 11253 | tANI_U8 channel = 1; |
| 11254 | tANI_U32 idx; |
| 11255 | tANI_U32 idxValidChannels; |
| 11256 | tANI_BOOLEAN fFound = FALSE; |
| 11257 | tANI_U32 len = sizeof(pMac->roam.validChannelList); |
| 11258 | |
| 11259 | if(eCSR_OPERATING_CHANNEL_ANY != pMac->roam.configParam.AdHocChannel24) |
| 11260 | { |
| 11261 | channel = pMac->roam.configParam.AdHocChannel24; |
| 11262 | if(!csrRoamIsChannelValid(pMac, channel)) |
| 11263 | { |
| 11264 | channel = 0; |
| 11265 | } |
| 11266 | } |
| 11267 | |
| 11268 | if (0 == channel && HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &len))) |
| 11269 | { |
| 11270 | for ( idx = 0; ( idx < CSR_NUM_IBSS_START_CHANNELS_24 ) && !fFound; idx++ ) |
| 11271 | { |
| 11272 | for ( idxValidChannels = 0; ( idxValidChannels < len ) && !fFound; idxValidChannels++ ) |
| 11273 | { |
| 11274 | if ( csrStartIbssChannels24[ idx ] == pMac->roam.validChannelList[ idxValidChannels ] ) |
| 11275 | { |
| 11276 | fFound = TRUE; |
| 11277 | channel = csrStartIbssChannels24[ idx ]; |
| 11278 | } |
| 11279 | } |
| 11280 | } |
| 11281 | } |
| 11282 | |
| 11283 | return( channel ); |
| 11284 | } |
| 11285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11286 | static void csrRoamGetBssStartParms( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile, |
| 11287 | tCsrRoamStartBssParams *pParam ) |
| 11288 | { |
| 11289 | eCsrCfgDot11Mode cfgDot11Mode; |
| 11290 | eCsrBand eBand; |
| 11291 | tANI_U8 channel = 0; |
| 11292 | tSirNwType nwType; |
| 11293 | tANI_U8 operationChannel = 0; |
| 11294 | |
| 11295 | if(pProfile->ChannelInfo.numOfChannels && pProfile->ChannelInfo.ChannelList) |
| 11296 | { |
| 11297 | operationChannel = pProfile->ChannelInfo.ChannelList[0]; |
| 11298 | } |
| 11299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11300 | cfgDot11Mode = csrRoamGetPhyModeBandForBss( pMac, pProfile, operationChannel, &eBand ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11301 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11302 | if( ( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 11303 | (pProfile->csrPersona == VOS_P2P_GO_MODE) ) |
| 11304 | && ( cfgDot11Mode == eCSR_CFG_DOT11_MODE_11B) |
| 11305 | ) |
| 11306 | { |
| 11307 | /* This should never happen */ |
| 11308 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11309 | FL("For P2PClient/P2P-GO (persona %d) cfgDot11Mode is 11B"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11310 | pProfile->csrPersona); |
| 11311 | VOS_ASSERT(0); |
| 11312 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11313 | switch( cfgDot11Mode ) |
| 11314 | { |
| 11315 | case eCSR_CFG_DOT11_MODE_11G: |
| 11316 | nwType = eSIR_11G_NW_TYPE; |
| 11317 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11318 | case eCSR_CFG_DOT11_MODE_11B: |
| 11319 | nwType = eSIR_11B_NW_TYPE; |
| 11320 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11321 | case eCSR_CFG_DOT11_MODE_11A: |
| 11322 | nwType = eSIR_11A_NW_TYPE; |
| 11323 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11324 | default: |
| 11325 | case eCSR_CFG_DOT11_MODE_11N: |
| 11326 | case eCSR_CFG_DOT11_MODE_TAURUS: |
| 11327 | //Because LIM only verifies it against 11a, 11b or 11g, set only 11g or 11a here |
| 11328 | if(eCSR_BAND_24 == eBand) |
| 11329 | { |
| 11330 | nwType = eSIR_11G_NW_TYPE; |
| 11331 | } |
| 11332 | else |
| 11333 | { |
| 11334 | nwType = eSIR_11A_NW_TYPE; |
| 11335 | } |
| 11336 | break; |
| 11337 | } |
| 11338 | |
| 11339 | pParam->extendedRateSet.numRates = 0; |
| 11340 | |
| 11341 | switch ( nwType ) |
| 11342 | { |
| 11343 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11344 | smsLog(pMac, LOGE, FL("sees an unknown pSirNwType (%d)"), nwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11345 | case eSIR_11A_NW_TYPE: |
| 11346 | |
| 11347 | pParam->operationalRateSet.numRates = 8; |
| 11348 | |
| 11349 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 11350 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11351 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 11352 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11353 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 11354 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11355 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11356 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11357 | |
| 11358 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11359 | { |
| 11360 | channel = csrRoamGetIbssStartChannelNumber50( pMac ); |
| 11361 | if( 0 == channel && |
| 11362 | CSR_IS_PHY_MODE_DUAL_BAND(pProfile->phyMode) && |
| 11363 | CSR_IS_PHY_MODE_DUAL_BAND(pMac->roam.configParam.phyMode) |
| 11364 | ) |
| 11365 | { |
| 11366 | //We could not find a 5G channel by auto pick, let's try 2.4G channels |
| 11367 | //We only do this here because csrRoamGetPhyModeBandForBss always picks 11a for AUTO |
| 11368 | nwType = eSIR_11B_NW_TYPE; |
| 11369 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11370 | pParam->operationalRateSet.numRates = 4; |
| 11371 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 11372 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 11373 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 11374 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 11375 | } |
| 11376 | } |
| 11377 | else |
| 11378 | { |
| 11379 | channel = operationChannel; |
| 11380 | } |
| 11381 | break; |
| 11382 | |
| 11383 | case eSIR_11B_NW_TYPE: |
| 11384 | pParam->operationalRateSet.numRates = 4; |
| 11385 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 11386 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 11387 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 11388 | 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] | 11389 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11390 | { |
| 11391 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11392 | } |
| 11393 | else |
| 11394 | { |
| 11395 | channel = operationChannel; |
| 11396 | } |
| 11397 | |
| 11398 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11399 | case eSIR_11G_NW_TYPE: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11400 | /* For P2P Client and P2P GO, disable 11b rates */ |
| 11401 | if( (pProfile->csrPersona == VOS_P2P_CLIENT_MODE) || |
| 11402 | (pProfile->csrPersona == VOS_P2P_GO_MODE) |
| 11403 | ) |
| 11404 | { |
| 11405 | pParam->operationalRateSet.numRates = 8; |
| 11406 | |
| 11407 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_6 | CSR_DOT11_BASIC_RATE_MASK; |
| 11408 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11409 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_12 | CSR_DOT11_BASIC_RATE_MASK; |
| 11410 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11411 | pParam->operationalRateSet.rate[4] = SIR_MAC_RATE_24 | CSR_DOT11_BASIC_RATE_MASK; |
| 11412 | pParam->operationalRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11413 | pParam->operationalRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11414 | pParam->operationalRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11415 | } |
| 11416 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11417 | { |
| 11418 | pParam->operationalRateSet.numRates = 4; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11419 | pParam->operationalRateSet.rate[0] = SIR_MAC_RATE_1 | CSR_DOT11_BASIC_RATE_MASK; |
| 11420 | pParam->operationalRateSet.rate[1] = SIR_MAC_RATE_2 | CSR_DOT11_BASIC_RATE_MASK; |
| 11421 | pParam->operationalRateSet.rate[2] = SIR_MAC_RATE_5_5 | CSR_DOT11_BASIC_RATE_MASK; |
| 11422 | pParam->operationalRateSet.rate[3] = SIR_MAC_RATE_11 | CSR_DOT11_BASIC_RATE_MASK; |
| 11423 | |
| 11424 | pParam->extendedRateSet.numRates = 8; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11425 | pParam->extendedRateSet.rate[0] = SIR_MAC_RATE_6; |
| 11426 | pParam->extendedRateSet.rate[1] = SIR_MAC_RATE_9; |
| 11427 | pParam->extendedRateSet.rate[2] = SIR_MAC_RATE_12; |
| 11428 | pParam->extendedRateSet.rate[3] = SIR_MAC_RATE_18; |
| 11429 | pParam->extendedRateSet.rate[4] = SIR_MAC_RATE_24; |
| 11430 | pParam->extendedRateSet.rate[5] = SIR_MAC_RATE_36; |
| 11431 | pParam->extendedRateSet.rate[6] = SIR_MAC_RATE_48; |
| 11432 | pParam->extendedRateSet.rate[7] = SIR_MAC_RATE_54; |
| 11433 | } |
| 11434 | |
| 11435 | if ( eCSR_OPERATING_CHANNEL_ANY == operationChannel ) |
| 11436 | { |
| 11437 | channel = csrRoamGetIbssStartChannelNumber24( pMac ); |
| 11438 | } |
| 11439 | else |
| 11440 | { |
| 11441 | channel = operationChannel; |
| 11442 | } |
| 11443 | |
| 11444 | break; |
| 11445 | } |
| 11446 | pParam->operationChn = channel; |
| 11447 | pParam->sirNwType = nwType; |
| 11448 | } |
| 11449 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11450 | static void csrRoamGetBssStartParmsFromBssDesc( tpAniSirGlobal pMac, tSirBssDescription *pBssDesc, |
| 11451 | tDot11fBeaconIEs *pIes, tCsrRoamStartBssParams *pParam ) |
| 11452 | { |
| 11453 | |
| 11454 | if( pParam ) |
| 11455 | { |
| 11456 | pParam->sirNwType = pBssDesc->nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11457 | pParam->cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11458 | pParam->operationChn = pBssDesc->channelId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11459 | vos_mem_copy(&pParam->bssid, pBssDesc->bssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11460 | |
| 11461 | if( pIes ) |
| 11462 | { |
| 11463 | if(pIes->SuppRates.present) |
| 11464 | { |
| 11465 | pParam->operationalRateSet.numRates = pIes->SuppRates.num_rates; |
| 11466 | if(pIes->SuppRates.num_rates > SIR_MAC_RATESET_EID_MAX) |
| 11467 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11468 | 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] | 11469 | pIes->SuppRates.num_rates); |
| 11470 | pIes->SuppRates.num_rates = SIR_MAC_RATESET_EID_MAX; |
| 11471 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11472 | vos_mem_copy(pParam->operationalRateSet.rate, pIes->SuppRates.rates, |
| 11473 | sizeof(*pIes->SuppRates.rates) * pIes->SuppRates.num_rates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11474 | } |
| 11475 | if( pIes->SSID.present ) |
| 11476 | { |
| 11477 | pParam->ssId.length = pIes->SSID.num_ssid; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11478 | vos_mem_copy(pParam->ssId.ssId, pIes->SSID.ssid, |
| 11479 | pParam->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11480 | } |
| 11481 | pParam->cbMode = csrGetCBModeFromIes(pMac, pParam->operationChn, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11482 | } |
| 11483 | else |
| 11484 | { |
| 11485 | pParam->ssId.length = 0; |
| 11486 | pParam->operationalRateSet.numRates = 0; |
| 11487 | } |
| 11488 | } |
| 11489 | } |
| 11490 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11491 | static void csrRoamDetermineMaxRateForAdHoc( tpAniSirGlobal pMac, tSirMacRateSet *pSirRateSet ) |
| 11492 | { |
| 11493 | tANI_U8 MaxRate = 0; |
| 11494 | tANI_U32 i; |
| 11495 | tANI_U8 *pRate; |
| 11496 | |
| 11497 | pRate = pSirRateSet->rate; |
| 11498 | for ( i = 0; i < pSirRateSet->numRates; i++ ) |
| 11499 | { |
| 11500 | MaxRate = CSR_MAX( MaxRate, ( pRate[ i ] & (~CSR_DOT11_BASIC_RATE_MASK) ) ); |
| 11501 | } |
| 11502 | |
| 11503 | // Save the max rate in the connected state information... |
| 11504 | |
| 11505 | // modify LastRates variable as well |
| 11506 | |
| 11507 | return; |
| 11508 | } |
| 11509 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11510 | eHalStatus csrRoamIssueStartBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamStartBssParams *pParam, |
| 11511 | tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc, tANI_U32 roamId ) |
| 11512 | { |
| 11513 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11514 | eCsrBand eBand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11515 | // Set the roaming substate to 'Start BSS attempt'... |
| 11516 | csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11517 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11518 | //Need to figure out whether we need to log WDS??? |
| 11519 | if( CSR_IS_IBSS( pProfile ) ) |
| 11520 | { |
| 11521 | vos_log_ibss_pkt_type *pIbssLog; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11522 | WLAN_VOS_DIAG_LOG_ALLOC(pIbssLog, vos_log_ibss_pkt_type, LOG_WLAN_IBSS_C); |
| 11523 | if(pIbssLog) |
| 11524 | { |
| 11525 | if(pBssDesc) |
| 11526 | { |
| 11527 | pIbssLog->eventId = WLAN_IBSS_EVENT_JOIN_IBSS_REQ; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11528 | vos_mem_copy(pIbssLog->bssid, pBssDesc->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11529 | } |
| 11530 | else |
| 11531 | { |
| 11532 | pIbssLog->eventId = WLAN_IBSS_EVENT_START_IBSS_REQ; |
| 11533 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11534 | vos_mem_copy(pIbssLog->ssid, pParam->ssId.ssId, pParam->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11535 | if(pProfile->ChannelInfo.numOfChannels == 0) |
| 11536 | { |
| 11537 | pIbssLog->channelSetting = AUTO_PICK; |
| 11538 | } |
| 11539 | else |
| 11540 | { |
| 11541 | pIbssLog->channelSetting = SPECIFIED; |
| 11542 | } |
| 11543 | pIbssLog->operatingChannel = pParam->operationChn; |
| 11544 | WLAN_VOS_DIAG_LOG_REPORT(pIbssLog); |
| 11545 | } |
| 11546 | } |
| 11547 | #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11548 | //Put RSN information in for Starting BSS |
| 11549 | pParam->nRSNIELength = (tANI_U16)pProfile->nRSNReqIELength; |
| 11550 | pParam->pRSNIE = pProfile->pRSNReqIE; |
| 11551 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11552 | pParam->privacy = pProfile->privacy; |
| 11553 | pParam->fwdWPSPBCProbeReq = pProfile->fwdWPSPBCProbeReq; |
| 11554 | pParam->authType = pProfile->csr80211AuthType; |
| 11555 | pParam->beaconInterval = pProfile->beaconInterval; |
| 11556 | pParam->dtimPeriod = pProfile->dtimPeriod; |
| 11557 | pParam->ApUapsdEnable = pProfile->ApUapsdEnable; |
| 11558 | pParam->ssidHidden = pProfile->SSIDs.SSIDList[0].ssidHidden; |
| 11559 | if (CSR_IS_INFRA_AP(pProfile)&& (pParam->operationChn != 0)) |
| 11560 | { |
| 11561 | if (csrIsValidChannel(pMac, pParam->operationChn) != eHAL_STATUS_SUCCESS) |
| 11562 | { |
| 11563 | pParam->operationChn = INFRA_AP_DEFAULT_CHANNEL; |
| 11564 | } |
| 11565 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11566 | pParam->protEnabled = pProfile->protEnabled; |
| 11567 | pParam->obssProtEnabled = pProfile->obssProtEnabled; |
| 11568 | pParam->ht_protection = pProfile->cfg_protection; |
| 11569 | pParam->wps_state = pProfile->wps_state; |
Jeff Johnson | 96fbeeb | 2013-02-26 21:23:00 -0800 | [diff] [blame] | 11570 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11571 | pParam->uCfgDot11Mode = csrRoamGetPhyModeBandForBss(pMac, pProfile, pParam->operationChn /* pProfile->operationChannel*/, |
| 11572 | &eBand); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11573 | pParam->bssPersona = pProfile->csrPersona; |
| 11574 | // When starting an IBSS, start on the channel from the Profile. |
| 11575 | status = csrSendMBStartBssReqMsg( pMac, sessionId, pProfile->BSSType, pParam, pBssDesc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11576 | return (status); |
| 11577 | } |
| 11578 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11579 | static void csrRoamPrepareBssParams(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11580 | tSirBssDescription *pBssDesc, tBssConfigParam *pBssConfig, tDot11fBeaconIEs *pIes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11581 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11582 | tANI_U8 Channel; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11583 | ePhyChanBondState cbMode = PHY_SINGLE_CHANNEL_CENTERED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11584 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11585 | |
| 11586 | if(!pSession) |
| 11587 | { |
| 11588 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11589 | return; |
| 11590 | } |
| 11591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11592 | if( pBssDesc ) |
| 11593 | { |
| 11594 | csrRoamGetBssStartParmsFromBssDesc( pMac, pBssDesc, pIes, &pSession->bssParams ); |
| 11595 | //Since csrRoamGetBssStartParmsFromBssDesc fills in the bssid for pSession->bssParams |
| 11596 | //The following code has to be do after that. |
| 11597 | //For WDS station, use selfMac as the self BSSID |
| 11598 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 11599 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11600 | vos_mem_copy(&pSession->bssParams.bssid, &pSession->selfMacAddr, |
| 11601 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11602 | } |
| 11603 | } |
| 11604 | else |
| 11605 | { |
| 11606 | csrRoamGetBssStartParms(pMac, pProfile, &pSession->bssParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11607 | //Use the first SSID |
| 11608 | if(pProfile->SSIDs.numOfSSIDs) |
| 11609 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11610 | vos_mem_copy(&pSession->bssParams.ssId, pProfile->SSIDs.SSIDList, |
| 11611 | sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11612 | } |
| 11613 | //For WDS station, use selfMac as the self BSSID |
| 11614 | if( CSR_IS_WDS_STA( pProfile ) ) |
| 11615 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11616 | vos_mem_copy(&pSession->bssParams.bssid, &pSession->selfMacAddr, |
| 11617 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11618 | } |
| 11619 | //Use the first BSSID |
| 11620 | else if( pProfile->BSSIDs.numOfBSSIDs ) |
| 11621 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11622 | vos_mem_copy(&pSession->bssParams.bssid, pProfile->BSSIDs.bssid, |
| 11623 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11624 | } |
| 11625 | else |
| 11626 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11627 | vos_mem_set(&pSession->bssParams.bssid, sizeof(tCsrBssid), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11628 | } |
| 11629 | } |
| 11630 | Channel = pSession->bssParams.operationChn; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11631 | //Set operating channel in pProfile which will be used |
| 11632 | //in csrRoamSetBssConfigCfg() to determine channel bonding |
| 11633 | //mode and will be configured in CFG later |
| 11634 | pProfile->operationChannel = Channel; |
| 11635 | |
| 11636 | if(Channel == 0) |
| 11637 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11638 | smsLog(pMac, LOGW, " CSR cannot find a channel to start IBSS"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11639 | } |
| 11640 | else |
| 11641 | { |
| 11642 | |
| 11643 | csrRoamDetermineMaxRateForAdHoc( pMac, &pSession->bssParams.operationalRateSet ); |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11644 | if (CSR_IS_INFRA_AP(pProfile) || CSR_IS_START_IBSS( pProfile ) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11645 | { |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11646 | if(CSR_IS_CHANNEL_24GHZ(Channel) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11647 | { |
| 11648 | cbMode = pMac->roam.configParam.channelBondingMode24GHz; |
| 11649 | } |
| 11650 | else |
| 11651 | { |
| 11652 | cbMode = pMac->roam.configParam.channelBondingMode5GHz; |
| 11653 | } |
Ravi Joshi | aeb7d9e | 2013-05-02 12:28:14 -0700 | [diff] [blame] | 11654 | smsLog(pMac, LOG1, "## cbMode %d", cbMode); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11655 | pBssConfig->cbMode = cbMode; |
| 11656 | pSession->bssParams.cbMode = cbMode; |
| 11657 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11658 | } |
| 11659 | } |
| 11660 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11661 | static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 11662 | tANI_BOOLEAN *pfSameIbss ) |
| 11663 | { |
| 11664 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 11665 | tANI_BOOLEAN fSameIbss = FALSE; |
| 11666 | |
| 11667 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 11668 | { |
| 11669 | // Check if any profile parameter has changed ? If any profile parameter |
| 11670 | // has changed then stop old BSS and start a new one with new parameters |
| 11671 | if ( csrIsSameProfile( pMac, &pMac->roam.roamSession[sessionId].connectedProfile, pProfile ) ) |
| 11672 | { |
| 11673 | fSameIbss = TRUE; |
| 11674 | } |
| 11675 | else |
| 11676 | { |
| 11677 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 11678 | } |
| 11679 | } |
| 11680 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 11681 | { |
| 11682 | // Disassociate from the connected Infrastructure network... |
| 11683 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 11684 | } |
| 11685 | else |
| 11686 | { |
| 11687 | tBssConfigParam *pBssConfig; |
| 11688 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11689 | pBssConfig = vos_mem_malloc(sizeof(tBssConfigParam)); |
| 11690 | if ( NULL == pBssConfig ) |
| 11691 | status = eHAL_STATUS_FAILURE; |
| 11692 | else |
| 11693 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11694 | if(HAL_STATUS_SUCCESS(status)) |
| 11695 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11696 | vos_mem_set(pBssConfig, sizeof(tBssConfigParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11697 | // there is no Bss description before we start an IBSS so we need to adopt |
| 11698 | // all Bss configuration parameters from the Profile. |
| 11699 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, pBssConfig, NULL); |
| 11700 | if(HAL_STATUS_SUCCESS(status)) |
| 11701 | { |
| 11702 | //save dotMode |
| 11703 | pMac->roam.roamSession[sessionId].bssParams.uCfgDot11Mode = pBssConfig->uCfgDot11Mode; |
| 11704 | //Prepare some more parameters for this IBSS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11705 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, pBssConfig, NULL); |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 11706 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 11707 | NULL, pBssConfig, |
| 11708 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11709 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11710 | |
| 11711 | vos_mem_free(pBssConfig); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11712 | }//Allocate memory |
| 11713 | } |
| 11714 | |
| 11715 | if(pfSameIbss) |
| 11716 | { |
| 11717 | *pfSameIbss = fSameIbss; |
| 11718 | } |
| 11719 | return( status ); |
| 11720 | } |
| 11721 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11722 | static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11723 | tSirSmeNewBssInfo *pNewBss ) |
| 11724 | { |
| 11725 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11726 | |
| 11727 | if(!pSession) |
| 11728 | { |
| 11729 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11730 | return; |
| 11731 | } |
| 11732 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11733 | if( pNewBss ) |
| 11734 | { |
| 11735 | // Set the operating channel. |
| 11736 | pSession->connectedProfile.operationChannel = pNewBss->channelNumber; |
| 11737 | // move the BSSId from the BSS description into the connected state information. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11738 | vos_mem_copy(&pSession->connectedProfile.bssid, &(pNewBss->bssId), |
| 11739 | sizeof( tCsrBssid )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11740 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11741 | return; |
| 11742 | } |
| 11743 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11744 | #ifdef FEATURE_WLAN_WAPI |
| 11745 | eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, |
| 11746 | tANI_U32 numItems ) |
| 11747 | { |
| 11748 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11749 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11750 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11751 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11752 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11753 | return status; |
| 11754 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11755 | smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11756 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11757 | if(numItems <= CSR_MAX_BKID_ALLOWED) |
| 11758 | { |
| 11759 | status = eHAL_STATUS_SUCCESS; |
| 11760 | //numItems may be 0 to clear the cache |
| 11761 | pSession->NumBkidCache = (tANI_U16)numItems; |
| 11762 | if(numItems && pBKIDCache) |
| 11763 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11764 | vos_mem_copy(pSession->BkidCacheInfo, pBKIDCache, |
| 11765 | sizeof(tBkidCacheInfo) * numItems); |
| 11766 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11767 | } |
| 11768 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11769 | return (status); |
| 11770 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11771 | eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, |
| 11772 | tBkidCacheInfo *pBkidCache) |
| 11773 | { |
| 11774 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11775 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11776 | if(!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 11777 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11778 | smsLog(pMac, LOGE, FL(" Invalid session ID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11779 | return status; |
| 11780 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11781 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11782 | if(pNum && pBkidCache) |
| 11783 | { |
| 11784 | if(pSession->NumBkidCache == 0) |
| 11785 | { |
| 11786 | *pNum = 0; |
| 11787 | status = eHAL_STATUS_SUCCESS; |
| 11788 | } |
| 11789 | else if(*pNum >= pSession->NumBkidCache) |
| 11790 | { |
| 11791 | if(pSession->NumBkidCache > CSR_MAX_PMKID_ALLOWED) |
| 11792 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11793 | 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] | 11794 | pSession->NumBkidCache); |
| 11795 | pSession->NumBkidCache = CSR_MAX_PMKID_ALLOWED; |
| 11796 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11797 | vos_mem_copy(pBkidCache, pSession->BkidCacheInfo, |
| 11798 | sizeof(tBkidCacheInfo) * pSession->NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11799 | *pNum = pSession->NumBkidCache; |
| 11800 | status = eHAL_STATUS_SUCCESS; |
| 11801 | } |
| 11802 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11803 | return (status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11804 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11805 | tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11806 | { |
| 11807 | return (pMac->roam.roamSession[sessionId].NumBkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11808 | } |
| 11809 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11810 | eHalStatus csrRoamSetPMKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11811 | tPmkidCacheInfo *pPMKIDCache, tANI_U32 numItems ) |
| 11812 | { |
| 11813 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11814 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11815 | |
| 11816 | if(!pSession) |
| 11817 | { |
| 11818 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11819 | return eHAL_STATUS_FAILURE; |
| 11820 | } |
| 11821 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11822 | smsLog(pMac, LOGW, "csrRoamSetPMKIDCache called, numItems = %d", numItems); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11823 | if(numItems <= CSR_MAX_PMKID_ALLOWED) |
| 11824 | { |
| 11825 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR |
| 11826 | { |
| 11827 | WLAN_VOS_DIAG_EVENT_DEF(secEvent, vos_event_wlan_security_payload_type); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11828 | vos_mem_set(&secEvent, |
| 11829 | sizeof(vos_event_wlan_security_payload_type), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11830 | secEvent.eventId = WLAN_SECURITY_EVENT_PMKID_UPDATE; |
| 11831 | secEvent.encryptionModeMulticast = |
| 11832 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.mcEncryptionType); |
| 11833 | secEvent.encryptionModeUnicast = |
| 11834 | (v_U8_t)diagEncTypeFromCSRType(pSession->connectedProfile.EncryptionType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11835 | vos_mem_copy(secEvent.bssid, pSession->connectedProfile.bssid, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11836 | secEvent.authMode = |
| 11837 | (v_U8_t)diagAuthTypeFromCSRType(pSession->connectedProfile.AuthType); |
| 11838 | WLAN_VOS_DIAG_EVENT_REPORT(&secEvent, EVENT_WLAN_SECURITY); |
| 11839 | } |
| 11840 | #endif//FEATURE_WLAN_DIAG_SUPPORT_CSR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11841 | status = eHAL_STATUS_SUCCESS; |
| 11842 | //numItems may be 0 to clear the cache |
| 11843 | pSession->NumPmkidCache = (tANI_U16)numItems; |
| 11844 | if(numItems && pPMKIDCache) |
| 11845 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11846 | vos_mem_copy(pSession->PmkidCacheInfo, pPMKIDCache, |
| 11847 | sizeof(tPmkidCacheInfo) * numItems); |
| 11848 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11849 | } |
| 11850 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11851 | return (status); |
| 11852 | } |
| 11853 | |
Leela Venkata Kiran Kumar Reddy Chirala | ede1065 | 2013-09-11 18:48:46 -0700 | [diff] [blame] | 11854 | eHalStatus csrRoamDelPMKIDfromCache( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 11855 | tANI_U8 *pBSSId ) |
| 11856 | { |
| 11857 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 11858 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 11859 | tANI_BOOLEAN fMatchFound = FALSE; |
| 11860 | tANI_U32 Index; |
| 11861 | if(!pSession) |
| 11862 | { |
| 11863 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11864 | return eHAL_STATUS_FAILURE; |
| 11865 | } |
| 11866 | do |
| 11867 | { |
| 11868 | for( Index=0; Index < pSession->NumPmkidCache; Index++ ) |
| 11869 | { |
| 11870 | smsLog(pMac, LOGW, "Delete PMKID for %02X-%02X-%02X-%02X-%02X-%02X ", |
| 11871 | pBSSId[0], pBSSId[1], pBSSId[2], pBSSId[3], pBSSId[4], pBSSId[5]); |
| 11872 | if( palEqualMemory( pMac->hHdd, pBSSId, pSession->PmkidCacheInfo[Index].BSSID, sizeof(tCsrBssid) ) ) |
| 11873 | { |
| 11874 | fMatchFound = TRUE; |
| 11875 | break; |
| 11876 | } |
| 11877 | } |
| 11878 | if( !fMatchFound ) break; |
| 11879 | palZeroMemory( pMac->hHdd, pSession->PmkidCacheInfo[Index].BSSID, sizeof(tPmkidCacheInfo)); |
| 11880 | status = eHAL_STATUS_SUCCESS; |
| 11881 | } |
| 11882 | while( 0 ); |
| 11883 | smsLog(pMac, LOGW, "csrDelPMKID called return match = %d Status = %d", |
| 11884 | fMatchFound, status); |
| 11885 | return status; |
| 11886 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11887 | tANI_U32 csrRoamGetNumPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 11888 | { |
| 11889 | return (pMac->roam.roamSession[sessionId].NumPmkidCache); |
| 11890 | } |
| 11891 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11892 | eHalStatus csrRoamGetPMKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, tPmkidCacheInfo *pPmkidCache) |
| 11893 | { |
| 11894 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11895 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11896 | |
| 11897 | if(!pSession) |
| 11898 | { |
| 11899 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11900 | return eHAL_STATUS_FAILURE; |
| 11901 | } |
| 11902 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11903 | if(pNum && pPmkidCache) |
| 11904 | { |
| 11905 | if(pSession->NumPmkidCache == 0) |
| 11906 | { |
| 11907 | *pNum = 0; |
| 11908 | status = eHAL_STATUS_SUCCESS; |
| 11909 | } |
| 11910 | else if(*pNum >= pSession->NumPmkidCache) |
| 11911 | { |
| 11912 | if(pSession->NumPmkidCache > CSR_MAX_PMKID_ALLOWED) |
| 11913 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 11914 | 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] | 11915 | pSession->NumPmkidCache); |
| 11916 | pSession->NumPmkidCache = CSR_MAX_PMKID_ALLOWED; |
| 11917 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11918 | vos_mem_copy(pPmkidCache, pSession->PmkidCacheInfo, |
| 11919 | sizeof(tPmkidCacheInfo) * pSession->NumPmkidCache); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11920 | *pNum = pSession->NumPmkidCache; |
| 11921 | status = eHAL_STATUS_SUCCESS; |
| 11922 | } |
| 11923 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11924 | return (status); |
| 11925 | } |
| 11926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11927 | eHalStatus csrRoamGetWpaRsnReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11928 | { |
| 11929 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11930 | tANI_U32 len; |
| 11931 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11932 | |
| 11933 | if(!pSession) |
| 11934 | { |
| 11935 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11936 | return eHAL_STATUS_FAILURE; |
| 11937 | } |
| 11938 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11939 | if(pLen) |
| 11940 | { |
| 11941 | len = *pLen; |
| 11942 | *pLen = pSession->nWpaRsnReqIeLength; |
| 11943 | if(pBuf) |
| 11944 | { |
| 11945 | if(len >= pSession->nWpaRsnReqIeLength) |
| 11946 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11947 | vos_mem_copy(pBuf, pSession->pWpaRsnReqIE, |
| 11948 | pSession->nWpaRsnReqIeLength); |
| 11949 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11950 | } |
| 11951 | } |
| 11952 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11953 | return (status); |
| 11954 | } |
| 11955 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11956 | eHalStatus csrRoamGetWpaRsnRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11957 | { |
| 11958 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11959 | tANI_U32 len; |
| 11960 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11961 | |
| 11962 | if(!pSession) |
| 11963 | { |
| 11964 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11965 | return eHAL_STATUS_FAILURE; |
| 11966 | } |
| 11967 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11968 | if(pLen) |
| 11969 | { |
| 11970 | len = *pLen; |
| 11971 | *pLen = pSession->nWpaRsnRspIeLength; |
| 11972 | if(pBuf) |
| 11973 | { |
| 11974 | if(len >= pSession->nWpaRsnRspIeLength) |
| 11975 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 11976 | vos_mem_copy(pBuf, pSession->pWpaRsnRspIE, |
| 11977 | pSession->nWpaRsnRspIeLength); |
| 11978 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11979 | } |
| 11980 | } |
| 11981 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11982 | return (status); |
| 11983 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11984 | #ifdef FEATURE_WLAN_WAPI |
| 11985 | eHalStatus csrRoamGetWapiReqIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 11986 | { |
| 11987 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 11988 | tANI_U32 len; |
| 11989 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 11990 | |
| 11991 | if(!pSession) |
| 11992 | { |
| 11993 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 11994 | return eHAL_STATUS_FAILURE; |
| 11995 | } |
| 11996 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11997 | if(pLen) |
| 11998 | { |
| 11999 | len = *pLen; |
| 12000 | *pLen = pSession->nWapiReqIeLength; |
| 12001 | if(pBuf) |
| 12002 | { |
| 12003 | if(len >= pSession->nWapiReqIeLength) |
| 12004 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12005 | vos_mem_copy(pBuf, pSession->pWapiReqIE, |
| 12006 | pSession->nWapiReqIeLength); |
| 12007 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12008 | } |
| 12009 | } |
| 12010 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12011 | return (status); |
| 12012 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12013 | eHalStatus csrRoamGetWapiRspIE(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pLen, tANI_U8 *pBuf) |
| 12014 | { |
| 12015 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 12016 | tANI_U32 len; |
| 12017 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12018 | |
| 12019 | if(!pSession) |
| 12020 | { |
| 12021 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12022 | return eHAL_STATUS_FAILURE; |
| 12023 | } |
| 12024 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12025 | if(pLen) |
| 12026 | { |
| 12027 | len = *pLen; |
| 12028 | *pLen = pSession->nWapiRspIeLength; |
| 12029 | if(pBuf) |
| 12030 | { |
| 12031 | if(len >= pSession->nWapiRspIeLength) |
| 12032 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12033 | vos_mem_copy(pBuf, pSession->pWapiRspIE, |
| 12034 | pSession->nWapiRspIeLength); |
| 12035 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12036 | } |
| 12037 | } |
| 12038 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12039 | return (status); |
| 12040 | } |
| 12041 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12042 | eRoamCmdStatus csrGetRoamCompleteStatus(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 12043 | { |
| 12044 | eRoamCmdStatus retStatus = eCSR_ROAM_CONNECT_COMPLETION; |
| 12045 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12046 | |
| 12047 | if(!pSession) |
| 12048 | { |
| 12049 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12050 | return (retStatus); |
| 12051 | } |
| 12052 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12053 | if(CSR_IS_ROAMING(pSession)) |
| 12054 | { |
| 12055 | retStatus = eCSR_ROAM_ROAMING_COMPLETION; |
| 12056 | pSession->fRoaming = eANI_BOOLEAN_FALSE; |
| 12057 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12058 | return (retStatus); |
| 12059 | } |
| 12060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12061 | //This function remove the connected BSS from te cached scan result |
| 12062 | eHalStatus csrRoamRemoveConnectedBssFromScanCache(tpAniSirGlobal pMac, |
| 12063 | tCsrRoamConnectedProfile *pConnProfile) |
| 12064 | { |
| 12065 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 12066 | tCsrScanResultFilter *pScanFilter = NULL; |
| 12067 | tListElem *pEntry; |
| 12068 | tCsrScanResult *pResult; |
| 12069 | tDot11fBeaconIEs *pIes; |
| 12070 | tANI_BOOLEAN fMatch; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12071 | if(!(csrIsMacAddressZero(pMac, &pConnProfile->bssid) || |
| 12072 | csrIsMacAddressBroadcast(pMac, &pConnProfile->bssid))) |
| 12073 | { |
| 12074 | do |
| 12075 | { |
| 12076 | //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] | 12077 | pScanFilter = vos_mem_malloc(sizeof(tCsrScanResultFilter)); |
| 12078 | if ( NULL == pScanFilter ) |
| 12079 | status = eHAL_STATUS_FAILURE; |
| 12080 | else |
| 12081 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12082 | if(!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12083 | vos_mem_set(pScanFilter, sizeof(tCsrScanResultFilter), 0); |
| 12084 | pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tCsrBssid)); |
| 12085 | if ( NULL == pScanFilter->BSSIDs.bssid ) |
| 12086 | status = eHAL_STATUS_FAILURE; |
| 12087 | else |
| 12088 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12089 | if(!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12090 | vos_mem_copy(pScanFilter->BSSIDs.bssid, &pConnProfile->bssid, |
| 12091 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12092 | pScanFilter->BSSIDs.numOfBSSIDs = 1; |
| 12093 | if(!csrIsNULLSSID(pConnProfile->SSID.ssId, pConnProfile->SSID.length)) |
| 12094 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12095 | pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); |
| 12096 | if ( NULL == pScanFilter->SSIDs.SSIDList ) |
| 12097 | status = eHAL_STATUS_FAILURE; |
| 12098 | else |
| 12099 | status = eHAL_STATUS_SUCCESS; |
| 12100 | if (!HAL_STATUS_SUCCESS(status)) break; |
| 12101 | vos_mem_copy(&pScanFilter->SSIDs.SSIDList[0].SSID, |
| 12102 | &pConnProfile->SSID, sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12103 | } |
| 12104 | pScanFilter->authType.numEntries = 1; |
| 12105 | pScanFilter->authType.authType[0] = pConnProfile->AuthType; |
| 12106 | pScanFilter->BSSType = pConnProfile->BSSType; |
| 12107 | pScanFilter->EncryptionType.numEntries = 1; |
| 12108 | pScanFilter->EncryptionType.encryptionType[0] = pConnProfile->EncryptionType; |
| 12109 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 12110 | pScanFilter->mcEncryptionType.encryptionType[0] = pConnProfile->mcEncryptionType; |
| 12111 | //We ignore the channel for now, BSSID should be enough |
| 12112 | pScanFilter->ChannelInfo.numOfChannels = 0; |
| 12113 | //Also ignore the following fields |
| 12114 | pScanFilter->uapsd_mask = 0; |
| 12115 | pScanFilter->bWPSAssociation = eANI_BOOLEAN_FALSE; |
| 12116 | pScanFilter->countryCode[0] = 0; |
| 12117 | pScanFilter->phyMode = eCSR_DOT11_MODE_TAURUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12118 | csrLLLock(&pMac->scan.scanResultList); |
| 12119 | pEntry = csrLLPeekHead( &pMac->scan.scanResultList, LL_ACCESS_NOLOCK ); |
| 12120 | while( pEntry ) |
| 12121 | { |
| 12122 | pResult = GET_BASE_ADDR( pEntry, tCsrScanResult, Link ); |
| 12123 | pIes = (tDot11fBeaconIEs *)( pResult->Result.pvIes ); |
| 12124 | fMatch = csrMatchBSS(pMac, &pResult->Result.BssDescriptor, |
| 12125 | pScanFilter, NULL, NULL, NULL, &pIes); |
| 12126 | //Release the IEs allocated by csrMatchBSS is needed |
| 12127 | if( !pResult->Result.pvIes ) |
| 12128 | { |
| 12129 | //need to free the IEs since it is allocated by csrMatchBSS |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12130 | vos_mem_free(pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12131 | } |
| 12132 | if(fMatch) |
| 12133 | { |
| 12134 | //We found the one |
| 12135 | if( csrLLRemoveEntry(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK) ) |
| 12136 | { |
| 12137 | //Free the memory |
| 12138 | csrFreeScanResultEntry( pMac, pResult ); |
| 12139 | } |
| 12140 | break; |
| 12141 | } |
| 12142 | pEntry = csrLLNext(&pMac->scan.scanResultList, pEntry, LL_ACCESS_NOLOCK); |
| 12143 | }//while |
| 12144 | csrLLUnlock(&pMac->scan.scanResultList); |
| 12145 | }while(0); |
| 12146 | if(pScanFilter) |
| 12147 | { |
| 12148 | csrFreeScanFilter(pMac, pScanFilter); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12149 | vos_mem_free(pScanFilter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12150 | } |
| 12151 | } |
| 12152 | return (status); |
| 12153 | } |
| 12154 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12155 | //BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12156 | eHalStatus csrIsBTAMPAllowed( tpAniSirGlobal pMac, tANI_U32 chnId ) |
| 12157 | { |
| 12158 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12159 | tANI_U32 sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12160 | for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 12161 | { |
| 12162 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 12163 | { |
| 12164 | if( csrIsConnStateIbss( pMac, sessionId ) || csrIsBTAMP( pMac, sessionId ) ) |
| 12165 | { |
| 12166 | //co-exist with IBSS or BT-AMP is not supported |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12167 | 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] | 12168 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 12169 | break; |
| 12170 | } |
| 12171 | if( csrIsConnStateInfra( pMac, sessionId ) ) |
| 12172 | { |
| 12173 | if( chnId && |
| 12174 | ( (tANI_U8)chnId != pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ) ) |
| 12175 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12176 | 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] | 12177 | chnId, pMac->roam.roamSession[sessionId].connectedProfile.operationChannel ); |
| 12178 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 12179 | break; |
| 12180 | } |
| 12181 | } |
| 12182 | } |
| 12183 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12184 | return ( status ); |
| 12185 | } |
| 12186 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12187 | static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc ) |
| 12188 | { |
| 12189 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12190 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12191 | tBssConfigParam bssConfig; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12192 | |
| 12193 | if(!pSession) |
| 12194 | { |
| 12195 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12196 | return eHAL_STATUS_FAILURE; |
| 12197 | } |
| 12198 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12199 | if ( csrIsConnStateIbss( pMac, sessionId ) ) |
| 12200 | { |
| 12201 | status = csrRoamIssueStopBss( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING ); |
| 12202 | } |
| 12203 | else if ( csrIsConnStateConnectedInfra( pMac, sessionId ) ) |
| 12204 | { |
| 12205 | // Disassociate from the connected Infrastructure network... |
| 12206 | status = csrRoamIssueDisassociate( pMac, sessionId, eCSR_ROAM_SUBSTATE_DISCONNECT_CONTINUE_ROAMING, FALSE ); |
| 12207 | } |
| 12208 | else |
| 12209 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12210 | //We don't expect Bt-AMP HDD not to disconnect the last connection first at this time. |
| 12211 | //Otherwise we need to add code to handle the |
| 12212 | //situation just like IBSS. Though for WDS station, we need to send disassoc to PE first then |
| 12213 | //send stop_bss to PE, before we can continue. |
| 12214 | VOS_ASSERT( !csrIsConnStateWds( pMac, sessionId ) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12215 | vos_mem_set(&bssConfig, sizeof(tBssConfigParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12216 | /* Assume HDD provide bssid in profile */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12217 | vos_mem_copy(&pSession->bssParams.bssid, pProfile->BSSIDs.bssid[0], |
| 12218 | sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12219 | // there is no Bss description before we start an WDS so we need |
| 12220 | // to adopt all Bss configuration parameters from the Profile. |
| 12221 | status = csrRoamPrepareBssConfigFromProfile(pMac, pProfile, &bssConfig, pBssDesc); |
| 12222 | if(HAL_STATUS_SUCCESS(status)) |
| 12223 | { |
| 12224 | //Save profile for late use |
| 12225 | csrFreeRoamProfile( pMac, sessionId ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12226 | pSession->pCurRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); |
| 12227 | if (pSession->pCurRoamProfile != NULL ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12228 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12229 | vos_mem_set(pSession->pCurRoamProfile, |
| 12230 | sizeof(tCsrRoamProfile), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12231 | csrRoamCopyProfile(pMac, pSession->pCurRoamProfile, pProfile); |
| 12232 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12233 | //Prepare some more parameters for this WDS |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12234 | csrRoamPrepareBssParams(pMac, sessionId, pProfile, NULL, &bssConfig, NULL); |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12235 | status = csrRoamSetBssConfigCfg(pMac, sessionId, pProfile, |
| 12236 | NULL, &bssConfig, |
| 12237 | NULL, eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12238 | } |
| 12239 | } |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12240 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12241 | return( status ); |
| 12242 | } |
| 12243 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12244 | ////////////////////Mail box |
| 12245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12246 | //pBuf is caller allocated memory point to &(tSirSmeJoinReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
| 12247 | //or &(tSirSmeReassocReq->rsnIE.rsnIEdata[ 0 ]) + pMsg->rsnIE.length; |
Madan Mohan Koyyalamudi | bd4fa9b | 2013-08-09 02:12:34 +0530 | [diff] [blame] | 12248 | static void csrPrepareJoinReassocReqBuffer( tpAniSirGlobal pMac, |
| 12249 | tSirBssDescription *pBssDescription, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12250 | tANI_U8 *pBuf, tANI_U8 uapsdMask) |
| 12251 | { |
| 12252 | tCsrChannelSet channelGroup; |
| 12253 | tSirMacCapabilityInfo *pAP_capabilityInfo; |
| 12254 | tAniBool fTmp; |
| 12255 | tANI_BOOLEAN found = FALSE; |
| 12256 | tANI_U32 size = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12257 | tANI_S8 pwrLimit = 0; |
| 12258 | tANI_U16 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12259 | // plug in neighborhood occupancy info (i.e. BSSes on primary or secondary channels) |
| 12260 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundPri |
| 12261 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecDown |
| 12262 | *pBuf++ = (tANI_U8)FALSE; //tAniTitanCBNeighborInfo->cbBssFoundSecUp |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12263 | // 802.11h |
| 12264 | //We can do this because it is in HOST CPU order for now. |
| 12265 | pAP_capabilityInfo = (tSirMacCapabilityInfo *)&pBssDescription->capabilityInfo; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12266 | //tell the target AP my 11H capability only if both AP and STA support 11H and the channel being used is 11a |
| 12267 | if ( csrIs11hSupported( pMac ) && pAP_capabilityInfo->spectrumMgt && eSIR_11A_NW_TYPE == pBssDescription->nwType ) |
| 12268 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12269 | fTmp = (tAniBool)pal_cpu_to_be32(1); |
| 12270 | } |
| 12271 | else |
| 12272 | fTmp = (tAniBool)0; |
| 12273 | |
| 12274 | // corresponds to --- pMsg->spectrumMgtIndicator = ON; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12275 | vos_mem_copy(pBuf, (tANI_U8 *)&fTmp, sizeof(tAniBool)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12276 | pBuf += sizeof(tAniBool); |
| 12277 | *pBuf++ = MIN_STA_PWR_CAP_DBM; // it is for pMsg->powerCap.minTxPower = 0; |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12278 | found = csrSearchChannelListForTxPower(pMac, pBssDescription, &channelGroup); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12279 | // This is required for 11k test VoWiFi Ent: Test 2. |
| 12280 | // We need the power capabilities for Assoc Req. |
| 12281 | // This macro is provided by the halPhyCfg.h. We pick our |
| 12282 | // max and min capability by the halPhy provided macros |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12283 | pwrLimit = csrGetCfgMaxTxPower (pMac, pBssDescription->channelId); |
| 12284 | if (0 != pwrLimit) |
| 12285 | { |
| 12286 | *pBuf++ = pwrLimit; |
| 12287 | } |
| 12288 | else |
| 12289 | { |
| 12290 | *pBuf++ = MAX_STA_PWR_CAP_DBM; |
| 12291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12292 | size = sizeof(pMac->roam.validChannelList); |
| 12293 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, (tANI_U8 *)pMac->roam.validChannelList, &size))) |
| 12294 | { |
| 12295 | *pBuf++ = (tANI_U8)size; //tSirSupChnl->numChnl |
| 12296 | for ( i = 0; i < size; i++) |
| 12297 | { |
| 12298 | *pBuf++ = pMac->roam.validChannelList[ i ]; //tSirSupChnl->channelList[ i ] |
| 12299 | |
| 12300 | } |
| 12301 | } |
| 12302 | else |
| 12303 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12304 | smsLog(pMac, LOGE, FL("can not find any valid channel")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12305 | *pBuf++ = 0; //tSirSupChnl->numChnl |
| 12306 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12307 | //Check whether it is ok to enter UAPSD |
| 12308 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 12309 | if( btcIsReadyForUapsd(pMac) ) |
| 12310 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 12311 | { |
| 12312 | *pBuf++ = uapsdMask; |
| 12313 | } |
| 12314 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
| 12315 | else |
| 12316 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12317 | 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] | 12318 | *pBuf++ = 0; |
| 12319 | } |
| 12320 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
| 12321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12322 | // move the entire BssDescription into the join request. |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12323 | vos_mem_copy(pBuf, pBssDescription, |
| 12324 | pBssDescription->length + sizeof( pBssDescription->length )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12325 | pBuf += pBssDescription->length + sizeof( pBssDescription->length ); // update to new location |
| 12326 | } |
| 12327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12328 | /* |
| 12329 | * The communication between HDD and LIM is thru mailbox (MB). |
| 12330 | * Both sides will access the data structure "tSirSmeJoinReq". |
| 12331 | * The rule is, while the components of "tSirSmeJoinReq" can be accessed in the regular way like tSirSmeJoinReq.assocType, this guideline |
| 12332 | * stops at component tSirRSNie; any acces to the components after tSirRSNie is forbidden because the space from tSirRSNie is quueezed |
| 12333 | * with the component "tSirBssDescription". And since the size of actual 'tSirBssDescription' varies, the receiving side (which is the routine |
| 12334 | * limJoinReqSerDes() of limSerDesUtils.cc) should keep in mind not to access the components DIRECTLY after tSirRSNie. |
| 12335 | */ |
| 12336 | eHalStatus csrSendJoinReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirBssDescription *pBssDescription, |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12337 | tCsrRoamProfile *pProfile, tDot11fBeaconIEs *pIes, tANI_U16 messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12338 | { |
| 12339 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12340 | tSirSmeJoinReq *pMsg; |
| 12341 | tANI_U8 *pBuf; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12342 | v_U8_t acm_mask = 0, uapsd_mask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12343 | tANI_U16 msgLen, wTmp, ieLen; |
| 12344 | tSirMacRateSet OpRateSet; |
| 12345 | tSirMacRateSet ExRateSet; |
| 12346 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12347 | tANI_U32 dwTmp; |
| 12348 | 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] | 12349 | tANI_U32 ucDot11Mode = 0; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12350 | |
| 12351 | if(!pSession) |
| 12352 | { |
| 12353 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 12354 | return eHAL_STATUS_FAILURE; |
| 12355 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12356 | /* To satisfy klockworks */ |
| 12357 | if (NULL == pBssDescription) |
| 12358 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12359 | smsLog(pMac, LOGE, FL(" pBssDescription is NULL")); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12360 | return eHAL_STATUS_FAILURE; |
| 12361 | } |
| 12362 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12363 | do { |
| 12364 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 12365 | pSession->joinFailStatusCode.reasonCode = 0; |
Kiran Kumar Lokere | c8550fa | 2013-04-15 22:23:00 -0700 | [diff] [blame] | 12366 | memcpy (&pSession->joinFailStatusCode.bssId, &pBssDescription->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12367 | // There are a number of variable length fields to consider. First, the tSirSmeJoinReq |
| 12368 | // includes a single bssDescription. bssDescription includes a single tANI_U32 for the |
| 12369 | // IE fields, but the length field in the bssDescription needs to be interpreted to |
| 12370 | // determine length of the IE fields. |
| 12371 | // |
| 12372 | // So, take the size of the JoinReq, subtract the size of the bssDescription and |
| 12373 | // add in the length from the bssDescription (then add the size of the 'length' field |
| 12374 | // itself because that is NOT included in the length field). |
| 12375 | msgLen = sizeof( tSirSmeJoinReq ) - sizeof( *pBssDescription ) + |
| 12376 | pBssDescription->length + sizeof( pBssDescription->length ) + |
| 12377 | 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] | 12378 | pMsg = vos_mem_malloc(msgLen); |
| 12379 | if (NULL == pMsg) |
| 12380 | status = eHAL_STATUS_FAILURE; |
| 12381 | else |
| 12382 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12383 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12384 | vos_mem_set(pMsg, msgLen , 0); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12385 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)messageType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12386 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 12387 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12388 | // sessionId |
| 12389 | *pBuf = (tANI_U8)sessionId; |
| 12390 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12391 | // transactionId |
| 12392 | *pBuf = 0; |
| 12393 | *( pBuf + 1 ) = 0; |
| 12394 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12395 | // ssId |
| 12396 | if( pIes->SSID.present && pIes->SSID.num_ssid ) |
| 12397 | { |
| 12398 | // ssId len |
| 12399 | *pBuf = pIes->SSID.num_ssid; |
| 12400 | pBuf++; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12401 | vos_mem_copy(pBuf, pIes->SSID.ssid, pIes->SSID.num_ssid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12402 | pBuf += pIes->SSID.num_ssid; |
| 12403 | } |
| 12404 | else |
| 12405 | { |
| 12406 | *pBuf = 0; |
| 12407 | pBuf++; |
| 12408 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12409 | // selfMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12410 | vos_mem_copy((tSirMacAddr *)pBuf, &pSession->selfMacAddr, |
| 12411 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12412 | pBuf += sizeof(tSirMacAddr); |
| 12413 | // bsstype |
| 12414 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( pProfile->BSSType ) ); |
| 12415 | 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] | 12416 | vos_mem_copy(pBuf, &dwTmp, sizeof(tSirBssType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12417 | pBuf += sizeof(tSirBssType); |
| 12418 | // dot11mode |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 12419 | ucDot11Mode = csrTranslateToWNICfgDot11Mode( pMac, pSession->bssParams.uCfgDot11Mode ); |
| 12420 | if (pBssDescription->channelId <= 14 && |
| 12421 | FALSE == pMac->roam.configParam.enableVhtFor24GHz && |
| 12422 | WNI_CFG_DOT11_MODE_11AC == ucDot11Mode) |
| 12423 | { |
| 12424 | //Need to disable VHT operation in 2.4 GHz band |
| 12425 | ucDot11Mode = WNI_CFG_DOT11_MODE_11N; |
| 12426 | } |
| 12427 | *pBuf = (tANI_U8)ucDot11Mode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12428 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12429 | //Persona |
| 12430 | *pBuf = (tANI_U8)pProfile->csrPersona; |
| 12431 | pBuf++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12432 | //CBMode |
| 12433 | *pBuf = (tANI_U8)pSession->bssParams.cbMode; |
| 12434 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12435 | |
| 12436 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12437 | FL("CSR PERSONA=%d CSR CbMode %d"), pProfile->csrPersona, pSession->bssParams.cbMode); |
| 12438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12439 | // uapsdPerAcBitmask |
| 12440 | *pBuf = pProfile->uapsd_mask; |
| 12441 | pBuf++; |
| 12442 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12443 | |
| 12444 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12445 | status = csrGetRateSet(pMac, pProfile, (eCsrPhyMode)pProfile->phyMode, pBssDescription, pIes, &OpRateSet, &ExRateSet); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12446 | if (HAL_STATUS_SUCCESS(status) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12447 | { |
| 12448 | // OperationalRateSet |
| 12449 | if (OpRateSet.numRates) { |
| 12450 | *pBuf++ = OpRateSet.numRates; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12451 | vos_mem_copy(pBuf, OpRateSet.rate, OpRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12452 | pBuf += OpRateSet.numRates; |
| 12453 | } else *pBuf++ = 0; |
| 12454 | // ExtendedRateSet |
| 12455 | if (ExRateSet.numRates) { |
| 12456 | *pBuf++ = ExRateSet.numRates; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12457 | vos_mem_copy(pBuf, ExRateSet.rate, ExRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12458 | pBuf += ExRateSet.numRates; |
| 12459 | } else *pBuf++ = 0; |
| 12460 | } |
| 12461 | else |
| 12462 | { |
| 12463 | *pBuf++ = 0; |
| 12464 | *pBuf++ = 0; |
| 12465 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12466 | // rsnIE |
| 12467 | if ( csrIsProfileWpa( pProfile ) ) |
| 12468 | { |
| 12469 | // Insert the Wpa IE into the join request |
| 12470 | ieLen = csrRetrieveWpaIe( pMac, pProfile, pBssDescription, pIes, |
| 12471 | (tCsrWpaIe *)( wpaRsnIE ) ); |
| 12472 | } |
| 12473 | else if( csrIsProfileRSN( pProfile ) ) |
| 12474 | { |
| 12475 | // Insert the RSN IE into the join request |
| 12476 | ieLen = csrRetrieveRsnIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 12477 | (tCsrRSNIe *)( wpaRsnIE ) ); |
| 12478 | } |
| 12479 | #ifdef FEATURE_WLAN_WAPI |
| 12480 | else if( csrIsProfileWapi( pProfile ) ) |
| 12481 | { |
| 12482 | // Insert the WAPI IE into the join request |
| 12483 | ieLen = csrRetrieveWapiIe( pMac, sessionId, pProfile, pBssDescription, pIes, |
| 12484 | (tCsrWapiIe *)( wpaRsnIE ) ); |
| 12485 | } |
| 12486 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12487 | else |
| 12488 | { |
| 12489 | ieLen = 0; |
| 12490 | } |
| 12491 | //remember the IE for future use |
| 12492 | if( ieLen ) |
| 12493 | { |
| 12494 | if(ieLen > DOT11F_IE_RSN_MAX_LEN) |
| 12495 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 12496 | 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] | 12497 | ieLen = DOT11F_IE_RSN_MAX_LEN; |
| 12498 | } |
| 12499 | #ifdef FEATURE_WLAN_WAPI |
| 12500 | if( csrIsProfileWapi( pProfile ) ) |
| 12501 | { |
| 12502 | //Check whether we need to allocate more memory |
| 12503 | if(ieLen > pSession->nWapiReqIeLength) |
| 12504 | { |
| 12505 | if(pSession->pWapiReqIE && pSession->nWapiReqIeLength) |
| 12506 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12507 | vos_mem_free(pSession->pWapiReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12508 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12509 | pSession->pWapiReqIE = vos_mem_malloc(ieLen); |
| 12510 | if (NULL == pSession->pWapiReqIE) |
| 12511 | status = eHAL_STATUS_FAILURE; |
| 12512 | else |
| 12513 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12514 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12515 | } |
| 12516 | pSession->nWapiReqIeLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12517 | vos_mem_copy(pSession->pWapiReqIE, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12518 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12519 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12520 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12521 | vos_mem_copy(pBuf, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12522 | pBuf += ieLen; |
| 12523 | } |
| 12524 | else//should be WPA/WPA2 otherwise |
| 12525 | #endif /* FEATURE_WLAN_WAPI */ |
| 12526 | { |
| 12527 | //Check whether we need to allocate more memory |
| 12528 | if(ieLen > pSession->nWpaRsnReqIeLength) |
| 12529 | { |
| 12530 | if(pSession->pWpaRsnReqIE && pSession->nWpaRsnReqIeLength) |
| 12531 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12532 | vos_mem_free(pSession->pWpaRsnReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12533 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12534 | pSession->pWpaRsnReqIE = vos_mem_malloc(ieLen); |
| 12535 | if (NULL == pSession->pWpaRsnReqIE) |
| 12536 | status = eHAL_STATUS_FAILURE; |
| 12537 | else |
| 12538 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12539 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12540 | } |
| 12541 | pSession->nWpaRsnReqIeLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12542 | vos_mem_copy(pSession->pWpaRsnReqIE, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12543 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12544 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12545 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12546 | vos_mem_copy(pBuf, wpaRsnIE, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12547 | pBuf += ieLen; |
| 12548 | } |
| 12549 | } |
| 12550 | else |
| 12551 | { |
| 12552 | //free whatever old info |
| 12553 | pSession->nWpaRsnReqIeLength = 0; |
| 12554 | if(pSession->pWpaRsnReqIE) |
| 12555 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12556 | vos_mem_free(pSession->pWpaRsnReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12557 | pSession->pWpaRsnReqIE = NULL; |
| 12558 | } |
| 12559 | #ifdef FEATURE_WLAN_WAPI |
| 12560 | pSession->nWapiReqIeLength = 0; |
| 12561 | if(pSession->pWapiReqIE) |
| 12562 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12563 | vos_mem_free(pSession->pWapiReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12564 | pSession->pWapiReqIE = NULL; |
| 12565 | } |
| 12566 | #endif /* FEATURE_WLAN_WAPI */ |
| 12567 | //length is two bytes |
| 12568 | *pBuf = 0; |
| 12569 | *(pBuf + 1) = 0; |
| 12570 | pBuf += 2; |
| 12571 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12572 | #ifdef FEATURE_WLAN_CCX |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12573 | if( eWNI_SME_JOIN_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12574 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12575 | // Never include the cckmIE in an Join Request |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12576 | //length is two bytes |
| 12577 | *pBuf = 0; |
| 12578 | *(pBuf + 1) = 0; |
| 12579 | pBuf += 2; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12580 | } |
| 12581 | else if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12582 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12583 | // cckmIE |
| 12584 | if( csrIsProfileCCX( pProfile ) ) |
| 12585 | { |
| 12586 | // Insert the CCKM IE into the join request |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 12587 | #ifdef FEATURE_WLAN_CCX_UPLOAD |
| 12588 | ieLen = pSession->suppCckmIeInfo.cckmIeLen; |
| 12589 | palCopyMemory(pMac->hHdd, (void *) (wpaRsnIE), |
| 12590 | pSession->suppCckmIeInfo.cckmIe, ieLen); |
| 12591 | #else |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12592 | ieLen = csrConstructCcxCckmIe( pMac, |
| 12593 | pSession, |
| 12594 | pProfile, |
| 12595 | pBssDescription, |
| 12596 | pSession->pWpaRsnReqIE, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12597 | pSession->nWpaRsnReqIeLength, |
| 12598 | (void *)( wpaRsnIE ) ); |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 12599 | #endif /* FEATURE_WLAN_CCX_UPLOAD */ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12600 | } |
| 12601 | else |
| 12602 | { |
| 12603 | ieLen = 0; |
| 12604 | } |
| 12605 | //If present, copy the IE into the eWNI_SME_REASSOC_REQ message buffer |
| 12606 | if( ieLen ) |
| 12607 | { |
| 12608 | //Copy the CCKM IE over from the temp buffer (wpaRsnIE) |
| 12609 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12610 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12611 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12612 | vos_mem_copy(pBuf, wpaRsnIE, ieLen); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12613 | pBuf += ieLen; |
| 12614 | } |
| 12615 | else |
| 12616 | { |
| 12617 | //Indicate you have no CCKM IE |
| 12618 | //length is two bytes |
| 12619 | *pBuf = 0; |
| 12620 | *(pBuf + 1) = 0; |
| 12621 | pBuf += 2; |
| 12622 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12623 | } |
| 12624 | #endif /* FEATURE_WLAN_CCX */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12625 | // addIEScan |
| 12626 | if(pProfile->nAddIEScanLength && pProfile->pAddIEScan) |
| 12627 | { |
| 12628 | ieLen = pProfile->nAddIEScanLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12629 | if(ieLen > pSession->nAddIEScanLength) |
| 12630 | { |
| 12631 | if(pSession->pAddIEScan && pSession->nAddIEScanLength) |
| 12632 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12633 | vos_mem_free(pSession->pAddIEScan); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12634 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12635 | pSession->pAddIEScan = vos_mem_malloc(ieLen); |
| 12636 | if (NULL == pSession->pAddIEScan) |
| 12637 | status = eHAL_STATUS_FAILURE; |
| 12638 | else |
| 12639 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12640 | if(!HAL_STATUS_SUCCESS(status)) break; |
| 12641 | } |
| 12642 | pSession->nAddIEScanLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12643 | vos_mem_copy(pSession->pAddIEScan, pProfile->pAddIEScan, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12644 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12645 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12646 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12647 | vos_mem_copy(pBuf, pProfile->pAddIEScan, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12648 | pBuf += ieLen; |
| 12649 | } |
| 12650 | else |
| 12651 | { |
| 12652 | pSession->nAddIEScanLength = 0; |
| 12653 | if(pSession->pAddIEScan) |
| 12654 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12655 | vos_mem_free(pSession->pAddIEScan); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12656 | pSession->pAddIEScan = NULL; |
| 12657 | } |
| 12658 | *pBuf = 0; |
| 12659 | *(pBuf + 1) = 0; |
| 12660 | pBuf += 2; |
| 12661 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12662 | // addIEAssoc |
| 12663 | if(pProfile->nAddIEAssocLength && pProfile->pAddIEAssoc) |
| 12664 | { |
| 12665 | ieLen = pProfile->nAddIEAssocLength; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12666 | if(ieLen > pSession->nAddIEAssocLength) |
| 12667 | { |
| 12668 | if(pSession->pAddIEAssoc && pSession->nAddIEAssocLength) |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12669 | { |
| 12670 | vos_mem_free(pSession->pAddIEAssoc); |
| 12671 | } |
| 12672 | pSession->pAddIEAssoc = vos_mem_malloc(ieLen); |
| 12673 | if (NULL == pSession->pAddIEAssoc) |
| 12674 | status = eHAL_STATUS_FAILURE; |
| 12675 | else |
| 12676 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12677 | if(!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12678 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12679 | pSession->nAddIEAssocLength = ieLen; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12680 | vos_mem_copy(pSession->pAddIEAssoc, pProfile->pAddIEAssoc, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12681 | wTmp = pal_cpu_to_be16( ieLen ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12682 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12683 | pBuf += sizeof(tANI_U16); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12684 | vos_mem_copy(pBuf, pProfile->pAddIEAssoc, ieLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12685 | pBuf += ieLen; |
| 12686 | } |
| 12687 | else |
| 12688 | { |
| 12689 | pSession->nAddIEAssocLength = 0; |
| 12690 | if(pSession->pAddIEAssoc) |
| 12691 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12692 | vos_mem_free(pSession->pAddIEAssoc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12693 | pSession->pAddIEAssoc = NULL; |
| 12694 | } |
| 12695 | *pBuf = 0; |
| 12696 | *(pBuf + 1) = 0; |
| 12697 | pBuf += 2; |
| 12698 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12699 | |
| 12700 | if(eWNI_SME_REASSOC_REQ == messageType ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12701 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12702 | //Unmask any AC in reassoc that is ACM-set |
| 12703 | uapsd_mask = (v_U8_t)pProfile->uapsd_mask; |
| 12704 | if( uapsd_mask && ( NULL != pBssDescription ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12705 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12706 | if( CSR_IS_QOS_BSS(pIes) && CSR_IS_UAPSD_BSS(pIes) ) |
| 12707 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12708 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12709 | acm_mask = sme_QosGetACMMask(pMac, pBssDescription, pIes); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12710 | #endif /* WLAN_MDM_CODE_REDUCTION_OPT*/ |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12711 | uapsd_mask &= ~(acm_mask); |
| 12712 | } |
| 12713 | else |
| 12714 | { |
| 12715 | uapsd_mask = 0; |
| 12716 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12717 | } |
| 12718 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12720 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedUCEncryptionType) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12721 | vos_mem_copy(pBuf, &dwTmp, sizeof(tANI_U32)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12722 | pBuf += sizeof(tANI_U32); |
| 12723 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12724 | dwTmp = pal_cpu_to_be32( csrTranslateEncryptTypeToEdType( pProfile->negotiatedMCEncryptionType) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12725 | vos_mem_copy(pBuf, &dwTmp, sizeof(tANI_U32)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12726 | pBuf += sizeof(tANI_U32); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12727 | #ifdef WLAN_FEATURE_11W |
| 12728 | //MgmtEncryption |
| 12729 | if (pProfile->MFPEnabled) |
| 12730 | { |
| 12731 | dwTmp = pal_cpu_to_be32(eSIR_ED_AES_128_CMAC); |
| 12732 | } |
| 12733 | else |
| 12734 | { |
| 12735 | dwTmp = pal_cpu_to_be32(eSIR_ED_NONE); |
| 12736 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12737 | vos_mem_copy(pBuf, &dwTmp, sizeof(tANI_U32)); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12738 | pBuf += sizeof(tANI_U32); |
| 12739 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12740 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12741 | pProfile->MDID.mdiePresent = pBssDescription->mdiePresent; |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 12742 | if (csrIsProfile11r( pProfile ) |
| 12743 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 09dd66b | 2013-04-01 17:13:01 +0530 | [diff] [blame] | 12744 | && !((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) && |
| 12745 | (pIes->CCXVersion.present) && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Saurabh Gupta | 775073c | 2013-02-14 13:31:36 +0530 | [diff] [blame] | 12746 | #endif |
| 12747 | ) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12748 | { |
| 12749 | // is11Rconnection; |
| 12750 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12751 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)) ; |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12752 | pBuf += sizeof(tAniBool); |
| 12753 | } |
| 12754 | else |
| 12755 | { |
| 12756 | // is11Rconnection; |
| 12757 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12758 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12759 | pBuf += sizeof(tAniBool); |
| 12760 | } |
| 12761 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12762 | #ifdef FEATURE_WLAN_CCX |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 12763 | |
| 12764 | // isCCXFeatureIniEnabled |
| 12765 | if (TRUE == pMac->roam.configParam.isCcxIniFeatureEnabled) |
| 12766 | { |
| 12767 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12768 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 12769 | pBuf += sizeof(tAniBool); |
| 12770 | } |
| 12771 | else |
| 12772 | { |
| 12773 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12774 | vos_mem_copy(pMac->hHdd, pBuf, &dwTmp, sizeof(tAniBool)); |
Gopichand Nakkala | 0ae39db | 2013-06-10 20:35:49 +0530 | [diff] [blame] | 12775 | pBuf += sizeof(tAniBool); |
| 12776 | } |
| 12777 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12778 | /* A profile can not be both CCX and 11R. But an 802.11R AP |
| 12779 | * may be advertising support for CCX as well. So if we are |
| 12780 | * associating Open or explicitly CCX then we will get CCX. |
| 12781 | * If we are associating explictly 11R only then we will get |
| 12782 | * 11R. |
| 12783 | */ |
| 12784 | if ((csrIsProfileCCX(pProfile) || |
| 12785 | ((pIes->CCXVersion.present) |
| 12786 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12787 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 12788 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 12789 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12790 | #ifdef WLAN_FEATURE_11W |
| 12791 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 12792 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12793 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12794 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
| 12795 | { |
| 12796 | // isCCXconnection; |
| 12797 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12798 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12799 | pBuf += sizeof(tAniBool); |
| 12800 | } |
| 12801 | else |
| 12802 | { |
| 12803 | //isCCXconnection; |
| 12804 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12805 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12806 | pBuf += sizeof(tAniBool); |
| 12807 | } |
| 12808 | |
| 12809 | if (eWNI_SME_JOIN_REQ == messageType) |
| 12810 | { |
| 12811 | tCCXTspecInfo ccxTspec; |
| 12812 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 12813 | // so nullify the TSPEC parameters |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12814 | vos_mem_set(&ccxTspec, sizeof(tCCXTspecInfo), 0); |
| 12815 | vos_mem_copy(pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12816 | pBuf += sizeof(tCCXTspecInfo); |
| 12817 | } |
| 12818 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 12819 | { |
| 12820 | if ((csrIsProfileCCX(pProfile) || |
| 12821 | ((pIes->CCXVersion.present) |
| 12822 | && ((pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_OPEN_SYSTEM) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12823 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA) |
| 12824 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_WPA_PSK) |
| 12825 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 12826 | #ifdef WLAN_FEATURE_11W |
| 12827 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) |
| 12828 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12829 | || (pProfile->negotiatedAuthType == eCSR_AUTH_TYPE_RSN_PSK)))) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12830 | && (pMac->roam.configParam.isCcxIniFeatureEnabled)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12831 | { |
| 12832 | tCCXTspecInfo ccxTspec; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12833 | // CCX Tspec information |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12834 | vos_mem_set(&ccxTspec, sizeof(tCCXTspecInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12835 | ccxTspec.numTspecs = sme_QosCCxRetrieveTspecInfo(pMac, sessionId, (tTspecInfo *) &ccxTspec.tspec[0]); |
| 12836 | *pBuf = ccxTspec.numTspecs; |
| 12837 | pBuf += sizeof(tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12838 | // Copy the TSPEC information only if present |
| 12839 | if (ccxTspec.numTspecs) { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12840 | vos_mem_copy(pBuf, (void*)&ccxTspec.tspec[0], |
| 12841 | (ccxTspec.numTspecs*sizeof(tTspecInfo))); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12842 | } |
| 12843 | pBuf += sizeof(ccxTspec.tspec); |
| 12844 | } |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12845 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12846 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12847 | tCCXTspecInfo ccxTspec; |
| 12848 | // CCX-Tspec IEs in the ASSOC request is presently not supported |
| 12849 | // so nullify the TSPEC parameters |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12850 | vos_mem_set(&ccxTspec, sizeof(tCCXTspecInfo), 0); |
| 12851 | vos_mem_copy(pBuf, &ccxTspec, sizeof(tCCXTspecInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12852 | pBuf += sizeof(tCCXTspecInfo); |
| 12853 | } |
| 12854 | } |
| 12855 | #endif // FEATURE_WLAN_CCX |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12856 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12857 | // Fill in isFastTransitionEnabled |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12858 | if (pMac->roam.configParam.isFastTransitionEnabled |
| 12859 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 12860 | || csrRoamIsFastRoamEnabled(pMac, sessionId) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12861 | #endif |
| 12862 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12863 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12864 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12865 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12866 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12867 | } |
| 12868 | else |
| 12869 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12870 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12871 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12872 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12873 | } |
| 12874 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12875 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 12876 | if(csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12877 | { |
| 12878 | //legacy fast roaming enabled |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12879 | dwTmp = pal_cpu_to_be32(TRUE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12880 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12881 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12882 | } |
| 12883 | else |
| 12884 | { |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12885 | dwTmp = pal_cpu_to_be32(FALSE); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12886 | vos_mem_copy(pBuf, &dwTmp, sizeof(tAniBool)); |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12887 | pBuf += sizeof(tAniBool); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 12888 | } |
| 12889 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12890 | |
| 12891 | // txLdpcIniFeatureEnabled |
| 12892 | *pBuf = (tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 12893 | pBuf++; |
| 12894 | |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12895 | if ((csrIs11hSupported (pMac)) && (CSR_IS_CHANNEL_5GHZ(pBssDescription->channelId)) && |
| 12896 | (pIes->Country.present) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)) |
| 12897 | { |
| 12898 | csrSaveToChannelPower2G_5G( pMac, pIes->Country.num_triplets * sizeof(tSirMacChanInfo), |
| 12899 | (tSirMacChanInfo *)(&pIes->Country.triplets[0]) ); |
| 12900 | csrApplyPower2Current(pMac); |
| 12901 | } |
| 12902 | |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 12903 | #ifdef WLAN_FEATURE_11AC |
Kiran | 4a17ebe | 2013-01-31 10:43:43 -0800 | [diff] [blame] | 12904 | // txBFIniFeatureEnabled |
| 12905 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFEnable; |
| 12906 | pBuf++; |
Shailender Karmuchi | cc3fe44 | 2013-02-16 18:18:33 -0800 | [diff] [blame] | 12907 | |
| 12908 | // txBFCsnValue |
| 12909 | *pBuf = (tANI_U8)pMac->roam.configParam.txBFCsnValue; |
| 12910 | pBuf++; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 12911 | #endif |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 12912 | *pBuf = (tANI_U8)pMac->roam.configParam.isAmsduSupportInAMPDU; |
| 12913 | pBuf++; |
| 12914 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12915 | //BssDesc |
| 12916 | csrPrepareJoinReassocReqBuffer( pMac, pBssDescription, pBuf, |
| 12917 | (tANI_U8)pProfile->uapsd_mask); |
krunal soni | 5afa96c | 2013-09-06 22:19:02 -0700 | [diff] [blame] | 12918 | |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12919 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 12920 | if(!HAL_STATUS_SUCCESS(status)) |
| 12921 | { |
| 12922 | break; |
| 12923 | } |
| 12924 | else |
| 12925 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12926 | #ifndef WLAN_MDM_CODE_REDUCTION_OPT |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12927 | if (eWNI_SME_JOIN_REQ == messageType) |
| 12928 | { |
| 12929 | //Tush-QoS: notify QoS module that join happening |
| 12930 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_JOIN_REQ, NULL); |
| 12931 | } |
| 12932 | else if (eWNI_SME_REASSOC_REQ == messageType) |
| 12933 | { |
| 12934 | //Tush-QoS: notify QoS module that reassoc happening |
| 12935 | sme_QosCsrEventInd(pMac, (v_U8_t)sessionId, SME_QOS_CSR_REASSOC_REQ, NULL); |
| 12936 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12937 | #endif |
Srinivas Girigowda | c16730e | 2013-01-16 13:39:39 -0800 | [diff] [blame] | 12938 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12939 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12940 | return( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12941 | } |
| 12942 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12943 | // |
| 12944 | eHalStatus csrSendMBDisassocReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 12945 | { |
| 12946 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 12947 | tSirSmeDisassocReq *pMsg; |
| 12948 | tANI_U8 *pBuf; |
| 12949 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12950 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 12951 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 12952 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12953 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12954 | pMsg = vos_mem_malloc(sizeof(tSirSmeDisassocReq)); |
| 12955 | if (NULL == pMsg) |
| 12956 | status = eHAL_STATUS_FAILURE; |
| 12957 | else |
| 12958 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12959 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12960 | vos_mem_set(pMsg, sizeof( tSirSmeDisassocReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12961 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_REQ); |
| 12962 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12963 | pBuf = &pMsg->sessionId; |
| 12964 | // sessionId |
| 12965 | *pBuf++ = (tANI_U8)sessionId; |
| 12966 | // transactionId |
| 12967 | *pBuf = 0; |
| 12968 | *( pBuf + 1 ) = 0; |
| 12969 | pBuf += sizeof(tANI_U16); |
| 12970 | |
Gopichand Nakkala | 06a7b3f | 2013-03-05 17:56:50 +0530 | [diff] [blame] | 12971 | if ( (pSession->pCurRoamProfile != NULL) && |
| 12972 | ((CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
| 12973 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12974 | { |
| 12975 | // Set the bssid address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12976 | vos_mem_copy((tSirMacAddr *)pBuf, pSession->selfMacAddr, |
| 12977 | sizeof( tSirMacAddr )); |
| 12978 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12979 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12980 | // Set the peer MAC address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12981 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr )); |
| 12982 | //perMacAddr is passed as bssId for softAP |
| 12983 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12984 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 12985 | } |
| 12986 | else |
| 12987 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12988 | // Set the peer MAC address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12989 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof( tSirMacAddr )); |
| 12990 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12991 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12992 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof( pMsg->bssId )); |
| 12993 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12994 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12995 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12996 | if(!HAL_STATUS_SUCCESS(status)) |
| 12997 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 12998 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12999 | break; |
| 13000 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13001 | // reasonCode |
| 13002 | wTmp = pal_cpu_to_be16(reasonCode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13003 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
| 13004 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13005 | if(!HAL_STATUS_SUCCESS(status)) |
| 13006 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13007 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13008 | break; |
| 13009 | } |
| 13010 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13011 | /* The state will be DISASSOC_HANDOFF only when we are doing handoff. |
| 13012 | Here we should not send the disassoc over the air to the AP */ |
| 13013 | if ( CSR_IS_ROAM_SUBSTATE_DISASSOC_HO(pMac, sessionId) |
| 13014 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 13015 | && csrRoamIs11rAssoc(pMac) |
| 13016 | #endif |
| 13017 | ) |
| 13018 | { |
| 13019 | *pBuf = CSR_DONT_SEND_DISASSOC_OVER_THE_AIR; /* Set DoNotSendOverTheAir flag to 1 only for handoff case */ |
| 13020 | } |
| 13021 | pBuf += sizeof(tANI_U8); |
| 13022 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13023 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13024 | return( status ); |
| 13025 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13026 | eHalStatus csrSendMBTkipCounterMeasuresReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_BOOLEAN bEnable, tSirMacAddr bssId ) |
| 13027 | { |
| 13028 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13029 | tSirSmeTkipCntrMeasReq *pMsg; |
| 13030 | tANI_U8 *pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13031 | do |
| 13032 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13033 | pMsg = vos_mem_malloc(sizeof( tSirSmeTkipCntrMeasReq )); |
| 13034 | if ( NULL == pMsg ) |
| 13035 | status = eHAL_STATUS_FAILURE; |
| 13036 | else |
| 13037 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13038 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13039 | vos_mem_set(pMsg, sizeof( tSirSmeTkipCntrMeasReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13040 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_TKIP_CNTR_MEAS_REQ); |
| 13041 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeTkipCntrMeasReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13042 | pBuf = &pMsg->sessionId; |
| 13043 | // sessionId |
| 13044 | *pBuf++ = (tANI_U8)sessionId; |
| 13045 | // transactionId |
| 13046 | *pBuf = 0; |
| 13047 | *( pBuf + 1 ) = 0; |
| 13048 | pBuf += sizeof(tANI_U16); |
| 13049 | // bssid |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13050 | vos_mem_copy(pMsg->bssId, bssId, sizeof( tSirMacAddr )); |
| 13051 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13052 | pBuf = pBuf + sizeof ( tSirMacAddr ); |
| 13053 | // bEnable |
| 13054 | *pBuf = (tANI_BOOLEAN)bEnable; |
| 13055 | if(!HAL_STATUS_SUCCESS(status)) |
| 13056 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13057 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13058 | break; |
| 13059 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13060 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13061 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13062 | return( status ); |
| 13063 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13064 | eHalStatus |
| 13065 | csrSendMBGetAssociatedStasReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13066 | VOS_MODULE_ID modId, tSirMacAddr bssId, |
| 13067 | void *pUsrContext, void *pfnSapEventCallback, |
| 13068 | tANI_U8 *pAssocStasBuf ) |
| 13069 | { |
| 13070 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13071 | tSirSmeGetAssocSTAsReq *pMsg; |
| 13072 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 13073 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13074 | do |
| 13075 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13076 | pMsg = vos_mem_malloc(sizeof( tSirSmeGetAssocSTAsReq )); |
| 13077 | if ( NULL == pMsg ) |
| 13078 | status = eHAL_STATUS_FAILURE; |
| 13079 | else |
| 13080 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13081 | if (!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13082 | vos_mem_set(pMsg, sizeof( tSirSmeGetAssocSTAsReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13083 | 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] | 13084 | pBuf = (tANI_U8 *)&pMsg->bssId; |
| 13085 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13086 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13087 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13088 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13089 | // modId |
| 13090 | dwTmp = pal_cpu_to_be16((tANI_U16)modId); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13091 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13092 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13093 | // pUsrContext |
| 13094 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13095 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13096 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13097 | // pfnSapEventCallback |
| 13098 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13099 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13100 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13101 | // pAssocStasBuf |
| 13102 | dwTmp = pal_cpu_to_be32((tANI_U32)pAssocStasBuf); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13103 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13104 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13105 | 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] | 13106 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13107 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13108 | return( status ); |
| 13109 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13110 | eHalStatus |
| 13111 | csrSendMBGetWPSPBCSessions( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13112 | tSirMacAddr bssId, void *pUsrContext, void *pfnSapEventCallback,v_MACADDR_t pRemoveMac) |
| 13113 | { |
| 13114 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13115 | tSirSmeGetWPSPBCSessionsReq *pMsg; |
| 13116 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 13117 | tANI_U32 dwTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13118 | do |
| 13119 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13120 | pMsg = vos_mem_malloc(sizeof(tSirSmeGetWPSPBCSessionsReq)); |
| 13121 | if ( NULL == pMsg ) |
| 13122 | status = eHAL_STATUS_FAILURE; |
| 13123 | else |
| 13124 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13125 | if (!HAL_STATUS_SUCCESS(status)) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13126 | vos_mem_set(pMsg, sizeof( tSirSmeGetWPSPBCSessionsReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13127 | 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] | 13128 | pBuf = (tANI_U8 *)&pMsg->pUsrContext; |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 13129 | VOS_ASSERT(pBuf); |
| 13130 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13131 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13132 | // pUsrContext |
| 13133 | dwTmp = pal_cpu_to_be32((tANI_U32)pUsrContext); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13134 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13135 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13136 | // pSapEventCallback |
| 13137 | dwTmp = pal_cpu_to_be32((tANI_U32)pfnSapEventCallback); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13138 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13139 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13140 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13141 | vos_mem_copy((tSirMacAddr *)pBuf, bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13142 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13143 | // MAC Address of STA in WPS session |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13144 | vos_mem_copy((tSirMacAddr *)pBuf, pRemoveMac.bytes, sizeof(v_MACADDR_t)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13145 | pBuf += sizeof(v_MACADDR_t); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13146 | 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] | 13147 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13148 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13149 | return( status ); |
| 13150 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13151 | |
| 13152 | eHalStatus |
| 13153 | csrSendChngMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13154 | { |
| 13155 | tpSirChangeBIParams pMsg; |
| 13156 | tANI_U16 len = 0; |
| 13157 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13158 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13159 | |
| 13160 | if(!pSession) |
| 13161 | { |
| 13162 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13163 | return eHAL_STATUS_FAILURE; |
| 13164 | } |
| 13165 | |
| 13166 | //NO need to update the Beacon Params if update beacon parameter flag is not set |
| 13167 | if(!pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval ) |
| 13168 | return eHAL_STATUS_SUCCESS; |
| 13169 | |
| 13170 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE; |
| 13171 | |
| 13172 | /* Create the message and send to lim */ |
| 13173 | len = sizeof(tSirChangeBIParams); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13174 | pMsg = vos_mem_malloc(len); |
| 13175 | if ( NULL == pMsg ) |
| 13176 | status = eHAL_STATUS_FAILURE; |
| 13177 | else |
| 13178 | status = eHAL_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13179 | if(HAL_STATUS_SUCCESS(status)) |
| 13180 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13181 | vos_mem_set(pMsg, sizeof(tSirChangeBIParams), 0); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13182 | pMsg->messageType = eWNI_SME_CHNG_MCC_BEACON_INTERVAL; |
| 13183 | pMsg->length = len; |
| 13184 | |
| 13185 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13186 | vos_mem_copy((tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, |
| 13187 | sizeof(tSirMacAddr)); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13188 | smsLog( pMac, LOG1, FL("CSR Attempting to change BI for Bssid= %02x-%02x-%02x-%02x-%02x-%02x "), |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13189 | pMsg->bssId[ 0 ], pMsg->bssId[ 1 ], pMsg->bssId[ 2 ], |
| 13190 | pMsg->bssId[ 3 ], pMsg->bssId[ 4 ], pMsg->bssId[ 5 ] ); |
| 13191 | pMsg->sessionId = sessionId; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13192 | 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] | 13193 | pMsg->beaconInterval = pMac->roam.roamSession[sessionId].bssParams.beaconInterval; |
| 13194 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 13195 | } |
| 13196 | return status; |
| 13197 | } |
| 13198 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13199 | eHalStatus csrSendMBDeauthReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirMacAddr bssId, tANI_U16 reasonCode ) |
| 13200 | { |
| 13201 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13202 | tSirSmeDeauthReq *pMsg; |
| 13203 | tANI_U8 *pBuf; |
| 13204 | tANI_U16 wTmp; |
| 13205 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13206 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 13207 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13208 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13209 | pMsg = vos_mem_malloc(sizeof( tSirSmeDeauthReq )); |
| 13210 | if ( NULL == pMsg ) |
| 13211 | status = eHAL_STATUS_FAILURE; |
| 13212 | else |
| 13213 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13214 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13215 | vos_mem_set(pMsg, sizeof( tSirSmeDeauthReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13216 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_REQ); |
| 13217 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthReq )); |
| 13218 | //sessionId |
| 13219 | pBuf = &pMsg->sessionId; |
| 13220 | *pBuf++ = (tANI_U8)sessionId; |
| 13221 | |
| 13222 | //tansactionId |
| 13223 | *pBuf = 0; |
| 13224 | *(pBuf + 1 ) = 0; |
| 13225 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13226 | if ((pSession->pCurRoamProfile != NULL) && ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13227 | (CSR_IS_INFRA_AP(pSession->pCurRoamProfile)) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13228 | (CSR_IS_WDS_AP(pSession->pCurRoamProfile)))){ |
| 13229 | // Set the BSSID before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13230 | vos_mem_copy( (tSirMacAddr *)pBuf, pSession->selfMacAddr, |
| 13231 | sizeof( pMsg->peerMacAddr ) ); |
| 13232 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13233 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 13234 | } |
| 13235 | else |
| 13236 | { |
| 13237 | // Set the BSSID before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13238 | vos_mem_copy( (tSirMacAddr *)pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 13239 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13240 | pBuf = pBuf + sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13241 | } |
| 13242 | if(!HAL_STATUS_SUCCESS(status)) |
| 13243 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13244 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13245 | break; |
| 13246 | } |
| 13247 | // Set the peer MAC address before sending the message to LIM |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13248 | vos_mem_copy( (tSirMacAddr *) pBuf, bssId, sizeof( pMsg->peerMacAddr ) ); |
| 13249 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13250 | pBuf = pBuf + sizeof(tSirMacAddr); |
| 13251 | if(!HAL_STATUS_SUCCESS(status)) |
| 13252 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13253 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13254 | break; |
| 13255 | } |
| 13256 | wTmp = pal_cpu_to_be16(reasonCode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13257 | vos_mem_copy( pBuf, &wTmp,sizeof( tANI_U16 ) ); |
| 13258 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13259 | if(!HAL_STATUS_SUCCESS(status)) |
| 13260 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13261 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13262 | break; |
| 13263 | } |
| 13264 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13265 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13266 | return( status ); |
| 13267 | } |
| 13268 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13269 | eHalStatus csrSendMBDisassocCnfMsg( tpAniSirGlobal pMac, tpSirSmeDisassocInd pDisassocInd ) |
| 13270 | { |
| 13271 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13272 | tSirSmeDisassocCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13273 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13274 | pMsg = vos_mem_malloc(sizeof( tSirSmeDisassocCnf )); |
| 13275 | if ( NULL == pMsg ) |
| 13276 | status = eHAL_STATUS_FAILURE; |
| 13277 | else |
| 13278 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13279 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13280 | vos_mem_set(pMsg, sizeof( tSirSmeDisassocCnf), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13281 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DISASSOC_CNF); |
| 13282 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13283 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDisassocCnf )); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13284 | vos_mem_copy(pMsg->peerMacAddr, pDisassocInd->peerMacAddr, |
| 13285 | sizeof(pMsg->peerMacAddr)); |
| 13286 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13287 | if(!HAL_STATUS_SUCCESS(status)) |
| 13288 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13289 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13290 | break; |
| 13291 | } |
| 13292 | //To test reconn |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13293 | vos_mem_copy(pMsg->bssId, pDisassocInd->bssId, sizeof(pMsg->peerMacAddr)); |
| 13294 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13295 | if(!HAL_STATUS_SUCCESS(status)) |
| 13296 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13297 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13298 | break; |
| 13299 | } |
| 13300 | //To test reconn ends |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13301 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13302 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13303 | return( status ); |
| 13304 | } |
| 13305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13306 | eHalStatus csrSendMBDeauthCnfMsg( tpAniSirGlobal pMac, tpSirSmeDeauthInd pDeauthInd ) |
| 13307 | { |
| 13308 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13309 | tSirSmeDeauthCnf *pMsg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13310 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13311 | pMsg = vos_mem_malloc(sizeof( tSirSmeDeauthCnf )); |
| 13312 | if ( NULL == pMsg ) |
| 13313 | status = eHAL_STATUS_FAILURE; |
| 13314 | else |
| 13315 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13316 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13317 | vos_mem_set(pMsg, sizeof( tSirSmeDeauthCnf ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13318 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEAUTH_CNF); |
| 13319 | pMsg->statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13320 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeDeauthCnf )); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13321 | vos_mem_copy(pMsg->bssId, pDeauthInd->bssId, sizeof(pMsg->bssId)); |
| 13322 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13323 | if(!HAL_STATUS_SUCCESS(status)) |
| 13324 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13325 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13326 | break; |
| 13327 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13328 | vos_mem_copy(pMsg->peerMacAddr, pDeauthInd->peerMacAddr, |
| 13329 | sizeof(pMsg->peerMacAddr)); |
| 13330 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13331 | if(!HAL_STATUS_SUCCESS(status)) |
| 13332 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13333 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13334 | break; |
| 13335 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13336 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13337 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13338 | return( status ); |
| 13339 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13340 | eHalStatus csrSendAssocCnfMsg( tpAniSirGlobal pMac, tpSirSmeAssocInd pAssocInd, eHalStatus Halstatus ) |
| 13341 | { |
| 13342 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13343 | tSirSmeAssocCnf *pMsg; |
| 13344 | tANI_U8 *pBuf; |
| 13345 | tSirResultCodes statusCode; |
| 13346 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13347 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13348 | pMsg = vos_mem_malloc(sizeof( tSirSmeAssocCnf )); |
| 13349 | if ( NULL == pMsg ) |
| 13350 | status = eHAL_STATUS_FAILURE; |
| 13351 | else |
| 13352 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13353 | if ( !HAL_STATUS_SUCCESS(status) ) break; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13354 | vos_mem_set(pMsg, sizeof( tSirSmeAssocCnf ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13355 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ASSOC_CNF); |
| 13356 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocCnf )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13357 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 13358 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 13359 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13360 | else |
| 13361 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13362 | vos_mem_copy(pBuf, &statusCode, sizeof(tSirResultCodes)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13363 | pBuf += sizeof(tSirResultCodes); |
| 13364 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13365 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 13366 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13367 | pBuf += sizeof (tSirMacAddr); |
| 13368 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13369 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, |
| 13370 | sizeof(tSirMacAddr)); |
| 13371 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13372 | pBuf += sizeof (tSirMacAddr); |
| 13373 | // aid |
| 13374 | wTmp = pal_cpu_to_be16(pAssocInd->aid); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13375 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13376 | pBuf += sizeof (tANI_U16); |
| 13377 | // alternateBssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13378 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
| 13379 | status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13380 | pBuf += sizeof (tSirMacAddr); |
| 13381 | // alternateChannelId |
| 13382 | *pBuf = 11; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13383 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13384 | if(!HAL_STATUS_SUCCESS(status)) |
| 13385 | { |
| 13386 | //pMsg is freed by palSendMBMessage |
| 13387 | break; |
| 13388 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13389 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13390 | return( status ); |
| 13391 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13392 | eHalStatus csrSendAssocIndToUpperLayerCnfMsg( tpAniSirGlobal pMac, |
| 13393 | tpSirSmeAssocInd pAssocInd, |
| 13394 | eHalStatus Halstatus, |
| 13395 | tANI_U8 sessionId) |
| 13396 | { |
| 13397 | tSirMsgQ msgQ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13398 | tSirSmeAssocIndToUpperLayerCnf *pMsg; |
| 13399 | tANI_U8 *pBuf; |
| 13400 | tSirResultCodes statusCode; |
| 13401 | tANI_U16 wTmp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13402 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13403 | pMsg = vos_mem_malloc(sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 13404 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13405 | vos_mem_set(pMsg, sizeof( tSirSmeAssocIndToUpperLayerCnf ), 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13406 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13407 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPPER_LAYER_ASSOC_CNF); |
| 13408 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeAssocIndToUpperLayerCnf )); |
| 13409 | |
| 13410 | pMsg->sessionId = sessionId; |
| 13411 | |
| 13412 | pBuf = (tANI_U8 *)&pMsg->statusCode; |
| 13413 | if(HAL_STATUS_SUCCESS(Halstatus)) |
| 13414 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_SUCCESS); |
| 13415 | else |
| 13416 | statusCode = (tSirResultCodes)pal_cpu_to_be32(eSIR_SME_ASSOC_REFUSED); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13417 | vos_mem_copy(pBuf, &statusCode, sizeof(tSirResultCodes)) ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13418 | pBuf += sizeof(tSirResultCodes); |
| 13419 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13420 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13421 | pBuf += sizeof (tSirMacAddr); |
| 13422 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13423 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->peerMacAddr, |
| 13424 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13425 | pBuf += sizeof (tSirMacAddr); |
| 13426 | // StaId |
| 13427 | wTmp = pal_cpu_to_be16(pAssocInd->staId); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13428 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13429 | pBuf += sizeof (tANI_U16); |
| 13430 | // alternateBssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13431 | vos_mem_copy((tSirMacAddr *)pBuf, pAssocInd->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13432 | pBuf += sizeof (tSirMacAddr); |
| 13433 | // alternateChannelId |
| 13434 | *pBuf = 11; |
| 13435 | pBuf += sizeof (tANI_U8); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 13436 | // Instead of copying roam Info, we just copy only WmmEnabled, RsnIE information |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13437 | //Wmm |
| 13438 | *pBuf = pAssocInd->wmmEnabledSta; |
| 13439 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13440 | //RSN IE |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13441 | vos_mem_copy((tSirRSNie *)pBuf, &pAssocInd->rsnIE, sizeof(tSirRSNie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13442 | pBuf += sizeof (tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13443 | //Additional IE |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13444 | vos_mem_copy((void *)pBuf, &pAssocInd->addIE, sizeof(tSirAddie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13445 | pBuf += sizeof (tSirAddie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13446 | //reassocReq |
| 13447 | *pBuf = pAssocInd->reassocReq; |
| 13448 | pBuf += sizeof (tANI_U8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13449 | msgQ.type = eWNI_SME_UPPER_LAYER_ASSOC_CNF; |
| 13450 | msgQ.bodyptr = pMsg; |
| 13451 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13452 | SysProcessMmhMsg(pMac, &msgQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13453 | } while( 0 ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13454 | return( eHAL_STATUS_SUCCESS ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13455 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13456 | |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 13457 | eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13458 | tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType, |
| 13459 | tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection, |
| 13460 | tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole, |
| 13461 | tANI_U8 *pKeyRsc ) |
| 13462 | { |
| 13463 | tSirSmeSetContextReq *pMsg; |
| 13464 | tANI_U16 msgLen; |
| 13465 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13466 | tAniEdType tmpEdType; |
| 13467 | tAniKeyDirection tmpDirection; |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 13468 | tANI_U8 *pBuf = NULL; |
| 13469 | tANI_U8 *p = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13470 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13471 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13472 | if( ( 1 != numKeys ) && ( 0 != numKeys ) ) break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13473 | // all of these fields appear in every SET_CONTEXT message. Below we'll add in the size for each |
| 13474 | // key set. Since we only support upto one key, we always allocate memory for 1 key |
| 13475 | msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) + |
| 13476 | sizeof( tSirMacAddr ) + 1 + sizeof(tANI_U16) + |
| 13477 | sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + |
| 13478 | ( sizeof( pMsg->keyMaterial.key ) ); |
| 13479 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13480 | pMsg = vos_mem_malloc(msgLen); |
| 13481 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13482 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13483 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_SETCONTEXT_REQ); |
| 13484 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13485 | //sessionId |
| 13486 | pBuf = &pMsg->sessionId; |
| 13487 | *pBuf = (tANI_U8)sessionId; |
| 13488 | pBuf++; |
| 13489 | // transactionId |
| 13490 | *pBuf = 0; |
| 13491 | *(pBuf + 1) = 0; |
| 13492 | pBuf += sizeof(tANI_U16); |
| 13493 | // peerMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13494 | vos_mem_copy(pBuf, (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13495 | |
| 13496 | pBuf += sizeof(tSirMacAddr); |
| 13497 | |
| 13498 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13499 | vos_mem_copy(pBuf, (tANI_U8 *)&pSession->connectedProfile.bssid, |
| 13500 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13501 | |
| 13502 | pBuf += sizeof(tSirMacAddr); |
| 13503 | |
| 13504 | p = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13505 | // Set the pMsg->keyMaterial.length field (this length is defined as all data that follows the edType field |
| 13506 | // in the tSirKeyMaterial keyMaterial; field). |
| 13507 | // |
| 13508 | // !!NOTE: This keyMaterial.length contains the length of a MAX size key, though the keyLength can be |
| 13509 | // shorter than this max size. Is LIM interpreting this ok ? |
| 13510 | 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] | 13511 | // set pMsg->keyMaterial.edType |
| 13512 | tmpEdType = (tAniEdType)pal_cpu_to_be32(edType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13513 | vos_mem_copy(p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13514 | p += sizeof( pMsg->keyMaterial.edType ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13515 | // set the pMsg->keyMaterial.numKeys field |
| 13516 | *p = numKeys; |
| 13517 | p += sizeof( pMsg->keyMaterial.numKeys ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13518 | // set pSirKey->keyId = keyId; |
| 13519 | *p = keyId; |
| 13520 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13521 | // set pSirKey->unicast = (tANI_U8)fUnicast; |
| 13522 | *p = (tANI_U8)fUnicast; |
| 13523 | p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13524 | // set pSirKey->keyDirection = aniKeyDirection; |
| 13525 | tmpDirection = (tAniKeyDirection)pal_cpu_to_be32(aniKeyDirection); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13526 | vos_mem_copy(p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13527 | p += sizeof(tAniKeyDirection); |
| 13528 | // pSirKey->keyRsc = ;; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13529 | vos_mem_copy(p, pKeyRsc, CSR_MAX_RSC_LEN); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13530 | p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13531 | // set pSirKey->paeRole |
| 13532 | *p = paeRole; // 0 is Supplicant |
| 13533 | p++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13534 | // set pSirKey->keyLength = keyLength; |
| 13535 | p = pal_set_U16( p, pal_cpu_to_be16(keyLength) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13536 | if ( keyLength && pKey ) |
| 13537 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13538 | vos_mem_copy(p, pKey, keyLength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13539 | if(keyLength == 16) |
| 13540 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13541 | 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] | 13542 | keyId, edType, pKey[0], pKey[1], pKey[2], pKey[3], pKey[4], |
| 13543 | pKey[5], pKey[6], pKey[7], pKey[8], |
| 13544 | pKey[9], pKey[10], pKey[11], pKey[12], pKey[13], pKey[14], pKey[15]); |
| 13545 | } |
| 13546 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13547 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13548 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13549 | return( status ); |
| 13550 | } |
| 13551 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13552 | eHalStatus csrSendMBStartBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrRoamBssType bssType, |
| 13553 | tCsrRoamStartBssParams *pParam, tSirBssDescription *pBssDesc ) |
| 13554 | { |
| 13555 | eHalStatus status; |
| 13556 | tSirSmeStartBssReq *pMsg; |
| 13557 | tANI_U8 *pBuf = NULL; |
| 13558 | tANI_U8 *wTmpBuf = NULL; |
| 13559 | tANI_U16 msgLen, wTmp; |
| 13560 | tANI_U32 dwTmp; |
| 13561 | tSirNwType nwType; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13562 | ePhyChanBondState cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13563 | tANI_U32 authType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13564 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13565 | |
| 13566 | if(!pSession) |
| 13567 | { |
| 13568 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13569 | return eHAL_STATUS_FAILURE; |
| 13570 | } |
| 13571 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13572 | do { |
| 13573 | pSession->joinFailStatusCode.statusCode = eSIR_SME_SUCCESS; |
| 13574 | pSession->joinFailStatusCode.reasonCode = 0; |
| 13575 | msgLen = sizeof(tSirSmeStartBssReq); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13576 | pMsg = vos_mem_malloc(msgLen); |
| 13577 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13578 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13579 | 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] | 13580 | pBuf = &pMsg->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13581 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13582 | //sessionId |
| 13583 | *pBuf = (tANI_U8)sessionId; |
| 13584 | pBuf++; |
| 13585 | // transactionId |
| 13586 | *pBuf = 0; |
| 13587 | *(pBuf + 1) = 0; |
| 13588 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13589 | // bssid |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13590 | vos_mem_copy(pBuf, pParam->bssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13591 | pBuf += sizeof(tSirMacAddr); |
| 13592 | // selfMacAddr |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13593 | vos_mem_copy(pBuf, pSession->selfMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13594 | pBuf += sizeof(tSirMacAddr); |
| 13595 | // beaconInterval |
| 13596 | if( pBssDesc && pBssDesc->beaconInterval ) |
| 13597 | { |
| 13598 | wTmp = pal_cpu_to_be16( pBssDesc->beaconInterval ); |
| 13599 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13600 | else if(pParam->beaconInterval) |
| 13601 | { |
| 13602 | wTmp = pal_cpu_to_be16( pParam->beaconInterval ); |
| 13603 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13604 | else |
| 13605 | { |
| 13606 | wTmp = pal_cpu_to_be16( WNI_CFG_BEACON_INTERVAL_STADEF ); |
| 13607 | } |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame] | 13608 | if(csrIsconcurrentsessionValid (pMac, sessionId, |
| 13609 | pParam->bssPersona) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13610 | == eHAL_STATUS_SUCCESS ) |
| 13611 | { |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 13612 | csrValidateMCCBeaconInterval(pMac, pParam->operationChn, &wTmp, sessionId, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13613 | pParam->bssPersona); |
| 13614 | //Update the beacon Interval |
| 13615 | pParam->beaconInterval = wTmp; |
| 13616 | } |
| 13617 | else |
| 13618 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13619 | smsLog( pMac,LOGE, FL("****Start BSS failed persona already exists***")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13620 | status = eHAL_STATUS_FAILURE; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13621 | vos_mem_free(pMsg); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13622 | return status; |
| 13623 | } |
| 13624 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13625 | vos_mem_copy(pBuf, &wTmp, sizeof( tANI_U16 )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13626 | pBuf += sizeof(tANI_U16); |
| 13627 | // dot11mode |
| 13628 | *pBuf = (tANI_U8)csrTranslateToWNICfgDot11Mode( pMac, pParam->uCfgDot11Mode ); |
| 13629 | pBuf += 1; |
| 13630 | // bssType |
| 13631 | dwTmp = pal_cpu_to_be32( csrTranslateBsstypeToMacType( bssType ) ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13632 | vos_mem_copy(pBuf, &dwTmp, sizeof(tSirBssType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13633 | pBuf += sizeof(tSirBssType); |
| 13634 | // ssId |
| 13635 | if( pParam->ssId.length ) |
| 13636 | { |
| 13637 | // ssId len |
| 13638 | *pBuf = pParam->ssId.length; |
| 13639 | pBuf++; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13640 | vos_mem_copy(pBuf, pParam->ssId.ssId, pParam->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13641 | pBuf += pParam->ssId.length; |
| 13642 | } |
| 13643 | else |
| 13644 | { |
| 13645 | *pBuf = 0; |
| 13646 | pBuf++; |
| 13647 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13648 | // set the channel Id |
| 13649 | *pBuf = pParam->operationChn; |
| 13650 | pBuf++; |
| 13651 | //What should we really do for the cbmode. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13652 | cbMode = (ePhyChanBondState)pal_cpu_to_be32(pParam->cbMode); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13653 | vos_mem_copy(pBuf, (tANI_U8 *)&cbMode, sizeof(ePhyChanBondState)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13654 | pBuf += sizeof(ePhyChanBondState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13655 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13656 | // Set privacy |
| 13657 | *pBuf = pParam->privacy; |
| 13658 | pBuf++; |
| 13659 | |
| 13660 | //Set Uapsd |
| 13661 | *pBuf = pParam->ApUapsdEnable; |
| 13662 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13663 | //Set SSID hidden |
| 13664 | *pBuf = pParam->ssidHidden; |
| 13665 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13666 | *pBuf = (tANI_U8)pParam->fwdWPSPBCProbeReq; |
| 13667 | pBuf++; |
| 13668 | |
| 13669 | //Ht protection Enable/Disable |
| 13670 | *pBuf = (tANI_U8)pParam->protEnabled; |
| 13671 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13672 | //Enable Beacons to Receive for OBSS protection Enable/Disable |
| 13673 | *pBuf = (tANI_U8)pParam->obssProtEnabled; |
| 13674 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13675 | //set cfg related to protection |
| 13676 | wTmp = pal_cpu_to_be16( pParam->ht_protection ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13677 | vos_mem_copy(pBuf, &wTmp, sizeof( tANI_U16 )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13678 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13679 | // Set Auth type |
| 13680 | authType = pal_cpu_to_be32(pParam->authType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13681 | vos_mem_copy(pBuf, (tANI_U8 *)&authType, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13682 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13683 | // Set DTIM |
| 13684 | dwTmp = pal_cpu_to_be32(pParam->dtimPeriod); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13685 | vos_mem_copy(pBuf, (tANI_U8 *)&dwTmp, sizeof(tANI_U32)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13686 | pBuf += sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13687 | // Set wps_state |
| 13688 | *pBuf = pParam->wps_state; |
| 13689 | pBuf++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13690 | //Persona |
| 13691 | *pBuf = (tANI_U8)pParam->bssPersona; |
| 13692 | pBuf++; |
| 13693 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 13694 | //txLdpcIniFeatureEnabled |
| 13695 | *pBuf = (tANI_U8)(tANI_U8)pMac->roam.configParam.txLdpcEnable; |
| 13696 | pBuf++; |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 13697 | |
krunal soni | 4f087d2 | 2013-07-29 16:32:26 -0700 | [diff] [blame] | 13698 | // set RSN IE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13699 | if( pParam->nRSNIELength > sizeof(pMsg->rsnIE.rsnIEdata) ) |
| 13700 | { |
| 13701 | status = eHAL_STATUS_INVALID_PARAMETER; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13702 | vos_mem_free(pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13703 | break; |
| 13704 | } |
| 13705 | wTmp = pal_cpu_to_be16( pParam->nRSNIELength ); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13706 | vos_mem_copy(pBuf, &wTmp, sizeof(tANI_U16)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13707 | pBuf += sizeof(tANI_U16); |
| 13708 | if( wTmp ) |
| 13709 | { |
| 13710 | wTmp = pParam->nRSNIELength; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13711 | vos_mem_copy(pBuf, pParam->pRSNIE, wTmp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13712 | pBuf += wTmp; |
| 13713 | } |
| 13714 | nwType = (tSirNwType)pal_cpu_to_be32(pParam->sirNwType); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13715 | vos_mem_copy(pBuf, (tANI_U8 *)&nwType, sizeof(tSirNwType)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13716 | pBuf += sizeof(tSirNwType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13717 | *pBuf = pParam->operationalRateSet.numRates; //tSirMacRateSet->numRates |
| 13718 | pBuf++; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13719 | vos_mem_copy(pBuf, pParam->operationalRateSet.rate, |
| 13720 | pParam->operationalRateSet.numRates ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13721 | pBuf += pParam->operationalRateSet.numRates ; |
| 13722 | *pBuf++ = pParam->extendedRateSet.numRates; |
| 13723 | if(0 != pParam->extendedRateSet.numRates) |
| 13724 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13725 | vos_mem_copy(pBuf, pParam->extendedRateSet.rate, |
| 13726 | pParam->extendedRateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13727 | pBuf += pParam->extendedRateSet.numRates; |
| 13728 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13729 | msgLen = (tANI_U16)(sizeof(tANI_U32 ) + (pBuf - wTmpBuf)); //msg_header + msg |
| 13730 | pMsg->length = pal_cpu_to_be16(msgLen); |
| 13731 | |
| 13732 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13733 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13734 | return( status ); |
| 13735 | } |
| 13736 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13737 | eHalStatus csrSendMBStopBssReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 13738 | { |
| 13739 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13740 | tSirSmeStopBssReq *pMsg; |
| 13741 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 13742 | tANI_U8 *pBuf; |
| 13743 | tANI_U16 msgLen; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13744 | |
| 13745 | if(!pSession) |
| 13746 | { |
| 13747 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 13748 | return eHAL_STATUS_FAILURE; |
| 13749 | } |
| 13750 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13751 | do { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13752 | pMsg = vos_mem_malloc(sizeof(tSirSmeStopBssReq)); |
| 13753 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13754 | vos_mem_set(pMsg, sizeof( tSirSmeStopBssReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13755 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 13756 | pBuf = &pMsg->sessionId; |
| 13757 | //sessionId |
| 13758 | *pBuf = (tANI_U8)sessionId; |
| 13759 | pBuf++; |
| 13760 | // transactionId |
| 13761 | *pBuf = 0; |
| 13762 | pBuf += sizeof(tANI_U16); |
| 13763 | //reason code |
| 13764 | *pBuf = 0; |
| 13765 | pBuf += sizeof(tSirResultCodes); |
| 13766 | // bssid |
| 13767 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 13768 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 13769 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13770 | vos_mem_copy(pBuf, (tANI_U8 *)&pSession->selfMacAddr, |
| 13771 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13772 | } |
| 13773 | else |
| 13774 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13775 | vos_mem_copy(pBuf, (tANI_U8 *)&pSession->connectedProfile.bssid, |
| 13776 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13777 | } |
| 13778 | pBuf += sizeof(tSirMacAddr); |
| 13779 | msgLen = sizeof(tANI_U16) + sizeof(tANI_U16) + 1 + sizeof(tANI_U16) + sizeof(tSirResultCodes) + sizeof(tSirMacAddr); |
| 13780 | pMsg->length = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13781 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13782 | #if 0 |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13783 | pMsg = vos_mem_malloc(sizeof(tSirSmeStopBssReq)); |
| 13784 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 13785 | vos_mem_set(pMsg, sizeof( tSirSmeStopBssReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13786 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_STOP_BSS_REQ); |
| 13787 | pMsg->reasonCode = 0; |
| 13788 | // bssid |
| 13789 | // if BSSType is WDS sta, use selfmacAddr as bssid, else use bssid in connectedProfile |
| 13790 | if( CSR_IS_CONN_WDS_STA(&pSession->connectedProfile) ) |
| 13791 | { |
| 13792 | pbBssid = (tANI_U8 *)&pSession->selfMacAddr; |
| 13793 | } |
| 13794 | else |
| 13795 | { |
| 13796 | pbBssid = (tANI_U8 *)&pSession->connectedProfile.bssid; |
| 13797 | } |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13798 | vos_mem_copy(&pMsg->bssId, pbBssid, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13799 | pMsg->transactionId = 0; |
| 13800 | pMsg->sessionId = (tANI_U8)sessionId; |
| 13801 | pMsg->length = pal_cpu_to_be16((tANI_U16)sizeof( tSirSmeStopBssReq )); |
| 13802 | status = palSendMBMessage( pMac->hHdd, pMsg ); |
| 13803 | #endif |
| 13804 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13805 | return( status ); |
| 13806 | } |
| 13807 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13808 | eHalStatus csrReassoc(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 13809 | tCsrRoamModifyProfileFields *pModProfileFields, |
| 13810 | tANI_U32 *pRoamId, v_BOOL_t fForce) |
| 13811 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13812 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 13813 | tANI_U32 roamId = 0; |
| 13814 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13815 | if((csrIsConnStateConnected(pMac, sessionId)) && |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13816 | (fForce || (!vos_mem_compare( &pModProfileFields, |
| 13817 | &pSession->connectedProfile.modifyProfileFields, |
| 13818 | sizeof(tCsrRoamModifyProfileFields)))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13819 | { |
| 13820 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 13821 | if(pRoamId) |
| 13822 | { |
| 13823 | *pRoamId = roamId; |
| 13824 | } |
| 13825 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13826 | status = csrRoamIssueReassoc(pMac, sessionId, NULL, pModProfileFields, |
| 13827 | eCsrSmeIssuedReassocToSameAP, roamId, |
| 13828 | eANI_BOOLEAN_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13829 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13830 | return status; |
| 13831 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13832 | static eHalStatus csrRoamSessionOpened(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 13833 | { |
| 13834 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13835 | tCsrRoamInfo roamInfo; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13836 | vos_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13837 | status = csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, |
| 13838 | eCSR_ROAM_SESSION_OPENED, eCSR_ROAM_RESULT_NONE); |
| 13839 | return (status); |
| 13840 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13841 | eHalStatus csrProcessAddStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 13842 | { |
| 13843 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13844 | tListElem *pEntry = NULL; |
| 13845 | tSmeCmd *pCommand = NULL; |
| 13846 | tSirSmeAddStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13847 | do |
| 13848 | { |
| 13849 | if(pMsg == NULL) |
| 13850 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13851 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13852 | status = eHAL_STATUS_FAILURE; |
| 13853 | break; |
| 13854 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13855 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 13856 | if(pEntry) |
| 13857 | { |
| 13858 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 13859 | if(eSmeCommandAddStaSession == pCommand->command) |
| 13860 | { |
| 13861 | pRsp = (tSirSmeAddStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13862 | smsLog( pMac, LOG1, "Add Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13863 | //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] | 13864 | csrRoamSessionOpened(pMac, pCommand->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13865 | //Remove this command out of the active list |
| 13866 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 13867 | { |
| 13868 | //Now put this command back on the avilable command list |
| 13869 | csrReleaseCommand(pMac, pCommand); |
| 13870 | } |
| 13871 | smeProcessPendingQueue( pMac ); |
| 13872 | } |
| 13873 | else |
| 13874 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13875 | 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] | 13876 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13877 | status = eHAL_STATUS_FAILURE; |
| 13878 | break; |
| 13879 | } |
| 13880 | } |
| 13881 | else |
| 13882 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13883 | 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] | 13884 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13885 | status = eHAL_STATUS_FAILURE; |
| 13886 | break; |
| 13887 | } |
| 13888 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13889 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13890 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13891 | eHalStatus csrSendMBAddSelfStaReqMsg(tpAniSirGlobal pMac, |
| 13892 | tAddStaForSessionCmd *pAddStaReq) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13893 | { |
| 13894 | tSirSmeAddStaSelfReq *pMsg; |
| 13895 | tANI_U16 msgLen; |
| 13896 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13897 | do { |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13898 | msgLen = sizeof(tSirSmeAddStaSelfReq); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13899 | pMsg = vos_mem_malloc(msgLen); |
| 13900 | if ( NULL == pMsg ) break; |
| 13901 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13902 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_ADD_STA_SELF_REQ); |
| 13903 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13904 | // self station address |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13905 | vos_mem_copy((tANI_U8 *)pMsg->selfMacAddr, |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13906 | (tANI_U8 *)&pAddStaReq->selfMacAddr, sizeof(tSirMacAddr)); |
| 13907 | |
| 13908 | pMsg->currDeviceMode = pAddStaReq->currDeviceMode; |
| 13909 | |
| 13910 | smsLog( pMac, LOG1, FL("selfMac=%02x, %02x, %02x, %02x, %02x, %02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13911 | pMsg->selfMacAddr[0], |
| 13912 | pMsg->selfMacAddr[1], |
| 13913 | pMsg->selfMacAddr[2], |
| 13914 | pMsg->selfMacAddr[3], |
| 13915 | pMsg->selfMacAddr[4], |
| 13916 | pMsg->selfMacAddr[5]); |
| 13917 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13918 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13919 | return( status ); |
| 13920 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13921 | eHalStatus csrIssueAddStaForSessionReq(tpAniSirGlobal pMac, |
| 13922 | tANI_U32 sessionId, |
| 13923 | tSirMacAddr sessionMacAddr) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13924 | { |
| 13925 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13926 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13927 | pCommand = csrGetCommandBuffer(pMac); |
| 13928 | if(NULL == pCommand) |
| 13929 | { |
| 13930 | status = eHAL_STATUS_RESOURCES; |
| 13931 | } |
| 13932 | else |
| 13933 | { |
| 13934 | pCommand->command = eSmeCommandAddStaSession; |
| 13935 | pCommand->sessionId = (tANI_U8)sessionId; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13936 | vos_mem_copy(pCommand->u.addStaSessionCmd.selfMacAddr, sessionMacAddr, |
| 13937 | sizeof( tSirMacAddr ) ); |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13938 | pCommand->u.addStaSessionCmd.currDeviceMode = pMac->sme.currDeviceMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13939 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 13940 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 13941 | { |
| 13942 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13943 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13944 | } |
| 13945 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13946 | return (status); |
| 13947 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13948 | eHalStatus csrProcessAddStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 13949 | { |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13950 | return csrSendMBAddSelfStaReqMsg(pMac, &pCommand->u.addStaSessionCmd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13951 | } |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13952 | eHalStatus csrRoamOpenSession(tpAniSirGlobal pMac, |
| 13953 | csrRoamCompleteCallback callback, |
| 13954 | void *pContext, tANI_U8 *pSelfMacAddr, |
| 13955 | tANI_U8 *pbSessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13956 | { |
| 13957 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 13958 | tANI_U32 i; |
| 13959 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13960 | *pbSessionId = CSR_SESSION_ID_INVALID; |
| 13961 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 13962 | { |
| 13963 | if( !CSR_IS_SESSION_VALID( pMac, i ) ) |
| 13964 | { |
| 13965 | pSession = CSR_GET_SESSION( pMac, i ); |
| 13966 | status = eHAL_STATUS_SUCCESS; |
| 13967 | pSession->sessionActive = eANI_BOOLEAN_TRUE; |
| 13968 | pSession->sessionId = (tANI_U8)i; |
| 13969 | pSession->callback = callback; |
| 13970 | pSession->pContext = pContext; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 13971 | vos_mem_copy(&pSession->selfMacAddr, pSelfMacAddr, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13972 | *pbSessionId = (tANI_U8)i; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 13973 | status = vos_timer_init(&pSession->hTimerRoaming, VOS_TIMER_TYPE_SW, |
| 13974 | csrRoamRoamingTimerHandler, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13975 | &pSession->roamingTimerInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 13976 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13977 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13978 | smsLog(pMac, LOGE, FL("cannot allocate memory for Roaming timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13979 | break; |
| 13980 | } |
| 13981 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 13982 | status = vos_timer_init(&pSession->hTimerJoinRetry, VOS_TIMER_TYPE_SW, |
| 13983 | csrRoamJoinRetryTimerHandler, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13984 | &pSession->joinRetryTimerInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 13985 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13986 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 13987 | smsLog(pMac, LOGE, FL("cannot allocate memory for joinretry timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13988 | break; |
| 13989 | } |
| 13990 | #endif |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 13991 | status = csrIssueAddStaForSessionReq (pMac, i, pSelfMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13992 | break; |
| 13993 | } |
| 13994 | } |
| 13995 | if( CSR_ROAM_SESSION_MAX == i ) |
| 13996 | { |
| 13997 | //No session is available |
| 13998 | status = eHAL_STATUS_RESOURCES; |
| 13999 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14000 | return ( status ); |
| 14001 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14002 | eHalStatus csrProcessDelStaSessionRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg) |
| 14003 | { |
| 14004 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14005 | tListElem *pEntry = NULL; |
| 14006 | tSmeCmd *pCommand = NULL; |
| 14007 | tSirSmeDelStaSelfRsp *pRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14008 | do |
| 14009 | { |
| 14010 | if(pMsg == NULL) |
| 14011 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14012 | smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14013 | status = eHAL_STATUS_FAILURE; |
| 14014 | break; |
| 14015 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14016 | pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); |
| 14017 | if(pEntry) |
| 14018 | { |
| 14019 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14020 | if(eSmeCommandDelStaSession == pCommand->command) |
| 14021 | { |
| 14022 | tANI_U8 sessionId = pCommand->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14023 | pRsp = (tSirSmeDelStaSelfRsp*)pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14024 | smsLog( pMac, LOG1, "Del Sta rsp status = %d", pRsp->status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14025 | //This session is done. |
| 14026 | csrCleanupSession(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14027 | if(pCommand->u.delStaSessionCmd.callback) |
| 14028 | { |
| 14029 | |
| 14030 | status = sme_ReleaseGlobalLock( &pMac->sme ); |
| 14031 | if ( HAL_STATUS_SUCCESS( status ) ) |
| 14032 | { |
| 14033 | pCommand->u.delStaSessionCmd.callback( |
| 14034 | pCommand->u.delStaSessionCmd.pContext); |
| 14035 | status = sme_AcquireGlobalLock( &pMac->sme ); |
| 14036 | if (! HAL_STATUS_SUCCESS( status ) ) |
| 14037 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14038 | smsLog(pMac, LOGP, "%s: Failed to Acquire Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14039 | return status; |
| 14040 | } |
| 14041 | } |
| 14042 | else { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14043 | smsLog(pMac, LOGE, "%s: Failed to Release Lock", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14044 | } |
| 14045 | } |
| 14046 | |
| 14047 | //Remove this command out of the active list |
| 14048 | if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList, pEntry, LL_ACCESS_LOCK)) |
| 14049 | { |
| 14050 | //Now put this command back on the avilable command list |
| 14051 | csrReleaseCommand(pMac, pCommand); |
| 14052 | } |
| 14053 | smeProcessPendingQueue( pMac ); |
| 14054 | } |
| 14055 | else |
| 14056 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14057 | 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] | 14058 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14059 | status = eHAL_STATUS_FAILURE; |
| 14060 | break; |
| 14061 | } |
| 14062 | } |
| 14063 | else |
| 14064 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14065 | 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] | 14066 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14067 | status = eHAL_STATUS_FAILURE; |
| 14068 | break; |
| 14069 | } |
| 14070 | } while(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14071 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14072 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14073 | eHalStatus csrSendMBDelSelfStaReqMsg( tpAniSirGlobal pMac, tSirMacAddr macAddr ) |
| 14074 | { |
| 14075 | tSirSmeDelStaSelfReq *pMsg; |
| 14076 | tANI_U16 msgLen; |
| 14077 | eHalStatus status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14078 | do { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14079 | msgLen = sizeof( tANI_U16 ) + sizeof( tANI_U16 ) + sizeof( tSirMacAddr ) /*+ |
| 14080 | sizeof( tSirBssType )*/; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14081 | pMsg = vos_mem_malloc(msgLen); |
| 14082 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 14083 | vos_mem_set(pMsg, msgLen, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14084 | pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_STA_SELF_REQ); |
| 14085 | pMsg->mesgLen = pal_cpu_to_be16(msgLen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14086 | // self station address |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14087 | vos_mem_copy((tANI_U8 *)pMsg->selfMacAddr, (tANI_U8 *)macAddr, |
| 14088 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14089 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14090 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14091 | return( status ); |
| 14092 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14093 | eHalStatus csrIssueDelStaForSessionReq(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 14094 | tSirMacAddr sessionMacAddr, |
| 14095 | csrRoamSessionCloseCallback callback, |
| 14096 | void *pContext) |
| 14097 | { |
| 14098 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14099 | tSmeCmd *pCommand; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14100 | pCommand = csrGetCommandBuffer(pMac); |
| 14101 | if(NULL == pCommand) |
| 14102 | { |
| 14103 | status = eHAL_STATUS_RESOURCES; |
| 14104 | } |
| 14105 | else |
| 14106 | { |
| 14107 | pCommand->command = eSmeCommandDelStaSession; |
| 14108 | pCommand->sessionId = (tANI_U8)sessionId; |
| 14109 | pCommand->u.delStaSessionCmd.callback = callback; |
| 14110 | pCommand->u.delStaSessionCmd.pContext = pContext; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14111 | vos_mem_copy(pCommand->u.delStaSessionCmd.selfMacAddr, sessionMacAddr, |
| 14112 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14113 | status = csrQueueSmeCommand(pMac, pCommand, TRUE); |
| 14114 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 14115 | { |
| 14116 | //Should be panic?? |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14117 | smsLog( pMac, LOGE, FL(" fail to send message status = %d"), status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14118 | } |
| 14119 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14120 | return (status); |
| 14121 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14122 | eHalStatus csrProcessDelStaSessionCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 14123 | { |
| 14124 | return csrSendMBDelSelfStaReqMsg( pMac, |
| 14125 | pCommand->u.delStaSessionCmd.selfMacAddr ); |
| 14126 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14127 | static void purgeCsrSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14128 | { |
| 14129 | tDblLinkList *pList = &pMac->roam.roamCmdPendingList; |
| 14130 | tListElem *pEntry, *pNext; |
| 14131 | tSmeCmd *pCommand; |
| 14132 | tDblLinkList localList; |
| 14133 | |
| 14134 | vos_mem_zero(&localList, sizeof(tDblLinkList)); |
| 14135 | if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList))) |
| 14136 | { |
| 14137 | smsLog(pMac, LOGE, FL(" failed to open list")); |
| 14138 | return; |
| 14139 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14140 | csrLLLock(pList); |
| 14141 | pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK); |
| 14142 | while(pEntry != NULL) |
| 14143 | { |
| 14144 | pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK); |
| 14145 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14146 | if(pCommand->sessionId == sessionId) |
| 14147 | { |
| 14148 | if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK)) |
| 14149 | { |
| 14150 | csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK); |
| 14151 | } |
| 14152 | } |
| 14153 | pEntry = pNext; |
| 14154 | } |
| 14155 | csrLLUnlock(pList); |
| 14156 | |
| 14157 | while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) ) |
| 14158 | { |
| 14159 | pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); |
| 14160 | csrAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE); |
| 14161 | } |
| 14162 | csrLLClose(&localList); |
| 14163 | } |
| 14164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14165 | void csrCleanupSession(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14166 | { |
| 14167 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 14168 | { |
| 14169 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14170 | csrRoamStop(pMac, sessionId); |
| 14171 | csrFreeConnectBssDesc(pMac, sessionId); |
| 14172 | csrRoamFreeConnectProfile( pMac, &pSession->connectedProfile ); |
| 14173 | csrRoamFreeConnectedInfo ( pMac, &pSession->connectedInfo); |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14174 | vos_timer_destroy(&pSession->hTimerRoaming); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14175 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14176 | vos_timer_destroy(&pSession->hTimerJoinRetry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14177 | #endif |
Madan Mohan Koyyalamudi | 2125599 | 2013-08-01 18:00:25 +0530 | [diff] [blame] | 14178 | purgeSmeSessionCmdList(pMac, sessionId, &pMac->sme.smeCmdPendingList); |
| 14179 | if (pMac->fScanOffload) |
| 14180 | { |
| 14181 | purgeSmeSessionCmdList(pMac, sessionId, |
| 14182 | &pMac->sme.smeScanCmdPendingList); |
| 14183 | } |
| 14184 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14185 | purgeCsrSessionCmdList(pMac, sessionId); |
| 14186 | csrInitSession(pMac, sessionId); |
| 14187 | } |
| 14188 | } |
| 14189 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14190 | eHalStatus csrRoamCloseSession( tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 14191 | tANI_BOOLEAN fSync, |
| 14192 | csrRoamSessionCloseCallback callback, |
| 14193 | void *pContext ) |
| 14194 | { |
| 14195 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14196 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 14197 | { |
| 14198 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 14199 | if(fSync) |
| 14200 | { |
| 14201 | csrCleanupSession(pMac, sessionId); |
| 14202 | } |
| 14203 | else |
| 14204 | { |
Madan Mohan Koyyalamudi | 2125599 | 2013-08-01 18:00:25 +0530 | [diff] [blame] | 14205 | purgeSmeSessionCmdList(pMac, sessionId, |
| 14206 | &pMac->sme.smeCmdPendingList); |
| 14207 | if (pMac->fScanOffload) |
| 14208 | { |
| 14209 | purgeSmeSessionCmdList(pMac, sessionId, |
| 14210 | &pMac->sme.smeScanCmdPendingList); |
| 14211 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14212 | purgeCsrSessionCmdList(pMac, sessionId); |
| 14213 | status = csrIssueDelStaForSessionReq( pMac, sessionId, |
| 14214 | pSession->selfMacAddr, callback, pContext); |
| 14215 | } |
| 14216 | } |
| 14217 | else |
| 14218 | { |
| 14219 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 14220 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14221 | return ( status ); |
| 14222 | } |
| 14223 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14224 | static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 14225 | { |
| 14226 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 14227 | |
| 14228 | if(!pSession) |
| 14229 | { |
| 14230 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 14231 | return; |
| 14232 | } |
| 14233 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14234 | pSession->sessionActive = eANI_BOOLEAN_FALSE; |
| 14235 | pSession->sessionId = CSR_SESSION_ID_INVALID; |
| 14236 | pSession->callback = NULL; |
| 14237 | pSession->pContext = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14238 | pSession->connectState = eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; |
| 14239 | // TODO : Confirm pMac->roam.fReadyForPowerSave = eANI_BOOLEAN_FALSE; |
| 14240 | csrFreeRoamProfile( pMac, sessionId ); |
| 14241 | csrRoamFreeConnectProfile(pMac, &pSession->connectedProfile); |
| 14242 | csrRoamFreeConnectedInfo( pMac, &pSession->connectedInfo ); |
| 14243 | csrFreeConnectBssDesc(pMac, sessionId); |
| 14244 | csrScanEnable(pMac); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14245 | vos_mem_set(&pSession->selfMacAddr, sizeof(tCsrBssid), 0); |
| 14246 | if (pSession->pWpaRsnReqIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14247 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14248 | vos_mem_free(pSession->pWpaRsnReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14249 | pSession->pWpaRsnReqIE = NULL; |
| 14250 | } |
| 14251 | pSession->nWpaRsnReqIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14252 | if (pSession->pWpaRsnRspIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14253 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14254 | vos_mem_free(pSession->pWpaRsnRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14255 | pSession->pWpaRsnRspIE = NULL; |
| 14256 | } |
| 14257 | pSession->nWpaRsnRspIeLength = 0; |
| 14258 | #ifdef FEATURE_WLAN_WAPI |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14259 | if (pSession->pWapiReqIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14260 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14261 | vos_mem_free(pSession->pWapiReqIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14262 | pSession->pWapiReqIE = NULL; |
| 14263 | } |
| 14264 | pSession->nWapiReqIeLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14265 | if (pSession->pWapiRspIE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14266 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14267 | vos_mem_free(pSession->pWapiRspIE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14268 | pSession->pWapiRspIE = NULL; |
| 14269 | } |
| 14270 | pSession->nWapiRspIeLength = 0; |
| 14271 | #endif /* FEATURE_WLAN_WAPI */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14272 | if (pSession->pAddIEScan) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14273 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14274 | vos_mem_free(pSession->pAddIEScan); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14275 | pSession->pAddIEScan = NULL; |
| 14276 | } |
| 14277 | pSession->nAddIEScanLength = 0; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14278 | if (pSession->pAddIEAssoc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14279 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14280 | vos_mem_free(pSession->pAddIEAssoc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14281 | pSession->pAddIEAssoc = NULL; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14282 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14283 | pSession->nAddIEAssocLength = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14284 | } |
| 14285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14286 | eHalStatus csrRoamGetSessionIdFromBSSID( tpAniSirGlobal pMac, tCsrBssid *bssid, tANI_U32 *pSessionId ) |
| 14287 | { |
| 14288 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14289 | tANI_U32 i; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14290 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 14291 | { |
| 14292 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 14293 | { |
| 14294 | if( csrIsMacAddressEqual( pMac, bssid, &pMac->roam.roamSession[i].connectedProfile.bssid ) ) |
| 14295 | { |
| 14296 | //Found it |
| 14297 | status = eHAL_STATUS_SUCCESS; |
| 14298 | *pSessionId = i; |
| 14299 | break; |
| 14300 | } |
| 14301 | } |
| 14302 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14303 | return( status ); |
| 14304 | } |
| 14305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14306 | //This function assumes that we only support one IBSS session. We cannot use BSSID to identify |
| 14307 | //session because for IBSS, the bssid changes. |
| 14308 | static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac ) |
| 14309 | { |
| 14310 | tANI_U32 i, nRet = CSR_SESSION_ID_INVALID; |
| 14311 | tCsrRoamSession *pSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14312 | for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ ) |
| 14313 | { |
| 14314 | if( CSR_IS_SESSION_VALID( pMac, i ) ) |
| 14315 | { |
| 14316 | pSession = CSR_GET_SESSION( pMac, i ); |
| 14317 | if( pSession->pCurRoamProfile && ( csrIsBssTypeIBSS( pSession->connectedProfile.BSSType ) ) ) |
| 14318 | { |
| 14319 | //Found it |
| 14320 | nRet = i; |
| 14321 | break; |
| 14322 | } |
| 14323 | } |
| 14324 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14325 | return (nRet); |
| 14326 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14327 | static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid) |
| 14328 | { |
| 14329 | /* Update the current BSS info in ho control block based on connected |
| 14330 | profile info from pmac global structure */ |
| 14331 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14332 | smsLog(pMac, LOGW, " csrRoamLinkUp: WLAN link UP with AP= %02x-%02x-%02x-%02x-%02x-%02x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14333 | bssid[ 0 ], bssid[ 1 ], bssid[ 2 ], |
| 14334 | bssid[ 3 ], bssid[ 4 ], bssid[ 5 ] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14335 | /* Check for user misconfig of RSSI trigger threshold */ |
| 14336 | pMac->roam.configParam.vccRssiThreshold = |
| 14337 | ( 0 == pMac->roam.configParam.vccRssiThreshold ) ? |
| 14338 | CSR_VCC_RSSI_THRESHOLD : pMac->roam.configParam.vccRssiThreshold; |
| 14339 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14340 | /* Check for user misconfig of UL MAC Loss trigger threshold */ |
| 14341 | pMac->roam.configParam.vccUlMacLossThreshold = |
| 14342 | ( 0 == pMac->roam.configParam.vccUlMacLossThreshold ) ? |
| 14343 | CSR_VCC_UL_MAC_LOSS_THRESHOLD : pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14344 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 14345 | { |
| 14346 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14347 | /* Indicate the neighbor roal algorithm about the connect indication */ |
| 14348 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssid, &sessionId); |
| 14349 | csrNeighborRoamIndicateConnect(pMac, sessionId, VOS_STATUS_SUCCESS); |
| 14350 | } |
| 14351 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14352 | } |
| 14353 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14354 | static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 14355 | { |
| 14356 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 14357 | |
| 14358 | if(!pSession) |
| 14359 | { |
| 14360 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 14361 | return; |
| 14362 | } |
| 14363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14364 | //Only to handle the case for Handover on infra link |
| 14365 | if( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 14366 | { |
| 14367 | return; |
| 14368 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14369 | /* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/ |
| 14370 | csrRoamDeregStatisticsReq(pMac); |
| 14371 | pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 14372 | #if defined WLAN_FEATURE_NEIGHBOR_ROAMING |
| 14373 | /* Indicate the neighbor roal algorithm about the disconnect indication */ |
| 14374 | csrNeighborRoamIndicateDisconnect(pMac, sessionId); |
| 14375 | #endif |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 14376 | |
| 14377 | //Remove this code once SLM_Sessionization is supported |
| 14378 | //BMPS_WORKAROUND_NOT_NEEDED |
| 14379 | if(!IS_FEATURE_SUPPORTED_BY_FW(SLM_SESSIONIZATION) && |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 14380 | csrIsInfraApStarted( pMac ) && |
| 14381 | pMac->roam.configParam.doBMPSWorkaround) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14382 | { |
| 14383 | pMac->roam.configParam.doBMPSWorkaround = 0; |
| 14384 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14385 | } |
| 14386 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14387 | void csrRoamTlStatsTimerHandler(void *pv) |
| 14388 | { |
| 14389 | tpAniSirGlobal pMac = PMAC_STRUCT( pv ); |
| 14390 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14391 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 14392 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14393 | smsLog(pMac, LOG1, FL(" TL stat timer is no-op. It needs to support multiple stations")); |
| 14394 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14395 | #if 0 |
| 14396 | // TODO Persession .??? |
| 14397 | //req TL for stats |
| 14398 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, &tlStats, pMac->roam.connectedInfo.staId)) |
| 14399 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14400 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:couldn't get the stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14401 | } |
| 14402 | else |
| 14403 | { |
| 14404 | //save in SME |
| 14405 | csrRoamSaveStatsFromTl(pMac, tlStats); |
| 14406 | } |
| 14407 | #endif |
| 14408 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 14409 | { |
| 14410 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 14411 | { |
| 14412 | //start timer |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14413 | status = vos_timer_start(&pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 14414 | pMac->roam.tlStatsReqInfo.periodicity); |
| 14415 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14416 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14417 | smsLog(pMac, LOGE, FL("csrRoamTlStatsTimerHandler:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14418 | return; |
| 14419 | } |
| 14420 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 14421 | } |
| 14422 | } |
| 14423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14424 | void csrRoamPeStatsTimerHandler(void *pv) |
| 14425 | { |
| 14426 | tCsrPeStatsReqInfo *pPeStatsReqListEntry = (tCsrPeStatsReqInfo *)pv; |
| 14427 | eHalStatus status; |
| 14428 | tpAniSirGlobal pMac = pPeStatsReqListEntry->pMac; |
| 14429 | VOS_STATUS vosStatus; |
| 14430 | tPmcPowerState powerState; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14431 | pPeStatsReqListEntry->timerRunning = FALSE; |
| 14432 | if( pPeStatsReqListEntry->timerStopFailed == TRUE ) |
| 14433 | { |
| 14434 | // If we entered here, meaning the timer could not be successfully |
| 14435 | // stopped in csrRoamRemoveEntryFromPeStatsReqList(). So do it here. |
| 14436 | |
| 14437 | /* Destroy the timer */ |
| 14438 | vosStatus = vos_timer_destroy( &pPeStatsReqListEntry->hPeStatsTimer ); |
| 14439 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14440 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14441 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14442 | } |
| 14443 | |
| 14444 | // Free the entry |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 14445 | vos_mem_free(pPeStatsReqListEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14446 | pPeStatsReqListEntry = NULL; |
| 14447 | } |
| 14448 | else |
| 14449 | { |
| 14450 | if(!pPeStatsReqListEntry->rspPending) |
| 14451 | { |
| 14452 | status = csrSendMBStatsReqMsg(pMac, pPeStatsReqListEntry->statsMask & ~(1 << eCsrGlobalClassDStats), |
| 14453 | pPeStatsReqListEntry->staId); |
| 14454 | if(!HAL_STATUS_SUCCESS(status)) |
| 14455 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14456 | 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] | 14457 | } |
| 14458 | else |
| 14459 | { |
| 14460 | pPeStatsReqListEntry->rspPending = TRUE; |
| 14461 | } |
| 14462 | } |
| 14463 | |
| 14464 | //send down a req |
| 14465 | if(pPeStatsReqListEntry->periodicity && |
| 14466 | (VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pPeStatsReqListEntry->hPeStatsTimer))) |
| 14467 | { |
| 14468 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 14469 | if(ePMC_FULL_POWER == powerState) |
| 14470 | { |
| 14471 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 14472 | { |
| 14473 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 14474 | } |
| 14475 | } |
| 14476 | else |
| 14477 | { |
| 14478 | if(pPeStatsReqListEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 14479 | { |
| 14480 | pPeStatsReqListEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 14481 | } |
| 14482 | } |
| 14483 | //start timer |
| 14484 | vosStatus = vos_timer_start( &pPeStatsReqListEntry->hPeStatsTimer, pPeStatsReqListEntry->periodicity ); |
| 14485 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14486 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14487 | smsLog(pMac, LOGE, FL("csrRoamPeStatsTimerHandler:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14488 | return; |
| 14489 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14490 | pPeStatsReqListEntry->timerRunning = TRUE; |
| 14491 | |
| 14492 | } |
| 14493 | |
| 14494 | } |
| 14495 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14496 | void csrRoamStatsClientTimerHandler(void *pv) |
| 14497 | { |
| 14498 | tCsrStatsClientReqInfo *pStaEntry = (tCsrStatsClientReqInfo *)pv; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14499 | if(VOS_TIMER_STATE_STOPPED == vos_timer_getCurrentState(&pStaEntry->timer)) |
| 14500 | { |
| 14501 | #if 0 |
| 14502 | // TODO Stats fix for multisession |
| 14503 | //start the timer |
| 14504 | vosStatus = vos_timer_start( &pStaEntry->timer, pStaEntry->periodicity ); |
| 14505 | |
| 14506 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 14507 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14508 | smsLog(pStaEntry->pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14509 | } |
| 14510 | #endif |
| 14511 | } |
| 14512 | #if 0 |
| 14513 | //send up the stats report |
| 14514 | csrRoamReportStatistics(pStaEntry->pMac, pStaEntry->statsMask, pStaEntry->callback, |
| 14515 | pStaEntry->staId, pStaEntry->pContext); |
| 14516 | #endif |
| 14517 | } |
| 14518 | |
| 14519 | |
| 14520 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14521 | eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask, tANI_U8 staId) |
| 14522 | { |
| 14523 | tAniGetPEStatsReq *pMsg; |
| 14524 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14525 | pMsg = vos_mem_malloc(sizeof(tAniGetPEStatsReq)); |
| 14526 | if ( NULL == pMsg ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14527 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14528 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to allocate mem for stats req "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14529 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14530 | } |
| 14531 | // need to initiate a stats request to PE |
| 14532 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_STATISTICS_REQ); |
| 14533 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetPEStatsReq); |
| 14534 | pMsg->staId = staId; |
| 14535 | pMsg->statsMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14536 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14537 | if(!HAL_STATUS_SUCCESS(status)) |
| 14538 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14539 | smsLog(pMac, LOG1, " csrSendMBStatsReqMsg: failed to send down the stats req "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14540 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14541 | return status; |
| 14542 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14543 | void csrRoamStatsRspProcessor(tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg) |
| 14544 | { |
| 14545 | tAniGetPEStatsRsp *pSmeStatsRsp; |
| 14546 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 14547 | tListElem *pEntry = NULL; |
| 14548 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 14549 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 14550 | tANI_U32 tempMask = 0; |
| 14551 | tANI_U8 counter = 0; |
| 14552 | tANI_U8 *pStats = NULL; |
| 14553 | tANI_U32 length = 0; |
| 14554 | v_PVOID_t pvosGCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14555 | v_S7_t rssi = 0, snr = 0; |
| 14556 | tANI_U32 *pRssi = NULL, *pSnr = NULL; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14557 | tANI_U32 linkCapacity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14558 | pSmeStatsRsp = (tAniGetPEStatsRsp *)pSirMsg; |
| 14559 | if(pSmeStatsRsp->rc) |
| 14560 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14561 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:stats rsp from PE shows failure")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14562 | goto post_update; |
| 14563 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14564 | tempMask = pSmeStatsRsp->statsMask; |
| 14565 | pStats = ((tANI_U8 *)&pSmeStatsRsp->statsMask) + sizeof(pSmeStatsRsp->statsMask); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14566 | /* subtract all statistics from this length, and after processing the entire |
| 14567 | * 'stat' part of the message, if the length is not zero, then rssi is piggy packed |
| 14568 | * in this 'stats' message. |
| 14569 | */ |
| 14570 | length = pSmeStatsRsp->msgLen - sizeof(tAniGetPEStatsRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14571 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 14572 | while(tempMask) |
| 14573 | { |
| 14574 | if(tempMask & 1) |
| 14575 | { |
| 14576 | switch(counter) |
| 14577 | { |
| 14578 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14579 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:summary stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14580 | vos_mem_copy((tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 14581 | pStats, sizeof(tCsrSummaryStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14582 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 14583 | length -= sizeof(tCsrSummaryStatsInfo); |
| 14584 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14585 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14586 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassA stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14587 | vos_mem_copy((tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 14588 | pStats, sizeof(tCsrGlobalClassAStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14589 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
| 14590 | length -= sizeof(tCsrGlobalClassAStatsInfo); |
| 14591 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14592 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14593 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassB stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14594 | vos_mem_copy((tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 14595 | pStats, sizeof(tCsrGlobalClassBStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14596 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
| 14597 | length -= sizeof(tCsrGlobalClassBStatsInfo); |
| 14598 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14599 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14600 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:ClassC stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14601 | vos_mem_copy((tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 14602 | pStats, sizeof(tCsrGlobalClassCStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14603 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
| 14604 | length -= sizeof(tCsrGlobalClassCStatsInfo); |
| 14605 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14606 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14607 | smsLog( pMac, LOG2, FL("csrRoamStatsRspProcessor:PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14608 | if( CSR_MAX_STA > pSmeStatsRsp->staId ) |
| 14609 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14610 | vos_mem_copy((tANI_U8 *)&pMac->roam.perStaStatsInfo[pSmeStatsRsp->staId], |
| 14611 | pStats, sizeof(tCsrPerStaStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14612 | } |
| 14613 | else |
| 14614 | { |
| 14615 | status = eHAL_STATUS_FAILURE; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14616 | smsLog( pMac, LOGE, FL("csrRoamStatsRspProcessor:out bound staId:%d"), pSmeStatsRsp->staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14617 | VOS_ASSERT( 0 ); |
| 14618 | } |
| 14619 | if(!HAL_STATUS_SUCCESS(status)) |
| 14620 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14621 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:failed to copy PerSta stats")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14622 | } |
| 14623 | pStats += sizeof(tCsrPerStaStatsInfo); |
| 14624 | length -= sizeof(tCsrPerStaStatsInfo); |
| 14625 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14626 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14627 | smsLog( pMac, LOGW, FL("csrRoamStatsRspProcessor:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14628 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14629 | } |
| 14630 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14631 | tempMask >>=1; |
| 14632 | counter++; |
| 14633 | } |
| 14634 | pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SME, pMac); |
| 14635 | if (length != 0) |
| 14636 | { |
| 14637 | pRssi = (tANI_U32*)pStats; |
| 14638 | rssi = (v_S7_t)*pRssi; |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14639 | pStats += sizeof(tANI_U32); |
| 14640 | length -= sizeof(tANI_U32); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14641 | } |
| 14642 | else |
| 14643 | { |
| 14644 | /* If riva is not sending rssi, continue to use the hack */ |
| 14645 | rssi = RSSI_HACK_BMPS; |
| 14646 | } |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14648 | WDA_UpdateRssiBmps(pvosGCtx, pSmeStatsRsp->staId, rssi); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14649 | |
| 14650 | if (length != 0) |
| 14651 | { |
| 14652 | linkCapacity = *(tANI_U32*)pStats; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14653 | pStats += sizeof(tANI_U32); |
| 14654 | length -= sizeof(tANI_U32); |
Gopichand Nakkala | 8a2b144 | 2013-05-29 15:33:14 +0530 | [diff] [blame] | 14655 | } |
| 14656 | else |
| 14657 | { |
| 14658 | linkCapacity = 0; |
| 14659 | } |
| 14660 | |
| 14661 | WDA_UpdateLinkCapacity(pvosGCtx, pSmeStatsRsp->staId, linkCapacity); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14662 | |
| 14663 | if (length != 0) |
| 14664 | { |
| 14665 | pSnr = (tANI_U32*)pStats; |
| 14666 | snr = (v_S7_t)*pSnr; |
| 14667 | } |
| 14668 | else |
| 14669 | { |
| 14670 | snr = SNR_HACK_BMPS; |
| 14671 | } |
| 14672 | |
| 14673 | WDA_UpdateSnrBmps(pvosGCtx, pSmeStatsRsp->staId, snr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14674 | post_update: |
| 14675 | //make sure to update the pe stats req list |
| 14676 | pEntry = csrRoamFindInPeStatsReqList(pMac, pSmeStatsRsp->statsMask); |
| 14677 | if(pEntry) |
| 14678 | { |
| 14679 | pPeStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
| 14680 | pPeStaEntry->rspPending = FALSE; |
| 14681 | |
| 14682 | } |
| 14683 | //check the one timer cases |
| 14684 | pEntry = csrRoamCheckClientReqList(pMac, pSmeStatsRsp->statsMask); |
| 14685 | if(pEntry) |
| 14686 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14687 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14688 | if(pTempStaEntry->timerExpired) |
| 14689 | { |
| 14690 | //send up the stats report |
| 14691 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 14692 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 14693 | //also remove from the client list |
| 14694 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 14695 | pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14696 | } |
| 14697 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14698 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14699 | tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 14700 | { |
| 14701 | tListElem *pEntry = NULL; |
| 14702 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14703 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14704 | if(!pEntry) |
| 14705 | { |
| 14706 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14707 | smsLog(pMac, LOG2, "csrRoamFindInPeStatsReqList: List empty, no request to PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14708 | return NULL; |
| 14709 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14710 | while( pEntry ) |
| 14711 | { |
| 14712 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14713 | if(pTempStaEntry->statsMask == statsMask) |
| 14714 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14715 | smsLog(pMac, LOG3, "csrRoamFindInPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14716 | break; |
| 14717 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14718 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14719 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14720 | return pEntry; |
| 14721 | } |
| 14722 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14723 | tListElem * csrRoamChecknUpdateClientReqList(tpAniSirGlobal pMac, tCsrStatsClientReqInfo *pStaEntry, |
| 14724 | tANI_BOOLEAN update) |
| 14725 | { |
| 14726 | tListElem *pEntry; |
| 14727 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14728 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14729 | if(!pEntry) |
| 14730 | { |
| 14731 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14732 | smsLog(pMac, LOG2, "csrRoamChecknUpdateClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14733 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14734 | return NULL; |
| 14735 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14736 | while( pEntry ) |
| 14737 | { |
| 14738 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14739 | if((pTempStaEntry->requesterId == pStaEntry->requesterId) && |
| 14740 | (pTempStaEntry->statsMask == pStaEntry->statsMask)) |
| 14741 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14742 | smsLog(pMac, LOG3, "csrRoamChecknUpdateClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14743 | if(update) |
| 14744 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 14745 | pTempStaEntry->periodicity = pStaEntry->periodicity; |
| 14746 | pTempStaEntry->callback = pStaEntry->callback; |
| 14747 | pTempStaEntry->pContext = pStaEntry->pContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14748 | } |
| 14749 | break; |
| 14750 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14751 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14752 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14753 | return pEntry; |
| 14754 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14755 | tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask) |
| 14756 | { |
| 14757 | tListElem *pEntry; |
| 14758 | tCsrStatsClientReqInfo *pTempStaEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14759 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14760 | if(!pEntry) |
| 14761 | { |
| 14762 | //list empty |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 14763 | smsLog(pMac, LOG2, "csrRoamCheckClientReqList: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14764 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14765 | return NULL; |
| 14766 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14767 | while( pEntry ) |
| 14768 | { |
| 14769 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14770 | if((pTempStaEntry->statsMask & ~(1 << eCsrGlobalClassDStats)) == statsMask) |
| 14771 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14772 | smsLog(pMac, LOG3, "csrRoamCheckClientReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14773 | break; |
| 14774 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14775 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 14776 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14777 | return pEntry; |
| 14778 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14779 | eHalStatus csrRoamRegisterLinkQualityIndCallback(tpAniSirGlobal pMac, |
| 14780 | csrRoamLinkQualityIndCallback callback, |
| 14781 | void *pContext) |
| 14782 | { |
| 14783 | pMac->roam.linkQualityIndInfo.callback = callback; |
| 14784 | pMac->roam.linkQualityIndInfo.context = pContext; |
| 14785 | if( NULL == callback ) |
| 14786 | { |
| 14787 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being deregistered"); |
| 14788 | } |
| 14789 | else |
| 14790 | { |
| 14791 | smsLog(pMac, LOGW, "csrRoamRegisterLinkQualityIndCallback: indication callback being registered"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14792 | /* do we need to invoke the callback to notify client of initial value ?? */ |
| 14793 | } |
| 14794 | return eHAL_STATUS_SUCCESS; |
| 14795 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14796 | void csrRoamVccTrigger(tpAniSirGlobal pMac) |
| 14797 | { |
| 14798 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 14799 | tANI_U32 ul_mac_loss = 0; |
| 14800 | tANI_U32 ul_mac_loss_trigger_threshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14801 | /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 14802 | /*------------------------------------------------------------------------- |
| 14803 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14804 | Check for a change in link quality and notify client if necessary |
| 14805 | -------------------------------------------------------------------------*/ |
| 14806 | ul_mac_loss_trigger_threshold = |
| 14807 | pMac->roam.configParam.vccUlMacLossThreshold; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14808 | VOS_ASSERT( ul_mac_loss_trigger_threshold != 0 ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14809 | smsLog(pMac, LOGW, "csrRoamVccTrigger: UL_MAC_LOSS_THRESHOLD is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14810 | ul_mac_loss_trigger_threshold ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14811 | if(ul_mac_loss_trigger_threshold < ul_mac_loss) |
| 14812 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14813 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is POOR "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14814 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 14815 | } |
| 14816 | else |
| 14817 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14818 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality is GOOD"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14819 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 14820 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14821 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link qual : *** UL_MAC_LOSS %d *** ", |
| 14822 | ul_mac_loss); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14823 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 14824 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14825 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14826 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 14827 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14828 | smsLog(pMac, LOGW, "csrRoamVccTrigger: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14829 | newVccLinkQuality ); |
| 14830 | |
| 14831 | /* we now invoke the callback once to notify client of initial value */ |
| 14832 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 14833 | pMac->roam.linkQualityIndInfo.context ); |
| 14834 | //event: EVENT_WLAN_VCC |
| 14835 | } |
| 14836 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14837 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
| 14838 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14839 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14840 | VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal, |
| 14841 | v_U8_t rssiNotification, |
| 14842 | void * context) |
| 14843 | { |
| 14844 | tpAniSirGlobal pMac = PMAC_STRUCT( context ); |
| 14845 | eCsrRoamLinkQualityInd newVccLinkQuality; |
| 14846 | // TODO : Session info unavailable |
| 14847 | tANI_U32 sessionId = 0; |
| 14848 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 14849 | /*------------------------------------------------------------------------- |
| 14850 | Link quality is currently binary based on OBIWAN recommended triggers |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14851 | Check for a change in link quality and notify client if necessary |
| 14852 | -------------------------------------------------------------------------*/ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14853 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: RSSI trigger threshold is %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14854 | pMac->roam.configParam.vccRssiThreshold); |
| 14855 | if(!csrIsConnStateConnectedInfra(pMac, sessionId)) |
| 14856 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14857 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14858 | return VOS_STATUS_SUCCESS; |
| 14859 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14860 | if(WLANTL_HO_THRESHOLD_DOWN == rssiNotification) |
| 14861 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14862 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is POOR"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14863 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_POOR_IND; |
| 14864 | } |
| 14865 | else if(WLANTL_HO_THRESHOLD_UP == rssiNotification) |
| 14866 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14867 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality is GOOD "); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14868 | newVccLinkQuality = eCSR_ROAM_LINK_QUAL_GOOD_IND; |
| 14869 | } |
| 14870 | else |
| 14871 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14872 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: unknown rssi notification %d", rssiNotification); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14873 | //Set to this so the code below won't do anything |
| 14874 | newVccLinkQuality = pMac->roam.vccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14875 | VOS_ASSERT(0); |
| 14876 | } |
| 14877 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14878 | if(newVccLinkQuality != pMac->roam.vccLinkQuality) |
| 14879 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14880 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality changed: trigger necessary"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14881 | if(NULL != pMac->roam.linkQualityIndInfo.callback) |
| 14882 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14883 | smsLog(pMac, LOGW, "csrRoamVccTriggerRssiIndCallback: link quality indication %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14884 | newVccLinkQuality); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14885 | /* we now invoke the callback once to notify client of initial value */ |
| 14886 | pMac->roam.linkQualityIndInfo.callback( newVccLinkQuality, |
| 14887 | pMac->roam.linkQualityIndInfo.context ); |
| 14888 | //event: EVENT_WLAN_VCC |
| 14889 | } |
| 14890 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14891 | pMac->roam.vccLinkQuality = newVccLinkQuality; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14892 | return status; |
| 14893 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14894 | tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac, |
| 14895 | tDblLinkList *pStaList, |
| 14896 | tCsrStatsClientReqInfo *pStaEntry) |
| 14897 | { |
| 14898 | tCsrStatsClientReqInfo *pNewStaEntry = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14899 | //if same entity requested for same set of stats with different periodicity & |
| 14900 | // callback update it |
| 14901 | if(NULL == csrRoamChecknUpdateClientReqList(pMac, pStaEntry, TRUE)) |
| 14902 | { |
| 14903 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14904 | pNewStaEntry = vos_mem_malloc(sizeof(tCsrStatsClientReqInfo)); |
| 14905 | if (NULL == pNewStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14906 | { |
| 14907 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14908 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14909 | return NULL; |
| 14910 | } |
| 14911 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14912 | pNewStaEntry->callback = pStaEntry->callback; |
| 14913 | pNewStaEntry->pContext = pStaEntry->pContext; |
| 14914 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 14915 | pNewStaEntry->requesterId = pStaEntry->requesterId; |
| 14916 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 14917 | pNewStaEntry->pPeStaEntry = pStaEntry->pPeStaEntry; |
| 14918 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 14919 | pNewStaEntry->staId = pStaEntry->staId; |
| 14920 | pNewStaEntry->timerExpired = pStaEntry->timerExpired; |
| 14921 | |
| 14922 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
| 14923 | } |
| 14924 | return pNewStaEntry; |
| 14925 | } |
| 14926 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14927 | tCsrPeStatsReqInfo * csrRoamInsertEntryIntoPeStatsReqList( tpAniSirGlobal pMac, |
| 14928 | tDblLinkList *pStaList, |
| 14929 | tCsrPeStatsReqInfo *pStaEntry) |
| 14930 | { |
| 14931 | tCsrPeStatsReqInfo *pNewStaEntry = NULL; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14932 | pNewStaEntry = vos_mem_malloc(sizeof(tCsrPeStatsReqInfo)); |
| 14933 | if (NULL == pNewStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14934 | { |
| 14935 | smsLog(pMac, LOGW, "csrRoamInsertEntryIntoPeStatsReqList: couldn't allocate memory for the " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14936 | "entry"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14937 | return NULL; |
| 14938 | } |
| 14939 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14940 | pNewStaEntry->hPeStatsTimer = pStaEntry->hPeStatsTimer; |
| 14941 | pNewStaEntry->numClient = pStaEntry->numClient; |
| 14942 | pNewStaEntry->periodicity = pStaEntry->periodicity; |
| 14943 | pNewStaEntry->statsMask = pStaEntry->statsMask; |
| 14944 | pNewStaEntry->pMac = pStaEntry->pMac; |
| 14945 | pNewStaEntry->staId = pStaEntry->staId; |
| 14946 | pNewStaEntry->timerRunning = pStaEntry->timerRunning; |
| 14947 | pNewStaEntry->rspPending = pStaEntry->rspPending; |
| 14948 | |
| 14949 | csrLLInsertTail( pStaList, &pNewStaEntry->link, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14950 | return pNewStaEntry; |
| 14951 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14952 | eHalStatus csrGetRssi(tpAniSirGlobal pMac, |
| 14953 | tCsrRssiCallback callback, |
| 14954 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 14955 | { |
| 14956 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14957 | vos_msg_t msg; |
| 14958 | tANI_U32 sessionId; |
| 14959 | |
| 14960 | tAniGetRssiReq *pMsg; |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14961 | smsLog(pMac, LOG2, FL("called")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14962 | pMsg = vos_mem_malloc(sizeof(tAniGetRssiReq)); |
| 14963 | if ( NULL == pMsg ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14964 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14965 | smsLog(pMac, LOGE, " csrGetRssi: failed to allocate mem for req "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14966 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14967 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14968 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 14969 | |
| 14970 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_RSSI_REQ); |
| 14971 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 14972 | pMsg->sessionId = sessionId; |
| 14973 | pMsg->staId = staId; |
| 14974 | pMsg->rssiCallback = callback; |
| 14975 | pMsg->pDevContext = pContext; |
| 14976 | pMsg->pVosContext = pVosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14977 | msg.type = eWNI_SME_GET_RSSI_REQ; |
| 14978 | msg.bodyptr = pMsg; |
| 14979 | msg.reserved = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14980 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 14981 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14982 | smsLog(pMac, LOGE, " csrGetRssi failed to post msg to self "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 14983 | vos_mem_free((void *)pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14984 | status = eHAL_STATUS_FAILURE; |
| 14985 | } |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 14986 | smsLog(pMac, LOG2, FL("returned")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14987 | return status; |
| 14988 | } |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 14989 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 14990 | eHalStatus csrGetSnr(tpAniSirGlobal pMac, |
| 14991 | tCsrSnrCallback callback, |
| 14992 | tANI_U8 staId, tCsrBssid bssId, |
| 14993 | void *pContext) |
| 14994 | { |
| 14995 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 14996 | vos_msg_t msg; |
| 14997 | tANI_U32 sessionId; |
| 14998 | |
| 14999 | tAniGetSnrReq *pMsg; |
| 15000 | |
| 15001 | smsLog(pMac, LOG2, FL("called")); |
| 15002 | |
| 15003 | pMsg =(tAniGetSnrReq *)vos_mem_malloc(sizeof(tAniGetSnrReq)); |
| 15004 | if (NULL == pMsg ) |
| 15005 | { |
| 15006 | smsLog(pMac, LOGE, "%s: failed to allocate mem for req",__func__); |
| 15007 | return status; |
| 15008 | } |
| 15009 | |
| 15010 | csrRoamGetSessionIdFromBSSID(pMac, (tCsrBssid *)bssId, &sessionId); |
| 15011 | |
| 15012 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_SNR_REQ); |
| 15013 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetSnrReq); |
| 15014 | pMsg->sessionId = sessionId; |
| 15015 | pMsg->staId = staId; |
| 15016 | pMsg->snrCallback = callback; |
| 15017 | pMsg->pDevContext = pContext; |
| 15018 | msg.type = eWNI_SME_GET_SNR_REQ; |
| 15019 | msg.bodyptr = pMsg; |
| 15020 | msg.reserved = 0; |
| 15021 | |
| 15022 | if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 15023 | { |
| 15024 | smsLog(pMac, LOGE, "%s failed to post msg to self", __func__); |
| 15025 | vos_mem_free((v_VOID_t *)pMsg); |
| 15026 | status = eHAL_STATUS_FAILURE; |
| 15027 | } |
| 15028 | |
| 15029 | smsLog(pMac, LOG2, FL("returned")); |
| 15030 | return status; |
| 15031 | } |
| 15032 | |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15033 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR) |
| 15034 | eHalStatus csrGetRoamRssi(tpAniSirGlobal pMac, |
| 15035 | tCsrRssiCallback callback, |
| 15036 | tANI_U8 staId, tCsrBssid bssId, void *pContext, void* pVosContext) |
| 15037 | { |
| 15038 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15039 | tAniGetRssiReq *pMsg; |
| 15040 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15041 | pMsg = vos_mem_malloc(sizeof(tAniGetRssiReq)); |
| 15042 | if ( NULL == pMsg ) |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15043 | { |
| 15044 | smsLog(pMac, LOGE, " csrGetRoamRssi: failed to allocate mem for req"); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15045 | return eHAL_STATUS_FAILURE; |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15046 | } |
| 15047 | // need to initiate a stats request to PE |
| 15048 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_ROAM_RSSI_REQ); |
| 15049 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetRssiReq); |
| 15050 | pMsg->staId = staId; |
| 15051 | pMsg->rssiCallback = callback; |
| 15052 | pMsg->pDevContext = pContext; |
| 15053 | pMsg->pVosContext = pVosContext; |
| 15054 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 15055 | if(!HAL_STATUS_SUCCESS(status)) |
| 15056 | { |
Tushnim Bhattacharyya | 41f7286 | 2013-04-03 21:34:01 -0700 | [diff] [blame] | 15057 | smsLog(pMac, LOG1, " csrGetRoamRssi: failed to send down the rssi req"); |
| 15058 | //pMsg is freed by palSendMBMessage |
Srinivas Girigowda | d34cedb | 2013-01-25 13:33:11 -0800 | [diff] [blame] | 15059 | status = eHAL_STATUS_FAILURE; |
| 15060 | } |
| 15061 | return status; |
| 15062 | } |
| 15063 | #endif |
| 15064 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 15065 | |
| 15066 | |
| 15067 | #if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD) |
| 15068 | eHalStatus csrGetTsmStats(tpAniSirGlobal pMac, |
| 15069 | tCsrTsmStatsCallback callback, |
| 15070 | tANI_U8 staId, |
| 15071 | tCsrBssid bssId, |
| 15072 | void *pContext, |
| 15073 | void* pVosContext, |
| 15074 | tANI_U8 tid) |
| 15075 | { |
| 15076 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15077 | tAniGetTsmStatsReq *pMsg = NULL; |
| 15078 | |
| 15079 | status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniGetTsmStatsReq)); |
| 15080 | if ( !HAL_STATUS_SUCCESS(status) ) |
| 15081 | { |
| 15082 | smsLog(pMac, LOGE, "csrGetTsmStats: failed to allocate mem for req"); |
| 15083 | return status; |
| 15084 | } |
| 15085 | // need to initiate a stats request to PE |
| 15086 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GET_TSM_STATS_REQ); |
| 15087 | pMsg->msgLen = (tANI_U16)sizeof(tAniGetTsmStatsReq); |
| 15088 | pMsg->staId = staId; |
| 15089 | pMsg->tid = tid; |
| 15090 | palCopyMemory(pMac->hHdd, pMsg->bssId, bssId, sizeof(tSirMacAddr)); |
| 15091 | pMsg->tsmStatsCallback = callback; |
| 15092 | pMsg->pDevContext = pContext; |
| 15093 | pMsg->pVosContext = pVosContext; |
| 15094 | status = palSendMBMessage(pMac->hHdd, pMsg ); |
| 15095 | if(!HAL_STATUS_SUCCESS(status)) |
| 15096 | { |
| 15097 | smsLog(pMac, LOG1, " csrGetTsmStats: failed to send down the rssi req"); |
| 15098 | //pMsg is freed by palSendMBMessage |
| 15099 | status = eHAL_STATUS_FAILURE; |
| 15100 | } |
| 15101 | return status; |
| 15102 | } |
| 15103 | #endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */ |
| 15104 | |
| 15105 | |
Madan Mohan Koyyalamudi | 8af9b40 | 2013-07-11 14:59:10 +0530 | [diff] [blame] | 15106 | /* --------------------------------------------------------------------------- |
| 15107 | \fn csrGetTLSTAState |
| 15108 | \helper function to get teh TL STA State whenever the function is called. |
| 15109 | |
| 15110 | \param staId - The staID to be passed to the TL |
| 15111 | to get the relevant TL STA State |
| 15112 | \return the state as tANI_U16 |
| 15113 | ---------------------------------------------------------------------------*/ |
| 15114 | tANI_U16 csrGetTLSTAState(tpAniSirGlobal pMac, tANI_U8 staId) |
| 15115 | { |
| 15116 | WLANTL_STAStateType tlSTAState; |
| 15117 | tlSTAState = WLANTL_STA_INIT; |
| 15118 | |
| 15119 | //request TL for STA State |
| 15120 | if ( !VOS_IS_STATUS_SUCCESS(WLANTL_GetSTAState(pMac->roam.gVosContext, staId, &tlSTAState)) ) |
| 15121 | { |
| 15122 | smsLog(pMac, LOGE, FL("csrGetTLSTAState:couldn't get the STA state from TL")); |
| 15123 | } |
| 15124 | |
| 15125 | return tlSTAState; |
| 15126 | } |
| 15127 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15128 | eHalStatus csrGetStatistics(tpAniSirGlobal pMac, eCsrStatsRequesterType requesterId, |
| 15129 | tANI_U32 statsMask, |
| 15130 | tCsrStatsCallback callback, |
| 15131 | tANI_U32 periodicity, tANI_BOOLEAN cache, |
| 15132 | tANI_U8 staId, void *pContext) |
| 15133 | { |
| 15134 | tCsrStatsClientReqInfo staEntry; |
| 15135 | tCsrStatsClientReqInfo *pStaEntry = NULL; |
| 15136 | tCsrPeStatsReqInfo *pPeStaEntry = NULL; |
| 15137 | tListElem *pEntry = NULL; |
| 15138 | tANI_BOOLEAN found = FALSE; |
| 15139 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15140 | tANI_BOOLEAN insertInClientList = FALSE; |
| 15141 | VOS_STATUS vosStatus; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15142 | WLANTL_TRANSFER_STA_TYPE *pTlStats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15143 | |
| 15144 | if( csrIsAllSessionDisconnected(pMac) ) |
| 15145 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15146 | //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] | 15147 | return eHAL_STATUS_FAILURE; |
| 15148 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15149 | if((!statsMask) && (!callback)) |
| 15150 | { |
| 15151 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15152 | smsLog(pMac, LOGW, "csrGetStatistics: statsMask & callback empty in the request"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15153 | return eHAL_STATUS_FAILURE; |
| 15154 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15155 | //for the search list method for deregister |
| 15156 | staEntry.requesterId = requesterId; |
| 15157 | staEntry.statsMask = statsMask; |
| 15158 | //requester wants to deregister or just an error |
| 15159 | if((statsMask) && (!callback)) |
| 15160 | { |
| 15161 | pEntry = csrRoamChecknUpdateClientReqList(pMac, &staEntry, FALSE); |
| 15162 | if(!pEntry) |
| 15163 | { |
| 15164 | //msg |
| 15165 | 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] | 15166 | "find any existing request in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15167 | return eHAL_STATUS_FAILURE; |
| 15168 | } |
| 15169 | else |
| 15170 | { |
| 15171 | //clean up & return |
| 15172 | pStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 15173 | if(NULL != pStaEntry->pPeStaEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15174 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15175 | pStaEntry->pPeStaEntry->numClient--; |
| 15176 | //check if we need to delete the entry from peStatsReqList too |
| 15177 | if(!pStaEntry->pPeStaEntry->numClient) |
| 15178 | { |
| 15179 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pStaEntry->pPeStaEntry); |
| 15180 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15181 | } |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 15182 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15183 | //check if we need to stop the tl stats timer too |
| 15184 | pMac->roam.tlStatsReqInfo.numClient--; |
| 15185 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 15186 | { |
| 15187 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 15188 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15189 | status = vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 15190 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15191 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15192 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15193 | return eHAL_STATUS_FAILURE; |
| 15194 | } |
| 15195 | } |
| 15196 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 15197 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 15198 | } |
| 15199 | vos_timer_stop( &pStaEntry->timer ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15200 | // Destroy the vos timer... |
| 15201 | vosStatus = vos_timer_destroy( &pStaEntry->timer ); |
| 15202 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15203 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15204 | smsLog(pMac, LOGE, FL("csrGetStatistics:failed to destroy Client req timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15205 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15206 | csrRoamRemoveStatListEntry(pMac, pEntry); |
| 15207 | pStaEntry = NULL; |
| 15208 | return eHAL_STATUS_SUCCESS; |
| 15209 | } |
| 15210 | } |
| 15211 | |
| 15212 | if(cache && !periodicity) |
| 15213 | { |
| 15214 | //return the cached stats |
| 15215 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 15216 | } |
| 15217 | else |
| 15218 | { |
| 15219 | //add the request in the client req list |
| 15220 | staEntry.callback = callback; |
| 15221 | staEntry.pContext = pContext; |
| 15222 | staEntry.periodicity = periodicity; |
| 15223 | staEntry.pPeStaEntry = NULL; |
| 15224 | staEntry.staId = staId; |
| 15225 | staEntry.pMac = pMac; |
| 15226 | staEntry.timerExpired = FALSE; |
| 15227 | |
| 15228 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15229 | //if periodic report requested with non cached result from PE/TL |
| 15230 | if(periodicity) |
| 15231 | { |
| 15232 | |
| 15233 | //if looking for stats from PE |
| 15234 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 15235 | { |
| 15236 | |
| 15237 | //check if same request made already & waiting for rsp |
| 15238 | pPeStaEntry = csrRoamCheckPeStatsReqList(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), |
| 15239 | periodicity, &found, staId); |
| 15240 | if(!pPeStaEntry) |
| 15241 | { |
| 15242 | //bail out, maxed out on number of req for PE |
| 15243 | return eHAL_STATUS_FAILURE; |
| 15244 | } |
| 15245 | else |
| 15246 | { |
| 15247 | staEntry.pPeStaEntry = pPeStaEntry; |
| 15248 | } |
| 15249 | |
| 15250 | } |
| 15251 | //request stats from TL rightaway if requested by client, update tlStatsReqInfo if needed |
| 15252 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 15253 | { |
| 15254 | if(cache && pMac->roam.tlStatsReqInfo.numClient) |
| 15255 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15256 | smsLog(pMac, LOGE, FL("csrGetStatistics:Looking for cached stats from TL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15257 | } |
| 15258 | else |
| 15259 | { |
| 15260 | |
| 15261 | //update periodicity |
| 15262 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 15263 | { |
| 15264 | pMac->roam.tlStatsReqInfo.periodicity = |
| 15265 | CSR_ROAM_MIN(periodicity, pMac->roam.tlStatsReqInfo.periodicity); |
| 15266 | } |
| 15267 | else |
| 15268 | { |
| 15269 | pMac->roam.tlStatsReqInfo.periodicity = periodicity; |
| 15270 | } |
| 15271 | if(pMac->roam.tlStatsReqInfo.periodicity < CSR_MIN_TL_STAT_QUERY_PERIOD) |
| 15272 | { |
| 15273 | pMac->roam.tlStatsReqInfo.periodicity = CSR_MIN_TL_STAT_QUERY_PERIOD; |
| 15274 | } |
| 15275 | |
| 15276 | if(!pMac->roam.tlStatsReqInfo.timerRunning) |
| 15277 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15278 | 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] | 15279 | if (NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15280 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15281 | //req TL for class D stats |
| 15282 | if(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId)) |
| 15283 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15284 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15285 | } |
| 15286 | else |
| 15287 | { |
| 15288 | //save in SME |
| 15289 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 15290 | } |
| 15291 | vos_mem_free(pTlStats); |
| 15292 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15293 | } |
| 15294 | else |
| 15295 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15296 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15297 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15298 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15299 | if(pMac->roam.tlStatsReqInfo.periodicity) |
| 15300 | { |
| 15301 | //start timer |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15302 | status = vos_timer_start(&pMac->roam.tlStatsReqInfo.hTlStatsTimer, |
| 15303 | pMac->roam.tlStatsReqInfo.periodicity); |
| 15304 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15305 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15306 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15307 | return eHAL_STATUS_FAILURE; |
| 15308 | } |
| 15309 | pMac->roam.tlStatsReqInfo.timerRunning = TRUE; |
| 15310 | } |
| 15311 | } |
| 15312 | } |
| 15313 | pMac->roam.tlStatsReqInfo.numClient++; |
| 15314 | } |
| 15315 | |
| 15316 | insertInClientList = TRUE; |
| 15317 | } |
| 15318 | //if one time report requested with non cached result from PE/TL |
| 15319 | else if(!cache && !periodicity) |
| 15320 | { |
| 15321 | if(statsMask & ~(1 << eCsrGlobalClassDStats)) |
| 15322 | { |
| 15323 | //send down a req |
| 15324 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 15325 | if(!HAL_STATUS_SUCCESS(status)) |
| 15326 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15327 | 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] | 15328 | } |
| 15329 | //so that when the stats rsp comes back from PE we respond to upper layer |
| 15330 | //right away |
| 15331 | staEntry.timerExpired = TRUE; |
| 15332 | insertInClientList = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15333 | } |
| 15334 | if(statsMask & (1 << eCsrGlobalClassDStats)) |
| 15335 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15336 | 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] | 15337 | if (NULL != pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15338 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15339 | //req TL for class D stats |
| 15340 | if(!VOS_IS_STATUS_SUCCESS(WLANTL_GetStatistics(pMac->roam.gVosContext, pTlStats, staId))) |
| 15341 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15342 | smsLog(pMac, LOGE, FL("csrGetStatistics:couldn't get the stats from TL")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15343 | } |
| 15344 | else |
| 15345 | { |
| 15346 | //save in SME |
| 15347 | csrRoamSaveStatsFromTl(pMac, pTlStats); |
| 15348 | } |
| 15349 | vos_mem_free(pTlStats); |
| 15350 | pTlStats = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15351 | } |
| 15352 | else |
| 15353 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15354 | smsLog(pMac, LOGE, FL("cannot allocate memory for TL stat")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15355 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15356 | |
| 15357 | } |
| 15358 | //if looking for stats from TL only |
| 15359 | if(!insertInClientList) |
| 15360 | { |
| 15361 | //return the stats |
| 15362 | csrRoamReportStatistics(pMac, statsMask, callback, staId, pContext); |
| 15363 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15364 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15365 | if(insertInClientList) |
| 15366 | { |
| 15367 | pStaEntry = csrRoamInsertEntryIntoList(pMac, &pMac->roam.statsClientReqList, &staEntry); |
| 15368 | if(!pStaEntry) |
| 15369 | { |
| 15370 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15371 | smsLog(pMac, LOGW, "csrGetStatistics: Failed to insert req in statsClientReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15372 | return eHAL_STATUS_FAILURE; |
| 15373 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15374 | pStaEntry->periodicity = periodicity; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15375 | //Init & start timer if needed |
| 15376 | if(periodicity) |
| 15377 | { |
| 15378 | vosStatus = vos_timer_init( &pStaEntry->timer, VOS_TIMER_TYPE_SW, |
| 15379 | csrRoamStatsClientTimerHandler, pStaEntry ); |
| 15380 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15381 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15382 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot init StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15383 | return eHAL_STATUS_FAILURE; |
| 15384 | } |
| 15385 | vosStatus = vos_timer_start( &pStaEntry->timer, periodicity ); |
| 15386 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15387 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15388 | smsLog(pMac, LOGE, FL("csrGetStatistics:cannot start StatsClient timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15389 | return eHAL_STATUS_FAILURE; |
| 15390 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15391 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15392 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15393 | } |
| 15394 | return eHAL_STATUS_SUCCESS; |
| 15395 | } |
| 15396 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15397 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 15398 | |
| 15399 | static tSirRetStatus |
| 15400 | csrRoamScanOffloadPopulateMacHeader(tpAniSirGlobal pMac, |
| 15401 | tANI_U8* pBD, |
| 15402 | tANI_U8 type, |
| 15403 | tANI_U8 subType, |
| 15404 | tSirMacAddr peerAddr, |
| 15405 | tSirMacAddr selfMacAddr) |
| 15406 | { |
| 15407 | tSirRetStatus statusCode = eSIR_SUCCESS; |
| 15408 | tpSirMacMgmtHdr pMacHdr; |
| 15409 | |
| 15410 | /* Prepare MAC management header */ |
| 15411 | pMacHdr = (tpSirMacMgmtHdr) (pBD); |
| 15412 | |
| 15413 | /* Prepare FC */ |
| 15414 | pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION; |
| 15415 | pMacHdr->fc.type = type; |
| 15416 | pMacHdr->fc.subType = subType; |
| 15417 | |
| 15418 | /* Prepare Address 1 */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15419 | vos_mem_copy((tANI_U8 *) pMacHdr->da, (tANI_U8 *) peerAddr, |
| 15420 | sizeof( tSirMacAddr )); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15421 | |
| 15422 | sirCopyMacAddr(pMacHdr->sa,selfMacAddr); |
| 15423 | |
| 15424 | /* Prepare Address 3 */ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15425 | vos_mem_copy((tANI_U8 *) pMacHdr->bssId, (tANI_U8 *) peerAddr, |
| 15426 | sizeof( tSirMacAddr )); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15427 | return statusCode; |
| 15428 | } /*** csrRoamScanOffloadPopulateMacHeader() ***/ |
| 15429 | |
| 15430 | static tSirRetStatus |
| 15431 | csrRoamScanOffloadPrepareProbeReqTemplate(tpAniSirGlobal pMac, |
| 15432 | tANI_U8 nChannelNum, |
| 15433 | tANI_U32 dot11mode, |
| 15434 | tSirMacAddr selfMacAddr, |
| 15435 | tANI_U8 *pFrame, |
| 15436 | tANI_U16 *pusLen) |
| 15437 | { |
| 15438 | tDot11fProbeRequest pr; |
| 15439 | tANI_U32 nStatus, nBytes, nPayload; |
| 15440 | tSirRetStatus nSirStatus; |
| 15441 | /*Bcast tx*/ |
| 15442 | tSirMacAddr bssId = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
| 15443 | /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ |
| 15444 | |
| 15445 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15446 | vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15447 | |
| 15448 | PopulateDot11fSuppRates( pMac, nChannelNum, &pr.SuppRates,NULL); |
| 15449 | |
| 15450 | if ( WNI_CFG_DOT11_MODE_11B != dot11mode ) |
| 15451 | { |
| 15452 | PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates ); |
| 15453 | } |
| 15454 | |
| 15455 | |
| 15456 | if (IS_DOT11_MODE_HT(dot11mode)) |
| 15457 | { |
| 15458 | PopulateDot11fHTCaps( pMac, NULL, &pr.HTCaps ); |
| 15459 | } |
| 15460 | |
| 15461 | |
| 15462 | nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload ); |
| 15463 | if ( DOT11F_FAILED( nStatus ) ) |
| 15464 | { |
| 15465 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15466 | "Failed to calculate the packed size f" |
| 15467 | "or a Probe Request (0x%08x).\n", nStatus ); |
| 15468 | |
| 15469 | |
| 15470 | nPayload = sizeof( tDot11fProbeRequest ); |
| 15471 | } |
| 15472 | else if ( DOT11F_WARNED( nStatus ) ) |
| 15473 | { |
| 15474 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15475 | "There were warnings while calculating" |
| 15476 | "the packed size for a Probe Request (" |
| 15477 | "0x%08x).\n", nStatus ); |
| 15478 | } |
| 15479 | |
| 15480 | nBytes = nPayload + sizeof( tSirMacMgmtHdr ); |
| 15481 | |
| 15482 | /* Prepare outgoing frame*/ |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15483 | vos_mem_set(pFrame, nBytes , 0); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15484 | |
| 15485 | |
| 15486 | nSirStatus = csrRoamScanOffloadPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15487 | SIR_MAC_MGMT_PROBE_REQ, bssId,selfMacAddr); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15488 | |
| 15489 | if ( eSIR_SUCCESS != nSirStatus ) |
| 15490 | { |
| 15491 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15492 | "Failed to populate the buffer descriptor for a Probe Request (%d).\n", |
| 15493 | nSirStatus ); |
| 15494 | return nSirStatus; |
| 15495 | } |
| 15496 | |
| 15497 | |
| 15498 | nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame + |
| 15499 | sizeof( tSirMacMgmtHdr ), |
| 15500 | nPayload, &nPayload ); |
| 15501 | if ( DOT11F_FAILED( nStatus ) ) |
| 15502 | { |
| 15503 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15504 | "Failed to pack a Probe Request (0x%08x).\n", nStatus ); |
| 15505 | return eSIR_FAILURE; |
| 15506 | } |
| 15507 | else if ( DOT11F_WARNED( nStatus ) ) |
| 15508 | { |
| 15509 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15510 | "There were warnings while packing a Probe Request (0x%08x).\n" ); |
| 15511 | } |
| 15512 | |
| 15513 | *pusLen = nPayload + sizeof(tSirMacMgmtHdr); |
| 15514 | return eSIR_SUCCESS; |
| 15515 | } |
| 15516 | |
| 15517 | eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 command, tANI_U8 reason) |
| 15518 | { |
| 15519 | vos_msg_t msg; |
| 15520 | tSirRoamOffloadScanReq *pRequestBuf; |
| 15521 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 15522 | tCsrRoamSession *pSession; |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 15523 | tANI_U8 i,j,num_channels = 0, ucDot11Mode; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15524 | tANI_U8 *ChannelList = NULL; |
| 15525 | tANI_U32 sessionId; |
| 15526 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15527 | tpCsrChannelInfo currChannelListInfo; |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 15528 | tANI_U32 host_channels = 0; |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 15529 | tANI_U8 ChannelCacheStr[128] = {0}; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15530 | currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
| 15531 | |
Srinivas Girigowda | 830bbd0 | 2013-06-13 19:44:16 -0700 | [diff] [blame] | 15532 | if (0 == csrRoamIsRoamOffloadScanEnabled(pMac)) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15533 | { |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 15534 | smsLog( pMac, LOGE,"isRoamOffloadScanEnabled not set"); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15535 | return eHAL_STATUS_FAILURE; |
| 15536 | } |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 15537 | |
| 15538 | if ((VOS_TRUE == bRoamScanOffloadStarted) && (ROAM_SCAN_OFFLOAD_START == command)) |
| 15539 | { |
| 15540 | smsLog( pMac, LOGE,"Roam Scan Offload is already started"); |
| 15541 | return eHAL_STATUS_FAILURE; |
| 15542 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15543 | status = csrRoamGetSessionIdFromBSSID(pMac, |
| 15544 | (tCsrBssid *)pNeighborRoamInfo->currAPbssid, |
| 15545 | &sessionId); |
| 15546 | /*The Dynamic Config Items Update may happen even if the state is in INIT. |
| 15547 | * It is important to ensure that the command is passed down to the FW only |
| 15548 | * if the Infra Station is in a connected state.A connected station could also be |
| 15549 | * in a PREAUTH or REASSOC states.So, consider not sending the command down in INIT state. |
| 15550 | * We also have to ensure that if there is a STOP command we always have to inform Riva, |
| 15551 | * irrespective of whichever state we are in.*/ |
| 15552 | if ((pMac->roam.neighborRoamInfo.neighborRoamState == eCSR_NEIGHBOR_ROAM_STATE_INIT) && |
| 15553 | (command != ROAM_SCAN_OFFLOAD_STOP)) |
| 15554 | { |
| 15555 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Scan Command not sent to FW with state = %d and cmd = %d\n", |
| 15556 | pMac->roam.neighborRoamInfo.neighborRoamState, command); |
| 15557 | return eHAL_STATUS_FAILURE; |
| 15558 | } |
| 15559 | |
| 15560 | if ( !HAL_STATUS_SUCCESS( status ) ) |
| 15561 | { |
| 15562 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to find the sessionId for Roam Offload scan request", __func__); |
| 15563 | return eHAL_STATUS_FAILURE; |
| 15564 | } |
| 15565 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 15566 | pRequestBuf = vos_mem_malloc(sizeof(tSirRoamOffloadScanReq)); |
| 15567 | if (NULL == pRequestBuf) |
| 15568 | { |
| 15569 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for Roam Offload scan request", __func__); |
| 15570 | return eHAL_STATUS_FAILED_ALLOC; |
| 15571 | } |
| 15572 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15573 | vos_mem_zero(pRequestBuf, sizeof(tSirRoamOffloadScanReq)); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15574 | /* If command is STOP, then pass down ScanOffloadEnabled as Zero.This will handle the case of |
| 15575 | * host driver reloads, but Riva still up and running*/ |
| 15576 | if(command == ROAM_SCAN_OFFLOAD_STOP) |
| 15577 | pRequestBuf->RoamScanOffloadEnabled = 0; |
| 15578 | else |
| 15579 | pRequestBuf->RoamScanOffloadEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15580 | vos_mem_copy(pRequestBuf->ConnectedNetwork.currAPbssid, |
| 15581 | pNeighborRoamInfo->currAPbssid, |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15582 | sizeof(tCsrBssid)); |
| 15583 | pRequestBuf->ConnectedNetwork.ssId.length = |
| 15584 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.length; |
| 15585 | vos_mem_copy(pRequestBuf->ConnectedNetwork.ssId.ssId, |
| 15586 | pMac->roam.roamSession[sessionId].connectedProfile.SSID.ssId, |
| 15587 | pRequestBuf->ConnectedNetwork.ssId.length); |
| 15588 | pRequestBuf->ConnectedNetwork.authentication = |
| 15589 | pMac->roam.roamSession[sessionId].connectedProfile.AuthType; |
| 15590 | pRequestBuf->ConnectedNetwork.encryption = |
| 15591 | pMac->roam.roamSession[sessionId].connectedProfile.EncryptionType; |
| 15592 | pRequestBuf->ConnectedNetwork.mcencryption = |
| 15593 | pMac->roam.roamSession[sessionId].connectedProfile.mcEncryptionType; |
| 15594 | pRequestBuf->LookupThreshold = |
| 15595 | (v_S7_t)pNeighborRoamInfo->cfgParams.neighborLookupThreshold * (-1); |
| 15596 | pRequestBuf->RoamRssiDiff = |
| 15597 | pMac->roam.configParam.RoamRssiDiff; |
| 15598 | pRequestBuf->Command = command; |
| 15599 | pRequestBuf->StartScanReason = reason; |
| 15600 | pRequestBuf->NeighborScanTimerPeriod = |
| 15601 | pNeighborRoamInfo->cfgParams.neighborScanPeriod; |
| 15602 | pRequestBuf->NeighborRoamScanRefreshPeriod = |
| 15603 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod; |
| 15604 | pRequestBuf->NeighborScanChannelMinTime = |
| 15605 | pNeighborRoamInfo->cfgParams.minChannelScanTime; |
| 15606 | pRequestBuf->NeighborScanChannelMaxTime = |
| 15607 | pNeighborRoamInfo->cfgParams.maxChannelScanTime; |
| 15608 | pRequestBuf->EmptyRefreshScanPeriod = |
| 15609 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod; |
| 15610 | #ifdef FEATURE_WLAN_CCX |
| 15611 | pRequestBuf->IsCCXEnabled = pMac->roam.configParam.isCcxIniFeatureEnabled; |
| 15612 | #endif |
| 15613 | if ( |
| 15614 | #ifdef FEATURE_WLAN_CCX |
| 15615 | ((pNeighborRoamInfo->isCCXAssoc) && |
| 15616 | (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == |
| 15617 | eANI_BOOLEAN_FALSE)) || |
| 15618 | (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) || |
| 15619 | #endif // CCX |
| 15620 | currChannelListInfo->numOfChannels == 0) |
| 15621 | { |
| 15622 | |
| 15623 | /*Retreive the Channel Cache either from ini or from the Occupied Channels list. |
| 15624 | * Give Preference to INI Channels.*/ |
| 15625 | if (pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) |
| 15626 | { |
| 15627 | ChannelList = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList; |
| 15628 | for (i=0; i<pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels ;i++) |
| 15629 | { |
| 15630 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 15631 | { |
| 15632 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 15633 | } |
| 15634 | ChannelList++; |
| 15635 | } |
| 15636 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 15637 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_STATIC; |
| 15638 | } |
| 15639 | else{ |
| 15640 | ChannelList = pMac->scan.occupiedChannels.channelList; |
| 15641 | for(i=0; i<pMac->scan.occupiedChannels.numChannels; i++) |
| 15642 | { |
| 15643 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 15644 | { |
| 15645 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 15646 | } |
| 15647 | ChannelList++; |
| 15648 | } |
| 15649 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 15650 | /* If the profile changes as to what it was earlier, inform the FW through |
| 15651 | * FLUSH as ChannelCacheType in which case, the FW will flush the occupied channels |
| 15652 | * for the earlier profile and try to learn them afresh.*/ |
| 15653 | if (reason == REASON_FLUSH_CHANNEL_LIST) |
| 15654 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_FLUSH; |
| 15655 | else { |
| 15656 | if (csrNeighborRoamIsNewConnectedProfile(pMac)) |
| 15657 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_INIT; |
| 15658 | else |
| 15659 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
| 15660 | } |
| 15661 | } |
| 15662 | } |
| 15663 | #ifdef FEATURE_WLAN_CCX |
| 15664 | else |
| 15665 | { |
| 15666 | /* If CCX is enabled, and a neighbor Report is received,then |
| 15667 | * Ignore the INI Channels or the Occupied Channel List. Consider |
| 15668 | * the channels in the neighbor list sent by the CCX AP.*/ |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 15669 | if (currChannelListInfo->numOfChannels != 0) |
| 15670 | { |
| 15671 | ChannelList = currChannelListInfo->ChannelList; |
| 15672 | for (i=0;i<currChannelListInfo->numOfChannels;i++) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15673 | { |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 15674 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 15675 | { |
| 15676 | pRequestBuf->ConnectedNetwork.ChannelCache[num_channels++] = *ChannelList; |
| 15677 | } |
| 15678 | ChannelList++; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15679 | } |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 15680 | pRequestBuf->ConnectedNetwork.ChannelCount = num_channels; |
| 15681 | pRequestBuf->ChannelCacheType = CHANNEL_LIST_DYNAMIC_UPDATE; |
| 15682 | } |
| 15683 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15684 | #endif |
Varun Reddy Yeturu | b4dedf2 | 2013-09-13 15:58:26 -0700 | [diff] [blame] | 15685 | for (i = 0, j = 0; i < pRequestBuf->ConnectedNetwork.ChannelCount; i++) |
| 15686 | { |
| 15687 | j += snprintf(ChannelCacheStr + j, sizeof(ChannelCacheStr) - j," %d", |
| 15688 | pRequestBuf->ConnectedNetwork.ChannelCache[i]); |
| 15689 | } |
| 15690 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 15691 | "ChnlCacheType:%d, No of Chnls:%d,Channels: %s", |
| 15692 | pRequestBuf->ChannelCacheType, |
| 15693 | pRequestBuf->ConnectedNetwork.ChannelCount, |
| 15694 | ChannelCacheStr); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15695 | num_channels = 0; |
| 15696 | ChannelList = NULL; |
| 15697 | |
| 15698 | /* Maintain the Valid Channels List*/ |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 15699 | host_channels = sizeof(pMac->roam.validChannelList); |
| 15700 | if (HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, pMac->roam.validChannelList, &host_channels))) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15701 | { |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 15702 | ChannelList = pMac->roam.validChannelList; |
| 15703 | pMac->roam.numValidChannels = host_channels; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15704 | } |
Srinivas Girigowda | 5607685 | 2013-08-20 14:00:50 -0700 | [diff] [blame] | 15705 | else |
| 15706 | { |
| 15707 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 15708 | "%s:Failed to get the valid channel list", __func__); |
| 15709 | return eHAL_STATUS_FAILURE; |
| 15710 | } |
| 15711 | for(i=0; i<pMac->roam.numValidChannels; i++) |
| 15712 | { |
| 15713 | if(!CSR_IS_CHANNEL_DFS(*ChannelList) && *ChannelList) |
| 15714 | { |
| 15715 | pRequestBuf->ValidChannelList[num_channels++] = *ChannelList; |
| 15716 | } |
| 15717 | ChannelList++; |
| 15718 | } |
| 15719 | pRequestBuf->ValidChannelCount = num_channels; |
| 15720 | |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 15721 | pRequestBuf->MDID.mdiePresent = |
| 15722 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent; |
| 15723 | pRequestBuf->MDID.mobilityDomain = |
| 15724 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mobilityDomain; |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 15725 | pRequestBuf->nProbes = pMac->roam.configParam.nProbes; |
| 15726 | |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 15727 | pRequestBuf->HomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime; |
Srinivas Girigowda | 6cf0b82 | 2013-06-27 14:00:20 -0700 | [diff] [blame] | 15728 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15729 | /*Prepare a probe request for 2.4GHz band and one for 5GHz band*/ |
| 15730 | ucDot11Mode = (tANI_U8) csrTranslateToWNICfgDot11Mode(pMac, |
| 15731 | csrFindBestPhyMode( pMac, pMac->roam.configParam.phyMode )); |
| 15732 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_24G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 15733 | pRequestBuf->p24GProbeTemplate, &pRequestBuf->us24GProbeTemplateLen); |
| 15734 | |
| 15735 | csrRoamScanOffloadPrepareProbeReqTemplate(pMac,SIR_ROAM_SCAN_5G_DEFAULT_CH, ucDot11Mode, pSession->selfMacAddr, |
| 15736 | pRequestBuf->p5GProbeTemplate, &pRequestBuf->us5GProbeTemplateLen); |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 15737 | msg.type = WDA_ROAM_SCAN_OFFLOAD_REQ; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15738 | msg.reserved = 0; |
| 15739 | msg.bodyptr = pRequestBuf; |
| 15740 | if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))) |
| 15741 | { |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 15742 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_ROAM_SCAN_OFFLOAD_REQ message to WDA", __func__); |
| 15743 | vos_mem_free(pRequestBuf); |
| 15744 | return eHAL_STATUS_FAILURE; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15745 | } |
Srinivas Girigowda | 577ed65 | 2013-08-14 11:38:29 -0700 | [diff] [blame] | 15746 | else |
| 15747 | { |
| 15748 | if (ROAM_SCAN_OFFLOAD_START == command) |
| 15749 | bRoamScanOffloadStarted = VOS_TRUE; |
| 15750 | else if (ROAM_SCAN_OFFLOAD_STOP == command) |
| 15751 | bRoamScanOffloadStarted = VOS_FALSE; |
| 15752 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15753 | |
| 15754 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Roam Scan Offload Command %d, Reason %d", command, reason); |
| 15755 | return status; |
| 15756 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 15757 | |
| 15758 | eHalStatus csrRoamOffloadScanRspHdlr(tpAniSirGlobal pMac, tANI_U8 reason) |
| 15759 | { |
| 15760 | switch(reason) |
| 15761 | { |
| 15762 | case 0: |
| 15763 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, "Rsp for Roam Scan Offload with failure status"); |
| 15764 | break; |
| 15765 | case REASON_OS_REQUESTED_ROAMING_NOW: |
| 15766 | csrNeighborRoamProceedWithHandoffReq(pMac); |
| 15767 | break; |
| 15768 | default: |
Tushnim Bhattacharyya | 5128d75 | 2013-06-26 23:23:18 -0700 | [diff] [blame] | 15769 | 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] | 15770 | } |
| 15771 | return eHAL_STATUS_SUCCESS; |
| 15772 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 15773 | #endif |
| 15774 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15775 | tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 15776 | tANI_U32 periodicity, tANI_BOOLEAN *pFound, tANI_U8 staId) |
| 15777 | { |
| 15778 | tANI_BOOLEAN found = FALSE; |
| 15779 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 15780 | tCsrPeStatsReqInfo staEntry; |
| 15781 | tCsrPeStatsReqInfo *pTempStaEntry = NULL; |
| 15782 | tListElem *pStaEntry = NULL; |
| 15783 | VOS_STATUS vosStatus; |
| 15784 | tPmcPowerState powerState; |
| 15785 | *pFound = FALSE; |
| 15786 | |
| 15787 | pStaEntry = csrRoamFindInPeStatsReqList(pMac, statsMask); |
| 15788 | if(pStaEntry) |
| 15789 | { |
| 15790 | pTempStaEntry = GET_BASE_ADDR( pStaEntry, tCsrPeStatsReqInfo, link ); |
| 15791 | if(pTempStaEntry->periodicity) |
| 15792 | { |
| 15793 | pTempStaEntry->periodicity = |
| 15794 | CSR_ROAM_MIN(periodicity, pTempStaEntry->periodicity); |
| 15795 | } |
| 15796 | else |
| 15797 | { |
| 15798 | pTempStaEntry->periodicity = periodicity; |
| 15799 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15800 | pTempStaEntry->numClient++; |
| 15801 | found = TRUE; |
| 15802 | } |
| 15803 | else |
| 15804 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15805 | vos_mem_set(&staEntry, sizeof(tCsrPeStatsReqInfo), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15806 | staEntry.numClient = 1; |
| 15807 | staEntry.periodicity = periodicity; |
| 15808 | staEntry.pMac = pMac; |
| 15809 | staEntry.rspPending = FALSE; |
| 15810 | staEntry.staId = staId; |
| 15811 | staEntry.statsMask = statsMask; |
| 15812 | staEntry.timerRunning = FALSE; |
| 15813 | pTempStaEntry = csrRoamInsertEntryIntoPeStatsReqList(pMac, &pMac->roam.peStatsReqList, &staEntry); |
| 15814 | if(!pTempStaEntry) |
| 15815 | { |
| 15816 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15817 | smsLog(pMac, LOGW, "csrRoamCheckPeStatsReqList: Failed to insert req in peStatsReqList"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15818 | return NULL; |
| 15819 | } |
| 15820 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15821 | pmcQueryPowerState(pMac, &powerState, NULL, NULL); |
| 15822 | if(ePMC_FULL_POWER == powerState) |
| 15823 | { |
| 15824 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicity) |
| 15825 | { |
| 15826 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicity; |
| 15827 | } |
| 15828 | } |
| 15829 | else |
| 15830 | { |
| 15831 | if(pTempStaEntry->periodicity < pMac->roam.configParam.statsReqPeriodicityInPS) |
| 15832 | { |
| 15833 | pTempStaEntry->periodicity = pMac->roam.configParam.statsReqPeriodicityInPS; |
| 15834 | } |
| 15835 | } |
| 15836 | if(!pTempStaEntry->timerRunning) |
| 15837 | { |
| 15838 | //send down a req in case of one time req, for periodic ones wait for timer to expire |
| 15839 | if(!pTempStaEntry->rspPending && |
| 15840 | !pTempStaEntry->periodicity) |
| 15841 | { |
| 15842 | status = csrSendMBStatsReqMsg(pMac, statsMask & ~(1 << eCsrGlobalClassDStats), staId); |
| 15843 | if(!HAL_STATUS_SUCCESS(status)) |
| 15844 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15845 | 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] | 15846 | } |
| 15847 | else |
| 15848 | { |
| 15849 | pTempStaEntry->rspPending = TRUE; |
| 15850 | } |
| 15851 | } |
| 15852 | if(pTempStaEntry->periodicity) |
| 15853 | { |
| 15854 | if(!found) |
| 15855 | { |
| 15856 | |
| 15857 | vosStatus = vos_timer_init( &pTempStaEntry->hPeStatsTimer, VOS_TIMER_TYPE_SW, |
| 15858 | csrRoamPeStatsTimerHandler, pTempStaEntry ); |
| 15859 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15860 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15861 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot init hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15862 | return NULL; |
| 15863 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15864 | } |
| 15865 | //start timer |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15866 | smsLog(pMac, LOG1, "csrRoamCheckPeStatsReqList:peStatsTimer period %d", pTempStaEntry->periodicity); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15867 | vosStatus = vos_timer_start( &pTempStaEntry->hPeStatsTimer, pTempStaEntry->periodicity ); |
| 15868 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15869 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15870 | smsLog(pMac, LOGE, FL("csrRoamCheckPeStatsReqList:cannot start hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15871 | return NULL; |
| 15872 | } |
| 15873 | pTempStaEntry->timerRunning = TRUE; |
| 15874 | } |
| 15875 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15876 | *pFound = found; |
| 15877 | return pTempStaEntry; |
| 15878 | } |
| 15879 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15880 | /* |
| 15881 | pStaEntry is no longer invalid upon the return of this function. |
| 15882 | */ |
| 15883 | static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry) |
| 15884 | { |
| 15885 | if(pEntry) |
| 15886 | { |
| 15887 | if(csrLLRemoveEntry(&pMac->roam.statsClientReqList, pEntry, LL_ACCESS_LOCK)) |
| 15888 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15889 | vos_mem_free(GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15890 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15891 | } |
| 15892 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15893 | |
| 15894 | void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry) |
| 15895 | { |
| 15896 | tListElem *pEntry; |
| 15897 | tCsrPeStatsReqInfo *pTempStaEntry; |
| 15898 | VOS_STATUS vosStatus; |
| 15899 | pEntry = csrLLPeekHead( &pMac->roam.peStatsReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15900 | if(!pEntry) |
| 15901 | { |
| 15902 | //list empty |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15903 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: List empty, no stats req for PE"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15904 | return; |
| 15905 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15906 | while( pEntry ) |
| 15907 | { |
| 15908 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrPeStatsReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15909 | if( pTempStaEntry && pTempStaEntry->statsMask == pPeStaEntry->statsMask) |
| 15910 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15911 | smsLog(pMac, LOGW, "csrRoamRemoveEntryFromPeStatsReqList: match found"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15912 | if(pTempStaEntry->timerRunning) |
| 15913 | { |
| 15914 | vosStatus = vos_timer_stop( &pTempStaEntry->hPeStatsTimer ); |
| 15915 | /* If we are not able to stop the timer here, just remove |
| 15916 | * the entry from the linked list. Destroy the timer object |
| 15917 | * and free the memory in the timer CB |
| 15918 | */ |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 15919 | if ( vosStatus == VOS_STATUS_SUCCESS ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15920 | { |
| 15921 | /* the timer is successfully stopped */ |
| 15922 | pTempStaEntry->timerRunning = FALSE; |
| 15923 | |
| 15924 | /* Destroy the timer */ |
| 15925 | vosStatus = vos_timer_destroy( &pTempStaEntry->hPeStatsTimer ); |
| 15926 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 15927 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15928 | smsLog(pMac, LOGE, FL("csrRoamRemoveEntryFromPeStatsReqList:failed to destroy hPeStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15929 | } |
| 15930 | } |
| 15931 | else |
| 15932 | { |
| 15933 | // the timer could not be stopped. Hence destroy and free the |
| 15934 | // memory for the PE stat entry in the timer CB. |
| 15935 | pTempStaEntry->timerStopFailed = TRUE; |
| 15936 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15937 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15938 | |
| 15939 | if(csrLLRemoveEntry(&pMac->roam.peStatsReqList, pEntry, LL_ACCESS_LOCK)) |
| 15940 | { |
| 15941 | // Only free the memory if we could stop the timer successfully |
| 15942 | if(!pTempStaEntry->timerStopFailed) |
| 15943 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 15944 | vos_mem_free(pTempStaEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15945 | pTempStaEntry = NULL; |
| 15946 | } |
| 15947 | break; |
| 15948 | } |
| 15949 | |
| 15950 | pEntry = csrLLNext( &pMac->roam.peStatsReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 15951 | } |
| 15952 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15953 | return; |
| 15954 | } |
| 15955 | |
| 15956 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15957 | void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15958 | { |
| 15959 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15960 | pMac->roam.classDStatsInfo.num_rx_bytes_crc_ok = pTlStats->rxBcntCRCok; |
| 15961 | pMac->roam.classDStatsInfo.rx_bc_byte_cnt = pTlStats->rxBCBcnt; |
| 15962 | pMac->roam.classDStatsInfo.rx_bc_frm_cnt = pTlStats->rxBCFcnt; |
| 15963 | pMac->roam.classDStatsInfo.rx_byte_cnt = pTlStats->rxBcnt; |
| 15964 | pMac->roam.classDStatsInfo.rx_mc_byte_cnt = pTlStats->rxMCBcnt; |
| 15965 | pMac->roam.classDStatsInfo.rx_mc_frm_cnt = pTlStats->rxMCFcnt; |
| 15966 | pMac->roam.classDStatsInfo.rx_rate = pTlStats->rxRate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15967 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15968 | pMac->roam.classDStatsInfo.rx_uc_byte_cnt[0] = pTlStats->rxUCBcnt; |
| 15969 | pMac->roam.classDStatsInfo.rx_uc_frm_cnt = pTlStats->rxUCFcnt; |
| 15970 | pMac->roam.classDStatsInfo.tx_bc_byte_cnt = pTlStats->txBCBcnt; |
| 15971 | pMac->roam.classDStatsInfo.tx_bc_frm_cnt = pTlStats->txBCFcnt; |
| 15972 | pMac->roam.classDStatsInfo.tx_mc_byte_cnt = pTlStats->txMCBcnt; |
| 15973 | pMac->roam.classDStatsInfo.tx_mc_frm_cnt = pTlStats->txMCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15974 | //?? need per AC |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15975 | pMac->roam.classDStatsInfo.tx_uc_byte_cnt[0] = pTlStats->txUCBcnt; |
| 15976 | pMac->roam.classDStatsInfo.tx_uc_frm_cnt = pTlStats->txUCFcnt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15977 | |
| 15978 | } |
| 15979 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15980 | void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask, |
| 15981 | tCsrStatsCallback callback, tANI_U8 staId, void *pContext) |
| 15982 | { |
| 15983 | tANI_U8 stats[500]; |
| 15984 | tANI_U8 *pStats = NULL; |
| 15985 | tANI_U32 tempMask = 0; |
| 15986 | tANI_U8 counter = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15987 | if(!callback) |
| 15988 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15989 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report callback NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15990 | return; |
| 15991 | } |
| 15992 | if(!statsMask) |
| 15993 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 15994 | smsLog(pMac, LOGE, FL("csrRoamReportStatistics:cannot report statsMask is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15995 | return; |
| 15996 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15997 | pStats = stats; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15998 | tempMask = statsMask; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15999 | while(tempMask) |
| 16000 | { |
| 16001 | if(tempMask & 1) |
| 16002 | { |
| 16003 | //new stats info from PE, fill up the stats strucutres in PMAC |
| 16004 | switch(counter) |
| 16005 | { |
| 16006 | case eCsrSummaryStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16007 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:summary stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16008 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.summaryStatsInfo, |
| 16009 | sizeof(tCsrSummaryStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16010 | pStats += sizeof(tCsrSummaryStatsInfo); |
| 16011 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16012 | case eCsrGlobalClassAStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16013 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassA stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16014 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classAStatsInfo, |
| 16015 | sizeof(tCsrGlobalClassAStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16016 | pStats += sizeof(tCsrGlobalClassAStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16017 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16018 | case eCsrGlobalClassBStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16019 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassB stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16020 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classBStatsInfo, |
| 16021 | sizeof(tCsrGlobalClassBStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16022 | pStats += sizeof(tCsrGlobalClassBStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16023 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16024 | case eCsrGlobalClassCStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16025 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassC stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16026 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classCStatsInfo, |
| 16027 | sizeof(tCsrGlobalClassCStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16028 | pStats += sizeof(tCsrGlobalClassCStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16029 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16030 | case eCsrGlobalClassDStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16031 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:ClassD stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16032 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.classDStatsInfo, |
| 16033 | sizeof(tCsrGlobalClassDStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16034 | pStats += sizeof(tCsrGlobalClassDStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16035 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16036 | case eCsrPerStaStats: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16037 | smsLog( pMac, LOG2, FL("csrRoamReportStatistics:PerSta stats")); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16038 | vos_mem_copy( pStats, (tANI_U8 *)&pMac->roam.perStaStatsInfo[staId], |
| 16039 | sizeof(tCsrPerStaStatsInfo)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16040 | pStats += sizeof(tCsrPerStaStatsInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16041 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16042 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16043 | smsLog( pMac, LOG1, FL("csrRoamReportStatistics:unknown stats type")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16044 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16045 | } |
| 16046 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16047 | tempMask >>=1; |
| 16048 | counter++; |
| 16049 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16050 | callback(stats, pContext ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16051 | } |
| 16052 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16053 | eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac) |
| 16054 | { |
| 16055 | tListElem *pEntry = NULL; |
| 16056 | tListElem *pPrevEntry = NULL; |
| 16057 | tCsrStatsClientReqInfo *pTempStaEntry = NULL; |
| 16058 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16059 | VOS_STATUS vosStatus; |
| 16060 | pEntry = csrLLPeekHead( &pMac->roam.statsClientReqList, LL_ACCESS_LOCK ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16061 | if(!pEntry) |
| 16062 | { |
| 16063 | //list empty |
| 16064 | smsLog(pMac, LOGW, "csrRoamDeregStatisticsReq: List empty, no request from " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16065 | "upper layer client(s)"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16066 | return status; |
| 16067 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16068 | while( pEntry ) |
| 16069 | { |
| 16070 | if(pPrevEntry) |
| 16071 | { |
| 16072 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 16073 | //send up the stats report |
| 16074 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 16075 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 16076 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 16077 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16078 | pTempStaEntry = GET_BASE_ADDR( pEntry, tCsrStatsClientReqInfo, link ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16079 | if (pTempStaEntry->pPeStaEntry) //pPeStaEntry can be NULL |
| 16080 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16081 | pTempStaEntry->pPeStaEntry->numClient--; |
| 16082 | //check if we need to delete the entry from peStatsReqList too |
| 16083 | if(!pTempStaEntry->pPeStaEntry->numClient) |
| 16084 | { |
| 16085 | csrRoamRemoveEntryFromPeStatsReqList(pMac, pTempStaEntry->pPeStaEntry); |
| 16086 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16087 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16088 | //check if we need to stop the tl stats timer too |
| 16089 | pMac->roam.tlStatsReqInfo.numClient--; |
| 16090 | if(!pMac->roam.tlStatsReqInfo.numClient) |
| 16091 | { |
| 16092 | if(pMac->roam.tlStatsReqInfo.timerRunning) |
| 16093 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 16094 | status = vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer); |
| 16095 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16096 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16097 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:cannot stop TlStatsTimer timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16098 | //we will continue |
| 16099 | } |
| 16100 | } |
| 16101 | pMac->roam.tlStatsReqInfo.periodicity = 0; |
| 16102 | pMac->roam.tlStatsReqInfo.timerRunning = FALSE; |
| 16103 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16104 | if (pTempStaEntry->periodicity) |
| 16105 | { |
| 16106 | //While creating StaEntry in csrGetStatistics, |
| 16107 | //Initializing and starting timer only when periodicity is set. |
| 16108 | //So Stop and Destroy timer only when periodicity is set. |
| 16109 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16110 | vos_timer_stop( &pTempStaEntry->timer ); |
| 16111 | // Destroy the vos timer... |
| 16112 | vosStatus = vos_timer_destroy( &pTempStaEntry->timer ); |
| 16113 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 16114 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16115 | smsLog(pMac, LOGE, FL("csrRoamDeregStatisticsReq:failed to destroy Client req timer")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16116 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16117 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16118 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16119 | |
| 16120 | pPrevEntry = pEntry; |
| 16121 | pEntry = csrLLNext( &pMac->roam.statsClientReqList, pEntry, LL_ACCESS_NOLOCK ); |
| 16122 | } |
| 16123 | //the last one |
| 16124 | if(pPrevEntry) |
| 16125 | { |
| 16126 | pTempStaEntry = GET_BASE_ADDR( pPrevEntry, tCsrStatsClientReqInfo, link ); |
| 16127 | //send up the stats report |
| 16128 | csrRoamReportStatistics(pMac, pTempStaEntry->statsMask, pTempStaEntry->callback, |
| 16129 | pTempStaEntry->staId, pTempStaEntry->pContext); |
| 16130 | csrRoamRemoveStatListEntry(pMac, pPrevEntry); |
| 16131 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16132 | return status; |
| 16133 | |
| 16134 | } |
| 16135 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16136 | eHalStatus csrIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand, |
| 16137 | tRequestFullPowerReason *pReason, |
| 16138 | tANI_BOOLEAN *pfNeedPower ) |
| 16139 | { |
| 16140 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 16141 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
| 16142 | tPmcState pmcState; |
| 16143 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16144 | // TODO : Session info unavailable |
| 16145 | tANI_U32 sessionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16146 | if( pfNeedPower ) |
| 16147 | { |
| 16148 | *pfNeedPower = eANI_BOOLEAN_FALSE; |
| 16149 | } |
| 16150 | //We only handle CSR commands |
| 16151 | if( !(eSmeCsrCommandMask & pCommand->command) ) |
| 16152 | { |
| 16153 | return eHAL_STATUS_SUCCESS; |
| 16154 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16155 | //Check PMC state first |
| 16156 | pmcState = pmcGetPmcState( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16157 | switch( pmcState ) |
| 16158 | { |
| 16159 | case REQUEST_IMPS: |
| 16160 | case IMPS: |
| 16161 | if( eSmeCommandScan == pCommand->command ) |
| 16162 | { |
| 16163 | switch( pCommand->u.scanCmd.reason ) |
| 16164 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16165 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 16166 | case eCsrScanGetLfrResult: |
| 16167 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16168 | case eCsrScanGetResult: |
| 16169 | case eCsrScanBGScanAbort: |
| 16170 | case eCsrScanBGScanEnable: |
| 16171 | case eCsrScanGetScanChnInfo: |
| 16172 | //Internal process, no need for full power |
| 16173 | fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 16174 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16175 | default: |
| 16176 | //Other scans are real scan, ask for power |
| 16177 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16178 | break; |
| 16179 | } //switch |
| 16180 | } |
| 16181 | else |
| 16182 | { |
| 16183 | //ask for power for roam and status change |
| 16184 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16185 | } |
| 16186 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16187 | case REQUEST_BMPS: |
| 16188 | case BMPS: |
| 16189 | case REQUEST_START_UAPSD: |
| 16190 | case UAPSD: |
| 16191 | //We treat WOWL same as BMPS |
| 16192 | case REQUEST_ENTER_WOWL: |
| 16193 | case WOWL: |
| 16194 | if( eSmeCommandRoam == pCommand->command ) |
| 16195 | { |
| 16196 | tScanResultList *pBSSList = (tScanResultList *)pCommand->u.roamCmd.hBSSList; |
| 16197 | tCsrScanResult *pScanResult; |
| 16198 | tListElem *pEntry; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16199 | switch ( pCommand->u.roamCmd.roamReason ) |
| 16200 | { |
| 16201 | case eCsrForcedDisassoc: |
| 16202 | case eCsrForcedDisassocMICFailure: |
| 16203 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 16204 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16205 | break; |
| 16206 | case eCsrSmeIssuedDisassocForHandoff: |
| 16207 | case eCsrForcedDeauth: |
| 16208 | case eCsrHddIssuedReassocToSameAP: |
| 16209 | case eCsrSmeIssuedReassocToSameAP: |
| 16210 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16211 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16212 | case eCsrCapsChange: |
| 16213 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16214 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16215 | default: |
| 16216 | //Check whether the profile is already connected. If so, no need for full power |
| 16217 | //Note: IBSS is ignored for now because we don't support powersave in IBSS |
| 16218 | if ( csrIsConnStateConnectedInfra(pMac, sessionId) && pBSSList ) |
| 16219 | { |
| 16220 | //Only need to check the first one |
| 16221 | pEntry = csrLLPeekHead(&pBSSList->List, LL_ACCESS_LOCK); |
| 16222 | if( pEntry ) |
| 16223 | { |
| 16224 | pScanResult = GET_BASE_ADDR(pEntry, tCsrScanResult, Link); |
| 16225 | #if 0 |
| 16226 | // TODO : Session Specific info pConnectBssDesc |
| 16227 | if( csrIsBssIdEqual( pMac, &pScanResult->Result.BssDescriptor, pMac->roam.pConnectBssDesc ) && |
| 16228 | csrIsSsidEqual( pMac, pMac->roam.pConnectBssDesc, |
| 16229 | &pScanResult->Result.BssDescriptor, (tDot11fBeaconIEs *)( pScanResult->Result.pvIes ) ) ) |
| 16230 | { |
| 16231 | // Check to see if the Auth type has changed in the Profile. If so, we don't want to Reassociate |
| 16232 | // with Authenticating first. To force this, stop the current association (Disassociate) and |
| 16233 | // then re 'Join' the AP, wihch will force an Authentication (with the new Auth type) followed by |
| 16234 | // a new Association. |
| 16235 | if(csrIsSameProfile(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 16236 | { |
| 16237 | if(csrRoamIsSameProfileKeys(pMac, &pMac->roam.connectedProfile, pProfile)) |
| 16238 | { |
| 16239 | //Done, eventually, the command reaches eCsrReassocToSelfNoCapChange; |
| 16240 | //No need for full power |
| 16241 | //Set the flag so the code later can avoid to do the above |
| 16242 | //check again. |
| 16243 | pCommand->u.roamCmd.fReassocToSelfNoCapChange = eANI_BOOLEAN_TRUE; |
| 16244 | break; |
| 16245 | } |
| 16246 | } |
| 16247 | } |
| 16248 | #endif |
| 16249 | } |
| 16250 | } |
| 16251 | //If we are here, full power is needed |
| 16252 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16253 | break; |
| 16254 | } |
| 16255 | } |
| 16256 | else if( eSmeCommandWmStatusChange == pCommand->command ) |
| 16257 | { |
| 16258 | //need full power for all |
| 16259 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16260 | reason = eSME_LINK_DISCONNECTED_BY_OTHER; |
| 16261 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16262 | #ifdef FEATURE_WLAN_TDLS |
| 16263 | else if( eSmeCommandTdlsAddPeer == pCommand->command ) |
| 16264 | { |
| 16265 | //TDLS link is getting established. need full power |
| 16266 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16267 | reason = eSME_FULL_PWR_NEEDED_BY_TDLS_PEER_SETUP; |
| 16268 | } |
| 16269 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16270 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16271 | case REQUEST_STOP_UAPSD: |
| 16272 | case REQUEST_EXIT_WOWL: |
| 16273 | if( eSmeCommandRoam == pCommand->command ) |
| 16274 | { |
| 16275 | fNeedFullPower = eANI_BOOLEAN_TRUE; |
| 16276 | switch ( pCommand->u.roamCmd.roamReason ) |
| 16277 | { |
| 16278 | case eCsrForcedDisassoc: |
| 16279 | case eCsrForcedDisassocMICFailure: |
| 16280 | reason = eSME_LINK_DISCONNECTED_BY_HDD; |
| 16281 | break; |
| 16282 | default: |
| 16283 | break; |
| 16284 | } |
| 16285 | } |
| 16286 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16287 | case STOPPED: |
| 16288 | case REQUEST_STANDBY: |
| 16289 | case STANDBY: |
| 16290 | case LOW_POWER: |
| 16291 | //We are not supposed to do anything |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16292 | smsLog( pMac, LOGE, FL( " cannot process because PMC is in stopped/standby state %d" ), pmcState ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16293 | status = eHAL_STATUS_FAILURE; |
| 16294 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16295 | case FULL_POWER: |
| 16296 | case REQUEST_FULL_POWER: |
| 16297 | default: |
| 16298 | //No need to ask for full power. This has to be FULL_POWER state |
| 16299 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16300 | } //switch |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16301 | if( pReason ) |
| 16302 | { |
| 16303 | *pReason = reason; |
| 16304 | } |
| 16305 | if( pfNeedPower ) |
| 16306 | { |
| 16307 | *pfNeedPower = fNeedFullPower; |
| 16308 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16309 | return ( status ); |
| 16310 | } |
| 16311 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16312 | static eHalStatus csrRequestFullPower( tpAniSirGlobal pMac, tSmeCmd *pCommand ) |
| 16313 | { |
| 16314 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16315 | tANI_BOOLEAN fNeedFullPower = eANI_BOOLEAN_FALSE; |
| 16316 | tRequestFullPowerReason reason = eSME_REASON_OTHER; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16317 | status = csrIsFullPowerNeeded( pMac, pCommand, &reason, &fNeedFullPower ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16318 | if( fNeedFullPower && HAL_STATUS_SUCCESS( status ) ) |
| 16319 | { |
| 16320 | status = pmcRequestFullPower(pMac, csrFullPowerCallback, pMac, reason); |
| 16321 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16322 | return ( status ); |
| 16323 | } |
| 16324 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16325 | tSmeCmd *csrGetCommandBuffer( tpAniSirGlobal pMac ) |
| 16326 | { |
| 16327 | tSmeCmd *pCmd = smeGetCommandBuffer( pMac ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16328 | if( pCmd ) |
| 16329 | { |
| 16330 | pMac->roam.sPendingCommands++; |
| 16331 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16332 | return ( pCmd ); |
| 16333 | } |
| 16334 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16335 | void csrReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCommand) |
| 16336 | { |
| 16337 | if (pMac->roam.sPendingCommands > 0) |
| 16338 | { |
| 16339 | //All command allocated through csrGetCommandBuffer need to |
| 16340 | //decrement the pending count when releasing. |
| 16341 | pMac->roam.sPendingCommands--; |
| 16342 | smeReleaseCommand( pMac, pCommand ); |
| 16343 | } |
| 16344 | else |
| 16345 | { |
| 16346 | smsLog(pMac, LOGE, FL( "no pending commands")); |
| 16347 | VOS_ASSERT(0); |
| 16348 | } |
| 16349 | } |
| 16350 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16351 | //Return SUCCESS is the command is queued, failed |
| 16352 | eHalStatus csrQueueSmeCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fHighPriority ) |
| 16353 | { |
| 16354 | eHalStatus status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16355 | if( (eSmeCommandScan == pCommand->command) && pMac->scan.fDropScanCmd ) |
| 16356 | { |
| 16357 | smsLog(pMac, LOGW, FL(" drop scan (scan reason %d) command"), |
| 16358 | pCommand->u.scanCmd.reason); |
| 16359 | return eHAL_STATUS_CSR_WRONG_STATE; |
| 16360 | } |
| 16361 | |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16362 | if ((pMac->fScanOffload) && (pCommand->command == eSmeCommandScan)) |
| 16363 | { |
| 16364 | csrLLInsertTail(&pMac->sme.smeScanCmdPendingList, |
| 16365 | &pCommand->Link, LL_ACCESS_LOCK); |
| 16366 | // process the command queue... |
| 16367 | smeProcessPendingQueue(pMac); |
| 16368 | status = eHAL_STATUS_SUCCESS; |
| 16369 | goto end; |
| 16370 | } |
| 16371 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16372 | //We can call request full power first before putting the command into pending Q |
| 16373 | //because we are holding SME lock at this point. |
| 16374 | status = csrRequestFullPower( pMac, pCommand ); |
| 16375 | if( HAL_STATUS_SUCCESS( status ) ) |
| 16376 | { |
| 16377 | tANI_BOOLEAN fNoCmdPending; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16378 | //make sure roamCmdPendingList is not empty first |
| 16379 | fNoCmdPending = csrLLIsListEmpty( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_FALSE ); |
| 16380 | if( fNoCmdPending ) |
| 16381 | { |
| 16382 | smePushCommand( pMac, pCommand, fHighPriority ); |
| 16383 | } |
| 16384 | else |
| 16385 | { |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16386 | //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] | 16387 | //no list lock is needed since SME lock is held |
| 16388 | if( !fHighPriority ) |
| 16389 | { |
| 16390 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 16391 | } |
| 16392 | else { |
| 16393 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 16394 | } |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16395 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16396 | } |
| 16397 | else if( eHAL_STATUS_PMC_PENDING == status ) |
| 16398 | { |
| 16399 | //no list lock is needed since SME lock is held |
| 16400 | if( !fHighPriority ) |
| 16401 | { |
| 16402 | csrLLInsertTail( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 16403 | } |
| 16404 | else { |
| 16405 | csrLLInsertHead( &pMac->roam.roamCmdPendingList, &pCommand->Link, eANI_BOOLEAN_FALSE ); |
| 16406 | } |
| 16407 | //Let caller know the command is queue |
| 16408 | status = eHAL_STATUS_SUCCESS; |
| 16409 | } |
| 16410 | else |
| 16411 | { |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16412 | //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] | 16413 | //release the command. |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16414 | smsLog( pMac, LOGE, FL( " cannot queue command %d" ), pCommand->command ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16415 | } |
Madan Mohan Koyyalamudi | e1a64b4 | 2013-06-19 16:34:44 +0530 | [diff] [blame] | 16416 | end: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16417 | return ( status ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16418 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16419 | eHalStatus csrRoamUpdateAPWPSIE( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirAPWPSIEs* pAPWPSIES ) |
| 16420 | { |
| 16421 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16422 | tSirUpdateAPWPSIEsReq *pMsg; |
| 16423 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
| 16424 | |
| 16425 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 16426 | if (NULL == pSession) |
| 16427 | { |
| 16428 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 16429 | return eHAL_STATUS_FAILURE; |
| 16430 | } |
| 16431 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16432 | do |
| 16433 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16434 | pMsg = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq)); |
| 16435 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 16436 | vos_mem_set(pMsg, sizeof(tSirUpdateAPWPSIEsReq), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16437 | pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_UPDATE_APWPSIE_REQ); |
| 16438 | |
| 16439 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 16440 | VOS_ASSERT(pBuf); |
| 16441 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16442 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16443 | // transactionId |
| 16444 | *pBuf = 0; |
| 16445 | *( pBuf + 1 ) = 0; |
| 16446 | pBuf += sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16447 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16448 | vos_mem_copy((tSirMacAddr *)pBuf, &pSession->selfMacAddr, |
| 16449 | sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16450 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16451 | //sessionId |
| 16452 | *pBuf++ = (tANI_U8)sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16453 | // APWPSIEs |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16454 | vos_mem_copy((tSirAPWPSIEs *)pBuf, pAPWPSIES, sizeof(tSirAPWPSIEs)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16455 | pBuf += sizeof(tSirAPWPSIEs); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16456 | 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] | 16457 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16458 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16459 | return ( status ); |
| 16460 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16461 | eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirRSNie * pAPSirRSNie) |
| 16462 | { |
| 16463 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16464 | tSirUpdateAPWPARSNIEsReq *pMsg; |
| 16465 | tANI_U8 *pBuf = NULL, *wTmpBuf = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16466 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 16467 | if (NULL == pSession) |
| 16468 | { |
| 16469 | smsLog( pMac, LOGE, FL( " Session does not exist for session id %d" ), sessionId); |
| 16470 | return eHAL_STATUS_FAILURE; |
| 16471 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16472 | do |
| 16473 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16474 | pMsg = vos_mem_malloc(sizeof(tSirUpdateAPWPARSNIEsReq)); |
| 16475 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 16476 | vos_mem_set(pMsg, sizeof( tSirUpdateAPWPARSNIEsReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16477 | 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] | 16478 | pBuf = (tANI_U8 *)&pMsg->transactionId; |
| 16479 | wTmpBuf = pBuf; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16480 | // transactionId |
| 16481 | *pBuf = 0; |
| 16482 | *( pBuf + 1 ) = 0; |
| 16483 | pBuf += sizeof(tANI_U16); |
lukez | 3c80922 | 2013-05-03 10:23:02 -0700 | [diff] [blame] | 16484 | VOS_ASSERT(pBuf); |
| 16485 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16486 | // bssId |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16487 | vos_mem_copy((tSirMacAddr *)pBuf, &pSession->selfMacAddr, |
| 16488 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16489 | pBuf += sizeof(tSirMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16490 | // sessionId |
| 16491 | *pBuf++ = (tANI_U8)sessionId; |
| 16492 | |
| 16493 | // APWPARSNIEs |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16494 | vos_mem_copy((tSirRSNie *)pBuf, pAPSirRSNie, sizeof(tSirRSNie)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16495 | pBuf += sizeof(tSirRSNie); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16496 | 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] | 16497 | status = palSendMBMessage(pMac->hHdd, pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16498 | } while( 0 ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16499 | return ( status ); |
| 16500 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16501 | |
| 16502 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 16503 | //eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId) |
| 16504 | eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription) |
| 16505 | { |
| 16506 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 16507 | tpSirFTPreAuthReq pftPreAuthReq; |
| 16508 | tANI_U16 auth_req_len = 0; |
| 16509 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16510 | auth_req_len = sizeof(tSirFTPreAuthReq); |
| 16511 | pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16512 | if (NULL == pftPreAuthReq) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16513 | { |
| 16514 | smsLog(pMac, LOGE, FL("Memory allocation for FT Preauth request failed")); |
| 16515 | return eHAL_STATUS_RESOURCES; |
| 16516 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16517 | // Save the SME Session ID here. We need it while processing the preauth response |
| 16518 | pMac->ft.ftSmeContext.smeSessionId = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16519 | vos_mem_zero(pftPreAuthReq, auth_req_len); |
| 16520 | |
| 16521 | pftPreAuthReq->pbssDescription = (tpSirBssDescription)vos_mem_malloc( |
| 16522 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 16523 | |
| 16524 | pftPreAuthReq->messageType = pal_cpu_to_be16(eWNI_SME_FT_PRE_AUTH_REQ); |
| 16525 | |
| 16526 | pftPreAuthReq->preAuthchannelNum = pBssDescription->channelId; |
| 16527 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16528 | vos_mem_copy((void *)&pftPreAuthReq->currbssId, |
| 16529 | (void *)pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
| 16530 | vos_mem_copy((void *)&pftPreAuthReq->preAuthbssId, |
| 16531 | (void *)pBssDescription->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16532 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16533 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 16534 | if (csrRoamIs11rAssoc(pMac) && |
| 16535 | (pMac->roam.roamSession[sessionId].connectedProfile.AuthType != eCSR_AUTH_TYPE_OPEN_SYSTEM)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16536 | { |
| 16537 | 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] | 16538 | vos_mem_copy(pftPreAuthReq->ft_ies, pMac->ft.ftSmeContext.auth_ft_ies, |
| 16539 | pMac->ft.ftSmeContext.auth_ft_ies_length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16540 | } |
| 16541 | else |
| 16542 | #endif |
| 16543 | { |
| 16544 | pftPreAuthReq->ft_ies_length = 0; |
| 16545 | } |
Madan Mohan Koyyalamudi | 613b0a4 | 2012-10-31 15:55:53 -0700 | [diff] [blame] | 16546 | vos_mem_copy(pftPreAuthReq->pbssDescription, pBssDescription, |
| 16547 | sizeof(pBssDescription->length) + pBssDescription->length); |
| 16548 | pftPreAuthReq->length = pal_cpu_to_be16(auth_req_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16549 | return palSendMBMessage(pMac->hHdd, pftPreAuthReq); |
| 16550 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16551 | /*-------------------------------------------------------------------------- |
| 16552 | * This will receive and process the FT Pre Auth Rsp from the current |
| 16553 | * associated ap. |
| 16554 | * |
| 16555 | * This will invoke the hdd call back. This is so that hdd can now |
| 16556 | * send the FTIEs from the Auth Rsp (Auth Seq 2) to the supplicant. |
| 16557 | ------------------------------------------------------------------------*/ |
| 16558 | void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuthRsp ) |
| 16559 | { |
| 16560 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 16561 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 16562 | #if defined(FEATURE_WLAN_LFR) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_CCX_UPLOAD) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16563 | tCsrRoamInfo roamInfo; |
| 16564 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16565 | |
| 16566 | #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 16567 | smsLog( pMac, LOGE, FL("Preauth response status code 0x%x"), pFTPreAuthRsp->status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16568 | #endif |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 16569 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 16570 | status = csrNeighborRoamPreauthRspHandler(pMac, pFTPreAuthRsp->status); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 16571 | if (status != eHAL_STATUS_SUCCESS) { |
| 16572 | /* |
| 16573 | * Bail out if pre-auth was not even processed. |
| 16574 | */ |
| 16575 | smsLog(pMac, LOGW, FL("Preauth was not processed: %d"), status); |
| 16576 | return; |
| 16577 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16578 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16579 | /* The below function calls/timers should be invoked only if the pre-auth is successful */ |
| 16580 | if (VOS_STATUS_SUCCESS != (VOS_STATUS)pFTPreAuthRsp->status) |
| 16581 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16582 | // Implies a success |
| 16583 | pMac->ft.ftSmeContext.FTState = eFT_AUTH_COMPLETE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16584 | // Indicate SME QoS module the completion of Preauth success. This will trigger the creation of RIC IEs |
| 16585 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = pFTPreAuthRsp; |
Tushnim Bhattacharyya | 8436d77 | 2013-06-26 23:03:29 -0700 | [diff] [blame] | 16586 | /* No need to notify qos module if this is a non 11r roam*/ |
| 16587 | if (csrRoamIs11rAssoc(pMac)) |
| 16588 | { |
| 16589 | sme_QosCsrEventInd(pMac, pMac->ft.ftSmeContext.smeSessionId, SME_QOS_CSR_PREAUTH_SUCCESS_IND, NULL); |
| 16590 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16591 | /* Start the pre-auth reassoc interval timer with a period of 400ms. When this expires, |
| 16592 | * actual transition from the current to handoff AP is triggered */ |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 16593 | status = vos_timer_start(&pMac->ft.ftSmeContext.preAuthReassocIntvlTimer, |
| 16594 | 60); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16595 | if (eHAL_STATUS_SUCCESS != status) |
| 16596 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16597 | 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] | 16598 | return; |
| 16599 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16600 | // Save the received response |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16601 | vos_mem_copy((void *)&pMac->ft.ftSmeContext.preAuthbssId, |
| 16602 | (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16603 | if (csrRoamIs11rAssoc(pMac)) |
| 16604 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, NULL, 0, |
| 16605 | eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE); |
| 16606 | |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 16607 | #if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD) |
| 16608 | if (csrRoamIsCCXAssoc(pMac)) |
| 16609 | { |
| 16610 | /* read TSF */ |
| 16611 | csrRoamReadTSF(pMac, (tANI_U8 *)roamInfo.timestamp); |
| 16612 | |
| 16613 | // Save the bssid from the received response |
| 16614 | palCopyMemory(pMac->hHdd, (void *)&roamInfo.bssid, (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
| 16615 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_CCKM_PREAUTH_NOTIFY, 0); |
| 16616 | } |
| 16617 | #endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16618 | #ifdef FEATURE_WLAN_LFR |
| 16619 | // If Legacy Fast Roaming is enabled, signal the supplicant |
| 16620 | // 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] | 16621 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16622 | { |
| 16623 | // Save the bssid from the received response |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16624 | vos_mem_copy((void *)&roamInfo.bssid, |
| 16625 | (void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16626 | csrRoamCallCallback(pMac, pFTPreAuthRsp->smeSessionId, &roamInfo, 0, eCSR_ROAM_PMK_NOTIFY, 0); |
| 16627 | } |
| 16628 | |
| 16629 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16630 | |
| 16631 | // Done with it, init it. |
| 16632 | pMac->ft.ftSmeContext.psavedFTPreAuthRsp = NULL; |
| 16633 | } |
| 16634 | #endif |
| 16635 | #ifdef FEATURE_WLAN_BTAMP_UT_RF |
| 16636 | void csrRoamJoinRetryTimerHandler(void *pv) |
| 16637 | { |
| 16638 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 16639 | tpAniSirGlobal pMac = pInfo->pMac; |
| 16640 | tANI_U32 sessionId = pInfo->sessionId; |
| 16641 | tCsrRoamSession *pSession; |
| 16642 | |
| 16643 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 16644 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16645 | 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] | 16646 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 16647 | if(pSession->pCurRoamProfile && csrIsConnStateDisconnected(pMac, sessionId)) |
| 16648 | { |
| 16649 | if( !HAL_STATUS_SUCCESS(csrRoamJoinLastProfile(pMac, sessionId)) ) |
| 16650 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16651 | smsLog( pMac, LOGE, FL( " fail to retry the last roam profile" ) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16652 | } |
| 16653 | } |
| 16654 | } |
| 16655 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16656 | eHalStatus csrRoamStartJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval) |
| 16657 | { |
| 16658 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 16659 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 16660 | |
| 16661 | if(pSession->pCurRoamProfile && pSession->maxRetryCount) |
| 16662 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16663 | 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] | 16664 | pSession->maxRetryCount--; |
| 16665 | pSession->joinRetryTimerInfo.pMac = pMac; |
| 16666 | pSession->joinRetryTimerInfo.sessionId = (tANI_U8)sessionId; |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 16667 | status = vos_timer_start(&pSession->hTimerJoinRetry, interval/PAL_TIMER_TO_MS_UNIT); |
| 16668 | if (!HAL_STATUS_SUCCESS(status)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16669 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16670 | smsLog(pMac, LOGE, FL(" fail to start timer status %s"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16671 | } |
| 16672 | } |
| 16673 | else |
| 16674 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16675 | 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] | 16676 | pSession->maxRetryCount); |
| 16677 | } |
| 16678 | |
| 16679 | return (status); |
| 16680 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16681 | eHalStatus csrRoamStopJoinRetryTimer(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 16682 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 16683 | smsLog(pMac, LOGE, " csrRoamStopJoinRetryTimer"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16684 | if( CSR_IS_SESSION_VALID(pMac, sessionId) ) |
| 16685 | { |
Madan Mohan Koyyalamudi | a48c681 | 2013-07-11 12:01:37 +0530 | [diff] [blame] | 16686 | return (vos_timer_stop(&pMac->roam.roamSession[sessionId].hTimerJoinRetry)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16687 | } |
| 16688 | |
| 16689 | return eHAL_STATUS_SUCCESS; |
| 16690 | } |
| 16691 | #endif |
| 16692 | |
| 16693 | |
| 16694 | /* |
| 16695 | pBuf points to the beginning of the message |
| 16696 | LIM packs disassoc rsp as below, |
| 16697 | messageType - 2 bytes |
| 16698 | messageLength - 2 bytes |
| 16699 | sessionId - 1 byte |
| 16700 | transactionId - 2 bytes (tANI_U16) |
| 16701 | reasonCode - 4 bytes (sizeof(tSirResultCodes)) |
| 16702 | peerMacAddr - 6 bytes |
| 16703 | The rest is conditionally defined of (WNI_POLARIS_FW_PRODUCT == AP) and not used |
| 16704 | */ |
| 16705 | static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp) |
| 16706 | { |
| 16707 | if(pBuf && pRsp) |
| 16708 | { |
| 16709 | pBuf += 4; //skip type and length |
| 16710 | pRsp->sessionId = *pBuf++; |
| 16711 | pal_get_U16( pBuf, (tANI_U16 *)&pRsp->transactionId ); |
| 16712 | pBuf += 2; |
| 16713 | pal_get_U32( pBuf, (tANI_U32 *)&pRsp->statusCode ); |
| 16714 | pBuf += 4; |
| 16715 | vos_mem_copy(pRsp->peerMacAddr, pBuf, 6); |
| 16716 | } |
| 16717 | } |
| 16718 | |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 16719 | eHalStatus csrGetDefaultCountryCodeFrmNv(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 16720 | { |
| 16721 | static uNvTables nvTables; |
| 16722 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16723 | VOS_STATUS vosStatus = vos_nv_readDefaultCountryTable( &nvTables ); |
| 16724 | |
| 16725 | /* read the country code from NV and use it */ |
| 16726 | if ( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 16727 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16728 | vos_mem_copy(pCountry, nvTables.defaultCountryTable.countryCode, |
| 16729 | WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 16730 | return status; |
| 16731 | } |
| 16732 | else |
| 16733 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16734 | vos_mem_copy(pCountry, "XXX", WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 16735 | status = eHAL_STATUS_FAILURE; |
| 16736 | return status; |
| 16737 | } |
| 16738 | } |
| 16739 | |
| 16740 | eHalStatus csrGetCurrentCountryCode(tpAniSirGlobal pMac, tANI_U8 *pCountry) |
| 16741 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16742 | vos_mem_copy(pCountry, pMac->scan.countryCode11d, WNI_CFG_COUNTRY_CODE_LEN); |
Jeff Johnson | d13512a | 2012-07-17 11:42:19 -0700 | [diff] [blame] | 16743 | return eHAL_STATUS_SUCCESS; |
| 16744 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 16745 | |
| 16746 | eHalStatus csrSetTxPower(tpAniSirGlobal pMac, v_U8_t sessionId, v_U8_t mW) |
| 16747 | { |
| 16748 | tSirSetTxPowerReq *pMsg = NULL; |
| 16749 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16750 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 16751 | |
| 16752 | if (!pSession) |
| 16753 | { |
| 16754 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 16755 | return eHAL_STATUS_FAILURE; |
| 16756 | } |
| 16757 | |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16758 | pMsg = vos_mem_malloc(sizeof(tSirSetTxPowerReq)); |
| 16759 | if ( NULL == pMsg ) return eHAL_STATUS_FAILURE; |
| 16760 | vos_mem_set((void *)pMsg, sizeof(tSirSetTxPowerReq), 0); |
| 16761 | pMsg->messageType = eWNI_SME_SET_TX_POWER_REQ; |
| 16762 | pMsg->length = sizeof(tSirSetTxPowerReq); |
| 16763 | pMsg->mwPower = mW; |
| 16764 | vos_mem_copy((tSirMacAddr *)pMsg->bssId, &pSession->selfMacAddr, |
| 16765 | sizeof(tSirMacAddr)); |
| 16766 | status = palSendMBMessage(pMac->hHdd, pMsg); |
| 16767 | if (!HAL_STATUS_SUCCESS(status)) |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 16768 | { |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16769 | smsLog(pMac, LOGE, FL(" csr set TX Power Post MSG Fail %d "), status); |
| 16770 | //pMsg is freed by palSendMBMessage |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 16771 | } |
| 16772 | return status; |
| 16773 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 16774 | |
| 16775 | /* Returns whether a session is in VOS_STA_MODE...or not */ |
| 16776 | tANI_BOOLEAN csrRoamIsStaMode(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 16777 | { |
| 16778 | tCsrRoamSession *pSession = NULL; |
| 16779 | pSession = CSR_GET_SESSION ( pMac, sessionId ); |
| 16780 | if(!pSession) |
| 16781 | { |
| 16782 | smsLog(pMac, LOGE, FL(" %s: session %d not found "), __func__, sessionId); |
| 16783 | return eANI_BOOLEAN_FALSE; |
| 16784 | } |
| 16785 | if ( !CSR_IS_SESSION_VALID ( pMac, sessionId ) ) |
| 16786 | { |
| 16787 | smsLog(pMac, LOGE, FL(" %s: Inactive session"), __func__); |
| 16788 | return eANI_BOOLEAN_FALSE; |
| 16789 | } |
| 16790 | if ( eCSR_BSS_TYPE_INFRASTRUCTURE != pSession->connectedProfile.BSSType ) |
| 16791 | { |
| 16792 | return eANI_BOOLEAN_FALSE; |
| 16793 | } |
| 16794 | /* There is a possibility that the above check may fail,because |
| 16795 | * P2P CLI also uses the same BSSType (eCSR_BSS_TYPE_INFRASTRUCTURE) |
| 16796 | * when it is connected.So,we may sneak through the above check even |
| 16797 | * if we are not a STA mode INFRA station. So, if we sneak through |
| 16798 | * the above condition, we can use the following check if we are |
| 16799 | * really in STA Mode.*/ |
| 16800 | |
| 16801 | if ( NULL != pSession->pCurRoamProfile ) |
| 16802 | { |
| 16803 | if ( pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE ) |
| 16804 | { |
| 16805 | return eANI_BOOLEAN_TRUE; |
| 16806 | } else { |
| 16807 | smsLog(pMac, LOGE, FL(" %s: pCurRoamProfile is NULL\n"), __func__); |
| 16808 | return eANI_BOOLEAN_FALSE; |
| 16809 | } |
| 16810 | } |
| 16811 | |
| 16812 | return eANI_BOOLEAN_FALSE; |
| 16813 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16814 | |
| 16815 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 16816 | eHalStatus csrHandoffRequest(tpAniSirGlobal pMac, |
| 16817 | tCsrHandoffRequest *pHandoffInfo) |
| 16818 | { |
| 16819 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16820 | vos_msg_t msg; |
| 16821 | |
| 16822 | tAniHandoffReq *pMsg; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16823 | pMsg = vos_mem_malloc(sizeof(tAniHandoffReq)); |
| 16824 | if ( NULL == pMsg ) |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16825 | { |
| 16826 | smsLog(pMac, LOGE, " csrHandoffRequest: failed to allocate mem for req "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16827 | return eHAL_STATUS_FAILURE; |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16828 | } |
| 16829 | pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_HANDOFF_REQ); |
| 16830 | pMsg->msgLen = (tANI_U16)sizeof(tAniHandoffReq); |
| 16831 | pMsg->sessionId = pMac->roam.neighborRoamInfo.csrSessionId; |
| 16832 | pMsg->channel = pHandoffInfo->channel; |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16833 | vos_mem_copy(pMsg->bssid, |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16834 | pHandoffInfo->bssid, |
| 16835 | 6); |
| 16836 | msg.type = eWNI_SME_HANDOFF_REQ; |
| 16837 | msg.bodyptr = pMsg; |
| 16838 | msg.reserved = 0; |
| 16839 | if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 16840 | { |
| 16841 | smsLog(pMac, LOGE, " csrHandoffRequest failed to post msg to self "); |
Kiet Lam | 64c1b49 | 2013-07-12 13:56:44 +0530 | [diff] [blame] | 16842 | vos_mem_free((void *)pMsg); |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 16843 | status = eHAL_STATUS_FAILURE; |
| 16844 | } |
| 16845 | return status; |
| 16846 | } |
| 16847 | #endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */ |
Srinivas Girigowda | 5cecb20 | 2013-10-08 09:13:25 -0700 | [diff] [blame] | 16848 | |
| 16849 | #if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD) |
| 16850 | /* --------------------------------------------------------------------------- |
| 16851 | \fn csrSetCCKMIe |
| 16852 | \brief This function stores the CCKM IE passed by the supplicant in a place holder |
| 16853 | data structure and this IE will be packed inside reassociation request |
| 16854 | \param pMac - pMac global structure |
| 16855 | \param sessionId - Current session id |
| 16856 | \param pCckmIe - pointer to CCKM IE data |
| 16857 | \param ccKmIeLen - length of the CCKM IE |
| 16858 | \- return Success or failure |
| 16859 | -------------------------------------------------------------------------*/ |
| 16860 | VOS_STATUS csrSetCCKMIe(tpAniSirGlobal pMac, const tANI_U8 sessionId, |
| 16861 | const tANI_U8 *pCckmIe, |
| 16862 | const tANI_U8 ccKmIeLen) |
| 16863 | { |
| 16864 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16865 | tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); |
| 16866 | |
| 16867 | if (!pSession) |
| 16868 | { |
| 16869 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 16870 | return eHAL_STATUS_FAILURE; |
| 16871 | } |
| 16872 | palCopyMemory(pMac->hHdd, pSession->suppCckmIeInfo.cckmIe, pCckmIe, ccKmIeLen); |
| 16873 | pSession->suppCckmIeInfo.cckmIeLen = ccKmIeLen; |
| 16874 | return status; |
| 16875 | } |
| 16876 | |
| 16877 | /* --------------------------------------------------------------------------- |
| 16878 | \fn csrRoamReadTSF |
| 16879 | \brief This function reads the TSF; and also add the time elapsed since last beacon or |
| 16880 | probe response reception from the hand off AP to arrive at the latest TSF value. |
| 16881 | \param pMac - pMac global structure |
| 16882 | \param pTimestamp - output TSF timestamp |
| 16883 | \- return Success or failure |
| 16884 | -------------------------------------------------------------------------*/ |
| 16885 | VOS_STATUS csrRoamReadTSF(tpAniSirGlobal pMac, tANI_U8 *pTimestamp) |
| 16886 | { |
| 16887 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 16888 | tCsrNeighborRoamBSSInfo handoffNode; |
| 16889 | tANI_U32 timer_diff = 0; |
| 16890 | tANI_U32 timeStamp[2]; |
| 16891 | tpSirBssDescription pBssDescription = NULL; |
| 16892 | |
| 16893 | csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode); |
| 16894 | pBssDescription = handoffNode.pBssDescription; |
| 16895 | |
| 16896 | // Get the time diff in milli seconds |
| 16897 | timer_diff = vos_timer_get_system_time() - pBssDescription->scanSysTimeMsec; |
| 16898 | // Convert msec to micro sec timer |
| 16899 | timer_diff = (tANI_U32)(timer_diff * SYSTEM_TIME_MSEC_TO_USEC); |
| 16900 | |
| 16901 | timeStamp[0] = pBssDescription->timeStamp[0]; |
| 16902 | timeStamp[1] = pBssDescription->timeStamp[1]; |
| 16903 | |
| 16904 | UpdateCCKMTSF(&(timeStamp[0]), &(timeStamp[1]), &timer_diff); |
| 16905 | |
| 16906 | palCopyMemory(pMac->hHdd, pTimestamp, (void *) &timeStamp[0], |
| 16907 | sizeof (tANI_U32) * 2); |
| 16908 | return status; |
| 16909 | } |
| 16910 | |
| 16911 | #endif /*FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */ |
| 16912 | |