blob: 837db655e5ca47ab11b2df092273b6702c07b99c [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 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limTimerUtils.cc contains the utility functions
45 * LIM uses for handling various timers.
46 * Author: Chandra Modumudi
47 * Date: 02/13/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 */
52
53#include "limTypes.h"
54#include "limUtils.h"
55#include "limAssocUtils.h"
56#include "limSecurityUtils.h"
57#include "pmmApi.h"
58
59
60// default value 5000 ms for background scan period when it is disabled
61#define LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS 5000
62// channel Switch Timer in ticks
63#define LIM_CHANNEL_SWITCH_TIMER_TICKS 1
64// Lim Quite timer in ticks
65#define LIM_QUIET_TIMER_TICKS 100
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -080066// Lim Quite BSS timer interval in ticks
Jeff Johnson295189b2012-06-20 16:38:30 -070067#define LIM_QUIET_BSS_TIMER_TICK 100
68// Lim KeepAlive timer default (3000)ms
69#define LIM_KEEPALIVE_TIMER_MS 3000
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -080070// Lim JoinProbeRequest Retry timer default (200)ms
71#define LIM_JOIN_PROBE_REQ_TIMER_MS 200
Jeff Johnson295189b2012-06-20 16:38:30 -070072
73//default beacon interval value used in HB timer interval calculation
74#define LIM_HB_TIMER_BEACON_INTERVAL 100
75/**
76 * limCreateTimers()
77 *
78 *FUNCTION:
79 * This function is called upon receiving
80 * 1. SME_START_REQ for STA in ESS role
81 * 2. SME_START_BSS_REQ for AP role & STA in IBSS role
82 *
83 *LOGIC:
84 *
85 *ASSUMPTIONS:
86 * NA
87 *
88 *NOTE:
89 * NA
90 *
91 * @param pMac - Pointer to Global MAC structure
92 *
93 * @return None
94 */
95
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -070096v_UINT_t
Jeff Johnson295189b2012-06-20 16:38:30 -070097limCreateTimers(tpAniSirGlobal pMac)
98{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -070099 tANI_U32 cfgValue, i=0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700100
101 PELOG1(limLog(pMac, LOG1, FL("Creating Timers used by LIM module in Role %d\n"), pMac->lim.gLimSystemRole);)
102
103 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
104 &cfgValue) != eSIR_SUCCESS)
105 {
106 /**
107 * Could not get MinChannelTimeout value
108 * from CFG. Log error.
109 */
110 limLog(pMac, LOGP, FL("could not retrieve MinChannelTimeout value\n"));
111 }
112 cfgValue = SYS_MS_TO_TICKS(cfgValue);
113
114 // Create MIN/MAX channel timers and activate them later
115 if (tx_timer_create(&pMac->lim.limTimers.gLimMinChannelTimer,
116 "MIN CHANNEL TIMEOUT",
117 limTimerHandler, SIR_LIM_MIN_CHANNEL_TIMEOUT,
118 cfgValue, 0,
119 TX_NO_ACTIVATE) != TX_SUCCESS)
120 {
121 /// Could not start min channel timer.
122 // Log error
123 limLog(pMac, LOGP, FL("could not create MIN channel timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700124 return TX_TIMER_ERROR;
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 }
126#if defined(ANI_OS_TYPE_RTAI_LINUX)
127 tx_timer_set_expiry_list(
128 &pMac->lim.limTimers.gLimMinChannelTimer, LIM_TIMER_EXPIRY_LIST);
129#endif
130
131 PELOG2(limLog(pMac, LOG2, FL("Created MinChannelTimer\n"));)
132
133 /* Periodic probe request timer value is half of the Min channel
134 * timer. Probe request sends periodically till min/max channel
135 * timer expires
136 */
137
138 cfgValue = cfgValue/2 ;
139 if( cfgValue >= 1)
140 {
141 // Create periodic probe request timer and activate them later
142 if (tx_timer_create(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
143 "Periodic Probe Request Timer",
144 limTimerHandler, SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT,
145 cfgValue, 0,
146 TX_NO_ACTIVATE) != TX_SUCCESS)
147 {
148 /// Could not start Periodic Probe Req timer.
149 // Log error
150 limLog(pMac, LOGP, FL("could not create periodic probe timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700151 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700152 }
153 }
154
155
156 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
157 &cfgValue) != eSIR_SUCCESS)
158 {
159 /**
160 * Could not get MAXChannelTimeout value
161 * from CFG. Log error.
162 */
163 limLog(pMac, LOGP,
164 FL("could not retrieve MAXChannelTimeout value\n"));
165 }
166 cfgValue = SYS_MS_TO_TICKS(cfgValue);
167
168 if (tx_timer_create(&pMac->lim.limTimers.gLimMaxChannelTimer,
169 "MAX CHANNEL TIMEOUT",
170 limTimerHandler, SIR_LIM_MAX_CHANNEL_TIMEOUT,
171 cfgValue, 0,
172 TX_NO_ACTIVATE) != TX_SUCCESS)
173 {
174 /// Could not start max channel timer.
175 // Log error
176 limLog(pMac, LOGP, FL("could not create MAX channel timer\n"));
177
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700178 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700179 }
180
181#if defined(ANI_OS_TYPE_RTAI_LINUX)
182 tx_timer_set_expiry_list(
183 &pMac->lim.limTimers.gLimMaxChannelTimer, LIM_TIMER_EXPIRY_LIST);
184#endif
185
186 PELOG2(limLog(pMac, LOG2, FL("Created MaxChannelTimer\n"));)
187
188 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
189 {
190 // Create Channel Switch Timer
191 if (tx_timer_create(&pMac->lim.limTimers.gLimChannelSwitchTimer,
192 "CHANNEL SWITCH TIMER",
193 limChannelSwitchTimerHandler,
194 0, // expiration_input
195 LIM_CHANNEL_SWITCH_TIMER_TICKS, // initial_ticks
196 0, // reschedule_ticks
197 TX_NO_ACTIVATE) != TX_SUCCESS)
198 {
199 limLog(pMac, LOGP, FL("failed to create Channel Switch timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700200 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 }
202
203 //
204 // Create Quiet Timer
205 // This is used on the STA to go and shut-off
206 // Tx/Rx "after" the specified quiteInterval
207 //
208 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietTimer,
209 "QUIET TIMER",
210 limQuietTimerHandler,
211 SIR_LIM_QUIET_TIMEOUT, // expiration_input
212 LIM_QUIET_TIMER_TICKS, // initial_ticks
213 0, // reschedule_ticks
214 TX_NO_ACTIVATE) != TX_SUCCESS)
215 {
216 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700217 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700218 }
219
220 //
221 // Create Quiet BSS Timer
222 // After the specified quiteInterval, determined by
223 // gLimQuietTimer, this timer, gLimQuietBssTimer,
224 // trigger and put the STA to sleep for the specified
225 // gLimQuietDuration
226 //
227 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietBssTimer,
228 "QUIET BSS TIMER",
229 limQuietBssTimerHandler,
230 SIR_LIM_QUIET_BSS_TIMEOUT, // expiration_input
231 LIM_QUIET_BSS_TIMER_TICK, // initial_ticks
232 0, // reschedule_ticks
233 TX_NO_ACTIVATE) != TX_SUCCESS)
234 {
235 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700236 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700237 }
238
239 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
240 &cfgValue) != eSIR_SUCCESS)
241 {
242 /**
243 * Could not get JoinFailureTimeout value
244 * from CFG. Log error.
245 */
246 limLog(pMac, LOGP,
247 FL("could not retrieve JoinFailureTimeout value\n"));
248 }
249 cfgValue = SYS_MS_TO_TICKS(cfgValue);
250
251 // Create Join failure timer and activate it later
252 if (tx_timer_create(&pMac->lim.limTimers.gLimJoinFailureTimer,
253 "JOIN FAILURE TIMEOUT",
254 limTimerHandler, SIR_LIM_JOIN_FAIL_TIMEOUT,
255 cfgValue, 0,
256 TX_NO_ACTIVATE) != TX_SUCCESS)
257 {
258 /// Could not create Join failure timer.
259 // Log error
260 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
261
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700262 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800264
265 //Send unicast probe req frame every 200 ms
266 if ((tx_timer_create(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
267 "Periodic Join Probe Request Timer",
268 limTimerHandler, SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT,
269 SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS), 0,
270 TX_NO_ACTIVATE)) != TX_SUCCESS)
271 {
272 /// Could not create Periodic Join Probe Request timer.
273 // Log error
274 limLog(pMac, LOGP, FL("could not create Periodic Join Probe Request timer\n"));
275 goto err_timer;
276 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700277#if defined(ANI_OS_TYPE_RTAI_LINUX)
278 tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimJoinFailureTimer,
279 LIM_TIMER_EXPIRY_LIST);
280#endif
281
282 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
283 &cfgValue) != eSIR_SUCCESS)
284 {
285 /**
286 * Could not get AssocFailureTimeout value
287 * from CFG. Log error.
288 */
289 limLog(pMac, LOGP,
290 FL("could not retrieve AssocFailureTimeout value\n"));
291 }
292 cfgValue = SYS_MS_TO_TICKS(cfgValue);
293
294 // Create Association failure timer and activate it later
295 if (tx_timer_create(&pMac->lim.limTimers.gLimAssocFailureTimer,
296 "ASSOC FAILURE TIMEOUT",
297 limAssocFailureTimerHandler, LIM_ASSOC,
298 cfgValue, 0,
299 TX_NO_ACTIVATE) != TX_SUCCESS)
300 {
301 /// Could not create Assoc failure timer.
302 // Log error
303 limLog(pMac, LOGP,
304 FL("could not create Association failure timer\n"));
305
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700306 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 }
308 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
309 &cfgValue) != eSIR_SUCCESS)
310 {
311 /**
312 * Could not get ReassocFailureTimeout value
313 * from CFG. Log error.
314 */
315 limLog(pMac, LOGP,
316 FL("could not retrieve ReassocFailureTimeout value\n"));
317 }
318 cfgValue = SYS_MS_TO_TICKS(cfgValue);
319
320 // Create Association failure timer and activate it later
321 if (tx_timer_create(&pMac->lim.limTimers.gLimReassocFailureTimer,
322 "REASSOC FAILURE TIMEOUT",
323 limAssocFailureTimerHandler, LIM_REASSOC,
324 cfgValue, 0,
325 TX_NO_ACTIVATE) != TX_SUCCESS)
326 {
327 /// Could not create Reassoc failure timer.
328 // Log error
329 limLog(pMac, LOGP,
330 FL("could not create Reassociation failure timer\n"));
331
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700332 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 }
334
335 if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &cfgValue) != eSIR_SUCCESS)
336 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_ADDTS_RSP_TIMEOUT \n"));
337
338 cfgValue = SYS_MS_TO_TICKS(cfgValue);
339
340 // Create Addts response timer and activate it later
341 if (tx_timer_create(&pMac->lim.limTimers.gLimAddtsRspTimer,
342 "ADDTS RSP TIMEOUT",
343 limAddtsResponseTimerHandler,
344 SIR_LIM_ADDTS_RSP_TIMEOUT,
345 cfgValue, 0,
346 TX_NO_ACTIVATE) != TX_SUCCESS)
347 {
348 /// Could not create Auth failure timer.
349 // Log error
350 limLog(pMac, LOGP, FL("could not create Addts response timer\n"));
351
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700352 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 }
354
355 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
356 &cfgValue) != eSIR_SUCCESS)
357 {
358 /**
359 * Could not get AuthFailureTimeout value
360 * from CFG. Log error.
361 */
362 limLog(pMac, LOGP,
363 FL("could not retrieve AuthFailureTimeout value\n"));
364 }
365 cfgValue = SYS_MS_TO_TICKS(cfgValue);
366
367 // Create Auth failure timer and activate it later
368 if (tx_timer_create(&pMac->lim.limTimers.gLimAuthFailureTimer,
369 "AUTH FAILURE TIMEOUT",
370 limTimerHandler,
371 SIR_LIM_AUTH_FAIL_TIMEOUT,
372 cfgValue, 0,
373 TX_NO_ACTIVATE) != TX_SUCCESS)
374 {
375 /// Could not create Auth failure timer.
376 // Log error
377 limLog(pMac, LOGP, FL("could not create Auth failure timer\n"));
378
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700379 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 }
381#if defined(ANI_OS_TYPE_RTAI_LINUX)
382 tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimAuthFailureTimer,
383 LIM_TIMER_EXPIRY_LIST);
384#endif
385 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
386 &cfgValue) != eSIR_SUCCESS)
387 {
388 /**
389 * Could not get BEACON_INTERVAL value
390 * from CFG. Log error.
391 */
392 limLog(pMac, LOGP,
393 FL("could not retrieve BEACON_INTERVAL value\n"));
394 }
395 cfgValue = SYS_MS_TO_TICKS(cfgValue);
396
397 if (tx_timer_create(&pMac->lim.limTimers.gLimHeartBeatTimer,
398 "Heartbeat TIMEOUT",
399 limTimerHandler,
400 SIR_LIM_HEART_BEAT_TIMEOUT,
401 cfgValue,
402 0,
403 TX_NO_ACTIVATE) != TX_SUCCESS)
404 {
405 /// Could not start Heartbeat timer.
406 // Log error
407 limLog(pMac, LOGP,
408 FL("call to create heartbeat timer failed\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700409 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 }
411
412 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
413 &cfgValue) != eSIR_SUCCESS)
414 {
415 /**
416 * Could not get PROBE_AFTER_HB_FAILURE
417 * value from CFG. Log error.
418 */
419 limLog(pMac, LOGP,
420 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
421 }
422
423 // Change timer to reactivate it in future
424 cfgValue = SYS_MS_TO_TICKS(cfgValue);
425
426 if (tx_timer_create(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
427 "Probe after Heartbeat TIMEOUT",
428 limTimerHandler,
429 SIR_LIM_PROBE_HB_FAILURE_TIMEOUT,
430 cfgValue,
431 0,
432 TX_NO_ACTIVATE) != TX_SUCCESS)
433 {
434 // Could not creat wt-probe-after-HeartBeat-failure timer.
435 // Log error
436 limLog(pMac, LOGP,
437 FL("unable to create ProbeAfterHBTimer\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700438 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 }
440
441#if defined(ANI_OS_TYPE_RTAI_LINUX)
442 tx_timer_set_expiry_list(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
443 LIM_TIMER_EXPIRY_LIST);
444#endif
445
446#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
447 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
448 &cfgValue) != eSIR_SUCCESS)
449 {
450 /**
451 * Could not get Background scan period value
452 * from CFG. Log error.
453 */
454 limLog(pMac, LOGP,
455 FL("could not retrieve Background scan period value\n"));
456 }
457
458 /*
459 * setting period to zero means disabling background scans when associated
460 * the way we do this is to set a flag indicating this and keeping
461 * the timer running, since it will be used for PDU leak workarounds
462 * as well as background scanning during SME idle states
463 */
464 if (cfgValue == 0)
465 {
466 cfgValue = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
467 pMac->lim.gLimBackgroundScanDisable = true;
468 }
469 else
470 pMac->lim.gLimBackgroundScanDisable = false;
471
472 cfgValue = SYS_MS_TO_TICKS(cfgValue);
473
474 if (tx_timer_create(&pMac->lim.limTimers.gLimBackgroundScanTimer,
475 "Background scan TIMEOUT",
476 limTimerHandler,
477 SIR_LIM_CHANNEL_SCAN_TIMEOUT,
478 cfgValue,
479 cfgValue,
480 TX_NO_ACTIVATE) != TX_SUCCESS)
481 {
482 /// Could not start background scan timer.
483 // Log error
484 limLog(pMac, LOGP,
485 FL("call to create background scan timer failed\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700486 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 }
488#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800489#ifdef FEATURE_WLAN_TDLS_INTERNAL
490 /*
491 * create TDLS timers..
492 * a) TDLS discovery response timer.
493 */
494
495 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
496 &cfgValue) != eSIR_SUCCESS)
497 {
498 /*
499 * Could not get discovery response Timeout value
500 * from CFG. Log error.
501 */
502 limLog(pMac, LOGP,
503 FL("could not retrieve ReassocFailureTimeout value\n"));
504 }
505 cfgValue = SYS_MS_TO_TICKS(cfgValue);
506
507 /*
508 * create TDLS discovery response wait timer and activate it later
509 */
510 if (tx_timer_create(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer,
511 "TDLS discovery response WAIT",
512 limTimerHandler,
513 SIR_LIM_TDLS_DISCOVERY_RSP_WAIT,
514 cfgValue, 0,
515 TX_NO_ACTIVATE) != TX_SUCCESS)
516 {
517 limLog(pMac, LOGP,
518 FL("could not create TDLS discovery response wait timer\n"));
519 goto err_timer;
520 }
521#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 }
523
524
525 cfgValue = SYS_MS_TO_TICKS(LIM_HASH_MISS_TIMER_MS);
526
527 if (tx_timer_create(
528 &pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer,
529 "Disassoc throttle TIMEOUT",
530 limSendDisassocFrameThresholdHandler,
531 SIR_LIM_HASH_MISS_THRES_TIMEOUT,
532 cfgValue,
533 cfgValue,
534 TX_AUTO_ACTIVATE) != TX_SUCCESS)
535 {
536 /// Could not start Send Disassociate Frame Threshold timer.
537 // Log error
538 limLog(pMac, LOGP,
539 FL("create Disassociate throttle timer failed\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700540 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 }
542#if defined(ANI_OS_TYPE_RTAI_LINUX)
543 tx_timer_set_expiry_list(
544 &pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer,
545 LIM_TIMER_EXPIRY_LIST);
546#endif
547 PELOG1(limLog(pMac, LOG1,
548 FL("Created Disassociate throttle timer \n"));)
549
550 /**
551 * Create keepalive timer and activate it right away for AP role
552 */
553
554 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
555 &cfgValue) != eSIR_SUCCESS)
556 {
557 /**
558 * Could not get keepalive timeout value
559 * from CFG. Log error.
560 */
561 limLog(pMac, LOGP,
562 FL("could not retrieve keepalive timeout value\n"));
563 }
564
565 // A value of zero implies keep alive should be disabled
566 if (cfgValue == 0)
567 {
568 cfgValue = LIM_KEEPALIVE_TIMER_MS;
569 pMac->sch.keepAlive = 0;
570 } else
571 pMac->sch.keepAlive = 1;
572
573
574 cfgValue = SYS_MS_TO_TICKS(cfgValue + SYS_TICK_DUR_MS - 1);
575
576 if (tx_timer_create(&pMac->lim.limTimers.gLimKeepaliveTimer,
577 "KEEPALIVE_TIMEOUT",
578 limKeepaliveTmerHandler,
579 0,
580 cfgValue,
581 cfgValue,
582 (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ?
583 TX_AUTO_ACTIVATE : TX_NO_ACTIVATE)
584 != TX_SUCCESS)
585 {
586 // Cannot create keepalive timer. Log error.
587 limLog(pMac, LOGP, FL("Cannot create keepalive timer.\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700588 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 }
590
591 /**
592 * Create all CNF_WAIT Timers upfront
593 */
594
595 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
596 &cfgValue) != eSIR_SUCCESS)
597 {
598 /**
599 * Could not get CNF_WAIT timeout value
600 * from CFG. Log error.
601 */
602 limLog(pMac, LOGP,
603 FL("could not retrieve CNF timeout value\n"));
604 }
605 cfgValue = SYS_MS_TO_TICKS(cfgValue);
606
607 for (i=0; i<pMac->lim.maxStation; i++)
608 {
609 if (tx_timer_create(&pMac->lim.limTimers.gpLimCnfWaitTimer[i],
610 "CNF_MISS_TIMEOUT",
611 limCnfWaitTmerHandler,
612 (tANI_U32)i,
613 cfgValue,
614 0,
615 TX_NO_ACTIVATE) != TX_SUCCESS)
616 {
617 // Cannot create timer. Log error.
618 limLog(pMac, LOGP, FL("Cannot create CNF wait timer.\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700619 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 }
621 }
622
623 /*
624 ** Alloc and init table for the preAuth timer list
625 **
626 **/
627
628 // get max number of Preauthentication
629 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
630 &cfgValue) != eSIR_SUCCESS)
631 {
632 /*
633 ** Could not get max preauth value
634 ** from CFG. Log error.
635 **/
636 limLog(pMac, LOGP,
637 FL("could not retrieve mac preauth value\n"));
638 }
639#ifdef ANI_AP_SDK_OPT
640 if(cfgValue > SIR_SDK_OPT_MAX_NUM_PRE_AUTH)
641 cfgValue = SIR_SDK_OPT_MAX_NUM_PRE_AUTH;
642#endif // ANI_AP_SDK_OPT
643 pMac->lim.gLimPreAuthTimerTable.numEntry = cfgValue;
644 if (palAllocateMemory(pMac->hHdd, (void **) &pMac->lim.gLimPreAuthTimerTable.pTable,
645 cfgValue*sizeof(tLimPreAuthNode)) != eHAL_STATUS_SUCCESS)
646 {
647 limLog(pMac, LOGP, FL("palAllocateMemory failed!\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700648 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 }
650
651 limInitPreAuthTimerTable(pMac, &pMac->lim.gLimPreAuthTimerTable);
652 PELOG1(limLog(pMac, LOG1, FL("alloc and init table for preAuth timers\n"));)
653
654
655#ifdef WLAN_SOFTAP_FEATURE
656 {
657 /**
658 * Create OLBC cache aging timer
659 */
660 if (wlan_cfgGetInt(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT,
661 &cfgValue) != eSIR_SUCCESS)
662 {
663 /**
664 * Could not get OLBC detect timeout value
665 * from CFG. Log error.
666 */
667 limLog(pMac, LOGP,
668 FL("could not retrieve OLBD detect timeout value\n"));
669 }
670
671 cfgValue = SYS_MS_TO_TICKS(cfgValue);
672
673 if (tx_timer_create(
674 &pMac->lim.limTimers.gLimUpdateOlbcCacheTimer,
675 "OLBC UPDATE CACHE TIMEOUT",
676 limUpdateOlbcCacheTimerHandler,
677 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
678 cfgValue,
679 cfgValue,
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -0700680 TX_NO_ACTIVATE) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 {
682 // Cannot create update OLBC cache timer
683 // Log error
684 limLog(pMac, LOGP, FL("Cannot create update OLBC cache timer\n"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700685 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 }
687 }
688#endif
689#ifdef WLAN_FEATURE_VOWIFI_11R
690 // In future we need to use the auth timer, cause
691 // the pre auth session will be introduced before sending
692 // Auth frame.
693 // We need to go off channel and come back to home channel
694 cfgValue = 1000;
695 cfgValue = SYS_MS_TO_TICKS(cfgValue);
696
697 if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
698 "FT PREAUTH RSP TIMEOUT",
699 limTimerHandler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT,
700 cfgValue, 0,
701 TX_NO_ACTIVATE) != TX_SUCCESS)
702 {
703 // Could not create Join failure timer.
704 // Log error
705 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700706 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700707 }
708#endif
709
710#ifdef FEATURE_WLAN_CCX
711 cfgValue = 5000;
712 cfgValue = SYS_MS_TO_TICKS(cfgValue);
713
714 if (tx_timer_create(&pMac->lim.limTimers.gLimCcxTsmTimer,
715 "CCX TSM Stats TIMEOUT",
716 limTimerHandler, SIR_LIM_CCX_TSM_TIMEOUT,
717 cfgValue, 0,
718 TX_NO_ACTIVATE) != TX_SUCCESS)
719 {
720 // Could not create Join failure timer.
721 // Log error
722 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700723 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 }
725#endif
726
727#ifdef WLAN_FEATURE_P2P
728 cfgValue = 1000;
729 cfgValue = SYS_MS_TO_TICKS(cfgValue);
730 if (tx_timer_create(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
731 "FT PREAUTH RSP TIMEOUT",
732 limTimerHandler, SIR_LIM_REMAIN_CHN_TIMEOUT,
733 cfgValue, 0,
734 TX_NO_ACTIVATE) != TX_SUCCESS)
735 {
736 // Could not create Join failure timer.
737 // Log error
738 limLog(pMac, LOGP, FL("could not create Join failure timer\n"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700739 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 }
741
742#endif
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800743
744 cfgValue = 1000;
745 cfgValue = SYS_MS_TO_TICKS(cfgValue);
746 if (tx_timer_create(&pMac->lim.limTimers.gLimDisassocAckTimer,
747 "DISASSOC ACK TIMEOUT",
748 limTimerHandler, SIR_LIM_DISASSOC_ACK_TIMEOUT,
749 cfgValue, 0,
750 TX_NO_ACTIVATE) != TX_SUCCESS)
751 {
752 limLog(pMac, LOGP, FL("could not DISASSOC ACK TIMEOUT timer\n"));
753 goto err_timer;
754 }
755
756 cfgValue = 1000;
757 cfgValue = SYS_MS_TO_TICKS(cfgValue);
758 if (tx_timer_create(&pMac->lim.limTimers.gLimDeauthAckTimer,
759 "DISASSOC ACK TIMEOUT",
Viral Modid86bde22012-12-10 13:09:21 -0800760 limTimerHandler, SIR_LIM_DEAUTH_ACK_TIMEOUT,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800761 cfgValue, 0,
762 TX_NO_ACTIVATE) != TX_SUCCESS)
763 {
764 limLog(pMac, LOGP, FL("could not create DEAUTH ACK TIMEOUT timer\n"));
765 goto err_timer;
766 }
Viral Modid86bde22012-12-10 13:09:21 -0800767
768#ifdef WLAN_FEATURE_P2P
769 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)
770 cfgValue = SYS_MS_TO_TICKS(cfgValue);
771 if (tx_timer_create(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
772 "Single Shot NOA Insert timeout",
773 limTimerHandler, SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT,
774 cfgValue, 0,
775 TX_NO_ACTIVATE) != TX_SUCCESS)
776 {
777 limLog(pMac, LOGP, FL("could not create Single Shot NOA Insert Timeout timer\n"));
778 goto err_timer;
779 }
780#endif
781
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700782 return TX_SUCCESS;
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700783
784 err_timer:
Viral Modid86bde22012-12-10 13:09:21 -0800785 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800786 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
787#ifdef WLAN_FEATURE_P2P
788 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
789#endif
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700790 #ifdef FEATURE_WLAN_CCX
791 tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
792 #endif
793 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
794 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
795 while(((tANI_S32)--i) >= 0)
796 {
797 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[i]);
798 }
799 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
800 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
801 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
802 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
803 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
804 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
805 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
806 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
807 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
808 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800809 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700810 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
811 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
812 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
813 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
814 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
815 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
Venkata Prathyusha Kuntupalli7a87ff02013-01-29 10:45:54 -0800816#ifdef WLAN_FEATURE_P2P
817 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
818#endif
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700819
820 if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
821 palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
822
823 return TX_TIMER_ERROR;
824
Jeff Johnson295189b2012-06-20 16:38:30 -0700825} /****** end limCreateTimers() ******/
826
827
828
829/**
830 * limTimerHandler()
831 *
832 *FUNCTION:
833 * This function is called upon
834 * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
835 * 2. JOIN_FAILURE timer expiration while joining a BSS
836 * 3. AUTH_FAILURE timer expiration while authenticating with a peer
837 * 4. Heartbeat timer expiration on STA
838 * 5. Background scan timer expiration on STA
839 * 6. AID release, Pre-auth cleanup and Link monitoring timer
840 * expiration on AP
841 *
842 *LOGIC:
843 *
844 *ASSUMPTIONS:
845 * NA
846 *
847 *NOTE:
848 * NA
849 *
850 * @param param - Message corresponding to the timer that expired
851 *
852 * @return None
853 */
854
855void
856limTimerHandler(void *pMacGlobal, tANI_U32 param)
857{
858 tANI_U32 statusCode;
859 tSirMsgQ msg;
860 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
861
862 // Prepare and post message to LIM Message Queue
863
864 msg.type = (tANI_U16) param;
865 msg.bodyptr = NULL;
866 msg.bodyval = 0;
867
868 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
869 limLog(pMac, LOGE,
870 FL("posting message %X to LIM failed, reason=%d\n"),
871 msg.type, statusCode);
872} /****** end limTimerHandler() ******/
873
874
875/**
876 * limAddtsResponseTimerHandler()
877 *
878 *FUNCTION:
879 * This function is called upon Addts response timer expiration on sta
880 *
881 *LOGIC:
882 * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
883 * when this function is executed.
884 *
885 *ASSUMPTIONS:
886 * NA
887 *
888 *NOTE:
889 * NA
890 *
891 * @param param - pointer to pre-auth node
892 *
893 * @return None
894 */
895
896void
897limAddtsResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
898{
899 tSirMsgQ msg;
900 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
901
902 // Prepare and post message to LIM Message Queue
903
904 msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
905 msg.bodyval = param;
906 msg.bodyptr = NULL;
907
908 limPostMsgApi(pMac, &msg);
909} /****** end limAuthResponseTimerHandler() ******/
910
911
912/**
913 * limAuthResponseTimerHandler()
914 *
915 *FUNCTION:
916 * This function is called upon Auth response timer expiration on AP
917 *
918 *LOGIC:
919 * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
920 * when this function is executed.
921 *
922 *ASSUMPTIONS:
923 * NA
924 *
925 *NOTE:
926 * NA
927 *
928 * @param param - pointer to pre-auth node
929 *
930 * @return None
931 */
932
933void
934limAuthResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
935{
936 tSirMsgQ msg;
937 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
938
939 // Prepare and post message to LIM Message Queue
940
941 msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
942 msg.bodyptr = NULL;
943 msg.bodyval = (tANI_U32)param;
944
945 limPostMsgApi(pMac, &msg);
946} /****** end limAuthResponseTimerHandler() ******/
947
948
949
950/**
951 * limAssocFailureTimerHandler()
952 *
953 *FUNCTION:
954 * This function is called upon Re/Assoc failure timer expiration
955 * on STA
956 *
957 *LOGIC:
958 * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ
959 * when this function is executed.
960 *
961 *ASSUMPTIONS:
962 * NA
963 *
964 *NOTE:
965 * NA
966 *
967 * @param param - Indicates whether this is assoc or reassoc
968 * failure timeout
969 * @return None
970 */
971
972void
973limAssocFailureTimerHandler(void *pMacGlobal, tANI_U32 param)
974{
975 tSirMsgQ msg;
976 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
977
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700978#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
979 if((LIM_REASSOC == param) &&
980 (NULL != pMac->lim.pSessionEntry))
981 {
982 limLog(pMac, LOGE, FL("Reassoc timeout happened\n"));
983 if(pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT)
984 {
985 limSendRetryReassocReqFrame(pMac, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, pMac->lim.pSessionEntry);
986 pMac->lim.reAssocRetryAttempt++;
987 limLog(pMac, LOGW, FL("Reassoc request retry is sent %d times\n"), pMac->lim.reAssocRetryAttempt);
988 return;
989 }
990 else
991 {
992 limLog(pMac, LOGW, FL("Reassoc request retry MAX(%d) reached\n"), LIM_MAX_REASSOC_RETRY_LIMIT);
993 if(NULL != pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
994 {
995 palFreeMemory( pMac->hHdd, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq);
996 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = NULL;
997 }
998 }
999 }
1000#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 // Prepare and post message to LIM Message Queue
1002
1003 msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
1004 msg.bodyval = (tANI_U32)param;
1005 msg.bodyptr = NULL;
1006
1007 limPostMsgApi(pMac, &msg);
1008} /****** end limAssocFailureTimerHandler() ******/
1009
1010
1011/**
1012 * limUpdateOlbcCacheTimerHandler()
1013 *
1014 *FUNCTION:
1015 * This function is called upon update olbc cache timer expiration
1016 * on STA
1017 *
1018 *LOGIC:
1019 * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
1020 * when this function is executed.
1021 *
1022 *ASSUMPTIONS:
1023 * NA
1024 *
1025 *NOTE:
1026 * NA
1027 *
1028 * @param
1029 *
1030 * @return None
1031 */
1032#ifdef WLAN_SOFTAP_FEATURE
1033void
1034limUpdateOlbcCacheTimerHandler(void *pMacGlobal, tANI_U32 param)
1035{
1036 tSirMsgQ msg;
1037 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
1038
1039 // Prepare and post message to LIM Message Queue
1040
1041 msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
1042 msg.bodyval = 0;
1043 msg.bodyptr = NULL;
1044
1045 limPostMsgApi(pMac, &msg);
1046} /****** end limUpdateOlbcCacheTimerHandler() ******/
1047#endif
1048
1049/**
1050 * limDeactivateAndChangeTimer()
1051 *
1052 *FUNCTION:
1053 * This function is called to deactivate and change a timer
1054 * for future re-activation
1055 *
1056 *LOGIC:
1057 *
1058 *ASSUMPTIONS:
1059 * NA
1060 *
1061 *NOTE:
1062 * NA
1063 *
1064 * @param pMac - Pointer to Global MAC structure
1065 * @param timerId - enum of timer to be deactivated and changed
1066 * This enum is defined in limUtils.h file
1067 *
1068 * @return None
1069 */
1070
1071void
1072limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1073{
1074 tANI_U32 val=0, val1=0;
1075
Jeff Johnsone7245742012-09-05 17:12:55 -07001076 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001077
1078 switch (timerId)
1079 {
1080 case eLIM_ADDTS_RSP_TIMER:
1081 pMac->lim.gLimAddtsRspTimerCount++;
1082 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
1083 {
1084 // Could not deactivate AddtsRsp Timer
1085 // Log error
1086 limLog(pMac, LOGP,
1087 FL("Unable to deactivate AddtsRsp timer\n"));
1088 }
1089 break;
1090
1091 case eLIM_MIN_CHANNEL_TIMER:
1092 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer)
1093 != TX_SUCCESS)
1094 {
1095 // Could not deactivate min channel timer.
1096 // Log error
1097 limLog(pMac, LOGP,
1098 FL("Unable to deactivate min channel timer\n"));
1099 }
1100
Jeff Johnsone7245742012-09-05 17:12:55 -07001101#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 // If a background was triggered via Quiet BSS,
1103 // then we need to adjust the MIN and MAX channel
1104 // timer's accordingly to the Quiet duration that
1105 // was specified
1106 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1107 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1108 {
1109 // gLimQuietDuration is already cached in units of
1110 // system ticks. No conversion is reqd...
1111 val = pMac->lim.gLimSpecMgmt.quietDuration;
1112 }
1113 else
1114 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001115#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 if(pMac->lim.gpLimMlmScanReq)
1117 {
1118 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
1119 }
1120 else
1121 {
1122 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1123 //No need to change min timer. This is not a scan
1124 break;
1125 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001126#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001127 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001128#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001129
1130 if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
1131 val, 0) != TX_SUCCESS)
1132 {
1133 // Could not change min channel timer.
1134 // Log error
1135 limLog(pMac, LOGP, FL("Unable to change min channel timer\n"));
1136 }
1137
1138 break;
1139
1140 case eLIM_PERIODIC_PROBE_REQ_TIMER:
1141 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
1142 != TX_SUCCESS)
1143 {
1144 // Could not deactivate min channel timer.
1145 // Log error
1146 limLog(pMac, LOGP,
1147 FL("Unable to deactivate periodic timer\n"));
1148 }
1149
1150 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
1151 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
1152 val, 0) != TX_SUCCESS)
1153 {
1154 // Could not change min channel timer.
1155 // Log error
1156 limLog(pMac, LOGP, FL("Unable to change periodic timer\n"));
1157 }
1158
1159 break;
1160
1161 case eLIM_MAX_CHANNEL_TIMER:
1162 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
1163 != TX_SUCCESS)
1164 {
1165 // Could not deactivate max channel timer.
1166 // Log error
1167 limLog(pMac, LOGP,
1168 FL("Unable to deactivate max channel timer\n"));
1169 }
1170
1171#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1172 // If a background was triggered via Quiet BSS,
1173 // then we need to adjust the MIN and MAX channel
1174 // timer's accordingly to the Quiet duration that
1175 // was specified
1176 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
1177 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001178#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001179
1180 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1181 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1182 {
1183 // gLimQuietDuration is already cached in units of
1184 // system ticks. No conversion is reqd...
1185 val = pMac->lim.gLimSpecMgmt.quietDuration;
1186 }
1187 else
1188 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001189#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 if(pMac->lim.gpLimMlmScanReq)
1191 {
1192 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
1193 }
1194 else
1195 {
1196 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1197 //No need to change max timer. This is not a scan
1198 break;
1199 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001200#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001202#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 }
1204#endif
1205#if defined(ANI_PRODUCT_TYPE_AP)
1206 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1207 {
1208 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
1209 &val) != eSIR_SUCCESS)
1210 {
1211 /**
1212 * Could not get max channel value
1213 * from CFG. Log error.
1214 */
1215 limLog(pMac, LOGP,
1216 FL("could not retrieve max channel value\n"));
1217 }
1218 val = SYS_MS_TO_TICKS(val);
1219 }
1220#endif
1221
1222 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
1223 val, 0) != TX_SUCCESS)
1224 {
1225 // Could not change max channel timer.
1226 // Log error
1227 limLog(pMac, LOGP,
1228 FL("Unable to change max channel timer\n"));
1229 }
1230
1231 break;
1232
1233 case eLIM_JOIN_FAIL_TIMER:
1234 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
1235 != TX_SUCCESS)
1236 {
1237 /**
1238 * Could not deactivate Join Failure
1239 * timer. Log error.
1240 */
1241 limLog(pMac, LOGP,
1242 FL("Unable to deactivate Join Failure timer\n"));
1243 }
1244
1245 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1246 &val) != eSIR_SUCCESS)
1247 {
1248 /**
1249 * Could not get JoinFailureTimeout value
1250 * from CFG. Log error.
1251 */
1252 limLog(pMac, LOGP,
1253 FL("could not retrieve JoinFailureTimeout value\n"));
1254 }
1255 val = SYS_MS_TO_TICKS(val);
1256
1257 if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
1258 val, 0) != TX_SUCCESS)
1259 {
1260 /**
1261 * Could not change Join Failure
1262 * timer. Log error.
1263 */
1264 limLog(pMac, LOGP,
1265 FL("Unable to change Join Failure timer\n"));
1266 }
1267
1268 break;
1269
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001270 case eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER:
1271 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer)
1272 != TX_SUCCESS)
1273 {
1274 // Could not deactivate periodic join req Times.
1275 limLog(pMac, LOGP,
1276 FL("Unable to deactivate periodic join request timer\n"));
1277 }
1278
1279 val = SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS);
1280 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
1281 val, 0) != TX_SUCCESS)
1282 {
1283 // Could not change periodic join req times.
1284 // Log error
1285 limLog(pMac, LOGP, FL("Unable to change periodic join request timer\n"));
1286 }
1287
1288 break;
1289
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 case eLIM_AUTH_FAIL_TIMER:
1291 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
1292 != TX_SUCCESS)
1293 {
1294 // Could not deactivate Auth failure timer.
1295 // Log error
1296 limLog(pMac, LOGP,
1297 FL("Unable to deactivate auth failure timer\n"));
1298 }
1299
1300 // Change timer to reactivate it in future
1301 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
1302 &val) != eSIR_SUCCESS)
1303 {
1304 /**
1305 * Could not get AuthFailureTimeout value
1306 * from CFG. Log error.
1307 */
1308 limLog(pMac, LOGP,
1309 FL("could not retrieve AuthFailureTimeout value\n"));
1310 }
1311 val = SYS_MS_TO_TICKS(val);
1312
1313 if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
1314 val, 0) != TX_SUCCESS)
1315 {
1316 // Could not change Authentication failure timer.
1317 // Log error
1318 limLog(pMac, LOGP,
1319 FL("unable to change Auth failure timer\n"));
1320 }
1321
1322 break;
1323
1324 case eLIM_ASSOC_FAIL_TIMER:
1325 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
1326 TX_SUCCESS)
1327 {
1328 // Could not deactivate Association failure timer.
1329 // Log error
1330 limLog(pMac, LOGP,
1331 FL("unable to deactivate Association failure timer\n"));
1332 }
1333
1334 // Change timer to reactivate it in future
1335 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
1336 &val) != eSIR_SUCCESS)
1337 {
1338 /**
1339 * Could not get AssocFailureTimeout value
1340 * from CFG. Log error.
1341 */
1342 limLog(pMac, LOGP,
1343 FL("could not retrieve AssocFailureTimeout value\n"));
1344 }
1345 val = SYS_MS_TO_TICKS(val);
1346
1347 if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
1348 val, 0) != TX_SUCCESS)
1349 {
1350 // Could not change Association failure timer.
1351 // Log error
1352 limLog(pMac, LOGP,
1353 FL("unable to change Assoc failure timer\n"));
1354 }
1355
1356 break;
1357
1358 case eLIM_REASSOC_FAIL_TIMER:
1359 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
1360 TX_SUCCESS)
1361 {
1362 // Could not deactivate Reassociation failure timer.
1363 // Log error
1364 limLog(pMac, LOGP,
1365 FL("unable to deactivate Reassoc failure timer\n"));
1366 }
1367
1368 // Change timer to reactivate it in future
1369 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1370 &val) != eSIR_SUCCESS)
1371 {
1372 /**
1373 * Could not get ReassocFailureTimeout value
1374 * from CFG. Log error.
1375 */
1376 limLog(pMac, LOGP,
1377 FL("could not retrieve ReassocFailureTimeout value\n"));
1378 }
1379 val = SYS_MS_TO_TICKS(val);
1380
1381 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
1382 val, 0) != TX_SUCCESS)
1383 {
1384 // Could not change Reassociation failure timer.
1385 // Log error
1386 limLog(pMac, LOGP,
1387 FL("unable to change Reassociation failure timer\n"));
1388 }
1389
1390 break;
1391
1392 case eLIM_HEART_BEAT_TIMER:
1393 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
1394 TX_SUCCESS)
1395 {
1396 // Could not deactivate Heartbeat timer.
1397 // Log error
1398 limLog(pMac, LOGP,
1399 FL("unable to deactivate Heartbeat timer\n"));
1400 }
1401
1402 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
1403 &val) != eSIR_SUCCESS)
1404 {
1405 /**
1406 * Could not get BEACON_INTERVAL value
1407 * from CFG. Log error.
1408 */
1409 limLog(pMac, LOGP,
1410 FL("could not retrieve BEACON_INTERVAL value\n"));
1411 }
1412
1413 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
1414 eSIR_SUCCESS)
1415 limLog(pMac, LOGP,
1416 FL("could not retrieve heartbeat failure value\n"));
1417
1418 // Change timer to reactivate it in future
1419 val = SYS_MS_TO_TICKS(val * val1);
1420
1421 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
1422 val, 0) != TX_SUCCESS)
1423 {
1424 // Could not change HeartBeat timer.
1425 // Log error
1426 limLog(pMac, LOGP,
1427 FL("unable to change HeartBeat timer\n"));
1428 }
1429
1430 break;
1431
1432 case eLIM_PROBE_AFTER_HB_TIMER:
1433 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
1434 TX_SUCCESS)
1435 {
1436 // Could not deactivate Heartbeat timer.
1437 // Log error
1438 limLog(pMac, LOGP,
1439 FL("unable to deactivate probeAfterHBTimer\n"));
1440 }
1441
1442 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
1443 &val) != eSIR_SUCCESS)
1444 {
1445 /**
1446 * Could not get PROBE_AFTER_HB_FAILURE
1447 * value from CFG. Log error.
1448 */
1449 limLog(pMac, LOGP,
1450 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value\n"));
1451 }
1452
1453 // Change timer to reactivate it in future
1454 val = SYS_MS_TO_TICKS(val);
1455
1456 if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
1457 val, 0) != TX_SUCCESS)
1458 {
1459 // Could not change HeartBeat timer.
1460 // Log error
1461 limLog(pMac, LOGP,
1462 FL("unable to change ProbeAfterHBTimer\n"));
1463 }
1464
1465 break;
1466
1467 case eLIM_KEEPALIVE_TIMER:
1468 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
1469 != TX_SUCCESS)
1470 {
1471 // Could not deactivate Keepalive timer.
1472 // Log error
1473 limLog(pMac, LOGP,
1474 FL("unable to deactivate KeepaliveTimer timer\n"));
1475 }
1476
1477 // Change timer to reactivate it in future
1478
1479 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
1480 &val) != eSIR_SUCCESS)
1481 {
1482 /**
1483 * Could not get keepalive timeout value
1484 * from CFG. Log error.
1485 */
1486 limLog(pMac, LOGP,
1487 FL("could not retrieve keepalive timeout value\n"));
1488 }
1489 if (val == 0)
1490 {
1491 val = 3000;
1492 pMac->sch.keepAlive = 0;
1493 } else
1494 pMac->sch.keepAlive = 1;
1495
1496
1497
1498 val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
1499
1500 if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
1501 val, val) != TX_SUCCESS)
1502 {
1503 // Could not change KeepaliveTimer timer.
1504 // Log error
1505 limLog(pMac, LOGP,
1506 FL("unable to change KeepaliveTimer timer\n"));
1507 }
1508
1509 break;
1510
1511#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1512 case eLIM_BACKGROUND_SCAN_TIMER:
1513 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
1514 != TX_SUCCESS)
1515 {
1516 // Could not deactivate BackgroundScanTimer timer.
1517 // Log error
1518 limLog(pMac, LOGP,
1519 FL("unable to deactivate BackgroundScanTimer timer\n"));
1520 }
1521
1522 // Change timer to reactivate it in future
1523 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
1524 &val) != eSIR_SUCCESS)
1525 {
1526 /**
1527 * Could not get Background scan period value
1528 * from CFG. Log error.
1529 */
1530 limLog(pMac, LOGP,
1531 FL("could not retrieve Background scan period value\n"));
1532 }
1533 if (val == 0)
1534 {
1535 val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
1536 pMac->lim.gLimBackgroundScanDisable = true;
1537 }
1538 else
1539 pMac->lim.gLimBackgroundScanDisable = false;
1540
1541 val = SYS_MS_TO_TICKS(val);
1542
1543 if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
1544 val, val) != TX_SUCCESS)
1545 {
1546 // Could not change BackgroundScanTimer timer.
1547 // Log error
1548 limLog(pMac, LOGP,
1549 FL("unable to change BackgroundScanTimer timer\n"));
1550 }
1551
1552 break;
1553#endif
1554
1555#ifdef ANI_PRODUCT_TYPE_AP
1556 case eLIM_PRE_AUTH_CLEANUP_TIMER:
1557 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPreAuthClnupTimer) !=
1558 TX_SUCCESS)
1559 {
1560 // Could not deactivate Pre-auth cleanup timer.
1561 // Log error
1562 limLog(pMac, LOGP,
1563 FL("unable to deactivate Pre-auth cleanup timer\n"));
1564 }
1565
1566 // Change timer to reactivate it in future
1567 if (wlan_cfgGetInt(pMac, WNI_CFG_PREAUTH_CLNUP_TIMEOUT,
1568 &val) != eSIR_SUCCESS)
1569 {
1570 /**
1571 * Could not get pre-auth cleanup value
1572 * from CFG. Log error.
1573 */
1574 limLog(pMac, LOGP,
1575 FL("could not retrieve pre-auth cleanup value\n"));
1576 }
1577 val = SYS_MS_TO_TICKS(val);
1578
1579 if (tx_timer_change(&pMac->lim.limTimers.gLimPreAuthClnupTimer,
1580 val, val) != TX_SUCCESS)
1581 {
1582 // Could not change pre-auth cleanup timer.
1583 // Log error
1584 limLog(pMac, LOGP,
1585 FL("unable to change pre-auth cleanup timer\n"));
1586 }
1587
1588 break;
1589
1590 case eLIM_LEARN_INTERVAL_TIMER:
1591 {
1592 // Restart Learn Interval timer
1593 tANI_U32 learnInterval =
1594 pMac->lim.gpLimMeasReq->measDuration.shortTermPeriod /
1595 pMac->lim.gpLimMeasReq->channelList.numChannels;
1596
1597 if (tx_timer_deactivate(
1598 &pMac->lim.gLimMeasParams.learnIntervalTimer) != TX_SUCCESS)
1599 {
1600 // Could not deactivate Learn Interval timer.
1601 // Log error
1602 limLog(pMac, LOGP,
1603 FL("Unable to deactivate Learn Interval timer\n"));
1604 }
1605
1606 if (tx_timer_change(
1607 &pMac->lim.gLimMeasParams.learnIntervalTimer,
1608 SYS_MS_TO_TICKS(learnInterval), 0) != TX_SUCCESS)
1609 {
1610 // Could not change Learn Interval timer.
1611 // Log error
1612 limLog(pMac, LOGP, FL("Unable to change Learn Interval timer\n"));
1613
1614 return;
1615 }
1616
1617 limLog( pMac, LOG3,
1618 FL("Setting the Learn Interval TIMER to %d ticks\n"),
1619 SYS_MS_TO_TICKS(learnInterval));
1620 }
1621 break;
1622
1623#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001624#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 case eLIM_CHANNEL_SWITCH_TIMER:
1626 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
1627 {
1628 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!\n"));
1629 return;
1630 }
1631
1632 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
1633 pMac->lim.gLimChannelSwitch.switchTimeoutValue,
1634 0) != TX_SUCCESS)
1635 {
1636 limLog(pMac, LOGP, FL("tx_timer_change failed \n"));
1637 return;
1638 }
1639 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001640#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001641
1642 case eLIM_LEARN_DURATION_TIMER:
1643#ifdef ANI_PRODUCT_TYPE_AP
1644 if (tx_timer_deactivate(&pMac->lim.gLimMeasParams.learnDurationTimer) != TX_SUCCESS)
1645 {
1646 limLog(pMac, LOGP, FL("Could not deactivate learn duration timer\n"));
1647 return;
1648 }
1649
1650 if (pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity &&
1651 (pMac->lim.gLimMeasParams.shortDurationCount ==
1652 pMac->lim.gpLimMeasReq->measControl.longChannelScanPeriodicity))
1653 {
1654#ifdef ANI_AP_SDK
1655 val = pMac->lim.gLimScanDurationConvert.longChannelScanDuration_tick;
1656#else
1657 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.longChannelScanDuration
1658 + SYS_TICK_DUR_MS - 1);
1659 if(val > 1)
1660 val--;
1661#endif /* ANI_AP_SDK */
1662 // Time to perform measurements for longer term
1663 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1664 val, 0) != TX_SUCCESS)
1665 {
1666 // Could not change Learn duration timer.
1667 // Log error
1668 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1669 return;
1670 }
1671 pMac->lim.gLimMeasParams.shortDurationCount = 0;
1672 }
1673 else
1674 {
1675#ifdef ANI_AP_SDK
1676 val = pMac->lim.gLimScanDurationConvert.shortChannelScanDuration_tick;
1677#else
1678 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration
1679 + SYS_TICK_DUR_MS - 1);
1680 if(val > 1)
1681 val--;
1682#endif /* ANI_AP_SDK */
1683 if (tx_timer_change(&pMac->lim.gLimMeasParams.learnDurationTimer,
1684 val, 0) != TX_SUCCESS)
1685 {
1686 // Could not change Learn duration timer.
1687 // Log error
1688 limLog(pMac, LOGP, FL("Unable to change Learn duration timer\n"));
1689 }
1690 }
1691 pMac->lim.gpLimMeasData->duration = val * SYS_TICK_DUR_MS;
1692#endif
1693 break;
1694
Jeff Johnsone7245742012-09-05 17:12:55 -07001695#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001696 case eLIM_QUIET_BSS_TIMER:
1697 if (TX_SUCCESS !=
1698 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
1699 {
1700 limLog( pMac, LOGE,
1701 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway...\n"));
1702 }
1703
1704 // gLimQuietDuration appears to be in units of ticks
1705 // Use it as is
1706 if (TX_SUCCESS !=
1707 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
1708 pMac->lim.gLimSpecMgmt.quietDuration,
1709 0))
1710 {
1711 limLog( pMac, LOGE,
1712 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway...\n"));
1713 }
1714 break;
1715
1716 case eLIM_QUIET_TIMER:
1717 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
1718 {
1719 limLog( pMac, LOGE,
1720 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1721 }
1722
1723 // Set the NEW timeout value, in ticks
1724 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
1725 SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
1726 {
1727 limLog( pMac, LOGE,
1728 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway...\n" ));
1729 }
1730 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001731#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001732
1733#ifdef WLAN_SOFTAP_FEATURE
1734#if 0
1735 case eLIM_WPS_OVERLAP_TIMER:
1736 {
1737 // Restart Learn Interval timer
1738
1739 tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
1740
1741 if (tx_timer_deactivate(
1742 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1743 {
1744 // Could not deactivate Learn Interval timer.
1745 // Log error
1746 limLog(pMac, LOGP,
1747 FL("Unable to deactivate WPS overlap timer\n"));
1748 }
1749
1750 if (tx_timer_change(
1751 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1752 WPSOverlapTimer, 0) != TX_SUCCESS)
1753 {
1754 // Could not change Learn Interval timer.
1755 // Log error
1756 limLog(pMac, LOGP, FL("Unable to change WPS overlap timer\n"));
1757
1758 return;
1759 }
1760
1761 limLog( pMac, LOGE,
1762 FL("Setting WPS overlap TIMER to %d ticks\n"),
1763 WPSOverlapTimer);
1764 }
1765 break;
1766#endif
1767#endif
1768
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}
2490#ifdef WLAN_SOFTAP_FEATURE
2491#if 0
2492void
2493limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
2494{
2495 tSirMsgQ msg;
2496 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2497
2498 msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
2499 msg.bodyval = (tANI_U32)param;
2500 msg.bodyptr = NULL;
2501 PELOG1(limLog(pMac, LOG1,
2502 FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. \n"));)
2503 limPostMsgApi(pMac, &msg);
2504}
2505#endif
2506#endif
Yathish9f22e662012-12-10 14:21:35 -08002507
2508#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2509/* ACTIVE_MODE_HB_OFFLOAD */
2510/**
2511 * limMissedBeaconInActiveMode()
2512 *
2513 *FUNCTION:
2514 * This function handle beacon miss indication from FW
2515 * in Active mode.
2516 *
2517 *LOGIC:
2518 *
2519 *ASSUMPTIONS:
2520 * NA
2521 *
2522 *NOTE:
2523 * NA
2524 *
2525 * @param param - Msg Type
2526 *
2527 * @return None
2528 */
2529void
2530limMissedBeaconInActiveMode(void *pMacGlobal)
2531{
2532 tANI_U32 statusCode;
2533 tSirMsgQ msg;
2534 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2535
2536 // Prepare and post message to LIM Message Queue
2537 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2538 {
2539 msg.type = (tANI_U16) SIR_LIM_HEART_BEAT_TIMEOUT;
2540 msg.bodyptr = NULL;
2541 msg.bodyval = 0;
2542 limLog(pMac, LOGE,
2543 FL("Heartbeat failure from Riva\n"));
2544 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2545 limLog(pMac, LOGE,
2546 FL("posting message %X to LIM failed, reason=%d\n"),
2547 msg.type, statusCode);
2548 }
2549}
2550#endif