blob: e2003cfee63edc344f4008c312e2fed4c2625127 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
2 * Copyright (c) 2012, Code Aurora Forum. 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
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 * This file limTimerUtils.cc contains the utility functions
25 * LIM uses for handling various timers.
26 * Author: Chandra Modumudi
27 * Date: 02/13/02
28 * History:-
29 * Date Modified by Modification Information
30 * --------------------------------------------------------------------
31 */
32
33#include "limTypes.h"
34#include "limUtils.h"
35#include "limAssocUtils.h"
36#include "limSecurityUtils.h"
37#include "pmmApi.h"
38
39
40// default value 5000 ms for background scan period when it is disabled
41#define LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS 5000
42// channel Switch Timer in ticks
43#define LIM_CHANNEL_SWITCH_TIMER_TICKS 1
44// Lim Quite timer in ticks
45#define LIM_QUIET_TIMER_TICKS 100
46// Lim Quite BSS timer inteval in ticks
47#define LIM_QUIET_BSS_TIMER_TICK 100
48// Lim KeepAlive timer default (3000)ms
49#define LIM_KEEPALIVE_TIMER_MS 3000
50
51//default beacon interval value used in HB timer interval calculation
52#define LIM_HB_TIMER_BEACON_INTERVAL 100
53/**
54 * limCreateTimers()
55 *
56 *FUNCTION:
57 * This function is called upon receiving
58 * 1. SME_START_REQ for STA in ESS role
59 * 2. SME_START_BSS_REQ for AP role & STA in IBSS role
60 *
61 *LOGIC:
62 *
63 *ASSUMPTIONS:
64 * NA
65 *
66 *NOTE:
67 * NA
68 *
69 * @param pMac - Pointer to Global MAC structure
70 *
71 * @return None
72 */
73
74void
75limCreateTimers(tpAniSirGlobal pMac)
76{
77 tANI_U32 cfgValue, i;
78
79 PELOG1(limLog(pMac, LOG1, FL("Creating Timers used by LIM module in Role %d\n"), pMac->lim.gLimSystemRole);)
80
81 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
82 &cfgValue) != eSIR_SUCCESS)
83 {
84 /**
85 * Could not get MinChannelTimeout value
86 * from CFG. Log error.
87 */
88 limLog(pMac, LOGP, FL("could not retrieve MinChannelTimeout value\n"));
89 }
90 cfgValue = SYS_MS_TO_TICKS(cfgValue);
91
92 // Create MIN/MAX channel timers and activate them later
93 if (tx_timer_create(&pMac->lim.limTimers.gLimMinChannelTimer,
94 "MIN CHANNEL TIMEOUT",
95 limTimerHandler, SIR_LIM_MIN_CHANNEL_TIMEOUT,
96 cfgValue, 0,
97 TX_NO_ACTIVATE) != TX_SUCCESS)
98 {
99 /// Could not start min channel timer.
100 // Log error
101 limLog(pMac, LOGP, FL("could not create MIN channel timer\n"));
102
103 return;
104 }
105#if defined(ANI_OS_TYPE_RTAI_LINUX)
106 tx_timer_set_expiry_list(
107 &pMac->lim.limTimers.gLimMinChannelTimer, LIM_TIMER_EXPIRY_LIST);
108#endif
109
110 PELOG2(limLog(pMac, LOG2, FL("Created MinChannelTimer\n"));)
111
112 /* Periodic probe request timer value is half of the Min channel
113 * timer. Probe request sends periodically till min/max channel
114 * timer expires
115 */
116
117 cfgValue = cfgValue/2 ;
118 if( cfgValue >= 1)
119 {
120 // Create periodic probe request timer and activate them later
121 if (tx_timer_create(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
122 "Periodic Probe Request Timer",
123 limTimerHandler, SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT,
124 cfgValue, 0,
125 TX_NO_ACTIVATE) != TX_SUCCESS)
126 {
127 /// Could not start Periodic Probe Req timer.
128 // Log error
129 limLog(pMac, LOGP, FL("could not create periodic probe timer\n"));
130 return;
131 }
132 }
133
134
135 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
136 &cfgValue) != eSIR_SUCCESS)
137 {
138 /**
139 * Could not get MAXChannelTimeout value
140 * from CFG. Log error.
141 */
142 limLog(pMac, LOGP,
143 FL("could not retrieve MAXChannelTimeout value\n"));
144 }
145 cfgValue = SYS_MS_TO_TICKS(cfgValue);
146
147 if (tx_timer_create(&pMac->lim.limTimers.gLimMaxChannelTimer,
148 "MAX CHANNEL TIMEOUT",
149 limTimerHandler, SIR_LIM_MAX_CHANNEL_TIMEOUT,
150 cfgValue, 0,
151 TX_NO_ACTIVATE) != TX_SUCCESS)
152 {
153 /// Could not start max channel timer.
154 // Log error
155 limLog(pMac, LOGP, FL("could not create MAX channel timer\n"));
156
157 return;
158 }
159
160#if defined(ANI_OS_TYPE_RTAI_LINUX)
161 tx_timer_set_expiry_list(
162 &pMac->lim.limTimers.gLimMaxChannelTimer, LIM_TIMER_EXPIRY_LIST);
163#endif
164
165 PELOG2(limLog(pMac, LOG2, FL("Created MaxChannelTimer\n"));)
166
167 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
168 {
169 // Create Channel Switch Timer
170 if (tx_timer_create(&pMac->lim.limTimers.gLimChannelSwitchTimer,
171 "CHANNEL SWITCH TIMER",
172 limChannelSwitchTimerHandler,
173 0, // expiration_input
174 LIM_CHANNEL_SWITCH_TIMER_TICKS, // initial_ticks
175 0, // reschedule_ticks
176 TX_NO_ACTIVATE) != TX_SUCCESS)
177 {
178 limLog(pMac, LOGP, FL("failed to create Channel Switch timer\n"));
179 return;
180 }
181
182 //
183 // Create Quiet Timer
184 // This is used on the STA to go and shut-off
185 // Tx/Rx "after" the specified quiteInterval
186 //
187 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietTimer,
188 "QUIET TIMER",
189 limQuietTimerHandler,
190 SIR_LIM_QUIET_TIMEOUT, // expiration_input
191 LIM_QUIET_TIMER_TICKS, // initial_ticks
192 0, // reschedule_ticks
193 TX_NO_ACTIVATE) != TX_SUCCESS)
194 {
195 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer\n"));
196 return;
197 }
198
199 //
200 // Create Quiet BSS Timer
201 // After the specified quiteInterval, determined by
202 // gLimQuietTimer, this timer, gLimQuietBssTimer,
203 // trigger and put the STA to sleep for the specified
204 // gLimQuietDuration
205 //
206 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietBssTimer,
207 "QUIET BSS TIMER",
208 limQuietBssTimerHandler,
209 SIR_LIM_QUIET_BSS_TIMEOUT, // expiration_input
210 LIM_QUIET_BSS_TIMER_TICK, // initial_ticks
211 0, // reschedule_ticks
212 TX_NO_ACTIVATE) != TX_SUCCESS)
213 {
214 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer\n"));
215 return;
216 }
217
218 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
219 &cfgValue) != eSIR_SUCCESS)
220 {
221 /**
222 * Could not get JoinFailureTimeout value
223 * from CFG. Log error.
224 */
225 limLog(pMac, LOGP,
226 FL("could not retrieve JoinFailureTimeout value\n"));
227 }
228 cfgValue = SYS_MS_TO_TICKS(cfgValue);
229
230 // Create Join failure timer and activate it later
231 if (tx_timer_create(&pMac->lim.limTimers.gLimJoinFailureTimer,
232 "JOIN FAILURE TIMEOUT",
233 limTimerHandler, SIR_LIM_JOIN_FAIL_TIMEOUT,
234 cfgValue, 0,
235 TX_NO_ACTIVATE) != TX_SUCCESS)
236 {
237 /// Could not create Join failure timer.
238 // Log error
239 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
240
241 return;
242 }
243#if defined(ANI_OS_TYPE_RTAI_LINUX)
244 tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimJoinFailureTimer,
245 LIM_TIMER_EXPIRY_LIST);
246#endif
247
248 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
249 &cfgValue) != eSIR_SUCCESS)
250 {
251 /**
252 * Could not get AssocFailureTimeout value
253 * from CFG. Log error.
254 */
255 limLog(pMac, LOGP,
256 FL("could not retrieve AssocFailureTimeout value\n"));
257 }
258 cfgValue = SYS_MS_TO_TICKS(cfgValue);
259
260 // Create Association failure timer and activate it later
261 if (tx_timer_create(&pMac->lim.limTimers.gLimAssocFailureTimer,
262 "ASSOC FAILURE TIMEOUT",
263 limAssocFailureTimerHandler, LIM_ASSOC,
264 cfgValue, 0,
265 TX_NO_ACTIVATE) != TX_SUCCESS)
266 {
267 /// Could not create Assoc failure timer.
268 // Log error
269 limLog(pMac, LOGP,
270 FL("could not create Association failure timer\n"));
271
272 return;
273 }
274 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
275 &cfgValue) != eSIR_SUCCESS)
276 {
277 /**
278 * Could not get ReassocFailureTimeout value
279 * from CFG. Log error.
280 */
281 limLog(pMac, LOGP,
282 FL("could not retrieve ReassocFailureTimeout value\n"));
283 }
284 cfgValue = SYS_MS_TO_TICKS(cfgValue);
285
286 // Create Association failure timer and activate it later
287 if (tx_timer_create(&pMac->lim.limTimers.gLimReassocFailureTimer,
288 "REASSOC FAILURE TIMEOUT",
289 limAssocFailureTimerHandler, LIM_REASSOC,
290 cfgValue, 0,
291 TX_NO_ACTIVATE) != TX_SUCCESS)
292 {
293 /// Could not create Reassoc failure timer.
294 // Log error
295 limLog(pMac, LOGP,
296 FL("could not create Reassociation failure timer\n"));
297
298 return;
299 }
300
301 if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &cfgValue) != eSIR_SUCCESS)
302 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_ADDTS_RSP_TIMEOUT \n"));
303
304 cfgValue = SYS_MS_TO_TICKS(cfgValue);
305
306 // Create Addts response timer and activate it later
307 if (tx_timer_create(&pMac->lim.limTimers.gLimAddtsRspTimer,
308 "ADDTS RSP TIMEOUT",
309 limAddtsResponseTimerHandler,
310 SIR_LIM_ADDTS_RSP_TIMEOUT,
311 cfgValue, 0,
312 TX_NO_ACTIVATE) != TX_SUCCESS)
313 {
314 /// Could not create Auth failure timer.
315 // Log error
316 limLog(pMac, LOGP, FL("could not create Addts response timer\n"));
317
318 return;
319 }
320
321 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
322 &cfgValue) != eSIR_SUCCESS)
323 {
324 /**
325 * Could not get AuthFailureTimeout value
326 * from CFG. Log error.
327 */
328 limLog(pMac, LOGP,
329 FL("could not retrieve AuthFailureTimeout value\n"));
330 }
331 cfgValue = SYS_MS_TO_TICKS(cfgValue);
332
333 // Create Auth failure timer and activate it later
334 if (tx_timer_create(&pMac->lim.limTimers.gLimAuthFailureTimer,
335 "AUTH FAILURE TIMEOUT",
336 limTimerHandler,
337 SIR_LIM_AUTH_FAIL_TIMEOUT,
338 cfgValue, 0,
339 TX_NO_ACTIVATE) != TX_SUCCESS)
340 {
341 /// Could not create Auth failure timer.
342 // Log error
343 limLog(pMac, LOGP, FL("could not create Auth failure timer\n"));
344
345 return;
346 }
347#if defined(ANI_OS_TYPE_RTAI_LINUX)
348 tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimAuthFailureTimer,
349 LIM_TIMER_EXPIRY_LIST);
350#endif
351 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
352 &cfgValue) != eSIR_SUCCESS)
353 {
354 /**
355 * Could not get BEACON_INTERVAL value
356 * from CFG. Log error.
357 */
358 limLog(pMac, LOGP,
359 FL("could not retrieve BEACON_INTERVAL value\n"));
360 }
361 cfgValue = SYS_MS_TO_TICKS(cfgValue);
362
363 if (tx_timer_create(&pMac->lim.limTimers.gLimHeartBeatTimer,
364 "Heartbeat TIMEOUT",
365 limTimerHandler,
366 SIR_LIM_HEART_BEAT_TIMEOUT,
367 cfgValue,
368 0,
369 TX_NO_ACTIVATE) != TX_SUCCESS)
370 {
371 /// Could not start Heartbeat timer.
372 // Log error
373 limLog(pMac, LOGP,
374 FL("call to create heartbeat timer failed\n"));
375 }
376
377 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
378 &cfgValue) != eSIR_SUCCESS)
379 {
380 /**
381 * Could not get PROBE_AFTER_HB_FAILURE
382 * value from CFG. Log error.
383 */
384 limLog(pMac, LOGP,
385 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
386 }
387
388 // Change timer to reactivate it in future
389 cfgValue = SYS_MS_TO_TICKS(cfgValue);
390
391 if (tx_timer_create(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
392 "Probe after Heartbeat TIMEOUT",
393 limTimerHandler,
394 SIR_LIM_PROBE_HB_FAILURE_TIMEOUT,
395 cfgValue,
396 0,
397 TX_NO_ACTIVATE) != TX_SUCCESS)
398 {
399 // Could not creat wt-probe-after-HeartBeat-failure timer.
400 // Log error
401 limLog(pMac, LOGP,
402 FL("unable to create ProbeAfterHBTimer\n"));
403 }
404
405#if defined(ANI_OS_TYPE_RTAI_LINUX)
406 tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
407 LIM_TIMER_EXPIRY_LIST);
408#endif
409
410#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
411 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
412 &cfgValue) != eSIR_SUCCESS)
413 {
414 /**
415 * Could not get Background scan period value
416 * from CFG. Log error.
417 */
418 limLog(pMac, LOGP,
419 FL("could not retrieve Background scan period value\n"));
420 }
421
422 /*
423 * setting period to zero means disabling background scans when associated
424 * the way we do this is to set a flag indicating this and keeping
425 * the timer running, since it will be used for PDU leak workarounds
426 * as well as background scanning during SME idle states
427 */
428 if (cfgValue == 0)
429 {
430 cfgValue = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
431 pMac->lim.gLimBackgroundScanDisable = true;
432 }
433 else
434 pMac->lim.gLimBackgroundScanDisable = false;
435
436 cfgValue = SYS_MS_TO_TICKS(cfgValue);
437
438 if (tx_timer_create(&pMac->lim.limTimers.gLimBackgroundScanTimer,
439 "Background scan TIMEOUT",
440 limTimerHandler,
441 SIR_LIM_CHANNEL_SCAN_TIMEOUT,
442 cfgValue,
443 cfgValue,
444 TX_NO_ACTIVATE) != TX_SUCCESS)
445 {
446 /// Could not start background scan timer.
447 // Log error
448 limLog(pMac, LOGP,
449 FL("call to create background scan timer failed\n"));
450 }
451#endif
452 }
453
454
455 cfgValue = SYS_MS_TO_TICKS(LIM_HASH_MISS_TIMER_MS);
456
457 if (tx_timer_create(
458 &pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer,
459 "Disassoc throttle TIMEOUT",
460 limSendDisassocFrameThresholdHandler,
461 SIR_LIM_HASH_MISS_THRES_TIMEOUT,
462 cfgValue,
463 cfgValue,
464 TX_AUTO_ACTIVATE) != TX_SUCCESS)
465 {
466 /// Could not start Send Disassociate Frame Threshold timer.
467 // Log error
468 limLog(pMac, LOGP,
469 FL("create Disassociate throttle timer failed\n"));
470 }
471#if defined(ANI_OS_TYPE_RTAI_LINUX)
472 tx_timer_set_expiry_list(
473 &pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer,
474 LIM_TIMER_EXPIRY_LIST);
475#endif
476 PELOG1(limLog(pMac, LOG1,
477 FL("Created Disassociate throttle timer \n"));)
478
479 /**
480 * Create keepalive timer and activate it right away for AP role
481 */
482
483 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
484 &cfgValue) != eSIR_SUCCESS)
485 {
486 /**
487 * Could not get keepalive timeout value
488 * from CFG. Log error.
489 */
490 limLog(pMac, LOGP,
491 FL("could not retrieve keepalive timeout value\n"));
492 }
493
494 // A value of zero implies keep alive should be disabled
495 if (cfgValue == 0)
496 {
497 cfgValue = LIM_KEEPALIVE_TIMER_MS;
498 pMac->sch.keepAlive = 0;
499 } else
500 pMac->sch.keepAlive = 1;
501
502
503 cfgValue = SYS_MS_TO_TICKS(cfgValue + SYS_TICK_DUR_MS - 1);
504
505 if (tx_timer_create(&pMac->lim.limTimers.gLimKeepaliveTimer,
506 "KEEPALIVE_TIMEOUT",
507 limKeepaliveTmerHandler,
508 0,
509 cfgValue,
510 cfgValue,
511 (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ?
512 TX_AUTO_ACTIVATE : TX_NO_ACTIVATE)
513 != TX_SUCCESS)
514 {
515 // Cannot create keepalive timer. Log error.
516 limLog(pMac, LOGP, FL("Cannot create keepalive timer.\n"));
517 }
518
519 /**
520 * Create all CNF_WAIT Timers upfront
521 */
522
523 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
524 &cfgValue) != eSIR_SUCCESS)
525 {
526 /**
527 * Could not get CNF_WAIT timeout value
528 * from CFG. Log error.
529 */
530 limLog(pMac, LOGP,
531 FL("could not retrieve CNF timeout value\n"));
532 }
533 cfgValue = SYS_MS_TO_TICKS(cfgValue);
534
535 for (i=0; i<pMac->lim.maxStation; i++)
536 {
537 if (tx_timer_create(&pMac->lim.limTimers.gpLimCnfWaitTimer[i],
538 "CNF_MISS_TIMEOUT",
539 limCnfWaitTmerHandler,
540 (tANI_U32)i,
541 cfgValue,
542 0,
543 TX_NO_ACTIVATE) != TX_SUCCESS)
544 {
545 // Cannot create timer. Log error.
546 limLog(pMac, LOGP, FL("Cannot create CNF wait timer.\n"));
547 }
548 }
549
550 /*
551 ** Alloc and init table for the preAuth timer list
552 **
553 **/
554
555 // get max number of Preauthentication
556 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
557 &cfgValue) != eSIR_SUCCESS)
558 {
559 /*
560 ** Could not get max preauth value
561 ** from CFG. Log error.
562 **/
563 limLog(pMac, LOGP,
564 FL("could not retrieve mac preauth value\n"));
565 }
566#ifdef ANI_AP_SDK_OPT
567 if(cfgValue > SIR_SDK_OPT_MAX_NUM_PRE_AUTH)
568 cfgValue = SIR_SDK_OPT_MAX_NUM_PRE_AUTH;
569#endif // ANI_AP_SDK_OPT
570 pMac->lim.gLimPreAuthTimerTable.numEntry = cfgValue;
571 if (palAllocateMemory(pMac->hHdd, (void **) &pMac->lim.gLimPreAuthTimerTable.pTable,
572 cfgValue*sizeof(tLimPreAuthNode)) != eHAL_STATUS_SUCCESS)
573 {
574 limLog(pMac, LOGP, FL("palAllocateMemory failed!\n"));
575 return;
576 }
577
578 limInitPreAuthTimerTable(pMac, &pMac->lim.gLimPreAuthTimerTable);
579 PELOG1(limLog(pMac, LOG1, FL("alloc and init table for preAuth timers\n"));)
580
581
582#ifdef WLAN_SOFTAP_FEATURE
583 {
584 /**
585 * Create OLBC cache aging timer
586 */
587 if (wlan_cfgGetInt(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT,
588 &cfgValue) != eSIR_SUCCESS)
589 {
590 /**
591 * Could not get OLBC detect timeout value
592 * from CFG. Log error.
593 */
594 limLog(pMac, LOGP,
595 FL("could not retrieve OLBD detect timeout value\n"));
596 }
597
598 cfgValue = SYS_MS_TO_TICKS(cfgValue);
599
600 if (tx_timer_create(
601 &pMac->lim.limTimers.gLimUpdateOlbcCacheTimer,
602 "OLBC UPDATE CACHE TIMEOUT",
603 limUpdateOlbcCacheTimerHandler,
604 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
605 cfgValue,
606 cfgValue,
607 TX_AUTO_ACTIVATE) != TX_SUCCESS)
608 {
609 // Cannot create update OLBC cache timer
610 // Log error
611 limLog(pMac, LOGP, FL("Cannot create update OLBC cache timer\n"));
612 }
613 }
614#endif
615#ifdef WLAN_FEATURE_VOWIFI_11R
616 // In future we need to use the auth timer, cause
617 // the pre auth session will be introduced before sending
618 // Auth frame.
619 // We need to go off channel and come back to home channel
620 cfgValue = 1000;
621 cfgValue = SYS_MS_TO_TICKS(cfgValue);
622
623 if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
624 "FT PREAUTH RSP TIMEOUT",
625 limTimerHandler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT,
626 cfgValue, 0,
627 TX_NO_ACTIVATE) != TX_SUCCESS)
628 {
629 // Could not create Join failure timer.
630 // Log error
631 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
632 return;
633 }
634#endif
635
636#ifdef FEATURE_WLAN_CCX
637 cfgValue = 5000;
638 cfgValue = SYS_MS_TO_TICKS(cfgValue);
639
640 if (tx_timer_create(&pMac->lim.limTimers.gLimCcxTsmTimer,
641 "CCX TSM Stats TIMEOUT",
642 limTimerHandler, SIR_LIM_CCX_TSM_TIMEOUT,
643 cfgValue, 0,
644 TX_NO_ACTIVATE) != TX_SUCCESS)
645 {
646 // Could not create Join failure timer.
647 // Log error
648 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
649 return;
650 }
651#endif
652
653#ifdef WLAN_FEATURE_P2P
654 cfgValue = 1000;
655 cfgValue = SYS_MS_TO_TICKS(cfgValue);
656 if (tx_timer_create(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
657 "FT PREAUTH RSP TIMEOUT",
658 limTimerHandler, SIR_LIM_REMAIN_CHN_TIMEOUT,
659 cfgValue, 0,
660 TX_NO_ACTIVATE) != TX_SUCCESS)
661 {
662 // Could not create Join failure timer.
663 // Log error
664 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
665 return;
666 }
667
668#endif
669 pMac->lim.gLimTimersCreated = 1;
670} /****** end limCreateTimers() ******/
671
672
673
674/**
675 * limTimerHandler()
676 *
677 *FUNCTION:
678 * This function is called upon
679 * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
680 * 2. JOIN_FAILURE timer expiration while joining a BSS
681 * 3. AUTH_FAILURE timer expiration while authenticating with a peer
682 * 4. Heartbeat timer expiration on STA
683 * 5. Background scan timer expiration on STA
684 * 6. AID release, Pre-auth cleanup and Link monitoring timer
685 * expiration on AP
686 *
687 *LOGIC:
688 *
689 *ASSUMPTIONS:
690 * NA
691 *
692 *NOTE:
693 * NA
694 *
695 * @param param - Message corresponding to the timer that expired
696 *
697 * @return None
698 */
699
700void
701limTimerHandler(void *pMacGlobal, tANI_U32 param)
702{
703 tANI_U32 statusCode;
704 tSirMsgQ msg;
705 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
706
707 // Prepare and post message to LIM Message Queue
708
709 msg.type = (tANI_U16) param;
710 msg.bodyptr = NULL;
711 msg.bodyval = 0;
712
713 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
714 limLog(pMac, LOGE,
715 FL("posting message %X to LIM failed, reason=%d\n"),
716 msg.type, statusCode);
717} /****** end limTimerHandler() ******/
718
719
720/**
721 * limAddtsResponseTimerHandler()
722 *
723 *FUNCTION:
724 * This function is called upon Addts response timer expiration on sta
725 *
726 *LOGIC:
727 * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
728 * when this function is executed.
729 *
730 *ASSUMPTIONS:
731 * NA
732 *
733 *NOTE:
734 * NA
735 *
736 * @param param - pointer to pre-auth node
737 *
738 * @return None
739 */
740
741void
742limAddtsResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
743{
744 tSirMsgQ msg;
745 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
746
747 // Prepare and post message to LIM Message Queue
748
749 msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
750 msg.bodyval = param;
751 msg.bodyptr = NULL;
752
753 limPostMsgApi(pMac, &msg);
754} /****** end limAuthResponseTimerHandler() ******/
755
756
757/**
758 * limAuthResponseTimerHandler()
759 *
760 *FUNCTION:
761 * This function is called upon Auth response timer expiration on AP
762 *
763 *LOGIC:
764 * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
765 * when this function is executed.
766 *
767 *ASSUMPTIONS:
768 * NA
769 *
770 *NOTE:
771 * NA
772 *
773 * @param param - pointer to pre-auth node
774 *
775 * @return None
776 */
777
778void
779limAuthResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
780{
781 tSirMsgQ msg;
782 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
783
784 // Prepare and post message to LIM Message Queue
785
786 msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
787 msg.bodyptr = NULL;
788 msg.bodyval = (tANI_U32)param;
789
790 limPostMsgApi(pMac, &msg);
791} /****** end limAuthResponseTimerHandler() ******/
792
793
794
795/**
796 * limAssocFailureTimerHandler()
797 *
798 *FUNCTION:
799 * This function is called upon Re/Assoc failure timer expiration
800 * on STA
801 *
802 *LOGIC:
803 * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ
804 * when this function is executed.
805 *
806 *ASSUMPTIONS:
807 * NA
808 *
809 *NOTE:
810 * NA
811 *
812 * @param param - Indicates whether this is assoc or reassoc
813 * failure timeout
814 * @return None
815 */
816
817void
818limAssocFailureTimerHandler(void *pMacGlobal, tANI_U32 param)
819{
820 tSirMsgQ msg;
821 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
822
823 // Prepare and post message to LIM Message Queue
824
825 msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
826 msg.bodyval = (tANI_U32)param;
827 msg.bodyptr = NULL;
828
829 limPostMsgApi(pMac, &msg);
830} /****** end limAssocFailureTimerHandler() ******/
831
832
833/**
834 * limUpdateOlbcCacheTimerHandler()
835 *
836 *FUNCTION:
837 * This function is called upon update olbc cache timer expiration
838 * on STA
839 *
840 *LOGIC:
841 * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
842 * when this function is executed.
843 *
844 *ASSUMPTIONS:
845 * NA
846 *
847 *NOTE:
848 * NA
849 *
850 * @param
851 *
852 * @return None
853 */
854#ifdef WLAN_SOFTAP_FEATURE
855void
856limUpdateOlbcCacheTimerHandler(void *pMacGlobal, tANI_U32 param)
857{
858 tSirMsgQ msg;
859 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
860
861 // Prepare and post message to LIM Message Queue
862
863 msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
864 msg.bodyval = 0;
865 msg.bodyptr = NULL;
866
867 limPostMsgApi(pMac, &msg);
868} /****** end limUpdateOlbcCacheTimerHandler() ******/
869#endif
870
871/**
872 * limDeactivateAndChangeTimer()
873 *
874 *FUNCTION:
875 * This function is called to deactivate and change a timer
876 * for future re-activation
877 *
878 *LOGIC:
879 *
880 *ASSUMPTIONS:
881 * NA
882 *
883 *NOTE:
884 * NA
885 *
886 * @param pMac - Pointer to Global MAC structure
887 * @param timerId - enum of timer to be deactivated and changed
888 * This enum is defined in limUtils.h file
889 *
890 * @return None
891 */
892
893void
894limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
895{
896 tANI_U32 val=0, val1=0;
897
Jeff Johnsone7245742012-09-05 17:12:55 -0700898 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
Jeff Johnson295189b2012-06-20 16:38:30 -0700899
900 switch (timerId)
901 {
902 case eLIM_ADDTS_RSP_TIMER:
903 pMac->lim.gLimAddtsRspTimerCount++;
904 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
905 {
906 // Could not deactivate AddtsRsp Timer
907 // Log error
908 limLog(pMac, LOGP,
909 FL("Unable to deactivate AddtsRsp timer\n"));
910 }
911 break;
912
913 case eLIM_MIN_CHANNEL_TIMER:
914 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer)
915 != TX_SUCCESS)
916 {
917 // Could not deactivate min channel timer.
918 // Log error
919 limLog(pMac, LOGP,
920 FL("Unable to deactivate min channel timer\n"));
921 }
922
Jeff Johnsone7245742012-09-05 17:12:55 -0700923#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700924 // If a background was triggered via Quiet BSS,
925 // then we need to adjust the MIN and MAX channel
926 // timer's accordingly to the Quiet duration that
927 // was specified
928 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
929 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
930 {
931 // gLimQuietDuration is already cached in units of
932 // system ticks. No conversion is reqd...
933 val = pMac->lim.gLimSpecMgmt.quietDuration;
934 }
935 else
936 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700937#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700938 if(pMac->lim.gpLimMlmScanReq)
939 {
940 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
941 }
942 else
943 {
944 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
945 //No need to change min timer. This is not a scan
946 break;
947 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700948#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700949 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700950#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700951
952 if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
953 val, 0) != TX_SUCCESS)
954 {
955 // Could not change min channel timer.
956 // Log error
957 limLog(pMac, LOGP, FL("Unable to change min channel timer\n"));
958 }
959
960 break;
961
962 case eLIM_PERIODIC_PROBE_REQ_TIMER:
963 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
964 != TX_SUCCESS)
965 {
966 // Could not deactivate min channel timer.
967 // Log error
968 limLog(pMac, LOGP,
969 FL("Unable to deactivate periodic timer\n"));
970 }
971
972 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
973 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
974 val, 0) != TX_SUCCESS)
975 {
976 // Could not change min channel timer.
977 // Log error
978 limLog(pMac, LOGP, FL("Unable to change periodic timer\n"));
979 }
980
981 break;
982
983 case eLIM_MAX_CHANNEL_TIMER:
984 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
985 != TX_SUCCESS)
986 {
987 // Could not deactivate max channel timer.
988 // Log error
989 limLog(pMac, LOGP,
990 FL("Unable to deactivate max channel timer\n"));
991 }
992
993#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
994 // If a background was triggered via Quiet BSS,
995 // then we need to adjust the MIN and MAX channel
996 // timer's accordingly to the Quiet duration that
997 // was specified
998 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
999 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001000#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001001
1002 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1003 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1004 {
1005 // gLimQuietDuration is already cached in units of
1006 // system ticks. No conversion is reqd...
1007 val = pMac->lim.gLimSpecMgmt.quietDuration;
1008 }
1009 else
1010 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001011#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 if(pMac->lim.gpLimMlmScanReq)
1013 {
1014 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
1015 }
1016 else
1017 {
1018 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1019 //No need to change max timer. This is not a scan
1020 break;
1021 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001022#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001024#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 }
1026#endif
1027#if defined(ANI_PRODUCT_TYPE_AP)
1028 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1029 {
1030 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
1031 &val) != eSIR_SUCCESS)
1032 {
1033 /**
1034 * Could not get max channel value
1035 * from CFG. Log error.
1036 */
1037 limLog(pMac, LOGP,
1038 FL("could not retrieve max channel value\n"));
1039 }
1040 val = SYS_MS_TO_TICKS(val);
1041 }
1042#endif
1043
1044 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
1045 val, 0) != TX_SUCCESS)
1046 {
1047 // Could not change max channel timer.
1048 // Log error
1049 limLog(pMac, LOGP,
1050 FL("Unable to change max channel timer\n"));
1051 }
1052
1053 break;
1054
1055 case eLIM_JOIN_FAIL_TIMER:
1056 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
1057 != TX_SUCCESS)
1058 {
1059 /**
1060 * Could not deactivate Join Failure
1061 * timer. Log error.
1062 */
1063 limLog(pMac, LOGP,
1064 FL("Unable to deactivate Join Failure timer\n"));
1065 }
1066
1067 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1068 &val) != eSIR_SUCCESS)
1069 {
1070 /**
1071 * Could not get JoinFailureTimeout value
1072 * from CFG. Log error.
1073 */
1074 limLog(pMac, LOGP,
1075 FL("could not retrieve JoinFailureTimeout value\n"));
1076 }
1077 val = SYS_MS_TO_TICKS(val);
1078
1079 if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
1080 val, 0) != TX_SUCCESS)
1081 {
1082 /**
1083 * Could not change Join Failure
1084 * timer. Log error.
1085 */
1086 limLog(pMac, LOGP,
1087 FL("Unable to change Join Failure timer\n"));
1088 }
1089
1090 break;
1091
1092 case eLIM_AUTH_FAIL_TIMER:
1093 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
1094 != TX_SUCCESS)
1095 {
1096 // Could not deactivate Auth failure timer.
1097 // Log error
1098 limLog(pMac, LOGP,
1099 FL("Unable to deactivate auth failure timer\n"));
1100 }
1101
1102 // Change timer to reactivate it in future
1103 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
1104 &val) != eSIR_SUCCESS)
1105 {
1106 /**
1107 * Could not get AuthFailureTimeout value
1108 * from CFG. Log error.
1109 */
1110 limLog(pMac, LOGP,
1111 FL("could not retrieve AuthFailureTimeout value\n"));
1112 }
1113 val = SYS_MS_TO_TICKS(val);
1114
1115 if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
1116 val, 0) != TX_SUCCESS)
1117 {
1118 // Could not change Authentication failure timer.
1119 // Log error
1120 limLog(pMac, LOGP,
1121 FL("unable to change Auth failure timer\n"));
1122 }
1123
1124 break;
1125
1126 case eLIM_ASSOC_FAIL_TIMER:
1127 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
1128 TX_SUCCESS)
1129 {
1130 // Could not deactivate Association failure timer.
1131 // Log error
1132 limLog(pMac, LOGP,
1133 FL("unable to deactivate Association failure timer\n"));
1134 }
1135
1136 // Change timer to reactivate it in future
1137 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
1138 &val) != eSIR_SUCCESS)
1139 {
1140 /**
1141 * Could not get AssocFailureTimeout value
1142 * from CFG. Log error.
1143 */
1144 limLog(pMac, LOGP,
1145 FL("could not retrieve AssocFailureTimeout value\n"));
1146 }
1147 val = SYS_MS_TO_TICKS(val);
1148
1149 if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
1150 val, 0) != TX_SUCCESS)
1151 {
1152 // Could not change Association failure timer.
1153 // Log error
1154 limLog(pMac, LOGP,
1155 FL("unable to change Assoc failure timer\n"));
1156 }
1157
1158 break;
1159
1160 case eLIM_REASSOC_FAIL_TIMER:
1161 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
1162 TX_SUCCESS)
1163 {
1164 // Could not deactivate Reassociation failure timer.
1165 // Log error
1166 limLog(pMac, LOGP,
1167 FL("unable to deactivate Reassoc failure timer\n"));
1168 }
1169
1170 // Change timer to reactivate it in future
1171 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1172 &val) != eSIR_SUCCESS)
1173 {
1174 /**
1175 * Could not get ReassocFailureTimeout value
1176 * from CFG. Log error.
1177 */
1178 limLog(pMac, LOGP,
1179 FL("could not retrieve ReassocFailureTimeout value\n"));
1180 }
1181 val = SYS_MS_TO_TICKS(val);
1182
1183 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
1184 val, 0) != TX_SUCCESS)
1185 {
1186 // Could not change Reassociation failure timer.
1187 // Log error
1188 limLog(pMac, LOGP,
1189 FL("unable to change Reassociation failure timer\n"));
1190 }
1191
1192 break;
1193
1194 case eLIM_HEART_BEAT_TIMER:
1195 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
1196 TX_SUCCESS)
1197 {
1198 // Could not deactivate Heartbeat timer.
1199 // Log error
1200 limLog(pMac, LOGP,
1201 FL("unable to deactivate Heartbeat timer\n"));
1202 }
1203
1204 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
1205 &val) != eSIR_SUCCESS)
1206 {
1207 /**
1208 * Could not get BEACON_INTERVAL value
1209 * from CFG. Log error.
1210 */
1211 limLog(pMac, LOGP,
1212 FL("could not retrieve BEACON_INTERVAL value\n"));
1213 }
1214
1215 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
1216 eSIR_SUCCESS)
1217 limLog(pMac, LOGP,
1218 FL("could not retrieve heartbeat failure value\n"));
1219
1220 // Change timer to reactivate it in future
1221 val = SYS_MS_TO_TICKS(val * val1);
1222
1223 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
1224 val, 0) != TX_SUCCESS)
1225 {
1226 // Could not change HeartBeat timer.
1227 // Log error
1228 limLog(pMac, LOGP,
1229 FL("unable to change HeartBeat timer\n"));
1230 }
1231
1232 break;
1233
1234 case eLIM_PROBE_AFTER_HB_TIMER:
1235 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
1236 TX_SUCCESS)
1237 {
1238 // Could not deactivate Heartbeat timer.
1239 // Log error
1240 limLog(pMac, LOGP,
1241 FL("unable to deactivate probeAfterHBTimer\n"));
1242 }
1243
1244 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
1245 &val) != eSIR_SUCCESS)
1246 {
1247 /**
1248 * Could not get PROBE_AFTER_HB_FAILURE
1249 * value from CFG. Log error.
1250 */
1251 limLog(pMac, LOGP,
1252 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
1253 }
1254
1255 // Change timer to reactivate it in future
1256 val = SYS_MS_TO_TICKS(val);
1257
1258 if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
1259 val, 0) != TX_SUCCESS)
1260 {
1261 // Could not change HeartBeat timer.
1262 // Log error
1263 limLog(pMac, LOGP,
1264 FL("unable to change ProbeAfterHBTimer\n"));
1265 }
1266
1267 break;
1268
1269 case eLIM_KEEPALIVE_TIMER:
1270 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
1271 != TX_SUCCESS)
1272 {
1273 // Could not deactivate Keepalive timer.
1274 // Log error
1275 limLog(pMac, LOGP,
1276 FL("unable to deactivate KeepaliveTimer timer\n"));
1277 }
1278
1279 // Change timer to reactivate it in future
1280
1281 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
1282 &val) != eSIR_SUCCESS)
1283 {
1284 /**
1285 * Could not get keepalive timeout value
1286 * from CFG. Log error.
1287 */
1288 limLog(pMac, LOGP,
1289 FL("could not retrieve keepalive timeout value\n"));
1290 }
1291 if (val == 0)
1292 {
1293 val = 3000;
1294 pMac->sch.keepAlive = 0;
1295 } else
1296 pMac->sch.keepAlive = 1;
1297
1298
1299
1300 val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
1301
1302 if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
1303 val, val) != TX_SUCCESS)
1304 {
1305 // Could not change KeepaliveTimer timer.
1306 // Log error
1307 limLog(pMac, LOGP,
1308 FL("unable to change KeepaliveTimer timer\n"));
1309 }
1310
1311 break;
1312
1313#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1314 case eLIM_BACKGROUND_SCAN_TIMER:
1315 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
1316 != TX_SUCCESS)
1317 {
1318 // Could not deactivate BackgroundScanTimer timer.
1319 // Log error
1320 limLog(pMac, LOGP,
1321 FL("unable to deactivate BackgroundScanTimer timer\n"));
1322 }
1323
1324 // Change timer to reactivate it in future
1325 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
1326 &val) != eSIR_SUCCESS)
1327 {
1328 /**
1329 * Could not get Background scan period value
1330 * from CFG. Log error.
1331 */
1332 limLog(pMac, LOGP,
1333 FL("could not retrieve Background scan period value\n"));
1334 }
1335 if (val == 0)
1336 {
1337 val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
1338 pMac->lim.gLimBackgroundScanDisable = true;
1339 }
1340 else
1341 pMac->lim.gLimBackgroundScanDisable = false;
1342
1343 val = SYS_MS_TO_TICKS(val);
1344
1345 if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
1346 val, val) != TX_SUCCESS)
1347 {
1348 // Could not change BackgroundScanTimer timer.
1349 // Log error
1350 limLog(pMac, LOGP,
1351 FL("unable to change BackgroundScanTimer timer\n"));
1352 }
1353
1354 break;
1355#endif
1356
1357#ifdef ANI_PRODUCT_TYPE_AP
1358 case eLIM_PRE_AUTH_CLEANUP_TIMER:
1359 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer) !=
1360 TX_SUCCESS)
1361 {
1362 // Could not deactivate Pre-auth cleanup timer.
1363 // Log error
1364 limLog(pMac, LOGP,
1365 FL("unable to deactivate Pre-auth cleanup timer\n"));
1366 }
1367
1368 // Change timer to reactivate it in future
1369 if (wlan_cfgGetInt(pMac, WNI_CFG_PREAUTH_CLNUP_TIMEOUT,
1370 &val) != eSIR_SUCCESS)
1371 {
1372 /**
1373 * Could not get pre-auth cleanup value
1374 * from CFG. Log error.
1375 */
1376 limLog(pMac, LOGP,
1377 FL("could not retrieve pre-auth cleanup value\n"));
1378 }
1379 val = SYS_MS_TO_TICKS(val);
1380
1381 if (tx_timer_change(&pMac->lim.limTimers.gLimPreAuthClnupTimer,
1382 val, val) != TX_SUCCESS)
1383 {
1384 // Could not change pre-auth cleanup timer.
1385 // Log error
1386 limLog(pMac, LOGP,
1387 FL("unable to change pre-auth cleanup timer\n"));
1388 }
1389
1390 break;
1391
1392 case eLIM_LEARN_INTERVAL_TIMER:
1393 {
1394 // Restart Learn Interval timer
1395 tANI_U32 learnInterval =
1396 pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
1397 pMac->lim.gpLimMeasReq->channelList.numChannels;
1398
1399 if (tx_timer_deactivate(
1400 &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
1401 {
1402 // Could not deactivate Learn Interval timer.
1403 // Log error
1404 limLog(pMac, LOGP,
1405 FL("Unable to deactivate Learn Interval timer\n"));
1406 }
1407
1408 if (tx_timer_change(
1409 &pMac->lim.gLimMeasParams.learnIntervalTimer,
1410 SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
1411 {
1412 // Could not change Learn Interval timer.
1413 // Log error
1414 limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
1415
1416 return;
1417 }
1418
1419 limLog( pMac, LOG3,
1420 FL("Setting the Learn Interval TIMER to %d ticks\n"),
1421 SYS_MS_TO_TICKS(learnInterval));
1422 }
1423 break;
1424
1425#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001426#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 case eLIM_CHANNEL_SWITCH_TIMER:
1428 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
1429 {
1430 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
1431 return;
1432 }
1433
1434 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
1435 pMac->lim.gLimChannelSwitch.switchTimeoutValue,
1436 0) != TX_SUCCESS)
1437 {
1438 limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
1439 return;
1440 }
1441 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001442#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001443
1444 case eLIM_LEARN_DURATION_TIMER:
1445#ifdef ANI_PRODUCT_TYPE_AP
1446 if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
1447 {
1448 limLog(pMac, LOGP, FL("Could not deactivate learn duration timer\n"));
1449 return;
1450 }
1451
1452 if (pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity &&
1453 (pMac->lim.gLimMeasParams.shortDurationCount ==
1454 pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity))
1455 {
1456#ifdef ANI_AP_SDK
1457 val = pMac->lim.gLimScanDurationConvert.longChannelScanDuration_tick;
1458#else
1459 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration
1460 + SYS_TICK_DUR_MS - 1);
1461 if(val > 1)
1462 val--;
1463#endif /* ANI_AP_SDK */
1464 // Time to perform measurements for longer term
1465 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1466 val, 0) != TX_SUCCESS)
1467 {
1468 // Could not change Learn duration timer.
1469 // Log error
1470 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1471 return;
1472 }
1473 pMac->lim.gLimMeasParams.shortDurationCount = 0;
1474 }
1475 else
1476 {
1477#ifdef ANI_AP_SDK
1478 val = pMac->lim.gLimScanDurationConvert.shortChannelScanDuration_tick;
1479#else
1480 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration
1481 + SYS_TICK_DUR_MS - 1);
1482 if(val > 1)
1483 val--;
1484#endif /* ANI_AP_SDK */
1485 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1486 val, 0) != TX_SUCCESS)
1487 {
1488 // Could not change Learn duration timer.
1489 // Log error
1490 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1491 }
1492 }
1493 pMac->lim.gpLimMeasData->duration = val * SYS_TICK_DUR_MS;
1494#endif
1495 break;
1496
Jeff Johnsone7245742012-09-05 17:12:55 -07001497#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 case eLIM_QUIET_BSS_TIMER:
1499 if (TX_SUCCESS !=
1500 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
1501 {
1502 limLog( pMac, LOGE,
1503 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway...\n"));
1504 }
1505
1506 // gLimQuietDuration appears to be in units of ticks
1507 // Use it as is
1508 if (TX_SUCCESS !=
1509 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
1510 pMac->lim.gLimSpecMgmt.quietDuration,
1511 0))
1512 {
1513 limLog( pMac, LOGE,
1514 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway...\n"));
1515 }
1516 break;
1517
1518 case eLIM_QUIET_TIMER:
1519 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
1520 {
1521 limLog( pMac, LOGE,
1522 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1523 }
1524
1525 // Set the NEW timeout value, in ticks
1526 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
1527 SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
1528 {
1529 limLog( pMac, LOGE,
1530 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1531 }
1532 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001533#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001534
1535#ifdef WLAN_SOFTAP_FEATURE
1536#if 0
1537 case eLIM_WPS_OVERLAP_TIMER:
1538 {
1539 // Restart Learn Interval timer
1540
1541 tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
1542
1543 if (tx_timer_deactivate(
1544 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1545 {
1546 // Could not deactivate Learn Interval timer.
1547 // Log error
1548 limLog(pMac, LOGP,
1549 FL("Unable to deactivate WPS overlap timer\n"));
1550 }
1551
1552 if (tx_timer_change(
1553 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1554 WPSOverlapTimer, 0) != TX_SUCCESS)
1555 {
1556 // Could not change Learn Interval timer.
1557 // Log error
1558 limLog(pMac, LOGP, FL("Unable to change WPS overlap timer\n"));
1559
1560 return;
1561 }
1562
1563 limLog( pMac, LOGE,
1564 FL("Setting WPS overlap TIMER to %d ticks\n"),
1565 WPSOverlapTimer);
1566 }
1567 break;
1568#endif
1569#endif
1570
1571#ifdef WLAN_FEATURE_VOWIFI_11R
1572 case eLIM_FT_PREAUTH_RSP_TIMER:
1573 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != TX_SUCCESS)
1574 {
1575 /**
1576 ** Could not deactivate Join Failure
1577 ** timer. Log error.
1578 **/
1579 limLog(pMac, LOGP, FL("Unable to deactivate Preauth response Failure timer\n"));
1580 }
1581 val = 1000;
1582 val = SYS_MS_TO_TICKS(val);
1583 if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
1584 val, 0) != TX_SUCCESS)
1585 {
1586 /**
1587 * Could not change Join Failure
1588 * timer. Log error.
1589 */
1590 limLog(pMac, LOGP, FL("Unable to change Join Failure timer\n"));
1591 }
1592 break;
1593#endif
1594#ifdef FEATURE_WLAN_CCX
1595 case eLIM_TSM_TIMER:
1596 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer)
1597 != TX_SUCCESS)
1598 {
1599 limLog(pMac, LOGE, FL("Unable to deactivate TSM timer\n"));
1600 }
1601 break;
1602#endif
1603#ifdef WLAN_FEATURE_P2P
1604 case eLIM_REMAIN_CHN_TIMER:
1605 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer) != TX_SUCCESS)
1606 {
1607 /**
1608 ** Could not deactivate Join Failure
1609 ** timer. Log error.
1610 **/
1611 limLog(pMac, LOGP, FL("Unable to deactivate Remain on Chn timer\n"));
1612 }
1613 val = 1000;
1614 val = SYS_MS_TO_TICKS(val);
1615 if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
1616 val, 0) != TX_SUCCESS)
1617 {
1618 /**
1619 * Could not change Join Failure
1620 * timer. Log error.
1621 */
1622 limLog(pMac, LOGP, FL("Unable to change timer\n"));
1623 }
1624 break;
1625#endif
1626
1627 default:
1628 // Invalid timerId. Log error
1629 break;
1630 }
1631} /****** end limDeactivateAndChangeTimer() ******/
1632
1633
1634
1635/**---------------------------------------------------------------
1636\fn limHeartBeatDeactivateAndChangeTimer
1637\brief This function deactivates and changes the heart beat
1638\ timer, eLIM_HEART_BEAT_TIMER.
1639\
1640\param pMac
1641\param psessionEntry
1642\return None
1643------------------------------------------------------------------*/
1644void
1645limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1646{
1647 tANI_U32 val, val1;
1648
Jeff Johnsone7245742012-09-05 17:12:55 -07001649 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001650
1651 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
1652 limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer \n"));
1653
1654 /* HB Timer sessionisation: In case of 2 or more sessions, the HB interval keeps
1655 changing. to avoid this problem, HeartBeat interval is made constant, by
1656 fixing beacon interval to 100ms immaterial of the beacon interval of the session */
1657
1658 //val = psessionEntry->beaconParams.beaconInterval;
1659 val = LIM_HB_TIMER_BEACON_INTERVAL;
1660
1661 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
1662 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_HEART_BEAT_THRESHOLD \n"));
1663
1664 PELOGW(limLog(pMac,LOGW,
1665 FL("HB Timer Int.=100ms * %d, Beacon Int.=%dms,Session Id=%d \n"),
1666 val1, psessionEntry->beaconParams.beaconInterval,
1667 psessionEntry->peSessionId);)
1668
1669 // Change timer to reactivate it in future
1670 val = SYS_MS_TO_TICKS(val * val1);
1671
1672 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer, val, 0) != TX_SUCCESS)
1673 limLog(pMac, LOGP, FL("Fail to change HeartBeatTimer\n"));
1674
1675} /****** end limHeartBeatDeactivateAndChangeTimer() ******/
1676
1677
1678/**---------------------------------------------------------------
1679\fn limReactivateHeartBeatTimer
1680\brief This function s called to deactivate, change and
1681\ activate a timer.
1682\
1683\param pMac - Pointer to Global MAC structure
1684\param psessionEntry
1685\return None
1686------------------------------------------------------------------*/
1687void
1688limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1689{
1690 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"), psessionEntry->LimRxedBeaconCntDuringHB);)
1691
1692 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001693 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001694
1695 //only start the hearbeat-timer if the timeout value is non-zero
1696 if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0) {
1697 if (tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
1698 {
1699 limLog(pMac, LOGP,FL("could not activate Heartbeat timer\n"));
1700 }
1701 limResetHBPktCount(psessionEntry);
1702 }
1703
1704} /****** end limReactivateHeartBeatTimer() ******/
1705
1706#if 0
1707/******
1708 * Note: Use this code once you have converted all
1709 * limReactivateHeartBeatTimer() calls to
1710 * limReactivateTimer() calls.
1711 *
1712 ******/
1713
1714Now, in dev/btamp2,
1715here are all the references to limReactivateHeartBeatTimer().
1716
1717C symbol: limReactivateHeartBeatTimer
1718
1719 File Function Line
17200 limTimerUtils.h <global> 55 void limReactivateHeartBeatTimer(tpAniSirGlobal , tpPESession);
17211 limIbssPeerMgmt.c limIbssHeartBeatHandle 1282 limReactivateHeartBeatTimer(pMac, psessionEntry);
17222 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 395 limReactivateHeartBeatTimer(pMac, psessionEntry);
17233 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 410 limReactivateHeartBeatTimer(pMac, psessionEntry);
17244 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
17255 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2350 limReactivateHeartBeatTimer(pMac, psessionEntry);
17266 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
17277 limTimerUtils.c limReactivateHeartBeatTim 1473 limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
17288 limUtils.c limHandleHeartBeatFailure 6743 limReactivateHeartBeatTimer(pMac, psessionEntry);
17299 limUtils.c limHandleHeartBeatFailure 6751 limReactivateHeartBeatTimer(pMac, psessionEntry);
1730
1731Now, in main/latest, on the other hand,
1732here are all the references to limReactivateTimer().
1733
1734C symbol: limReactivateTimer
1735
1736 File Function Line
17370 limTimerUtils.h <global> 54 void limReactivateTimer(tpAniSirGlobal, tANI_U32);
17381 limIbssPeerMgmt.c limIbssHeartBeatHandle 1183 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17392 limIbssPeerMgmt.c limIbssHeartBeatHandle 1246 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17403 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 283 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17414 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 320 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17425 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 335 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17436 limProcessMessageQueue.c limProcessMessages 1210 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17447 limProcessMessageQueue.c limProcessMessages 1218 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17458 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 1726 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17469 limTimerUtils.c limReactivateTimer 1451 limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1747
1748
1749/**
1750 * limReactivateTimer()
1751 *
1752 *FUNCTION:
1753 * This function is called to deactivate, change and
1754 * activate a timer
1755 *
1756 *LOGIC:
1757 *
1758 *ASSUMPTIONS:
1759 * NA
1760 *
1761 *NOTE:
1762 * NA
1763 *
1764 * @param pMac - Pointer to Global MAC structure
1765 * @param timerId - enum of timer to be deactivated and changed
1766 * This enum is defined in limUtils.h file
1767 *
1768 * @return None
1769 */
1770
1771void
1772limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1773{
1774 if (timerId == eLIM_HEART_BEAT_TIMER)
1775 {
1776 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"),
1777 pMac->lim.gLimRxedBeaconCntDuringHB);)
1778 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
1779 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
1780 if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
1781 {
1782 /// Could not activate Heartbeat timer.
1783 // Log error
1784 limLog(pMac, LOGP,
1785 FL("could not activate Heartbeat timer\n"));
1786 }
1787 limResetHBPktCount(pMac);
1788 }
1789} /****** end limReactivateTimer() ******/
1790#endif
1791
1792
1793/**
1794 * limActivateHearBeatTimer()
1795 *
1796 *
1797 * @brief: This function is called to activate heartbeat timer
1798 *
1799 *LOGIC:
1800 *
1801 *ASSUMPTIONS:
1802 * NA
1803 *
1804 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
1805 *
1806 * @param pMac - Pointer to Global MAC structure
1807 *
1808 * @return TX_SUCCESS - timer is activated
1809 * errors - fail to start the timer
1810 */
1811v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac)
1812{
1813 v_UINT_t status = TX_TIMER_ERROR;
1814
1815 if(TX_AIRGO_TMR_SIGNATURE == pMac->lim.limTimers.gLimHeartBeatTimer.tmrSignature)
1816 {
1817 //consider 0 interval a ok case
1818 if( pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs )
1819 {
1820 status = tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1821 if( TX_SUCCESS != status )
1822 {
1823 PELOGE(limLog(pMac, LOGE,
1824 FL("could not activate Heartbeat timer status(%d)\n"), status);)
1825 }
1826 }
1827 else
1828 {
1829 status = TX_SUCCESS;
1830 }
1831 }
1832
1833 return (status);
1834}
1835
1836
1837
1838/**
1839 * limDeactivateAndChangePerStaIdTimer()
1840 *
1841 *
1842 * @brief: This function is called to deactivate and change a per STA timer
1843 * for future re-activation
1844 *
1845 *LOGIC:
1846 *
1847 *ASSUMPTIONS:
1848 * NA
1849 *
1850 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
1851 *
1852 * @param pMac - Pointer to Global MAC structure
1853 * @param timerId - enum of timer to be deactivated and changed
1854 * This enum is defined in limUtils.h file
1855 * @param staId - staId
1856 *
1857 * @return None
1858 */
1859
1860void
1861limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
1862{
1863 tANI_U32 val;
Jeff Johnsone7245742012-09-05 17:12:55 -07001864 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001865
1866 switch (timerId)
1867 {
1868 case eLIM_CNF_WAIT_TIMER:
1869
1870 if (tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
1871 != TX_SUCCESS)
1872 {
1873 limLog(pMac, LOGP,
1874 FL("unable to deactivate CNF wait timer\n"));
1875
1876 }
1877
1878 // Change timer to reactivate it in future
1879
1880 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
1881 &val) != eSIR_SUCCESS)
1882 {
1883 /**
1884 * Could not get cnf timeout value
1885 * from CFG. Log error.
1886 */
1887 limLog(pMac, LOGP,
1888 FL("could not retrieve cnf timeout value\n"));
1889 }
1890 val = SYS_MS_TO_TICKS(val);
1891
1892 if (tx_timer_change(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId],
1893 val, val) != TX_SUCCESS)
1894 {
1895 // Could not change cnf timer.
1896 // Log error
1897 limLog(pMac, LOGP, FL("unable to change cnf wait timer\n"));
1898 }
1899
1900 break;
1901
1902 case eLIM_AUTH_RSP_TIMER:
1903 {
1904 tLimPreAuthNode *pAuthNode;
1905
1906 pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, staId);
1907
1908 if (pAuthNode == NULL)
1909 {
1910 limLog(pMac, LOGP, FL("Invalid Pre Auth Index passed :%d\n"), staId);
1911 break;
1912 }
1913
1914 if (tx_timer_deactivate(&pAuthNode->timer) != TX_SUCCESS)
1915 {
1916 // Could not deactivate auth response timer.
1917 // Log error
1918 limLog(pMac, LOGP, FL("unable to deactivate auth response timer\n"));
1919 }
1920
1921 // Change timer to reactivate it in future
1922
1923 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, &val) != eSIR_SUCCESS)
1924 {
1925 /**
1926 * Could not get auth rsp timeout value
1927 * from CFG. Log error.
1928 */
1929 limLog(pMac, LOGP,
1930 FL("could not retrieve auth response timeout value\n"));
1931 }
1932
1933 val = SYS_MS_TO_TICKS(val);
1934
1935 if (tx_timer_change(&pAuthNode->timer, val, 0) != TX_SUCCESS)
1936 {
1937 // Could not change auth rsp timer.
1938 // Log error
1939 limLog(pMac, LOGP, FL("unable to change auth rsp timer\n"));
1940 }
1941 }
1942 break;
1943
1944#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
1945 case eLIM_LEARN_INTERVAL_TIMER:
1946 {
1947 // Restart Learn Interval timer
1948 tANI_U32 learnInterval =
1949 pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
1950 pMac->lim.gpLimMeasReq->channelList.numChannels;
1951
1952 if (tx_timer_deactivate(
1953 &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
1954 {
1955 // Could not deactivate Learn Interval timer.
1956 // Log error
1957 limLog(pMac, LOGP,
1958 FL("Unable to deactivate Learn Interval timer\n"));
1959 }
1960
1961 if (tx_timer_change(
1962 &pMac->lim.gLimMeasParams.learnIntervalTimer,
1963 SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
1964 {
1965 // Could not change Learn Interval timer.
1966 // Log error
1967 limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
1968
1969 return;
1970 }
1971
1972 limLog( pMac, LOG3,
1973 FL("Setting the Learn Interval TIMER to %d ticks\n"),
1974 SYS_MS_TO_TICKS(learnInterval) );
1975 }
1976 break;
1977#endif //#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
1978
1979 default:
1980 // Invalid timerId. Log error
1981 break;
1982
1983 }
1984}
1985
1986
1987/**
1988 * limActivateCnfTimer()
1989 *
1990 *FUNCTION:
1991 * This function is called to activate a per STA timer
1992 *
1993 *LOGIC:
1994 *
1995 *ASSUMPTIONS:
1996 * NA
1997 *
1998 *NOTE:
1999 * NA
2000 *
2001 * @param pMac - Pointer to Global MAC structure
2002 * @param StaId - staId
2003 *
2004 * @return None
2005 */
2006
2007void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
2008{
Jeff Johnsone7245742012-09-05 17:12:55 -07002009 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_CNF_WAIT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
2011 if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2012 != TX_SUCCESS)
2013 {
2014 limLog(pMac, LOGP,
2015 FL("could not activate cnf wait timer\n"));
2016 }
2017}
2018
2019/**
2020 * limActivateAuthRspTimer()
2021 *
2022 *FUNCTION:
2023 * This function is called to activate a per STA timer
2024 *
2025 *LOGIC:
2026 *
2027 *ASSUMPTIONS:
2028 * NA
2029 *
2030 *NOTE:
2031 * NA
2032 *
2033 * @param pMac - Pointer to Global MAC structure
2034 * @param id - id
2035 *
2036 * @return None
2037 */
2038
2039void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
2040{
Jeff Johnsone7245742012-09-05 17:12:55 -07002041 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_AUTH_RESP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
2043 {
2044 /// Could not activate auth rsp timer.
2045 // Log error
2046 limLog(pMac, LOGP,
2047 FL("could not activate auth rsp timer\n"));
2048 }
2049}
2050
2051
2052/**
2053 * limSendDisassocFrameThresholdHandler()
2054 *
2055 *FUNCTION:
2056 * This function reloads the credit to the send disassociate frame bucket
2057 *
2058 *LOGIC:
2059 *
2060 *ASSUMPTIONS:
2061 *
2062 *NOTE:
2063 * NA
2064 *
2065 * @param
2066 *
2067 * @return None
2068 */
2069
2070void
2071limSendDisassocFrameThresholdHandler(void *pMacGlobal, tANI_U32 param)
2072{
2073 tSirMsgQ msg;
2074 tANI_U32 statusCode;
2075 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2076
2077 msg.type = SIR_LIM_HASH_MISS_THRES_TIMEOUT;
2078 msg.bodyval = 0;
2079 msg.bodyptr = NULL;
2080
2081 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2082 limLog(pMac, LOGE,
2083 FL("posting to LIM failed, reason=%d\n"), statusCode);
2084
2085}
2086
2087/**
2088 * limAssocCnfWaitTmerHandler()
2089 *
2090 *FUNCTION:
2091 * This function post a message to send a disassociate frame out.
2092 *
2093 *LOGIC:
2094 *
2095 *ASSUMPTIONS:
2096 *
2097 *NOTE:
2098 * NA
2099 *
2100 * @param
2101 *
2102 * @return None
2103 */
2104
2105void
2106limCnfWaitTmerHandler(void *pMacGlobal, tANI_U32 param)
2107{
2108 tSirMsgQ msg;
2109 tANI_U32 statusCode;
2110 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2111
2112 msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
2113 msg.bodyval = (tANI_U32)param;
2114 msg.bodyptr = NULL;
2115
2116 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2117 limLog(pMac, LOGE,
2118 FL("posting to LIM failed, reason=%d\n"), statusCode);
2119
2120}
2121
2122/**
2123 * limKeepaliveTmerHandler()
2124 *
2125 *FUNCTION:
2126 * This function post a message to send a NULL data frame.
2127 *
2128 *LOGIC:
2129 *
2130 *ASSUMPTIONS:
2131 *
2132 *NOTE:
2133 * NA
2134 *
2135 * @param
2136 *
2137 * @return None
2138 */
2139
2140void
2141limKeepaliveTmerHandler(void *pMacGlobal, tANI_U32 param)
2142{
2143 tSirMsgQ msg;
2144 tANI_U32 statusCode;
2145 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2146
2147 msg.type = SIR_LIM_KEEPALIVE_TIMEOUT;
2148 msg.bodyval = (tANI_U32)param;
2149 msg.bodyptr = NULL;
2150
2151 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2152 limLog(pMac, LOGE,
2153 FL("posting to LIM failed, reason=%d\n"), statusCode);
2154
2155}
2156
2157void
2158limChannelSwitchTimerHandler(void *pMacGlobal, tANI_U32 param)
2159{
2160 tSirMsgQ msg;
2161 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2162
2163 PELOG1(limLog(pMac, LOG1,
2164 FL("ChannelSwitch Timer expired. Posting msg to LIM \n"));)
2165
2166 msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
2167 msg.bodyval = (tANI_U32)param;
2168 msg.bodyptr = NULL;
2169
2170 limPostMsgApi(pMac, &msg);
2171}
2172
2173void
2174limQuietTimerHandler(void *pMacGlobal, tANI_U32 param)
2175{
2176 tSirMsgQ msg;
2177 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2178
2179 msg.type = SIR_LIM_QUIET_TIMEOUT;
2180 msg.bodyval = (tANI_U32)param;
2181 msg.bodyptr = NULL;
2182
2183 PELOG1(limLog(pMac, LOG1,
2184 FL("Post SIR_LIM_QUIET_TIMEOUT msg. \n"));)
2185 limPostMsgApi(pMac, &msg);
2186}
2187
2188void
2189limQuietBssTimerHandler(void *pMacGlobal, tANI_U32 param)
2190{
2191 tSirMsgQ msg;
2192 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2193
2194 msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
2195 msg.bodyval = (tANI_U32)param;
2196 msg.bodyptr = NULL;
2197 PELOG1(limLog(pMac, LOG1,
2198 FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. \n"));)
2199 limPostMsgApi(pMac, &msg);
2200}
2201#ifdef WLAN_SOFTAP_FEATURE
2202#if 0
2203void
2204limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
2205{
2206 tSirMsgQ msg;
2207 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2208
2209 msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
2210 msg.bodyval = (tANI_U32)param;
2211 msg.bodyptr = NULL;
2212 PELOG1(limLog(pMac, LOG1,
2213 FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. \n"));)
2214 limPostMsgApi(pMac, &msg);
2215}
2216#endif
2217#endif