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 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 44 | * This file limLinkMonitoringAlgo.cc contains the code for |
| 45 | * Link monitoring algorithm on AP and heart beat failure |
| 46 | * handling on STA. |
| 47 | * Author: Chandra Modumudi |
| 48 | * Date: 03/01/02 |
| 49 | * History:- |
| 50 | * Date Modified by Modification Information |
| 51 | * -------------------------------------------------------------------- |
| 52 | * |
| 53 | */ |
| 54 | |
| 55 | #include "aniGlobal.h" |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 56 | #include "wniCfgSta.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 57 | #include "cfgApi.h" |
| 58 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 59 | |
| 60 | #include "schApi.h" |
| 61 | #include "pmmApi.h" |
| 62 | #include "utilsApi.h" |
| 63 | #include "limAssocUtils.h" |
| 64 | #include "limTypes.h" |
| 65 | #include "limUtils.h" |
| 66 | #include "limPropExtsUtils.h" |
| 67 | |
| 68 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 69 | #include "vos_diag_core_log.h" |
| 70 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 71 | #include "limSession.h" |
| 72 | #include "limSerDesUtils.h" |
| 73 | |
| 74 | |
| 75 | /** |
| 76 | * limSendKeepAliveToPeer() |
| 77 | * |
| 78 | *FUNCTION: |
| 79 | * This function is called to send Keep alive message to peer |
| 80 | * |
| 81 | *LOGIC: |
| 82 | * |
| 83 | *ASSUMPTIONS: |
| 84 | * |
| 85 | *NOTE: |
| 86 | * NA |
| 87 | * |
| 88 | * @param pMac - Pointer to Global MAC structure |
| 89 | * @return None |
| 90 | */ |
| 91 | |
| 92 | void |
| 93 | limSendKeepAliveToPeer(tpAniSirGlobal pMac) |
| 94 | { |
| 95 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 96 | } /*** limSendKeepAliveToPeer() ***/ |
| 97 | |
| 98 | |
| 99 | /** --------------------------------------------------------- |
| 100 | \fn limDeleteStaContext |
| 101 | \brief This function handles the message from HAL: |
| 102 | \ WDA_DELETE_STA_CONTEXT_IND. This function |
| 103 | \ validates that the given station id exist, and if so, |
| 104 | \ deletes the station by calling limTriggerSTAdeletion. |
| 105 | \param tpAniSirGlobal pMac |
| 106 | \param tpSirMsgQ limMsg |
| 107 | \return none |
| 108 | -----------------------------------------------------------*/ |
| 109 | void |
| 110 | limDeleteStaContext(tpAniSirGlobal pMac, tpSirMsgQ limMsg) |
| 111 | { |
| 112 | tpDeleteStaContext pMsg = (tpDeleteStaContext)limMsg->bodyptr; |
| 113 | tpDphHashNode pStaDs; |
| 114 | tpPESession psessionEntry ; |
| 115 | tANI_U8 sessionId; |
| 116 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 117 | if(NULL == pMsg) |
| 118 | { |
| 119 | PELOGE(limLog(pMac, LOGE,FL("Invalid body pointer in message\n"));) |
| 120 | return; |
| 121 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 122 | if((psessionEntry = peFindSessionByBssid(pMac,pMsg->bssId,&sessionId))== NULL) |
| 123 | { |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 124 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));) |
| 125 | palFreeMemory(pMac->hHdd, pMsg); |
| 126 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 129 | switch(pMsg->reasonCode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 130 | { |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 131 | case HAL_DEL_STA_REASON_CODE_KEEP_ALIVE: |
| 132 | case HAL_DEL_STA_REASON_CODE_TIM_BASED: |
| 133 | PELOGE(limLog(pMac, LOGE, FL(" Deleting station: staId = %d, reasonCode = %d\n"), pMsg->staId, pMsg->reasonCode);) |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 134 | pStaDs = dphGetHashEntry(pMac, pMsg->assocId, &psessionEntry->dph.dphHashTable); |
| 135 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 136 | if (!pStaDs) |
| 137 | { |
| 138 | PELOGE(limLog(pMac, LOGE, FL("Skip STA deletion (invalid STA) limSystemRole=%d\n"),psessionEntry->limSystemRole);) |
| 139 | palFreeMemory(pMac->hHdd, pMsg); |
| 140 | return; |
| 141 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 142 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 143 | /* check and see if same staId. This is to avoid the scenario |
| 144 | * where we're trying to delete a staId we just added. |
| 145 | */ |
| 146 | if (pStaDs->staIndex != pMsg->staId) |
| 147 | { |
| 148 | PELOGE(limLog(pMac, LOGE, FL("staid mismatch: %d vs %d \n"), pStaDs->staIndex, pMsg->staId);) |
| 149 | palFreeMemory(pMac->hHdd, pMsg); |
| 150 | return; |
| 151 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 152 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 153 | if((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) || |
| 154 | (eLIM_AP_ROLE == psessionEntry->limSystemRole)) |
| 155 | { |
| 156 | PELOG1(limLog(pMac, LOG1, FL("SAP:lim Delete Station Context (staId: %d, assocId: %d) \n"), |
| 157 | pMsg->staId, pMsg->assocId);) |
| 158 | limTriggerSTAdeletion(pMac, pStaDs, psessionEntry); |
| 159 | } |
| 160 | else |
| 161 | { |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 162 | #ifdef FEATURE_WLAN_TDLS |
| 163 | if(eLIM_STA_ROLE == psessionEntry->limSystemRole && |
| 164 | STA_ENTRY_TDLS_PEER == pStaDs->staType) |
| 165 | { |
| 166 | //TeardownLink with PEER |
| 167 | //Reason code HAL_DEL_STA_REASON_CODE_KEEP_ALIVE means |
| 168 | //eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE |
| 169 | limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry, |
| 170 | /*pMsg->reasonCode*/ eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE); |
| 171 | } |
| 172 | else |
| 173 | { |
| 174 | #endif |
| 175 | //TearDownLink with AP |
| 176 | tLimMlmDeauthInd mlmDeauthInd; |
| 177 | PELOGW(limLog(pMac, LOGW, FL("lim Delete Station Context (staId: %d, assocId: %d) \n"), |
| 178 | pMsg->staId, pMsg->assocId);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 179 | |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 180 | pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON; |
| 181 | pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 182 | |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 183 | // Issue Deauth Indication to SME. |
| 184 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr, |
| 185 | pStaDs->staAddr, sizeof(tSirMacAddr)); |
| 186 | mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason; |
| 187 | mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 188 | |
Gopichand Nakkala | ca35d29 | 2013-03-05 11:06:03 -0800 | [diff] [blame^] | 189 | #ifdef FEATURE_WLAN_TDLS |
| 190 | /* Delete all TDLS peers connected before leaving BSS*/ |
| 191 | limDeleteTDLSPeers(pMac, psessionEntry); |
| 192 | #endif |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 193 | limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd); |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 194 | |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 195 | limSendSmeDeauthInd(pMac, pStaDs, psessionEntry); |
| 196 | #ifdef FEATURE_WLAN_TDLS |
| 197 | } |
| 198 | #endif |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 199 | } |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 200 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 201 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 202 | case HAL_DEL_STA_REASON_CODE_UNKNOWN_A2: |
| 203 | PELOGE(limLog(pMac, LOGE, FL(" Deleting Unknown station \n"));) |
| 204 | limPrintMacAddr(pMac, pMsg->addr2, LOGE); |
| 205 | limSendDeauthMgmtFrame( pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMsg->addr2, psessionEntry, FALSE); |
| 206 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 207 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 208 | default: |
| 209 | PELOGE(limLog(pMac, LOGE, FL(" Unknown reason code \n"));) |
| 210 | break; |
| 211 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 212 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 213 | palFreeMemory(pMac->hHdd, pMsg); |
| 214 | return; |
| 215 | } |
| 216 | |
| 217 | |
| 218 | /** |
| 219 | * limTriggerSTAdeletion() |
| 220 | * |
| 221 | *FUNCTION: |
| 222 | * This function is called to trigger STA context deletion |
| 223 | * |
| 224 | *LOGIC: |
| 225 | * |
| 226 | *ASSUMPTIONS: |
| 227 | * |
| 228 | *NOTE: |
| 229 | * NA |
| 230 | * |
| 231 | * @param pMac - Pointer to global MAC structure |
| 232 | * @param pStaDs - Pointer to internal STA Datastructure |
| 233 | * @return None |
| 234 | */ |
| 235 | void |
| 236 | limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry) |
| 237 | { |
| 238 | tSirSmeDeauthReq *pSmeDeauthReq; |
| 239 | tANI_U8 *pBuf; |
| 240 | tANI_U8 *pLen; |
| 241 | tANI_U16 msgLength = 0; |
| 242 | |
| 243 | if (! pStaDs) |
| 244 | { |
| 245 | PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)\n"));) |
| 246 | return; |
| 247 | } |
| 248 | /** |
| 249 | * MAC based Authentication was used. Trigger |
| 250 | * Deauthentication frame to peer since it will |
| 251 | * take care of disassociation as well. |
| 252 | */ |
| 253 | |
| 254 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeDeauthReq, sizeof(tSirSmeDeauthReq))) |
| 255 | { |
| 256 | limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DEAUTH_REQ \n")); |
| 257 | return; |
| 258 | } |
| 259 | |
| 260 | pBuf = (tANI_U8 *) &pSmeDeauthReq->messageType; |
| 261 | |
| 262 | //messageType |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 263 | limCopyU16((tANI_U8*)pBuf, eWNI_SME_DISASSOC_REQ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 264 | pBuf += sizeof(tANI_U16); |
| 265 | msgLength += sizeof(tANI_U16); |
| 266 | |
| 267 | //length |
| 268 | pLen = pBuf; |
| 269 | pBuf += sizeof(tANI_U16); |
| 270 | msgLength += sizeof(tANI_U16); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 271 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 272 | //sessionId |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 273 | *pBuf = psessionEntry->smeSessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 274 | pBuf++; |
| 275 | msgLength++; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 276 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 277 | //transactionId |
| 278 | limCopyU16((tANI_U8*)pBuf, psessionEntry->transactionId); |
| 279 | pBuf += sizeof(tANI_U16); |
| 280 | msgLength += sizeof(tANI_U16); |
| 281 | |
| 282 | //bssId |
| 283 | palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr) ); |
| 284 | pBuf += sizeof(tSirMacAddr); |
| 285 | msgLength += sizeof(tSirMacAddr); |
| 286 | |
| 287 | //peerMacAddr |
| 288 | palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr) ); |
| 289 | pBuf += sizeof(tSirMacAddr); |
| 290 | msgLength += sizeof(tSirMacAddr); |
| 291 | |
| 292 | //reasonCode |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | limCopyU16((tANI_U8*)pBuf, (tANI_U16)eLIM_LINK_MONITORING_DISASSOC); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 294 | pBuf += sizeof(tANI_U16); |
| 295 | msgLength += sizeof(tANI_U16); |
| 296 | |
| 297 | //Do not send disassoc OTA |
| 298 | //pBuf[0] = 1 means do not send the disassoc frame over the air |
| 299 | //pBuf[0] = 0 means send the disassoc frame over the air |
| 300 | pBuf[0]= 0; |
| 301 | pBuf += sizeof(tANI_U8); |
| 302 | msgLength += sizeof(tANI_U8); |
| 303 | |
| 304 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 305 | |
| 306 | //Fill in length |
| 307 | limCopyU16((tANI_U8*)pLen, msgLength); |
| 308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 309 | limPostSmeMessage(pMac, eWNI_SME_DISASSOC_REQ, (tANI_U32 *) pSmeDeauthReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 310 | palFreeMemory( pMac->hHdd, pSmeDeauthReq ); |
| 311 | |
| 312 | } /*** end limTriggerSTAdeletion() ***/ |
| 313 | |
| 314 | |
| 315 | |
| 316 | /** |
| 317 | * limTearDownLinkWithAp() |
| 318 | * |
| 319 | *FUNCTION: |
| 320 | * This function is called when heartbeat (beacon reception) |
| 321 | * fails on STA |
| 322 | * |
| 323 | *LOGIC: |
| 324 | * |
| 325 | *ASSUMPTIONS: |
| 326 | * |
| 327 | *NOTE: |
| 328 | * |
| 329 | * @param pMac - Pointer to Global MAC structure |
| 330 | * @return None |
| 331 | */ |
| 332 | |
| 333 | void |
| 334 | limTearDownLinkWithAp(tpAniSirGlobal pMac, tANI_U8 sessionId, tSirMacReasonCodes reasonCode) |
| 335 | { |
| 336 | tpDphHashNode pStaDs = NULL; |
| 337 | |
| 338 | //tear down the following sessionEntry |
| 339 | tpPESession psessionEntry; |
| 340 | |
| 341 | if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL) |
| 342 | { |
| 343 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n")); |
| 344 | return; |
| 345 | } |
| 346 | /** |
| 347 | * Heart beat failed for upto threshold value |
| 348 | * and AP did not respond for Probe request. |
| 349 | * Trigger link tear down. |
| 350 | */ |
| 351 | |
| 352 | pMac->pmm.inMissedBeaconScenario = FALSE; |
| 353 | limLog(pMac, LOGW, |
| 354 | FL("No ProbeRsp from AP after HB failure. Tearing down link\n")); |
| 355 | |
| 356 | // Deactivate heartbeat timer |
| 357 | limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry); |
| 358 | |
| 359 | // Announce loss of link to Roaming algorithm |
| 360 | // and cleanup by sending SME_DISASSOC_REQ to SME |
| 361 | |
| 362 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 363 | |
| 364 | |
| 365 | if (pStaDs != NULL) |
| 366 | { |
| 367 | tLimMlmDeauthInd mlmDeauthInd; |
| 368 | |
Gopichand Nakkala | e9b72e1 | 2013-02-27 20:51:16 -0800 | [diff] [blame] | 369 | #ifdef FEATURE_WLAN_TDLS |
| 370 | /* Delete all TDLS peers connected before leaving BSS*/ |
| 371 | limDeleteTDLSPeers(pMac, psessionEntry); |
| 372 | #endif |
| 373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 374 | pStaDs->mlmStaContext.disassocReason = reasonCode; |
| 375 | pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH; |
| 376 | |
| 377 | /// Issue Deauth Indication to SME. |
| 378 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr, |
| 379 | pStaDs->staAddr, |
| 380 | sizeof(tSirMacAddr)); |
| 381 | mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason; |
| 382 | mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger; |
| 383 | |
| 384 | limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd); |
| 385 | |
| 386 | limSendSmeDeauthInd(pMac, pStaDs, psessionEntry); |
| 387 | } |
| 388 | } /*** limTearDownLinkWithAp() ***/ |
| 389 | |
| 390 | |
| 391 | |
| 392 | |
| 393 | /** |
| 394 | * limHandleHeartBeatFailure() |
| 395 | * |
| 396 | *FUNCTION: |
| 397 | * This function is called when heartbeat (beacon reception) |
| 398 | * fails on STA |
| 399 | * |
| 400 | *LOGIC: |
| 401 | * |
| 402 | *ASSUMPTIONS: |
| 403 | * |
| 404 | *NOTE: |
| 405 | * |
| 406 | * @param pMac - Pointer to Global MAC structure |
| 407 | * @return None |
| 408 | */ |
| 409 | |
| 410 | void limHandleHeartBeatFailure(tpAniSirGlobal pMac,tpPESession psessionEntry) |
| 411 | { |
| 412 | |
| 413 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 414 | vos_log_beacon_update_pkt_type *log_ptr = NULL; |
| 415 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 416 | |
| 417 | /* If gLimHeartBeatTimer fires between the interval of sending WDA_ENTER_BMPS_REQUEST |
| 418 | * to the HAL and receiving WDA_ENTER_BMPS_RSP from the HAL, then LIM (PE) tries to Process the |
| 419 | * SIR_LIM_HEAR_BEAT_TIMEOUT message but The PE state is ePMM_STATE_BMPS_SLEEP so PE dont |
| 420 | * want to handle heartbeat timeout in the BMPS, because Firmware handles it in BMPS. |
| 421 | * So just return from heartbeatfailure handler |
| 422 | */ |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 423 | if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE && (!limIsSystemInActiveState(pMac))) |
| 424 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 425 | |
| 426 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 427 | WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_beacon_update_pkt_type, LOG_WLAN_BEACON_UPDATE_C); |
| 428 | if(log_ptr) |
| 429 | log_ptr->bcn_rx_cnt = psessionEntry->LimRxedBeaconCntDuringHB; |
| 430 | WLAN_VOS_DIAG_LOG_REPORT(log_ptr); |
| 431 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 432 | |
| 433 | /* Ensure HB Status for the session has been reseted */ |
| 434 | psessionEntry->LimHBFailureStatus = eANI_BOOLEAN_FALSE; |
| 435 | /** Re Activate Timer if the system is Waiting for ReAssoc Response*/ |
| 436 | if(((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) || |
| 437 | (psessionEntry->limSystemRole == eLIM_STA_ROLE) || |
| 438 | (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) && |
| 439 | (LIM_IS_CONNECTION_ACTIVE(psessionEntry) || |
| 440 | (limIsReassocInProgress(pMac, psessionEntry)))) |
| 441 | { |
| 442 | if(psessionEntry->LimRxedBeaconCntDuringHB < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL) |
| 443 | pMac->lim.gLimHeartBeatBeaconStats[psessionEntry->LimRxedBeaconCntDuringHB]++; |
| 444 | else |
| 445 | pMac->lim.gLimHeartBeatBeaconStats[0]++; |
| 446 | |
| 447 | /****** |
| 448 | * Note: Use this code once you have converted all |
| 449 | * limReactivateHeartBeatTimer() calls to |
| 450 | * limReactivateTimer() calls. |
| 451 | * |
| 452 | ******/ |
| 453 | //limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER, psessionEntry); |
| 454 | limReactivateHeartBeatTimer(pMac, psessionEntry); |
| 455 | |
| 456 | // Reset number of beacons received |
| 457 | limResetHBPktCount(psessionEntry); |
| 458 | return; |
| 459 | } |
| 460 | if (((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&& |
| 461 | (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)) |
| 462 | { |
| 463 | if (!pMac->sys.gSysEnableLinkMonitorMode) |
| 464 | return; |
| 465 | |
| 466 | /** |
| 467 | * Beacon frame not received within heartbeat timeout. |
| 468 | */ |
| 469 | PELOGW(limLog(pMac, LOGW, FL("Heartbeat Failure\n"));) |
| 470 | pMac->lim.gLimHBfailureCntInLinkEstState++; |
| 471 | |
| 472 | /** |
| 473 | * Check if connected on the DFS channel, if not connected on |
| 474 | * DFS channel then only send the probe request otherwise tear down the link |
| 475 | */ |
| 476 | if(!limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel)) |
| 477 | { |
| 478 | /*** Detected continuous Beacon Misses ***/ |
| 479 | psessionEntry->LimHBFailureStatus= eANI_BOOLEAN_TRUE; |
| 480 | /** |
| 481 | * Send Probe Request frame to AP to see if |
| 482 | * it is still around. Wait until certain |
| 483 | * timeout for Probe Response from AP. |
| 484 | */ |
| 485 | PELOGW(limLog(pMac, LOGW, FL("Heart Beat missed from AP. Sending Probe Req\n"));) |
| 486 | /* for searching AP, we don't include any additional IE */ |
| 487 | limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId, |
| 488 | psessionEntry->currentOperChannel,psessionEntry->selfMacAddr, |
| 489 | psessionEntry->dot11mode, 0, NULL); |
| 490 | } |
| 491 | else |
| 492 | { |
| 493 | /* Connected on DFS channel so should not send the probe request |
| 494 | * tear down the link directly */ |
| 495 | limTearDownLinkWithAp(pMac, psessionEntry->peSessionId, eSIR_MAC_UNSPEC_FAILURE_REASON); |
| 496 | } |
| 497 | } |
| 498 | else |
| 499 | { |
| 500 | /** |
| 501 | * Heartbeat timer may have timed out |
| 502 | * while we're doing background scanning/learning |
| 503 | * or in states other than link-established state. |
| 504 | * Log error. |
| 505 | */ |
| 506 | PELOG1(limLog(pMac, LOG1, FL("received heartbeat timeout in state %X\n"), |
| 507 | psessionEntry->limMlmState);) |
| 508 | limPrintMlmState(pMac, LOG1, psessionEntry->limMlmState); |
| 509 | pMac->lim.gLimHBfailureCntInOtherStates++; |
| 510 | limReactivateHeartBeatTimer(pMac, psessionEntry); |
| 511 | } |
| 512 | } /*** limHandleHeartBeatFailure() ***/ |