blob: 0fa777aaf67d17c202c8646d435121cf62f40e97 [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#ifdef WLAN_SOFTAP_FEATURE
189 switch(pMsg->reasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -0700190 {
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530191 case HAL_DEL_STA_REASON_CODE_KEEP_ALIVE:
192 case HAL_DEL_STA_REASON_CODE_TIM_BASED:
193 PELOGE(limLog(pMac, LOGE, FL(" Deleting station: staId = %d, reasonCode = %d\n"), pMsg->staId, pMsg->reasonCode);)
Madan Mohan Koyyalamudi49a7c0f2012-11-06 18:57:59 -0800194#endif
Hoonki Leee6bfe942013-02-05 15:01:19 -0800195 pStaDs = dphGetHashEntry(pMac, pMsg->assocId, &psessionEntry->dph.dphHashTable);
196
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530197 if (!pStaDs)
198 {
199 PELOGE(limLog(pMac, LOGE, FL("Skip STA deletion (invalid STA) limSystemRole=%d\n"),psessionEntry->limSystemRole);)
200 palFreeMemory(pMac->hHdd, pMsg);
201 return;
202 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700203
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530204 /* check and see if same staId. This is to avoid the scenario
205 * where we're trying to delete a staId we just added.
206 */
207 if (pStaDs->staIndex != pMsg->staId)
208 {
209 PELOGE(limLog(pMac, LOGE, FL("staid mismatch: %d vs %d \n"), pStaDs->staIndex, pMsg->staId);)
210 palFreeMemory(pMac->hHdd, pMsg);
211 return;
212 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700213
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530214 if((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) ||
215 (eLIM_AP_ROLE == psessionEntry->limSystemRole))
216 {
217 PELOG1(limLog(pMac, LOG1, FL("SAP:lim Delete Station Context (staId: %d, assocId: %d) \n"),
218 pMsg->staId, pMsg->assocId);)
219 limTriggerSTAdeletion(pMac, pStaDs, psessionEntry);
220 }
221 else
222 {
Hoonki Leee6bfe942013-02-05 15:01:19 -0800223#ifdef FEATURE_WLAN_TDLS
224 if(eLIM_STA_ROLE == psessionEntry->limSystemRole &&
225 STA_ENTRY_TDLS_PEER == pStaDs->staType)
226 {
227 //TeardownLink with PEER
228 //Reason code HAL_DEL_STA_REASON_CODE_KEEP_ALIVE means
229 //eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE
230 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
231 /*pMsg->reasonCode*/ eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE);
232 }
233 else
234 {
235#endif
236 //TearDownLink with AP
237 tLimMlmDeauthInd mlmDeauthInd;
238 PELOGW(limLog(pMac, LOGW, FL("lim Delete Station Context (staId: %d, assocId: %d) \n"),
239 pMsg->staId, pMsg->assocId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700240
Hoonki Leee6bfe942013-02-05 15:01:19 -0800241 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
242 pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;
Jeff Johnson295189b2012-06-20 16:38:30 -0700243
Hoonki Leee6bfe942013-02-05 15:01:19 -0800244 // Issue Deauth Indication to SME.
245 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr,
246 pStaDs->staAddr, sizeof(tSirMacAddr));
247 mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
248 mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -0700249
Hoonki Leee6bfe942013-02-05 15:01:19 -0800250 limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530251
Hoonki Leee6bfe942013-02-05 15:01:19 -0800252 limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
253#ifdef FEATURE_WLAN_TDLS
254 }
255#endif
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530256 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700257#ifdef WLAN_SOFTAP_FEATURE
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530258 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700259
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530260 case HAL_DEL_STA_REASON_CODE_UNKNOWN_A2:
261 PELOGE(limLog(pMac, LOGE, FL(" Deleting Unknown station \n"));)
262 limPrintMacAddr(pMac, pMsg->addr2, LOGE);
263 limSendDeauthMgmtFrame( pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMsg->addr2, psessionEntry, FALSE);
264 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700265
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530266 default:
267 PELOGE(limLog(pMac, LOGE, FL(" Unknown reason code \n"));)
268 break;
269
Jeff Johnson295189b2012-06-20 16:38:30 -0700270 }
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530271#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700272 palFreeMemory(pMac->hHdd, pMsg);
273 return;
274}
275
276
277/**
278 * limTriggerSTAdeletion()
279 *
280 *FUNCTION:
281 * This function is called to trigger STA context deletion
282 *
283 *LOGIC:
284 *
285 *ASSUMPTIONS:
286 *
287 *NOTE:
288 * NA
289 *
290 * @param pMac - Pointer to global MAC structure
291 * @param pStaDs - Pointer to internal STA Datastructure
292 * @return None
293 */
294void
295limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
296{
297 tSirSmeDeauthReq *pSmeDeauthReq;
298 tANI_U8 *pBuf;
299 tANI_U8 *pLen;
300 tANI_U16 msgLength = 0;
301
302 if (! pStaDs)
303 {
304 PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)\n"));)
305 return;
306 }
307 /**
308 * MAC based Authentication was used. Trigger
309 * Deauthentication frame to peer since it will
310 * take care of disassociation as well.
311 */
312
313 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeDeauthReq, sizeof(tSirSmeDeauthReq)))
314 {
315 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DEAUTH_REQ \n"));
316 return;
317 }
318
319 pBuf = (tANI_U8 *) &pSmeDeauthReq->messageType;
320
321 //messageType
322#ifdef WLAN_SOFTAP_FEATURE
323 limCopyU16((tANI_U8*)pBuf, eWNI_SME_DISASSOC_REQ);
324#else
325 limCopyU16((tANI_U8*)pBuf, eWNI_SME_DEAUTH_REQ);
326#endif
327 pBuf += sizeof(tANI_U16);
328 msgLength += sizeof(tANI_U16);
329
330 //length
331 pLen = pBuf;
332 pBuf += sizeof(tANI_U16);
333 msgLength += sizeof(tANI_U16);
Jeff Johnsone7245742012-09-05 17:12:55 -0700334
Jeff Johnson295189b2012-06-20 16:38:30 -0700335 //sessionId
Jeff Johnsone7245742012-09-05 17:12:55 -0700336 *pBuf = psessionEntry->smeSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 pBuf++;
338 msgLength++;
Jeff Johnsone7245742012-09-05 17:12:55 -0700339
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 //transactionId
341 limCopyU16((tANI_U8*)pBuf, psessionEntry->transactionId);
342 pBuf += sizeof(tANI_U16);
343 msgLength += sizeof(tANI_U16);
344
345 //bssId
346 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr) );
347 pBuf += sizeof(tSirMacAddr);
348 msgLength += sizeof(tSirMacAddr);
349
350 //peerMacAddr
351 palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr) );
352 pBuf += sizeof(tSirMacAddr);
353 msgLength += sizeof(tSirMacAddr);
354
355 //reasonCode
356#ifdef WLAN_SOFTAP_FEATURE
357 limCopyU16((tANI_U8*)pBuf, (tANI_U16)eLIM_LINK_MONITORING_DISASSOC);
358#else
359 limCopyU16((tANI_U8*)pBuf, (tANI_U16)eLIM_LINK_MONITORING_DEAUTH);
360#endif
361 pBuf += sizeof(tANI_U16);
362 msgLength += sizeof(tANI_U16);
363
364 //Do not send disassoc OTA
365 //pBuf[0] = 1 means do not send the disassoc frame over the air
366 //pBuf[0] = 0 means send the disassoc frame over the air
367 pBuf[0]= 0;
368 pBuf += sizeof(tANI_U8);
369 msgLength += sizeof(tANI_U8);
370
371
372#if (WNI_POLARIS_FW_PRODUCT == AP)
373 //aid
374 limCopyU16((tANI_U8*)pBuf, pStaDs->assocId);
375 pBuf += sizeof(tANI_U16);
376 msgLength += sizeof(tANI_U16);
377#endif
378
379 //Fill in length
380 limCopyU16((tANI_U8*)pLen, msgLength);
381
382#ifdef WLAN_SOFTAP_FEATURE
383 limPostSmeMessage(pMac, eWNI_SME_DISASSOC_REQ, (tANI_U32 *) pSmeDeauthReq);
384#else
385 limPostSmeMessage(pMac, eWNI_SME_DEAUTH_REQ, (tANI_U32 *) pSmeDeauthReq);
386#endif
387 palFreeMemory( pMac->hHdd, pSmeDeauthReq );
388
389} /*** end limTriggerSTAdeletion() ***/
390
391
392
393/**
394 * limTearDownLinkWithAp()
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
410void
411limTearDownLinkWithAp(tpAniSirGlobal pMac, tANI_U8 sessionId, tSirMacReasonCodes reasonCode)
412{
413 tpDphHashNode pStaDs = NULL;
414
415 //tear down the following sessionEntry
416 tpPESession psessionEntry;
417
418 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
419 {
420 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
421 return;
422 }
423 /**
424 * Heart beat failed for upto threshold value
425 * and AP did not respond for Probe request.
426 * Trigger link tear down.
427 */
428
429 pMac->pmm.inMissedBeaconScenario = FALSE;
430 limLog(pMac, LOGW,
431 FL("No ProbeRsp from AP after HB failure. Tearing down link\n"));
432
433 // Deactivate heartbeat timer
434 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
435
436 // Announce loss of link to Roaming algorithm
437 // and cleanup by sending SME_DISASSOC_REQ to SME
438
439 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
440
441
442 if (pStaDs != NULL)
443 {
444 tLimMlmDeauthInd mlmDeauthInd;
445
446 pStaDs->mlmStaContext.disassocReason = reasonCode;
447 pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;
448
449 /// Issue Deauth Indication to SME.
450 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmDeauthInd.peerMacAddr,
451 pStaDs->staAddr,
452 sizeof(tSirMacAddr));
453 mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
454 mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger;
455
456 limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
457
458 limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
459 }
460} /*** limTearDownLinkWithAp() ***/
461
462
463
464
465/**
466 * limHandleHeartBeatFailure()
467 *
468 *FUNCTION:
469 * This function is called when heartbeat (beacon reception)
470 * fails on STA
471 *
472 *LOGIC:
473 *
474 *ASSUMPTIONS:
475 *
476 *NOTE:
477 *
478 * @param pMac - Pointer to Global MAC structure
479 * @return None
480 */
481
482void limHandleHeartBeatFailure(tpAniSirGlobal pMac,tpPESession psessionEntry)
483{
484
485#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
486 vos_log_beacon_update_pkt_type *log_ptr = NULL;
487#endif //FEATURE_WLAN_DIAG_SUPPORT
488
489 /* If gLimHeartBeatTimer fires between the interval of sending WDA_ENTER_BMPS_REQUEST
490 * to the HAL and receiving WDA_ENTER_BMPS_RSP from the HAL, then LIM (PE) tries to Process the
491 * SIR_LIM_HEAR_BEAT_TIMEOUT message but The PE state is ePMM_STATE_BMPS_SLEEP so PE dont
492 * want to handle heartbeat timeout in the BMPS, because Firmware handles it in BMPS.
493 * So just return from heartbeatfailure handler
494 */
Yathish9f22e662012-12-10 14:21:35 -0800495 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE && (!limIsSystemInActiveState(pMac)))
496 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700497
498#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
499 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_beacon_update_pkt_type, LOG_WLAN_BEACON_UPDATE_C);
500 if(log_ptr)
501 log_ptr->bcn_rx_cnt = psessionEntry->LimRxedBeaconCntDuringHB;
502 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
503#endif //FEATURE_WLAN_DIAG_SUPPORT
504
505 /* Ensure HB Status for the session has been reseted */
506 psessionEntry->LimHBFailureStatus = eANI_BOOLEAN_FALSE;
507 /** Re Activate Timer if the system is Waiting for ReAssoc Response*/
508 if(((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
509 (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
510 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
511 (LIM_IS_CONNECTION_ACTIVE(psessionEntry) ||
512 (limIsReassocInProgress(pMac, psessionEntry))))
513 {
514 if(psessionEntry->LimRxedBeaconCntDuringHB < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL)
515 pMac->lim.gLimHeartBeatBeaconStats[psessionEntry->LimRxedBeaconCntDuringHB]++;
516 else
517 pMac->lim.gLimHeartBeatBeaconStats[0]++;
518
519 /******
520 * Note: Use this code once you have converted all
521 * limReactivateHeartBeatTimer() calls to
522 * limReactivateTimer() calls.
523 *
524 ******/
525 //limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER, psessionEntry);
526 limReactivateHeartBeatTimer(pMac, psessionEntry);
527
528 // Reset number of beacons received
529 limResetHBPktCount(psessionEntry);
530 return;
531 }
532 if (((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
533 (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))
534 {
535 if (!pMac->sys.gSysEnableLinkMonitorMode)
536 return;
537
538 /**
539 * Beacon frame not received within heartbeat timeout.
540 */
541 PELOGW(limLog(pMac, LOGW, FL("Heartbeat Failure\n"));)
542 pMac->lim.gLimHBfailureCntInLinkEstState++;
543
544 /**
545 * Check if connected on the DFS channel, if not connected on
546 * DFS channel then only send the probe request otherwise tear down the link
547 */
548 if(!limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
549 {
550 /*** Detected continuous Beacon Misses ***/
551 psessionEntry->LimHBFailureStatus= eANI_BOOLEAN_TRUE;
552 /**
553 * Send Probe Request frame to AP to see if
554 * it is still around. Wait until certain
555 * timeout for Probe Response from AP.
556 */
557 PELOGW(limLog(pMac, LOGW, FL("Heart Beat missed from AP. Sending Probe Req\n"));)
558 /* for searching AP, we don't include any additional IE */
559 limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
560 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
561 psessionEntry->dot11mode, 0, NULL);
562 }
563 else
564 {
565 /* Connected on DFS channel so should not send the probe request
566 * tear down the link directly */
567 limTearDownLinkWithAp(pMac, psessionEntry->peSessionId, eSIR_MAC_UNSPEC_FAILURE_REASON);
568 }
569 }
570 else
571 {
572 /**
573 * Heartbeat timer may have timed out
574 * while we're doing background scanning/learning
575 * or in states other than link-established state.
576 * Log error.
577 */
578 PELOG1(limLog(pMac, LOG1, FL("received heartbeat timeout in state %X\n"),
579 psessionEntry->limMlmState);)
580 limPrintMlmState(pMac, LOG1, psessionEntry->limMlmState);
581 pMac->lim.gLimHBfailureCntInOtherStates++;
582 limReactivateHeartBeatTimer(pMac, psessionEntry);
583 }
584} /*** limHandleHeartBeatFailure() ***/