blob: 37ff687e0e279d797220c7d6b54268a4970522fd [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08005 */
6/*
Jeff Johnson295189b2012-06-20 16:38:30 -07007 * This file limLinkMonitoringAlgo.cc contains the code for
8 * Link monitoring algorithm on AP and heart beat failure
9 * handling on STA.
10 * Author: Chandra Modumudi
11 * Date: 03/01/02
12 * History:-
13 * Date Modified by Modification Information
14 * --------------------------------------------------------------------
15 *
16 */
17
18#include "aniGlobal.h"
Jeff Johnson62c27982013-02-27 17:53:55 -080019#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070020#include "cfgApi.h"
21
Jeff Johnson295189b2012-06-20 16:38:30 -070022
23#include "schApi.h"
24#include "pmmApi.h"
25#include "utilsApi.h"
26#include "limAssocUtils.h"
27#include "limTypes.h"
28#include "limUtils.h"
29#include "limPropExtsUtils.h"
30
31#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
32#include "vos_diag_core_log.h"
33#endif //FEATURE_WLAN_DIAG_SUPPORT
34#include "limSession.h"
35#include "limSerDesUtils.h"
36
37
38/**
39 * limSendKeepAliveToPeer()
40 *
41 *FUNCTION:
42 * This function is called to send Keep alive message to peer
43 *
44 *LOGIC:
45 *
46 *ASSUMPTIONS:
47 *
48 *NOTE:
49 * NA
50 *
51 * @param pMac - Pointer to Global MAC structure
52 * @return None
53 */
54
55void
56limSendKeepAliveToPeer(tpAniSirGlobal pMac)
57{
58
Jeff Johnson295189b2012-06-20 16:38:30 -070059} /*** limSendKeepAliveToPeer() ***/
60
61
62/** ---------------------------------------------------------
63\fn limDeleteStaContext
64\brief This function handles the message from HAL:
65\ WDA_DELETE_STA_CONTEXT_IND. This function
66\ validates that the given station id exist, and if so,
67\ deletes the station by calling limTriggerSTAdeletion.
68\param tpAniSirGlobal pMac
69\param tpSirMsgQ limMsg
70\return none
71 -----------------------------------------------------------*/
72void
73limDeleteStaContext(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
74{
75 tpDeleteStaContext pMsg = (tpDeleteStaContext)limMsg->bodyptr;
76 tpDphHashNode pStaDs;
77 tpPESession psessionEntry ;
78 tANI_U8 sessionId;
79
Pratik Bhalgataa1ae392012-11-22 17:44:33 +053080 if(NULL == pMsg)
81 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070082 PELOGE(limLog(pMac, LOGE,FL("Invalid body pointer in message"));)
Pratik Bhalgataa1ae392012-11-22 17:44:33 +053083 return;
84 }
Jeff Johnson295189b2012-06-20 16:38:30 -070085 if((psessionEntry = peFindSessionByBssid(pMac,pMsg->bssId,&sessionId))== NULL)
86 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070087 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +053088 vos_mem_free(pMsg);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +053089 return;
Jeff Johnson295189b2012-06-20 16:38:30 -070090 }
91
Pratik Bhalgataa1ae392012-11-22 17:44:33 +053092 switch(pMsg->reasonCode)
Jeff Johnson295189b2012-06-20 16:38:30 -070093 {
Pratik Bhalgataa1ae392012-11-22 17:44:33 +053094 case HAL_DEL_STA_REASON_CODE_KEEP_ALIVE:
95 case HAL_DEL_STA_REASON_CODE_TIM_BASED:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070096 PELOGE(limLog(pMac, LOGE, FL(" Deleting station: staId = %d, reasonCode = %d"), pMsg->staId, pMsg->reasonCode);)
Shailender Karmuchia734f332013-04-19 14:02:48 -070097 if (eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole)
98 return;
99
Gopichand Nakkala94253192013-03-28 15:35:48 -0700100 pStaDs = dphLookupAssocId(pMac, pMsg->staId, &pMsg->assocId, &psessionEntry->dph.dphHashTable);
Hoonki Leee6bfe942013-02-05 15:01:19 -0800101
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530102 if (!pStaDs)
103 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700104 PELOGE(limLog(pMac, LOGE, FL("Skip STA deletion (invalid STA) limSystemRole=%d"),psessionEntry->limSystemRole);)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530105 vos_mem_free(pMsg);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530106 return;
107 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700108
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530109 /* check and see if same staId. This is to avoid the scenario
110 * where we're trying to delete a staId we just added.
111 */
112 if (pStaDs->staIndex != pMsg->staId)
113 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700114 PELOGE(limLog(pMac, LOGE, FL("staid mismatch: %d vs %d "), pStaDs->staIndex, pMsg->staId);)
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530115 vos_mem_free(pMsg);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530116 return;
117 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700118
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530119 if((eLIM_BT_AMP_AP_ROLE == psessionEntry->limSystemRole) ||
120 (eLIM_AP_ROLE == psessionEntry->limSystemRole))
121 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700122 PELOG1(limLog(pMac, LOG1, FL("SAP:lim Delete Station Context (staId: %d, assocId: %d) "),
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530123 pMsg->staId, pMsg->assocId);)
124 limTriggerSTAdeletion(pMac, pStaDs, psessionEntry);
125 }
126 else
127 {
Hoonki Leee6bfe942013-02-05 15:01:19 -0800128#ifdef FEATURE_WLAN_TDLS
129 if(eLIM_STA_ROLE == psessionEntry->limSystemRole &&
130 STA_ENTRY_TDLS_PEER == pStaDs->staType)
131 {
132 //TeardownLink with PEER
133 //Reason code HAL_DEL_STA_REASON_CODE_KEEP_ALIVE means
134 //eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE
135 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
136 /*pMsg->reasonCode*/ eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE);
137 }
138 else
139 {
140#endif
141 //TearDownLink with AP
142 tLimMlmDeauthInd mlmDeauthInd;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700143 PELOGW(limLog(pMac, LOGW, FL("lim Delete Station Context (staId: %d, assocId: %d) "),
Hoonki Leee6bfe942013-02-05 15:01:19 -0800144 pMsg->staId, pMsg->assocId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700145
Hoonki Leee6bfe942013-02-05 15:01:19 -0800146 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
147 pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;
Jeff Johnson295189b2012-06-20 16:38:30 -0700148
Hoonki Leee6bfe942013-02-05 15:01:19 -0800149 // Issue Deauth Indication to SME.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530150 vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
151 pStaDs->staAddr, sizeof(tSirMacAddr));
Hoonki Leee6bfe942013-02-05 15:01:19 -0800152 mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
153 mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -0700154
Gopichand Nakkalaca35d292013-03-05 11:06:03 -0800155#ifdef FEATURE_WLAN_TDLS
156 /* Delete all TDLS peers connected before leaving BSS*/
157 limDeleteTDLSPeers(pMac, psessionEntry);
158#endif
Hoonki Leee6bfe942013-02-05 15:01:19 -0800159 limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530160
Hoonki Leee6bfe942013-02-05 15:01:19 -0800161 limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
162#ifdef FEATURE_WLAN_TDLS
163 }
164#endif
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530165 }
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530166 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700167
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530168 case HAL_DEL_STA_REASON_CODE_UNKNOWN_A2:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700169 PELOGE(limLog(pMac, LOGE, FL(" Deleting Unknown station "));)
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530170 limPrintMacAddr(pMac, pMsg->addr2, LOGE);
171 limSendDeauthMgmtFrame( pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMsg->addr2, psessionEntry, FALSE);
172 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700173
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530174 default:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700175 PELOGE(limLog(pMac, LOGE, FL(" Unknown reason code "));)
Pratik Bhalgataa1ae392012-11-22 17:44:33 +0530176 break;
177
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 }
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530179 vos_mem_free(pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700180 return;
181}
182
183
184/**
185 * limTriggerSTAdeletion()
186 *
187 *FUNCTION:
188 * This function is called to trigger STA context deletion
189 *
190 *LOGIC:
191 *
192 *ASSUMPTIONS:
193 *
194 *NOTE:
195 * NA
196 *
197 * @param pMac - Pointer to global MAC structure
198 * @param pStaDs - Pointer to internal STA Datastructure
199 * @return None
200 */
201void
202limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
203{
204 tSirSmeDeauthReq *pSmeDeauthReq;
205 tANI_U8 *pBuf;
206 tANI_U8 *pLen;
207 tANI_U16 msgLength = 0;
208
209 if (! pStaDs)
210 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700211 PELOGW(limLog(pMac, LOGW, FL("Skip STA deletion (invalid STA)"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700212 return;
213 }
214 /**
215 * MAC based Authentication was used. Trigger
216 * Deauthentication frame to peer since it will
217 * take care of disassociation as well.
218 */
219
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530220 pSmeDeauthReq = vos_mem_malloc(sizeof(tSirSmeDeauthReq));
221 if (NULL == pSmeDeauthReq)
Jeff Johnson295189b2012-06-20 16:38:30 -0700222 {
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530223 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DEAUTH_REQ "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700224 return;
225 }
226
227 pBuf = (tANI_U8 *) &pSmeDeauthReq->messageType;
228
229 //messageType
Jeff Johnson295189b2012-06-20 16:38:30 -0700230 limCopyU16((tANI_U8*)pBuf, eWNI_SME_DISASSOC_REQ);
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 pBuf += sizeof(tANI_U16);
232 msgLength += sizeof(tANI_U16);
233
234 //length
235 pLen = pBuf;
236 pBuf += sizeof(tANI_U16);
237 msgLength += sizeof(tANI_U16);
Jeff Johnsone7245742012-09-05 17:12:55 -0700238
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 //sessionId
Jeff Johnsone7245742012-09-05 17:12:55 -0700240 *pBuf = psessionEntry->smeSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700241 pBuf++;
242 msgLength++;
Jeff Johnsone7245742012-09-05 17:12:55 -0700243
Jeff Johnson295189b2012-06-20 16:38:30 -0700244 //transactionId
245 limCopyU16((tANI_U8*)pBuf, psessionEntry->transactionId);
246 pBuf += sizeof(tANI_U16);
247 msgLength += sizeof(tANI_U16);
248
249 //bssId
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530250 vos_mem_copy(pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 pBuf += sizeof(tSirMacAddr);
252 msgLength += sizeof(tSirMacAddr);
253
254 //peerMacAddr
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530255 vos_mem_copy(pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 pBuf += sizeof(tSirMacAddr);
257 msgLength += sizeof(tSirMacAddr);
258
259 //reasonCode
Jeff Johnson295189b2012-06-20 16:38:30 -0700260 limCopyU16((tANI_U8*)pBuf, (tANI_U16)eLIM_LINK_MONITORING_DISASSOC);
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 pBuf += sizeof(tANI_U16);
262 msgLength += sizeof(tANI_U16);
263
264 //Do not send disassoc OTA
265 //pBuf[0] = 1 means do not send the disassoc frame over the air
266 //pBuf[0] = 0 means send the disassoc frame over the air
267 pBuf[0]= 0;
268 pBuf += sizeof(tANI_U8);
269 msgLength += sizeof(tANI_U8);
270
271
Jeff Johnson295189b2012-06-20 16:38:30 -0700272
273 //Fill in length
Gopichand Nakkala114718f2013-03-25 19:19:46 -0700274 limCopyU16((tANI_U8*)pLen , msgLength);
Jeff Johnson295189b2012-06-20 16:38:30 -0700275
Jeff Johnson295189b2012-06-20 16:38:30 -0700276 limPostSmeMessage(pMac, eWNI_SME_DISASSOC_REQ, (tANI_U32 *) pSmeDeauthReq);
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530277 vos_mem_free(pSmeDeauthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700278
279} /*** end limTriggerSTAdeletion() ***/
280
281
282
283/**
284 * limTearDownLinkWithAp()
285 *
286 *FUNCTION:
287 * This function is called when heartbeat (beacon reception)
288 * fails on STA
289 *
290 *LOGIC:
291 *
292 *ASSUMPTIONS:
293 *
294 *NOTE:
295 *
296 * @param pMac - Pointer to Global MAC structure
297 * @return None
298 */
299
300void
301limTearDownLinkWithAp(tpAniSirGlobal pMac, tANI_U8 sessionId, tSirMacReasonCodes reasonCode)
302{
303 tpDphHashNode pStaDs = NULL;
304
305 //tear down the following sessionEntry
306 tpPESession psessionEntry;
307
308 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
309 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700310 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 return;
312 }
313 /**
314 * Heart beat failed for upto threshold value
315 * and AP did not respond for Probe request.
316 * Trigger link tear down.
317 */
318
319 pMac->pmm.inMissedBeaconScenario = FALSE;
320 limLog(pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700321 FL("No ProbeRsp from AP after HB failure. Tearing down link"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700322
323 // Deactivate heartbeat timer
324 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
325
326 // Announce loss of link to Roaming algorithm
327 // and cleanup by sending SME_DISASSOC_REQ to SME
328
329 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
330
331
332 if (pStaDs != NULL)
333 {
334 tLimMlmDeauthInd mlmDeauthInd;
335
Gopichand Nakkalae9b72e12013-02-27 20:51:16 -0800336#ifdef FEATURE_WLAN_TDLS
337 /* Delete all TDLS peers connected before leaving BSS*/
338 limDeleteTDLSPeers(pMac, psessionEntry);
339#endif
340
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 pStaDs->mlmStaContext.disassocReason = reasonCode;
342 pStaDs->mlmStaContext.cleanupTrigger = eLIM_LINK_MONITORING_DEAUTH;
343
344 /// Issue Deauth Indication to SME.
Bansidhar Gopalachari2f7395d2013-07-12 11:24:23 +0530345 vos_mem_copy((tANI_U8 *) &mlmDeauthInd.peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 pStaDs->staAddr,
347 sizeof(tSirMacAddr));
348 mlmDeauthInd.reasonCode = (tANI_U8) pStaDs->mlmStaContext.disassocReason;
349 mlmDeauthInd.deauthTrigger = pStaDs->mlmStaContext.cleanupTrigger;
350
351 limPostSmeMessage(pMac, LIM_MLM_DEAUTH_IND, (tANI_U32 *) &mlmDeauthInd);
352
353 limSendSmeDeauthInd(pMac, pStaDs, psessionEntry);
354 }
355} /*** limTearDownLinkWithAp() ***/
356
357
358
359
360/**
361 * limHandleHeartBeatFailure()
362 *
363 *FUNCTION:
364 * This function is called when heartbeat (beacon reception)
365 * fails on STA
366 *
367 *LOGIC:
368 *
369 *ASSUMPTIONS:
370 *
371 *NOTE:
372 *
373 * @param pMac - Pointer to Global MAC structure
374 * @return None
375 */
376
377void limHandleHeartBeatFailure(tpAniSirGlobal pMac,tpPESession psessionEntry)
378{
379
380#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
381 vos_log_beacon_update_pkt_type *log_ptr = NULL;
382#endif //FEATURE_WLAN_DIAG_SUPPORT
383
384 /* If gLimHeartBeatTimer fires between the interval of sending WDA_ENTER_BMPS_REQUEST
385 * to the HAL and receiving WDA_ENTER_BMPS_RSP from the HAL, then LIM (PE) tries to Process the
386 * SIR_LIM_HEAR_BEAT_TIMEOUT message but The PE state is ePMM_STATE_BMPS_SLEEP so PE dont
387 * want to handle heartbeat timeout in the BMPS, because Firmware handles it in BMPS.
388 * So just return from heartbeatfailure handler
389 */
Yathish9f22e662012-12-10 14:21:35 -0800390 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE && (!limIsSystemInActiveState(pMac)))
391 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700392
393#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
394 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_beacon_update_pkt_type, LOG_WLAN_BEACON_UPDATE_C);
395 if(log_ptr)
396 log_ptr->bcn_rx_cnt = psessionEntry->LimRxedBeaconCntDuringHB;
397 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
398#endif //FEATURE_WLAN_DIAG_SUPPORT
399
400 /* Ensure HB Status for the session has been reseted */
401 psessionEntry->LimHBFailureStatus = eANI_BOOLEAN_FALSE;
402 /** Re Activate Timer if the system is Waiting for ReAssoc Response*/
403 if(((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
404 (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||
405 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
406 (LIM_IS_CONNECTION_ACTIVE(psessionEntry) ||
407 (limIsReassocInProgress(pMac, psessionEntry))))
408 {
409 if(psessionEntry->LimRxedBeaconCntDuringHB < MAX_NO_BEACONS_PER_HEART_BEAT_INTERVAL)
410 pMac->lim.gLimHeartBeatBeaconStats[psessionEntry->LimRxedBeaconCntDuringHB]++;
411 else
412 pMac->lim.gLimHeartBeatBeaconStats[0]++;
413
414 /******
415 * Note: Use this code once you have converted all
416 * limReactivateHeartBeatTimer() calls to
417 * limReactivateTimer() calls.
418 *
419 ******/
420 //limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER, psessionEntry);
421 limReactivateHeartBeatTimer(pMac, psessionEntry);
422
423 // Reset number of beacons received
424 limResetHBPktCount(psessionEntry);
425 return;
426 }
427 if (((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
428 (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))
429 {
430 if (!pMac->sys.gSysEnableLinkMonitorMode)
431 return;
432
433 /**
434 * Beacon frame not received within heartbeat timeout.
435 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700436 PELOGW(limLog(pMac, LOGW, FL("Heartbeat Failure"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 pMac->lim.gLimHBfailureCntInLinkEstState++;
438
439 /**
440 * Check if connected on the DFS channel, if not connected on
441 * DFS channel then only send the probe request otherwise tear down the link
442 */
443 if(!limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
444 {
445 /*** Detected continuous Beacon Misses ***/
446 psessionEntry->LimHBFailureStatus= eANI_BOOLEAN_TRUE;
447 /**
448 * Send Probe Request frame to AP to see if
449 * it is still around. Wait until certain
450 * timeout for Probe Response from AP.
451 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700452 PELOGW(limLog(pMac, LOGW, FL("Heart Beat missed from AP. Sending Probe Req"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 /* for searching AP, we don't include any additional IE */
454 limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
455 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
456 psessionEntry->dot11mode, 0, NULL);
457 }
458 else
459 {
Praveen Kumar Sirisillaedf67e82013-08-21 19:17:10 -0700460 PELOGW(limLog(pMac, LOGW,
461 FL("Heart Beat missed from AP on DFS chanel moving to passive"));)
462 if (psessionEntry->currentOperChannel < SIR_MAX_24G_5G_CHANNEL_RANGE){
463 limCovertChannelScanType(pMac, psessionEntry->currentOperChannel, false);
464 pMac->lim.dfschannelList.timeStamp[psessionEntry->currentOperChannel] = 0;
465 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 /* Connected on DFS channel so should not send the probe request
467 * tear down the link directly */
468 limTearDownLinkWithAp(pMac, psessionEntry->peSessionId, eSIR_MAC_UNSPEC_FAILURE_REASON);
469 }
470 }
471 else
472 {
473 /**
474 * Heartbeat timer may have timed out
475 * while we're doing background scanning/learning
476 * or in states other than link-established state.
477 * Log error.
478 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700479 PELOG1(limLog(pMac, LOG1, FL("received heartbeat timeout in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 psessionEntry->limMlmState);)
481 limPrintMlmState(pMac, LOG1, psessionEntry->limMlmState);
482 pMac->lim.gLimHBfailureCntInOtherStates++;
483 limReactivateHeartBeatTimer(pMac, psessionEntry);
484 }
485} /*** limHandleHeartBeatFailure() ***/