blob: 5a5163a4be3ded0a616407f9ab4d5967ea6bc99b [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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.
Jeff Johnson295189b2012-06-20 16:38:30 -070020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
Jeff Johnson295189b2012-06-20 16:38:30 -070022/*
Kiet Lam842dad02014-02-18 18:44:02 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file limTimerUtils.cc contains the utility functions
30 * LIM uses for handling various timers.
31 * Author: Chandra Modumudi
32 * Date: 02/13/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 */
37
38#include "limTypes.h"
39#include "limUtils.h"
40#include "limAssocUtils.h"
41#include "limSecurityUtils.h"
42#include "pmmApi.h"
Padma, Santhosh Kumarb036fc72015-11-13 16:22:23 +053043#include "limApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070044
45// default value 5000 ms for background scan period when it is disabled
46#define LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS 5000
47// channel Switch Timer in ticks
48#define LIM_CHANNEL_SWITCH_TIMER_TICKS 1
49// Lim Quite timer in ticks
50#define LIM_QUIET_TIMER_TICKS 100
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -080051// Lim Quite BSS timer interval in ticks
Jeff Johnson295189b2012-06-20 16:38:30 -070052#define LIM_QUIET_BSS_TIMER_TICK 100
53// Lim KeepAlive timer default (3000)ms
54#define LIM_KEEPALIVE_TIMER_MS 3000
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -080055// Lim JoinProbeRequest Retry timer default (200)ms
56#define LIM_JOIN_PROBE_REQ_TIMER_MS 200
Sushant Kaushik9e923872015-04-02 17:09:31 +053057#define LIM_AUTH_RETRY_TIMER_MS 60
58
Jeff Johnson295189b2012-06-20 16:38:30 -070059
60//default beacon interval value used in HB timer interval calculation
61#define LIM_HB_TIMER_BEACON_INTERVAL 100
Gopichand Nakkalad492d202013-05-10 02:50:47 +053062
Madan Mohan Koyyalamudi98b82ce2013-07-11 17:03:55 +053063/* This timer is a periodic timer which expires at every 1 sec to
Gopichand Nakkalad492d202013-05-10 02:50:47 +053064 convert ACTIVE DFS channel to DFS channels */
Madan Mohan Koyyalamudi98b82ce2013-07-11 17:03:55 +053065#define ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT 1000
Gopichand Nakkalad492d202013-05-10 02:50:47 +053066
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +053067#ifdef WLAN_FEATURE_LFR_MBB
68#define PREAUTH_REASSOC_TIMEOUT 500
69#endif
70
Jeff Johnson295189b2012-06-20 16:38:30 -070071/**
72 * limCreateTimers()
73 *
74 *FUNCTION:
75 * This function is called upon receiving
76 * 1. SME_START_REQ for STA in ESS role
77 * 2. SME_START_BSS_REQ for AP role & STA in IBSS role
78 *
79 *LOGIC:
80 *
81 *ASSUMPTIONS:
82 * NA
83 *
84 *NOTE:
85 * NA
86 *
87 * @param pMac - Pointer to Global MAC structure
88 *
89 * @return None
90 */
91
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -070092v_UINT_t
Jeff Johnson295189b2012-06-20 16:38:30 -070093limCreateTimers(tpAniSirGlobal pMac)
94{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -070095 tANI_U32 cfgValue, i=0;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -080096 tANI_U32 cfgValue1;
Jeff Johnson295189b2012-06-20 16:38:30 -070097
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -070098 PELOG1(limLog(pMac, LOG1, FL("Creating Timers used by LIM module in Role %d"), pMac->lim.gLimSystemRole);)
Jeff Johnson295189b2012-06-20 16:38:30 -070099
100 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
101 &cfgValue) != eSIR_SUCCESS)
102 {
103 /**
104 * Could not get MinChannelTimeout value
105 * from CFG. Log error.
106 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700107 limLog(pMac, LOGP, FL("could not retrieve MinChannelTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700108 }
109 cfgValue = SYS_MS_TO_TICKS(cfgValue);
110
111 // Create MIN/MAX channel timers and activate them later
112 if (tx_timer_create(&pMac->lim.limTimers.gLimMinChannelTimer,
113 "MIN CHANNEL TIMEOUT",
114 limTimerHandler, SIR_LIM_MIN_CHANNEL_TIMEOUT,
115 cfgValue, 0,
116 TX_NO_ACTIVATE) != TX_SUCCESS)
117 {
118 /// Could not start min channel timer.
119 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700120 limLog(pMac, LOGP, FL("could not create MIN channel timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700121 return TX_TIMER_ERROR;
Jeff Johnson295189b2012-06-20 16:38:30 -0700122 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700123 PELOG2(limLog(pMac, LOG2, FL("Created MinChannelTimer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700124
125 /* Periodic probe request timer value is half of the Min channel
126 * timer. Probe request sends periodically till min/max channel
127 * timer expires
128 */
129
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800130 cfgValue1 = cfgValue/2 ;
131 if( cfgValue1 >= 1)
Jeff Johnson295189b2012-06-20 16:38:30 -0700132 {
133 // Create periodic probe request timer and activate them later
134 if (tx_timer_create(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
135 "Periodic Probe Request Timer",
136 limTimerHandler, SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT,
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800137 cfgValue1, 0,
Jeff Johnson295189b2012-06-20 16:38:30 -0700138 TX_NO_ACTIVATE) != TX_SUCCESS)
139 {
140 /// Could not start Periodic Probe Req timer.
141 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700142 limLog(pMac, LOGP, FL("could not create periodic probe timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700143 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700144 }
145 }
146
147
148 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
149 &cfgValue) != eSIR_SUCCESS)
150 {
151 /**
152 * Could not get MAXChannelTimeout value
153 * from CFG. Log error.
154 */
155 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700156 FL("could not retrieve MAXChannelTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700157 }
158 cfgValue = SYS_MS_TO_TICKS(cfgValue);
159
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800160 /* Limiting max numm of probe req for each channel scan */
161 pMac->lim.maxProbe = (cfgValue/cfgValue1);
162
Jeff Johnson295189b2012-06-20 16:38:30 -0700163 if (tx_timer_create(&pMac->lim.limTimers.gLimMaxChannelTimer,
164 "MAX CHANNEL TIMEOUT",
165 limTimerHandler, SIR_LIM_MAX_CHANNEL_TIMEOUT,
166 cfgValue, 0,
167 TX_NO_ACTIVATE) != TX_SUCCESS)
168 {
169 /// Could not start max channel timer.
170 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700171 limLog(pMac, LOGP, FL("could not create MAX channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700172
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700173 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700174 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700175 PELOG2(limLog(pMac, LOG2, FL("Created MaxChannelTimer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700176
177 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
178 {
179 // Create Channel Switch Timer
180 if (tx_timer_create(&pMac->lim.limTimers.gLimChannelSwitchTimer,
181 "CHANNEL SWITCH TIMER",
182 limChannelSwitchTimerHandler,
183 0, // expiration_input
184 LIM_CHANNEL_SWITCH_TIMER_TICKS, // initial_ticks
185 0, // reschedule_ticks
186 TX_NO_ACTIVATE) != TX_SUCCESS)
187 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700188 limLog(pMac, LOGP, FL("failed to create Channel Switch timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700189 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700190 }
191
192 //
193 // Create Quiet Timer
194 // This is used on the STA to go and shut-off
195 // Tx/Rx "after" the specified quiteInterval
196 //
197 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietTimer,
198 "QUIET TIMER",
199 limQuietTimerHandler,
200 SIR_LIM_QUIET_TIMEOUT, // expiration_input
201 LIM_QUIET_TIMER_TICKS, // initial_ticks
202 0, // reschedule_ticks
203 TX_NO_ACTIVATE) != TX_SUCCESS)
204 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700205 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700206 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 }
208
209 //
210 // Create Quiet BSS Timer
211 // After the specified quiteInterval, determined by
212 // gLimQuietTimer, this timer, gLimQuietBssTimer,
213 // trigger and put the STA to sleep for the specified
214 // gLimQuietDuration
215 //
216 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietBssTimer,
217 "QUIET BSS TIMER",
218 limQuietBssTimerHandler,
219 SIR_LIM_QUIET_BSS_TIMEOUT, // expiration_input
220 LIM_QUIET_BSS_TIMER_TICK, // initial_ticks
221 0, // reschedule_ticks
222 TX_NO_ACTIVATE) != TX_SUCCESS)
223 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700224 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700225 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700226 }
227
228 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
229 &cfgValue) != eSIR_SUCCESS)
230 {
231 /**
232 * Could not get JoinFailureTimeout value
233 * from CFG. Log error.
234 */
235 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700236 FL("could not retrieve JoinFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700237 }
238 cfgValue = SYS_MS_TO_TICKS(cfgValue);
239
240 // Create Join failure timer and activate it later
241 if (tx_timer_create(&pMac->lim.limTimers.gLimJoinFailureTimer,
242 "JOIN FAILURE TIMEOUT",
243 limTimerHandler, SIR_LIM_JOIN_FAIL_TIMEOUT,
244 cfgValue, 0,
245 TX_NO_ACTIVATE) != TX_SUCCESS)
246 {
247 /// Could not create Join failure timer.
248 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700249 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700250
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700251 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700252 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800253
Jeff Johnson62c27982013-02-27 17:53:55 -0800254 //Send unicast probe req frame every 200 ms
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800255 if ((tx_timer_create(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
256 "Periodic Join Probe Request Timer",
257 limTimerHandler, SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT,
258 SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS), 0,
259 TX_NO_ACTIVATE)) != TX_SUCCESS)
260 {
261 /// Could not create Periodic Join Probe Request timer.
262 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700263 limLog(pMac, LOGP, FL("could not create Periodic Join Probe Request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800264 goto err_timer;
265 }
Sushant Kaushik9e923872015-04-02 17:09:31 +0530266 //Send Auth frame every 60 ms
267 if ((tx_timer_create(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer,
268 "Periodic AUTH Timer",
269 limTimerHandler, SIR_LIM_AUTH_RETRY_TIMEOUT,
270 SYS_MS_TO_TICKS(LIM_AUTH_RETRY_TIMER_MS), 0,
271 TX_NO_ACTIVATE)) != TX_SUCCESS)
272 {
273 /// Could not create Periodic Join Probe Request timer.
274 // Log error
275 limLog(pMac, LOGP, FL("could not create Periodic AUTH Timer timer"));
276 goto err_timer;
277 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
279 &cfgValue) != eSIR_SUCCESS)
280 {
281 /**
282 * Could not get AssocFailureTimeout value
283 * from CFG. Log error.
284 */
285 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700286 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 }
288 cfgValue = SYS_MS_TO_TICKS(cfgValue);
289
290 // Create Association failure timer and activate it later
291 if (tx_timer_create(&pMac->lim.limTimers.gLimAssocFailureTimer,
292 "ASSOC FAILURE TIMEOUT",
293 limAssocFailureTimerHandler, LIM_ASSOC,
294 cfgValue, 0,
295 TX_NO_ACTIVATE) != TX_SUCCESS)
296 {
297 /// Could not create Assoc failure timer.
298 // Log error
299 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700300 FL("could not create Association failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700301
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700302 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 }
304 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
305 &cfgValue) != eSIR_SUCCESS)
306 {
307 /**
308 * Could not get ReassocFailureTimeout value
309 * from CFG. Log error.
310 */
311 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700312 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 }
314 cfgValue = SYS_MS_TO_TICKS(cfgValue);
315
316 // Create Association failure timer and activate it later
317 if (tx_timer_create(&pMac->lim.limTimers.gLimReassocFailureTimer,
318 "REASSOC FAILURE TIMEOUT",
319 limAssocFailureTimerHandler, LIM_REASSOC,
320 cfgValue, 0,
321 TX_NO_ACTIVATE) != TX_SUCCESS)
322 {
323 /// Could not create Reassoc failure timer.
324 // Log error
325 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700326 FL("could not create Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700327
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700328 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 }
330
331 if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &cfgValue) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700332 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_ADDTS_RSP_TIMEOUT "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700333
334 cfgValue = SYS_MS_TO_TICKS(cfgValue);
335
336 // Create Addts response timer and activate it later
337 if (tx_timer_create(&pMac->lim.limTimers.gLimAddtsRspTimer,
338 "ADDTS RSP TIMEOUT",
339 limAddtsResponseTimerHandler,
340 SIR_LIM_ADDTS_RSP_TIMEOUT,
341 cfgValue, 0,
342 TX_NO_ACTIVATE) != TX_SUCCESS)
343 {
344 /// Could not create Auth failure timer.
345 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700346 limLog(pMac, LOGP, FL("could not create Addts response timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700347
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700348 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 }
350
351 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
352 &cfgValue) != eSIR_SUCCESS)
353 {
354 /**
355 * Could not get AuthFailureTimeout value
356 * from CFG. Log error.
357 */
358 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700359 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 }
361 cfgValue = SYS_MS_TO_TICKS(cfgValue);
362
363 // Create Auth failure timer and activate it later
364 if (tx_timer_create(&pMac->lim.limTimers.gLimAuthFailureTimer,
365 "AUTH FAILURE TIMEOUT",
366 limTimerHandler,
367 SIR_LIM_AUTH_FAIL_TIMEOUT,
368 cfgValue, 0,
369 TX_NO_ACTIVATE) != TX_SUCCESS)
370 {
371 /// Could not create Auth failure timer.
372 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700373 limLog(pMac, LOGP, FL("could not create Auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700374
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700375 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 }
Jeff Johnson41707a42013-02-14 07:54:26 -0800377
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
379 &cfgValue) != eSIR_SUCCESS)
380 {
381 /**
382 * Could not get BEACON_INTERVAL value
383 * from CFG. Log error.
384 */
385 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700386 FL("could not retrieve BEACON_INTERVAL value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 }
388 cfgValue = SYS_MS_TO_TICKS(cfgValue);
389
390 if (tx_timer_create(&pMac->lim.limTimers.gLimHeartBeatTimer,
391 "Heartbeat TIMEOUT",
392 limTimerHandler,
393 SIR_LIM_HEART_BEAT_TIMEOUT,
394 cfgValue,
395 0,
396 TX_NO_ACTIVATE) != TX_SUCCESS)
397 {
398 /// Could not start Heartbeat timer.
399 // Log error
400 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700401 FL("call to create heartbeat timer failed"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700402 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 }
404
405 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
406 &cfgValue) != eSIR_SUCCESS)
407 {
408 /**
409 * Could not get PROBE_AFTER_HB_FAILURE
410 * value from CFG. Log error.
411 */
412 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700413 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 }
415
416 // Change timer to reactivate it in future
417 cfgValue = SYS_MS_TO_TICKS(cfgValue);
418
419 if (tx_timer_create(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
420 "Probe after Heartbeat TIMEOUT",
421 limTimerHandler,
422 SIR_LIM_PROBE_HB_FAILURE_TIMEOUT,
423 cfgValue,
424 0,
425 TX_NO_ACTIVATE) != TX_SUCCESS)
426 {
427 // Could not creat wt-probe-after-HeartBeat-failure timer.
428 // Log error
429 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700430 FL("unable to create ProbeAfterHBTimer"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700431 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 }
433
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
435 &cfgValue) != eSIR_SUCCESS)
436 {
437 /**
438 * Could not get Background scan period value
439 * from CFG. Log error.
440 */
441 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700442 FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 }
444
445 /*
446 * setting period to zero means disabling background scans when associated
447 * the way we do this is to set a flag indicating this and keeping
448 * the timer running, since it will be used for PDU leak workarounds
449 * as well as background scanning during SME idle states
450 */
451 if (cfgValue == 0)
452 {
453 cfgValue = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
454 pMac->lim.gLimBackgroundScanDisable = true;
455 }
456 else
457 pMac->lim.gLimBackgroundScanDisable = false;
458
459 cfgValue = SYS_MS_TO_TICKS(cfgValue);
460
461 if (tx_timer_create(&pMac->lim.limTimers.gLimBackgroundScanTimer,
462 "Background scan TIMEOUT",
463 limTimerHandler,
464 SIR_LIM_CHANNEL_SCAN_TIMEOUT,
465 cfgValue,
466 cfgValue,
467 TX_NO_ACTIVATE) != TX_SUCCESS)
468 {
469 /// Could not start background scan timer.
470 // Log error
471 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700472 FL("call to create background scan timer failed"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700473 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 }
476
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 /**
478 * Create keepalive timer and activate it right away for AP role
479 */
480
481 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
482 &cfgValue) != eSIR_SUCCESS)
483 {
484 /**
485 * Could not get keepalive timeout value
486 * from CFG. Log error.
487 */
488 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700489 FL("could not retrieve keepalive timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 }
491
492 // A value of zero implies keep alive should be disabled
493 if (cfgValue == 0)
494 {
495 cfgValue = LIM_KEEPALIVE_TIMER_MS;
496 pMac->sch.keepAlive = 0;
497 } else
498 pMac->sch.keepAlive = 1;
499
500
501 cfgValue = SYS_MS_TO_TICKS(cfgValue + SYS_TICK_DUR_MS - 1);
502
503 if (tx_timer_create(&pMac->lim.limTimers.gLimKeepaliveTimer,
504 "KEEPALIVE_TIMEOUT",
505 limKeepaliveTmerHandler,
506 0,
507 cfgValue,
508 cfgValue,
509 (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ?
510 TX_AUTO_ACTIVATE : TX_NO_ACTIVATE)
511 != TX_SUCCESS)
512 {
513 // Cannot create keepalive timer. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700514 limLog(pMac, LOGP, FL("Cannot create keepalive timer."));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700515 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 }
517
518 /**
519 * Create all CNF_WAIT Timers upfront
520 */
521
522 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
523 &cfgValue) != eSIR_SUCCESS)
524 {
525 /**
526 * Could not get CNF_WAIT timeout value
527 * from CFG. Log error.
528 */
529 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700530 FL("could not retrieve CNF timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 }
532 cfgValue = SYS_MS_TO_TICKS(cfgValue);
533
534 for (i=0; i<pMac->lim.maxStation; i++)
535 {
536 if (tx_timer_create(&pMac->lim.limTimers.gpLimCnfWaitTimer[i],
537 "CNF_MISS_TIMEOUT",
538 limCnfWaitTmerHandler,
539 (tANI_U32)i,
540 cfgValue,
541 0,
542 TX_NO_ACTIVATE) != TX_SUCCESS)
543 {
544 // Cannot create timer. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700545 limLog(pMac, LOGP, FL("Cannot create CNF wait timer."));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700546 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 }
548 }
549
550 /*
551 ** Alloc and init table for the preAuth timer list
552 **
553 **/
554
555 // get max number of Preauthentication
556 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
557 &cfgValue) != eSIR_SUCCESS)
558 {
559 /*
560 ** Could not get max preauth value
561 ** from CFG. Log error.
562 **/
563 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700564 FL("could not retrieve mac preauth value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 pMac->lim.gLimPreAuthTimerTable.numEntry = cfgValue;
Sushant Kaushikf4a27972015-04-16 16:48:00 +0530567 pMac->lim.gLimPreAuthTimerTable.pTable = vos_mem_vmalloc(cfgValue*sizeof(tLimPreAuthNode));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530568 if(pMac->lim.gLimPreAuthTimerTable.pTable == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530570 limLog(pMac, LOGP, FL("AllocateMemory failed!"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700571 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 }
573
574 limInitPreAuthTimerTable(pMac, &pMac->lim.gLimPreAuthTimerTable);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700575 PELOG1(limLog(pMac, LOG1, FL("alloc and init table for preAuth timers"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700576
577
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 {
579 /**
580 * Create OLBC cache aging timer
581 */
582 if (wlan_cfgGetInt(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT,
583 &cfgValue) != eSIR_SUCCESS)
584 {
585 /**
586 * Could not get OLBC detect timeout value
587 * from CFG. Log error.
588 */
589 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700590 FL("could not retrieve OLBD detect timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 }
592
593 cfgValue = SYS_MS_TO_TICKS(cfgValue);
594
595 if (tx_timer_create(
596 &pMac->lim.limTimers.gLimUpdateOlbcCacheTimer,
597 "OLBC UPDATE CACHE TIMEOUT",
598 limUpdateOlbcCacheTimerHandler,
599 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
600 cfgValue,
601 cfgValue,
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -0700602 TX_NO_ACTIVATE) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 {
604 // Cannot create update OLBC cache timer
605 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700606 limLog(pMac, LOGP, FL("Cannot create update OLBC cache timer"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700607 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 }
609 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700610#ifdef WLAN_FEATURE_VOWIFI_11R
611 // In future we need to use the auth timer, cause
612 // the pre auth session will be introduced before sending
613 // Auth frame.
614 // We need to go off channel and come back to home channel
615 cfgValue = 1000;
616 cfgValue = SYS_MS_TO_TICKS(cfgValue);
617
618 if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
619 "FT PREAUTH RSP TIMEOUT",
620 limTimerHandler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT,
621 cfgValue, 0,
622 TX_NO_ACTIVATE) != TX_SUCCESS)
623 {
624 // Could not create Join failure timer.
625 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700626 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700627 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 }
629#endif
630
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530631#ifdef WLAN_FEATURE_LFR_MBB
632 cfgValue = PREAUTH_REASSOC_TIMEOUT;
633 cfgValue = SYS_MS_TO_TICKS(cfgValue);
634
635 if (tx_timer_create(&pMac->lim.limTimers.glim_pre_auth_mbb_rsp_timer,
636 "PREAUTH MBB RSP TIMEOUT",
637 limTimerHandler, SIR_LIM_PREAUTH_MBB_RSP_TIMEOUT,
638 cfgValue, 0,
639 TX_NO_ACTIVATE) != TX_SUCCESS)
640 {
641 limLog(pMac, LOGP, FL("could not create PREAUTH_MBB_RSP timer"));
642 goto err_timer;
643 }
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +0530644
645 cfgValue = PREAUTH_REASSOC_TIMEOUT;
646 cfgValue = SYS_MS_TO_TICKS(cfgValue);
647
648 if (tx_timer_create(&pMac->lim.limTimers.glim_reassoc_mbb_rsp_timer,
649 "REASSOC MBB RSP TIMEOUT",
650 limTimerHandler, SIR_LIM_REASSOC_MBB_RSP_TIMEOUT,
651 cfgValue, 0,
652 TX_NO_ACTIVATE) != TX_SUCCESS)
653 {
654 limLog(pMac, LOGP, FL("could not create REASSOC_MBB_RSP timer"));
655 goto err_timer;
656 }
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530657#endif
658
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800659#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 cfgValue = 5000;
661 cfgValue = SYS_MS_TO_TICKS(cfgValue);
662
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800663 if (tx_timer_create(&pMac->lim.limTimers.gLimEseTsmTimer,
664 "ESE TSM Stats TIMEOUT",
665 limTimerHandler, SIR_LIM_ESE_TSM_TIMEOUT,
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 cfgValue, 0,
667 TX_NO_ACTIVATE) != TX_SUCCESS)
668 {
669 // Could not create Join failure timer.
670 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700671 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700672 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800674#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700675
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 cfgValue = 1000;
677 cfgValue = SYS_MS_TO_TICKS(cfgValue);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800678 if (tx_timer_create(&pMac->lim.limTimers.gLimDisassocAckTimer,
679 "DISASSOC ACK TIMEOUT",
680 limTimerHandler, SIR_LIM_DISASSOC_ACK_TIMEOUT,
681 cfgValue, 0,
682 TX_NO_ACTIVATE) != TX_SUCCESS)
683 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700684 limLog(pMac, LOGP, FL("could not DISASSOC ACK TIMEOUT timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800685 goto err_timer;
686 }
687
688 cfgValue = 1000;
689 cfgValue = SYS_MS_TO_TICKS(cfgValue);
690 if (tx_timer_create(&pMac->lim.limTimers.gLimDeauthAckTimer,
691 "DISASSOC ACK TIMEOUT",
Viral Modid86bde22012-12-10 13:09:21 -0800692 limTimerHandler, SIR_LIM_DEAUTH_ACK_TIMEOUT,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800693 cfgValue, 0,
694 TX_NO_ACTIVATE) != TX_SUCCESS)
695 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700696 limLog(pMac, LOGP, FL("could not create DEAUTH ACK TIMEOUT timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800697 goto err_timer;
698 }
Viral Modid86bde22012-12-10 13:09:21 -0800699
Viral Modid86bde22012-12-10 13:09:21 -0800700 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)
701 cfgValue = SYS_MS_TO_TICKS(cfgValue);
702 if (tx_timer_create(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
703 "Single Shot NOA Insert timeout",
704 limTimerHandler, SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT,
705 cfgValue, 0,
706 TX_NO_ACTIVATE) != TX_SUCCESS)
707 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700708 limLog(pMac, LOGP, FL("could not create Single Shot NOA Insert Timeout timer"));
Viral Modid86bde22012-12-10 13:09:21 -0800709 goto err_timer;
710 }
Viral Modid86bde22012-12-10 13:09:21 -0800711
Hanumantha Reddy Pothula97ea0952015-10-09 11:29:39 +0530712 cfgValue = WNI_CFG_ACTIVE_PASSIVE_CON_MAX;
713 if (eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_PASSIVE_CON,
Hanumantha Reddy Pothula802d31d2015-09-29 17:39:11 +0530714 &cfgValue))
715 {
716 limLog(pMac, LOGP,
717 FL("could not retrieve WNI_CFG_ACTIVE_PASSIVE_CON"));
718 }
719 if (cfgValue)
720 {
721 cfgValue = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
722 cfgValue = SYS_MS_TO_TICKS(cfgValue);
723 if (tx_timer_create(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer,
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530724 "ACTIVE TO PASSIVE CHANNEL", limTimerHandler,
725 SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE, cfgValue, 0,
726 TX_NO_ACTIVATE) != TX_SUCCESS)
Hanumantha Reddy Pothula802d31d2015-09-29 17:39:11 +0530727 {
728 limLog(pMac, LOGW,FL("could not create timer for passive channel to active channel"));
729 goto err_timer;
730 }
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530731 }
Hanumantha Reddy Pothula802d31d2015-09-29 17:39:11 +0530732 else
733 {
734 limLog(pMac, LOG1,
735 FL("gLimActiveToPassiveChannelTimer not created %d"), cfgValue);
736 }
Abhishek Singh550aa8c2017-10-30 17:34:53 +0530737 cfgValue = WNI_CFG_BEACON_INTERVAL_STADEF;
738 cfgValue = SYS_MS_TO_TICKS(cfgValue);
739 if (tx_timer_create(&pMac->lim.limTimers.g_lim_ap_ecsa_timer,
740 "AP ECSA TIMER", limTimerHandler,
741 SIR_LIM_SAP_ECSA_TIMEOUT,
742 cfgValue, 0,
743 TX_NO_ACTIVATE) != TX_SUCCESS)
744 {
745 limLog(pMac, LOGW,FL("could not create timer for passive channel to active channel"));
746 goto err_timer;
747 }
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530748
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700749 return TX_SUCCESS;
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700750
751 err_timer:
Viral Modid86bde22012-12-10 13:09:21 -0800752 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800753 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800754#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
755 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
756#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700757 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530758#ifdef WLAN_FEATURE_LFR_MBB
759 tx_timer_delete(&pMac->lim.limTimers.glim_pre_auth_mbb_rsp_timer);
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +0530760 tx_timer_delete(&pMac->lim.limTimers.glim_reassoc_mbb_rsp_timer);
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530761#endif
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700762 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
763 while(((tANI_S32)--i) >= 0)
764 {
765 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[i]);
766 }
767 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700768 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
769 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
770 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
771 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
772 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
773 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
774 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
Jeff Johnson62c27982013-02-27 17:53:55 -0800775 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800776 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
Sushant Kaushik9e923872015-04-02 17:09:31 +0530777 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700778 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
779 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
780 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
781 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
782 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
783 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
Venkata Prathyusha Kuntupalli7a87ff02013-01-29 10:45:54 -0800784 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530785 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
Abhishek Singh550aa8c2017-10-30 17:34:53 +0530786 tx_timer_delete(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700787
788 if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800789 {
Sushant Kaushikf4a27972015-04-16 16:48:00 +0530790 vos_mem_vfree(pMac->lim.gLimPreAuthTimerTable.pTable);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800791 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
792 }
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700793
794 return TX_TIMER_ERROR;
795
Jeff Johnson295189b2012-06-20 16:38:30 -0700796} /****** end limCreateTimers() ******/
797
798
799
800/**
801 * limTimerHandler()
802 *
803 *FUNCTION:
804 * This function is called upon
805 * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
806 * 2. JOIN_FAILURE timer expiration while joining a BSS
807 * 3. AUTH_FAILURE timer expiration while authenticating with a peer
808 * 4. Heartbeat timer expiration on STA
809 * 5. Background scan timer expiration on STA
810 * 6. AID release, Pre-auth cleanup and Link monitoring timer
811 * expiration on AP
812 *
813 *LOGIC:
814 *
815 *ASSUMPTIONS:
816 * NA
817 *
818 *NOTE:
819 * NA
820 *
821 * @param param - Message corresponding to the timer that expired
822 *
823 * @return None
824 */
825
826void
827limTimerHandler(void *pMacGlobal, tANI_U32 param)
828{
829 tANI_U32 statusCode;
830 tSirMsgQ msg;
831 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
832
833 // Prepare and post message to LIM Message Queue
834
835 msg.type = (tANI_U16) param;
836 msg.bodyptr = NULL;
837 msg.bodyval = 0;
838
Padma, Santhosh Kumarb036fc72015-11-13 16:22:23 +0530839 if ((statusCode = limPostMsgApiHighPri(pMac, &msg)) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700841 FL("posting message %X to LIM failed, reason=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 msg.type, statusCode);
843} /****** end limTimerHandler() ******/
844
845
846/**
847 * limAddtsResponseTimerHandler()
848 *
849 *FUNCTION:
850 * This function is called upon Addts response timer expiration on sta
851 *
852 *LOGIC:
853 * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
854 * when this function is executed.
855 *
856 *ASSUMPTIONS:
857 * NA
858 *
859 *NOTE:
860 * NA
861 *
862 * @param param - pointer to pre-auth node
863 *
864 * @return None
865 */
866
867void
868limAddtsResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
869{
870 tSirMsgQ msg;
871 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
872
873 // Prepare and post message to LIM Message Queue
874
875 msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
876 msg.bodyval = param;
877 msg.bodyptr = NULL;
878
879 limPostMsgApi(pMac, &msg);
880} /****** end limAuthResponseTimerHandler() ******/
881
882
883/**
884 * limAuthResponseTimerHandler()
885 *
886 *FUNCTION:
887 * This function is called upon Auth response timer expiration on AP
888 *
889 *LOGIC:
890 * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
891 * when this function is executed.
892 *
893 *ASSUMPTIONS:
894 * NA
895 *
896 *NOTE:
897 * NA
898 *
899 * @param param - pointer to pre-auth node
900 *
901 * @return None
902 */
903
904void
905limAuthResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
906{
907 tSirMsgQ msg;
908 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
909
910 // Prepare and post message to LIM Message Queue
911
912 msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
913 msg.bodyptr = NULL;
914 msg.bodyval = (tANI_U32)param;
915
916 limPostMsgApi(pMac, &msg);
917} /****** end limAuthResponseTimerHandler() ******/
918
919
920
921/**
922 * limAssocFailureTimerHandler()
923 *
924 *FUNCTION:
925 * This function is called upon Re/Assoc failure timer expiration
926 * on STA
927 *
928 *LOGIC:
929 * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ
930 * when this function is executed.
931 *
932 *ASSUMPTIONS:
933 * NA
934 *
935 *NOTE:
936 * NA
937 *
938 * @param param - Indicates whether this is assoc or reassoc
939 * failure timeout
940 * @return None
941 */
942
943void
944limAssocFailureTimerHandler(void *pMacGlobal, tANI_U32 param)
945{
946 tSirMsgQ msg;
947 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
948
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800949#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700950 if((LIM_REASSOC == param) &&
Kanchanapally, Vidyullathab6da2a62014-02-06 12:28:52 +0530951 (NULL != pMac->lim.pSessionEntry) &&
952 (pMac->lim.pSessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE))
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700953 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700954 limLog(pMac, LOGE, FL("Reassoc timeout happened"));
Sachin Ahuja07a43012015-01-30 17:04:38 +0530955#ifdef FEATURE_WLAN_ESE
956 if (((pMac->lim.pSessionEntry->isESEconnection) &&
957 (pMac->lim.reAssocRetryAttempt <
958 (LIM_MAX_REASSOC_RETRY_LIMIT - 1)))||
959 ((!pMac->lim.pSessionEntry->isESEconnection) &&
960 (pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT))
961 )
962#else
963 if (pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT)
964#endif
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700965 {
966 limSendRetryReassocReqFrame(pMac, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, pMac->lim.pSessionEntry);
967 pMac->lim.reAssocRetryAttempt++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700968 limLog(pMac, LOGW, FL("Reassoc request retry is sent %d times"), pMac->lim.reAssocRetryAttempt);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700969 return;
970 }
971 else
972 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700973 limLog(pMac, LOGW, FL("Reassoc request retry MAX(%d) reached"), LIM_MAX_REASSOC_RETRY_LIMIT);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700974 if(NULL != pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
975 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530976 vos_mem_free( pMac->lim.pSessionEntry->pLimMlmReassocRetryReq);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700977 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = NULL;
978 }
979 }
980 }
981#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700982 // Prepare and post message to LIM Message Queue
983
984 msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
985 msg.bodyval = (tANI_U32)param;
986 msg.bodyptr = NULL;
987
988 limPostMsgApi(pMac, &msg);
989} /****** end limAssocFailureTimerHandler() ******/
990
991
992/**
993 * limUpdateOlbcCacheTimerHandler()
994 *
995 *FUNCTION:
996 * This function is called upon update olbc cache timer expiration
997 * on STA
998 *
999 *LOGIC:
1000 * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
1001 * when this function is executed.
1002 *
1003 *ASSUMPTIONS:
1004 * NA
1005 *
1006 *NOTE:
1007 * NA
1008 *
1009 * @param
1010 *
1011 * @return None
1012 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001013void
1014limUpdateOlbcCacheTimerHandler(void *pMacGlobal, tANI_U32 param)
1015{
1016 tSirMsgQ msg;
1017 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
1018
1019 // Prepare and post message to LIM Message Queue
1020
1021 msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
1022 msg.bodyval = 0;
1023 msg.bodyptr = NULL;
1024
1025 limPostMsgApi(pMac, &msg);
1026} /****** end limUpdateOlbcCacheTimerHandler() ******/
Jeff Johnson295189b2012-06-20 16:38:30 -07001027
1028/**
1029 * limDeactivateAndChangeTimer()
1030 *
1031 *FUNCTION:
1032 * This function is called to deactivate and change a timer
1033 * for future re-activation
1034 *
1035 *LOGIC:
1036 *
1037 *ASSUMPTIONS:
1038 * NA
1039 *
1040 *NOTE:
1041 * NA
1042 *
1043 * @param pMac - Pointer to Global MAC structure
1044 * @param timerId - enum of timer to be deactivated and changed
1045 * This enum is defined in limUtils.h file
1046 *
1047 * @return None
1048 */
1049
1050void
1051limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1052{
1053 tANI_U32 val=0, val1=0;
Sushant Kaushik9e923872015-04-02 17:09:31 +05301054 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001055
Jeff Johnson295189b2012-06-20 16:38:30 -07001056 switch (timerId)
1057 {
1058 case eLIM_ADDTS_RSP_TIMER:
1059 pMac->lim.gLimAddtsRspTimerCount++;
1060 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
1061 {
1062 // Could not deactivate AddtsRsp Timer
1063 // Log error
1064 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001065 FL("Unable to deactivate AddtsRsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 }
1067 break;
1068
1069 case eLIM_MIN_CHANNEL_TIMER:
1070 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer)
1071 != TX_SUCCESS)
1072 {
1073 // Could not deactivate min channel timer.
1074 // Log error
1075 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001076 FL("Unable to deactivate min channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001077 }
1078
Jeff Johnsone7245742012-09-05 17:12:55 -07001079#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 // If a background was triggered via Quiet BSS,
1081 // then we need to adjust the MIN and MAX channel
1082 // timer's accordingly to the Quiet duration that
1083 // was specified
1084 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1085 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1086 {
1087 // gLimQuietDuration is already cached in units of
1088 // system ticks. No conversion is reqd...
1089 val = pMac->lim.gLimSpecMgmt.quietDuration;
1090 }
1091 else
1092 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001093#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001094 if(pMac->lim.gpLimMlmScanReq)
1095 {
1096 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301097 if (pMac->btc.btc_scan_compromise_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001098 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301099 if (pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001100 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301101 val = SYS_MS_TO_TICKS(
1102 pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001103 limLog(pMac, LOG1, FL("Using BTC Min Active Scan time"));
1104 }
1105 else
1106 {
1107 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1108 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301109 } else if (pMac->btc.btc_scan_compromise_sco &&
1110 pMac->roam.configParam.min_chntime_btc_sco) {
1111 val = SYS_MS_TO_TICKS(
1112 pMac->roam.configParam.min_chntime_btc_sco);
1113 limLog(pMac, LOG1,
1114 FL("Using BTC SCO Min Active Scan time %d"), val);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001115 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 }
1117 else
1118 {
1119 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1120 //No need to change min timer. This is not a scan
1121 break;
1122 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001123#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001125#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001126
1127 if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
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 min channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 }
1134
1135 break;
1136
1137 case eLIM_PERIODIC_PROBE_REQ_TIMER:
1138 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
1139 != TX_SUCCESS)
1140 {
1141 // Could not deactivate min channel timer.
1142 // Log error
1143 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001144 FL("Unable to deactivate periodic timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 }
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301146 if(pMac->lim.gpLimMlmScanReq)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001147 {
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301148 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301149 if (pMac->btc.btc_scan_compromise_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301150 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301151 if (pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301152 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301153 val = SYS_MS_TO_TICKS(
1154 pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)/2;
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301155 limLog(pMac, LOG1, FL("Using BTC Min Active Scan time"));
1156 }
1157 else
1158 {
1159 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1160 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301161 } else if (pMac->btc.btc_scan_compromise_sco &&
1162 pMac->roam.configParam.min_chntime_btc_sco) {
1163 val = SYS_MS_TO_TICKS(
1164 pMac->roam.configParam.min_chntime_btc_sco / 2);
1165 limLog(pMac, LOG1,
1166 FL("Using BTC SCO Min Active Scan time %d"), val);
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301167 }
1168 }
1169 /*If val is 0 it means min Channel timer is 0 so take the value from maxChannelTimer*/
1170 if (!val)
1171 {
1172
1173 if(pMac->lim.gpLimMlmScanReq)
1174 {
1175 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime)/2;
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301176 if (pMac->btc.btc_scan_compromise_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301177 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301178 if (pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301179 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301180 val = SYS_MS_TO_TICKS(
1181 pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)/2;
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301182 limLog(pMac, LOG1, FL("Using BTC Max Active Scan time"));
1183 }
1184 else
1185 {
1186 limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set"));
1187 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301188 } else if (pMac->btc.btc_scan_compromise_sco &&
1189 pMac->roam.configParam.max_chntime_btc_sco) {
1190 val = SYS_MS_TO_TICKS(
1191 pMac->roam.configParam.max_chntime_btc_sco / 2);
1192 limLog(pMac, LOG1,
1193 FL("Using BTC SCO Max Active Scan time %d"), val);
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301194 }
1195 }
1196 else
1197 {
1198 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1199 //No need to change max timer. This is not a scan
1200 break;
1201 }
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001202 }
Mahesh A Saptasagarbfcdcc32015-09-24 17:41:51 +05301203 if (val)
Jeff Johnson295189b2012-06-20 16:38:30 -07001204 {
Mahesh A Saptasagarbfcdcc32015-09-24 17:41:51 +05301205 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
1206 val, 0) != TX_SUCCESS)
1207 {
1208 // Could not change min channel timer.
1209 // Log error
1210 limLog(pMac, LOGE, FL("Unable to change periodic timer"));
1211 }
1212 }
1213 else
1214 {
1215 limLog(pMac, LOGE, FL("Do not change gLimPeriodicProbeReqTimer values,"
1216 "value = %d minchannel time = %d"
1217 "maxchannel time = %d"), val,
1218 pMac->lim.gpLimMlmScanReq->minChannelTime,
1219 pMac->lim.gpLimMlmScanReq->maxChannelTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07001220 }
1221
1222 break;
1223
1224 case eLIM_MAX_CHANNEL_TIMER:
1225 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
1226 != TX_SUCCESS)
1227 {
1228 // Could not deactivate max channel timer.
1229 // Log error
1230 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001231 FL("Unable to deactivate max channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001232 }
1233
Jeff Johnson295189b2012-06-20 16:38:30 -07001234 // If a background was triggered via Quiet BSS,
1235 // then we need to adjust the MIN and MAX channel
1236 // timer's accordingly to the Quiet duration that
1237 // was specified
1238 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
1239 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001240#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001241
1242 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1243 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1244 {
1245 // gLimQuietDuration is already cached in units of
1246 // system ticks. No conversion is reqd...
1247 val = pMac->lim.gLimSpecMgmt.quietDuration;
1248 }
1249 else
1250 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001251#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 if(pMac->lim.gpLimMlmScanReq)
1253 {
1254 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301255 if (pMac->btc.btc_scan_compromise_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001256 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301257 if (pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001258 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301259 val = SYS_MS_TO_TICKS(
1260 pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001261 limLog(pMac, LOG1, FL("Using BTC Max Active Scan time"));
1262 }
1263 else
1264 {
1265 limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set"));
1266 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301267 } else if (pMac->btc.btc_scan_compromise_sco &&
1268 pMac->roam.configParam.max_chntime_btc_sco) {
1269 val = SYS_MS_TO_TICKS(
1270 pMac->roam.configParam.max_chntime_btc_sco);
1271 limLog(pMac, LOG1,
1272 FL("Using BTC SCO Max Active Scan time %d"), val);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001273 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 }
1275 else
1276 {
1277 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1278 //No need to change max timer. This is not a scan
1279 break;
1280 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001281#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001282 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001283#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001284 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001285
1286 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
1287 val, 0) != TX_SUCCESS)
1288 {
1289 // Could not change max channel timer.
1290 // Log error
1291 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001292 FL("Unable to change max channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 }
1294
1295 break;
1296
1297 case eLIM_JOIN_FAIL_TIMER:
1298 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
1299 != TX_SUCCESS)
1300 {
1301 /**
1302 * Could not deactivate Join Failure
1303 * timer. Log error.
1304 */
1305 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001306 FL("Unable to deactivate Join Failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 }
1308
1309 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1310 &val) != eSIR_SUCCESS)
1311 {
1312 /**
1313 * Could not get JoinFailureTimeout value
1314 * from CFG. Log error.
1315 */
1316 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001317 FL("could not retrieve JoinFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 }
1319 val = SYS_MS_TO_TICKS(val);
1320
1321 if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
1322 val, 0) != TX_SUCCESS)
1323 {
1324 /**
1325 * Could not change Join Failure
1326 * timer. Log error.
1327 */
1328 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001329 FL("Unable to change Join Failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 }
1331
1332 break;
1333
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001334 case eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER:
1335 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer)
1336 != TX_SUCCESS)
1337 {
1338 // Could not deactivate periodic join req Times.
1339 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001340 FL("Unable to deactivate periodic join request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001341 }
1342
1343 val = SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS);
1344 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
1345 val, 0) != TX_SUCCESS)
1346 {
1347 // Could not change periodic join req times.
1348 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001349 limLog(pMac, LOGP, FL("Unable to change periodic join request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001350 }
Jeff Johnson62c27982013-02-27 17:53:55 -08001351
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001352 break;
1353
Jeff Johnson295189b2012-06-20 16:38:30 -07001354 case eLIM_AUTH_FAIL_TIMER:
1355 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
1356 != TX_SUCCESS)
1357 {
1358 // Could not deactivate Auth failure timer.
1359 // Log error
1360 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001361 FL("Unable to deactivate auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 }
1363
1364 // Change timer to reactivate it in future
1365 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
1366 &val) != eSIR_SUCCESS)
1367 {
1368 /**
1369 * Could not get AuthFailureTimeout value
1370 * from CFG. Log error.
1371 */
1372 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001373 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 }
1375 val = SYS_MS_TO_TICKS(val);
1376
1377 if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
1378 val, 0) != TX_SUCCESS)
1379 {
1380 // Could not change Authentication failure timer.
1381 // Log error
1382 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001383 FL("unable to change Auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001384 }
1385
1386 break;
1387
Sushant Kaushik9e923872015-04-02 17:09:31 +05301388 case eLIM_AUTH_RETRY_TIMER:
1389
1390 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer)
1391 != TX_SUCCESS)
1392 {
1393 // Could not deactivate Auth Retry Timer.
1394 limLog(pMac, LOGP,
1395 FL("Unable to deactivate Auth Retry timer"));
1396 }
1397 if ((psessionEntry = peFindSessionBySessionId(pMac,
1398 pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId))
1399 == NULL)
1400 {
1401 limLog(pMac, LOGP,
1402 FL("session does not exist for given SessionId : %d"),
1403 pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId);
1404 break;
1405 }
1406 /* 3/5 of the beacon interval*/
1407 val = psessionEntry->beaconParams.beaconInterval * 3/5;
1408 val = SYS_MS_TO_TICKS(val);
1409 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer,
1410 val, 0) != TX_SUCCESS)
1411 {
1412 // Could not change Auth Retry timer.
1413 // Log error
1414 limLog(pMac, LOGP, FL("Unable to change Auth Retry timer"));
1415 }
1416
1417 break;
1418
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 case eLIM_ASSOC_FAIL_TIMER:
1420 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
1421 TX_SUCCESS)
1422 {
1423 // Could not deactivate Association failure timer.
1424 // Log error
1425 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001426 FL("unable to deactivate Association failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 }
1428
1429 // Change timer to reactivate it in future
1430 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
1431 &val) != eSIR_SUCCESS)
1432 {
1433 /**
1434 * Could not get AssocFailureTimeout value
1435 * from CFG. Log error.
1436 */
1437 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001438 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001439 }
1440 val = SYS_MS_TO_TICKS(val);
1441
1442 if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
1443 val, 0) != TX_SUCCESS)
1444 {
1445 // Could not change Association failure timer.
1446 // Log error
1447 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001448 FL("unable to change Assoc failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001449 }
1450
1451 break;
1452
1453 case eLIM_REASSOC_FAIL_TIMER:
1454 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
1455 TX_SUCCESS)
1456 {
1457 // Could not deactivate Reassociation failure timer.
1458 // Log error
1459 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001460 FL("unable to deactivate Reassoc failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 }
1462
1463 // Change timer to reactivate it in future
1464 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1465 &val) != eSIR_SUCCESS)
1466 {
1467 /**
1468 * Could not get ReassocFailureTimeout value
1469 * from CFG. Log error.
1470 */
1471 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001472 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 }
1474 val = SYS_MS_TO_TICKS(val);
1475
1476 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
1477 val, 0) != TX_SUCCESS)
1478 {
1479 // Could not change Reassociation failure timer.
1480 // Log error
1481 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001482 FL("unable to change Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 }
1484
1485 break;
1486
1487 case eLIM_HEART_BEAT_TIMER:
1488 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
1489 TX_SUCCESS)
1490 {
1491 // Could not deactivate Heartbeat timer.
1492 // Log error
1493 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001494 FL("unable to deactivate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001496 else
1497 {
1498 limLog(pMac, LOGW, FL("Deactivated heartbeat link monitoring"));
1499 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001500
1501 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
1502 &val) != eSIR_SUCCESS)
1503 {
1504 /**
1505 * Could not get BEACON_INTERVAL value
1506 * from CFG. Log error.
1507 */
1508 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001509 FL("could not retrieve BEACON_INTERVAL value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001510 }
1511
1512 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
1513 eSIR_SUCCESS)
1514 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001515 FL("could not retrieve heartbeat failure value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001516
1517 // Change timer to reactivate it in future
1518 val = SYS_MS_TO_TICKS(val * val1);
1519
1520 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
1521 val, 0) != TX_SUCCESS)
1522 {
1523 // Could not change HeartBeat timer.
1524 // Log error
1525 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001526 FL("unable to change HeartBeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001527 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001528 else
1529 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001530 limLog(pMac, LOGW, FL("HeartBeat timer value is changed = %u"), val);
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001531 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001532 break;
1533
1534 case eLIM_PROBE_AFTER_HB_TIMER:
1535 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
1536 TX_SUCCESS)
1537 {
1538 // Could not deactivate Heartbeat timer.
1539 // Log error
1540 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001541 FL("unable to deactivate probeAfterHBTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001542 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001543 else
1544 {
Kaushik, Sushant8489f472014-01-27 11:41:22 +05301545 limLog(pMac, LOG1, FL("Deactivated probe after hb timer"));
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001546 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001547
1548 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
1549 &val) != eSIR_SUCCESS)
1550 {
1551 /**
1552 * Could not get PROBE_AFTER_HB_FAILURE
1553 * value from CFG. Log error.
1554 */
1555 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001556 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001557 }
1558
1559 // Change timer to reactivate it in future
1560 val = SYS_MS_TO_TICKS(val);
1561
1562 if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
1563 val, 0) != TX_SUCCESS)
1564 {
1565 // Could not change HeartBeat timer.
1566 // Log error
1567 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001568 FL("unable to change ProbeAfterHBTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001570 else
1571 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001572 limLog(pMac, LOGW, FL("Probe after HB timer value is changed = %u"), val);
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001573 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001574
1575 break;
1576
1577 case eLIM_KEEPALIVE_TIMER:
1578 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
1579 != TX_SUCCESS)
1580 {
1581 // Could not deactivate Keepalive timer.
1582 // Log error
1583 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001584 FL("unable to deactivate KeepaliveTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001585 }
1586
1587 // Change timer to reactivate it in future
1588
1589 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
1590 &val) != eSIR_SUCCESS)
1591 {
1592 /**
1593 * Could not get keepalive timeout value
1594 * from CFG. Log error.
1595 */
1596 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001597 FL("could not retrieve keepalive timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001598 }
1599 if (val == 0)
1600 {
1601 val = 3000;
1602 pMac->sch.keepAlive = 0;
1603 } else
1604 pMac->sch.keepAlive = 1;
1605
1606
1607
1608 val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
1609
1610 if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
1611 val, val) != TX_SUCCESS)
1612 {
1613 // Could not change KeepaliveTimer timer.
1614 // Log error
1615 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001616 FL("unable to change KeepaliveTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 }
1618
1619 break;
1620
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 case eLIM_BACKGROUND_SCAN_TIMER:
1622 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
1623 != TX_SUCCESS)
1624 {
1625 // Could not deactivate BackgroundScanTimer timer.
1626 // Log error
1627 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001628 FL("unable to deactivate BackgroundScanTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001629 }
1630
1631 // Change timer to reactivate it in future
1632 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
1633 &val) != eSIR_SUCCESS)
1634 {
1635 /**
1636 * Could not get Background scan period value
1637 * from CFG. Log error.
1638 */
1639 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001640 FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 }
1642 if (val == 0)
1643 {
1644 val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
1645 pMac->lim.gLimBackgroundScanDisable = true;
1646 }
1647 else
1648 pMac->lim.gLimBackgroundScanDisable = false;
1649
1650 val = SYS_MS_TO_TICKS(val);
1651
1652 if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
1653 val, val) != TX_SUCCESS)
1654 {
1655 // Could not change BackgroundScanTimer timer.
1656 // Log error
1657 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001658 FL("unable to change BackgroundScanTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 }
1660
1661 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001662
Jeff Johnsone7245742012-09-05 17:12:55 -07001663#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 case eLIM_CHANNEL_SWITCH_TIMER:
1665 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
1666 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001667 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 return;
1669 }
1670
1671 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
1672 pMac->lim.gLimChannelSwitch.switchTimeoutValue,
1673 0) != TX_SUCCESS)
1674 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001675 limLog(pMac, LOGP, FL("tx_timer_change failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001676 return;
1677 }
1678 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001679#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001680
1681 case eLIM_LEARN_DURATION_TIMER:
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 break;
1683
Jeff Johnsone7245742012-09-05 17:12:55 -07001684#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001685 case eLIM_QUIET_BSS_TIMER:
1686 if (TX_SUCCESS !=
1687 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
1688 {
1689 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001690 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001691 }
1692
1693 // gLimQuietDuration appears to be in units of ticks
1694 // Use it as is
1695 if (TX_SUCCESS !=
1696 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
1697 pMac->lim.gLimSpecMgmt.quietDuration,
1698 0))
1699 {
1700 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001701 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001702 }
1703 break;
1704
1705 case eLIM_QUIET_TIMER:
1706 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
1707 {
1708 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001709 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001710 }
1711
1712 // Set the NEW timeout value, in ticks
1713 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
1714 SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
1715 {
1716 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001717 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001718 }
1719 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001720#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001721
Jeff Johnson295189b2012-06-20 16:38:30 -07001722#if 0
1723 case eLIM_WPS_OVERLAP_TIMER:
1724 {
1725 // Restart Learn Interval timer
1726
1727 tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
1728
1729 if (tx_timer_deactivate(
1730 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1731 {
1732 // Could not deactivate Learn Interval timer.
1733 // Log error
1734 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001735 FL("Unable to deactivate WPS overlap timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001736 }
1737
1738 if (tx_timer_change(
1739 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1740 WPSOverlapTimer, 0) != TX_SUCCESS)
1741 {
1742 // Could not change Learn Interval timer.
1743 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001744 limLog(pMac, LOGP, FL("Unable to change WPS overlap timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001745
1746 return;
1747 }
1748
1749 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001750 FL("Setting WPS overlap TIMER to %d ticks"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001751 WPSOverlapTimer);
1752 }
1753 break;
1754#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001755
1756#ifdef WLAN_FEATURE_VOWIFI_11R
1757 case eLIM_FT_PREAUTH_RSP_TIMER:
1758 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != TX_SUCCESS)
1759 {
1760 /**
1761 ** Could not deactivate Join Failure
1762 ** timer. Log error.
1763 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001764 limLog(pMac, LOGP, FL("Unable to deactivate Preauth response Failure timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001765 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 }
1767 val = 1000;
1768 val = SYS_MS_TO_TICKS(val);
1769 if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
1770 val, 0) != TX_SUCCESS)
1771 {
1772 /**
1773 * Could not change Join Failure
1774 * timer. Log error.
1775 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001776 limLog(pMac, LOGP, FL("Unable to change Join Failure timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001777 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001778 }
1779 break;
1780#endif
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301781
1782#ifdef WLAN_FEATURE_LFR_MBB
1783 case eLIM_PREAUTH_MBB_RSP_TIMER:
Padma, Santhosh Kumarce74fd82017-02-10 19:57:08 +05301784 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE,
1785 NO_SESSION, eLIM_PREAUTH_MBB_RSP_TIMER));
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301786 if (tx_timer_deactivate(&pMac->lim.limTimers.
1787 glim_pre_auth_mbb_rsp_timer) != TX_SUCCESS) {
1788 limLog(pMac, LOGP,
1789 FL("Unable to deactivate preauth response mbb timer"));
1790 return;
1791 }
1792 break;
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +05301793 case eLIM_REASSOC_MBB_RSP_TIMER:
Padma, Santhosh Kumarce74fd82017-02-10 19:57:08 +05301794 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE,
1795 NO_SESSION, eLIM_REASSOC_MBB_RSP_TIMER));
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +05301796 if (tx_timer_deactivate(&pMac->lim.limTimers.
1797 glim_reassoc_mbb_rsp_timer) != TX_SUCCESS) {
1798 limLog(pMac, LOGP,
1799 FL("Unable to deactivate reassoc response mbb timer"));
1800 return;
1801 }
1802 break;
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301803#endif
1804
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001805#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001806 case eLIM_TSM_TIMER:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001807 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 != TX_SUCCESS)
1809 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001810 limLog(pMac, LOGE, FL("Unable to deactivate TSM timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 }
1812 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001813#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Gopichand Nakkalad492d202013-05-10 02:50:47 +05301814
1815 case eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
1816 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer) != TX_SUCCESS)
1817 {
1818 /**
1819 ** Could not deactivate Active to passive channel timer.
1820 ** Log error.
1821 **/
1822 limLog(pMac, LOGP, FL("Unable to Deactivate "
1823 "Active to passive channel timer"));
1824 return;
1825 }
1826 val = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
1827 val = SYS_MS_TO_TICKS(val);
1828 if (tx_timer_change(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer,
1829 val, 0) != TX_SUCCESS)
1830 {
1831 /**
1832 * Could not change timer to check scan type for passive channel.
1833 * timer. Log error.
1834 */
1835 limLog(pMac, LOGP, FL("Unable to change timer"));
1836 return;
1837 }
1838 break;
1839
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001840 case eLIM_DISASSOC_ACK_TIMER:
1841 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer) != TX_SUCCESS)
1842 {
1843 /**
1844 ** Could not deactivate Join Failure
1845 ** timer. Log error.
1846 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001847 limLog(pMac, LOGP, FL("Unable to deactivate Disassoc ack timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001848 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001849 }
1850 val = 1000;
1851 val = SYS_MS_TO_TICKS(val);
1852 if (tx_timer_change(&pMac->lim.limTimers.gLimDisassocAckTimer,
1853 val, 0) != TX_SUCCESS)
1854 {
1855 /**
1856 * Could not change Join Failure
1857 * timer. Log error.
1858 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001859 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001860 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001861 }
1862 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001863
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001864 case eLIM_DEAUTH_ACK_TIMER:
1865 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer) != TX_SUCCESS)
1866 {
1867 /**
1868 ** Could not deactivate Join Failure
1869 ** timer. Log error.
1870 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001871 limLog(pMac, LOGP, FL("Unable to deactivate Deauth ack timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001872 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001873 }
1874 val = 1000;
1875 val = SYS_MS_TO_TICKS(val);
1876 if (tx_timer_change(&pMac->lim.limTimers.gLimDeauthAckTimer,
1877 val, 0) != TX_SUCCESS)
1878 {
1879 /**
1880 * Could not change Join Failure
1881 * timer. Log error.
1882 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001883 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001884 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001885 }
1886 break;
Viral Modid86bde22012-12-10 13:09:21 -08001887
Viral Modid86bde22012-12-10 13:09:21 -08001888 case eLIM_INSERT_SINGLESHOT_NOA_TIMER:
1889 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer) != TX_SUCCESS)
1890 {
1891 /**
1892 ** Could not deactivate SingleShot NOA Insert
1893 ** timer. Log error.
1894 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001895 limLog(pMac, LOGP, FL("Unable to deactivate SingleShot NOA Insert timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001896 return;
1897 }
1898 val = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE;
1899 val = SYS_MS_TO_TICKS(val);
1900 if (tx_timer_change(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
1901 val, 0) != TX_SUCCESS)
1902 {
1903 /**
1904 * Could not change Single Shot NOA Insert
1905 * timer. Log error.
1906 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001907 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001908 return;
1909 }
1910 break;
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301911 case eLIM_AP_ECSA_TIMER:
1912 if (tx_timer_deactivate(
1913 &pMac->lim.limTimers.g_lim_ap_ecsa_timer) != TX_SUCCESS)
1914 {
1915 /*
1916 * Could not deactivate SingleShot NOA Insert
1917 * timer. Log error.
1918 */
1919 limLog(pMac, LOGE, FL("Unable to deactivate AP ecsa timer"));
1920 return;
1921 }
1922 if ((psessionEntry = peFindSessionBySessionId(pMac,
1923 pMac->lim.limTimers.g_lim_ap_ecsa_timer.sessionId)) == NULL)
1924 {
1925 limLog(pMac, LOGE,
1926 FL("session does not exist for given SessionId : %d, for AP ecsa timer"),
1927 pMac->lim.limTimers.g_lim_ap_ecsa_timer.sessionId);
1928 break;
1929 }
1930 val = psessionEntry->beaconParams.beaconInterval;
1931 val = SYS_MS_TO_TICKS(val);
1932 if (tx_timer_change(&pMac->lim.limTimers.g_lim_ap_ecsa_timer,
1933 val, 0) != TX_SUCCESS)
1934 {
1935 limLog(pMac, LOGE, FL("Unable to change g_lim_ap_ecsa_timer timer"));
1936 }
Jeff Johnson62c27982013-02-27 17:53:55 -08001937
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301938 break;
1939 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 // Invalid timerId. Log error
1941 break;
1942 }
1943} /****** end limDeactivateAndChangeTimer() ******/
1944
1945
1946
1947/**---------------------------------------------------------------
1948\fn limHeartBeatDeactivateAndChangeTimer
1949\brief This function deactivates and changes the heart beat
1950\ timer, eLIM_HEART_BEAT_TIMER.
1951\
1952\param pMac
1953\param psessionEntry
1954\return None
1955------------------------------------------------------------------*/
1956void
1957limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1958{
Ravi Joshid0699502013-07-08 15:48:47 -07001959 tANI_U32 val, val1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001960
Siddharth Bhal224da542014-05-28 07:07:46 +05301961 if (NULL == psessionEntry)
1962 {
1963 limLog(pMac, LOGE, FL("%s: received session id NULL."
1964 " Heartbeat timer config failed"), __func__);
1965 return;
1966 }
1967
Yathish9f22e662012-12-10 14:21:35 -08001968#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
Ravi Joshid0699502013-07-08 15:48:47 -07001969 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1970 return;
Yathish9f22e662012-12-10 14:21:35 -08001971#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001972
Ravi Joshid0699502013-07-08 15:48:47 -07001973 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
1974 limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001975
Ravi Joshid0699502013-07-08 15:48:47 -07001976 /* HB Timer sessionisation: In case of 2 or more sessions, the HB interval keeps
1977 changing. to avoid this problem, HeartBeat interval is made constant, by
1978 fixing beacon interval to 100ms immaterial of the beacon interval of the session */
Jeff Johnson295189b2012-06-20 16:38:30 -07001979
Ravi Joshid0699502013-07-08 15:48:47 -07001980 //val = psessionEntry->beaconParams.beaconInterval;
1981 val = LIM_HB_TIMER_BEACON_INTERVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001982
Ravi Joshid0699502013-07-08 15:48:47 -07001983 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
1984 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_HEART_BEAT_THRESHOLD "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001985
Ravi Joshid0699502013-07-08 15:48:47 -07001986 PELOGW(limLog(pMac,LOGW,
1987 FL("HB Timer Int.=100ms * %d, Beacon Int.=%dms,Session Id=%d "),
1988 val1, psessionEntry->beaconParams.beaconInterval,
1989 psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001990
Ravi Joshid0699502013-07-08 15:48:47 -07001991 /* The HB timer timeout value of 4 seconds (40 beacon intervals) is not
1992 * enough to judge the peer device inactivity when 32 peers are connected.
1993 * Hence increasing the HB timer timeout to
1994 * HBtimeout = (TBTT * num_beacons * num_peers)
1995 */
1996 if (eSIR_IBSS_MODE == psessionEntry->bssType &&
1997 pMac->lim.gLimNumIbssPeers > 0)
1998 {
Ravi Joshi92a4e142013-06-27 17:00:42 -07001999 val1 = val1 * pMac->lim.gLimNumIbssPeers;
Ravi Joshid0699502013-07-08 15:48:47 -07002000 }
Ravi Joshi92a4e142013-06-27 17:00:42 -07002001
Ravi Joshid0699502013-07-08 15:48:47 -07002002 // Change timer to reactivate it in future
2003 val = SYS_MS_TO_TICKS(val * val1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002004
Ravi Joshid0699502013-07-08 15:48:47 -07002005 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer, val, 0) != TX_SUCCESS)
2006 limLog(pMac, LOGP, FL("Fail to change HeartBeatTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002007
2008} /****** end limHeartBeatDeactivateAndChangeTimer() ******/
2009
2010
2011/**---------------------------------------------------------------
2012\fn limReactivateHeartBeatTimer
2013\brief This function s called to deactivate, change and
2014\ activate a timer.
2015\
2016\param pMac - Pointer to Global MAC structure
2017\param psessionEntry
2018\return None
2019------------------------------------------------------------------*/
2020void
2021limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
2022{
Siddharth Bhald31c1252014-05-05 19:34:14 +05302023 if (NULL == psessionEntry)
2024 {
2025 limLog(pMac, LOGE, FL("%s: received session id NULL."
2026 " Heartbeat timer config failed"), __func__);
2027 return;
2028 }
2029
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002030 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d"), psessionEntry->LimRxedBeaconCntDuringHB);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002031
Yathish9f22e662012-12-10 14:21:35 -08002032#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2033 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07002034 {
2035 limLog(pMac, LOGW, FL("Active offload feature is enabled, FW takes care of HB monitoring"));
Yathish9f22e662012-12-10 14:21:35 -08002036 return;
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07002037 }
Yathish9f22e662012-12-10 14:21:35 -08002038#endif
2039
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002041
2042 //only start the hearbeat-timer if the timeout value is non-zero
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002043 if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0)
2044 {
2045 /*
2046 * There is increasing need to limit the apps wakeup due to WLAN
2047 * activity. During HB monitoring, the beacons from peer are sent to
2048 * the host causing the host to wakeup. Hence, offloading the HB
2049 * monitoring to LMAC
2050 */
2051 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE &&
2052 IS_IBSS_HEARTBEAT_OFFLOAD_FEATURE_ENABLE)
2053 {
2054 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
2055 {
2056 limLog(pMac, LOGP,FL("IBSS HeartBeat Offloaded, Could not deactivate Heartbeat timer"));
2057 }
2058 else
2059 {
2060 limLog(pMac, LOGE, FL("IBSS HeartBeat Offloaded, Deactivated heartbeat link monitoring"));
2061 }
2062 }
2063 else
2064 {
2065 if (tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
2066 {
2067 limLog(pMac, LOGP,FL("could not activate Heartbeat timer"));
2068 }
2069 else
2070 {
2071 limLog(pMac, LOGW, FL("Reactivated heartbeat link monitoring"));
2072 }
2073 }
2074 limResetHBPktCount(psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 }
2076
2077} /****** end limReactivateHeartBeatTimer() ******/
2078
Jeff Johnson295189b2012-06-20 16:38:30 -07002079
2080/**
2081 * limActivateHearBeatTimer()
2082 *
2083 *
2084 * @brief: This function is called to activate heartbeat timer
2085 *
2086 *LOGIC:
2087 *
2088 *ASSUMPTIONS:
2089 * NA
2090 *
2091 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2092 *
2093 * @param pMac - Pointer to Global MAC structure
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002094 * @param psessionEntry - Session Entry
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 *
2096 * @return TX_SUCCESS - timer is activated
2097 * errors - fail to start the timer
2098 */
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002099v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002100{
2101 v_UINT_t status = TX_TIMER_ERROR;
2102
Yathish9f22e662012-12-10 14:21:35 -08002103#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2104 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Ravi Joshif7fe8d32013-09-21 17:02:11 -07002105 return (TX_SUCCESS);
Yathish9f22e662012-12-10 14:21:35 -08002106#endif
2107
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 if(TX_AIRGO_TMR_SIGNATURE == pMac->lim.limTimers.gLimHeartBeatTimer.tmrSignature)
2109 {
2110 //consider 0 interval a ok case
2111 if( pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs )
2112 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002113 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE &&
2114 IS_IBSS_HEARTBEAT_OFFLOAD_FEATURE_ENABLE)
2115 {
2116 /* HB offload in IBSS mode */
2117 status = tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
2118 if (TX_SUCCESS != status)
2119 {
2120 PELOGE(limLog(pMac, LOGE,
2121 FL("IBSS HB Offload, Could not deactivate HB timer status(%d)"),
2122 status);)
2123 }
2124 else
2125 {
2126 PELOGE(limLog(pMac, LOGE,
2127 FL("%s] IBSS HB Offloaded, Heartbeat timer deactivated"),
2128 __func__);)
2129 }
2130
2131 }
2132 else
2133 {
2134 status = tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer);
2135 if ( TX_SUCCESS != status )
2136 {
2137 PELOGE(limLog(pMac, LOGE,
2138 FL("could not activate Heartbeat timer status(%d)"), status);)
2139 }
2140 else
2141 {
2142 PELOGE(limLog(pMac, LOGW,
2143 FL("%s] Activated Heartbeat timer status(%d)"), __func__, status);)
2144 }
2145 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 }
2147 else
2148 {
2149 status = TX_SUCCESS;
2150 }
2151 }
2152
2153 return (status);
2154}
2155
2156
2157
2158/**
2159 * limDeactivateAndChangePerStaIdTimer()
2160 *
2161 *
2162 * @brief: This function is called to deactivate and change a per STA timer
2163 * for future re-activation
2164 *
2165 *LOGIC:
2166 *
2167 *ASSUMPTIONS:
2168 * NA
2169 *
2170 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2171 *
2172 * @param pMac - Pointer to Global MAC structure
2173 * @param timerId - enum of timer to be deactivated and changed
2174 * This enum is defined in limUtils.h file
2175 * @param staId - staId
2176 *
2177 * @return None
2178 */
2179
2180void
2181limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
2182{
2183 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002184
2185 switch (timerId)
2186 {
2187 case eLIM_CNF_WAIT_TIMER:
2188
2189 if (tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2190 != TX_SUCCESS)
2191 {
2192 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002193 FL("unable to deactivate CNF wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002194
2195 }
2196
2197 // Change timer to reactivate it in future
2198
2199 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
2200 &val) != eSIR_SUCCESS)
2201 {
2202 /**
2203 * Could not get cnf timeout value
2204 * from CFG. Log error.
2205 */
2206 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002207 FL("could not retrieve cnf timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 }
2209 val = SYS_MS_TO_TICKS(val);
2210
2211 if (tx_timer_change(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId],
2212 val, val) != TX_SUCCESS)
2213 {
2214 // Could not change cnf timer.
2215 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002216 limLog(pMac, LOGP, FL("unable to change cnf wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 }
2218
2219 break;
2220
2221 case eLIM_AUTH_RSP_TIMER:
2222 {
2223 tLimPreAuthNode *pAuthNode;
2224
2225 pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, staId);
2226
2227 if (pAuthNode == NULL)
2228 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002229 limLog(pMac, LOGP, FL("Invalid Pre Auth Index passed :%d"), staId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 break;
2231 }
2232
2233 if (tx_timer_deactivate(&pAuthNode->timer) != TX_SUCCESS)
2234 {
2235 // Could not deactivate auth response timer.
2236 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002237 limLog(pMac, LOGP, FL("unable to deactivate auth response timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 }
2239
2240 // Change timer to reactivate it in future
2241
2242 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, &val) != eSIR_SUCCESS)
2243 {
2244 /**
2245 * Could not get auth rsp timeout value
2246 * from CFG. Log error.
2247 */
2248 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002249 FL("could not retrieve auth response timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 }
2251
2252 val = SYS_MS_TO_TICKS(val);
2253
2254 if (tx_timer_change(&pAuthNode->timer, val, 0) != TX_SUCCESS)
2255 {
2256 // Could not change auth rsp timer.
2257 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002258 limLog(pMac, LOGP, FL("unable to change auth rsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 }
2260 }
2261 break;
2262
Jeff Johnson295189b2012-06-20 16:38:30 -07002263
2264 default:
2265 // Invalid timerId. Log error
2266 break;
2267
2268 }
2269}
2270
2271
2272/**
2273 * limActivateCnfTimer()
2274 *
2275 *FUNCTION:
2276 * This function is called to activate a per STA timer
2277 *
2278 *LOGIC:
2279 *
2280 *ASSUMPTIONS:
2281 * NA
2282 *
2283 *NOTE:
2284 * NA
2285 *
2286 * @param pMac - Pointer to Global MAC structure
2287 * @param StaId - staId
2288 *
2289 * @return None
2290 */
2291
2292void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
2293{
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
2295 if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2296 != TX_SUCCESS)
2297 {
2298 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002299 FL("could not activate cnf wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 }
2301}
2302
2303/**
2304 * limActivateAuthRspTimer()
2305 *
2306 *FUNCTION:
2307 * This function is called to activate a per STA timer
2308 *
2309 *LOGIC:
2310 *
2311 *ASSUMPTIONS:
2312 * NA
2313 *
2314 *NOTE:
2315 * NA
2316 *
2317 * @param pMac - Pointer to Global MAC structure
2318 * @param id - id
2319 *
2320 * @return None
2321 */
2322
2323void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
2324{
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
2326 {
2327 /// Could not activate auth rsp timer.
2328 // Log error
2329 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002330 FL("could not activate auth rsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 }
2332}
2333
2334
2335/**
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 * limAssocCnfWaitTmerHandler()
2337 *
2338 *FUNCTION:
2339 * This function post a message to send a disassociate frame out.
2340 *
2341 *LOGIC:
2342 *
2343 *ASSUMPTIONS:
2344 *
2345 *NOTE:
2346 * NA
2347 *
2348 * @param
2349 *
2350 * @return None
2351 */
2352
2353void
2354limCnfWaitTmerHandler(void *pMacGlobal, tANI_U32 param)
2355{
2356 tSirMsgQ msg;
2357 tANI_U32 statusCode;
2358 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2359
2360 msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
2361 msg.bodyval = (tANI_U32)param;
2362 msg.bodyptr = NULL;
2363
2364 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2365 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002366 FL("posting to LIM failed, reason=%d"), statusCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002367
2368}
2369
2370/**
2371 * limKeepaliveTmerHandler()
2372 *
2373 *FUNCTION:
2374 * This function post a message to send a NULL data frame.
2375 *
2376 *LOGIC:
2377 *
2378 *ASSUMPTIONS:
2379 *
2380 *NOTE:
2381 * NA
2382 *
2383 * @param
2384 *
2385 * @return None
2386 */
2387
2388void
2389limKeepaliveTmerHandler(void *pMacGlobal, tANI_U32 param)
2390{
2391 tSirMsgQ msg;
2392 tANI_U32 statusCode;
2393 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2394
2395 msg.type = SIR_LIM_KEEPALIVE_TIMEOUT;
2396 msg.bodyval = (tANI_U32)param;
2397 msg.bodyptr = NULL;
2398
2399 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2400 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002401 FL("posting to LIM failed, reason=%d"), statusCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002402
2403}
2404
2405void
2406limChannelSwitchTimerHandler(void *pMacGlobal, tANI_U32 param)
2407{
2408 tSirMsgQ msg;
2409 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2410
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302411 limLog(pMac, LOG1,
2412 FL("ChannelSwitch Timer expired. Posting msg to LIM "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002413
2414 msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
2415 msg.bodyval = (tANI_U32)param;
2416 msg.bodyptr = NULL;
2417
2418 limPostMsgApi(pMac, &msg);
2419}
2420
2421void
2422limQuietTimerHandler(void *pMacGlobal, tANI_U32 param)
2423{
2424 tSirMsgQ msg;
2425 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2426
2427 msg.type = SIR_LIM_QUIET_TIMEOUT;
2428 msg.bodyval = (tANI_U32)param;
2429 msg.bodyptr = NULL;
2430
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302431 limLog(pMac, LOG1,
2432 FL("Post SIR_LIM_QUIET_TIMEOUT msg. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002433 limPostMsgApi(pMac, &msg);
2434}
2435
2436void
2437limQuietBssTimerHandler(void *pMacGlobal, tANI_U32 param)
2438{
2439 tSirMsgQ msg;
2440 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2441
2442 msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
2443 msg.bodyval = (tANI_U32)param;
2444 msg.bodyptr = NULL;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302445 limLog(pMac, LOG1,
2446 FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 limPostMsgApi(pMac, &msg);
2448}
Jeff Johnson295189b2012-06-20 16:38:30 -07002449#if 0
2450void
2451limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
2452{
2453 tSirMsgQ msg;
2454 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2455
2456 msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
2457 msg.bodyval = (tANI_U32)param;
2458 msg.bodyptr = NULL;
2459 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002460 FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002461 limPostMsgApi(pMac, &msg);
2462}
2463#endif
Yathish9f22e662012-12-10 14:21:35 -08002464
2465#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2466/* ACTIVE_MODE_HB_OFFLOAD */
2467/**
2468 * limMissedBeaconInActiveMode()
2469 *
2470 *FUNCTION:
2471 * This function handle beacon miss indication from FW
2472 * in Active mode.
2473 *
2474 *LOGIC:
2475 *
2476 *ASSUMPTIONS:
2477 * NA
2478 *
2479 *NOTE:
2480 * NA
2481 *
2482 * @param param - Msg Type
2483 *
2484 * @return None
2485 */
2486void
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002487limMissedBeaconInActiveMode(void *pMacGlobal, tpPESession psessionEntry)
Yathish9f22e662012-12-10 14:21:35 -08002488{
2489 tANI_U32 statusCode;
2490 tSirMsgQ msg;
2491 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2492
2493 // Prepare and post message to LIM Message Queue
2494 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Jeff Johnson62c27982013-02-27 17:53:55 -08002495 {
Yathish9f22e662012-12-10 14:21:35 -08002496 msg.type = (tANI_U16) SIR_LIM_HEART_BEAT_TIMEOUT;
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002497 msg.bodyptr = psessionEntry;
Yathish9f22e662012-12-10 14:21:35 -08002498 msg.bodyval = 0;
2499 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002500 FL("Heartbeat failure from Riva"));
Yathish9f22e662012-12-10 14:21:35 -08002501 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2502 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002503 FL("posting message %X to LIM failed, reason=%d"),
Yathish9f22e662012-12-10 14:21:35 -08002504 msg.type, statusCode);
2505 }
2506}
2507#endif