blob: b8de1aa3610c7f65d0f4b61544fa070f19d65a52 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * 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 Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
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"
56#include "wniCfgAp.h"
57#include "cfgApi.h"
58
Jeff Johnson295189b2012-06-20 16:38:30 -070059
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
92void
93limSendKeepAliveToPeer(tpAniSirGlobal pMac)
94{
95
96#ifdef ANI_PRODUCT_TYPE_AP //oct 3rd review
97
98 tpDphHashNode pStaDs;
99 //fetch the sessionEntry based on the sessionId
100 tpPESession psessionEntry;
101
102 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimKeepaliveTimer.sessionId))== NULL)
103 {
104 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
105 return;
106 }
107
108 // If keep live has been disabled, exit
109 if (pMac->sch.keepAlive == 0)
110 return;
111
112 if ( (limIsSystemInScanState(pMac) == false) &&
113 (psessionEntry->limSystemRole == eLIM_AP_ROLE))
114 {
115 tANI_U16 i;
116 tANI_U32 len = SIR_MAC_MAX_SSID_LENGTH;
117 tAniSSID ssId;
118
119 /*
120 ** send keepalive NULL data frame for each
121 ** associated STA;
122 */
123
124 for (i=2; i<pMac->lim.maxStation; i++)
125 {
126 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
127
128 if (pStaDs && pStaDs->added &&
129 (pStaDs->mlmStaContext.mlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))
130 {
131 // SP-Tx hangs at times when a zero-lenght packet is transmitted
132 // To avoid any interoperability issue with third party clinet
133 // instead of sending a non-zero data-null packet, AP sends a
134 // probe response as a keep alive packet.
135 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID,
136 (tANI_U8 *) &ssId.ssId,
137 (tANI_U32 *) &len) != eSIR_SUCCESS)
138 {
139 /// Could not get SSID from CFG. Log error.
140 limLog(pMac, LOGP, FL("could not retrieve SSID\n"));
141 }
142 ssId.length = (tANI_U8) len;
143
144 PELOG2(limLog(pMac, LOG2, FL("Sending keepalive Probe Rsp Msg to "));
145 limPrintMacAddr(pMac, pStaDs->staAddr, LOG2);)
146 limSendProbeRspMgmtFrame(pMac,
147 pStaDs->staAddr,
148 &ssId,
149 i,
150 DPH_KEEPALIVE_FRAME, 0);
151 }
152 }
153 }
154 #endif
155} /*** limSendKeepAliveToPeer() ***/
156
157
158/** ---------------------------------------------------------
159\fn limDeleteStaContext
160\brief This function handles the message from HAL:
161\ WDA_DELETE_STA_CONTEXT_IND. This function
162\ validates that the given station id exist, and if so,
163\ deletes the station by calling limTriggerSTAdeletion.
164\param tpAniSirGlobal pMac
165\param tpSirMsgQ limMsg
166\return none
167 -----------------------------------------------------------*/
168void
169limDeleteStaContext(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
170{
171 tpDeleteStaContext pMsg = (tpDeleteStaContext)limMsg->bodyptr;
172 tpDphHashNode pStaDs;
173 tpPESession psessionEntry ;
174 tANI_U8 sessionId;
175
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530176 if(NULL == pMsg)
177 {
178 PELOGE(limLog(pMac, LOGE,FL("Invalid body pointer in message\n"));)
179 return;
180 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700181 if((psessionEntry = peFindSessionByBssid(pMac,pMsg->bssId,&sessionId))== NULL)
182 {
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530183 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
184 palFreeMemory(pMac->hHdd, pMsg);
185 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700186 }
187
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530188 switch(pMsg->reasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 {
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530190 case HAL_DEL_STA_REASON_CODE_KEEP_ALIVE:
191 case HAL_DEL_STA_REASON_CODE_TIM_BASED:
192 PELOGE(limLog(pMac, LOGE, FL(" Deleting station: staId = %d, reasonCode = %d\n"), pMsg->staId, pMsg->reasonCode);)
Hoonki Leee6bfe942013-02-05 15:01:19 -0800193 pStaDs = dphGetHashEntry(pMac, pMsg->assocId, &psessionEntry->dph.dphHashTable);
194
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530195 if (!pStaDs)
196 {
197 PELOGE(limLog(pMac, LOGE, FL("Skip STA deletion (invalid STA) limSystemRole=%d\n"),psessionEntry->limSystemRole);)
198 palFreeMemory(pMac->hHdd, pMsg);
199 return;
200 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700201
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530202 /* check and see if same staId. This is to avoid the scenario
203 * where we're trying to delete a staId we just added.
204 */
205 if (pStaDs->staIndex != pMsg->staId)
206 {
207 PELOGE(limLog(pMac, LOGE, FL("staid mismatch: %d vs %d \n"), pStaDs->staIndex, pMsg->staId);)
208 palFreeMemory(pMac->hHdd, pMsg);
209 return;
210 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700211
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530212 if((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) ||
213 (eLIM_AP_ROLE == psessionEntry->limSystemRole))
214 {
215 PELOG1(limLog(pMac, LOG1, FL("SAP:lim Delete Station Context (staId: %d, assocId: %d) \n"),
216 pMsg->staId, pMsg->assocId);)
217 limTriggerSTAdeletion(pMac, pStaDs, psessionEntry);
218 }
219 else
220 {
Hoonki Leee6bfe942013-02-05 15:01:19 -0800221#ifdef FEATURE_WLAN_TDLS
222 if(eLIM_STA_ROLE == psessionEntry->limSystemRole &&
223 STA_ENTRY_TDLS_PEER == pStaDs->staType)
224 {
225 //TeardownLink with PEER
226 //Reason code HAL_DEL_STA_REASON_CODE_KEEP_ALIVE means
227 //eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE
228 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
229 /*pMsg->reasonCode*/ eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE);
230 }
231 else
232 {
233#endif
234 //TearDownLink with AP
235 tLimMlmDeauthInd mlmDeauthInd;
236 PELOGW(limLog(pMac, LOGW, FL("lim Delete Station Context (staId: %d, assocId: %d) \n"),
237 pMsg->staId, pMsg->assocId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700238
Hoonki Leee6bfe942013-02-05 15:01:19 -0800239 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
240 pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;
Jeff Johnson295189b2012-06-20 16:38:30 -0700241
Hoonki Leee6bfe942013-02-05 15:01:19 -0800242 // Issue Deauth Indication to SME.
243 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr,
244 pStaDs->staAddr, sizeof(tSirMacAddr));
245 mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
246 mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -0700247
Hoonki Leee6bfe942013-02-05 15:01:19 -0800248 limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530249
Hoonki Leee6bfe942013-02-05 15:01:19 -0800250 limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
251#ifdef FEATURE_WLAN_TDLS
252 }
253#endif
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530254 }
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530255 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700256
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530257 case HAL_DEL_STA_REASON_CODE_UNKNOWN_A2:
258 PELOGE(limLog(pMac, LOGE, FL(" Deleting Unknown station \n"));)
259 limPrintMacAddr(pMac, pMsg->addr2, LOGE);
260 limSendDeauthMgmtFrame( pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMsg->addr2, psessionEntry, FALSE);
261 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700262
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530263 default:
264 PELOGE(limLog(pMac, LOGE, FL(" Unknown reason code \n"));)
265 break;
266
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700268 palFreeMemory(pMac->hHdd, pMsg);
269 return;
270}
271
272
273/**
274 * limTriggerSTAdeletion()
275 *
276 *FUNCTION:
277 * This function is called to trigger STA context deletion
278 *
279 *LOGIC:
280 *
281 *ASSUMPTIONS:
282 *
283 *NOTE:
284 * NA
285 *
286 * @param pMac - Pointer to global MAC structure
287 * @param pStaDs - Pointer to internal STA Datastructure
288 * @return None
289 */
290void
291limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
292{
293 tSirSmeDeauthReq *pSmeDeauthReq;
294 tANI_U8 *pBuf;
295 tANI_U8 *pLen;
296 tANI_U16 msgLength = 0;
297
298 if (! pStaDs)
299 {
300 PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)\n"));)
301 return;
302 }
303 /**
304 * MAC based Authentication was used. Trigger
305 * Deauthentication frame to peer since it will
306 * take care of disassociation as well.
307 */
308
309 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeDeauthReq, sizeof(tSirSmeDeauthReq)))
310 {
311 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DEAUTH_REQ \n"));
312 return;
313 }
314
315 pBuf = (tANI_U8 *) &pSmeDeauthReq->messageType;
316
317 //messageType
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 limCopyU16((tANI_U8*)pBuf, eWNI_SME_DISASSOC_REQ);
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 pBuf += sizeof(tANI_U16);
320 msgLength += sizeof(tANI_U16);
321
322 //length
323 pLen = pBuf;
324 pBuf += sizeof(tANI_U16);
325 msgLength += sizeof(tANI_U16);
Jeff Johnsone7245742012-09-05 17:12:55 -0700326
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 //sessionId
Jeff Johnsone7245742012-09-05 17:12:55 -0700328 *pBuf = psessionEntry->smeSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 pBuf++;
330 msgLength++;
Jeff Johnsone7245742012-09-05 17:12:55 -0700331
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 //transactionId
333 limCopyU16((tANI_U8*)pBuf, psessionEntry->transactionId);
334 pBuf += sizeof(tANI_U16);
335 msgLength += sizeof(tANI_U16);
336
337 //bssId
338 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr) );
339 pBuf += sizeof(tSirMacAddr);
340 msgLength += sizeof(tSirMacAddr);
341
342 //peerMacAddr
343 palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr) );
344 pBuf += sizeof(tSirMacAddr);
345 msgLength += sizeof(tSirMacAddr);
346
347 //reasonCode
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 limCopyU16((tANI_U8*)pBuf, (tANI_U16)eLIM_LINK_MONITORING_DISASSOC);
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 pBuf += sizeof(tANI_U16);
350 msgLength += sizeof(tANI_U16);
351
352 //Do not send disassoc OTA
353 //pBuf[0] = 1 means do not send the disassoc frame over the air
354 //pBuf[0] = 0 means send the disassoc frame over the air
355 pBuf[0]= 0;
356 pBuf += sizeof(tANI_U8);
357 msgLength += sizeof(tANI_U8);
358
359
360#if (WNI_POLARIS_FW_PRODUCT == AP)
361 //aid
362 limCopyU16((tANI_U8*)pBuf, pStaDs->assocId);
363 pBuf += sizeof(tANI_U16);
364 msgLength += sizeof(tANI_U16);
365#endif
366
367 //Fill in length
368 limCopyU16((tANI_U8*)pLen, msgLength);
369
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 limPostSmeMessage(pMac, eWNI_SME_DISASSOC_REQ, (tANI_U32 *) pSmeDeauthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 palFreeMemory( pMac->hHdd, pSmeDeauthReq );
372
373} /*** end limTriggerSTAdeletion() ***/
374
375
376
377/**
378 * limTearDownLinkWithAp()
379 *
380 *FUNCTION:
381 * This function is called when heartbeat (beacon reception)
382 * fails on STA
383 *
384 *LOGIC:
385 *
386 *ASSUMPTIONS:
387 *
388 *NOTE:
389 *
390 * @param pMac - Pointer to Global MAC structure
391 * @return None
392 */
393
394void
395limTearDownLinkWithAp(tpAniSirGlobal pMac, tANI_U8 sessionId, tSirMacReasonCodes reasonCode)
396{
397 tpDphHashNode pStaDs = NULL;
398
399 //tear down the following sessionEntry
400 tpPESession psessionEntry;
401
402 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
403 {
404 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
405 return;
406 }
407 /**
408 * Heart beat failed for upto threshold value
409 * and AP did not respond for Probe request.
410 * Trigger link tear down.
411 */
412
413 pMac->pmm.inMissedBeaconScenario = FALSE;
414 limLog(pMac, LOGW,
415 FL("No ProbeRsp from AP after HB failure. Tearing down link\n"));
416
417 // Deactivate heartbeat timer
418 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
419
420 // Announce loss of link to Roaming algorithm
421 // and cleanup by sending SME_DISASSOC_REQ to SME
422
423 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
424
425
426 if (pStaDs != NULL)
427 {
428 tLimMlmDeauthInd mlmDeauthInd;
429
Gopichand Nakkalae9b72e12013-02-27 20:51:16 -0800430#ifdef FEATURE_WLAN_TDLS
431 /* Delete all TDLS peers connected before leaving BSS*/
432 limDeleteTDLSPeers(pMac, psessionEntry);
433#endif
434
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 pStaDs->mlmStaContext.disassocReason = reasonCode;
436 pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;
437
438 /// Issue Deauth Indication to SME.
439 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr,
440 pStaDs->staAddr,
441 sizeof(tSirMacAddr));
442 mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
443 mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger;
444
445 limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
446
447 limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
448 }
449} /*** limTearDownLinkWithAp() ***/
450
451
452
453
454/**
455 * limHandleHeartBeatFailure()
456 *
457 *FUNCTION:
458 * This function is called when heartbeat (beacon reception)
459 * fails on STA
460 *
461 *LOGIC:
462 *
463 *ASSUMPTIONS:
464 *
465 *NOTE:
466 *
467 * @param pMac - Pointer to Global MAC structure
468 * @return None
469 */
470
471void limHandleHeartBeatFailure(tpAniSirGlobal pMac,tpPESession psessionEntry)
472{
473
474#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
475 vos_log_beacon_update_pkt_type *log_ptr = NULL;
476#endif //FEATURE_WLAN_DIAG_SUPPORT
477
478 /* If gLimHeartBeatTimer fires between the interval of sending WDA_ENTER_BMPS_REQUEST
479 * to the HAL and receiving WDA_ENTER_BMPS_RSP from the HAL, then LIM (PE) tries to Process the
480 * SIR_LIM_HEAR_BEAT_TIMEOUT message but The PE state is ePMM_STATE_BMPS_SLEEP so PE dont
481 * want to handle heartbeat timeout in the BMPS, because Firmware handles it in BMPS.
482 * So just return from heartbeatfailure handler
483 */
Yathish9f22e662012-12-10 14:21:35 -0800484 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE && (!limIsSystemInActiveState(pMac)))
485 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700486
487#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
488 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_beacon_update_pkt_type, LOG_WLAN_BEACON_UPDATE_C);
489 if(log_ptr)
490 log_ptr->bcn_rx_cnt = psessionEntry->LimRxedBeaconCntDuringHB;
491 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
492#endif //FEATURE_WLAN_DIAG_SUPPORT
493
494 /* Ensure HB Status for the session has been reseted */
495 psessionEntry->LimHBFailureStatus = eANI_BOOLEAN_FALSE;
496 /** Re Activate Timer if the system is Waiting for ReAssoc Response*/
497 if(((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
498 (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
499 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
500 (LIM_IS_CONNECTION_ACTIVE(psessionEntry) ||
501 (limIsReassocInProgress(pMac, psessionEntry))))
502 {
503 if(psessionEntry->LimRxedBeaconCntDuringHB < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL)
504 pMac->lim.gLimHeartBeatBeaconStats[psessionEntry->LimRxedBeaconCntDuringHB]++;
505 else
506 pMac->lim.gLimHeartBeatBeaconStats[0]++;
507
508 /******
509 * Note: Use this code once you have converted all
510 * limReactivateHeartBeatTimer() calls to
511 * limReactivateTimer() calls.
512 *
513 ******/
514 //limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER, psessionEntry);
515 limReactivateHeartBeatTimer(pMac, psessionEntry);
516
517 // Reset number of beacons received
518 limResetHBPktCount(psessionEntry);
519 return;
520 }
521 if (((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
522 (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))
523 {
524 if (!pMac->sys.gSysEnableLinkMonitorMode)
525 return;
526
527 /**
528 * Beacon frame not received within heartbeat timeout.
529 */
530 PELOGW(limLog(pMac, LOGW, FL("Heartbeat Failure\n"));)
531 pMac->lim.gLimHBfailureCntInLinkEstState++;
532
533 /**
534 * Check if connected on the DFS channel, if not connected on
535 * DFS channel then only send the probe request otherwise tear down the link
536 */
537 if(!limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
538 {
539 /*** Detected continuous Beacon Misses ***/
540 psessionEntry->LimHBFailureStatus= eANI_BOOLEAN_TRUE;
541 /**
542 * Send Probe Request frame to AP to see if
543 * it is still around. Wait until certain
544 * timeout for Probe Response from AP.
545 */
546 PELOGW(limLog(pMac, LOGW, FL("Heart Beat missed from AP. Sending Probe Req\n"));)
547 /* for searching AP, we don't include any additional IE */
548 limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
549 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
550 psessionEntry->dot11mode, 0, NULL);
551 }
552 else
553 {
554 /* Connected on DFS channel so should not send the probe request
555 * tear down the link directly */
556 limTearDownLinkWithAp(pMac, psessionEntry->peSessionId, eSIR_MAC_UNSPEC_FAILURE_REASON);
557 }
558 }
559 else
560 {
561 /**
562 * Heartbeat timer may have timed out
563 * while we're doing background scanning/learning
564 * or in states other than link-established state.
565 * Log error.
566 */
567 PELOG1(limLog(pMac, LOG1, FL("received heartbeat timeout in state %X\n"),
568 psessionEntry->limMlmState);)
569 limPrintMlmState(pMac, LOG1, psessionEntry->limMlmState);
570 pMac->lim.gLimHBfailureCntInOtherStates++;
571 limReactivateHeartBeatTimer(pMac, psessionEntry);
572 }
573} /*** limHandleHeartBeatFailure() ***/