blob: 7abdb89af51c7d7948ed3086e95d93ed92594eeb [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
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 {
627 /**
628 * Create OLBC cache aging timer
629 */
630 if (wlan_cfgGetInt(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT,
631 &cfgValue) != eSIR_SUCCESS)
632 {
633 /**
634 * Could not get OLBC detect timeout value
635 * from CFG. Log error.
636 */
637 limLog(pMac, LOGP,
638 FL("could not retrieve OLBD detect timeout value\n"));
639 }
640
641 cfgValue = SYS_MS_TO_TICKS(cfgValue);
642
643 if (tx_timer_create(
644 &pMac->lim.limTimers.gLimUpdateOlbcCacheTimer,
645 "OLBC UPDATE CACHE TIMEOUT",
646 limUpdateOlbcCacheTimerHandler,
647 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
648 cfgValue,
649 cfgValue,
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -0700650 TX_NO_ACTIVATE) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 {
652 // Cannot create update OLBC cache timer
653 // Log error
654 limLog(pMac, LOGP, FL("Cannot create update OLBC cache timer\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700655 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 }
657 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700658#ifdef WLAN_FEATURE_VOWIFI_11R
659 // In future we need to use the auth timer, cause
660 // the pre auth session will be introduced before sending
661 // Auth frame.
662 // We need to go off channel and come back to home channel
663 cfgValue = 1000;
664 cfgValue = SYS_MS_TO_TICKS(cfgValue);
665
666 if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
667 "FT PREAUTH RSP TIMEOUT",
668 limTimerHandler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT,
669 cfgValue, 0,
670 TX_NO_ACTIVATE) != TX_SUCCESS)
671 {
672 // Could not create Join failure timer.
673 // Log error
674 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700675 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 }
677#endif
678
679#ifdef FEATURE_WLAN_CCX
680 cfgValue = 5000;
681 cfgValue = SYS_MS_TO_TICKS(cfgValue);
682
683 if (tx_timer_create(&pMac->lim.limTimers.gLimCcxTsmTimer,
684 "CCX TSM Stats TIMEOUT",
685 limTimerHandler, SIR_LIM_CCX_TSM_TIMEOUT,
686 cfgValue, 0,
687 TX_NO_ACTIVATE) != TX_SUCCESS)
688 {
689 // Could not create Join failure timer.
690 // Log error
691 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700692 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 }
694#endif
695
696#ifdef WLAN_FEATURE_P2P
697 cfgValue = 1000;
698 cfgValue = SYS_MS_TO_TICKS(cfgValue);
699 if (tx_timer_create(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
700 "FT PREAUTH RSP TIMEOUT",
701 limTimerHandler, SIR_LIM_REMAIN_CHN_TIMEOUT,
702 cfgValue, 0,
703 TX_NO_ACTIVATE) != TX_SUCCESS)
704 {
705 // Could not create Join failure timer.
706 // Log error
707 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700708 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 }
710
711#endif
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800712
713 cfgValue = 1000;
714 cfgValue = SYS_MS_TO_TICKS(cfgValue);
715 if (tx_timer_create(&pMac->lim.limTimers.gLimDisassocAckTimer,
716 "DISASSOC ACK TIMEOUT",
717 limTimerHandler, SIR_LIM_DISASSOC_ACK_TIMEOUT,
718 cfgValue, 0,
719 TX_NO_ACTIVATE) != TX_SUCCESS)
720 {
721 limLog(pMac, LOGP, FL("could not DISASSOC ACK TIMEOUT timer\n"));
722 goto err_timer;
723 }
724
725 cfgValue = 1000;
726 cfgValue = SYS_MS_TO_TICKS(cfgValue);
727 if (tx_timer_create(&pMac->lim.limTimers.gLimDeauthAckTimer,
728 "DISASSOC ACK TIMEOUT",
Viral Modid86bde22012-12-10 13:09:21 -0800729 limTimerHandler, SIR_LIM_DEAUTH_ACK_TIMEOUT,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800730 cfgValue, 0,
731 TX_NO_ACTIVATE) != TX_SUCCESS)
732 {
733 limLog(pMac, LOGP, FL("could not create DEAUTH ACK TIMEOUT timer\n"));
734 goto err_timer;
735 }
Viral Modid86bde22012-12-10 13:09:21 -0800736
737#ifdef WLAN_FEATURE_P2P
738 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)
739 cfgValue = SYS_MS_TO_TICKS(cfgValue);
740 if (tx_timer_create(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
741 "Single Shot NOA Insert timeout",
742 limTimerHandler, SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT,
743 cfgValue, 0,
744 TX_NO_ACTIVATE) != TX_SUCCESS)
745 {
746 limLog(pMac, LOGP, FL("could not create Single Shot NOA Insert Timeout timer\n"));
747 goto err_timer;
748 }
749#endif
750
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700751 return TX_SUCCESS;
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700752
753 err_timer:
Viral Modid86bde22012-12-10 13:09:21 -0800754 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800755 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
756#ifdef WLAN_FEATURE_P2P
757 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
758#endif
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700759 #ifdef FEATURE_WLAN_CCX
760 tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
761 #endif
762 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
763 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
764 while(((tANI_S32)--i) >= 0)
765 {
766 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[i]);
767 }
768 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
769 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
770 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
771 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
772 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
773 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
774 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
775 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
776 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
777 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800778 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700779 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
780 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
781 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
782 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
783 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
784 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
Venkata Prathyusha Kuntupalli7a87ff02013-01-29 10:45:54 -0800785#ifdef WLAN_FEATURE_P2P
786 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
787#endif
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700788
789 if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
790 palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
791
792 return TX_TIMER_ERROR;
793
Jeff Johnson295189b2012-06-20 16:38:30 -0700794} /****** end limCreateTimers() ******/
795
796
797
798/**
799 * limTimerHandler()
800 *
801 *FUNCTION:
802 * This function is called upon
803 * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
804 * 2. JOIN_FAILURE timer expiration while joining a BSS
805 * 3. AUTH_FAILURE timer expiration while authenticating with a peer
806 * 4. Heartbeat timer expiration on STA
807 * 5. Background scan timer expiration on STA
808 * 6. AID release, Pre-auth cleanup and Link monitoring timer
809 * expiration on AP
810 *
811 *LOGIC:
812 *
813 *ASSUMPTIONS:
814 * NA
815 *
816 *NOTE:
817 * NA
818 *
819 * @param param - Message corresponding to the timer that expired
820 *
821 * @return None
822 */
823
824void
825limTimerHandler(void *pMacGlobal, tANI_U32 param)
826{
827 tANI_U32 statusCode;
828 tSirMsgQ msg;
829 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
830
831 // Prepare and post message to LIM Message Queue
832
833 msg.type = (tANI_U16) param;
834 msg.bodyptr = NULL;
835 msg.bodyval = 0;
836
837 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
838 limLog(pMac, LOGE,
839 FL("posting message %X to LIM failed, reason=%d\n"),
840 msg.type, statusCode);
841} /****** end limTimerHandler() ******/
842
843
844/**
845 * limAddtsResponseTimerHandler()
846 *
847 *FUNCTION:
848 * This function is called upon Addts response timer expiration on sta
849 *
850 *LOGIC:
851 * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
852 * when this function is executed.
853 *
854 *ASSUMPTIONS:
855 * NA
856 *
857 *NOTE:
858 * NA
859 *
860 * @param param - pointer to pre-auth node
861 *
862 * @return None
863 */
864
865void
866limAddtsResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
867{
868 tSirMsgQ msg;
869 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
870
871 // Prepare and post message to LIM Message Queue
872
873 msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
874 msg.bodyval = param;
875 msg.bodyptr = NULL;
876
877 limPostMsgApi(pMac, &msg);
878} /****** end limAuthResponseTimerHandler() ******/
879
880
881/**
882 * limAuthResponseTimerHandler()
883 *
884 *FUNCTION:
885 * This function is called upon Auth response timer expiration on AP
886 *
887 *LOGIC:
888 * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
889 * when this function is executed.
890 *
891 *ASSUMPTIONS:
892 * NA
893 *
894 *NOTE:
895 * NA
896 *
897 * @param param - pointer to pre-auth node
898 *
899 * @return None
900 */
901
902void
903limAuthResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
904{
905 tSirMsgQ msg;
906 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
907
908 // Prepare and post message to LIM Message Queue
909
910 msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
911 msg.bodyptr = NULL;
912 msg.bodyval = (tANI_U32)param;
913
914 limPostMsgApi(pMac, &msg);
915} /****** end limAuthResponseTimerHandler() ******/
916
917
918
919/**
920 * limAssocFailureTimerHandler()
921 *
922 *FUNCTION:
923 * This function is called upon Re/Assoc failure timer expiration
924 * on STA
925 *
926 *LOGIC:
927 * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ
928 * when this function is executed.
929 *
930 *ASSUMPTIONS:
931 * NA
932 *
933 *NOTE:
934 * NA
935 *
936 * @param param - Indicates whether this is assoc or reassoc
937 * failure timeout
938 * @return None
939 */
940
941void
942limAssocFailureTimerHandler(void *pMacGlobal, tANI_U32 param)
943{
944 tSirMsgQ msg;
945 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
946
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700947#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
948 if((LIM_REASSOC == param) &&
949 (NULL != pMac->lim.pSessionEntry))
950 {
951 limLog(pMac, LOGE, FL("Reassoc timeout happened\n"));
952 if(pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT)
953 {
954 limSendRetryReassocReqFrame(pMac, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, pMac->lim.pSessionEntry);
955 pMac->lim.reAssocRetryAttempt++;
956 limLog(pMac, LOGW, FL("Reassoc request retry is sent %d times\n"), pMac->lim.reAssocRetryAttempt);
957 return;
958 }
959 else
960 {
961 limLog(pMac, LOGW, FL("Reassoc request retry MAX(%d) reached\n"), LIM_MAX_REASSOC_RETRY_LIMIT);
962 if(NULL != pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
963 {
964 palFreeMemory( pMac->hHdd, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq);
965 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = NULL;
966 }
967 }
968 }
969#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700970 // Prepare and post message to LIM Message Queue
971
972 msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
973 msg.bodyval = (tANI_U32)param;
974 msg.bodyptr = NULL;
975
976 limPostMsgApi(pMac, &msg);
977} /****** end limAssocFailureTimerHandler() ******/
978
979
980/**
981 * limUpdateOlbcCacheTimerHandler()
982 *
983 *FUNCTION:
984 * This function is called upon update olbc cache timer expiration
985 * on STA
986 *
987 *LOGIC:
988 * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
989 * when this function is executed.
990 *
991 *ASSUMPTIONS:
992 * NA
993 *
994 *NOTE:
995 * NA
996 *
997 * @param
998 *
999 * @return None
1000 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001001void
1002limUpdateOlbcCacheTimerHandler(void *pMacGlobal, tANI_U32 param)
1003{
1004 tSirMsgQ msg;
1005 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
1006
1007 // Prepare and post message to LIM Message Queue
1008
1009 msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
1010 msg.bodyval = 0;
1011 msg.bodyptr = NULL;
1012
1013 limPostMsgApi(pMac, &msg);
1014} /****** end limUpdateOlbcCacheTimerHandler() ******/
Jeff Johnson295189b2012-06-20 16:38:30 -07001015
1016/**
1017 * limDeactivateAndChangeTimer()
1018 *
1019 *FUNCTION:
1020 * This function is called to deactivate and change a timer
1021 * for future re-activation
1022 *
1023 *LOGIC:
1024 *
1025 *ASSUMPTIONS:
1026 * NA
1027 *
1028 *NOTE:
1029 * NA
1030 *
1031 * @param pMac - Pointer to Global MAC structure
1032 * @param timerId - enum of timer to be deactivated and changed
1033 * This enum is defined in limUtils.h file
1034 *
1035 * @return None
1036 */
1037
1038void
1039limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1040{
1041 tANI_U32 val=0, val1=0;
1042
Jeff Johnsone7245742012-09-05 17:12:55 -07001043 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001044
1045 switch (timerId)
1046 {
1047 case eLIM_ADDTS_RSP_TIMER:
1048 pMac->lim.gLimAddtsRspTimerCount++;
1049 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
1050 {
1051 // Could not deactivate AddtsRsp Timer
1052 // Log error
1053 limLog(pMac, LOGP,
1054 FL("Unable to deactivate AddtsRsp timer\n"));
1055 }
1056 break;
1057
1058 case eLIM_MIN_CHANNEL_TIMER:
1059 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer)
1060 != TX_SUCCESS)
1061 {
1062 // Could not deactivate min channel timer.
1063 // Log error
1064 limLog(pMac, LOGP,
1065 FL("Unable to deactivate min channel timer\n"));
1066 }
1067
Jeff Johnsone7245742012-09-05 17:12:55 -07001068#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 // If a background was triggered via Quiet BSS,
1070 // then we need to adjust the MIN and MAX channel
1071 // timer's accordingly to the Quiet duration that
1072 // was specified
1073 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1074 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1075 {
1076 // gLimQuietDuration is already cached in units of
1077 // system ticks. No conversion is reqd...
1078 val = pMac->lim.gLimSpecMgmt.quietDuration;
1079 }
1080 else
1081 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001082#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 if(pMac->lim.gpLimMlmScanReq)
1084 {
1085 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001086 if (pMac->btc.btcScanCompromise)
1087 {
1088 if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)
1089 {
1090 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTimeBtc);
1091 limLog(pMac, LOG1, FL("Using BTC Min Active Scan time"));
1092 }
1093 else
1094 {
1095 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1096 }
1097 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001098 }
1099 else
1100 {
1101 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1102 //No need to change min timer. This is not a scan
1103 break;
1104 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001105#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001107#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001108
1109 if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
1110 val, 0) != TX_SUCCESS)
1111 {
1112 // Could not change min channel timer.
1113 // Log error
1114 limLog(pMac, LOGP, FL("Unable to change min channel timer\n"));
1115 }
1116
1117 break;
1118
1119 case eLIM_PERIODIC_PROBE_REQ_TIMER:
1120 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
1121 != TX_SUCCESS)
1122 {
1123 // Could not deactivate min channel timer.
1124 // Log error
1125 limLog(pMac, LOGP,
1126 FL("Unable to deactivate periodic timer\n"));
1127 }
1128
1129 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001130 if (pMac->btc.btcScanCompromise)
1131 {
1132 if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)
1133 {
1134 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)/2;
1135 }
1136 else
1137 {
1138 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1139 }
1140 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001141 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
1142 val, 0) != TX_SUCCESS)
1143 {
1144 // Could not change min channel timer.
1145 // Log error
1146 limLog(pMac, LOGP, FL("Unable to change periodic timer\n"));
1147 }
1148
1149 break;
1150
1151 case eLIM_MAX_CHANNEL_TIMER:
1152 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
1153 != TX_SUCCESS)
1154 {
1155 // Could not deactivate max channel timer.
1156 // Log error
1157 limLog(pMac, LOGP,
1158 FL("Unable to deactivate max channel timer\n"));
1159 }
1160
1161#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1162 // If a background was triggered via Quiet BSS,
1163 // then we need to adjust the MIN and MAX channel
1164 // timer's accordingly to the Quiet duration that
1165 // was specified
1166 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
1167 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001168#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001169
1170 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1171 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1172 {
1173 // gLimQuietDuration is already cached in units of
1174 // system ticks. No conversion is reqd...
1175 val = pMac->lim.gLimSpecMgmt.quietDuration;
1176 }
1177 else
1178 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001179#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 if(pMac->lim.gpLimMlmScanReq)
1181 {
1182 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001183 if (pMac->btc.btcScanCompromise)
1184 {
1185 if (pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc)
1186 {
1187 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc);
1188 limLog(pMac, LOG1, FL("Using BTC Max Active Scan time"));
1189 }
1190 else
1191 {
1192 limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set"));
1193 }
1194 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 }
1196 else
1197 {
1198 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1199 //No need to change max timer. This is not a scan
1200 break;
1201 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001202#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001204#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001205 }
1206#endif
1207#if defined(ANI_PRODUCT_TYPE_AP)
1208 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1209 {
1210 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
1211 &val) != eSIR_SUCCESS)
1212 {
1213 /**
1214 * Could not get max channel value
1215 * from CFG. Log error.
1216 */
1217 limLog(pMac, LOGP,
1218 FL("could not retrieve max channel value\n"));
1219 }
1220 val = SYS_MS_TO_TICKS(val);
1221 }
1222#endif
1223
1224 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
1225 val, 0) != TX_SUCCESS)
1226 {
1227 // Could not change max channel timer.
1228 // Log error
1229 limLog(pMac, LOGP,
1230 FL("Unable to change max channel timer\n"));
1231 }
1232
1233 break;
1234
1235 case eLIM_JOIN_FAIL_TIMER:
1236 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
1237 != TX_SUCCESS)
1238 {
1239 /**
1240 * Could not deactivate Join Failure
1241 * timer. Log error.
1242 */
1243 limLog(pMac, LOGP,
1244 FL("Unable to deactivate Join Failure timer\n"));
1245 }
1246
1247 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1248 &val) != eSIR_SUCCESS)
1249 {
1250 /**
1251 * Could not get JoinFailureTimeout value
1252 * from CFG. Log error.
1253 */
1254 limLog(pMac, LOGP,
1255 FL("could not retrieve JoinFailureTimeout value\n"));
1256 }
1257 val = SYS_MS_TO_TICKS(val);
1258
1259 if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
1260 val, 0) != TX_SUCCESS)
1261 {
1262 /**
1263 * Could not change Join Failure
1264 * timer. Log error.
1265 */
1266 limLog(pMac, LOGP,
1267 FL("Unable to change Join Failure timer\n"));
1268 }
1269
1270 break;
1271
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001272 case eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER:
1273 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer)
1274 != TX_SUCCESS)
1275 {
1276 // Could not deactivate periodic join req Times.
1277 limLog(pMac, LOGP,
1278 FL("Unable to deactivate periodic join request timer\n"));
1279 }
1280
1281 val = SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS);
1282 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
1283 val, 0) != TX_SUCCESS)
1284 {
1285 // Could not change periodic join req times.
1286 // Log error
1287 limLog(pMac, LOGP, FL("Unable to change periodic join request timer\n"));
1288 }
1289
1290 break;
1291
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 case eLIM_AUTH_FAIL_TIMER:
1293 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
1294 != TX_SUCCESS)
1295 {
1296 // Could not deactivate Auth failure timer.
1297 // Log error
1298 limLog(pMac, LOGP,
1299 FL("Unable to deactivate auth failure timer\n"));
1300 }
1301
1302 // Change timer to reactivate it in future
1303 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
1304 &val) != eSIR_SUCCESS)
1305 {
1306 /**
1307 * Could not get AuthFailureTimeout value
1308 * from CFG. Log error.
1309 */
1310 limLog(pMac, LOGP,
1311 FL("could not retrieve AuthFailureTimeout value\n"));
1312 }
1313 val = SYS_MS_TO_TICKS(val);
1314
1315 if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
1316 val, 0) != TX_SUCCESS)
1317 {
1318 // Could not change Authentication failure timer.
1319 // Log error
1320 limLog(pMac, LOGP,
1321 FL("unable to change Auth failure timer\n"));
1322 }
1323
1324 break;
1325
1326 case eLIM_ASSOC_FAIL_TIMER:
1327 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
1328 TX_SUCCESS)
1329 {
1330 // Could not deactivate Association failure timer.
1331 // Log error
1332 limLog(pMac, LOGP,
1333 FL("unable to deactivate Association failure timer\n"));
1334 }
1335
1336 // Change timer to reactivate it in future
1337 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
1338 &val) != eSIR_SUCCESS)
1339 {
1340 /**
1341 * Could not get AssocFailureTimeout value
1342 * from CFG. Log error.
1343 */
1344 limLog(pMac, LOGP,
1345 FL("could not retrieve AssocFailureTimeout value\n"));
1346 }
1347 val = SYS_MS_TO_TICKS(val);
1348
1349 if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
1350 val, 0) != TX_SUCCESS)
1351 {
1352 // Could not change Association failure timer.
1353 // Log error
1354 limLog(pMac, LOGP,
1355 FL("unable to change Assoc failure timer\n"));
1356 }
1357
1358 break;
1359
1360 case eLIM_REASSOC_FAIL_TIMER:
1361 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
1362 TX_SUCCESS)
1363 {
1364 // Could not deactivate Reassociation failure timer.
1365 // Log error
1366 limLog(pMac, LOGP,
1367 FL("unable to deactivate Reassoc failure timer\n"));
1368 }
1369
1370 // Change timer to reactivate it in future
1371 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1372 &val) != eSIR_SUCCESS)
1373 {
1374 /**
1375 * Could not get ReassocFailureTimeout value
1376 * from CFG. Log error.
1377 */
1378 limLog(pMac, LOGP,
1379 FL("could not retrieve ReassocFailureTimeout value\n"));
1380 }
1381 val = SYS_MS_TO_TICKS(val);
1382
1383 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
1384 val, 0) != TX_SUCCESS)
1385 {
1386 // Could not change Reassociation failure timer.
1387 // Log error
1388 limLog(pMac, LOGP,
1389 FL("unable to change Reassociation failure timer\n"));
1390 }
1391
1392 break;
1393
1394 case eLIM_HEART_BEAT_TIMER:
1395 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
1396 TX_SUCCESS)
1397 {
1398 // Could not deactivate Heartbeat timer.
1399 // Log error
1400 limLog(pMac, LOGP,
1401 FL("unable to deactivate Heartbeat timer\n"));
1402 }
1403
1404 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
1405 &val) != eSIR_SUCCESS)
1406 {
1407 /**
1408 * Could not get BEACON_INTERVAL value
1409 * from CFG. Log error.
1410 */
1411 limLog(pMac, LOGP,
1412 FL("could not retrieve BEACON_INTERVAL value\n"));
1413 }
1414
1415 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
1416 eSIR_SUCCESS)
1417 limLog(pMac, LOGP,
1418 FL("could not retrieve heartbeat failure value\n"));
1419
1420 // Change timer to reactivate it in future
1421 val = SYS_MS_TO_TICKS(val * val1);
1422
1423 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
1424 val, 0) != TX_SUCCESS)
1425 {
1426 // Could not change HeartBeat timer.
1427 // Log error
1428 limLog(pMac, LOGP,
1429 FL("unable to change HeartBeat timer\n"));
1430 }
1431
1432 break;
1433
1434 case eLIM_PROBE_AFTER_HB_TIMER:
1435 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
1436 TX_SUCCESS)
1437 {
1438 // Could not deactivate Heartbeat timer.
1439 // Log error
1440 limLog(pMac, LOGP,
1441 FL("unable to deactivate probeAfterHBTimer\n"));
1442 }
1443
1444 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
1445 &val) != eSIR_SUCCESS)
1446 {
1447 /**
1448 * Could not get PROBE_AFTER_HB_FAILURE
1449 * value from CFG. Log error.
1450 */
1451 limLog(pMac, LOGP,
1452 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
1453 }
1454
1455 // Change timer to reactivate it in future
1456 val = SYS_MS_TO_TICKS(val);
1457
1458 if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
1459 val, 0) != TX_SUCCESS)
1460 {
1461 // Could not change HeartBeat timer.
1462 // Log error
1463 limLog(pMac, LOGP,
1464 FL("unable to change ProbeAfterHBTimer\n"));
1465 }
1466
1467 break;
1468
1469 case eLIM_KEEPALIVE_TIMER:
1470 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
1471 != TX_SUCCESS)
1472 {
1473 // Could not deactivate Keepalive timer.
1474 // Log error
1475 limLog(pMac, LOGP,
1476 FL("unable to deactivate KeepaliveTimer timer\n"));
1477 }
1478
1479 // Change timer to reactivate it in future
1480
1481 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
1482 &val) != eSIR_SUCCESS)
1483 {
1484 /**
1485 * Could not get keepalive timeout value
1486 * from CFG. Log error.
1487 */
1488 limLog(pMac, LOGP,
1489 FL("could not retrieve keepalive timeout value\n"));
1490 }
1491 if (val == 0)
1492 {
1493 val = 3000;
1494 pMac->sch.keepAlive = 0;
1495 } else
1496 pMac->sch.keepAlive = 1;
1497
1498
1499
1500 val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
1501
1502 if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
1503 val, val) != TX_SUCCESS)
1504 {
1505 // Could not change KeepaliveTimer timer.
1506 // Log error
1507 limLog(pMac, LOGP,
1508 FL("unable to change KeepaliveTimer timer\n"));
1509 }
1510
1511 break;
1512
1513#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1514 case eLIM_BACKGROUND_SCAN_TIMER:
1515 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
1516 != TX_SUCCESS)
1517 {
1518 // Could not deactivate BackgroundScanTimer timer.
1519 // Log error
1520 limLog(pMac, LOGP,
1521 FL("unable to deactivate BackgroundScanTimer timer\n"));
1522 }
1523
1524 // Change timer to reactivate it in future
1525 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
1526 &val) != eSIR_SUCCESS)
1527 {
1528 /**
1529 * Could not get Background scan period value
1530 * from CFG. Log error.
1531 */
1532 limLog(pMac, LOGP,
1533 FL("could not retrieve Background scan period value\n"));
1534 }
1535 if (val == 0)
1536 {
1537 val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
1538 pMac->lim.gLimBackgroundScanDisable = true;
1539 }
1540 else
1541 pMac->lim.gLimBackgroundScanDisable = false;
1542
1543 val = SYS_MS_TO_TICKS(val);
1544
1545 if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
1546 val, val) != TX_SUCCESS)
1547 {
1548 // Could not change BackgroundScanTimer timer.
1549 // Log error
1550 limLog(pMac, LOGP,
1551 FL("unable to change BackgroundScanTimer timer\n"));
1552 }
1553
1554 break;
1555#endif
1556
1557#ifdef ANI_PRODUCT_TYPE_AP
1558 case eLIM_PRE_AUTH_CLEANUP_TIMER:
1559 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer) !=
1560 TX_SUCCESS)
1561 {
1562 // Could not deactivate Pre-auth cleanup timer.
1563 // Log error
1564 limLog(pMac, LOGP,
1565 FL("unable to deactivate Pre-auth cleanup timer\n"));
1566 }
1567
1568 // Change timer to reactivate it in future
1569 if (wlan_cfgGetInt(pMac, WNI_CFG_PREAUTH_CLNUP_TIMEOUT,
1570 &val) != eSIR_SUCCESS)
1571 {
1572 /**
1573 * Could not get pre-auth cleanup value
1574 * from CFG. Log error.
1575 */
1576 limLog(pMac, LOGP,
1577 FL("could not retrieve pre-auth cleanup value\n"));
1578 }
1579 val = SYS_MS_TO_TICKS(val);
1580
1581 if (tx_timer_change(&pMac->lim.limTimers.gLimPreAuthClnupTimer,
1582 val, val) != TX_SUCCESS)
1583 {
1584 // Could not change pre-auth cleanup timer.
1585 // Log error
1586 limLog(pMac, LOGP,
1587 FL("unable to change pre-auth cleanup timer\n"));
1588 }
1589
1590 break;
1591
1592 case eLIM_LEARN_INTERVAL_TIMER:
1593 {
1594 // Restart Learn Interval timer
1595 tANI_U32 learnInterval =
1596 pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
1597 pMac->lim.gpLimMeasReq->channelList.numChannels;
1598
1599 if (tx_timer_deactivate(
1600 &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
1601 {
1602 // Could not deactivate Learn Interval timer.
1603 // Log error
1604 limLog(pMac, LOGP,
1605 FL("Unable to deactivate Learn Interval timer\n"));
1606 }
1607
1608 if (tx_timer_change(
1609 &pMac->lim.gLimMeasParams.learnIntervalTimer,
1610 SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
1611 {
1612 // Could not change Learn Interval timer.
1613 // Log error
1614 limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
1615
1616 return;
1617 }
1618
1619 limLog( pMac, LOG3,
1620 FL("Setting the Learn Interval TIMER to %d ticks\n"),
1621 SYS_MS_TO_TICKS(learnInterval));
1622 }
1623 break;
1624
1625#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001626#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001627 case eLIM_CHANNEL_SWITCH_TIMER:
1628 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
1629 {
1630 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
1631 return;
1632 }
1633
1634 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
1635 pMac->lim.gLimChannelSwitch.switchTimeoutValue,
1636 0) != TX_SUCCESS)
1637 {
1638 limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
1639 return;
1640 }
1641 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001642#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001643
1644 case eLIM_LEARN_DURATION_TIMER:
1645#ifdef ANI_PRODUCT_TYPE_AP
1646 if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
1647 {
1648 limLog(pMac, LOGP, FL("Could not deactivate learn duration timer\n"));
1649 return;
1650 }
1651
1652 if (pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity &&
1653 (pMac->lim.gLimMeasParams.shortDurationCount ==
1654 pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity))
1655 {
1656#ifdef ANI_AP_SDK
1657 val = pMac->lim.gLimScanDurationConvert.longChannelScanDuration_tick;
1658#else
1659 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration
1660 + SYS_TICK_DUR_MS - 1);
1661 if(val > 1)
1662 val--;
1663#endif /* ANI_AP_SDK */
1664 // Time to perform measurements for longer term
1665 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1666 val, 0) != TX_SUCCESS)
1667 {
1668 // Could not change Learn duration timer.
1669 // Log error
1670 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1671 return;
1672 }
1673 pMac->lim.gLimMeasParams.shortDurationCount = 0;
1674 }
1675 else
1676 {
1677#ifdef ANI_AP_SDK
1678 val = pMac->lim.gLimScanDurationConvert.shortChannelScanDuration_tick;
1679#else
1680 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration
1681 + SYS_TICK_DUR_MS - 1);
1682 if(val > 1)
1683 val--;
1684#endif /* ANI_AP_SDK */
1685 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1686 val, 0) != TX_SUCCESS)
1687 {
1688 // Could not change Learn duration timer.
1689 // Log error
1690 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1691 }
1692 }
1693 pMac->lim.gpLimMeasData->duration = val * SYS_TICK_DUR_MS;
1694#endif
1695 break;
1696
Jeff Johnsone7245742012-09-05 17:12:55 -07001697#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 case eLIM_QUIET_BSS_TIMER:
1699 if (TX_SUCCESS !=
1700 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
1701 {
1702 limLog( pMac, LOGE,
1703 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway...\n"));
1704 }
1705
1706 // gLimQuietDuration appears to be in units of ticks
1707 // Use it as is
1708 if (TX_SUCCESS !=
1709 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
1710 pMac->lim.gLimSpecMgmt.quietDuration,
1711 0))
1712 {
1713 limLog( pMac, LOGE,
1714 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway...\n"));
1715 }
1716 break;
1717
1718 case eLIM_QUIET_TIMER:
1719 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
1720 {
1721 limLog( pMac, LOGE,
1722 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1723 }
1724
1725 // Set the NEW timeout value, in ticks
1726 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
1727 SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
1728 {
1729 limLog( pMac, LOGE,
1730 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1731 }
1732 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001733#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001734
Jeff Johnson295189b2012-06-20 16:38:30 -07001735#if 0
1736 case eLIM_WPS_OVERLAP_TIMER:
1737 {
1738 // Restart Learn Interval timer
1739
1740 tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
1741
1742 if (tx_timer_deactivate(
1743 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1744 {
1745 // Could not deactivate Learn Interval timer.
1746 // Log error
1747 limLog(pMac, LOGP,
1748 FL("Unable to deactivate WPS overlap timer\n"));
1749 }
1750
1751 if (tx_timer_change(
1752 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1753 WPSOverlapTimer, 0) != TX_SUCCESS)
1754 {
1755 // Could not change Learn Interval timer.
1756 // Log error
1757 limLog(pMac, LOGP, FL("Unable to change WPS overlap timer\n"));
1758
1759 return;
1760 }
1761
1762 limLog( pMac, LOGE,
1763 FL("Setting WPS overlap TIMER to %d ticks\n"),
1764 WPSOverlapTimer);
1765 }
1766 break;
1767#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001768
1769#ifdef WLAN_FEATURE_VOWIFI_11R
1770 case eLIM_FT_PREAUTH_RSP_TIMER:
1771 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != TX_SUCCESS)
1772 {
1773 /**
1774 ** Could not deactivate Join Failure
1775 ** timer. Log error.
1776 **/
1777 limLog(pMac, LOGP, FL("Unable to deactivate Preauth response Failure timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001778 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001779 }
1780 val = 1000;
1781 val = SYS_MS_TO_TICKS(val);
1782 if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
1783 val, 0) != TX_SUCCESS)
1784 {
1785 /**
1786 * Could not change Join Failure
1787 * timer. Log error.
1788 */
1789 limLog(pMac, LOGP, FL("Unable to change Join Failure timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001790 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001791 }
1792 break;
1793#endif
1794#ifdef FEATURE_WLAN_CCX
1795 case eLIM_TSM_TIMER:
1796 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer)
1797 != TX_SUCCESS)
1798 {
1799 limLog(pMac, LOGE, FL("Unable to deactivate TSM timer\n"));
1800 }
1801 break;
1802#endif
1803#ifdef WLAN_FEATURE_P2P
1804 case eLIM_REMAIN_CHN_TIMER:
1805 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer) != TX_SUCCESS)
1806 {
1807 /**
1808 ** Could not deactivate Join Failure
1809 ** timer. Log error.
1810 **/
1811 limLog(pMac, LOGP, FL("Unable to deactivate Remain on Chn timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001812 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 }
1814 val = 1000;
1815 val = SYS_MS_TO_TICKS(val);
1816 if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
1817 val, 0) != TX_SUCCESS)
1818 {
1819 /**
1820 * Could not change Join Failure
1821 * timer. Log error.
1822 */
1823 limLog(pMac, LOGP, FL("Unable to change timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001824 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001825 }
1826 break;
1827#endif
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001828 case eLIM_DISASSOC_ACK_TIMER:
1829 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer) != TX_SUCCESS)
1830 {
1831 /**
1832 ** Could not deactivate Join Failure
1833 ** timer. Log error.
1834 **/
1835 limLog(pMac, LOGP, FL("Unable to deactivate Disassoc ack timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001836 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001837 }
1838 val = 1000;
1839 val = SYS_MS_TO_TICKS(val);
1840 if (tx_timer_change(&pMac->lim.limTimers.gLimDisassocAckTimer,
1841 val, 0) != TX_SUCCESS)
1842 {
1843 /**
1844 * Could not change Join Failure
1845 * timer. Log error.
1846 */
1847 limLog(pMac, LOGP, FL("Unable to change timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001848 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001849 }
1850 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001851
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001852 case eLIM_DEAUTH_ACK_TIMER:
1853 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer) != TX_SUCCESS)
1854 {
1855 /**
1856 ** Could not deactivate Join Failure
1857 ** timer. Log error.
1858 **/
1859 limLog(pMac, LOGP, FL("Unable to deactivate Deauth ack timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001860 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001861 }
1862 val = 1000;
1863 val = SYS_MS_TO_TICKS(val);
1864 if (tx_timer_change(&pMac->lim.limTimers.gLimDeauthAckTimer,
1865 val, 0) != TX_SUCCESS)
1866 {
1867 /**
1868 * Could not change Join Failure
1869 * timer. Log error.
1870 */
1871 limLog(pMac, LOGP, FL("Unable to change timer\n"));
Viral Modid86bde22012-12-10 13:09:21 -08001872 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001873 }
1874 break;
Viral Modid86bde22012-12-10 13:09:21 -08001875
1876#ifdef WLAN_FEATURE_P2P
1877 case eLIM_INSERT_SINGLESHOT_NOA_TIMER:
1878 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer) != TX_SUCCESS)
1879 {
1880 /**
1881 ** Could not deactivate SingleShot NOA Insert
1882 ** timer. Log error.
1883 **/
1884 limLog(pMac, LOGP, FL("Unable to deactivate SingleShot NOA Insert timer\n"));
1885 return;
1886 }
1887 val = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE;
1888 val = SYS_MS_TO_TICKS(val);
1889 if (tx_timer_change(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
1890 val, 0) != TX_SUCCESS)
1891 {
1892 /**
1893 * Could not change Single Shot NOA Insert
1894 * timer. Log error.
1895 */
1896 limLog(pMac, LOGP, FL("Unable to change timer\n"));
1897 return;
1898 }
1899 break;
1900#endif
1901
Jeff Johnson295189b2012-06-20 16:38:30 -07001902 default:
1903 // Invalid timerId. Log error
1904 break;
1905 }
1906} /****** end limDeactivateAndChangeTimer() ******/
1907
1908
1909
1910/**---------------------------------------------------------------
1911\fn limHeartBeatDeactivateAndChangeTimer
1912\brief This function deactivates and changes the heart beat
1913\ timer, eLIM_HEART_BEAT_TIMER.
1914\
1915\param pMac
1916\param psessionEntry
1917\return None
1918------------------------------------------------------------------*/
1919void
1920limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1921{
1922 tANI_U32 val, val1;
1923
Jeff Johnsone7245742012-09-05 17:12:55 -07001924 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Yathish9f22e662012-12-10 14:21:35 -08001925#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1926 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1927 return;
1928#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001929
1930 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
1931 limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer \n"));
1932
1933 /* HB Timer sessionisation: In case of 2 or more sessions, the HB interval keeps
1934 changing. to avoid this problem, HeartBeat interval is made constant, by
1935 fixing beacon interval to 100ms immaterial of the beacon interval of the session */
1936
1937 //val = psessionEntry->beaconParams.beaconInterval;
1938 val = LIM_HB_TIMER_BEACON_INTERVAL;
1939
1940 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
1941 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_HEART_BEAT_THRESHOLD \n"));
1942
1943 PELOGW(limLog(pMac,LOGW,
1944 FL("HB Timer Int.=100ms * %d, Beacon Int.=%dms,Session Id=%d \n"),
1945 val1, psessionEntry->beaconParams.beaconInterval,
1946 psessionEntry->peSessionId);)
1947
1948 // Change timer to reactivate it in future
1949 val = SYS_MS_TO_TICKS(val * val1);
1950
1951 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer, val, 0) != TX_SUCCESS)
1952 limLog(pMac, LOGP, FL("Fail to change HeartBeatTimer\n"));
1953
1954} /****** end limHeartBeatDeactivateAndChangeTimer() ******/
1955
1956
1957/**---------------------------------------------------------------
1958\fn limReactivateHeartBeatTimer
1959\brief This function s called to deactivate, change and
1960\ activate a timer.
1961\
1962\param pMac - Pointer to Global MAC structure
1963\param psessionEntry
1964\return None
1965------------------------------------------------------------------*/
1966void
1967limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1968{
1969 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"), psessionEntry->LimRxedBeaconCntDuringHB);)
1970
Yathish9f22e662012-12-10 14:21:35 -08001971#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1972 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1973 return;
1974#endif
1975
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001977 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001978
1979 //only start the hearbeat-timer if the timeout value is non-zero
1980 if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0) {
1981 if (tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
1982 {
1983 limLog(pMac, LOGP,FL("could not activate Heartbeat timer\n"));
1984 }
1985 limResetHBPktCount(psessionEntry);
1986 }
1987
1988} /****** end limReactivateHeartBeatTimer() ******/
1989
1990#if 0
1991/******
1992 * Note: Use this code once you have converted all
1993 * limReactivateHeartBeatTimer() calls to
1994 * limReactivateTimer() calls.
1995 *
1996 ******/
1997
1998Now, in dev/btamp2,
1999here are all the references to limReactivateHeartBeatTimer().
2000
2001C symbol: limReactivateHeartBeatTimer
2002
2003 File Function Line
20040 limTimerUtils.h <global> 55 void limReactivateHeartBeatTimer(tpAniSirGlobal , tpPESession);
20051 limIbssPeerMgmt.c limIbssHeartBeatHandle 1282 limReactivateHeartBeatTimer(pMac, psessionEntry);
20062 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 395 limReactivateHeartBeatTimer(pMac, psessionEntry);
20073 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 410 limReactivateHeartBeatTimer(pMac, psessionEntry);
20084 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
20095 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2350 limReactivateHeartBeatTimer(pMac, psessionEntry);
20106 limProcessMlmRspMessages_ limProcessStaMlmAddStaRsp 2111 limReactivateHeartBeatTimer(pMac, psessionEntry);
20117 limTimerUtils.c limReactivateHeartBeatTim 1473 limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
20128 limUtils.c limHandleHeartBeatFailure 6743 limReactivateHeartBeatTimer(pMac, psessionEntry);
20139 limUtils.c limHandleHeartBeatFailure 6751 limReactivateHeartBeatTimer(pMac, psessionEntry);
2014
2015Now, in main/latest, on the other hand,
2016here are all the references to limReactivateTimer().
2017
2018C symbol: limReactivateTimer
2019
2020 File Function Line
20210 limTimerUtils.h <global> 54 void limReactivateTimer(tpAniSirGlobal, tANI_U32);
20221 limIbssPeerMgmt.c limIbssHeartBeatHandle 1183 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20232 limIbssPeerMgmt.c limIbssHeartBeatHandle 1246 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20243 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 283 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20254 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 320 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20265 limLinkMonitoringAlgo.c limHandleHeartBeatFailure 335 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20276 limProcessMessageQueue.c limProcessMessages 1210 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20287 limProcessMessageQueue.c limProcessMessages 1218 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20298 limProcessMlmRspMessages. limProcessStaMlmAddStaRsp 1726 limReactivateTimer(pMac, eLIM_HEART_BEAT_TIMER);
20309 limTimerUtils.c limReactivateTimer 1451 limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
2031
2032
2033/**
2034 * limReactivateTimer()
2035 *
2036 *FUNCTION:
2037 * This function is called to deactivate, change and
2038 * activate a timer
2039 *
2040 *LOGIC:
2041 *
2042 *ASSUMPTIONS:
2043 * NA
2044 *
2045 *NOTE:
2046 * NA
2047 *
2048 * @param pMac - Pointer to Global MAC structure
2049 * @param timerId - enum of timer to be deactivated and changed
2050 * This enum is defined in limUtils.h file
2051 *
2052 * @return None
2053 */
2054
2055void
2056limReactivateTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
2057{
2058 if (timerId == eLIM_HEART_BEAT_TIMER)
2059 {
2060 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d\n"),
2061 pMac->lim.gLimRxedBeaconCntDuringHB);)
2062 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
2063 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0, eLIM_HEART_BEAT_TIMER));
2064 if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
2065 {
2066 /// Could not activate Heartbeat timer.
2067 // Log error
2068 limLog(pMac, LOGP,
2069 FL("could not activate Heartbeat timer\n"));
2070 }
2071 limResetHBPktCount(pMac);
2072 }
2073} /****** end limReactivateTimer() ******/
2074#endif
2075
2076
2077/**
2078 * limActivateHearBeatTimer()
2079 *
2080 *
2081 * @brief: This function is called to activate heartbeat timer
2082 *
2083 *LOGIC:
2084 *
2085 *ASSUMPTIONS:
2086 * NA
2087 *
2088 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2089 *
2090 * @param pMac - Pointer to Global MAC structure
2091 *
2092 * @return TX_SUCCESS - timer is activated
2093 * errors - fail to start the timer
2094 */
2095v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac)
2096{
2097 v_UINT_t status = TX_TIMER_ERROR;
2098
Yathish9f22e662012-12-10 14:21:35 -08002099#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2100 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2101 return (status);
2102#endif
2103
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 if(TX_AIRGO_TMR_SIGNATURE == pMac->lim.limTimers.gLimHeartBeatTimer.tmrSignature)
2105 {
2106 //consider 0 interval a ok case
2107 if( pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs )
2108 {
2109 status = tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer);
2110 if( TX_SUCCESS != status )
2111 {
2112 PELOGE(limLog(pMac, LOGE,
2113 FL("could not activate Heartbeat timer status(%d)\n"), status);)
2114 }
2115 }
2116 else
2117 {
2118 status = TX_SUCCESS;
2119 }
2120 }
2121
2122 return (status);
2123}
2124
2125
2126
2127/**
2128 * limDeactivateAndChangePerStaIdTimer()
2129 *
2130 *
2131 * @brief: This function is called to deactivate and change a per STA timer
2132 * for future re-activation
2133 *
2134 *LOGIC:
2135 *
2136 *ASSUMPTIONS:
2137 * NA
2138 *
2139 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2140 *
2141 * @param pMac - Pointer to Global MAC structure
2142 * @param timerId - enum of timer to be deactivated and changed
2143 * This enum is defined in limUtils.h file
2144 * @param staId - staId
2145 *
2146 * @return None
2147 */
2148
2149void
2150limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
2151{
2152 tANI_U32 val;
Jeff Johnsone7245742012-09-05 17:12:55 -07002153 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002154
2155 switch (timerId)
2156 {
2157 case eLIM_CNF_WAIT_TIMER:
2158
2159 if (tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2160 != TX_SUCCESS)
2161 {
2162 limLog(pMac, LOGP,
2163 FL("unable to deactivate CNF wait timer\n"));
2164
2165 }
2166
2167 // Change timer to reactivate it in future
2168
2169 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
2170 &val) != eSIR_SUCCESS)
2171 {
2172 /**
2173 * Could not get cnf timeout value
2174 * from CFG. Log error.
2175 */
2176 limLog(pMac, LOGP,
2177 FL("could not retrieve cnf timeout value\n"));
2178 }
2179 val = SYS_MS_TO_TICKS(val);
2180
2181 if (tx_timer_change(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId],
2182 val, val) != TX_SUCCESS)
2183 {
2184 // Could not change cnf timer.
2185 // Log error
2186 limLog(pMac, LOGP, FL("unable to change cnf wait timer\n"));
2187 }
2188
2189 break;
2190
2191 case eLIM_AUTH_RSP_TIMER:
2192 {
2193 tLimPreAuthNode *pAuthNode;
2194
2195 pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, staId);
2196
2197 if (pAuthNode == NULL)
2198 {
2199 limLog(pMac, LOGP, FL("Invalid Pre Auth Index passed :%d\n"), staId);
2200 break;
2201 }
2202
2203 if (tx_timer_deactivate(&pAuthNode->timer) != TX_SUCCESS)
2204 {
2205 // Could not deactivate auth response timer.
2206 // Log error
2207 limLog(pMac, LOGP, FL("unable to deactivate auth response timer\n"));
2208 }
2209
2210 // Change timer to reactivate it in future
2211
2212 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, &val) != eSIR_SUCCESS)
2213 {
2214 /**
2215 * Could not get auth rsp timeout value
2216 * from CFG. Log error.
2217 */
2218 limLog(pMac, LOGP,
2219 FL("could not retrieve auth response timeout value\n"));
2220 }
2221
2222 val = SYS_MS_TO_TICKS(val);
2223
2224 if (tx_timer_change(&pAuthNode->timer, val, 0) != TX_SUCCESS)
2225 {
2226 // Could not change auth rsp timer.
2227 // Log error
2228 limLog(pMac, LOGP, FL("unable to change auth rsp timer\n"));
2229 }
2230 }
2231 break;
2232
2233#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
2234 case eLIM_LEARN_INTERVAL_TIMER:
2235 {
2236 // Restart Learn Interval timer
2237 tANI_U32 learnInterval =
2238 pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
2239 pMac->lim.gpLimMeasReq->channelList.numChannels;
2240
2241 if (tx_timer_deactivate(
2242 &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
2243 {
2244 // Could not deactivate Learn Interval timer.
2245 // Log error
2246 limLog(pMac, LOGP,
2247 FL("Unable to deactivate Learn Interval timer\n"));
2248 }
2249
2250 if (tx_timer_change(
2251 &pMac->lim.gLimMeasParams.learnIntervalTimer,
2252 SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
2253 {
2254 // Could not change Learn Interval timer.
2255 // Log error
2256 limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
2257
2258 return;
2259 }
2260
2261 limLog( pMac, LOG3,
2262 FL("Setting the Learn Interval TIMER to %d ticks\n"),
2263 SYS_MS_TO_TICKS(learnInterval) );
2264 }
2265 break;
2266#endif //#if (defined(ANI_PRODUCT_TYPE_AP) ||defined(ANI_PRODUCT_TYPE_AP_SDK))
2267
2268 default:
2269 // Invalid timerId. Log error
2270 break;
2271
2272 }
2273}
2274
2275
2276/**
2277 * limActivateCnfTimer()
2278 *
2279 *FUNCTION:
2280 * This function is called to activate a per STA timer
2281 *
2282 *LOGIC:
2283 *
2284 *ASSUMPTIONS:
2285 * NA
2286 *
2287 *NOTE:
2288 * NA
2289 *
2290 * @param pMac - Pointer to Global MAC structure
2291 * @param StaId - staId
2292 *
2293 * @return None
2294 */
2295
2296void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
2297{
Jeff Johnsone7245742012-09-05 17:12:55 -07002298 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_CNF_WAIT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002299 pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
2300 if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2301 != TX_SUCCESS)
2302 {
2303 limLog(pMac, LOGP,
2304 FL("could not activate cnf wait timer\n"));
2305 }
2306}
2307
2308/**
2309 * limActivateAuthRspTimer()
2310 *
2311 *FUNCTION:
2312 * This function is called to activate a per STA timer
2313 *
2314 *LOGIC:
2315 *
2316 *ASSUMPTIONS:
2317 * NA
2318 *
2319 *NOTE:
2320 * NA
2321 *
2322 * @param pMac - Pointer to Global MAC structure
2323 * @param id - id
2324 *
2325 * @return None
2326 */
2327
2328void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
2329{
Jeff Johnsone7245742012-09-05 17:12:55 -07002330 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_AUTH_RESP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
2332 {
2333 /// Could not activate auth rsp timer.
2334 // Log error
2335 limLog(pMac, LOGP,
2336 FL("could not activate auth rsp timer\n"));
2337 }
2338}
2339
2340
2341/**
2342 * limSendDisassocFrameThresholdHandler()
2343 *
2344 *FUNCTION:
2345 * This function reloads the credit to the send disassociate frame bucket
2346 *
2347 *LOGIC:
2348 *
2349 *ASSUMPTIONS:
2350 *
2351 *NOTE:
2352 * NA
2353 *
2354 * @param
2355 *
2356 * @return None
2357 */
2358
2359void
2360limSendDisassocFrameThresholdHandler(void *pMacGlobal, tANI_U32 param)
2361{
2362 tSirMsgQ msg;
2363 tANI_U32 statusCode;
2364 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2365
2366 msg.type = SIR_LIM_HASH_MISS_THRES_TIMEOUT;
2367 msg.bodyval = 0;
2368 msg.bodyptr = NULL;
2369
2370 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2371 limLog(pMac, LOGE,
2372 FL("posting to LIM failed, reason=%d\n"), statusCode);
2373
2374}
2375
2376/**
2377 * limAssocCnfWaitTmerHandler()
2378 *
2379 *FUNCTION:
2380 * This function post a message to send a disassociate frame out.
2381 *
2382 *LOGIC:
2383 *
2384 *ASSUMPTIONS:
2385 *
2386 *NOTE:
2387 * NA
2388 *
2389 * @param
2390 *
2391 * @return None
2392 */
2393
2394void
2395limCnfWaitTmerHandler(void *pMacGlobal, tANI_U32 param)
2396{
2397 tSirMsgQ msg;
2398 tANI_U32 statusCode;
2399 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2400
2401 msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
2402 msg.bodyval = (tANI_U32)param;
2403 msg.bodyptr = NULL;
2404
2405 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2406 limLog(pMac, LOGE,
2407 FL("posting to LIM failed, reason=%d\n"), statusCode);
2408
2409}
2410
2411/**
2412 * limKeepaliveTmerHandler()
2413 *
2414 *FUNCTION:
2415 * This function post a message to send a NULL data frame.
2416 *
2417 *LOGIC:
2418 *
2419 *ASSUMPTIONS:
2420 *
2421 *NOTE:
2422 * NA
2423 *
2424 * @param
2425 *
2426 * @return None
2427 */
2428
2429void
2430limKeepaliveTmerHandler(void *pMacGlobal, tANI_U32 param)
2431{
2432 tSirMsgQ msg;
2433 tANI_U32 statusCode;
2434 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2435
2436 msg.type = SIR_LIM_KEEPALIVE_TIMEOUT;
2437 msg.bodyval = (tANI_U32)param;
2438 msg.bodyptr = NULL;
2439
2440 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2441 limLog(pMac, LOGE,
2442 FL("posting to LIM failed, reason=%d\n"), statusCode);
2443
2444}
2445
2446void
2447limChannelSwitchTimerHandler(void *pMacGlobal, tANI_U32 param)
2448{
2449 tSirMsgQ msg;
2450 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2451
2452 PELOG1(limLog(pMac, LOG1,
2453 FL("ChannelSwitch Timer expired. Posting msg to LIM \n"));)
2454
2455 msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
2456 msg.bodyval = (tANI_U32)param;
2457 msg.bodyptr = NULL;
2458
2459 limPostMsgApi(pMac, &msg);
2460}
2461
2462void
2463limQuietTimerHandler(void *pMacGlobal, tANI_U32 param)
2464{
2465 tSirMsgQ msg;
2466 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2467
2468 msg.type = SIR_LIM_QUIET_TIMEOUT;
2469 msg.bodyval = (tANI_U32)param;
2470 msg.bodyptr = NULL;
2471
2472 PELOG1(limLog(pMac, LOG1,
2473 FL("Post SIR_LIM_QUIET_TIMEOUT msg. \n"));)
2474 limPostMsgApi(pMac, &msg);
2475}
2476
2477void
2478limQuietBssTimerHandler(void *pMacGlobal, tANI_U32 param)
2479{
2480 tSirMsgQ msg;
2481 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2482
2483 msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
2484 msg.bodyval = (tANI_U32)param;
2485 msg.bodyptr = NULL;
2486 PELOG1(limLog(pMac, LOG1,
2487 FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. \n"));)
2488 limPostMsgApi(pMac, &msg);
2489}
Jeff Johnson295189b2012-06-20 16:38:30 -07002490#if 0
2491void
2492limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
2493{
2494 tSirMsgQ msg;
2495 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2496
2497 msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
2498 msg.bodyval = (tANI_U32)param;
2499 msg.bodyptr = NULL;
2500 PELOG1(limLog(pMac, LOG1,
2501 FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. \n"));)
2502 limPostMsgApi(pMac, &msg);
2503}
2504#endif
Yathish9f22e662012-12-10 14:21:35 -08002505
2506#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2507/* ACTIVE_MODE_HB_OFFLOAD */
2508/**
2509 * limMissedBeaconInActiveMode()
2510 *
2511 *FUNCTION:
2512 * This function handle beacon miss indication from FW
2513 * in Active mode.
2514 *
2515 *LOGIC:
2516 *
2517 *ASSUMPTIONS:
2518 * NA
2519 *
2520 *NOTE:
2521 * NA
2522 *
2523 * @param param - Msg Type
2524 *
2525 * @return None
2526 */
2527void
2528limMissedBeaconInActiveMode(void *pMacGlobal)
2529{
2530 tANI_U32 statusCode;
2531 tSirMsgQ msg;
2532 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2533
2534 // Prepare and post message to LIM Message Queue
2535 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2536 {
2537 msg.type = (tANI_U16) SIR_LIM_HEART_BEAT_TIMEOUT;
2538 msg.bodyptr = NULL;
2539 msg.bodyval = 0;
2540 limLog(pMac, LOGE,
2541 FL("Heartbeat failure from Riva\n"));
2542 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2543 limLog(pMac, LOGE,
2544 FL("posting message %X to LIM failed, reason=%d\n"),
2545 msg.type, statusCode);
2546 }
2547}
2548#endif