blob: fd0b2a5510522f106dafa2a807ca3a8112d9d9df [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
898 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, timerId));
899
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
923 // If a background was triggered via Quiet BSS,
924 // then we need to adjust the MIN and MAX channel
925 // timer's accordingly to the Quiet duration that
926 // was specified
927 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
928 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
929 {
930 // gLimQuietDuration is already cached in units of
931 // system ticks. No conversion is reqd...
932 val = pMac->lim.gLimSpecMgmt.quietDuration;
933 }
934 else
935 {
936 if(pMac->lim.gpLimMlmScanReq)
937 {
938 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
939 }
940 else
941 {
942 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
943 //No need to change min timer. This is not a scan
944 break;
945 }
946 }
947
948 if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
949 val, 0) != TX_SUCCESS)
950 {
951 // Could not change min channel timer.
952 // Log error
953 limLog(pMac, LOGP, FL("Unable to change min channel timer\n"));
954 }
955
956 break;
957
958 case eLIM_PERIODIC_PROBE_REQ_TIMER:
959 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
960 != TX_SUCCESS)
961 {
962 // Could not deactivate min channel timer.
963 // Log error
964 limLog(pMac, LOGP,
965 FL("Unable to deactivate periodic timer\n"));
966 }
967
968 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
969 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
970 val, 0) != TX_SUCCESS)
971 {
972 // Could not change min channel timer.
973 // Log error
974 limLog(pMac, LOGP, FL("Unable to change periodic timer\n"));
975 }
976
977 break;
978
979 case eLIM_MAX_CHANNEL_TIMER:
980 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
981 != TX_SUCCESS)
982 {
983 // Could not deactivate max channel timer.
984 // Log error
985 limLog(pMac, LOGP,
986 FL("Unable to deactivate max channel timer\n"));
987 }
988
989#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
990 // If a background was triggered via Quiet BSS,
991 // then we need to adjust the MIN and MAX channel
992 // timer's accordingly to the Quiet duration that
993 // was specified
994 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
995 {
996
997 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
998 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
999 {
1000 // gLimQuietDuration is already cached in units of
1001 // system ticks. No conversion is reqd...
1002 val = pMac->lim.gLimSpecMgmt.quietDuration;
1003 }
1004 else
1005 {
1006 if(pMac->lim.gpLimMlmScanReq)
1007 {
1008 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
1009 }
1010 else
1011 {
1012 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1013 //No need to change max timer. This is not a scan
1014 break;
1015 }
1016 }
1017 }
1018#endif
1019#if defined(ANI_PRODUCT_TYPE_AP)
1020 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1021 {
1022 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
1023 &val) != eSIR_SUCCESS)
1024 {
1025 /**
1026 * Could not get max channel value
1027 * from CFG. Log error.
1028 */
1029 limLog(pMac, LOGP,
1030 FL("could not retrieve max channel value\n"));
1031 }
1032 val = SYS_MS_TO_TICKS(val);
1033 }
1034#endif
1035
1036 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
1037 val, 0) != TX_SUCCESS)
1038 {
1039 // Could not change max channel timer.
1040 // Log error
1041 limLog(pMac, LOGP,
1042 FL("Unable to change max channel timer\n"));
1043 }
1044
1045 break;
1046
1047 case eLIM_JOIN_FAIL_TIMER:
1048 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
1049 != TX_SUCCESS)
1050 {
1051 /**
1052 * Could not deactivate Join Failure
1053 * timer. Log error.
1054 */
1055 limLog(pMac, LOGP,
1056 FL("Unable to deactivate Join Failure timer\n"));
1057 }
1058
1059 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1060 &val) != eSIR_SUCCESS)
1061 {
1062 /**
1063 * Could not get JoinFailureTimeout value
1064 * from CFG. Log error.
1065 */
1066 limLog(pMac, LOGP,
1067 FL("could not retrieve JoinFailureTimeout value\n"));
1068 }
1069 val = SYS_MS_TO_TICKS(val);
1070
1071 if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
1072 val, 0) != TX_SUCCESS)
1073 {
1074 /**
1075 * Could not change Join Failure
1076 * timer. Log error.
1077 */
1078 limLog(pMac, LOGP,
1079 FL("Unable to change Join Failure timer\n"));
1080 }
1081
1082 break;
1083
1084 case eLIM_AUTH_FAIL_TIMER:
1085 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
1086 != TX_SUCCESS)
1087 {
1088 // Could not deactivate Auth failure timer.
1089 // Log error
1090 limLog(pMac, LOGP,
1091 FL("Unable to deactivate auth failure timer\n"));
1092 }
1093
1094 // Change timer to reactivate it in future
1095 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
1096 &val) != eSIR_SUCCESS)
1097 {
1098 /**
1099 * Could not get AuthFailureTimeout value
1100 * from CFG. Log error.
1101 */
1102 limLog(pMac, LOGP,
1103 FL("could not retrieve AuthFailureTimeout value\n"));
1104 }
1105 val = SYS_MS_TO_TICKS(val);
1106
1107 if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
1108 val, 0) != TX_SUCCESS)
1109 {
1110 // Could not change Authentication failure timer.
1111 // Log error
1112 limLog(pMac, LOGP,
1113 FL("unable to change Auth failure timer\n"));
1114 }
1115
1116 break;
1117
1118 case eLIM_ASSOC_FAIL_TIMER:
1119 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
1120 TX_SUCCESS)
1121 {
1122 // Could not deactivate Association failure timer.
1123 // Log error
1124 limLog(pMac, LOGP,
1125 FL("unable to deactivate Association failure timer\n"));
1126 }
1127
1128 // Change timer to reactivate it in future
1129 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
1130 &val) != eSIR_SUCCESS)
1131 {
1132 /**
1133 * Could not get AssocFailureTimeout value
1134 * from CFG. Log error.
1135 */
1136 limLog(pMac, LOGP,
1137 FL("could not retrieve AssocFailureTimeout value\n"));
1138 }
1139 val = SYS_MS_TO_TICKS(val);
1140
1141 if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
1142 val, 0) != TX_SUCCESS)
1143 {
1144 // Could not change Association failure timer.
1145 // Log error
1146 limLog(pMac, LOGP,
1147 FL("unable to change Assoc failure timer\n"));
1148 }
1149
1150 break;
1151
1152 case eLIM_REASSOC_FAIL_TIMER:
1153 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
1154 TX_SUCCESS)
1155 {
1156 // Could not deactivate Reassociation failure timer.
1157 // Log error
1158 limLog(pMac, LOGP,
1159 FL("unable to deactivate Reassoc failure timer\n"));
1160 }
1161
1162 // Change timer to reactivate it in future
1163 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1164 &val) != eSIR_SUCCESS)
1165 {
1166 /**
1167 * Could not get ReassocFailureTimeout value
1168 * from CFG. Log error.
1169 */
1170 limLog(pMac, LOGP,
1171 FL("could not retrieve ReassocFailureTimeout value\n"));
1172 }
1173 val = SYS_MS_TO_TICKS(val);
1174
1175 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
1176 val, 0) != TX_SUCCESS)
1177 {
1178 // Could not change Reassociation failure timer.
1179 // Log error
1180 limLog(pMac, LOGP,
1181 FL("unable to change Reassociation failure timer\n"));
1182 }
1183
1184 break;
1185
1186 case eLIM_HEART_BEAT_TIMER:
1187 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
1188 TX_SUCCESS)
1189 {
1190 // Could not deactivate Heartbeat timer.
1191 // Log error
1192 limLog(pMac, LOGP,
1193 FL("unable to deactivate Heartbeat timer\n"));
1194 }
1195
1196 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
1197 &val) != eSIR_SUCCESS)
1198 {
1199 /**
1200 * Could not get BEACON_INTERVAL value
1201 * from CFG. Log error.
1202 */
1203 limLog(pMac, LOGP,
1204 FL("could not retrieve BEACON_INTERVAL value\n"));
1205 }
1206
1207 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
1208 eSIR_SUCCESS)
1209 limLog(pMac, LOGP,
1210 FL("could not retrieve heartbeat failure value\n"));
1211
1212 // Change timer to reactivate it in future
1213 val = SYS_MS_TO_TICKS(val * val1);
1214
1215 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
1216 val, 0) != TX_SUCCESS)
1217 {
1218 // Could not change HeartBeat timer.
1219 // Log error
1220 limLog(pMac, LOGP,
1221 FL("unable to change HeartBeat timer\n"));
1222 }
1223
1224 break;
1225
1226 case eLIM_PROBE_AFTER_HB_TIMER:
1227 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
1228 TX_SUCCESS)
1229 {
1230 // Could not deactivate Heartbeat timer.
1231 // Log error
1232 limLog(pMac, LOGP,
1233 FL("unable to deactivate probeAfterHBTimer\n"));
1234 }
1235
1236 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
1237 &val) != eSIR_SUCCESS)
1238 {
1239 /**
1240 * Could not get PROBE_AFTER_HB_FAILURE
1241 * value from CFG. Log error.
1242 */
1243 limLog(pMac, LOGP,
1244 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
1245 }
1246
1247 // Change timer to reactivate it in future
1248 val = SYS_MS_TO_TICKS(val);
1249
1250 if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
1251 val, 0) != TX_SUCCESS)
1252 {
1253 // Could not change HeartBeat timer.
1254 // Log error
1255 limLog(pMac, LOGP,
1256 FL("unable to change ProbeAfterHBTimer\n"));
1257 }
1258
1259 break;
1260
1261 case eLIM_KEEPALIVE_TIMER:
1262 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
1263 != TX_SUCCESS)
1264 {
1265 // Could not deactivate Keepalive timer.
1266 // Log error
1267 limLog(pMac, LOGP,
1268 FL("unable to deactivate KeepaliveTimer timer\n"));
1269 }
1270
1271 // Change timer to reactivate it in future
1272
1273 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
1274 &val) != eSIR_SUCCESS)
1275 {
1276 /**
1277 * Could not get keepalive timeout value
1278 * from CFG. Log error.
1279 */
1280 limLog(pMac, LOGP,
1281 FL("could not retrieve keepalive timeout value\n"));
1282 }
1283 if (val == 0)
1284 {
1285 val = 3000;
1286 pMac->sch.keepAlive = 0;
1287 } else
1288 pMac->sch.keepAlive = 1;
1289
1290
1291
1292 val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
1293
1294 if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
1295 val, val) != TX_SUCCESS)
1296 {
1297 // Could not change KeepaliveTimer timer.
1298 // Log error
1299 limLog(pMac, LOGP,
1300 FL("unable to change KeepaliveTimer timer\n"));
1301 }
1302
1303 break;
1304
1305#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1306 case eLIM_BACKGROUND_SCAN_TIMER:
1307 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
1308 != TX_SUCCESS)
1309 {
1310 // Could not deactivate BackgroundScanTimer timer.
1311 // Log error
1312 limLog(pMac, LOGP,
1313 FL("unable to deactivate BackgroundScanTimer timer\n"));
1314 }
1315
1316 // Change timer to reactivate it in future
1317 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
1318 &val) != eSIR_SUCCESS)
1319 {
1320 /**
1321 * Could not get Background scan period value
1322 * from CFG. Log error.
1323 */
1324 limLog(pMac, LOGP,
1325 FL("could not retrieve Background scan period value\n"));
1326 }
1327 if (val == 0)
1328 {
1329 val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
1330 pMac->lim.gLimBackgroundScanDisable = true;
1331 }
1332 else
1333 pMac->lim.gLimBackgroundScanDisable = false;
1334
1335 val = SYS_MS_TO_TICKS(val);
1336
1337 if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
1338 val, val) != TX_SUCCESS)
1339 {
1340 // Could not change BackgroundScanTimer timer.
1341 // Log error
1342 limLog(pMac, LOGP,
1343 FL("unable to change BackgroundScanTimer timer\n"));
1344 }
1345
1346 break;
1347#endif
1348
1349#ifdef ANI_PRODUCT_TYPE_AP
1350 case eLIM_PRE_AUTH_CLEANUP_TIMER:
1351 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer) !=
1352 TX_SUCCESS)
1353 {
1354 // Could not deactivate Pre-auth cleanup timer.
1355 // Log error
1356 limLog(pMac, LOGP,
1357 FL("unable to deactivate Pre-auth cleanup timer\n"));
1358 }
1359
1360 // Change timer to reactivate it in future
1361 if (wlan_cfgGetInt(pMac, WNI_CFG_PREAUTH_CLNUP_TIMEOUT,
1362 &val) != eSIR_SUCCESS)
1363 {
1364 /**
1365 * Could not get pre-auth cleanup value
1366 * from CFG. Log error.
1367 */
1368 limLog(pMac, LOGP,
1369 FL("could not retrieve pre-auth cleanup value\n"));
1370 }
1371 val = SYS_MS_TO_TICKS(val);
1372
1373 if (tx_timer_change(&pMac->lim.limTimers.gLimPreAuthClnupTimer,
1374 val, val) != TX_SUCCESS)
1375 {
1376 // Could not change pre-auth cleanup timer.
1377 // Log error
1378 limLog(pMac, LOGP,
1379 FL("unable to change pre-auth cleanup timer\n"));
1380 }
1381
1382 break;
1383
1384 case eLIM_LEARN_INTERVAL_TIMER:
1385 {
1386 // Restart Learn Interval timer
1387 tANI_U32 learnInterval =
1388 pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
1389 pMac->lim.gpLimMeasReq->channelList.numChannels;
1390
1391 if (tx_timer_deactivate(
1392 &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
1393 {
1394 // Could not deactivate Learn Interval timer.
1395 // Log error
1396 limLog(pMac, LOGP,
1397 FL("Unable to deactivate Learn Interval timer\n"));
1398 }
1399
1400 if (tx_timer_change(
1401 &pMac->lim.gLimMeasParams.learnIntervalTimer,
1402 SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
1403 {
1404 // Could not change Learn Interval timer.
1405 // Log error
1406 limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
1407
1408 return;
1409 }
1410
1411 limLog( pMac, LOG3,
1412 FL("Setting the Learn Interval TIMER to %d ticks\n"),
1413 SYS_MS_TO_TICKS(learnInterval));
1414 }
1415 break;
1416
1417#endif
1418 case eLIM_CHANNEL_SWITCH_TIMER:
1419 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
1420 {
1421 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
1422 return;
1423 }
1424
1425 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
1426 pMac->lim.gLimChannelSwitch.switchTimeoutValue,
1427 0) != TX_SUCCESS)
1428 {
1429 limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
1430 return;
1431 }
1432 break;
1433
1434 case eLIM_LEARN_DURATION_TIMER:
1435#ifdef ANI_PRODUCT_TYPE_AP
1436 if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
1437 {
1438 limLog(pMac, LOGP, FL("Could not deactivate learn duration timer\n"));
1439 return;
1440 }
1441
1442 if (pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity &&
1443 (pMac->lim.gLimMeasParams.shortDurationCount ==
1444 pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity))
1445 {
1446#ifdef ANI_AP_SDK
1447 val = pMac->lim.gLimScanDurationConvert.longChannelScanDuration_tick;
1448#else
1449 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration
1450 + SYS_TICK_DUR_MS - 1);
1451 if(val > 1)
1452 val--;
1453#endif /* ANI_AP_SDK */
1454 // Time to perform measurements for longer term
1455 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1456 val, 0) != TX_SUCCESS)
1457 {
1458 // Could not change Learn duration timer.
1459 // Log error
1460 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1461 return;
1462 }
1463 pMac->lim.gLimMeasParams.shortDurationCount = 0;
1464 }
1465 else
1466 {
1467#ifdef ANI_AP_SDK
1468 val = pMac->lim.gLimScanDurationConvert.shortChannelScanDuration_tick;
1469#else
1470 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration
1471 + SYS_TICK_DUR_MS - 1);
1472 if(val > 1)
1473 val--;
1474#endif /* ANI_AP_SDK */
1475 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1476 val, 0) != TX_SUCCESS)
1477 {
1478 // Could not change Learn duration timer.
1479 // Log error
1480 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1481 }
1482 }
1483 pMac->lim.gpLimMeasData->duration = val * SYS_TICK_DUR_MS;
1484#endif
1485 break;
1486
1487 case eLIM_QUIET_BSS_TIMER:
1488 if (TX_SUCCESS !=
1489 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
1490 {
1491 limLog( pMac, LOGE,
1492 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway...\n"));
1493 }
1494
1495 // gLimQuietDuration appears to be in units of ticks
1496 // Use it as is
1497 if (TX_SUCCESS !=
1498 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
1499 pMac->lim.gLimSpecMgmt.quietDuration,
1500 0))
1501 {
1502 limLog( pMac, LOGE,
1503 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway...\n"));
1504 }
1505 break;
1506
1507 case eLIM_QUIET_TIMER:
1508 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
1509 {
1510 limLog( pMac, LOGE,
1511 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1512 }
1513
1514 // Set the NEW timeout value, in ticks
1515 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
1516 SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
1517 {
1518 limLog( pMac, LOGE,
1519 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1520 }
1521 break;
1522
1523
1524#ifdef WLAN_SOFTAP_FEATURE
1525#if 0
1526 case eLIM_WPS_OVERLAP_TIMER:
1527 {
1528 // Restart Learn Interval timer
1529
1530 tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
1531
1532 if (tx_timer_deactivate(
1533 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1534 {
1535 // Could not deactivate Learn Interval timer.
1536 // Log error
1537 limLog(pMac, LOGP,
1538 FL("Unable to deactivate WPS overlap timer\n"));
1539 }
1540
1541 if (tx_timer_change(
1542 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1543 WPSOverlapTimer, 0) != TX_SUCCESS)
1544 {
1545 // Could not change Learn Interval timer.
1546 // Log error
1547 limLog(pMac, LOGP, FL("Unable to change WPS overlap timer\n"));
1548
1549 return;
1550 }
1551
1552 limLog( pMac, LOGE,
1553 FL("Setting WPS overlap TIMER to %d ticks\n"),
1554 WPSOverlapTimer);
1555 }
1556 break;
1557#endif
1558#endif
1559
1560#ifdef WLAN_FEATURE_VOWIFI_11R
1561 case eLIM_FT_PREAUTH_RSP_TIMER:
1562 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != TX_SUCCESS)
1563 {
1564 /**
1565 ** Could not deactivate Join Failure
1566 ** timer. Log error.
1567 **/
1568 limLog(pMac, LOGP, FL("Unable to deactivate Preauth response Failure timer\n"));
1569 }
1570 val = 1000;
1571 val = SYS_MS_TO_TICKS(val);
1572 if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
1573 val, 0) != TX_SUCCESS)
1574 {
1575 /**
1576 * Could not change Join Failure
1577 * timer. Log error.
1578 */
1579 limLog(pMac, LOGP, FL("Unable to change Join Failure timer\n"));
1580 }
1581 break;
1582#endif
1583#ifdef FEATURE_WLAN_CCX
1584 case eLIM_TSM_TIMER:
1585 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer)
1586 != TX_SUCCESS)
1587 {
1588 limLog(pMac, LOGE, FL("Unable to deactivate TSM timer\n"));
1589 }
1590 break;
1591#endif
1592#ifdef WLAN_FEATURE_P2P
1593 case eLIM_REMAIN_CHN_TIMER:
1594 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer) != TX_SUCCESS)
1595 {
1596 /**
1597 ** Could not deactivate Join Failure
1598 ** timer. Log error.
1599 **/
1600 limLog(pMac, LOGP, FL("Unable to deactivate Remain on Chn timer\n"));
1601 }
1602 val = 1000;
1603 val = SYS_MS_TO_TICKS(val);
1604 if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
1605 val, 0) != TX_SUCCESS)
1606 {
1607 /**
1608 * Could not change Join Failure
1609 * timer. Log error.
1610 */
1611 limLog(pMac, LOGP, FL("Unable to change timer\n"));
1612 }
1613 break;
1614#endif
1615
1616 default:
1617 // Invalid timerId. Log error
1618 break;
1619 }
1620} /****** end limDeactivateAndChangeTimer() ******/
1621
1622
1623
1624/**---------------------------------------------------------------
1625\fn limHeartBeatDeactivateAndChangeTimer
1626\brief This function deactivates and changes the heart beat
1627\ timer, eLIM_HEART_BEAT_TIMER.
1628\
1629\param pMac
1630\param psessionEntry
1631\return None
1632------------------------------------------------------------------*/
1633void
1634limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1635{
1636 tANI_U32 val, val1;
1637
1638 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
1639
1640 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
1641 limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer \n"));
1642
1643 /* HB Timer sessionisation: In case of 2 or more sessions, the HB interval keeps
1644 changing. to avoid this problem, HeartBeat interval is made constant, by
1645 fixing beacon interval to 100ms immaterial of the beacon interval of the session */
1646
1647 //val = psessionEntry->beaconParams.beaconInterval;
1648 val = LIM_HB_TIMER_BEACON_INTERVAL;
1649
1650 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
1651 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_HEART_BEAT_THRESHOLD \n"));
1652
1653 PELOGW(limLog(pMac,LOGW,
1654 FL("HB Timer Int.=100ms * %d, Beacon Int.=%dms,Session Id=%d \n"),
1655 val1, psessionEntry->beaconParams.beaconInterval,
1656 psessionEntry->peSessionId);)
1657
1658 // Change timer to reactivate it in future
1659 val = SYS_MS_TO_TICKS(val * val1);
1660
1661 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer, val, 0) != TX_SUCCESS)
1662 limLog(pMac, LOGP, FL("Fail to change HeartBeatTimer\n"));
1663
1664} /****** end limHeartBeatDeactivateAndChangeTimer() ******/
1665
1666
1667/**---------------------------------------------------------------
1668\fn limReactivateHeartBeatTimer
1669\brief This function s called to deactivate, change and
1670\ activate a timer.
1671\
1672\param pMac - Pointer to Global MAC structure
1673\param psessionEntry
1674\return None
1675------------------------------------------------------------------*/
1676void
1677limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1678{
1679 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"), psessionEntry->LimRxedBeaconCntDuringHB);)
1680
1681 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
1682 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
1683
1684 //only start the hearbeat-timer if the timeout value is non-zero
1685 if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0) {
1686 if (tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
1687 {
1688 limLog(pMac, LOGP,FL("could not activate Heartbeat timer\n"));
1689 }
1690 limResetHBPktCount(psessionEntry);
1691 }
1692
1693} /****** end limReactivateHeartBeatTimer() ******/
1694
1695#if 0
1696/******
1697 * Note: Use this code once you have converted all
1698 * limReactivateHeartBeatTimer() calls to
1699 * limReactivateTimer() calls.
1700 *
1701 ******/
1702
1703Now, in dev/btamp2,
1704here are all the references to limReactivateHeartBeatTimer().
1705
1706C symbol: limReactivateHeartBeatTimer
1707
1708 File Function Line
17090 limTimerUtils.h <global> 55 void limReactivateHeartBeatTimer(tpAniSirGlobal , tpPESession);
17101 limIbssPeerMgmt.c limIbssHeartBeatHandle 1282 limReactivateHeartBeatTimer(pMac, psessionEntry);
17112 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 395 limReactivateHeartBeatTimer(pMac, psessionEntry);
17123 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 410 limReactivateHeartBeatTimer(pMac, psessionEntry);
17134 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
17145 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2350 limReactivateHeartBeatTimer(pMac, psessionEntry);
17156 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
17167 limTimerUtils.c limReactivateHeartBeatTim 1473 limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
17178 limUtils.c limHandleHeartBeatFailure 6743 limReactivateHeartBeatTimer(pMac, psessionEntry);
17189 limUtils.c limHandleHeartBeatFailure 6751 limReactivateHeartBeatTimer(pMac, psessionEntry);
1719
1720Now, in main/latest, on the other hand,
1721here are all the references to limReactivateTimer().
1722
1723C symbol: limReactivateTimer
1724
1725 File Function Line
17260 limTimerUtils.h <global> 54 void limReactivateTimer(tpAniSirGlobal, tANI_U32);
17271 limIbssPeerMgmt.c limIbssHeartBeatHandle 1183 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17282 limIbssPeerMgmt.c limIbssHeartBeatHandle 1246 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17293 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 283 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17304 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 320 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17315 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 335 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17326 limProcessMessageQueue.c limProcessMessages 1210 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17337 limProcessMessageQueue.c limProcessMessages 1218 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17348 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 1726 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
17359 limTimerUtils.c limReactivateTimer 1451 limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1736
1737
1738/**
1739 * limReactivateTimer()
1740 *
1741 *FUNCTION:
1742 * This function is called to deactivate, change and
1743 * activate a timer
1744 *
1745 *LOGIC:
1746 *
1747 *ASSUMPTIONS:
1748 * NA
1749 *
1750 *NOTE:
1751 * NA
1752 *
1753 * @param pMac - Pointer to Global MAC structure
1754 * @param timerId - enum of timer to be deactivated and changed
1755 * This enum is defined in limUtils.h file
1756 *
1757 * @return None
1758 */
1759
1760void
1761limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1762{
1763 if (timerId == eLIM_HEART_BEAT_TIMER)
1764 {
1765 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"),
1766 pMac->lim.gLimRxedBeaconCntDuringHB);)
1767 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
1768 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
1769 if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
1770 {
1771 /// Could not activate Heartbeat timer.
1772 // Log error
1773 limLog(pMac, LOGP,
1774 FL("could not activate Heartbeat timer\n"));
1775 }
1776 limResetHBPktCount(pMac);
1777 }
1778} /****** end limReactivateTimer() ******/
1779#endif
1780
1781
1782/**
1783 * limActivateHearBeatTimer()
1784 *
1785 *
1786 * @brief: This function is called to activate heartbeat timer
1787 *
1788 *LOGIC:
1789 *
1790 *ASSUMPTIONS:
1791 * NA
1792 *
1793 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
1794 *
1795 * @param pMac - Pointer to Global MAC structure
1796 *
1797 * @return TX_SUCCESS - timer is activated
1798 * errors - fail to start the timer
1799 */
1800v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac)
1801{
1802 v_UINT_t status = TX_TIMER_ERROR;
1803
1804 if(TX_AIRGO_TMR_SIGNATURE == pMac->lim.limTimers.gLimHeartBeatTimer.tmrSignature)
1805 {
1806 //consider 0 interval a ok case
1807 if( pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs )
1808 {
1809 status = tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1810 if( TX_SUCCESS != status )
1811 {
1812 PELOGE(limLog(pMac, LOGE,
1813 FL("could not activate Heartbeat timer status(%d)\n"), status);)
1814 }
1815 }
1816 else
1817 {
1818 status = TX_SUCCESS;
1819 }
1820 }
1821
1822 return (status);
1823}
1824
1825
1826
1827/**
1828 * limDeactivateAndChangePerStaIdTimer()
1829 *
1830 *
1831 * @brief: This function is called to deactivate and change a per STA timer
1832 * for future re-activation
1833 *
1834 *LOGIC:
1835 *
1836 *ASSUMPTIONS:
1837 * NA
1838 *
1839 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
1840 *
1841 * @param pMac - Pointer to Global MAC structure
1842 * @param timerId - enum of timer to be deactivated and changed
1843 * This enum is defined in limUtils.h file
1844 * @param staId - staId
1845 *
1846 * @return None
1847 */
1848
1849void
1850limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
1851{
1852 tANI_U32 val;
1853 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, 0, timerId));
1854
1855 switch (timerId)
1856 {
1857 case eLIM_CNF_WAIT_TIMER:
1858
1859 if (tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
1860 != TX_SUCCESS)
1861 {
1862 limLog(pMac, LOGP,
1863 FL("unable to deactivate CNF wait timer\n"));
1864
1865 }
1866
1867 // Change timer to reactivate it in future
1868
1869 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
1870 &val) != eSIR_SUCCESS)
1871 {
1872 /**
1873 * Could not get cnf timeout value
1874 * from CFG. Log error.
1875 */
1876 limLog(pMac, LOGP,
1877 FL("could not retrieve cnf timeout value\n"));
1878 }
1879 val = SYS_MS_TO_TICKS(val);
1880
1881 if (tx_timer_change(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId],
1882 val, val) != TX_SUCCESS)
1883 {
1884 // Could not change cnf timer.
1885 // Log error
1886 limLog(pMac, LOGP, FL("unable to change cnf wait timer\n"));
1887 }
1888
1889 break;
1890
1891 case eLIM_AUTH_RSP_TIMER:
1892 {
1893 tLimPreAuthNode *pAuthNode;
1894
1895 pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, staId);
1896
1897 if (pAuthNode == NULL)
1898 {
1899 limLog(pMac, LOGP, FL("Invalid Pre Auth Index passed :%d\n"), staId);
1900 break;
1901 }
1902
1903 if (tx_timer_deactivate(&pAuthNode->timer) != TX_SUCCESS)
1904 {
1905 // Could not deactivate auth response timer.
1906 // Log error
1907 limLog(pMac, LOGP, FL("unable to deactivate auth response timer\n"));
1908 }
1909
1910 // Change timer to reactivate it in future
1911
1912 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, &val) != eSIR_SUCCESS)
1913 {
1914 /**
1915 * Could not get auth rsp timeout value
1916 * from CFG. Log error.
1917 */
1918 limLog(pMac, LOGP,
1919 FL("could not retrieve auth response timeout value\n"));
1920 }
1921
1922 val = SYS_MS_TO_TICKS(val);
1923
1924 if (tx_timer_change(&pAuthNode->timer, val, 0) != TX_SUCCESS)
1925 {
1926 // Could not change auth rsp timer.
1927 // Log error
1928 limLog(pMac, LOGP, FL("unable to change auth rsp timer\n"));
1929 }
1930 }
1931 break;
1932
1933#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
1934 case eLIM_LEARN_INTERVAL_TIMER:
1935 {
1936 // Restart Learn Interval timer
1937 tANI_U32 learnInterval =
1938 pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
1939 pMac->lim.gpLimMeasReq->channelList.numChannels;
1940
1941 if (tx_timer_deactivate(
1942 &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
1943 {
1944 // Could not deactivate Learn Interval timer.
1945 // Log error
1946 limLog(pMac, LOGP,
1947 FL("Unable to deactivate Learn Interval timer\n"));
1948 }
1949
1950 if (tx_timer_change(
1951 &pMac->lim.gLimMeasParams.learnIntervalTimer,
1952 SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
1953 {
1954 // Could not change Learn Interval timer.
1955 // Log error
1956 limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
1957
1958 return;
1959 }
1960
1961 limLog( pMac, LOG3,
1962 FL("Setting the Learn Interval TIMER to %d ticks\n"),
1963 SYS_MS_TO_TICKS(learnInterval) );
1964 }
1965 break;
1966#endif //#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
1967
1968 default:
1969 // Invalid timerId. Log error
1970 break;
1971
1972 }
1973}
1974
1975
1976/**
1977 * limActivateCnfTimer()
1978 *
1979 *FUNCTION:
1980 * This function is called to activate a per STA timer
1981 *
1982 *LOGIC:
1983 *
1984 *ASSUMPTIONS:
1985 * NA
1986 *
1987 *NOTE:
1988 * NA
1989 *
1990 * @param pMac - Pointer to Global MAC structure
1991 * @param StaId - staId
1992 *
1993 * @return None
1994 */
1995
1996void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
1997{
1998 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_CNF_WAIT_TIMER));
1999 pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
2000 if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2001 != TX_SUCCESS)
2002 {
2003 limLog(pMac, LOGP,
2004 FL("could not activate cnf wait timer\n"));
2005 }
2006}
2007
2008/**
2009 * limActivateAuthRspTimer()
2010 *
2011 *FUNCTION:
2012 * This function is called to activate a per STA timer
2013 *
2014 *LOGIC:
2015 *
2016 *ASSUMPTIONS:
2017 * NA
2018 *
2019 *NOTE:
2020 * NA
2021 *
2022 * @param pMac - Pointer to Global MAC structure
2023 * @param id - id
2024 *
2025 * @return None
2026 */
2027
2028void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
2029{
2030 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_AUTH_RESP_TIMER));
2031 if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
2032 {
2033 /// Could not activate auth rsp timer.
2034 // Log error
2035 limLog(pMac, LOGP,
2036 FL("could not activate auth rsp timer\n"));
2037 }
2038}
2039
2040
2041/**
2042 * limSendDisassocFrameThresholdHandler()
2043 *
2044 *FUNCTION:
2045 * This function reloads the credit to the send disassociate frame bucket
2046 *
2047 *LOGIC:
2048 *
2049 *ASSUMPTIONS:
2050 *
2051 *NOTE:
2052 * NA
2053 *
2054 * @param
2055 *
2056 * @return None
2057 */
2058
2059void
2060limSendDisassocFrameThresholdHandler(void *pMacGlobal, tANI_U32 param)
2061{
2062 tSirMsgQ msg;
2063 tANI_U32 statusCode;
2064 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2065
2066 msg.type = SIR_LIM_HASH_MISS_THRES_TIMEOUT;
2067 msg.bodyval = 0;
2068 msg.bodyptr = NULL;
2069
2070 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2071 limLog(pMac, LOGE,
2072 FL("posting to LIM failed, reason=%d\n"), statusCode);
2073
2074}
2075
2076/**
2077 * limAssocCnfWaitTmerHandler()
2078 *
2079 *FUNCTION:
2080 * This function post a message to send a disassociate frame out.
2081 *
2082 *LOGIC:
2083 *
2084 *ASSUMPTIONS:
2085 *
2086 *NOTE:
2087 * NA
2088 *
2089 * @param
2090 *
2091 * @return None
2092 */
2093
2094void
2095limCnfWaitTmerHandler(void *pMacGlobal, tANI_U32 param)
2096{
2097 tSirMsgQ msg;
2098 tANI_U32 statusCode;
2099 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2100
2101 msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
2102 msg.bodyval = (tANI_U32)param;
2103 msg.bodyptr = NULL;
2104
2105 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2106 limLog(pMac, LOGE,
2107 FL("posting to LIM failed, reason=%d\n"), statusCode);
2108
2109}
2110
2111/**
2112 * limKeepaliveTmerHandler()
2113 *
2114 *FUNCTION:
2115 * This function post a message to send a NULL data frame.
2116 *
2117 *LOGIC:
2118 *
2119 *ASSUMPTIONS:
2120 *
2121 *NOTE:
2122 * NA
2123 *
2124 * @param
2125 *
2126 * @return None
2127 */
2128
2129void
2130limKeepaliveTmerHandler(void *pMacGlobal, tANI_U32 param)
2131{
2132 tSirMsgQ msg;
2133 tANI_U32 statusCode;
2134 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2135
2136 msg.type = SIR_LIM_KEEPALIVE_TIMEOUT;
2137 msg.bodyval = (tANI_U32)param;
2138 msg.bodyptr = NULL;
2139
2140 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2141 limLog(pMac, LOGE,
2142 FL("posting to LIM failed, reason=%d\n"), statusCode);
2143
2144}
2145
2146void
2147limChannelSwitchTimerHandler(void *pMacGlobal, tANI_U32 param)
2148{
2149 tSirMsgQ msg;
2150 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2151
2152 PELOG1(limLog(pMac, LOG1,
2153 FL("ChannelSwitch Timer expired. Posting msg to LIM \n"));)
2154
2155 msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
2156 msg.bodyval = (tANI_U32)param;
2157 msg.bodyptr = NULL;
2158
2159 limPostMsgApi(pMac, &msg);
2160}
2161
2162void
2163limQuietTimerHandler(void *pMacGlobal, tANI_U32 param)
2164{
2165 tSirMsgQ msg;
2166 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2167
2168 msg.type = SIR_LIM_QUIET_TIMEOUT;
2169 msg.bodyval = (tANI_U32)param;
2170 msg.bodyptr = NULL;
2171
2172 PELOG1(limLog(pMac, LOG1,
2173 FL("Post SIR_LIM_QUIET_TIMEOUT msg. \n"));)
2174 limPostMsgApi(pMac, &msg);
2175}
2176
2177void
2178limQuietBssTimerHandler(void *pMacGlobal, tANI_U32 param)
2179{
2180 tSirMsgQ msg;
2181 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2182
2183 msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
2184 msg.bodyval = (tANI_U32)param;
2185 msg.bodyptr = NULL;
2186 PELOG1(limLog(pMac, LOG1,
2187 FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. \n"));)
2188 limPostMsgApi(pMac, &msg);
2189}
2190#ifdef WLAN_SOFTAP_FEATURE
2191#if 0
2192void
2193limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
2194{
2195 tSirMsgQ msg;
2196 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2197
2198 msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
2199 msg.bodyval = (tANI_U32)param;
2200 msg.bodyptr = NULL;
2201 PELOG1(limLog(pMac, LOG1,
2202 FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. \n"));)
2203 limPostMsgApi(pMac, &msg);
2204}
2205#endif
2206#endif