blob: 6bd9a6136dffe079f8c7918c0ebe194e6a835e04 [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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700100 PELOG1(limLog(pMac, LOG1, FL("Creating Timers used by LIM module in Role %d"), pMac->lim.gLimSystemRole);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700101
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 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700109 limLog(pMac, LOGP, FL("could not retrieve MinChannelTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700110 }
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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700122 limLog(pMac, LOGP, FL("could not create MIN channel timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700123 return TX_TIMER_ERROR;
Jeff Johnson295189b2012-06-20 16:38:30 -0700124 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700125 PELOG2(limLog(pMac, LOG2, FL("Created MinChannelTimer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700126
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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700144 limLog(pMac, LOGP, FL("could not create periodic probe timer"));
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700158 FL("could not retrieve MAXChannelTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700159 }
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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700170 limLog(pMac, LOGP, FL("could not create MAX channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700171
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700172 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700174 PELOG2(limLog(pMac, LOG2, FL("Created MaxChannelTimer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700175
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 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700187 limLog(pMac, LOGP, FL("failed to create Channel Switch timer"));
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 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700204 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer"));
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 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700223 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer"));
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700235 FL("could not retrieve JoinFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700236 }
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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700248 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700249
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
Jeff Johnson62c27982013-02-27 17:53:55 -0800253 //Send unicast probe req frame every 200 ms
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800254 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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700262 limLog(pMac, LOGP, FL("could not create Periodic Join Probe Request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800263 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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700274 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 }
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700288 FL("could not create Association failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700289
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 }
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700314 FL("could not create Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700315
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)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700320 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_ADDTS_RSP_TIMEOUT "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700321
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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700334 limLog(pMac, LOGP, FL("could not create Addts response timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700335
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700347 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 }
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
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700361 limLog(pMac, LOGP, FL("could not create Auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700362
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700374 FL("could not retrieve BEACON_INTERVAL value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700375 }
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700389 FL("call to create heartbeat timer failed"));
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700401 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 }
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,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700418 FL("unable to create ProbeAfterHBTimer"));
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 (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
423 &cfgValue) != eSIR_SUCCESS)
424 {
425 /**
426 * Could not get Background scan period value
427 * from CFG. Log error.
428 */
429 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700430 FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700431 }
432
433 /*
434 * setting period to zero means disabling background scans when associated
435 * the way we do this is to set a flag indicating this and keeping
436 * the timer running, since it will be used for PDU leak workarounds
437 * as well as background scanning during SME idle states
438 */
439 if (cfgValue == 0)
440 {
441 cfgValue = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
442 pMac->lim.gLimBackgroundScanDisable = true;
443 }
444 else
445 pMac->lim.gLimBackgroundScanDisable = false;
446
447 cfgValue = SYS_MS_TO_TICKS(cfgValue);
448
449 if (tx_timer_create(&pMac->lim.limTimers.gLimBackgroundScanTimer,
450 "Background scan TIMEOUT",
451 limTimerHandler,
452 SIR_LIM_CHANNEL_SCAN_TIMEOUT,
453 cfgValue,
454 cfgValue,
455 TX_NO_ACTIVATE) != TX_SUCCESS)
456 {
457 /// Could not start background scan timer.
458 // Log error
459 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700460 FL("call to create background scan timer failed"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700461 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800463#ifdef FEATURE_WLAN_TDLS_INTERNAL
Jeff Johnson62c27982013-02-27 17:53:55 -0800464 /*
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800465 * create TDLS timers..
466 * a) TDLS discovery response timer.
Jeff Johnson62c27982013-02-27 17:53:55 -0800467 */
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800468
469 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
470 &cfgValue) != eSIR_SUCCESS)
471 {
472 /*
473 * Could not get discovery response Timeout value
474 * from CFG. Log error.
475 */
476 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700477 FL("could not retrieve ReassocFailureTimeout value"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800478 }
479 cfgValue = SYS_MS_TO_TICKS(cfgValue);
480
Jeff Johnson62c27982013-02-27 17:53:55 -0800481 /*
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800482 * create TDLS discovery response wait timer and activate it later
483 */
484 if (tx_timer_create(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer,
485 "TDLS discovery response WAIT",
486 limTimerHandler,
487 SIR_LIM_TDLS_DISCOVERY_RSP_WAIT,
488 cfgValue, 0,
489 TX_NO_ACTIVATE) != TX_SUCCESS)
490 {
491 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700492 FL("could not create TDLS discovery response wait timer"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800493 goto err_timer;
494 }
495#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 }
497
498
499 cfgValue = SYS_MS_TO_TICKS(LIM_HASH_MISS_TIMER_MS);
500
501 if (tx_timer_create(
502 &pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer,
503 "Disassoc throttle TIMEOUT",
504 limSendDisassocFrameThresholdHandler,
505 SIR_LIM_HASH_MISS_THRES_TIMEOUT,
506 cfgValue,
507 cfgValue,
508 TX_AUTO_ACTIVATE) != TX_SUCCESS)
509 {
510 /// Could not start Send Disassociate Frame Threshold timer.
511 // Log error
512 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700513 FL("create Disassociate throttle timer failed"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700514 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700517 FL("Created Disassociate throttle timer "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700518
519 /**
520 * Create keepalive timer and activate it right away for AP role
521 */
522
523 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
524 &cfgValue) != eSIR_SUCCESS)
525 {
526 /**
527 * Could not get keepalive timeout value
528 * from CFG. Log error.
529 */
530 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700531 FL("could not retrieve keepalive timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 }
533
534 // A value of zero implies keep alive should be disabled
535 if (cfgValue == 0)
536 {
537 cfgValue = LIM_KEEPALIVE_TIMER_MS;
538 pMac->sch.keepAlive = 0;
539 } else
540 pMac->sch.keepAlive = 1;
541
542
543 cfgValue = SYS_MS_TO_TICKS(cfgValue + SYS_TICK_DUR_MS - 1);
544
545 if (tx_timer_create(&pMac->lim.limTimers.gLimKeepaliveTimer,
546 "KEEPALIVE_TIMEOUT",
547 limKeepaliveTmerHandler,
548 0,
549 cfgValue,
550 cfgValue,
551 (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ?
552 TX_AUTO_ACTIVATE : TX_NO_ACTIVATE)
553 != TX_SUCCESS)
554 {
555 // Cannot create keepalive timer. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700556 limLog(pMac, LOGP, FL("Cannot create keepalive timer."));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700557 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 }
559
560 /**
561 * Create all CNF_WAIT Timers upfront
562 */
563
564 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
565 &cfgValue) != eSIR_SUCCESS)
566 {
567 /**
568 * Could not get CNF_WAIT timeout value
569 * from CFG. Log error.
570 */
571 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700572 FL("could not retrieve CNF timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 }
574 cfgValue = SYS_MS_TO_TICKS(cfgValue);
575
576 for (i=0; i<pMac->lim.maxStation; i++)
577 {
578 if (tx_timer_create(&pMac->lim.limTimers.gpLimCnfWaitTimer[i],
579 "CNF_MISS_TIMEOUT",
580 limCnfWaitTmerHandler,
581 (tANI_U32)i,
582 cfgValue,
583 0,
584 TX_NO_ACTIVATE) != TX_SUCCESS)
585 {
586 // Cannot create timer. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700587 limLog(pMac, LOGP, FL("Cannot create CNF wait timer."));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700588 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 }
590 }
591
592 /*
593 ** Alloc and init table for the preAuth timer list
594 **
595 **/
596
597 // get max number of Preauthentication
598 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
599 &cfgValue) != eSIR_SUCCESS)
600 {
601 /*
602 ** Could not get max preauth value
603 ** from CFG. Log error.
604 **/
605 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700606 FL("could not retrieve mac preauth value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 pMac->lim.gLimPreAuthTimerTable.numEntry = cfgValue;
609 if (palAllocateMemory(pMac->hHdd, (void **) &pMac->lim.gLimPreAuthTimerTable.pTable,
610 cfgValue*sizeof(tLimPreAuthNode)) != eHAL_STATUS_SUCCESS)
611 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700612 limLog(pMac, LOGP, FL("palAllocateMemory failed!"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700613 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 }
615
616 limInitPreAuthTimerTable(pMac, &pMac->lim.gLimPreAuthTimerTable);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700617 PELOG1(limLog(pMac, LOG1, FL("alloc and init table for preAuth timers"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700618
619
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 {
621 /**
622 * Create OLBC cache aging timer
623 */
624 if (wlan_cfgGetInt(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT,
625 &cfgValue) != eSIR_SUCCESS)
626 {
627 /**
628 * Could not get OLBC detect timeout value
629 * from CFG. Log error.
630 */
631 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700632 FL("could not retrieve OLBD detect timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 }
634
635 cfgValue = SYS_MS_TO_TICKS(cfgValue);
636
637 if (tx_timer_create(
638 &pMac->lim.limTimers.gLimUpdateOlbcCacheTimer,
639 "OLBC UPDATE CACHE TIMEOUT",
640 limUpdateOlbcCacheTimerHandler,
641 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
642 cfgValue,
643 cfgValue,
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -0700644 TX_NO_ACTIVATE) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 {
646 // Cannot create update OLBC cache timer
647 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700648 limLog(pMac, LOGP, FL("Cannot create update OLBC cache timer"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700649 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 }
651 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700652#ifdef WLAN_FEATURE_VOWIFI_11R
653 // In future we need to use the auth timer, cause
654 // the pre auth session will be introduced before sending
655 // Auth frame.
656 // We need to go off channel and come back to home channel
657 cfgValue = 1000;
658 cfgValue = SYS_MS_TO_TICKS(cfgValue);
659
660 if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
661 "FT PREAUTH RSP TIMEOUT",
662 limTimerHandler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT,
663 cfgValue, 0,
664 TX_NO_ACTIVATE) != TX_SUCCESS)
665 {
666 // Could not create Join failure timer.
667 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700668 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700669 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 }
671#endif
672
673#ifdef FEATURE_WLAN_CCX
674 cfgValue = 5000;
675 cfgValue = SYS_MS_TO_TICKS(cfgValue);
676
677 if (tx_timer_create(&pMac->lim.limTimers.gLimCcxTsmTimer,
678 "CCX TSM Stats TIMEOUT",
679 limTimerHandler, SIR_LIM_CCX_TSM_TIMEOUT,
680 cfgValue, 0,
681 TX_NO_ACTIVATE) != TX_SUCCESS)
682 {
683 // Could not create Join failure timer.
684 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700685 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700686 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 }
688#endif
689
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 cfgValue = 1000;
691 cfgValue = SYS_MS_TO_TICKS(cfgValue);
692 if (tx_timer_create(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
693 "FT PREAUTH RSP TIMEOUT",
694 limTimerHandler, SIR_LIM_REMAIN_CHN_TIMEOUT,
695 cfgValue, 0,
696 TX_NO_ACTIVATE) != TX_SUCCESS)
697 {
698 // Could not create Join failure timer.
699 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700700 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700701 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 }
703
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800704
705 cfgValue = 1000;
706 cfgValue = SYS_MS_TO_TICKS(cfgValue);
707 if (tx_timer_create(&pMac->lim.limTimers.gLimDisassocAckTimer,
708 "DISASSOC ACK TIMEOUT",
709 limTimerHandler, SIR_LIM_DISASSOC_ACK_TIMEOUT,
710 cfgValue, 0,
711 TX_NO_ACTIVATE) != TX_SUCCESS)
712 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700713 limLog(pMac, LOGP, FL("could not DISASSOC ACK TIMEOUT timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800714 goto err_timer;
715 }
716
717 cfgValue = 1000;
718 cfgValue = SYS_MS_TO_TICKS(cfgValue);
719 if (tx_timer_create(&pMac->lim.limTimers.gLimDeauthAckTimer,
720 "DISASSOC ACK TIMEOUT",
Viral Modid86bde22012-12-10 13:09:21 -0800721 limTimerHandler, SIR_LIM_DEAUTH_ACK_TIMEOUT,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800722 cfgValue, 0,
723 TX_NO_ACTIVATE) != TX_SUCCESS)
724 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700725 limLog(pMac, LOGP, FL("could not create DEAUTH ACK TIMEOUT timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800726 goto err_timer;
727 }
Viral Modid86bde22012-12-10 13:09:21 -0800728
Viral Modid86bde22012-12-10 13:09:21 -0800729 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)
730 cfgValue = SYS_MS_TO_TICKS(cfgValue);
731 if (tx_timer_create(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
732 "Single Shot NOA Insert timeout",
733 limTimerHandler, SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT,
734 cfgValue, 0,
735 TX_NO_ACTIVATE) != TX_SUCCESS)
736 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700737 limLog(pMac, LOGP, FL("could not create Single Shot NOA Insert Timeout timer"));
Viral Modid86bde22012-12-10 13:09:21 -0800738 goto err_timer;
739 }
Viral Modid86bde22012-12-10 13:09:21 -0800740
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700741 return TX_SUCCESS;
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700742
743 err_timer:
Viral Modid86bde22012-12-10 13:09:21 -0800744 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800745 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800746 tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700747 #ifdef FEATURE_WLAN_CCX
748 tx_timer_delete(&pMac->lim.limTimers.gLimCcxTsmTimer);
749 #endif
750 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
751 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
752 while(((tANI_S32)--i) >= 0)
753 {
754 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[i]);
755 }
756 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
757 tx_timer_delete(&pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer);
758 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
759 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
760 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
761 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
762 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
763 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
764 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
Jeff Johnson62c27982013-02-27 17:53:55 -0800765 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800766 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700767 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
768 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
769 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
770 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
771 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
772 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
Venkata Prathyusha Kuntupalli7a87ff02013-01-29 10:45:54 -0800773 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700774
775 if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
776 palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
777
778 return TX_TIMER_ERROR;
779
Jeff Johnson295189b2012-06-20 16:38:30 -0700780} /****** end limCreateTimers() ******/
781
782
783
784/**
785 * limTimerHandler()
786 *
787 *FUNCTION:
788 * This function is called upon
789 * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
790 * 2. JOIN_FAILURE timer expiration while joining a BSS
791 * 3. AUTH_FAILURE timer expiration while authenticating with a peer
792 * 4. Heartbeat timer expiration on STA
793 * 5. Background scan timer expiration on STA
794 * 6. AID release, Pre-auth cleanup and Link monitoring timer
795 * expiration on AP
796 *
797 *LOGIC:
798 *
799 *ASSUMPTIONS:
800 * NA
801 *
802 *NOTE:
803 * NA
804 *
805 * @param param - Message corresponding to the timer that expired
806 *
807 * @return None
808 */
809
810void
811limTimerHandler(void *pMacGlobal, tANI_U32 param)
812{
813 tANI_U32 statusCode;
814 tSirMsgQ msg;
815 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
816
817 // Prepare and post message to LIM Message Queue
818
819 msg.type = (tANI_U16) param;
820 msg.bodyptr = NULL;
821 msg.bodyval = 0;
822
823 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
824 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700825 FL("posting message %X to LIM failed, reason=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 msg.type, statusCode);
827} /****** end limTimerHandler() ******/
828
829
830/**
831 * limAddtsResponseTimerHandler()
832 *
833 *FUNCTION:
834 * This function is called upon Addts response timer expiration on sta
835 *
836 *LOGIC:
837 * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
838 * when this function is executed.
839 *
840 *ASSUMPTIONS:
841 * NA
842 *
843 *NOTE:
844 * NA
845 *
846 * @param param - pointer to pre-auth node
847 *
848 * @return None
849 */
850
851void
852limAddtsResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
853{
854 tSirMsgQ msg;
855 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
856
857 // Prepare and post message to LIM Message Queue
858
859 msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
860 msg.bodyval = param;
861 msg.bodyptr = NULL;
862
863 limPostMsgApi(pMac, &msg);
864} /****** end limAuthResponseTimerHandler() ******/
865
866
867/**
868 * limAuthResponseTimerHandler()
869 *
870 *FUNCTION:
871 * This function is called upon Auth response timer expiration on AP
872 *
873 *LOGIC:
874 * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
875 * when this function is executed.
876 *
877 *ASSUMPTIONS:
878 * NA
879 *
880 *NOTE:
881 * NA
882 *
883 * @param param - pointer to pre-auth node
884 *
885 * @return None
886 */
887
888void
889limAuthResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
890{
891 tSirMsgQ msg;
892 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
893
894 // Prepare and post message to LIM Message Queue
895
896 msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
897 msg.bodyptr = NULL;
898 msg.bodyval = (tANI_U32)param;
899
900 limPostMsgApi(pMac, &msg);
901} /****** end limAuthResponseTimerHandler() ******/
902
903
904
905/**
906 * limAssocFailureTimerHandler()
907 *
908 *FUNCTION:
909 * This function is called upon Re/Assoc failure timer expiration
910 * on STA
911 *
912 *LOGIC:
913 * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ
914 * when this function is executed.
915 *
916 *ASSUMPTIONS:
917 * NA
918 *
919 *NOTE:
920 * NA
921 *
922 * @param param - Indicates whether this is assoc or reassoc
923 * failure timeout
924 * @return None
925 */
926
927void
928limAssocFailureTimerHandler(void *pMacGlobal, tANI_U32 param)
929{
930 tSirMsgQ msg;
931 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
932
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700933#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
934 if((LIM_REASSOC == param) &&
935 (NULL != pMac->lim.pSessionEntry))
936 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700937 limLog(pMac, LOGE, FL("Reassoc timeout happened"));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700938 if(pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT)
939 {
940 limSendRetryReassocReqFrame(pMac, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, pMac->lim.pSessionEntry);
941 pMac->lim.reAssocRetryAttempt++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700942 limLog(pMac, LOGW, FL("Reassoc request retry is sent %d times"), pMac->lim.reAssocRetryAttempt);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700943 return;
944 }
945 else
946 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700947 limLog(pMac, LOGW, FL("Reassoc request retry MAX(%d) reached"), LIM_MAX_REASSOC_RETRY_LIMIT);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700948 if(NULL != pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
949 {
950 palFreeMemory( pMac->hHdd, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq);
951 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = NULL;
952 }
953 }
954 }
955#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700956 // Prepare and post message to LIM Message Queue
957
958 msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
959 msg.bodyval = (tANI_U32)param;
960 msg.bodyptr = NULL;
961
962 limPostMsgApi(pMac, &msg);
963} /****** end limAssocFailureTimerHandler() ******/
964
965
966/**
967 * limUpdateOlbcCacheTimerHandler()
968 *
969 *FUNCTION:
970 * This function is called upon update olbc cache timer expiration
971 * on STA
972 *
973 *LOGIC:
974 * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
975 * when this function is executed.
976 *
977 *ASSUMPTIONS:
978 * NA
979 *
980 *NOTE:
981 * NA
982 *
983 * @param
984 *
985 * @return None
986 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700987void
988limUpdateOlbcCacheTimerHandler(void *pMacGlobal, tANI_U32 param)
989{
990 tSirMsgQ msg;
991 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
992
993 // Prepare and post message to LIM Message Queue
994
995 msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
996 msg.bodyval = 0;
997 msg.bodyptr = NULL;
998
999 limPostMsgApi(pMac, &msg);
1000} /****** end limUpdateOlbcCacheTimerHandler() ******/
Jeff Johnson295189b2012-06-20 16:38:30 -07001001
1002/**
1003 * limDeactivateAndChangeTimer()
1004 *
1005 *FUNCTION:
1006 * This function is called to deactivate and change a timer
1007 * for future re-activation
1008 *
1009 *LOGIC:
1010 *
1011 *ASSUMPTIONS:
1012 * NA
1013 *
1014 *NOTE:
1015 * NA
1016 *
1017 * @param pMac - Pointer to Global MAC structure
1018 * @param timerId - enum of timer to be deactivated and changed
1019 * This enum is defined in limUtils.h file
1020 *
1021 * @return None
1022 */
1023
1024void
1025limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1026{
1027 tANI_U32 val=0, val1=0;
1028
Jeff Johnsone7245742012-09-05 17:12:55 -07001029 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001030
1031 switch (timerId)
1032 {
1033 case eLIM_ADDTS_RSP_TIMER:
1034 pMac->lim.gLimAddtsRspTimerCount++;
1035 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
1036 {
1037 // Could not deactivate AddtsRsp Timer
1038 // Log error
1039 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001040 FL("Unable to deactivate AddtsRsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001041 }
1042 break;
1043
1044 case eLIM_MIN_CHANNEL_TIMER:
1045 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer)
1046 != TX_SUCCESS)
1047 {
1048 // Could not deactivate min channel timer.
1049 // Log error
1050 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001051 FL("Unable to deactivate min channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001052 }
1053
Jeff Johnsone7245742012-09-05 17:12:55 -07001054#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 // If a background was triggered via Quiet BSS,
1056 // then we need to adjust the MIN and MAX channel
1057 // timer's accordingly to the Quiet duration that
1058 // was specified
1059 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1060 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1061 {
1062 // gLimQuietDuration is already cached in units of
1063 // system ticks. No conversion is reqd...
1064 val = pMac->lim.gLimSpecMgmt.quietDuration;
1065 }
1066 else
1067 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001068#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 if(pMac->lim.gpLimMlmScanReq)
1070 {
1071 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001072 if (pMac->btc.btcScanCompromise)
1073 {
1074 if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)
1075 {
1076 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTimeBtc);
1077 limLog(pMac, LOG1, FL("Using BTC Min Active Scan time"));
1078 }
1079 else
1080 {
1081 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1082 }
1083 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 }
1085 else
1086 {
1087 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1088 //No need to change min timer. This is not a scan
1089 break;
1090 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001091#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001093#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001094
1095 if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
1096 val, 0) != TX_SUCCESS)
1097 {
1098 // Could not change min channel timer.
1099 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001100 limLog(pMac, LOGP, FL("Unable to change min channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 }
1102
1103 break;
1104
1105 case eLIM_PERIODIC_PROBE_REQ_TIMER:
1106 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
1107 != TX_SUCCESS)
1108 {
1109 // Could not deactivate min channel timer.
1110 // Log error
1111 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001112 FL("Unable to deactivate periodic timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 }
1114
1115 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001116 if (pMac->btc.btcScanCompromise)
1117 {
1118 if (pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)
1119 {
1120 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTimeBtc)/2;
1121 }
1122 else
1123 {
1124 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1125 }
1126 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001127 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
1128 val, 0) != TX_SUCCESS)
1129 {
1130 // Could not change min channel timer.
1131 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001132 limLog(pMac, LOGP, FL("Unable to change periodic timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 }
1134
1135 break;
1136
1137 case eLIM_MAX_CHANNEL_TIMER:
1138 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
1139 != TX_SUCCESS)
1140 {
1141 // Could not deactivate max channel timer.
1142 // Log error
1143 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001144 FL("Unable to deactivate max channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 }
1146
Jeff Johnson295189b2012-06-20 16:38:30 -07001147 // If a background was triggered via Quiet BSS,
1148 // then we need to adjust the MIN and MAX channel
1149 // timer's accordingly to the Quiet duration that
1150 // was specified
1151 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
1152 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001153#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001154
1155 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1156 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1157 {
1158 // gLimQuietDuration is already cached in units of
1159 // system ticks. No conversion is reqd...
1160 val = pMac->lim.gLimSpecMgmt.quietDuration;
1161 }
1162 else
1163 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001164#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001165 if(pMac->lim.gpLimMlmScanReq)
1166 {
1167 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001168 if (pMac->btc.btcScanCompromise)
1169 {
1170 if (pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc)
1171 {
1172 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTimeBtc);
1173 limLog(pMac, LOG1, FL("Using BTC Max Active Scan time"));
1174 }
1175 else
1176 {
1177 limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set"));
1178 }
1179 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 }
1181 else
1182 {
1183 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1184 //No need to change max timer. This is not a scan
1185 break;
1186 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001187#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001189#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001191
1192 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
1193 val, 0) != TX_SUCCESS)
1194 {
1195 // Could not change max channel timer.
1196 // Log error
1197 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001198 FL("Unable to change max channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 }
1200
1201 break;
1202
1203 case eLIM_JOIN_FAIL_TIMER:
1204 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
1205 != TX_SUCCESS)
1206 {
1207 /**
1208 * Could not deactivate Join Failure
1209 * timer. Log error.
1210 */
1211 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001212 FL("Unable to deactivate Join Failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001213 }
1214
1215 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1216 &val) != eSIR_SUCCESS)
1217 {
1218 /**
1219 * Could not get JoinFailureTimeout value
1220 * from CFG. Log error.
1221 */
1222 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001223 FL("could not retrieve JoinFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001224 }
1225 val = SYS_MS_TO_TICKS(val);
1226
1227 if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
1228 val, 0) != TX_SUCCESS)
1229 {
1230 /**
1231 * Could not change Join Failure
1232 * timer. Log error.
1233 */
1234 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001235 FL("Unable to change Join Failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 }
1237
1238 break;
1239
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001240 case eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER:
1241 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer)
1242 != TX_SUCCESS)
1243 {
1244 // Could not deactivate periodic join req Times.
1245 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001246 FL("Unable to deactivate periodic join request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001247 }
1248
1249 val = SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS);
1250 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
1251 val, 0) != TX_SUCCESS)
1252 {
1253 // Could not change periodic join req times.
1254 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001255 limLog(pMac, LOGP, FL("Unable to change periodic join request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001256 }
Jeff Johnson62c27982013-02-27 17:53:55 -08001257
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001258 break;
1259
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 case eLIM_AUTH_FAIL_TIMER:
1261 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
1262 != TX_SUCCESS)
1263 {
1264 // Could not deactivate Auth failure timer.
1265 // Log error
1266 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001267 FL("Unable to deactivate auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 }
1269
1270 // Change timer to reactivate it in future
1271 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
1272 &val) != eSIR_SUCCESS)
1273 {
1274 /**
1275 * Could not get AuthFailureTimeout value
1276 * from CFG. Log error.
1277 */
1278 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001279 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001280 }
1281 val = SYS_MS_TO_TICKS(val);
1282
1283 if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
1284 val, 0) != TX_SUCCESS)
1285 {
1286 // Could not change Authentication failure timer.
1287 // Log error
1288 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001289 FL("unable to change Auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 }
1291
1292 break;
1293
1294 case eLIM_ASSOC_FAIL_TIMER:
1295 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
1296 TX_SUCCESS)
1297 {
1298 // Could not deactivate Association failure timer.
1299 // Log error
1300 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001301 FL("unable to deactivate Association failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 }
1303
1304 // Change timer to reactivate it in future
1305 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
1306 &val) != eSIR_SUCCESS)
1307 {
1308 /**
1309 * Could not get AssocFailureTimeout value
1310 * from CFG. Log error.
1311 */
1312 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001313 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001314 }
1315 val = SYS_MS_TO_TICKS(val);
1316
1317 if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
1318 val, 0) != TX_SUCCESS)
1319 {
1320 // Could not change Association failure timer.
1321 // Log error
1322 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001323 FL("unable to change Assoc failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001324 }
1325
1326 break;
1327
1328 case eLIM_REASSOC_FAIL_TIMER:
1329 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
1330 TX_SUCCESS)
1331 {
1332 // Could not deactivate Reassociation failure timer.
1333 // Log error
1334 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001335 FL("unable to deactivate Reassoc failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 }
1337
1338 // Change timer to reactivate it in future
1339 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1340 &val) != eSIR_SUCCESS)
1341 {
1342 /**
1343 * Could not get ReassocFailureTimeout value
1344 * from CFG. Log error.
1345 */
1346 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001347 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 }
1349 val = SYS_MS_TO_TICKS(val);
1350
1351 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
1352 val, 0) != TX_SUCCESS)
1353 {
1354 // Could not change Reassociation failure timer.
1355 // Log error
1356 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001357 FL("unable to change Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 }
1359
1360 break;
1361
1362 case eLIM_HEART_BEAT_TIMER:
1363 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
1364 TX_SUCCESS)
1365 {
1366 // Could not deactivate Heartbeat timer.
1367 // Log error
1368 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001369 FL("unable to deactivate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 }
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07001371 limLog(pMac, LOGW, FL("Deactivated heartbeat link monitoring"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001372
1373 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
1374 &val) != eSIR_SUCCESS)
1375 {
1376 /**
1377 * Could not get BEACON_INTERVAL value
1378 * from CFG. Log error.
1379 */
1380 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001381 FL("could not retrieve BEACON_INTERVAL value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001382 }
1383
1384 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
1385 eSIR_SUCCESS)
1386 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001387 FL("could not retrieve heartbeat failure value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001388
1389 // Change timer to reactivate it in future
1390 val = SYS_MS_TO_TICKS(val * val1);
1391
1392 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
1393 val, 0) != TX_SUCCESS)
1394 {
1395 // Could not change HeartBeat timer.
1396 // Log error
1397 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001398 FL("unable to change HeartBeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001399 }
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07001400 limLog(pMac, LOGW, FL("HeartBeat timer value is changed = %lu"), val);
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 break;
1402
1403 case eLIM_PROBE_AFTER_HB_TIMER:
1404 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
1405 TX_SUCCESS)
1406 {
1407 // Could not deactivate Heartbeat timer.
1408 // Log error
1409 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001410 FL("unable to deactivate probeAfterHBTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001411 }
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07001412 limLog(pMac, LOGE, FL("Deactivated probe after hb timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001413
1414 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
1415 &val) != eSIR_SUCCESS)
1416 {
1417 /**
1418 * Could not get PROBE_AFTER_HB_FAILURE
1419 * value from CFG. Log error.
1420 */
1421 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001422 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001423 }
1424
1425 // Change timer to reactivate it in future
1426 val = SYS_MS_TO_TICKS(val);
1427
1428 if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
1429 val, 0) != TX_SUCCESS)
1430 {
1431 // Could not change HeartBeat timer.
1432 // Log error
1433 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001434 FL("unable to change ProbeAfterHBTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 }
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07001436 limLog(pMac, LOGW, FL("Probe after HB timer value is changed = %lu"), val);
Jeff Johnson295189b2012-06-20 16:38:30 -07001437
1438 break;
1439
1440 case eLIM_KEEPALIVE_TIMER:
1441 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
1442 != TX_SUCCESS)
1443 {
1444 // Could not deactivate Keepalive timer.
1445 // Log error
1446 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001447 FL("unable to deactivate KeepaliveTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001448 }
1449
1450 // Change timer to reactivate it in future
1451
1452 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
1453 &val) != eSIR_SUCCESS)
1454 {
1455 /**
1456 * Could not get keepalive timeout value
1457 * from CFG. Log error.
1458 */
1459 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001460 FL("could not retrieve keepalive timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 }
1462 if (val == 0)
1463 {
1464 val = 3000;
1465 pMac->sch.keepAlive = 0;
1466 } else
1467 pMac->sch.keepAlive = 1;
1468
1469
1470
1471 val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
1472
1473 if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
1474 val, val) != TX_SUCCESS)
1475 {
1476 // Could not change KeepaliveTimer timer.
1477 // Log error
1478 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001479 FL("unable to change KeepaliveTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 }
1481
1482 break;
1483
Jeff Johnson295189b2012-06-20 16:38:30 -07001484 case eLIM_BACKGROUND_SCAN_TIMER:
1485 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
1486 != TX_SUCCESS)
1487 {
1488 // Could not deactivate BackgroundScanTimer timer.
1489 // Log error
1490 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001491 FL("unable to deactivate BackgroundScanTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 }
1493
1494 // Change timer to reactivate it in future
1495 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
1496 &val) != eSIR_SUCCESS)
1497 {
1498 /**
1499 * Could not get Background scan period value
1500 * from CFG. Log error.
1501 */
1502 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001503 FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 }
1505 if (val == 0)
1506 {
1507 val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
1508 pMac->lim.gLimBackgroundScanDisable = true;
1509 }
1510 else
1511 pMac->lim.gLimBackgroundScanDisable = false;
1512
1513 val = SYS_MS_TO_TICKS(val);
1514
1515 if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
1516 val, val) != TX_SUCCESS)
1517 {
1518 // Could not change BackgroundScanTimer timer.
1519 // Log error
1520 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001521 FL("unable to change BackgroundScanTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 }
1523
1524 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001525
Jeff Johnsone7245742012-09-05 17:12:55 -07001526#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001527 case eLIM_CHANNEL_SWITCH_TIMER:
1528 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
1529 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001530 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001531 return;
1532 }
1533
1534 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
1535 pMac->lim.gLimChannelSwitch.switchTimeoutValue,
1536 0) != TX_SUCCESS)
1537 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001538 limLog(pMac, LOGP, FL("tx_timer_change failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001539 return;
1540 }
1541 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001542#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001543
1544 case eLIM_LEARN_DURATION_TIMER:
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 break;
1546
Jeff Johnsone7245742012-09-05 17:12:55 -07001547#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 case eLIM_QUIET_BSS_TIMER:
1549 if (TX_SUCCESS !=
1550 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
1551 {
1552 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001553 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 }
1555
1556 // gLimQuietDuration appears to be in units of ticks
1557 // Use it as is
1558 if (TX_SUCCESS !=
1559 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
1560 pMac->lim.gLimSpecMgmt.quietDuration,
1561 0))
1562 {
1563 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001564 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 }
1566 break;
1567
1568 case eLIM_QUIET_TIMER:
1569 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
1570 {
1571 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001572 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001573 }
1574
1575 // Set the NEW timeout value, in ticks
1576 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
1577 SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
1578 {
1579 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001580 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001581 }
1582 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001583#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001584
Jeff Johnson295189b2012-06-20 16:38:30 -07001585#if 0
1586 case eLIM_WPS_OVERLAP_TIMER:
1587 {
1588 // Restart Learn Interval timer
1589
1590 tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
1591
1592 if (tx_timer_deactivate(
1593 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1594 {
1595 // Could not deactivate Learn Interval timer.
1596 // Log error
1597 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001598 FL("Unable to deactivate WPS overlap timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001599 }
1600
1601 if (tx_timer_change(
1602 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1603 WPSOverlapTimer, 0) != TX_SUCCESS)
1604 {
1605 // Could not change Learn Interval timer.
1606 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001607 limLog(pMac, LOGP, FL("Unable to change WPS overlap timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001608
1609 return;
1610 }
1611
1612 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001613 FL("Setting WPS overlap TIMER to %d ticks"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001614 WPSOverlapTimer);
1615 }
1616 break;
1617#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001618
1619#ifdef WLAN_FEATURE_VOWIFI_11R
1620 case eLIM_FT_PREAUTH_RSP_TIMER:
1621 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != TX_SUCCESS)
1622 {
1623 /**
1624 ** Could not deactivate Join Failure
1625 ** timer. Log error.
1626 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001627 limLog(pMac, LOGP, FL("Unable to deactivate Preauth response Failure timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001628 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001629 }
1630 val = 1000;
1631 val = SYS_MS_TO_TICKS(val);
1632 if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
1633 val, 0) != TX_SUCCESS)
1634 {
1635 /**
1636 * Could not change Join Failure
1637 * timer. Log error.
1638 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001639 limLog(pMac, LOGP, FL("Unable to change Join Failure timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001640 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 }
1642 break;
1643#endif
1644#ifdef FEATURE_WLAN_CCX
1645 case eLIM_TSM_TIMER:
1646 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimCcxTsmTimer)
1647 != TX_SUCCESS)
1648 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001649 limLog(pMac, LOGE, FL("Unable to deactivate TSM timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 }
1651 break;
1652#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 case eLIM_REMAIN_CHN_TIMER:
1654 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer) != TX_SUCCESS)
1655 {
1656 /**
1657 ** Could not deactivate Join Failure
1658 ** timer. Log error.
1659 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001660 limLog(pMac, LOGP, FL("Unable to deactivate Remain on Chn timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001661 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 }
1663 val = 1000;
1664 val = SYS_MS_TO_TICKS(val);
1665 if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer,
1666 val, 0) != TX_SUCCESS)
1667 {
1668 /**
1669 * Could not change Join Failure
1670 * timer. Log error.
1671 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001672 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001673 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 }
1675 break;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001676 case eLIM_DISASSOC_ACK_TIMER:
1677 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer) != TX_SUCCESS)
1678 {
1679 /**
1680 ** Could not deactivate Join Failure
1681 ** timer. Log error.
1682 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001683 limLog(pMac, LOGP, FL("Unable to deactivate Disassoc ack timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001684 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001685 }
1686 val = 1000;
1687 val = SYS_MS_TO_TICKS(val);
1688 if (tx_timer_change(&pMac->lim.limTimers.gLimDisassocAckTimer,
1689 val, 0) != TX_SUCCESS)
1690 {
1691 /**
1692 * Could not change Join Failure
1693 * timer. Log error.
1694 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001695 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001696 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001697 }
1698 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001699
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001700 case eLIM_DEAUTH_ACK_TIMER:
1701 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer) != TX_SUCCESS)
1702 {
1703 /**
1704 ** Could not deactivate Join Failure
1705 ** timer. Log error.
1706 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001707 limLog(pMac, LOGP, FL("Unable to deactivate Deauth ack timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001708 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001709 }
1710 val = 1000;
1711 val = SYS_MS_TO_TICKS(val);
1712 if (tx_timer_change(&pMac->lim.limTimers.gLimDeauthAckTimer,
1713 val, 0) != TX_SUCCESS)
1714 {
1715 /**
1716 * Could not change Join Failure
1717 * timer. Log error.
1718 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001719 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001720 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001721 }
1722 break;
Viral Modid86bde22012-12-10 13:09:21 -08001723
Viral Modid86bde22012-12-10 13:09:21 -08001724 case eLIM_INSERT_SINGLESHOT_NOA_TIMER:
1725 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer) != TX_SUCCESS)
1726 {
1727 /**
1728 ** Could not deactivate SingleShot NOA Insert
1729 ** timer. Log error.
1730 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001731 limLog(pMac, LOGP, FL("Unable to deactivate SingleShot NOA Insert timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001732 return;
1733 }
1734 val = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE;
1735 val = SYS_MS_TO_TICKS(val);
1736 if (tx_timer_change(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
1737 val, 0) != TX_SUCCESS)
1738 {
1739 /**
1740 * Could not change Single Shot NOA Insert
1741 * timer. Log error.
1742 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001743 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001744 return;
1745 }
1746 break;
Jeff Johnson62c27982013-02-27 17:53:55 -08001747
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 default:
1749 // Invalid timerId. Log error
1750 break;
1751 }
1752} /****** end limDeactivateAndChangeTimer() ******/
1753
1754
1755
1756/**---------------------------------------------------------------
1757\fn limHeartBeatDeactivateAndChangeTimer
1758\brief This function deactivates and changes the heart beat
1759\ timer, eLIM_HEART_BEAT_TIMER.
1760\
1761\param pMac
1762\param psessionEntry
1763\return None
1764------------------------------------------------------------------*/
1765void
1766limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1767{
1768 tANI_U32 val, val1;
1769
Jeff Johnsone7245742012-09-05 17:12:55 -07001770 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Yathish9f22e662012-12-10 14:21:35 -08001771#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1772 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1773 return;
1774#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001775
1776 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001777 limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001778
1779 /* HB Timer sessionisation: In case of 2 or more sessions, the HB interval keeps
1780 changing. to avoid this problem, HeartBeat interval is made constant, by
1781 fixing beacon interval to 100ms immaterial of the beacon interval of the session */
1782
1783 //val = psessionEntry->beaconParams.beaconInterval;
1784 val = LIM_HB_TIMER_BEACON_INTERVAL;
1785
1786 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001787 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_HEART_BEAT_THRESHOLD "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001788
1789 PELOGW(limLog(pMac,LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001790 FL("HB Timer Int.=100ms * %d, Beacon Int.=%dms,Session Id=%d "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001791 val1, psessionEntry->beaconParams.beaconInterval,
1792 psessionEntry->peSessionId);)
1793
1794 // Change timer to reactivate it in future
1795 val = SYS_MS_TO_TICKS(val * val1);
1796
1797 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer, val, 0) != TX_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001798 limLog(pMac, LOGP, FL("Fail to change HeartBeatTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001799
1800} /****** end limHeartBeatDeactivateAndChangeTimer() ******/
1801
1802
1803/**---------------------------------------------------------------
1804\fn limReactivateHeartBeatTimer
1805\brief This function s called to deactivate, change and
1806\ activate a timer.
1807\
1808\param pMac - Pointer to Global MAC structure
1809\param psessionEntry
1810\return None
1811------------------------------------------------------------------*/
1812void
1813limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1814{
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001815 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d"), psessionEntry->LimRxedBeaconCntDuringHB);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001816
Yathish9f22e662012-12-10 14:21:35 -08001817#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1818 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07001819 {
1820 limLog(pMac, LOGW, FL("Active offload feature is enabled, FW takes care of HB monitoring"));
Yathish9f22e662012-12-10 14:21:35 -08001821 return;
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07001822 }
Yathish9f22e662012-12-10 14:21:35 -08001823#endif
1824
Jeff Johnson295189b2012-06-20 16:38:30 -07001825 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001826 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001827
1828 //only start the hearbeat-timer if the timeout value is non-zero
1829 if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0) {
1830 if (tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
1831 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001832 limLog(pMac, LOGP,FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 }
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07001834 limLog(pMac, LOGW, FL("Reactivated heartbeat link monitoring"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 limResetHBPktCount(psessionEntry);
1836 }
1837
1838} /****** end limReactivateHeartBeatTimer() ******/
1839
Jeff Johnson295189b2012-06-20 16:38:30 -07001840
1841/**
1842 * limActivateHearBeatTimer()
1843 *
1844 *
1845 * @brief: This function is called to activate heartbeat timer
1846 *
1847 *LOGIC:
1848 *
1849 *ASSUMPTIONS:
1850 * NA
1851 *
1852 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
1853 *
1854 * @param pMac - Pointer to Global MAC structure
1855 *
1856 * @return TX_SUCCESS - timer is activated
1857 * errors - fail to start the timer
1858 */
1859v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac)
1860{
1861 v_UINT_t status = TX_TIMER_ERROR;
1862
Yathish9f22e662012-12-10 14:21:35 -08001863#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1864 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1865 return (status);
1866#endif
1867
Jeff Johnson295189b2012-06-20 16:38:30 -07001868 if(TX_AIRGO_TMR_SIGNATURE == pMac->lim.limTimers.gLimHeartBeatTimer.tmrSignature)
1869 {
1870 //consider 0 interval a ok case
1871 if( pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs )
1872 {
1873 status = tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer);
1874 if( TX_SUCCESS != status )
1875 {
1876 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001877 FL("could not activate Heartbeat timer status(%d)"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 }
1879 }
1880 else
1881 {
1882 status = TX_SUCCESS;
1883 }
1884 }
1885
1886 return (status);
1887}
1888
1889
1890
1891/**
1892 * limDeactivateAndChangePerStaIdTimer()
1893 *
1894 *
1895 * @brief: This function is called to deactivate and change a per STA timer
1896 * for future re-activation
1897 *
1898 *LOGIC:
1899 *
1900 *ASSUMPTIONS:
1901 * NA
1902 *
1903 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
1904 *
1905 * @param pMac - Pointer to Global MAC structure
1906 * @param timerId - enum of timer to be deactivated and changed
1907 * This enum is defined in limUtils.h file
1908 * @param staId - staId
1909 *
1910 * @return None
1911 */
1912
1913void
1914limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
1915{
1916 tANI_U32 val;
Jeff Johnsone7245742012-09-05 17:12:55 -07001917 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001918
1919 switch (timerId)
1920 {
1921 case eLIM_CNF_WAIT_TIMER:
1922
1923 if (tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
1924 != TX_SUCCESS)
1925 {
1926 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001927 FL("unable to deactivate CNF wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001928
1929 }
1930
1931 // Change timer to reactivate it in future
1932
1933 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
1934 &val) != eSIR_SUCCESS)
1935 {
1936 /**
1937 * Could not get cnf timeout value
1938 * from CFG. Log error.
1939 */
1940 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001941 FL("could not retrieve cnf timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 }
1943 val = SYS_MS_TO_TICKS(val);
1944
1945 if (tx_timer_change(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId],
1946 val, val) != TX_SUCCESS)
1947 {
1948 // Could not change cnf timer.
1949 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001950 limLog(pMac, LOGP, FL("unable to change cnf wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 }
1952
1953 break;
1954
1955 case eLIM_AUTH_RSP_TIMER:
1956 {
1957 tLimPreAuthNode *pAuthNode;
1958
1959 pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, staId);
1960
1961 if (pAuthNode == NULL)
1962 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001963 limLog(pMac, LOGP, FL("Invalid Pre Auth Index passed :%d"), staId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 break;
1965 }
1966
1967 if (tx_timer_deactivate(&pAuthNode->timer) != TX_SUCCESS)
1968 {
1969 // Could not deactivate auth response timer.
1970 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001971 limLog(pMac, LOGP, FL("unable to deactivate auth response timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 }
1973
1974 // Change timer to reactivate it in future
1975
1976 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, &val) != eSIR_SUCCESS)
1977 {
1978 /**
1979 * Could not get auth rsp timeout value
1980 * from CFG. Log error.
1981 */
1982 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001983 FL("could not retrieve auth response timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 }
1985
1986 val = SYS_MS_TO_TICKS(val);
1987
1988 if (tx_timer_change(&pAuthNode->timer, val, 0) != TX_SUCCESS)
1989 {
1990 // Could not change auth rsp timer.
1991 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001992 limLog(pMac, LOGP, FL("unable to change auth rsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001993 }
1994 }
1995 break;
1996
Jeff Johnson295189b2012-06-20 16:38:30 -07001997
1998 default:
1999 // Invalid timerId. Log error
2000 break;
2001
2002 }
2003}
2004
2005
2006/**
2007 * limActivateCnfTimer()
2008 *
2009 *FUNCTION:
2010 * This function is called to activate a per STA timer
2011 *
2012 *LOGIC:
2013 *
2014 *ASSUMPTIONS:
2015 * NA
2016 *
2017 *NOTE:
2018 * NA
2019 *
2020 * @param pMac - Pointer to Global MAC structure
2021 * @param StaId - staId
2022 *
2023 * @return None
2024 */
2025
2026void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
2027{
Jeff Johnsone7245742012-09-05 17:12:55 -07002028 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_CNF_WAIT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002029 pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
2030 if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2031 != TX_SUCCESS)
2032 {
2033 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002034 FL("could not activate cnf wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002035 }
2036}
2037
2038/**
2039 * limActivateAuthRspTimer()
2040 *
2041 *FUNCTION:
2042 * This function is called to activate a per STA timer
2043 *
2044 *LOGIC:
2045 *
2046 *ASSUMPTIONS:
2047 * NA
2048 *
2049 *NOTE:
2050 * NA
2051 *
2052 * @param pMac - Pointer to Global MAC structure
2053 * @param id - id
2054 *
2055 * @return None
2056 */
2057
2058void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
2059{
Jeff Johnsone7245742012-09-05 17:12:55 -07002060 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_AUTH_RESP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
2062 {
2063 /// Could not activate auth rsp timer.
2064 // Log error
2065 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002066 FL("could not activate auth rsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 }
2068}
2069
2070
2071/**
2072 * limSendDisassocFrameThresholdHandler()
2073 *
2074 *FUNCTION:
2075 * This function reloads the credit to the send disassociate frame bucket
2076 *
2077 *LOGIC:
2078 *
2079 *ASSUMPTIONS:
2080 *
2081 *NOTE:
2082 * NA
2083 *
2084 * @param
2085 *
2086 * @return None
2087 */
2088
2089void
2090limSendDisassocFrameThresholdHandler(void *pMacGlobal, tANI_U32 param)
2091{
2092 tSirMsgQ msg;
2093 tANI_U32 statusCode;
2094 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2095
2096 msg.type = SIR_LIM_HASH_MISS_THRES_TIMEOUT;
2097 msg.bodyval = 0;
2098 msg.bodyptr = NULL;
2099
2100 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2101 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002102 FL("posting to LIM failed, reason=%d"), statusCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002103
2104}
2105
2106/**
2107 * limAssocCnfWaitTmerHandler()
2108 *
2109 *FUNCTION:
2110 * This function post a message to send a disassociate frame out.
2111 *
2112 *LOGIC:
2113 *
2114 *ASSUMPTIONS:
2115 *
2116 *NOTE:
2117 * NA
2118 *
2119 * @param
2120 *
2121 * @return None
2122 */
2123
2124void
2125limCnfWaitTmerHandler(void *pMacGlobal, tANI_U32 param)
2126{
2127 tSirMsgQ msg;
2128 tANI_U32 statusCode;
2129 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2130
2131 msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
2132 msg.bodyval = (tANI_U32)param;
2133 msg.bodyptr = NULL;
2134
2135 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2136 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002137 FL("posting to LIM failed, reason=%d"), statusCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002138
2139}
2140
2141/**
2142 * limKeepaliveTmerHandler()
2143 *
2144 *FUNCTION:
2145 * This function post a message to send a NULL data frame.
2146 *
2147 *LOGIC:
2148 *
2149 *ASSUMPTIONS:
2150 *
2151 *NOTE:
2152 * NA
2153 *
2154 * @param
2155 *
2156 * @return None
2157 */
2158
2159void
2160limKeepaliveTmerHandler(void *pMacGlobal, tANI_U32 param)
2161{
2162 tSirMsgQ msg;
2163 tANI_U32 statusCode;
2164 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2165
2166 msg.type = SIR_LIM_KEEPALIVE_TIMEOUT;
2167 msg.bodyval = (tANI_U32)param;
2168 msg.bodyptr = NULL;
2169
2170 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2171 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002172 FL("posting to LIM failed, reason=%d"), statusCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002173
2174}
2175
2176void
2177limChannelSwitchTimerHandler(void *pMacGlobal, tANI_U32 param)
2178{
2179 tSirMsgQ msg;
2180 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2181
2182 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002183 FL("ChannelSwitch Timer expired. Posting msg to LIM "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002184
2185 msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
2186 msg.bodyval = (tANI_U32)param;
2187 msg.bodyptr = NULL;
2188
2189 limPostMsgApi(pMac, &msg);
2190}
2191
2192void
2193limQuietTimerHandler(void *pMacGlobal, tANI_U32 param)
2194{
2195 tSirMsgQ msg;
2196 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2197
2198 msg.type = SIR_LIM_QUIET_TIMEOUT;
2199 msg.bodyval = (tANI_U32)param;
2200 msg.bodyptr = NULL;
2201
2202 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002203 FL("Post SIR_LIM_QUIET_TIMEOUT msg. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002204 limPostMsgApi(pMac, &msg);
2205}
2206
2207void
2208limQuietBssTimerHandler(void *pMacGlobal, tANI_U32 param)
2209{
2210 tSirMsgQ msg;
2211 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2212
2213 msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
2214 msg.bodyval = (tANI_U32)param;
2215 msg.bodyptr = NULL;
2216 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002217 FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 limPostMsgApi(pMac, &msg);
2219}
Jeff Johnson295189b2012-06-20 16:38:30 -07002220#if 0
2221void
2222limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
2223{
2224 tSirMsgQ msg;
2225 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2226
2227 msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
2228 msg.bodyval = (tANI_U32)param;
2229 msg.bodyptr = NULL;
2230 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002231 FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 limPostMsgApi(pMac, &msg);
2233}
2234#endif
Yathish9f22e662012-12-10 14:21:35 -08002235
2236#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2237/* ACTIVE_MODE_HB_OFFLOAD */
2238/**
2239 * limMissedBeaconInActiveMode()
2240 *
2241 *FUNCTION:
2242 * This function handle beacon miss indication from FW
2243 * in Active mode.
2244 *
2245 *LOGIC:
2246 *
2247 *ASSUMPTIONS:
2248 * NA
2249 *
2250 *NOTE:
2251 * NA
2252 *
2253 * @param param - Msg Type
2254 *
2255 * @return None
2256 */
2257void
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002258limMissedBeaconInActiveMode(void *pMacGlobal, tpPESession psessionEntry)
Yathish9f22e662012-12-10 14:21:35 -08002259{
2260 tANI_U32 statusCode;
2261 tSirMsgQ msg;
2262 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2263
2264 // Prepare and post message to LIM Message Queue
2265 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Jeff Johnson62c27982013-02-27 17:53:55 -08002266 {
Yathish9f22e662012-12-10 14:21:35 -08002267 msg.type = (tANI_U16) SIR_LIM_HEART_BEAT_TIMEOUT;
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002268 msg.bodyptr = psessionEntry;
Yathish9f22e662012-12-10 14:21:35 -08002269 msg.bodyval = 0;
2270 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002271 FL("Heartbeat failure from Riva"));
Yathish9f22e662012-12-10 14:21:35 -08002272 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2273 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002274 FL("posting message %X to LIM failed, reason=%d"),
Yathish9f22e662012-12-10 14:21:35 -08002275 msg.type, statusCode);
2276 }
2277}
2278#endif