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