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