blob: 7c46ef5e18c8da54cce8c6d7b39faedd9fc73f14 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
Jeff Johnson295189b2012-06-20 16:38:30 -070041/*
42 * Airgo Networks, Inc proprietary. All rights reserved.
43 * This file limTimerUtils.cc contains the utility functions
44 * LIM uses for handling various timers.
45 * Author: Chandra Modumudi
46 * Date: 02/13/02
47 * History:-
48 * Date Modified by Modification Information
49 * --------------------------------------------------------------------
50 */
51
52#include "limTypes.h"
53#include "limUtils.h"
54#include "limAssocUtils.h"
55#include "limSecurityUtils.h"
56#include "pmmApi.h"
57
58
59// default value 5000 ms for background scan period when it is disabled
60#define LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS 5000
61// channel Switch Timer in ticks
62#define LIM_CHANNEL_SWITCH_TIMER_TICKS 1
63// Lim Quite timer in ticks
64#define LIM_QUIET_TIMER_TICKS 100
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -080065// Lim Quite BSS timer interval in ticks
Jeff Johnson295189b2012-06-20 16:38:30 -070066#define LIM_QUIET_BSS_TIMER_TICK 100
67// Lim KeepAlive timer default (3000)ms
68#define LIM_KEEPALIVE_TIMER_MS 3000
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -080069// Lim JoinProbeRequest Retry timer default (200)ms
70#define LIM_JOIN_PROBE_REQ_TIMER_MS 200
Jeff Johnson295189b2012-06-20 16:38:30 -070071
72//default beacon interval value used in HB timer interval calculation
73#define LIM_HB_TIMER_BEACON_INTERVAL 100
74/**
75 * limCreateTimers()
76 *
77 *FUNCTION:
78 * This function is called upon receiving
79 * 1. SME_START_REQ for STA in ESS role
80 * 2. SME_START_BSS_REQ for AP role & STA in IBSS role
81 *
82 *LOGIC:
83 *
84 *ASSUMPTIONS:
85 * NA
86 *
87 *NOTE:
88 * NA
89 *
90 * @param pMac - Pointer to Global MAC structure
91 *
92 * @return None
93 */
94
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -070095v_UINT_t
Jeff Johnson295189b2012-06-20 16:38:30 -070096limCreateTimers(tpAniSirGlobal pMac)
97{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -070098 tANI_U32 cfgValue, i=0;
Jeff Johnson295189b2012-06-20 16:38:30 -070099
100 PELOG1(limLog(pMac, LOG1, FL("Creating Timers used by LIM module in Role %d\n"), pMac->lim.gLimSystemRole);)
101
102 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
103 &cfgValue) != eSIR_SUCCESS)
104 {
105 /**
106 * Could not get MinChannelTimeout value
107 * from CFG. Log error.
108 */
109 limLog(pMac, LOGP, FL("could not retrieve MinChannelTimeout value\n"));
110 }
111 cfgValue = SYS_MS_TO_TICKS(cfgValue);
112
113 // Create MIN/MAX channel timers and activate them later
114 if (tx_timer_create(&pMac->lim.limTimers.gLimMinChannelTimer,
115 "MIN CHANNEL TIMEOUT",
116 limTimerHandler, SIR_LIM_MIN_CHANNEL_TIMEOUT,
117 cfgValue, 0,
118 TX_NO_ACTIVATE) != TX_SUCCESS)
119 {
120 /// Could not start min channel timer.
121 // Log error
122 limLog(pMac, LOGP, FL("could not create MIN channel timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700123 return TX_TIMER_ERROR;
Jeff Johnson295189b2012-06-20 16:38:30 -0700124 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 PELOG2(limLog(pMac, LOG2, FL("Created MinChannelTimer\n"));)
126
127 /* Periodic probe request timer value is half of the Min channel
128 * timer. Probe request sends periodically till min/max channel
129 * timer expires
130 */
131
132 cfgValue = cfgValue/2 ;
133 if( cfgValue >= 1)
134 {
135 // Create periodic probe request timer and activate them later
136 if (tx_timer_create(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
137 "Periodic Probe Request Timer",
138 limTimerHandler, SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT,
139 cfgValue, 0,
140 TX_NO_ACTIVATE) != TX_SUCCESS)
141 {
142 /// Could not start Periodic Probe Req timer.
143 // Log error
144 limLog(pMac, LOGP, FL("could not create periodic probe timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700145 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700146 }
147 }
148
149
150 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
151 &cfgValue) != eSIR_SUCCESS)
152 {
153 /**
154 * Could not get MAXChannelTimeout value
155 * from CFG. Log error.
156 */
157 limLog(pMac, LOGP,
158 FL("could not retrieve MAXChannelTimeout value\n"));
159 }
160 cfgValue = SYS_MS_TO_TICKS(cfgValue);
161
162 if (tx_timer_create(&pMac->lim.limTimers.gLimMaxChannelTimer,
163 "MAX CHANNEL TIMEOUT",
164 limTimerHandler, SIR_LIM_MAX_CHANNEL_TIMEOUT,
165 cfgValue, 0,
166 TX_NO_ACTIVATE) != TX_SUCCESS)
167 {
168 /// Could not start max channel timer.
169 // Log error
170 limLog(pMac, LOGP, FL("could not create MAX channel timer\n"));
171
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700172 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700174 PELOG2(limLog(pMac, LOG2, FL("Created MaxChannelTimer\n"));)
175
176 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
177 {
178 // Create Channel Switch Timer
179 if (tx_timer_create(&pMac->lim.limTimers.gLimChannelSwitchTimer,
180 "CHANNEL SWITCH TIMER",
181 limChannelSwitchTimerHandler,
182 0, // expiration_input
183 LIM_CHANNEL_SWITCH_TIMER_TICKS, // initial_ticks
184 0, // reschedule_ticks
185 TX_NO_ACTIVATE) != TX_SUCCESS)
186 {
187 limLog(pMac, LOGP, FL("failed to create Channel Switch timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700188 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 }
190
191 //
192 // Create Quiet Timer
193 // This is used on the STA to go and shut-off
194 // Tx/Rx "after" the specified quiteInterval
195 //
196 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietTimer,
197 "QUIET TIMER",
198 limQuietTimerHandler,
199 SIR_LIM_QUIET_TIMEOUT, // expiration_input
200 LIM_QUIET_TIMER_TICKS, // initial_ticks
201 0, // reschedule_ticks
202 TX_NO_ACTIVATE) != TX_SUCCESS)
203 {
204 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700205 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700206 }
207
208 //
209 // Create Quiet BSS Timer
210 // After the specified quiteInterval, determined by
211 // gLimQuietTimer, this timer, gLimQuietBssTimer,
212 // trigger and put the STA to sleep for the specified
213 // gLimQuietDuration
214 //
215 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietBssTimer,
216 "QUIET BSS TIMER",
217 limQuietBssTimerHandler,
218 SIR_LIM_QUIET_BSS_TIMEOUT, // expiration_input
219 LIM_QUIET_BSS_TIMER_TICK, // initial_ticks
220 0, // reschedule_ticks
221 TX_NO_ACTIVATE) != TX_SUCCESS)
222 {
223 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700224 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 }
226
227 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
228 &cfgValue) != eSIR_SUCCESS)
229 {
230 /**
231 * Could not get JoinFailureTimeout value
232 * from CFG. Log error.
233 */
234 limLog(pMac, LOGP,
235 FL("could not retrieve JoinFailureTimeout value\n"));
236 }
237 cfgValue = SYS_MS_TO_TICKS(cfgValue);
238
239 // Create Join failure timer and activate it later
240 if (tx_timer_create(&pMac->lim.limTimers.gLimJoinFailureTimer,
241 "JOIN FAILURE TIMEOUT",
242 limTimerHandler, SIR_LIM_JOIN_FAIL_TIMEOUT,
243 cfgValue, 0,
244 TX_NO_ACTIVATE) != TX_SUCCESS)
245 {
246 /// Could not create Join failure timer.
247 // Log error
248 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
249
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700250 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800252
253 //Send unicast probe req frame every 200 ms
254 if ((tx_timer_create(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
255 "Periodic Join Probe Request Timer",
256 limTimerHandler, SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT,
257 SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS), 0,
258 TX_NO_ACTIVATE)) != TX_SUCCESS)
259 {
260 /// Could not create Periodic Join Probe Request timer.
261 // Log error
262 limLog(pMac, LOGP, FL("could not create Periodic Join Probe Request timer\n"));
263 goto err_timer;
264 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700265
266 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
267 &cfgValue) != eSIR_SUCCESS)
268 {
269 /**
270 * Could not get AssocFailureTimeout value
271 * from CFG. Log error.
272 */
273 limLog(pMac, LOGP,
274 FL("could not retrieve AssocFailureTimeout value\n"));
275 }
276 cfgValue = SYS_MS_TO_TICKS(cfgValue);
277
278 // Create Association failure timer and activate it later
279 if (tx_timer_create(&pMac->lim.limTimers.gLimAssocFailureTimer,
280 "ASSOC FAILURE TIMEOUT",
281 limAssocFailureTimerHandler, LIM_ASSOC,
282 cfgValue, 0,
283 TX_NO_ACTIVATE) != TX_SUCCESS)
284 {
285 /// Could not create Assoc failure timer.
286 // Log error
287 limLog(pMac, LOGP,
288 FL("could not create Association failure timer\n"));
289
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700290 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 }
292 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
293 &cfgValue) != eSIR_SUCCESS)
294 {
295 /**
296 * Could not get ReassocFailureTimeout value
297 * from CFG. Log error.
298 */
299 limLog(pMac, LOGP,
300 FL("could not retrieve ReassocFailureTimeout value\n"));
301 }
302 cfgValue = SYS_MS_TO_TICKS(cfgValue);
303
304 // Create Association failure timer and activate it later
305 if (tx_timer_create(&pMac->lim.limTimers.gLimReassocFailureTimer,
306 "REASSOC FAILURE TIMEOUT",
307 limAssocFailureTimerHandler, LIM_REASSOC,
308 cfgValue, 0,
309 TX_NO_ACTIVATE) != TX_SUCCESS)
310 {
311 /// Could not create Reassoc failure timer.
312 // Log error
313 limLog(pMac, LOGP,
314 FL("could not create Reassociation failure timer\n"));
315
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700316 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 }
318
319 if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &cfgValue) != eSIR_SUCCESS)
320 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_ADDTS_RSP_TIMEOUT \n"));
321
322 cfgValue = SYS_MS_TO_TICKS(cfgValue);
323
324 // Create Addts response timer and activate it later
325 if (tx_timer_create(&pMac->lim.limTimers.gLimAddtsRspTimer,
326 "ADDTS RSP TIMEOUT",
327 limAddtsResponseTimerHandler,
328 SIR_LIM_ADDTS_RSP_TIMEOUT,
329 cfgValue, 0,
330 TX_NO_ACTIVATE) != TX_SUCCESS)
331 {
332 /// Could not create Auth failure timer.
333 // Log error
334 limLog(pMac, LOGP, FL("could not create Addts response timer\n"));
335
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700336 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 }
338
339 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
340 &cfgValue) != eSIR_SUCCESS)
341 {
342 /**
343 * Could not get AuthFailureTimeout value
344 * from CFG. Log error.
345 */
346 limLog(pMac, LOGP,
347 FL("could not retrieve AuthFailureTimeout value\n"));
348 }
349 cfgValue = SYS_MS_TO_TICKS(cfgValue);
350
351 // Create Auth failure timer and activate it later
352 if (tx_timer_create(&pMac->lim.limTimers.gLimAuthFailureTimer,
353 "AUTH FAILURE TIMEOUT",
354 limTimerHandler,
355 SIR_LIM_AUTH_FAIL_TIMEOUT,
356 cfgValue, 0,
357 TX_NO_ACTIVATE) != TX_SUCCESS)
358 {
359 /// Could not create Auth failure timer.
360 // Log error
361 limLog(pMac, LOGP, FL("could not create Auth failure timer\n"));
362
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700363 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 }
Jeff Johnson41707a42013-02-14 07:54:26 -0800365
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
367 &cfgValue) != eSIR_SUCCESS)
368 {
369 /**
370 * Could not get BEACON_INTERVAL value
371 * from CFG. Log error.
372 */
373 limLog(pMac, LOGP,
374 FL("could not retrieve BEACON_INTERVAL value\n"));
375 }
376 cfgValue = SYS_MS_TO_TICKS(cfgValue);
377
378 if (tx_timer_create(&pMac->lim.limTimers.gLimHeartBeatTimer,
379 "Heartbeat TIMEOUT",
380 limTimerHandler,
381 SIR_LIM_HEART_BEAT_TIMEOUT,
382 cfgValue,
383 0,
384 TX_NO_ACTIVATE) != TX_SUCCESS)
385 {
386 /// Could not start Heartbeat timer.
387 // Log error
388 limLog(pMac, LOGP,
389 FL("call to create heartbeat timer failed\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700390 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700391 }
392
393 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
394 &cfgValue) != eSIR_SUCCESS)
395 {
396 /**
397 * Could not get PROBE_AFTER_HB_FAILURE
398 * value from CFG. Log error.
399 */
400 limLog(pMac, LOGP,
401 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
402 }
403
404 // Change timer to reactivate it in future
405 cfgValue = SYS_MS_TO_TICKS(cfgValue);
406
407 if (tx_timer_create(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
408 "Probe after Heartbeat TIMEOUT",
409 limTimerHandler,
410 SIR_LIM_PROBE_HB_FAILURE_TIMEOUT,
411 cfgValue,
412 0,
413 TX_NO_ACTIVATE) != TX_SUCCESS)
414 {
415 // Could not creat wt-probe-after-HeartBeat-failure timer.
416 // Log error
417 limLog(pMac, LOGP,
418 FL("unable to create ProbeAfterHBTimer\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700419 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 }
421
Jeff Johnson295189b2012-06-20 16:38:30 -0700422#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
423 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
424 &cfgValue) != eSIR_SUCCESS)
425 {
426 /**
427 * Could not get Background scan period value
428 * from CFG. Log error.
429 */
430 limLog(pMac, LOGP,
431 FL("could not retrieve Background scan period value\n"));
432 }
433
434 /*
435 * setting period to zero means disabling background scans when associated
436 * the way we do this is to set a flag indicating this and keeping
437 * the timer running, since it will be used for PDU leak workarounds
438 * as well as background scanning during SME idle states
439 */
440 if (cfgValue == 0)
441 {
442 cfgValue = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
443 pMac->lim.gLimBackgroundScanDisable = true;
444 }
445 else
446 pMac->lim.gLimBackgroundScanDisable = false;
447
448 cfgValue = SYS_MS_TO_TICKS(cfgValue);
449
450 if (tx_timer_create(&pMac->lim.limTimers.gLimBackgroundScanTimer,
451 "Background scan TIMEOUT",
452 limTimerHandler,
453 SIR_LIM_CHANNEL_SCAN_TIMEOUT,
454 cfgValue,
455 cfgValue,
456 TX_NO_ACTIVATE) != TX_SUCCESS)
457 {
458 /// Could not start background scan timer.
459 // Log error
460 limLog(pMac, LOGP,
461 FL("call to create background scan timer failed\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700462 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 }
464#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800465#ifdef FEATURE_WLAN_TDLS_INTERNAL
466 /*
467 * create TDLS timers..
468 * a) TDLS discovery response timer.
469 */
470
471 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
472 &cfgValue) != eSIR_SUCCESS)
473 {
474 /*
475 * Could not get discovery response Timeout value
476 * from CFG. Log error.
477 */
478 limLog(pMac, LOGP,
479 FL("could not retrieve ReassocFailureTimeout value\n"));
480 }
481 cfgValue = SYS_MS_TO_TICKS(cfgValue);
482
483 /*
484 * create TDLS discovery response wait timer and activate it later
485 */
486 if (tx_timer_create(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer,
487 "TDLS discovery response WAIT",
488 limTimerHandler,
489 SIR_LIM_TDLS_DISCOVERY_RSP_WAIT,
490 cfgValue, 0,
491 TX_NO_ACTIVATE) != TX_SUCCESS)
492 {
493 limLog(pMac, LOGP,
494 FL("could not create TDLS discovery response wait timer\n"));
495 goto err_timer;
496 }
497#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 }
499
500
501 cfgValue = SYS_MS_TO_TICKS(LIM_HASH_MISS_TIMER_MS);
502
503 if (tx_timer_create(
504 &pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer,
505 "Disassoc throttle TIMEOUT",
506 limSendDisassocFrameThresholdHandler,
507 SIR_LIM_HASH_MISS_THRES_TIMEOUT,
508 cfgValue,
509 cfgValue,
510 TX_AUTO_ACTIVATE) != TX_SUCCESS)
511 {
512 /// Could not start Send Disassociate Frame Threshold timer.
513 // Log error
514 limLog(pMac, LOGP,
515 FL("create Disassociate throttle timer failed\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700516 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 PELOG1(limLog(pMac, LOG1,
519 FL("Created Disassociate throttle timer \n"));)
520
521 /**
522 * Create keepalive timer and activate it right away for AP role
523 */
524
525 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
526 &cfgValue) != eSIR_SUCCESS)
527 {
528 /**
529 * Could not get keepalive timeout value
530 * from CFG. Log error.
531 */
532 limLog(pMac, LOGP,
533 FL("could not retrieve keepalive timeout value\n"));
534 }
535
536 // A value of zero implies keep alive should be disabled
537 if (cfgValue == 0)
538 {
539 cfgValue = LIM_KEEPALIVE_TIMER_MS;
540 pMac->sch.keepAlive = 0;
541 } else
542 pMac->sch.keepAlive = 1;
543
544
545 cfgValue = SYS_MS_TO_TICKS(cfgValue + SYS_TICK_DUR_MS - 1);
546
547 if (tx_timer_create(&pMac->lim.limTimers.gLimKeepaliveTimer,
548 "KEEPALIVE_TIMEOUT",
549 limKeepaliveTmerHandler,
550 0,
551 cfgValue,
552 cfgValue,
553 (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ?
554 TX_AUTO_ACTIVATE : TX_NO_ACTIVATE)
555 != TX_SUCCESS)
556 {
557 // Cannot create keepalive timer. Log error.
558 limLog(pMac, LOGP, FL("Cannot create keepalive timer.\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700559 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 }
561
562 /**
563 * Create all CNF_WAIT Timers upfront
564 */
565
566 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
567 &cfgValue) != eSIR_SUCCESS)
568 {
569 /**
570 * Could not get CNF_WAIT timeout value
571 * from CFG. Log error.
572 */
573 limLog(pMac, LOGP,
574 FL("could not retrieve CNF timeout value\n"));
575 }
576 cfgValue = SYS_MS_TO_TICKS(cfgValue);
577
578 for (i=0; i<pMac->lim.maxStation; i++)
579 {
580 if (tx_timer_create(&pMac->lim.limTimers.gpLimCnfWaitTimer[i],
581 "CNF_MISS_TIMEOUT",
582 limCnfWaitTmerHandler,
583 (tANI_U32)i,
584 cfgValue,
585 0,
586 TX_NO_ACTIVATE) != TX_SUCCESS)
587 {
588 // Cannot create timer. Log error.
589 limLog(pMac, LOGP, FL("Cannot create CNF wait timer.\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700590 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 }
592 }
593
594 /*
595 ** Alloc and init table for the preAuth timer list
596 **
597 **/
598
599 // get max number of Preauthentication
600 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
601 &cfgValue) != eSIR_SUCCESS)
602 {
603 /*
604 ** Could not get max preauth value
605 ** from CFG. Log error.
606 **/
607 limLog(pMac, LOGP,
608 FL("could not retrieve mac preauth value\n"));
609 }
610#ifdef ANI_AP_SDK_OPT
611 if(cfgValue > SIR_SDK_OPT_MAX_NUM_PRE_AUTH)
612 cfgValue = SIR_SDK_OPT_MAX_NUM_PRE_AUTH;
613#endif // ANI_AP_SDK_OPT
614 pMac->lim.gLimPreAuthTimerTable.numEntry = cfgValue;
615 if (palAllocateMemory(pMac->hHdd, (void **) &pMac->lim.gLimPreAuthTimerTable.pTable,
616 cfgValue*sizeof(tLimPreAuthNode)) != eHAL_STATUS_SUCCESS)
617 {
618 limLog(pMac, LOGP, FL("palAllocateMemory failed!\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700619 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 }
621
622 limInitPreAuthTimerTable(pMac, &pMac->lim.gLimPreAuthTimerTable);
623 PELOG1(limLog(pMac, LOG1, FL("alloc and init table for preAuth timers\n"));)
624
625
626#ifdef WLAN_SOFTAP_FEATURE
627 {
628 /**
629 * Create OLBC cache aging timer
630 */
631 if (wlan_cfgGetInt(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT,
632 &cfgValue) != eSIR_SUCCESS)
633 {
634 /**
635 * Could not get OLBC detect timeout value
636 * from CFG. Log error.
637 */
638 limLog(pMac, LOGP,
639 FL("could not retrieve OLBD detect timeout value\n"));
640 }
641
642 cfgValue = SYS_MS_TO_TICKS(cfgValue);
643
644 if (tx_timer_create(
645 &pMac->lim.limTimers.gLimUpdateOlbcCacheTimer,
646 "OLBC UPDATE CACHE TIMEOUT",
647 limUpdateOlbcCacheTimerHandler,
648 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
649 cfgValue,
650 cfgValue,
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -0700651 TX_NO_ACTIVATE) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 {
653 // Cannot create update OLBC cache timer
654 // Log error
655 limLog(pMac, LOGP, FL("Cannot create update OLBC cache timer\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700656 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 }
658 }
659#endif
660#ifdef WLAN_FEATURE_VOWIFI_11R
661 // In future we need to use the auth timer, cause
662 // the pre auth session will be introduced before sending
663 // Auth frame.
664 // We need to go off channel and come back to home channel
665 cfgValue = 1000;
666 cfgValue = SYS_MS_TO_TICKS(cfgValue);
667
668 if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
669 "FT PREAUTH RSP TIMEOUT",
670 limTimerHandler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT,
671 cfgValue, 0,
672 TX_NO_ACTIVATE) != TX_SUCCESS)
673 {
674 // Could not create Join failure timer.
675 // Log error
676 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700677 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 }
679#endif
680
681#ifdef FEATURE_WLAN_CCX
682 cfgValue = 5000;
683 cfgValue = SYS_MS_TO_TICKS(cfgValue);
684
685 if (tx_timer_create(&pMac->lim.limTimers.gLimCcxTsmTimer,
686 "CCX TSM Stats TIMEOUT",
687 limTimerHandler, SIR_LIM_CCX_TSM_TIMEOUT,
688 cfgValue, 0,
689 TX_NO_ACTIVATE) != TX_SUCCESS)
690 {
691 // Could not create Join failure timer.
692 // Log error
693 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700694 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 }
696#endif
697
698#ifdef WLAN_FEATURE_P2P
699 cfgValue = 1000;
700 cfgValue = SYS_MS_TO_TICKS(cfgValue);
701 if (tx_timer_create(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
702 "FT PREAUTH RSP TIMEOUT",
703 limTimerHandler, SIR_LIM_REMAIN_CHN_TIMEOUT,
704 cfgValue, 0,
705 TX_NO_ACTIVATE) != TX_SUCCESS)
706 {
707 // Could not create Join failure timer.
708 // Log error
709 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700710 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 }
712
713#endif
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800714
715 cfgValue = 1000;
716 cfgValue = SYS_MS_TO_TICKS(cfgValue);
717 if (tx_timer_create(&pMac->lim.limTimers.gLimDisassocAckTimer,
718 "DISASSOC ACK TIMEOUT",
719 limTimerHandler, SIR_LIM_DISASSOC_ACK_TIMEOUT,
720 cfgValue, 0,
721 TX_NO_ACTIVATE) != TX_SUCCESS)
722 {
723 limLog(pMac, LOGP, FL("could not DISASSOC ACK TIMEOUT timer\n"));
724 goto err_timer;
725 }
726
727 cfgValue = 1000;
728 cfgValue = SYS_MS_TO_TICKS(cfgValue);
729 if (tx_timer_create(&pMac->lim.limTimers.gLimDeauthAckTimer,
730 "DISASSOC ACK TIMEOUT",
Viral Modid86bde22012-12-10 13:09:21 -0800731 limTimerHandler, SIR_LIM_DEAUTH_ACK_TIMEOUT,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800732 cfgValue, 0,
733 TX_NO_ACTIVATE) != TX_SUCCESS)
734 {
735 limLog(pMac, LOGP, FL("could not create DEAUTH ACK TIMEOUT timer\n"));
736 goto err_timer;
737 }
Viral Modid86bde22012-12-10 13:09:21 -0800738
739#ifdef WLAN_FEATURE_P2P
740 cfgValue = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE; // (> no of BI* no of TUs per BI * 1TU in msec + p2p start time offset*1 TU in msec = 2*100*1.024 + 5*1.024 = 204.8 + 5.12 = 209.20)
741 cfgValue = SYS_MS_TO_TICKS(cfgValue);
742 if (tx_timer_create(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
743 "Single Shot NOA Insert timeout",
744 limTimerHandler, SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT,
745 cfgValue, 0,
746 TX_NO_ACTIVATE) != TX_SUCCESS)
747 {
748 limLog(pMac, LOGP, FL("could not create Single Shot NOA Insert Timeout timer\n"));
749 goto err_timer;
750 }
751#endif
752
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700753 return TX_SUCCESS;
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700754
755 err_timer:
Viral Modid86bde22012-12-10 13:09:21 -0800756 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800757 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
758#ifdef WLAN_FEATURE_P2P
759 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
760#endif
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700761 #ifdef FEATURE_WLAN_CCX
762 tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
763 #endif
764 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
765 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
766 while(((tANI_S32)--i) >= 0)
767 {
768 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[i]);
769 }
770 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
771 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
772 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
773 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
774 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
775 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
776 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
777 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
778 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
779 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800780 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700781 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
782 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
783 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
784 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
785 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
786 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
Venkata Prathyusha Kuntupalli7a87ff02013-01-29 10:45:54 -0800787#ifdef WLAN_FEATURE_P2P
788 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
789#endif
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700790
791 if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
792 palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
793
794 return TX_TIMER_ERROR;
795
Jeff Johnson295189b2012-06-20 16:38:30 -0700796} /****** end limCreateTimers() ******/
797
798
799
800/**
801 * limTimerHandler()
802 *
803 *FUNCTION:
804 * This function is called upon
805 * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
806 * 2. JOIN_FAILURE timer expiration while joining a BSS
807 * 3. AUTH_FAILURE timer expiration while authenticating with a peer
808 * 4. Heartbeat timer expiration on STA
809 * 5. Background scan timer expiration on STA
810 * 6. AID release, Pre-auth cleanup and Link monitoring timer
811 * expiration on AP
812 *
813 *LOGIC:
814 *
815 *ASSUMPTIONS:
816 * NA
817 *
818 *NOTE:
819 * NA
820 *
821 * @param param - Message corresponding to the timer that expired
822 *
823 * @return None
824 */
825
826void
827limTimerHandler(void *pMacGlobal, tANI_U32 param)
828{
829 tANI_U32 statusCode;
830 tSirMsgQ msg;
831 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
832
833 // Prepare and post message to LIM Message Queue
834
835 msg.type = (tANI_U16) param;
836 msg.bodyptr = NULL;
837 msg.bodyval = 0;
838
839 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
840 limLog(pMac, LOGE,
841 FL("posting message %X to LIM failed, reason=%d\n"),
842 msg.type, statusCode);
843} /****** end limTimerHandler() ******/
844
845
846/**
847 * limAddtsResponseTimerHandler()
848 *
849 *FUNCTION:
850 * This function is called upon Addts response timer expiration on sta
851 *
852 *LOGIC:
853 * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
854 * when this function is executed.
855 *
856 *ASSUMPTIONS:
857 * NA
858 *
859 *NOTE:
860 * NA
861 *
862 * @param param - pointer to pre-auth node
863 *
864 * @return None
865 */
866
867void
868limAddtsResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
869{
870 tSirMsgQ msg;
871 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
872
873 // Prepare and post message to LIM Message Queue
874
875 msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
876 msg.bodyval = param;
877 msg.bodyptr = NULL;
878
879 limPostMsgApi(pMac, &msg);
880} /****** end limAuthResponseTimerHandler() ******/
881
882
883/**
884 * limAuthResponseTimerHandler()
885 *
886 *FUNCTION:
887 * This function is called upon Auth response timer expiration on AP
888 *
889 *LOGIC:
890 * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
891 * when this function is executed.
892 *
893 *ASSUMPTIONS:
894 * NA
895 *
896 *NOTE:
897 * NA
898 *
899 * @param param - pointer to pre-auth node
900 *
901 * @return None
902 */
903
904void
905limAuthResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
906{
907 tSirMsgQ msg;
908 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
909
910 // Prepare and post message to LIM Message Queue
911
912 msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
913 msg.bodyptr = NULL;
914 msg.bodyval = (tANI_U32)param;
915
916 limPostMsgApi(pMac, &msg);
917} /****** end limAuthResponseTimerHandler() ******/
918
919
920
921/**
922 * limAssocFailureTimerHandler()
923 *
924 *FUNCTION:
925 * This function is called upon Re/Assoc failure timer expiration
926 * on STA
927 *
928 *LOGIC:
929 * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ
930 * when this function is executed.
931 *
932 *ASSUMPTIONS:
933 * NA
934 *
935 *NOTE:
936 * NA
937 *
938 * @param param - Indicates whether this is assoc or reassoc
939 * failure timeout
940 * @return None
941 */
942
943void
944limAssocFailureTimerHandler(void *pMacGlobal, tANI_U32 param)
945{
946 tSirMsgQ msg;
947 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
948
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700949#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
950 if((LIM_REASSOC == param) &&
951 (NULL != pMac->lim.pSessionEntry))
952 {
953 limLog(pMac, LOGE, FL("Reassoc timeout happened\n"));
954 if(pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT)
955 {
956 limSendRetryReassocReqFrame(pMac, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, pMac->lim.pSessionEntry);
957 pMac->lim.reAssocRetryAttempt++;
958 limLog(pMac, LOGW, FL("Reassoc request retry is sent %d times\n"), pMac->lim.reAssocRetryAttempt);
959 return;
960 }
961 else
962 {
963 limLog(pMac, LOGW, FL("Reassoc request retry MAX(%d) reached\n"), LIM_MAX_REASSOC_RETRY_LIMIT);
964 if(NULL != pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
965 {
966 palFreeMemory( pMac->hHdd, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq);
967 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = NULL;
968 }
969 }
970 }
971#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700972 // Prepare and post message to LIM Message Queue
973
974 msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
975 msg.bodyval = (tANI_U32)param;
976 msg.bodyptr = NULL;
977
978 limPostMsgApi(pMac, &msg);
979} /****** end limAssocFailureTimerHandler() ******/
980
981
982/**
983 * limUpdateOlbcCacheTimerHandler()
984 *
985 *FUNCTION:
986 * This function is called upon update olbc cache timer expiration
987 * on STA
988 *
989 *LOGIC:
990 * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
991 * when this function is executed.
992 *
993 *ASSUMPTIONS:
994 * NA
995 *
996 *NOTE:
997 * NA
998 *
999 * @param
1000 *
1001 * @return None
1002 */
1003#ifdef WLAN_SOFTAP_FEATURE
1004void
1005limUpdateOlbcCacheTimerHandler(void *pMacGlobal, tANI_U32 param)
1006{
1007 tSirMsgQ msg;
1008 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
1009
1010 // Prepare and post message to LIM Message Queue
1011
1012 msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
1013 msg.bodyval = 0;
1014 msg.bodyptr = NULL;
1015
1016 limPostMsgApi(pMac, &msg);
1017} /****** end limUpdateOlbcCacheTimerHandler() ******/
1018#endif
1019
1020/**
1021 * limDeactivateAndChangeTimer()
1022 *
1023 *FUNCTION:
1024 * This function is called to deactivate and change a timer
1025 * for future re-activation
1026 *
1027 *LOGIC:
1028 *
1029 *ASSUMPTIONS:
1030 * NA
1031 *
1032 *NOTE:
1033 * NA
1034 *
1035 * @param pMac - Pointer to Global MAC structure
1036 * @param timerId - enum of timer to be deactivated and changed
1037 * This enum is defined in limUtils.h file
1038 *
1039 * @return None
1040 */
1041
1042void
1043limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1044{
1045 tANI_U32 val=0, val1=0;
1046
Jeff Johnsone7245742012-09-05 17:12:55 -07001047 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001048
1049 switch (timerId)
1050 {
1051 case eLIM_ADDTS_RSP_TIMER:
1052 pMac->lim.gLimAddtsRspTimerCount++;
1053 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
1054 {
1055 // Could not deactivate AddtsRsp Timer
1056 // Log error
1057 limLog(pMac, LOGP,
1058 FL("Unable to deactivate AddtsRsp timer\n"));
1059 }
1060 break;
1061
1062 case eLIM_MIN_CHANNEL_TIMER:
1063 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer)
1064 != TX_SUCCESS)
1065 {
1066 // Could not deactivate min channel timer.
1067 // Log error
1068 limLog(pMac, LOGP,
1069 FL("Unable to deactivate min channel timer\n"));
1070 }
1071
Jeff Johnsone7245742012-09-05 17:12:55 -07001072#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001073 // If a background was triggered via Quiet BSS,
1074 // then we need to adjust the MIN and MAX channel
1075 // timer's accordingly to the Quiet duration that
1076 // was specified
1077 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1078 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1079 {
1080 // gLimQuietDuration is already cached in units of
1081 // system ticks. No conversion is reqd...
1082 val = pMac->lim.gLimSpecMgmt.quietDuration;
1083 }
1084 else
1085 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001086#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 if(pMac->lim.gpLimMlmScanReq)
1088 {
1089 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001090 if (pMac->btc.btcScanCompromise)
1091 {
1092 if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)
1093 {
1094 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTimeBtc);
1095 limLog(pMac, LOG1, FL("Using BTC Min Active Scan time"));
1096 }
1097 else
1098 {
1099 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1100 }
1101 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 }
1103 else
1104 {
1105 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1106 //No need to change min timer. This is not a scan
1107 break;
1108 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001109#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001110 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001111#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001112
1113 if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
1114 val, 0) != TX_SUCCESS)
1115 {
1116 // Could not change min channel timer.
1117 // Log error
1118 limLog(pMac, LOGP, FL("Unable to change min channel timer\n"));
1119 }
1120
1121 break;
1122
1123 case eLIM_PERIODIC_PROBE_REQ_TIMER:
1124 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
1125 != TX_SUCCESS)
1126 {
1127 // Could not deactivate min channel timer.
1128 // Log error
1129 limLog(pMac, LOGP,
1130 FL("Unable to deactivate periodic timer\n"));
1131 }
1132
1133 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001134 if (pMac->btc.btcScanCompromise)
1135 {
1136 if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)
1137 {
1138 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)/2;
1139 }
1140 else
1141 {
1142 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1143 }
1144 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
1146 val, 0) != TX_SUCCESS)
1147 {
1148 // Could not change min channel timer.
1149 // Log error
1150 limLog(pMac, LOGP, FL("Unable to change periodic timer\n"));
1151 }
1152
1153 break;
1154
1155 case eLIM_MAX_CHANNEL_TIMER:
1156 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
1157 != TX_SUCCESS)
1158 {
1159 // Could not deactivate max channel timer.
1160 // Log error
1161 limLog(pMac, LOGP,
1162 FL("Unable to deactivate max channel timer\n"));
1163 }
1164
1165#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1166 // If a background was triggered via Quiet BSS,
1167 // then we need to adjust the MIN and MAX channel
1168 // timer's accordingly to the Quiet duration that
1169 // was specified
1170 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
1171 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001172#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001173
1174 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1175 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1176 {
1177 // gLimQuietDuration is already cached in units of
1178 // system ticks. No conversion is reqd...
1179 val = pMac->lim.gLimSpecMgmt.quietDuration;
1180 }
1181 else
1182 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001183#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001184 if(pMac->lim.gpLimMlmScanReq)
1185 {
1186 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001187 if (pMac->btc.btcScanCompromise)
1188 {
1189 if (pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc)
1190 {
1191 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc);
1192 limLog(pMac, LOG1, FL("Using BTC Max Active Scan time"));
1193 }
1194 else
1195 {
1196 limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set"));
1197 }
1198 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 }
1200 else
1201 {
1202 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1203 //No need to change max timer. This is not a scan
1204 break;
1205 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001206#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001208#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001209 }
1210#endif
1211#if defined(ANI_PRODUCT_TYPE_AP)
1212 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1213 {
1214 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
1215 &val) != eSIR_SUCCESS)
1216 {
1217 /**
1218 * Could not get max channel value
1219 * from CFG. Log error.
1220 */
1221 limLog(pMac, LOGP,
1222 FL("could not retrieve max channel value\n"));
1223 }
1224 val = SYS_MS_TO_TICKS(val);
1225 }
1226#endif
1227
1228 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
1229 val, 0) != TX_SUCCESS)
1230 {
1231 // Could not change max channel timer.
1232 // Log error
1233 limLog(pMac, LOGP,
1234 FL("Unable to change max channel timer\n"));
1235 }
1236
1237 break;
1238
1239 case eLIM_JOIN_FAIL_TIMER:
1240 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
1241 != TX_SUCCESS)
1242 {
1243 /**
1244 * Could not deactivate Join Failure
1245 * timer. Log error.
1246 */
1247 limLog(pMac, LOGP,
1248 FL("Unable to deactivate Join Failure timer\n"));
1249 }
1250
1251 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1252 &val) != eSIR_SUCCESS)
1253 {
1254 /**
1255 * Could not get JoinFailureTimeout value
1256 * from CFG. Log error.
1257 */
1258 limLog(pMac, LOGP,
1259 FL("could not retrieve JoinFailureTimeout value\n"));
1260 }
1261 val = SYS_MS_TO_TICKS(val);
1262
1263 if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
1264 val, 0) != TX_SUCCESS)
1265 {
1266 /**
1267 * Could not change Join Failure
1268 * timer. Log error.
1269 */
1270 limLog(pMac, LOGP,
1271 FL("Unable to change Join Failure timer\n"));
1272 }
1273
1274 break;
1275
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001276 case eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER:
1277 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer)
1278 != TX_SUCCESS)
1279 {
1280 // Could not deactivate periodic join req Times.
1281 limLog(pMac, LOGP,
1282 FL("Unable to deactivate periodic join request timer\n"));
1283 }
1284
1285 val = SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS);
1286 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
1287 val, 0) != TX_SUCCESS)
1288 {
1289 // Could not change periodic join req times.
1290 // Log error
1291 limLog(pMac, LOGP, FL("Unable to change periodic join request timer\n"));
1292 }
1293
1294 break;
1295
Jeff Johnson295189b2012-06-20 16:38:30 -07001296 case eLIM_AUTH_FAIL_TIMER:
1297 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
1298 != TX_SUCCESS)
1299 {
1300 // Could not deactivate Auth failure timer.
1301 // Log error
1302 limLog(pMac, LOGP,
1303 FL("Unable to deactivate auth failure timer\n"));
1304 }
1305
1306 // Change timer to reactivate it in future
1307 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
1308 &val) != eSIR_SUCCESS)
1309 {
1310 /**
1311 * Could not get AuthFailureTimeout value
1312 * from CFG. Log error.
1313 */
1314 limLog(pMac, LOGP,
1315 FL("could not retrieve AuthFailureTimeout value\n"));
1316 }
1317 val = SYS_MS_TO_TICKS(val);
1318
1319 if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
1320 val, 0) != TX_SUCCESS)
1321 {
1322 // Could not change Authentication failure timer.
1323 // Log error
1324 limLog(pMac, LOGP,
1325 FL("unable to change Auth failure timer\n"));
1326 }
1327
1328 break;
1329
1330 case eLIM_ASSOC_FAIL_TIMER:
1331 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
1332 TX_SUCCESS)
1333 {
1334 // Could not deactivate Association failure timer.
1335 // Log error
1336 limLog(pMac, LOGP,
1337 FL("unable to deactivate Association failure timer\n"));
1338 }
1339
1340 // Change timer to reactivate it in future
1341 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
1342 &val) != eSIR_SUCCESS)
1343 {
1344 /**
1345 * Could not get AssocFailureTimeout value
1346 * from CFG. Log error.
1347 */
1348 limLog(pMac, LOGP,
1349 FL("could not retrieve AssocFailureTimeout value\n"));
1350 }
1351 val = SYS_MS_TO_TICKS(val);
1352
1353 if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
1354 val, 0) != TX_SUCCESS)
1355 {
1356 // Could not change Association failure timer.
1357 // Log error
1358 limLog(pMac, LOGP,
1359 FL("unable to change Assoc failure timer\n"));
1360 }
1361
1362 break;
1363
1364 case eLIM_REASSOC_FAIL_TIMER:
1365 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
1366 TX_SUCCESS)
1367 {
1368 // Could not deactivate Reassociation failure timer.
1369 // Log error
1370 limLog(pMac, LOGP,
1371 FL("unable to deactivate Reassoc failure timer\n"));
1372 }
1373
1374 // Change timer to reactivate it in future
1375 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1376 &val) != eSIR_SUCCESS)
1377 {
1378 /**
1379 * Could not get ReassocFailureTimeout value
1380 * from CFG. Log error.
1381 */
1382 limLog(pMac, LOGP,
1383 FL("could not retrieve ReassocFailureTimeout value\n"));
1384 }
1385 val = SYS_MS_TO_TICKS(val);
1386
1387 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
1388 val, 0) != TX_SUCCESS)
1389 {
1390 // Could not change Reassociation failure timer.
1391 // Log error
1392 limLog(pMac, LOGP,
1393 FL("unable to change Reassociation failure timer\n"));
1394 }
1395
1396 break;
1397
1398 case eLIM_HEART_BEAT_TIMER:
1399 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
1400 TX_SUCCESS)
1401 {
1402 // Could not deactivate Heartbeat timer.
1403 // Log error
1404 limLog(pMac, LOGP,
1405 FL("unable to deactivate Heartbeat timer\n"));
1406 }
1407
1408 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
1409 &val) != eSIR_SUCCESS)
1410 {
1411 /**
1412 * Could not get BEACON_INTERVAL value
1413 * from CFG. Log error.
1414 */
1415 limLog(pMac, LOGP,
1416 FL("could not retrieve BEACON_INTERVAL value\n"));
1417 }
1418
1419 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
1420 eSIR_SUCCESS)
1421 limLog(pMac, LOGP,
1422 FL("could not retrieve heartbeat failure value\n"));
1423
1424 // Change timer to reactivate it in future
1425 val = SYS_MS_TO_TICKS(val * val1);
1426
1427 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
1428 val, 0) != TX_SUCCESS)
1429 {
1430 // Could not change HeartBeat timer.
1431 // Log error
1432 limLog(pMac, LOGP,
1433 FL("unable to change HeartBeat timer\n"));
1434 }
1435
1436 break;
1437
1438 case eLIM_PROBE_AFTER_HB_TIMER:
1439 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
1440 TX_SUCCESS)
1441 {
1442 // Could not deactivate Heartbeat timer.
1443 // Log error
1444 limLog(pMac, LOGP,
1445 FL("unable to deactivate probeAfterHBTimer\n"));
1446 }
1447
1448 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
1449 &val) != eSIR_SUCCESS)
1450 {
1451 /**
1452 * Could not get PROBE_AFTER_HB_FAILURE
1453 * value from CFG. Log error.
1454 */
1455 limLog(pMac, LOGP,
1456 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
1457 }
1458
1459 // Change timer to reactivate it in future
1460 val = SYS_MS_TO_TICKS(val);
1461
1462 if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
1463 val, 0) != TX_SUCCESS)
1464 {
1465 // Could not change HeartBeat timer.
1466 // Log error
1467 limLog(pMac, LOGP,
1468 FL("unable to change ProbeAfterHBTimer\n"));
1469 }
1470
1471 break;
1472
1473 case eLIM_KEEPALIVE_TIMER:
1474 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
1475 != TX_SUCCESS)
1476 {
1477 // Could not deactivate Keepalive timer.
1478 // Log error
1479 limLog(pMac, LOGP,
1480 FL("unable to deactivate KeepaliveTimer timer\n"));
1481 }
1482
1483 // Change timer to reactivate it in future
1484
1485 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
1486 &val) != eSIR_SUCCESS)
1487 {
1488 /**
1489 * Could not get keepalive timeout value
1490 * from CFG. Log error.
1491 */
1492 limLog(pMac, LOGP,
1493 FL("could not retrieve keepalive timeout value\n"));
1494 }
1495 if (val == 0)
1496 {
1497 val = 3000;
1498 pMac->sch.keepAlive = 0;
1499 } else
1500 pMac->sch.keepAlive = 1;
1501
1502
1503
1504 val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
1505
1506 if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
1507 val, val) != TX_SUCCESS)
1508 {
1509 // Could not change KeepaliveTimer timer.
1510 // Log error
1511 limLog(pMac, LOGP,
1512 FL("unable to change KeepaliveTimer timer\n"));
1513 }
1514
1515 break;
1516
1517#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1518 case eLIM_BACKGROUND_SCAN_TIMER:
1519 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
1520 != TX_SUCCESS)
1521 {
1522 // Could not deactivate BackgroundScanTimer timer.
1523 // Log error
1524 limLog(pMac, LOGP,
1525 FL("unable to deactivate BackgroundScanTimer timer\n"));
1526 }
1527
1528 // Change timer to reactivate it in future
1529 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
1530 &val) != eSIR_SUCCESS)
1531 {
1532 /**
1533 * Could not get Background scan period value
1534 * from CFG. Log error.
1535 */
1536 limLog(pMac, LOGP,
1537 FL("could not retrieve Background scan period value\n"));
1538 }
1539 if (val == 0)
1540 {
1541 val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
1542 pMac->lim.gLimBackgroundScanDisable = true;
1543 }
1544 else
1545 pMac->lim.gLimBackgroundScanDisable = false;
1546
1547 val = SYS_MS_TO_TICKS(val);
1548
1549 if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
1550 val, val) != TX_SUCCESS)
1551 {
1552 // Could not change BackgroundScanTimer timer.
1553 // Log error
1554 limLog(pMac, LOGP,
1555 FL("unable to change BackgroundScanTimer timer\n"));
1556 }
1557
1558 break;
1559#endif
1560
1561#ifdef ANI_PRODUCT_TYPE_AP
1562 case eLIM_PRE_AUTH_CLEANUP_TIMER:
1563 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer) !=
1564 TX_SUCCESS)
1565 {
1566 // Could not deactivate Pre-auth cleanup timer.
1567 // Log error
1568 limLog(pMac, LOGP,
1569 FL("unable to deactivate Pre-auth cleanup timer\n"));
1570 }
1571
1572 // Change timer to reactivate it in future
1573 if (wlan_cfgGetInt(pMac, WNI_CFG_PREAUTH_CLNUP_TIMEOUT,
1574 &val) != eSIR_SUCCESS)
1575 {
1576 /**
1577 * Could not get pre-auth cleanup value
1578 * from CFG. Log error.
1579 */
1580 limLog(pMac, LOGP,
1581 FL("could not retrieve pre-auth cleanup value\n"));
1582 }
1583 val = SYS_MS_TO_TICKS(val);
1584
1585 if (tx_timer_change(&pMac->lim.limTimers.gLimPreAuthClnupTimer,
1586 val, val) != TX_SUCCESS)
1587 {
1588 // Could not change pre-auth cleanup timer.
1589 // Log error
1590 limLog(pMac, LOGP,
1591 FL("unable to change pre-auth cleanup timer\n"));
1592 }
1593
1594 break;
1595
1596 case eLIM_LEARN_INTERVAL_TIMER:
1597 {
1598 // Restart Learn Interval timer
1599 tANI_U32 learnInterval =
1600 pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
1601 pMac->lim.gpLimMeasReq->channelList.numChannels;
1602
1603 if (tx_timer_deactivate(
1604 &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
1605 {
1606 // Could not deactivate Learn Interval timer.
1607 // Log error
1608 limLog(pMac, LOGP,
1609 FL("Unable to deactivate Learn Interval timer\n"));
1610 }
1611
1612 if (tx_timer_change(
1613 &pMac->lim.gLimMeasParams.learnIntervalTimer,
1614 SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
1615 {
1616 // Could not change Learn Interval timer.
1617 // Log error
1618 limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
1619
1620 return;
1621 }
1622
1623 limLog( pMac, LOG3,
1624 FL("Setting the Learn Interval TIMER to %d ticks\n"),
1625 SYS_MS_TO_TICKS(learnInterval));
1626 }
1627 break;
1628
1629#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001630#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001631 case eLIM_CHANNEL_SWITCH_TIMER:
1632 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
1633 {
1634 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
1635 return;
1636 }
1637
1638 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
1639 pMac->lim.gLimChannelSwitch.switchTimeoutValue,
1640 0) != TX_SUCCESS)
1641 {
1642 limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
1643 return;
1644 }
1645 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001646#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001647
1648 case eLIM_LEARN_DURATION_TIMER:
1649#ifdef ANI_PRODUCT_TYPE_AP
1650 if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
1651 {
1652 limLog(pMac, LOGP, FL("Could not deactivate learn duration timer\n"));
1653 return;
1654 }
1655
1656 if (pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity &&
1657 (pMac->lim.gLimMeasParams.shortDurationCount ==
1658 pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity))
1659 {
1660#ifdef ANI_AP_SDK
1661 val = pMac->lim.gLimScanDurationConvert.longChannelScanDuration_tick;
1662#else
1663 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration
1664 + SYS_TICK_DUR_MS - 1);
1665 if(val > 1)
1666 val--;
1667#endif /* ANI_AP_SDK */
1668 // Time to perform measurements for longer term
1669 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1670 val, 0) != TX_SUCCESS)
1671 {
1672 // Could not change Learn duration timer.
1673 // Log error
1674 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1675 return;
1676 }
1677 pMac->lim.gLimMeasParams.shortDurationCount = 0;
1678 }
1679 else
1680 {
1681#ifdef ANI_AP_SDK
1682 val = pMac->lim.gLimScanDurationConvert.shortChannelScanDuration_tick;
1683#else
1684 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration
1685 + SYS_TICK_DUR_MS - 1);
1686 if(val > 1)
1687 val--;
1688#endif /* ANI_AP_SDK */
1689 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1690 val, 0) != TX_SUCCESS)
1691 {
1692 // Could not change Learn duration timer.
1693 // Log error
1694 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1695 }
1696 }
1697 pMac->lim.gpLimMeasData->duration = val * SYS_TICK_DUR_MS;
1698#endif
1699 break;
1700
Jeff Johnsone7245742012-09-05 17:12:55 -07001701#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001702 case eLIM_QUIET_BSS_TIMER:
1703 if (TX_SUCCESS !=
1704 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
1705 {
1706 limLog( pMac, LOGE,
1707 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway...\n"));
1708 }
1709
1710 // gLimQuietDuration appears to be in units of ticks
1711 // Use it as is
1712 if (TX_SUCCESS !=
1713 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
1714 pMac->lim.gLimSpecMgmt.quietDuration,
1715 0))
1716 {
1717 limLog( pMac, LOGE,
1718 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway...\n"));
1719 }
1720 break;
1721
1722 case eLIM_QUIET_TIMER:
1723 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
1724 {
1725 limLog( pMac, LOGE,
1726 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1727 }
1728
1729 // Set the NEW timeout value, in ticks
1730 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
1731 SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
1732 {
1733 limLog( pMac, LOGE,
1734 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1735 }
1736 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001737#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001738
1739#ifdef WLAN_SOFTAP_FEATURE
1740#if 0
1741 case eLIM_WPS_OVERLAP_TIMER:
1742 {
1743 // Restart Learn Interval timer
1744
1745 tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
1746
1747 if (tx_timer_deactivate(
1748 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1749 {
1750 // Could not deactivate Learn Interval timer.
1751 // Log error
1752 limLog(pMac, LOGP,
1753 FL("Unable to deactivate WPS overlap timer\n"));
1754 }
1755
1756 if (tx_timer_change(
1757 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1758 WPSOverlapTimer, 0) != TX_SUCCESS)
1759 {
1760 // Could not change Learn Interval timer.
1761 // Log error
1762 limLog(pMac, LOGP, FL("Unable to change WPS overlap timer\n"));
1763
1764 return;
1765 }
1766
1767 limLog( pMac, LOGE,
1768 FL("Setting WPS overlap TIMER to %d ticks\n"),
1769 WPSOverlapTimer);
1770 }
1771 break;
1772#endif
1773#endif
1774
1775#ifdef WLAN_FEATURE_VOWIFI_11R
1776 case eLIM_FT_PREAUTH_RSP_TIMER:
1777 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != TX_SUCCESS)
1778 {
1779 /**
1780 ** Could not deactivate Join Failure
1781 ** timer. Log error.
1782 **/
1783 limLog(pMac, LOGP, FL("Unable to deactivate Preauth response Failure timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001784 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001785 }
1786 val = 1000;
1787 val = SYS_MS_TO_TICKS(val);
1788 if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
1789 val, 0) != TX_SUCCESS)
1790 {
1791 /**
1792 * Could not change Join Failure
1793 * timer. Log error.
1794 */
1795 limLog(pMac, LOGP, FL("Unable to change Join Failure timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001796 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 }
1798 break;
1799#endif
1800#ifdef FEATURE_WLAN_CCX
1801 case eLIM_TSM_TIMER:
1802 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer)
1803 != TX_SUCCESS)
1804 {
1805 limLog(pMac, LOGE, FL("Unable to deactivate TSM timer\n"));
1806 }
1807 break;
1808#endif
1809#ifdef WLAN_FEATURE_P2P
1810 case eLIM_REMAIN_CHN_TIMER:
1811 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer) != TX_SUCCESS)
1812 {
1813 /**
1814 ** Could not deactivate Join Failure
1815 ** timer. Log error.
1816 **/
1817 limLog(pMac, LOGP, FL("Unable to deactivate Remain on Chn timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001818 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001819 }
1820 val = 1000;
1821 val = SYS_MS_TO_TICKS(val);
1822 if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
1823 val, 0) != TX_SUCCESS)
1824 {
1825 /**
1826 * Could not change Join Failure
1827 * timer. Log error.
1828 */
1829 limLog(pMac, LOGP, FL("Unable to change timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001830 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 }
1832 break;
1833#endif
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001834 case eLIM_DISASSOC_ACK_TIMER:
1835 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer) != TX_SUCCESS)
1836 {
1837 /**
1838 ** Could not deactivate Join Failure
1839 ** timer. Log error.
1840 **/
1841 limLog(pMac, LOGP, FL("Unable to deactivate Disassoc ack timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001842 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001843 }
1844 val = 1000;
1845 val = SYS_MS_TO_TICKS(val);
1846 if (tx_timer_change(&pMac->lim.limTimers.gLimDisassocAckTimer,
1847 val, 0) != TX_SUCCESS)
1848 {
1849 /**
1850 * Could not change Join Failure
1851 * timer. Log error.
1852 */
1853 limLog(pMac, LOGP, FL("Unable to change timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001854 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001855 }
1856 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001857
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001858 case eLIM_DEAUTH_ACK_TIMER:
1859 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer) != TX_SUCCESS)
1860 {
1861 /**
1862 ** Could not deactivate Join Failure
1863 ** timer. Log error.
1864 **/
1865 limLog(pMac, LOGP, FL("Unable to deactivate Deauth ack timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001866 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001867 }
1868 val = 1000;
1869 val = SYS_MS_TO_TICKS(val);
1870 if (tx_timer_change(&pMac->lim.limTimers.gLimDeauthAckTimer,
1871 val, 0) != TX_SUCCESS)
1872 {
1873 /**
1874 * Could not change Join Failure
1875 * timer. Log error.
1876 */
1877 limLog(pMac, LOGP, FL("Unable to change timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001878 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001879 }
1880 break;
Viral Modid86bde22012-12-10 13:09:21 -08001881
1882#ifdef WLAN_FEATURE_P2P
1883 case eLIM_INSERT_SINGLESHOT_NOA_TIMER:
1884 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer) != TX_SUCCESS)
1885 {
1886 /**
1887 ** Could not deactivate SingleShot NOA Insert
1888 ** timer. Log error.
1889 **/
1890 limLog(pMac, LOGP, FL("Unable to deactivate SingleShot NOA Insert timer\n"));
1891 return;
1892 }
1893 val = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE;
1894 val = SYS_MS_TO_TICKS(val);
1895 if (tx_timer_change(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
1896 val, 0) != TX_SUCCESS)
1897 {
1898 /**
1899 * Could not change Single Shot NOA Insert
1900 * timer. Log error.
1901 */
1902 limLog(pMac, LOGP, FL("Unable to change timer\n"));
1903 return;
1904 }
1905 break;
1906#endif
1907
Jeff Johnson295189b2012-06-20 16:38:30 -07001908 default:
1909 // Invalid timerId. Log error
1910 break;
1911 }
1912} /****** end limDeactivateAndChangeTimer() ******/
1913
1914
1915
1916/**---------------------------------------------------------------
1917\fn limHeartBeatDeactivateAndChangeTimer
1918\brief This function deactivates and changes the heart beat
1919\ timer, eLIM_HEART_BEAT_TIMER.
1920\
1921\param pMac
1922\param psessionEntry
1923\return None
1924------------------------------------------------------------------*/
1925void
1926limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1927{
1928 tANI_U32 val, val1;
1929
Jeff Johnsone7245742012-09-05 17:12:55 -07001930 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Yathish9f22e662012-12-10 14:21:35 -08001931#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1932 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1933 return;
1934#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001935
1936 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
1937 limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer \n"));
1938
1939 /* HB Timer sessionisation: In case of 2 or more sessions, the HB interval keeps
1940 changing. to avoid this problem, HeartBeat interval is made constant, by
1941 fixing beacon interval to 100ms immaterial of the beacon interval of the session */
1942
1943 //val = psessionEntry->beaconParams.beaconInterval;
1944 val = LIM_HB_TIMER_BEACON_INTERVAL;
1945
1946 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
1947 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_HEART_BEAT_THRESHOLD \n"));
1948
1949 PELOGW(limLog(pMac,LOGW,
1950 FL("HB Timer Int.=100ms * %d, Beacon Int.=%dms,Session Id=%d \n"),
1951 val1, psessionEntry->beaconParams.beaconInterval,
1952 psessionEntry->peSessionId);)
1953
1954 // Change timer to reactivate it in future
1955 val = SYS_MS_TO_TICKS(val * val1);
1956
1957 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer, val, 0) != TX_SUCCESS)
1958 limLog(pMac, LOGP, FL("Fail to change HeartBeatTimer\n"));
1959
1960} /****** end limHeartBeatDeactivateAndChangeTimer() ******/
1961
1962
1963/**---------------------------------------------------------------
1964\fn limReactivateHeartBeatTimer
1965\brief This function s called to deactivate, change and
1966\ activate a timer.
1967\
1968\param pMac - Pointer to Global MAC structure
1969\param psessionEntry
1970\return None
1971------------------------------------------------------------------*/
1972void
1973limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1974{
1975 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"), psessionEntry->LimRxedBeaconCntDuringHB);)
1976
Yathish9f22e662012-12-10 14:21:35 -08001977#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1978 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1979 return;
1980#endif
1981
Jeff Johnson295189b2012-06-20 16:38:30 -07001982 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001983 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001984
1985 //only start the hearbeat-timer if the timeout value is non-zero
1986 if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0) {
1987 if (tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
1988 {
1989 limLog(pMac, LOGP,FL("could not activate Heartbeat timer\n"));
1990 }
1991 limResetHBPktCount(psessionEntry);
1992 }
1993
1994} /****** end limReactivateHeartBeatTimer() ******/
1995
1996#if 0
1997/******
1998 * Note: Use this code once you have converted all
1999 * limReactivateHeartBeatTimer() calls to
2000 * limReactivateTimer() calls.
2001 *
2002 ******/
2003
2004Now, in dev/btamp2,
2005here are all the references to limReactivateHeartBeatTimer().
2006
2007C symbol: limReactivateHeartBeatTimer
2008
2009 File Function Line
20100 limTimerUtils.h <global> 55 void limReactivateHeartBeatTimer(tpAniSirGlobal , tpPESession);
20111 limIbssPeerMgmt.c limIbssHeartBeatHandle 1282 limReactivateHeartBeatTimer(pMac, psessionEntry);
20122 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 395 limReactivateHeartBeatTimer(pMac, psessionEntry);
20133 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 410 limReactivateHeartBeatTimer(pMac, psessionEntry);
20144 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
20155 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2350 limReactivateHeartBeatTimer(pMac, psessionEntry);
20166 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
20177 limTimerUtils.c limReactivateHeartBeatTim 1473 limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
20188 limUtils.c limHandleHeartBeatFailure 6743 limReactivateHeartBeatTimer(pMac, psessionEntry);
20199 limUtils.c limHandleHeartBeatFailure 6751 limReactivateHeartBeatTimer(pMac, psessionEntry);
2020
2021Now, in main/latest, on the other hand,
2022here are all the references to limReactivateTimer().
2023
2024C symbol: limReactivateTimer
2025
2026 File Function Line
20270 limTimerUtils.h <global> 54 void limReactivateTimer(tpAniSirGlobal, tANI_U32);
20281 limIbssPeerMgmt.c limIbssHeartBeatHandle 1183 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20292 limIbssPeerMgmt.c limIbssHeartBeatHandle 1246 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20303 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 283 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20314 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 320 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20325 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 335 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20336 limProcessMessageQueue.c limProcessMessages 1210 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20347 limProcessMessageQueue.c limProcessMessages 1218 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20358 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 1726 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20369 limTimerUtils.c limReactivateTimer 1451 limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
2037
2038
2039/**
2040 * limReactivateTimer()
2041 *
2042 *FUNCTION:
2043 * This function is called to deactivate, change and
2044 * activate a timer
2045 *
2046 *LOGIC:
2047 *
2048 *ASSUMPTIONS:
2049 * NA
2050 *
2051 *NOTE:
2052 * NA
2053 *
2054 * @param pMac - Pointer to Global MAC structure
2055 * @param timerId - enum of timer to be deactivated and changed
2056 * This enum is defined in limUtils.h file
2057 *
2058 * @return None
2059 */
2060
2061void
2062limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
2063{
2064 if (timerId == eLIM_HEART_BEAT_TIMER)
2065 {
2066 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"),
2067 pMac->lim.gLimRxedBeaconCntDuringHB);)
2068 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
2069 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
2070 if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
2071 {
2072 /// Could not activate Heartbeat timer.
2073 // Log error
2074 limLog(pMac, LOGP,
2075 FL("could not activate Heartbeat timer\n"));
2076 }
2077 limResetHBPktCount(pMac);
2078 }
2079} /****** end limReactivateTimer() ******/
2080#endif
2081
2082
2083/**
2084 * limActivateHearBeatTimer()
2085 *
2086 *
2087 * @brief: This function is called to activate heartbeat timer
2088 *
2089 *LOGIC:
2090 *
2091 *ASSUMPTIONS:
2092 * NA
2093 *
2094 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2095 *
2096 * @param pMac - Pointer to Global MAC structure
2097 *
2098 * @return TX_SUCCESS - timer is activated
2099 * errors - fail to start the timer
2100 */
2101v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac)
2102{
2103 v_UINT_t status = TX_TIMER_ERROR;
2104
Yathish9f22e662012-12-10 14:21:35 -08002105#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2106 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2107 return (status);
2108#endif
2109
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 if(TX_AIRGO_TMR_SIGNATURE == pMac->lim.limTimers.gLimHeartBeatTimer.tmrSignature)
2111 {
2112 //consider 0 interval a ok case
2113 if( pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs )
2114 {
2115 status = tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer);
2116 if( TX_SUCCESS != status )
2117 {
2118 PELOGE(limLog(pMac, LOGE,
2119 FL("could not activate Heartbeat timer status(%d)\n"), status);)
2120 }
2121 }
2122 else
2123 {
2124 status = TX_SUCCESS;
2125 }
2126 }
2127
2128 return (status);
2129}
2130
2131
2132
2133/**
2134 * limDeactivateAndChangePerStaIdTimer()
2135 *
2136 *
2137 * @brief: This function is called to deactivate and change a per STA timer
2138 * for future re-activation
2139 *
2140 *LOGIC:
2141 *
2142 *ASSUMPTIONS:
2143 * NA
2144 *
2145 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2146 *
2147 * @param pMac - Pointer to Global MAC structure
2148 * @param timerId - enum of timer to be deactivated and changed
2149 * This enum is defined in limUtils.h file
2150 * @param staId - staId
2151 *
2152 * @return None
2153 */
2154
2155void
2156limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
2157{
2158 tANI_U32 val;
Jeff Johnsone7245742012-09-05 17:12:55 -07002159 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002160
2161 switch (timerId)
2162 {
2163 case eLIM_CNF_WAIT_TIMER:
2164
2165 if (tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2166 != TX_SUCCESS)
2167 {
2168 limLog(pMac, LOGP,
2169 FL("unable to deactivate CNF wait timer\n"));
2170
2171 }
2172
2173 // Change timer to reactivate it in future
2174
2175 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
2176 &val) != eSIR_SUCCESS)
2177 {
2178 /**
2179 * Could not get cnf timeout value
2180 * from CFG. Log error.
2181 */
2182 limLog(pMac, LOGP,
2183 FL("could not retrieve cnf timeout value\n"));
2184 }
2185 val = SYS_MS_TO_TICKS(val);
2186
2187 if (tx_timer_change(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId],
2188 val, val) != TX_SUCCESS)
2189 {
2190 // Could not change cnf timer.
2191 // Log error
2192 limLog(pMac, LOGP, FL("unable to change cnf wait timer\n"));
2193 }
2194
2195 break;
2196
2197 case eLIM_AUTH_RSP_TIMER:
2198 {
2199 tLimPreAuthNode *pAuthNode;
2200
2201 pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, staId);
2202
2203 if (pAuthNode == NULL)
2204 {
2205 limLog(pMac, LOGP, FL("Invalid Pre Auth Index passed :%d\n"), staId);
2206 break;
2207 }
2208
2209 if (tx_timer_deactivate(&pAuthNode->timer) != TX_SUCCESS)
2210 {
2211 // Could not deactivate auth response timer.
2212 // Log error
2213 limLog(pMac, LOGP, FL("unable to deactivate auth response timer\n"));
2214 }
2215
2216 // Change timer to reactivate it in future
2217
2218 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, &val) != eSIR_SUCCESS)
2219 {
2220 /**
2221 * Could not get auth rsp timeout value
2222 * from CFG. Log error.
2223 */
2224 limLog(pMac, LOGP,
2225 FL("could not retrieve auth response timeout value\n"));
2226 }
2227
2228 val = SYS_MS_TO_TICKS(val);
2229
2230 if (tx_timer_change(&pAuthNode->timer, val, 0) != TX_SUCCESS)
2231 {
2232 // Could not change auth rsp timer.
2233 // Log error
2234 limLog(pMac, LOGP, FL("unable to change auth rsp timer\n"));
2235 }
2236 }
2237 break;
2238
2239#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
2240 case eLIM_LEARN_INTERVAL_TIMER:
2241 {
2242 // Restart Learn Interval timer
2243 tANI_U32 learnInterval =
2244 pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
2245 pMac->lim.gpLimMeasReq->channelList.numChannels;
2246
2247 if (tx_timer_deactivate(
2248 &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
2249 {
2250 // Could not deactivate Learn Interval timer.
2251 // Log error
2252 limLog(pMac, LOGP,
2253 FL("Unable to deactivate Learn Interval timer\n"));
2254 }
2255
2256 if (tx_timer_change(
2257 &pMac->lim.gLimMeasParams.learnIntervalTimer,
2258 SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
2259 {
2260 // Could not change Learn Interval timer.
2261 // Log error
2262 limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
2263
2264 return;
2265 }
2266
2267 limLog( pMac, LOG3,
2268 FL("Setting the Learn Interval TIMER to %d ticks\n"),
2269 SYS_MS_TO_TICKS(learnInterval) );
2270 }
2271 break;
2272#endif //#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
2273
2274 default:
2275 // Invalid timerId. Log error
2276 break;
2277
2278 }
2279}
2280
2281
2282/**
2283 * limActivateCnfTimer()
2284 *
2285 *FUNCTION:
2286 * This function is called to activate a per STA timer
2287 *
2288 *LOGIC:
2289 *
2290 *ASSUMPTIONS:
2291 * NA
2292 *
2293 *NOTE:
2294 * NA
2295 *
2296 * @param pMac - Pointer to Global MAC structure
2297 * @param StaId - staId
2298 *
2299 * @return None
2300 */
2301
2302void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
2303{
Jeff Johnsone7245742012-09-05 17:12:55 -07002304 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_CNF_WAIT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
2306 if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2307 != TX_SUCCESS)
2308 {
2309 limLog(pMac, LOGP,
2310 FL("could not activate cnf wait timer\n"));
2311 }
2312}
2313
2314/**
2315 * limActivateAuthRspTimer()
2316 *
2317 *FUNCTION:
2318 * This function is called to activate a per STA timer
2319 *
2320 *LOGIC:
2321 *
2322 *ASSUMPTIONS:
2323 * NA
2324 *
2325 *NOTE:
2326 * NA
2327 *
2328 * @param pMac - Pointer to Global MAC structure
2329 * @param id - id
2330 *
2331 * @return None
2332 */
2333
2334void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
2335{
Jeff Johnsone7245742012-09-05 17:12:55 -07002336 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_AUTH_RESP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
2338 {
2339 /// Could not activate auth rsp timer.
2340 // Log error
2341 limLog(pMac, LOGP,
2342 FL("could not activate auth rsp timer\n"));
2343 }
2344}
2345
2346
2347/**
2348 * limSendDisassocFrameThresholdHandler()
2349 *
2350 *FUNCTION:
2351 * This function reloads the credit to the send disassociate frame bucket
2352 *
2353 *LOGIC:
2354 *
2355 *ASSUMPTIONS:
2356 *
2357 *NOTE:
2358 * NA
2359 *
2360 * @param
2361 *
2362 * @return None
2363 */
2364
2365void
2366limSendDisassocFrameThresholdHandler(void *pMacGlobal, tANI_U32 param)
2367{
2368 tSirMsgQ msg;
2369 tANI_U32 statusCode;
2370 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2371
2372 msg.type = SIR_LIM_HASH_MISS_THRES_TIMEOUT;
2373 msg.bodyval = 0;
2374 msg.bodyptr = NULL;
2375
2376 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2377 limLog(pMac, LOGE,
2378 FL("posting to LIM failed, reason=%d\n"), statusCode);
2379
2380}
2381
2382/**
2383 * limAssocCnfWaitTmerHandler()
2384 *
2385 *FUNCTION:
2386 * This function post a message to send a disassociate frame out.
2387 *
2388 *LOGIC:
2389 *
2390 *ASSUMPTIONS:
2391 *
2392 *NOTE:
2393 * NA
2394 *
2395 * @param
2396 *
2397 * @return None
2398 */
2399
2400void
2401limCnfWaitTmerHandler(void *pMacGlobal, tANI_U32 param)
2402{
2403 tSirMsgQ msg;
2404 tANI_U32 statusCode;
2405 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2406
2407 msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
2408 msg.bodyval = (tANI_U32)param;
2409 msg.bodyptr = NULL;
2410
2411 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2412 limLog(pMac, LOGE,
2413 FL("posting to LIM failed, reason=%d\n"), statusCode);
2414
2415}
2416
2417/**
2418 * limKeepaliveTmerHandler()
2419 *
2420 *FUNCTION:
2421 * This function post a message to send a NULL data frame.
2422 *
2423 *LOGIC:
2424 *
2425 *ASSUMPTIONS:
2426 *
2427 *NOTE:
2428 * NA
2429 *
2430 * @param
2431 *
2432 * @return None
2433 */
2434
2435void
2436limKeepaliveTmerHandler(void *pMacGlobal, tANI_U32 param)
2437{
2438 tSirMsgQ msg;
2439 tANI_U32 statusCode;
2440 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2441
2442 msg.type = SIR_LIM_KEEPALIVE_TIMEOUT;
2443 msg.bodyval = (tANI_U32)param;
2444 msg.bodyptr = NULL;
2445
2446 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2447 limLog(pMac, LOGE,
2448 FL("posting to LIM failed, reason=%d\n"), statusCode);
2449
2450}
2451
2452void
2453limChannelSwitchTimerHandler(void *pMacGlobal, tANI_U32 param)
2454{
2455 tSirMsgQ msg;
2456 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2457
2458 PELOG1(limLog(pMac, LOG1,
2459 FL("ChannelSwitch Timer expired. Posting msg to LIM \n"));)
2460
2461 msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
2462 msg.bodyval = (tANI_U32)param;
2463 msg.bodyptr = NULL;
2464
2465 limPostMsgApi(pMac, &msg);
2466}
2467
2468void
2469limQuietTimerHandler(void *pMacGlobal, tANI_U32 param)
2470{
2471 tSirMsgQ msg;
2472 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2473
2474 msg.type = SIR_LIM_QUIET_TIMEOUT;
2475 msg.bodyval = (tANI_U32)param;
2476 msg.bodyptr = NULL;
2477
2478 PELOG1(limLog(pMac, LOG1,
2479 FL("Post SIR_LIM_QUIET_TIMEOUT msg. \n"));)
2480 limPostMsgApi(pMac, &msg);
2481}
2482
2483void
2484limQuietBssTimerHandler(void *pMacGlobal, tANI_U32 param)
2485{
2486 tSirMsgQ msg;
2487 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2488
2489 msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
2490 msg.bodyval = (tANI_U32)param;
2491 msg.bodyptr = NULL;
2492 PELOG1(limLog(pMac, LOG1,
2493 FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. \n"));)
2494 limPostMsgApi(pMac, &msg);
2495}
2496#ifdef WLAN_SOFTAP_FEATURE
2497#if 0
2498void
2499limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
2500{
2501 tSirMsgQ msg;
2502 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2503
2504 msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
2505 msg.bodyval = (tANI_U32)param;
2506 msg.bodyptr = NULL;
2507 PELOG1(limLog(pMac, LOG1,
2508 FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. \n"));)
2509 limPostMsgApi(pMac, &msg);
2510}
2511#endif
2512#endif
Yathish9f22e662012-12-10 14:21:35 -08002513
2514#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2515/* ACTIVE_MODE_HB_OFFLOAD */
2516/**
2517 * limMissedBeaconInActiveMode()
2518 *
2519 *FUNCTION:
2520 * This function handle beacon miss indication from FW
2521 * in Active mode.
2522 *
2523 *LOGIC:
2524 *
2525 *ASSUMPTIONS:
2526 * NA
2527 *
2528 *NOTE:
2529 * NA
2530 *
2531 * @param param - Msg Type
2532 *
2533 * @return None
2534 */
2535void
2536limMissedBeaconInActiveMode(void *pMacGlobal)
2537{
2538 tANI_U32 statusCode;
2539 tSirMsgQ msg;
2540 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2541
2542 // Prepare and post message to LIM Message Queue
2543 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2544 {
2545 msg.type = (tANI_U16) SIR_LIM_HEART_BEAT_TIMEOUT;
2546 msg.bodyptr = NULL;
2547 msg.bodyval = 0;
2548 limLog(pMac, LOGE,
2549 FL("Heartbeat failure from Riva\n"));
2550 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2551 limLog(pMac, LOGE,
2552 FL("posting message %X to LIM failed, reason=%d\n"),
2553 msg.type, statusCode);
2554 }
2555}
2556#endif