blob: 640b47a86cb9470c62ad49d27cb0b312e8b650fb [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhinav Kumar626f8652019-08-05 16:20:39 +05302 * Copyright (c) 2012-2017, 2019 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
Abhinav Kumar626f8652019-08-05 16:20:39 +053059/*
60 * SAE auth timer of 5secs. This is required for duration of entire SAE
61 * authentication.
62 */
63#define LIM_AUTH_SAE_TIMER_MS 5000
Jeff Johnson295189b2012-06-20 16:38:30 -070064
65//default beacon interval value used in HB timer interval calculation
66#define LIM_HB_TIMER_BEACON_INTERVAL 100
Gopichand Nakkalad492d202013-05-10 02:50:47 +053067
Madan Mohan Koyyalamudi98b82ce2013-07-11 17:03:55 +053068/* This timer is a periodic timer which expires at every 1 sec to
Gopichand Nakkalad492d202013-05-10 02:50:47 +053069 convert ACTIVE DFS channel to DFS channels */
Madan Mohan Koyyalamudi98b82ce2013-07-11 17:03:55 +053070#define ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT 1000
Gopichand Nakkalad492d202013-05-10 02:50:47 +053071
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +053072#ifdef WLAN_FEATURE_LFR_MBB
73#define PREAUTH_REASSOC_TIMEOUT 500
74#endif
75
Jeff Johnson295189b2012-06-20 16:38:30 -070076/**
77 * limCreateTimers()
78 *
79 *FUNCTION:
80 * This function is called upon receiving
81 * 1. SME_START_REQ for STA in ESS role
82 * 2. SME_START_BSS_REQ for AP role & STA in IBSS role
83 *
84 *LOGIC:
85 *
86 *ASSUMPTIONS:
87 * NA
88 *
89 *NOTE:
90 * NA
91 *
92 * @param pMac - Pointer to Global MAC structure
93 *
94 * @return None
95 */
96
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -070097v_UINT_t
Jeff Johnson295189b2012-06-20 16:38:30 -070098limCreateTimers(tpAniSirGlobal pMac)
99{
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700100 tANI_U32 cfgValue, i=0;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800101 tANI_U32 cfgValue1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700102
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700103 PELOG1(limLog(pMac, LOG1, FL("Creating Timers used by LIM module in Role %d"), pMac->lim.gLimSystemRole);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700104
105 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
106 &cfgValue) != eSIR_SUCCESS)
107 {
108 /**
109 * Could not get MinChannelTimeout value
110 * from CFG. Log error.
111 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700112 limLog(pMac, LOGP, FL("could not retrieve MinChannelTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700113 }
114 cfgValue = SYS_MS_TO_TICKS(cfgValue);
115
116 // Create MIN/MAX channel timers and activate them later
117 if (tx_timer_create(&pMac->lim.limTimers.gLimMinChannelTimer,
118 "MIN CHANNEL TIMEOUT",
119 limTimerHandler, SIR_LIM_MIN_CHANNEL_TIMEOUT,
120 cfgValue, 0,
121 TX_NO_ACTIVATE) != TX_SUCCESS)
122 {
123 /// Could not start min channel timer.
124 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700125 limLog(pMac, LOGP, FL("could not create MIN channel timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700126 return TX_TIMER_ERROR;
Jeff Johnson295189b2012-06-20 16:38:30 -0700127 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700128 PELOG2(limLog(pMac, LOG2, FL("Created MinChannelTimer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700129
130 /* Periodic probe request timer value is half of the Min channel
131 * timer. Probe request sends periodically till min/max channel
132 * timer expires
133 */
134
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800135 cfgValue1 = cfgValue/2 ;
136 if( cfgValue1 >= 1)
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 {
138 // Create periodic probe request timer and activate them later
139 if (tx_timer_create(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
140 "Periodic Probe Request Timer",
141 limTimerHandler, SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT,
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800142 cfgValue1, 0,
Jeff Johnson295189b2012-06-20 16:38:30 -0700143 TX_NO_ACTIVATE) != TX_SUCCESS)
144 {
145 /// Could not start Periodic Probe Req timer.
146 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700147 limLog(pMac, LOGP, FL("could not create periodic probe timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700148 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700149 }
150 }
151
152
153 if (wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
154 &cfgValue) != eSIR_SUCCESS)
155 {
156 /**
157 * Could not get MAXChannelTimeout value
158 * from CFG. Log error.
159 */
160 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700161 FL("could not retrieve MAXChannelTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700162 }
163 cfgValue = SYS_MS_TO_TICKS(cfgValue);
164
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800165 /* Limiting max numm of probe req for each channel scan */
166 pMac->lim.maxProbe = (cfgValue/cfgValue1);
167
Jeff Johnson295189b2012-06-20 16:38:30 -0700168 if (tx_timer_create(&pMac->lim.limTimers.gLimMaxChannelTimer,
169 "MAX CHANNEL TIMEOUT",
170 limTimerHandler, SIR_LIM_MAX_CHANNEL_TIMEOUT,
171 cfgValue, 0,
172 TX_NO_ACTIVATE) != TX_SUCCESS)
173 {
174 /// Could not start max channel timer.
175 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700176 limLog(pMac, LOGP, FL("could not create MAX channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700177
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700178 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700179 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700180 PELOG2(limLog(pMac, LOG2, FL("Created MaxChannelTimer"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700181
182 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
183 {
184 // Create Channel Switch Timer
185 if (tx_timer_create(&pMac->lim.limTimers.gLimChannelSwitchTimer,
186 "CHANNEL SWITCH TIMER",
187 limChannelSwitchTimerHandler,
188 0, // expiration_input
189 LIM_CHANNEL_SWITCH_TIMER_TICKS, // initial_ticks
190 0, // reschedule_ticks
191 TX_NO_ACTIVATE) != TX_SUCCESS)
192 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700193 limLog(pMac, LOGP, FL("failed to create Channel Switch timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700194 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700195 }
196
197 //
198 // Create Quiet Timer
199 // This is used on the STA to go and shut-off
200 // Tx/Rx "after" the specified quiteInterval
201 //
202 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietTimer,
203 "QUIET TIMER",
204 limQuietTimerHandler,
205 SIR_LIM_QUIET_TIMEOUT, // expiration_input
206 LIM_QUIET_TIMER_TICKS, // initial_ticks
207 0, // reschedule_ticks
208 TX_NO_ACTIVATE) != TX_SUCCESS)
209 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700210 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700211 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700212 }
213
214 //
215 // Create Quiet BSS Timer
216 // After the specified quiteInterval, determined by
217 // gLimQuietTimer, this timer, gLimQuietBssTimer,
218 // trigger and put the STA to sleep for the specified
219 // gLimQuietDuration
220 //
221 if (tx_timer_create(&pMac->lim.limTimers.gLimQuietBssTimer,
222 "QUIET BSS TIMER",
223 limQuietBssTimerHandler,
224 SIR_LIM_QUIET_BSS_TIMEOUT, // expiration_input
225 LIM_QUIET_BSS_TIMER_TICK, // initial_ticks
226 0, // reschedule_ticks
227 TX_NO_ACTIVATE) != TX_SUCCESS)
228 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700229 limLog(pMac, LOGP, FL("failed to create Quiet Begin Timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700230 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 }
232
233 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
234 &cfgValue) != eSIR_SUCCESS)
235 {
236 /**
237 * Could not get JoinFailureTimeout value
238 * from CFG. Log error.
239 */
240 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700241 FL("could not retrieve JoinFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 }
243 cfgValue = SYS_MS_TO_TICKS(cfgValue);
244
245 // Create Join failure timer and activate it later
246 if (tx_timer_create(&pMac->lim.limTimers.gLimJoinFailureTimer,
247 "JOIN FAILURE TIMEOUT",
248 limTimerHandler, SIR_LIM_JOIN_FAIL_TIMEOUT,
249 cfgValue, 0,
250 TX_NO_ACTIVATE) != TX_SUCCESS)
251 {
252 /// Could not create Join failure timer.
253 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700254 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700255
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700256 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800258
Jeff Johnson62c27982013-02-27 17:53:55 -0800259 //Send unicast probe req frame every 200 ms
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800260 if ((tx_timer_create(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
261 "Periodic Join Probe Request Timer",
262 limTimerHandler, SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT,
263 SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS), 0,
264 TX_NO_ACTIVATE)) != TX_SUCCESS)
265 {
266 /// Could not create Periodic Join Probe Request timer.
267 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700268 limLog(pMac, LOGP, FL("could not create Periodic Join Probe Request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800269 goto err_timer;
270 }
Sushant Kaushik9e923872015-04-02 17:09:31 +0530271 //Send Auth frame every 60 ms
272 if ((tx_timer_create(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer,
273 "Periodic AUTH Timer",
274 limTimerHandler, SIR_LIM_AUTH_RETRY_TIMEOUT,
275 SYS_MS_TO_TICKS(LIM_AUTH_RETRY_TIMER_MS), 0,
276 TX_NO_ACTIVATE)) != TX_SUCCESS)
277 {
278 /// Could not create Periodic Join Probe Request timer.
279 // Log error
280 limLog(pMac, LOGP, FL("could not create Periodic AUTH Timer timer"));
281 goto err_timer;
282 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
284 &cfgValue) != eSIR_SUCCESS)
285 {
286 /**
287 * Could not get AssocFailureTimeout value
288 * from CFG. Log error.
289 */
290 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700291 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 }
293 cfgValue = SYS_MS_TO_TICKS(cfgValue);
294
295 // Create Association failure timer and activate it later
296 if (tx_timer_create(&pMac->lim.limTimers.gLimAssocFailureTimer,
297 "ASSOC FAILURE TIMEOUT",
298 limAssocFailureTimerHandler, LIM_ASSOC,
299 cfgValue, 0,
300 TX_NO_ACTIVATE) != TX_SUCCESS)
301 {
302 /// Could not create Assoc failure timer.
303 // Log error
304 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700305 FL("could not create Association failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700306
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700307 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700308 }
309 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
310 &cfgValue) != eSIR_SUCCESS)
311 {
312 /**
313 * Could not get ReassocFailureTimeout value
314 * from CFG. Log error.
315 */
316 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700317 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 }
319 cfgValue = SYS_MS_TO_TICKS(cfgValue);
320
321 // Create Association failure timer and activate it later
322 if (tx_timer_create(&pMac->lim.limTimers.gLimReassocFailureTimer,
323 "REASSOC FAILURE TIMEOUT",
324 limAssocFailureTimerHandler, LIM_REASSOC,
325 cfgValue, 0,
326 TX_NO_ACTIVATE) != TX_SUCCESS)
327 {
328 /// Could not create Reassoc failure timer.
329 // Log error
330 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700331 FL("could not create Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700332
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700333 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 }
335
336 if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &cfgValue) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700337 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_ADDTS_RSP_TIMEOUT "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700338
339 cfgValue = SYS_MS_TO_TICKS(cfgValue);
340
341 // Create Addts response timer and activate it later
342 if (tx_timer_create(&pMac->lim.limTimers.gLimAddtsRspTimer,
343 "ADDTS RSP TIMEOUT",
344 limAddtsResponseTimerHandler,
345 SIR_LIM_ADDTS_RSP_TIMEOUT,
346 cfgValue, 0,
347 TX_NO_ACTIVATE) != TX_SUCCESS)
348 {
349 /// Could not create Auth failure timer.
350 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700351 limLog(pMac, LOGP, FL("could not create Addts response timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700352
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700353 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 }
355
356 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
357 &cfgValue) != eSIR_SUCCESS)
358 {
359 /**
360 * Could not get AuthFailureTimeout value
361 * from CFG. Log error.
362 */
363 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700364 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 }
366 cfgValue = SYS_MS_TO_TICKS(cfgValue);
367
368 // Create Auth failure timer and activate it later
369 if (tx_timer_create(&pMac->lim.limTimers.gLimAuthFailureTimer,
370 "AUTH FAILURE TIMEOUT",
371 limTimerHandler,
372 SIR_LIM_AUTH_FAIL_TIMEOUT,
373 cfgValue, 0,
374 TX_NO_ACTIVATE) != TX_SUCCESS)
375 {
376 /// Could not create Auth failure timer.
377 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700378 limLog(pMac, LOGP, FL("could not create Auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700379
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700380 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700381 }
Jeff Johnson41707a42013-02-14 07:54:26 -0800382
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
384 &cfgValue) != eSIR_SUCCESS)
385 {
386 /**
387 * Could not get BEACON_INTERVAL value
388 * from CFG. Log error.
389 */
390 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700391 FL("could not retrieve BEACON_INTERVAL value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 }
393 cfgValue = SYS_MS_TO_TICKS(cfgValue);
394
395 if (tx_timer_create(&pMac->lim.limTimers.gLimHeartBeatTimer,
396 "Heartbeat TIMEOUT",
397 limTimerHandler,
398 SIR_LIM_HEART_BEAT_TIMEOUT,
399 cfgValue,
400 0,
401 TX_NO_ACTIVATE) != TX_SUCCESS)
402 {
403 /// Could not start Heartbeat timer.
404 // Log error
405 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700406 FL("call to create heartbeat timer failed"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700407 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 }
409
410 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
411 &cfgValue) != eSIR_SUCCESS)
412 {
413 /**
414 * Could not get PROBE_AFTER_HB_FAILURE
415 * value from CFG. Log error.
416 */
417 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700418 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 }
420
421 // Change timer to reactivate it in future
422 cfgValue = SYS_MS_TO_TICKS(cfgValue);
423
424 if (tx_timer_create(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
425 "Probe after Heartbeat TIMEOUT",
426 limTimerHandler,
427 SIR_LIM_PROBE_HB_FAILURE_TIMEOUT,
428 cfgValue,
429 0,
430 TX_NO_ACTIVATE) != TX_SUCCESS)
431 {
432 // Could not creat wt-probe-after-HeartBeat-failure timer.
433 // Log error
434 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700435 FL("unable to create ProbeAfterHBTimer"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700436 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 }
438
Abhinav Kumar626f8652019-08-05 16:20:39 +0530439 /*
440 * SAE auth timer of 5secs. This is required for duration of entire SAE
441 * authentication.
442 */
443 if ((tx_timer_create(&pMac->lim.limTimers.sae_auth_timer,
444 "SAE AUTH Timer", limTimerHandler, SIR_LIM_AUTH_SAE_TIMEOUT,
445 SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS), 0, TX_NO_ACTIVATE)) !=
446 TX_SUCCESS) {
447 limLog(pMac, LOGP, FL("could not create SAE AUTH Timer"));
448 goto err_timer;
449 }
450
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
452 &cfgValue) != eSIR_SUCCESS)
453 {
454 /**
455 * Could not get Background scan period value
456 * from CFG. Log error.
457 */
458 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700459 FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 }
461
462 /*
463 * setting period to zero means disabling background scans when associated
464 * the way we do this is to set a flag indicating this and keeping
465 * the timer running, since it will be used for PDU leak workarounds
466 * as well as background scanning during SME idle states
467 */
468 if (cfgValue == 0)
469 {
470 cfgValue = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
471 pMac->lim.gLimBackgroundScanDisable = true;
472 }
473 else
474 pMac->lim.gLimBackgroundScanDisable = false;
475
476 cfgValue = SYS_MS_TO_TICKS(cfgValue);
477
478 if (tx_timer_create(&pMac->lim.limTimers.gLimBackgroundScanTimer,
479 "Background scan TIMEOUT",
480 limTimerHandler,
481 SIR_LIM_CHANNEL_SCAN_TIMEOUT,
482 cfgValue,
483 cfgValue,
484 TX_NO_ACTIVATE) != TX_SUCCESS)
485 {
486 /// Could not start background scan timer.
487 // Log error
488 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700489 FL("call to create background scan timer failed"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700490 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 }
493
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 /**
495 * Create keepalive timer and activate it right away for AP role
496 */
497
498 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
499 &cfgValue) != eSIR_SUCCESS)
500 {
501 /**
502 * Could not get keepalive timeout value
503 * from CFG. Log error.
504 */
505 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700506 FL("could not retrieve keepalive timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 }
508
509 // A value of zero implies keep alive should be disabled
510 if (cfgValue == 0)
511 {
512 cfgValue = LIM_KEEPALIVE_TIMER_MS;
513 pMac->sch.keepAlive = 0;
514 } else
515 pMac->sch.keepAlive = 1;
516
517
518 cfgValue = SYS_MS_TO_TICKS(cfgValue + SYS_TICK_DUR_MS - 1);
519
520 if (tx_timer_create(&pMac->lim.limTimers.gLimKeepaliveTimer,
521 "KEEPALIVE_TIMEOUT",
522 limKeepaliveTmerHandler,
523 0,
524 cfgValue,
525 cfgValue,
526 (pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ?
527 TX_AUTO_ACTIVATE : TX_NO_ACTIVATE)
528 != TX_SUCCESS)
529 {
530 // Cannot create keepalive timer. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700531 limLog(pMac, LOGP, FL("Cannot create keepalive timer."));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700532 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 }
534
535 /**
536 * Create all CNF_WAIT Timers upfront
537 */
538
539 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
540 &cfgValue) != eSIR_SUCCESS)
541 {
542 /**
543 * Could not get CNF_WAIT timeout value
544 * from CFG. Log error.
545 */
546 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700547 FL("could not retrieve CNF timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 }
549 cfgValue = SYS_MS_TO_TICKS(cfgValue);
550
551 for (i=0; i<pMac->lim.maxStation; i++)
552 {
553 if (tx_timer_create(&pMac->lim.limTimers.gpLimCnfWaitTimer[i],
554 "CNF_MISS_TIMEOUT",
555 limCnfWaitTmerHandler,
556 (tANI_U32)i,
557 cfgValue,
558 0,
559 TX_NO_ACTIVATE) != TX_SUCCESS)
560 {
561 // Cannot create timer. Log error.
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700562 limLog(pMac, LOGP, FL("Cannot create CNF wait timer."));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700563 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 }
565 }
566
567 /*
568 ** Alloc and init table for the preAuth timer list
569 **
570 **/
571
572 // get max number of Preauthentication
573 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH,
574 &cfgValue) != eSIR_SUCCESS)
575 {
576 /*
577 ** Could not get max preauth value
578 ** from CFG. Log error.
579 **/
580 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700581 FL("could not retrieve mac preauth value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 pMac->lim.gLimPreAuthTimerTable.numEntry = cfgValue;
Sushant Kaushikf4a27972015-04-16 16:48:00 +0530584 pMac->lim.gLimPreAuthTimerTable.pTable = vos_mem_vmalloc(cfgValue*sizeof(tLimPreAuthNode));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530585 if(pMac->lim.gLimPreAuthTimerTable.pTable == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530587 limLog(pMac, LOGP, FL("AllocateMemory failed!"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700588 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 }
Ramanasarvesh Sadula9447d372020-09-22 12:20:20 +0530590 memset(pMac->lim.gLimPreAuthTimerTable.pTable,
591 0, cfgValue*sizeof(tLimPreAuthNode));
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 limInitPreAuthTimerTable(pMac, &pMac->lim.gLimPreAuthTimerTable);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700593 PELOG1(limLog(pMac, LOG1, FL("alloc and init table for preAuth timers"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700594
595
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 {
597 /**
598 * Create OLBC cache aging timer
599 */
600 if (wlan_cfgGetInt(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT,
601 &cfgValue) != eSIR_SUCCESS)
602 {
603 /**
604 * Could not get OLBC detect timeout value
605 * from CFG. Log error.
606 */
607 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700608 FL("could not retrieve OLBD detect timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 }
610
611 cfgValue = SYS_MS_TO_TICKS(cfgValue);
612
613 if (tx_timer_create(
614 &pMac->lim.limTimers.gLimUpdateOlbcCacheTimer,
615 "OLBC UPDATE CACHE TIMEOUT",
616 limUpdateOlbcCacheTimerHandler,
617 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
618 cfgValue,
619 cfgValue,
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -0700620 TX_NO_ACTIVATE) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 {
622 // Cannot create update OLBC cache timer
623 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700624 limLog(pMac, LOGP, FL("Cannot create update OLBC cache timer"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700625 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 }
627 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700628#ifdef WLAN_FEATURE_VOWIFI_11R
629 // In future we need to use the auth timer, cause
630 // the pre auth session will be introduced before sending
631 // Auth frame.
632 // We need to go off channel and come back to home channel
633 cfgValue = 1000;
634 cfgValue = SYS_MS_TO_TICKS(cfgValue);
635
636 if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
637 "FT PREAUTH RSP TIMEOUT",
638 limTimerHandler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT,
639 cfgValue, 0,
640 TX_NO_ACTIVATE) != TX_SUCCESS)
641 {
642 // Could not create Join failure timer.
643 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700644 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700645 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 }
647#endif
648
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530649#ifdef WLAN_FEATURE_LFR_MBB
650 cfgValue = PREAUTH_REASSOC_TIMEOUT;
651 cfgValue = SYS_MS_TO_TICKS(cfgValue);
652
653 if (tx_timer_create(&pMac->lim.limTimers.glim_pre_auth_mbb_rsp_timer,
654 "PREAUTH MBB RSP TIMEOUT",
655 limTimerHandler, SIR_LIM_PREAUTH_MBB_RSP_TIMEOUT,
656 cfgValue, 0,
657 TX_NO_ACTIVATE) != TX_SUCCESS)
658 {
659 limLog(pMac, LOGP, FL("could not create PREAUTH_MBB_RSP timer"));
660 goto err_timer;
661 }
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +0530662
663 cfgValue = PREAUTH_REASSOC_TIMEOUT;
664 cfgValue = SYS_MS_TO_TICKS(cfgValue);
665
666 if (tx_timer_create(&pMac->lim.limTimers.glim_reassoc_mbb_rsp_timer,
667 "REASSOC MBB RSP TIMEOUT",
668 limTimerHandler, SIR_LIM_REASSOC_MBB_RSP_TIMEOUT,
669 cfgValue, 0,
670 TX_NO_ACTIVATE) != TX_SUCCESS)
671 {
672 limLog(pMac, LOGP, FL("could not create REASSOC_MBB_RSP timer"));
673 goto err_timer;
674 }
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530675#endif
676
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800677#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 cfgValue = 5000;
679 cfgValue = SYS_MS_TO_TICKS(cfgValue);
680
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800681 if (tx_timer_create(&pMac->lim.limTimers.gLimEseTsmTimer,
682 "ESE TSM Stats TIMEOUT",
683 limTimerHandler, SIR_LIM_ESE_TSM_TIMEOUT,
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 cfgValue, 0,
685 TX_NO_ACTIVATE) != TX_SUCCESS)
686 {
687 // Could not create Join failure timer.
688 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700689 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700690 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800692#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700693
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 cfgValue = 1000;
695 cfgValue = SYS_MS_TO_TICKS(cfgValue);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800696 if (tx_timer_create(&pMac->lim.limTimers.gLimDisassocAckTimer,
697 "DISASSOC ACK TIMEOUT",
698 limTimerHandler, SIR_LIM_DISASSOC_ACK_TIMEOUT,
699 cfgValue, 0,
700 TX_NO_ACTIVATE) != TX_SUCCESS)
701 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700702 limLog(pMac, LOGP, FL("could not DISASSOC ACK TIMEOUT timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800703 goto err_timer;
704 }
705
706 cfgValue = 1000;
707 cfgValue = SYS_MS_TO_TICKS(cfgValue);
708 if (tx_timer_create(&pMac->lim.limTimers.gLimDeauthAckTimer,
709 "DISASSOC ACK TIMEOUT",
Viral Modid86bde22012-12-10 13:09:21 -0800710 limTimerHandler, SIR_LIM_DEAUTH_ACK_TIMEOUT,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800711 cfgValue, 0,
712 TX_NO_ACTIVATE) != TX_SUCCESS)
713 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700714 limLog(pMac, LOGP, FL("could not create DEAUTH ACK TIMEOUT timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800715 goto err_timer;
716 }
Viral Modid86bde22012-12-10 13:09:21 -0800717
Viral Modid86bde22012-12-10 13:09:21 -0800718 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)
719 cfgValue = SYS_MS_TO_TICKS(cfgValue);
720 if (tx_timer_create(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
721 "Single Shot NOA Insert timeout",
722 limTimerHandler, SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT,
723 cfgValue, 0,
724 TX_NO_ACTIVATE) != TX_SUCCESS)
725 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700726 limLog(pMac, LOGP, FL("could not create Single Shot NOA Insert Timeout timer"));
Viral Modid86bde22012-12-10 13:09:21 -0800727 goto err_timer;
728 }
Viral Modid86bde22012-12-10 13:09:21 -0800729
Hanumantha Reddy Pothula97ea0952015-10-09 11:29:39 +0530730 cfgValue = WNI_CFG_ACTIVE_PASSIVE_CON_MAX;
731 if (eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_PASSIVE_CON,
Hanumantha Reddy Pothula802d31d2015-09-29 17:39:11 +0530732 &cfgValue))
733 {
734 limLog(pMac, LOGP,
735 FL("could not retrieve WNI_CFG_ACTIVE_PASSIVE_CON"));
736 }
737 if (cfgValue)
738 {
739 cfgValue = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
740 cfgValue = SYS_MS_TO_TICKS(cfgValue);
741 if (tx_timer_create(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer,
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530742 "ACTIVE TO PASSIVE CHANNEL", limTimerHandler,
743 SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE, cfgValue, 0,
744 TX_NO_ACTIVATE) != TX_SUCCESS)
Hanumantha Reddy Pothula802d31d2015-09-29 17:39:11 +0530745 {
746 limLog(pMac, LOGW,FL("could not create timer for passive channel to active channel"));
747 goto err_timer;
748 }
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530749 }
Hanumantha Reddy Pothula802d31d2015-09-29 17:39:11 +0530750 else
751 {
752 limLog(pMac, LOG1,
753 FL("gLimActiveToPassiveChannelTimer not created %d"), cfgValue);
754 }
Abhishek Singh550aa8c2017-10-30 17:34:53 +0530755 cfgValue = WNI_CFG_BEACON_INTERVAL_STADEF;
756 cfgValue = SYS_MS_TO_TICKS(cfgValue);
757 if (tx_timer_create(&pMac->lim.limTimers.g_lim_ap_ecsa_timer,
758 "AP ECSA TIMER", limTimerHandler,
759 SIR_LIM_SAP_ECSA_TIMEOUT,
760 cfgValue, 0,
761 TX_NO_ACTIVATE) != TX_SUCCESS)
762 {
763 limLog(pMac, LOGW,FL("could not create timer for passive channel to active channel"));
764 goto err_timer;
765 }
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530766
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700767 return TX_SUCCESS;
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700768
769 err_timer:
Viral Modid86bde22012-12-10 13:09:21 -0800770 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800771 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800772#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
773 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
774#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700775 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530776#ifdef WLAN_FEATURE_LFR_MBB
777 tx_timer_delete(&pMac->lim.limTimers.glim_pre_auth_mbb_rsp_timer);
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +0530778 tx_timer_delete(&pMac->lim.limTimers.glim_reassoc_mbb_rsp_timer);
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530779#endif
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700780 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
781 while(((tANI_S32)--i) >= 0)
782 {
783 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[i]);
784 }
785 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700786 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
787 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
788 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
789 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
790 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
791 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
792 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
Jeff Johnson62c27982013-02-27 17:53:55 -0800793 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800794 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
Sushant Kaushik9e923872015-04-02 17:09:31 +0530795 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700796 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
797 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
798 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
799 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
800 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
801 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
Venkata Prathyusha Kuntupalli7a87ff02013-01-29 10:45:54 -0800802 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530803 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
Abhishek Singh550aa8c2017-10-30 17:34:53 +0530804 tx_timer_delete(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
Abhinav Kumar626f8652019-08-05 16:20:39 +0530805 tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700806
807 if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800808 {
Sushant Kaushikf4a27972015-04-16 16:48:00 +0530809 vos_mem_vfree(pMac->lim.gLimPreAuthTimerTable.pTable);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800810 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
811 }
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700812
813 return TX_TIMER_ERROR;
814
Jeff Johnson295189b2012-06-20 16:38:30 -0700815} /****** end limCreateTimers() ******/
816
817
818
819/**
820 * limTimerHandler()
821 *
822 *FUNCTION:
823 * This function is called upon
824 * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
825 * 2. JOIN_FAILURE timer expiration while joining a BSS
826 * 3. AUTH_FAILURE timer expiration while authenticating with a peer
827 * 4. Heartbeat timer expiration on STA
828 * 5. Background scan timer expiration on STA
829 * 6. AID release, Pre-auth cleanup and Link monitoring timer
830 * expiration on AP
831 *
832 *LOGIC:
833 *
834 *ASSUMPTIONS:
835 * NA
836 *
837 *NOTE:
838 * NA
839 *
840 * @param param - Message corresponding to the timer that expired
841 *
842 * @return None
843 */
844
845void
846limTimerHandler(void *pMacGlobal, tANI_U32 param)
847{
848 tANI_U32 statusCode;
849 tSirMsgQ msg;
850 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
851
852 // Prepare and post message to LIM Message Queue
853
854 msg.type = (tANI_U16) param;
855 msg.bodyptr = NULL;
856 msg.bodyval = 0;
857
Padma, Santhosh Kumarb036fc72015-11-13 16:22:23 +0530858 if ((statusCode = limPostMsgApiHighPri(pMac, &msg)) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700860 FL("posting message %X to LIM failed, reason=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 msg.type, statusCode);
862} /****** end limTimerHandler() ******/
863
864
865/**
866 * limAddtsResponseTimerHandler()
867 *
868 *FUNCTION:
869 * This function is called upon Addts response timer expiration on sta
870 *
871 *LOGIC:
872 * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
873 * when this function is executed.
874 *
875 *ASSUMPTIONS:
876 * NA
877 *
878 *NOTE:
879 * NA
880 *
881 * @param param - pointer to pre-auth node
882 *
883 * @return None
884 */
885
886void
887limAddtsResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
888{
889 tSirMsgQ msg;
890 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
891
892 // Prepare and post message to LIM Message Queue
893
894 msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
895 msg.bodyval = param;
896 msg.bodyptr = NULL;
897
898 limPostMsgApi(pMac, &msg);
899} /****** end limAuthResponseTimerHandler() ******/
900
901
902/**
903 * limAuthResponseTimerHandler()
904 *
905 *FUNCTION:
906 * This function is called upon Auth response timer expiration on AP
907 *
908 *LOGIC:
909 * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
910 * when this function is executed.
911 *
912 *ASSUMPTIONS:
913 * NA
914 *
915 *NOTE:
916 * NA
917 *
918 * @param param - pointer to pre-auth node
919 *
920 * @return None
921 */
922
923void
924limAuthResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
925{
926 tSirMsgQ msg;
927 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
928
929 // Prepare and post message to LIM Message Queue
930
931 msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
932 msg.bodyptr = NULL;
933 msg.bodyval = (tANI_U32)param;
934
935 limPostMsgApi(pMac, &msg);
936} /****** end limAuthResponseTimerHandler() ******/
937
938
939
940/**
941 * limAssocFailureTimerHandler()
942 *
943 *FUNCTION:
944 * This function is called upon Re/Assoc failure timer expiration
945 * on STA
946 *
947 *LOGIC:
948 * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ
949 * when this function is executed.
950 *
951 *ASSUMPTIONS:
952 * NA
953 *
954 *NOTE:
955 * NA
956 *
957 * @param param - Indicates whether this is assoc or reassoc
958 * failure timeout
959 * @return None
960 */
961
962void
963limAssocFailureTimerHandler(void *pMacGlobal, tANI_U32 param)
964{
965 tSirMsgQ msg;
966 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
967
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800968#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700969 if((LIM_REASSOC == param) &&
Kanchanapally, Vidyullathab6da2a62014-02-06 12:28:52 +0530970 (NULL != pMac->lim.pSessionEntry) &&
971 (pMac->lim.pSessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE))
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700972 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700973 limLog(pMac, LOGE, FL("Reassoc timeout happened"));
Sachin Ahuja07a43012015-01-30 17:04:38 +0530974#ifdef FEATURE_WLAN_ESE
975 if (((pMac->lim.pSessionEntry->isESEconnection) &&
976 (pMac->lim.reAssocRetryAttempt <
977 (LIM_MAX_REASSOC_RETRY_LIMIT - 1)))||
978 ((!pMac->lim.pSessionEntry->isESEconnection) &&
979 (pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT))
980 )
981#else
982 if (pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT)
983#endif
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700984 {
985 limSendRetryReassocReqFrame(pMac, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, pMac->lim.pSessionEntry);
986 pMac->lim.reAssocRetryAttempt++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700987 limLog(pMac, LOGW, FL("Reassoc request retry is sent %d times"), pMac->lim.reAssocRetryAttempt);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700988 return;
989 }
990 else
991 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700992 limLog(pMac, LOGW, FL("Reassoc request retry MAX(%d) reached"), LIM_MAX_REASSOC_RETRY_LIMIT);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700993 if(NULL != pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
994 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530995 vos_mem_free( pMac->lim.pSessionEntry->pLimMlmReassocRetryReq);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700996 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = NULL;
997 }
998 }
999 }
1000#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 // Prepare and post message to LIM Message Queue
1002
1003 msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
1004 msg.bodyval = (tANI_U32)param;
1005 msg.bodyptr = NULL;
1006
1007 limPostMsgApi(pMac, &msg);
1008} /****** end limAssocFailureTimerHandler() ******/
1009
1010
1011/**
1012 * limUpdateOlbcCacheTimerHandler()
1013 *
1014 *FUNCTION:
1015 * This function is called upon update olbc cache timer expiration
1016 * on STA
1017 *
1018 *LOGIC:
1019 * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
1020 * when this function is executed.
1021 *
1022 *ASSUMPTIONS:
1023 * NA
1024 *
1025 *NOTE:
1026 * NA
1027 *
1028 * @param
1029 *
1030 * @return None
1031 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001032void
1033limUpdateOlbcCacheTimerHandler(void *pMacGlobal, tANI_U32 param)
1034{
1035 tSirMsgQ msg;
1036 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
1037
1038 // Prepare and post message to LIM Message Queue
1039
1040 msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
1041 msg.bodyval = 0;
1042 msg.bodyptr = NULL;
1043
1044 limPostMsgApi(pMac, &msg);
1045} /****** end limUpdateOlbcCacheTimerHandler() ******/
Jeff Johnson295189b2012-06-20 16:38:30 -07001046
1047/**
1048 * limDeactivateAndChangeTimer()
1049 *
1050 *FUNCTION:
1051 * This function is called to deactivate and change a timer
1052 * for future re-activation
1053 *
1054 *LOGIC:
1055 *
1056 *ASSUMPTIONS:
1057 * NA
1058 *
1059 *NOTE:
1060 * NA
1061 *
1062 * @param pMac - Pointer to Global MAC structure
1063 * @param timerId - enum of timer to be deactivated and changed
1064 * This enum is defined in limUtils.h file
1065 *
1066 * @return None
1067 */
1068
1069void
1070limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1071{
1072 tANI_U32 val=0, val1=0;
Sushant Kaushik9e923872015-04-02 17:09:31 +05301073 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001074
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 switch (timerId)
1076 {
1077 case eLIM_ADDTS_RSP_TIMER:
1078 pMac->lim.gLimAddtsRspTimerCount++;
1079 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
1080 {
1081 // Could not deactivate AddtsRsp Timer
1082 // Log error
1083 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001084 FL("Unable to deactivate AddtsRsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 }
1086 break;
1087
1088 case eLIM_MIN_CHANNEL_TIMER:
1089 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer)
1090 != TX_SUCCESS)
1091 {
1092 // Could not deactivate min channel timer.
1093 // Log error
1094 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001095 FL("Unable to deactivate min channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 }
1097
Jeff Johnsone7245742012-09-05 17:12:55 -07001098#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 // If a background was triggered via Quiet BSS,
1100 // then we need to adjust the MIN and MAX channel
1101 // timer's accordingly to the Quiet duration that
1102 // was specified
1103 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1104 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1105 {
1106 // gLimQuietDuration is already cached in units of
1107 // system ticks. No conversion is reqd...
1108 val = pMac->lim.gLimSpecMgmt.quietDuration;
1109 }
1110 else
1111 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001112#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 if(pMac->lim.gpLimMlmScanReq)
1114 {
1115 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301116 if (pMac->btc.btc_scan_compromise_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001117 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301118 if (pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001119 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301120 val = SYS_MS_TO_TICKS(
1121 pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001122 limLog(pMac, LOG1, FL("Using BTC Min Active Scan time"));
1123 }
1124 else
1125 {
1126 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1127 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301128 } else if (pMac->btc.btc_scan_compromise_sco &&
1129 pMac->roam.configParam.min_chntime_btc_sco) {
1130 val = SYS_MS_TO_TICKS(
1131 pMac->roam.configParam.min_chntime_btc_sco);
1132 limLog(pMac, LOG1,
1133 FL("Using BTC SCO Min Active Scan time %d"), val);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001134 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001135 }
1136 else
1137 {
1138 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1139 //No need to change min timer. This is not a scan
1140 break;
1141 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001142#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001143 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001144#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001145
1146 if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
1147 val, 0) != TX_SUCCESS)
1148 {
1149 // Could not change min channel timer.
1150 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001151 limLog(pMac, LOGP, FL("Unable to change min channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001152 }
1153
1154 break;
1155
1156 case eLIM_PERIODIC_PROBE_REQ_TIMER:
1157 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
1158 != TX_SUCCESS)
1159 {
1160 // Could not deactivate min channel timer.
1161 // Log error
1162 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001163 FL("Unable to deactivate periodic timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 }
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301165 if(pMac->lim.gpLimMlmScanReq)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001166 {
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301167 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301168 if (pMac->btc.btc_scan_compromise_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301169 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301170 if (pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301171 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301172 val = SYS_MS_TO_TICKS(
1173 pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)/2;
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301174 limLog(pMac, LOG1, FL("Using BTC Min Active Scan time"));
1175 }
1176 else
1177 {
1178 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1179 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301180 } else if (pMac->btc.btc_scan_compromise_sco &&
1181 pMac->roam.configParam.min_chntime_btc_sco) {
1182 val = SYS_MS_TO_TICKS(
1183 pMac->roam.configParam.min_chntime_btc_sco / 2);
1184 limLog(pMac, LOG1,
1185 FL("Using BTC SCO Min Active Scan time %d"), val);
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301186 }
1187 }
1188 /*If val is 0 it means min Channel timer is 0 so take the value from maxChannelTimer*/
1189 if (!val)
1190 {
1191
1192 if(pMac->lim.gpLimMlmScanReq)
1193 {
1194 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime)/2;
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301195 if (pMac->btc.btc_scan_compromise_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301196 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301197 if (pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301198 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301199 val = SYS_MS_TO_TICKS(
1200 pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)/2;
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301201 limLog(pMac, LOG1, FL("Using BTC Max Active Scan time"));
1202 }
1203 else
1204 {
1205 limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set"));
1206 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301207 } else if (pMac->btc.btc_scan_compromise_sco &&
1208 pMac->roam.configParam.max_chntime_btc_sco) {
1209 val = SYS_MS_TO_TICKS(
1210 pMac->roam.configParam.max_chntime_btc_sco / 2);
1211 limLog(pMac, LOG1,
1212 FL("Using BTC SCO Max Active Scan time %d"), val);
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301213 }
1214 }
1215 else
1216 {
1217 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1218 //No need to change max timer. This is not a scan
1219 break;
1220 }
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001221 }
Mahesh A Saptasagarbfcdcc32015-09-24 17:41:51 +05301222 if (val)
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 {
Mahesh A Saptasagarbfcdcc32015-09-24 17:41:51 +05301224 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
1225 val, 0) != TX_SUCCESS)
1226 {
1227 // Could not change min channel timer.
1228 // Log error
1229 limLog(pMac, LOGE, FL("Unable to change periodic timer"));
1230 }
1231 }
1232 else
1233 {
1234 limLog(pMac, LOGE, FL("Do not change gLimPeriodicProbeReqTimer values,"
1235 "value = %d minchannel time = %d"
1236 "maxchannel time = %d"), val,
1237 pMac->lim.gpLimMlmScanReq->minChannelTime,
1238 pMac->lim.gpLimMlmScanReq->maxChannelTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07001239 }
1240
1241 break;
1242
1243 case eLIM_MAX_CHANNEL_TIMER:
1244 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
1245 != TX_SUCCESS)
1246 {
1247 // Could not deactivate max channel timer.
1248 // Log error
1249 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001250 FL("Unable to deactivate max channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 }
1252
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 // If a background was triggered via Quiet BSS,
1254 // then we need to adjust the MIN and MAX channel
1255 // timer's accordingly to the Quiet duration that
1256 // was specified
1257 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
1258 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001259#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001260
1261 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1262 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1263 {
1264 // gLimQuietDuration is already cached in units of
1265 // system ticks. No conversion is reqd...
1266 val = pMac->lim.gLimSpecMgmt.quietDuration;
1267 }
1268 else
1269 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001270#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 if(pMac->lim.gpLimMlmScanReq)
1272 {
1273 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301274 if (pMac->btc.btc_scan_compromise_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001275 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301276 if (pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001277 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301278 val = SYS_MS_TO_TICKS(
1279 pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001280 limLog(pMac, LOG1, FL("Using BTC Max Active Scan time"));
1281 }
1282 else
1283 {
1284 limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set"));
1285 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301286 } else if (pMac->btc.btc_scan_compromise_sco &&
1287 pMac->roam.configParam.max_chntime_btc_sco) {
1288 val = SYS_MS_TO_TICKS(
1289 pMac->roam.configParam.max_chntime_btc_sco);
1290 limLog(pMac, LOG1,
1291 FL("Using BTC SCO Max Active Scan time %d"), val);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001292 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 }
1294 else
1295 {
1296 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1297 //No need to change max timer. This is not a scan
1298 break;
1299 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001300#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001302#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001304
1305 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
1306 val, 0) != TX_SUCCESS)
1307 {
1308 // Could not change max channel timer.
1309 // Log error
1310 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001311 FL("Unable to change max channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001312 }
1313
1314 break;
1315
1316 case eLIM_JOIN_FAIL_TIMER:
1317 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
1318 != TX_SUCCESS)
1319 {
1320 /**
1321 * Could not deactivate Join Failure
1322 * timer. Log error.
1323 */
1324 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001325 FL("Unable to deactivate Join Failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 }
1327
1328 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1329 &val) != eSIR_SUCCESS)
1330 {
1331 /**
1332 * Could not get JoinFailureTimeout value
1333 * from CFG. Log error.
1334 */
1335 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001336 FL("could not retrieve JoinFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 }
1338 val = SYS_MS_TO_TICKS(val);
1339
1340 if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
1341 val, 0) != TX_SUCCESS)
1342 {
1343 /**
1344 * Could not change Join Failure
1345 * timer. Log error.
1346 */
1347 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001348 FL("Unable to change Join Failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 }
1350
1351 break;
1352
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001353 case eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER:
1354 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer)
1355 != TX_SUCCESS)
1356 {
1357 // Could not deactivate periodic join req Times.
1358 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001359 FL("Unable to deactivate periodic join request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001360 }
1361
1362 val = SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS);
1363 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
1364 val, 0) != TX_SUCCESS)
1365 {
1366 // Could not change periodic join req times.
1367 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001368 limLog(pMac, LOGP, FL("Unable to change periodic join request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001369 }
Jeff Johnson62c27982013-02-27 17:53:55 -08001370
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001371 break;
1372
Jeff Johnson295189b2012-06-20 16:38:30 -07001373 case eLIM_AUTH_FAIL_TIMER:
1374 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
1375 != TX_SUCCESS)
1376 {
1377 // Could not deactivate Auth failure timer.
1378 // Log error
1379 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001380 FL("Unable to deactivate auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001381 }
1382
1383 // Change timer to reactivate it in future
1384 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
1385 &val) != eSIR_SUCCESS)
1386 {
1387 /**
1388 * Could not get AuthFailureTimeout value
1389 * from CFG. Log error.
1390 */
1391 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001392 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001393 }
1394 val = SYS_MS_TO_TICKS(val);
1395
1396 if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
1397 val, 0) != TX_SUCCESS)
1398 {
1399 // Could not change Authentication failure timer.
1400 // Log error
1401 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001402 FL("unable to change Auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 }
1404
1405 break;
1406
Sushant Kaushik9e923872015-04-02 17:09:31 +05301407 case eLIM_AUTH_RETRY_TIMER:
1408
1409 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer)
1410 != TX_SUCCESS)
1411 {
1412 // Could not deactivate Auth Retry Timer.
1413 limLog(pMac, LOGP,
1414 FL("Unable to deactivate Auth Retry timer"));
1415 }
1416 if ((psessionEntry = peFindSessionBySessionId(pMac,
1417 pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId))
1418 == NULL)
1419 {
1420 limLog(pMac, LOGP,
1421 FL("session does not exist for given SessionId : %d"),
1422 pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId);
1423 break;
1424 }
1425 /* 3/5 of the beacon interval*/
1426 val = psessionEntry->beaconParams.beaconInterval * 3/5;
1427 val = SYS_MS_TO_TICKS(val);
1428 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer,
1429 val, 0) != TX_SUCCESS)
1430 {
1431 // Could not change Auth Retry timer.
1432 // Log error
1433 limLog(pMac, LOGP, FL("Unable to change Auth Retry timer"));
1434 }
1435
1436 break;
1437
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 case eLIM_ASSOC_FAIL_TIMER:
1439 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
1440 TX_SUCCESS)
1441 {
1442 // Could not deactivate Association failure timer.
1443 // Log error
1444 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001445 FL("unable to deactivate Association failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001446 }
1447
1448 // Change timer to reactivate it in future
1449 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
1450 &val) != eSIR_SUCCESS)
1451 {
1452 /**
1453 * Could not get AssocFailureTimeout value
1454 * from CFG. Log error.
1455 */
1456 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001457 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 }
1459 val = SYS_MS_TO_TICKS(val);
1460
1461 if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
1462 val, 0) != TX_SUCCESS)
1463 {
1464 // Could not change Association failure timer.
1465 // Log error
1466 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001467 FL("unable to change Assoc failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 }
1469
1470 break;
1471
1472 case eLIM_REASSOC_FAIL_TIMER:
1473 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
1474 TX_SUCCESS)
1475 {
1476 // Could not deactivate Reassociation failure timer.
1477 // Log error
1478 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001479 FL("unable to deactivate Reassoc failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 }
1481
1482 // Change timer to reactivate it in future
1483 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1484 &val) != eSIR_SUCCESS)
1485 {
1486 /**
1487 * Could not get ReassocFailureTimeout value
1488 * from CFG. Log error.
1489 */
1490 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001491 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 }
1493 val = SYS_MS_TO_TICKS(val);
1494
1495 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
1496 val, 0) != TX_SUCCESS)
1497 {
1498 // Could not change Reassociation failure timer.
1499 // Log error
1500 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001501 FL("unable to change Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 }
1503
1504 break;
1505
1506 case eLIM_HEART_BEAT_TIMER:
1507 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
1508 TX_SUCCESS)
1509 {
1510 // Could not deactivate Heartbeat timer.
1511 // Log error
1512 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001513 FL("unable to deactivate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001515 else
1516 {
1517 limLog(pMac, LOGW, FL("Deactivated heartbeat link monitoring"));
1518 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001519
1520 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
1521 &val) != eSIR_SUCCESS)
1522 {
1523 /**
1524 * Could not get BEACON_INTERVAL value
1525 * from CFG. Log error.
1526 */
1527 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001528 FL("could not retrieve BEACON_INTERVAL value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001529 }
1530
1531 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
1532 eSIR_SUCCESS)
1533 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001534 FL("could not retrieve heartbeat failure value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001535
1536 // Change timer to reactivate it in future
1537 val = SYS_MS_TO_TICKS(val * val1);
1538
1539 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
1540 val, 0) != TX_SUCCESS)
1541 {
1542 // Could not change HeartBeat timer.
1543 // Log error
1544 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001545 FL("unable to change HeartBeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001546 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001547 else
1548 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001549 limLog(pMac, LOGW, FL("HeartBeat timer value is changed = %u"), val);
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001550 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001551 break;
1552
1553 case eLIM_PROBE_AFTER_HB_TIMER:
1554 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
1555 TX_SUCCESS)
1556 {
1557 // Could not deactivate Heartbeat timer.
1558 // Log error
1559 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001560 FL("unable to deactivate probeAfterHBTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001562 else
1563 {
Kaushik, Sushant8489f472014-01-27 11:41:22 +05301564 limLog(pMac, LOG1, FL("Deactivated probe after hb timer"));
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001565 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001566
1567 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
1568 &val) != eSIR_SUCCESS)
1569 {
1570 /**
1571 * Could not get PROBE_AFTER_HB_FAILURE
1572 * value from CFG. Log error.
1573 */
1574 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001575 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001576 }
1577
1578 // Change timer to reactivate it in future
1579 val = SYS_MS_TO_TICKS(val);
1580
1581 if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
1582 val, 0) != TX_SUCCESS)
1583 {
1584 // Could not change HeartBeat timer.
1585 // Log error
1586 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001587 FL("unable to change ProbeAfterHBTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001588 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001589 else
1590 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001591 limLog(pMac, LOGW, FL("Probe after HB timer value is changed = %u"), val);
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001592 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001593
1594 break;
1595
1596 case eLIM_KEEPALIVE_TIMER:
1597 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
1598 != TX_SUCCESS)
1599 {
1600 // Could not deactivate Keepalive timer.
1601 // Log error
1602 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001603 FL("unable to deactivate KeepaliveTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001604 }
1605
1606 // Change timer to reactivate it in future
1607
1608 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
1609 &val) != eSIR_SUCCESS)
1610 {
1611 /**
1612 * Could not get keepalive timeout value
1613 * from CFG. Log error.
1614 */
1615 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001616 FL("could not retrieve keepalive timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 }
1618 if (val == 0)
1619 {
1620 val = 3000;
1621 pMac->sch.keepAlive = 0;
1622 } else
1623 pMac->sch.keepAlive = 1;
1624
1625
1626
1627 val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
1628
1629 if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
1630 val, val) != TX_SUCCESS)
1631 {
1632 // Could not change KeepaliveTimer timer.
1633 // Log error
1634 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001635 FL("unable to change KeepaliveTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001636 }
1637
1638 break;
1639
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 case eLIM_BACKGROUND_SCAN_TIMER:
1641 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
1642 != TX_SUCCESS)
1643 {
1644 // Could not deactivate BackgroundScanTimer timer.
1645 // Log error
1646 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001647 FL("unable to deactivate BackgroundScanTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 }
1649
1650 // Change timer to reactivate it in future
1651 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
1652 &val) != eSIR_SUCCESS)
1653 {
1654 /**
1655 * Could not get Background scan period value
1656 * from CFG. Log error.
1657 */
1658 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001659 FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 }
1661 if (val == 0)
1662 {
1663 val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
1664 pMac->lim.gLimBackgroundScanDisable = true;
1665 }
1666 else
1667 pMac->lim.gLimBackgroundScanDisable = false;
1668
1669 val = SYS_MS_TO_TICKS(val);
1670
1671 if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
1672 val, val) != TX_SUCCESS)
1673 {
1674 // Could not change BackgroundScanTimer timer.
1675 // Log error
1676 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001677 FL("unable to change BackgroundScanTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001678 }
1679
1680 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001681
Jeff Johnsone7245742012-09-05 17:12:55 -07001682#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 case eLIM_CHANNEL_SWITCH_TIMER:
1684 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
1685 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001686 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001687 return;
1688 }
1689
1690 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
1691 pMac->lim.gLimChannelSwitch.switchTimeoutValue,
1692 0) != TX_SUCCESS)
1693 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001694 limLog(pMac, LOGP, FL("tx_timer_change failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001695 return;
1696 }
1697 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001698#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001699
1700 case eLIM_LEARN_DURATION_TIMER:
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 break;
1702
Jeff Johnsone7245742012-09-05 17:12:55 -07001703#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 case eLIM_QUIET_BSS_TIMER:
1705 if (TX_SUCCESS !=
1706 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
1707 {
1708 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001709 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001710 }
1711
1712 // gLimQuietDuration appears to be in units of ticks
1713 // Use it as is
1714 if (TX_SUCCESS !=
1715 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
1716 pMac->lim.gLimSpecMgmt.quietDuration,
1717 0))
1718 {
1719 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001720 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001721 }
1722 break;
1723
1724 case eLIM_QUIET_TIMER:
1725 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
1726 {
1727 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001728 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001729 }
1730
1731 // Set the NEW timeout value, in ticks
1732 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
1733 SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
1734 {
1735 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001736 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 }
1738 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001739#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001740
Jeff Johnson295189b2012-06-20 16:38:30 -07001741#if 0
1742 case eLIM_WPS_OVERLAP_TIMER:
1743 {
1744 // Restart Learn Interval timer
1745
1746 tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
1747
1748 if (tx_timer_deactivate(
1749 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1750 {
1751 // Could not deactivate Learn Interval timer.
1752 // Log error
1753 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001754 FL("Unable to deactivate WPS overlap timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001755 }
1756
1757 if (tx_timer_change(
1758 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1759 WPSOverlapTimer, 0) != TX_SUCCESS)
1760 {
1761 // Could not change Learn Interval timer.
1762 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001763 limLog(pMac, LOGP, FL("Unable to change WPS overlap timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001764
1765 return;
1766 }
1767
1768 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001769 FL("Setting WPS overlap TIMER to %d ticks"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001770 WPSOverlapTimer);
1771 }
1772 break;
1773#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001774
1775#ifdef WLAN_FEATURE_VOWIFI_11R
1776 case eLIM_FT_PREAUTH_RSP_TIMER:
1777 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != TX_SUCCESS)
1778 {
1779 /**
1780 ** Could not deactivate Join Failure
1781 ** timer. Log error.
1782 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001783 limLog(pMac, LOGP, FL("Unable to deactivate Preauth response Failure timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001784 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001785 }
1786 val = 1000;
1787 val = SYS_MS_TO_TICKS(val);
1788 if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
1789 val, 0) != TX_SUCCESS)
1790 {
1791 /**
1792 * Could not change Join Failure
1793 * timer. Log error.
1794 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001795 limLog(pMac, LOGP, FL("Unable to change Join Failure timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001796 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 }
1798 break;
1799#endif
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301800
1801#ifdef WLAN_FEATURE_LFR_MBB
1802 case eLIM_PREAUTH_MBB_RSP_TIMER:
Padma, Santhosh Kumarce74fd82017-02-10 19:57:08 +05301803 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE,
1804 NO_SESSION, eLIM_PREAUTH_MBB_RSP_TIMER));
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301805 if (tx_timer_deactivate(&pMac->lim.limTimers.
1806 glim_pre_auth_mbb_rsp_timer) != TX_SUCCESS) {
1807 limLog(pMac, LOGP,
1808 FL("Unable to deactivate preauth response mbb timer"));
1809 return;
1810 }
1811 break;
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +05301812 case eLIM_REASSOC_MBB_RSP_TIMER:
Padma, Santhosh Kumarce74fd82017-02-10 19:57:08 +05301813 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE,
1814 NO_SESSION, eLIM_REASSOC_MBB_RSP_TIMER));
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +05301815 if (tx_timer_deactivate(&pMac->lim.limTimers.
1816 glim_reassoc_mbb_rsp_timer) != TX_SUCCESS) {
1817 limLog(pMac, LOGP,
1818 FL("Unable to deactivate reassoc response mbb timer"));
1819 return;
1820 }
1821 break;
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301822#endif
1823
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001824#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001825 case eLIM_TSM_TIMER:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001826 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 != TX_SUCCESS)
1828 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001829 limLog(pMac, LOGE, FL("Unable to deactivate TSM timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 }
1831 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001832#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Gopichand Nakkalad492d202013-05-10 02:50:47 +05301833
1834 case eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
1835 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer) != TX_SUCCESS)
1836 {
1837 /**
1838 ** Could not deactivate Active to passive channel timer.
1839 ** Log error.
1840 **/
1841 limLog(pMac, LOGP, FL("Unable to Deactivate "
1842 "Active to passive channel timer"));
1843 return;
1844 }
1845 val = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
1846 val = SYS_MS_TO_TICKS(val);
1847 if (tx_timer_change(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer,
1848 val, 0) != TX_SUCCESS)
1849 {
1850 /**
1851 * Could not change timer to check scan type for passive channel.
1852 * timer. Log error.
1853 */
1854 limLog(pMac, LOGP, FL("Unable to change timer"));
1855 return;
1856 }
1857 break;
1858
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001859 case eLIM_DISASSOC_ACK_TIMER:
1860 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer) != TX_SUCCESS)
1861 {
1862 /**
1863 ** Could not deactivate Join Failure
1864 ** timer. Log error.
1865 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001866 limLog(pMac, LOGP, FL("Unable to deactivate Disassoc ack timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001867 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001868 }
1869 val = 1000;
1870 val = SYS_MS_TO_TICKS(val);
1871 if (tx_timer_change(&pMac->lim.limTimers.gLimDisassocAckTimer,
1872 val, 0) != TX_SUCCESS)
1873 {
1874 /**
1875 * Could not change Join Failure
1876 * timer. Log error.
1877 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001878 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001879 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001880 }
1881 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001882
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001883 case eLIM_DEAUTH_ACK_TIMER:
1884 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer) != TX_SUCCESS)
1885 {
1886 /**
1887 ** Could not deactivate Join Failure
1888 ** timer. Log error.
1889 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001890 limLog(pMac, LOGP, FL("Unable to deactivate Deauth ack timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001891 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001892 }
1893 val = 1000;
1894 val = SYS_MS_TO_TICKS(val);
1895 if (tx_timer_change(&pMac->lim.limTimers.gLimDeauthAckTimer,
1896 val, 0) != TX_SUCCESS)
1897 {
1898 /**
1899 * Could not change Join Failure
1900 * timer. Log error.
1901 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001902 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001903 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001904 }
1905 break;
Viral Modid86bde22012-12-10 13:09:21 -08001906
Viral Modid86bde22012-12-10 13:09:21 -08001907 case eLIM_INSERT_SINGLESHOT_NOA_TIMER:
1908 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer) != TX_SUCCESS)
1909 {
1910 /**
1911 ** Could not deactivate SingleShot NOA Insert
1912 ** timer. Log error.
1913 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001914 limLog(pMac, LOGP, FL("Unable to deactivate SingleShot NOA Insert timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001915 return;
1916 }
1917 val = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE;
1918 val = SYS_MS_TO_TICKS(val);
1919 if (tx_timer_change(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
1920 val, 0) != TX_SUCCESS)
1921 {
1922 /**
1923 * Could not change Single Shot NOA Insert
1924 * timer. Log error.
1925 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001926 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001927 return;
1928 }
1929 break;
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301930 case eLIM_AP_ECSA_TIMER:
1931 if (tx_timer_deactivate(
1932 &pMac->lim.limTimers.g_lim_ap_ecsa_timer) != TX_SUCCESS)
1933 {
1934 /*
1935 * Could not deactivate SingleShot NOA Insert
1936 * timer. Log error.
1937 */
1938 limLog(pMac, LOGE, FL("Unable to deactivate AP ecsa timer"));
1939 return;
1940 }
1941 if ((psessionEntry = peFindSessionBySessionId(pMac,
1942 pMac->lim.limTimers.g_lim_ap_ecsa_timer.sessionId)) == NULL)
1943 {
1944 limLog(pMac, LOGE,
1945 FL("session does not exist for given SessionId : %d, for AP ecsa timer"),
1946 pMac->lim.limTimers.g_lim_ap_ecsa_timer.sessionId);
1947 break;
1948 }
1949 val = psessionEntry->beaconParams.beaconInterval;
1950 val = SYS_MS_TO_TICKS(val);
1951 if (tx_timer_change(&pMac->lim.limTimers.g_lim_ap_ecsa_timer,
1952 val, 0) != TX_SUCCESS)
1953 {
1954 limLog(pMac, LOGE, FL("Unable to change g_lim_ap_ecsa_timer timer"));
1955 }
Jeff Johnson62c27982013-02-27 17:53:55 -08001956
Abhinav Kumar626f8652019-08-05 16:20:39 +05301957 case eLIM_AUTH_SAE_TIMER:
1958 if (tx_timer_deactivate(&pMac->lim.limTimers.sae_auth_timer)
1959 != TX_SUCCESS) {
1960 limLog(pMac, LOGP, FL("Unable to deactivate SAE auth timer"));
1961 return;
1962 }
1963 /* Change timer to reactivate it in future */
1964 val = SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS);
1965 if (tx_timer_change(&pMac->lim.limTimers.sae_auth_timer,
1966 val, 0) != TX_SUCCESS) {
1967 limLog(pMac, LOGP, FL("unable to change SAE auth timer"));
1968 return;
1969 }
1970 break;
1971
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301972 break;
1973 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 // Invalid timerId. Log error
1975 break;
1976 }
1977} /****** end limDeactivateAndChangeTimer() ******/
1978
1979
1980
1981/**---------------------------------------------------------------
1982\fn limHeartBeatDeactivateAndChangeTimer
1983\brief This function deactivates and changes the heart beat
1984\ timer, eLIM_HEART_BEAT_TIMER.
1985\
1986\param pMac
1987\param psessionEntry
1988\return None
1989------------------------------------------------------------------*/
1990void
1991limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1992{
Ravi Joshid0699502013-07-08 15:48:47 -07001993 tANI_U32 val, val1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001994
Siddharth Bhal224da542014-05-28 07:07:46 +05301995 if (NULL == psessionEntry)
1996 {
1997 limLog(pMac, LOGE, FL("%s: received session id NULL."
1998 " Heartbeat timer config failed"), __func__);
1999 return;
2000 }
2001
Yathish9f22e662012-12-10 14:21:35 -08002002#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
Ravi Joshid0699502013-07-08 15:48:47 -07002003 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2004 return;
Yathish9f22e662012-12-10 14:21:35 -08002005#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002006
Ravi Joshid0699502013-07-08 15:48:47 -07002007 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
2008 limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002009
Ravi Joshid0699502013-07-08 15:48:47 -07002010 /* HB Timer sessionisation: In case of 2 or more sessions, the HB interval keeps
2011 changing. to avoid this problem, HeartBeat interval is made constant, by
2012 fixing beacon interval to 100ms immaterial of the beacon interval of the session */
Jeff Johnson295189b2012-06-20 16:38:30 -07002013
Ravi Joshid0699502013-07-08 15:48:47 -07002014 //val = psessionEntry->beaconParams.beaconInterval;
2015 val = LIM_HB_TIMER_BEACON_INTERVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002016
Ravi Joshid0699502013-07-08 15:48:47 -07002017 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
2018 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_HEART_BEAT_THRESHOLD "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002019
Ravi Joshid0699502013-07-08 15:48:47 -07002020 PELOGW(limLog(pMac,LOGW,
2021 FL("HB Timer Int.=100ms * %d, Beacon Int.=%dms,Session Id=%d "),
2022 val1, psessionEntry->beaconParams.beaconInterval,
2023 psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002024
Ravi Joshid0699502013-07-08 15:48:47 -07002025 /* The HB timer timeout value of 4 seconds (40 beacon intervals) is not
2026 * enough to judge the peer device inactivity when 32 peers are connected.
2027 * Hence increasing the HB timer timeout to
2028 * HBtimeout = (TBTT * num_beacons * num_peers)
2029 */
2030 if (eSIR_IBSS_MODE == psessionEntry->bssType &&
2031 pMac->lim.gLimNumIbssPeers > 0)
2032 {
Ravi Joshi92a4e142013-06-27 17:00:42 -07002033 val1 = val1 * pMac->lim.gLimNumIbssPeers;
Ravi Joshid0699502013-07-08 15:48:47 -07002034 }
Ravi Joshi92a4e142013-06-27 17:00:42 -07002035
Ravi Joshid0699502013-07-08 15:48:47 -07002036 // Change timer to reactivate it in future
2037 val = SYS_MS_TO_TICKS(val * val1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002038
Ravi Joshid0699502013-07-08 15:48:47 -07002039 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer, val, 0) != TX_SUCCESS)
2040 limLog(pMac, LOGP, FL("Fail to change HeartBeatTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002041
2042} /****** end limHeartBeatDeactivateAndChangeTimer() ******/
2043
2044
2045/**---------------------------------------------------------------
2046\fn limReactivateHeartBeatTimer
2047\brief This function s called to deactivate, change and
2048\ activate a timer.
2049\
2050\param pMac - Pointer to Global MAC structure
2051\param psessionEntry
2052\return None
2053------------------------------------------------------------------*/
2054void
2055limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
2056{
Siddharth Bhald31c1252014-05-05 19:34:14 +05302057 if (NULL == psessionEntry)
2058 {
2059 limLog(pMac, LOGE, FL("%s: received session id NULL."
2060 " Heartbeat timer config failed"), __func__);
2061 return;
2062 }
2063
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002064 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d"), psessionEntry->LimRxedBeaconCntDuringHB);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002065
Yathish9f22e662012-12-10 14:21:35 -08002066#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2067 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07002068 {
2069 limLog(pMac, LOGW, FL("Active offload feature is enabled, FW takes care of HB monitoring"));
Yathish9f22e662012-12-10 14:21:35 -08002070 return;
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07002071 }
Yathish9f22e662012-12-10 14:21:35 -08002072#endif
2073
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002075
2076 //only start the hearbeat-timer if the timeout value is non-zero
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002077 if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0)
2078 {
2079 /*
2080 * There is increasing need to limit the apps wakeup due to WLAN
2081 * activity. During HB monitoring, the beacons from peer are sent to
2082 * the host causing the host to wakeup. Hence, offloading the HB
2083 * monitoring to LMAC
2084 */
2085 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE &&
2086 IS_IBSS_HEARTBEAT_OFFLOAD_FEATURE_ENABLE)
2087 {
2088 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
2089 {
2090 limLog(pMac, LOGP,FL("IBSS HeartBeat Offloaded, Could not deactivate Heartbeat timer"));
2091 }
2092 else
2093 {
2094 limLog(pMac, LOGE, FL("IBSS HeartBeat Offloaded, Deactivated heartbeat link monitoring"));
2095 }
2096 }
2097 else
2098 {
2099 if (tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
2100 {
2101 limLog(pMac, LOGP,FL("could not activate Heartbeat timer"));
2102 }
2103 else
2104 {
2105 limLog(pMac, LOGW, FL("Reactivated heartbeat link monitoring"));
2106 }
2107 }
2108 limResetHBPktCount(psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 }
2110
2111} /****** end limReactivateHeartBeatTimer() ******/
2112
Jeff Johnson295189b2012-06-20 16:38:30 -07002113
2114/**
2115 * limActivateHearBeatTimer()
2116 *
2117 *
2118 * @brief: This function is called to activate heartbeat timer
2119 *
2120 *LOGIC:
2121 *
2122 *ASSUMPTIONS:
2123 * NA
2124 *
2125 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2126 *
2127 * @param pMac - Pointer to Global MAC structure
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002128 * @param psessionEntry - Session Entry
Jeff Johnson295189b2012-06-20 16:38:30 -07002129 *
2130 * @return TX_SUCCESS - timer is activated
2131 * errors - fail to start the timer
2132 */
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002133v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002134{
2135 v_UINT_t status = TX_TIMER_ERROR;
2136
Yathish9f22e662012-12-10 14:21:35 -08002137#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2138 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Ravi Joshif7fe8d32013-09-21 17:02:11 -07002139 return (TX_SUCCESS);
Yathish9f22e662012-12-10 14:21:35 -08002140#endif
2141
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 if(TX_AIRGO_TMR_SIGNATURE == pMac->lim.limTimers.gLimHeartBeatTimer.tmrSignature)
2143 {
2144 //consider 0 interval a ok case
2145 if( pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs )
2146 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002147 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE &&
2148 IS_IBSS_HEARTBEAT_OFFLOAD_FEATURE_ENABLE)
2149 {
2150 /* HB offload in IBSS mode */
2151 status = tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
2152 if (TX_SUCCESS != status)
2153 {
2154 PELOGE(limLog(pMac, LOGE,
2155 FL("IBSS HB Offload, Could not deactivate HB timer status(%d)"),
2156 status);)
2157 }
2158 else
2159 {
2160 PELOGE(limLog(pMac, LOGE,
2161 FL("%s] IBSS HB Offloaded, Heartbeat timer deactivated"),
2162 __func__);)
2163 }
2164
2165 }
2166 else
2167 {
2168 status = tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer);
2169 if ( TX_SUCCESS != status )
2170 {
2171 PELOGE(limLog(pMac, LOGE,
2172 FL("could not activate Heartbeat timer status(%d)"), status);)
2173 }
2174 else
2175 {
2176 PELOGE(limLog(pMac, LOGW,
2177 FL("%s] Activated Heartbeat timer status(%d)"), __func__, status);)
2178 }
2179 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 }
2181 else
2182 {
2183 status = TX_SUCCESS;
2184 }
2185 }
2186
2187 return (status);
2188}
2189
2190
2191
2192/**
2193 * limDeactivateAndChangePerStaIdTimer()
2194 *
2195 *
2196 * @brief: This function is called to deactivate and change a per STA timer
2197 * for future re-activation
2198 *
2199 *LOGIC:
2200 *
2201 *ASSUMPTIONS:
2202 * NA
2203 *
2204 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2205 *
2206 * @param pMac - Pointer to Global MAC structure
2207 * @param timerId - enum of timer to be deactivated and changed
2208 * This enum is defined in limUtils.h file
2209 * @param staId - staId
2210 *
2211 * @return None
2212 */
2213
2214void
2215limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
2216{
2217 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002218
2219 switch (timerId)
2220 {
2221 case eLIM_CNF_WAIT_TIMER:
2222
2223 if (tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2224 != TX_SUCCESS)
2225 {
2226 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002227 FL("unable to deactivate CNF wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002228
2229 }
2230
2231 // Change timer to reactivate it in future
2232
2233 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
2234 &val) != eSIR_SUCCESS)
2235 {
2236 /**
2237 * Could not get cnf timeout value
2238 * from CFG. Log error.
2239 */
2240 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002241 FL("could not retrieve cnf timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 }
2243 val = SYS_MS_TO_TICKS(val);
2244
2245 if (tx_timer_change(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId],
2246 val, val) != TX_SUCCESS)
2247 {
2248 // Could not change cnf timer.
2249 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002250 limLog(pMac, LOGP, FL("unable to change cnf wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002251 }
2252
2253 break;
2254
2255 case eLIM_AUTH_RSP_TIMER:
2256 {
2257 tLimPreAuthNode *pAuthNode;
2258
2259 pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, staId);
2260
2261 if (pAuthNode == NULL)
2262 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002263 limLog(pMac, LOGP, FL("Invalid Pre Auth Index passed :%d"), staId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002264 break;
2265 }
2266
2267 if (tx_timer_deactivate(&pAuthNode->timer) != TX_SUCCESS)
2268 {
2269 // Could not deactivate auth response timer.
2270 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002271 limLog(pMac, LOGP, FL("unable to deactivate auth response timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 }
2273
2274 // Change timer to reactivate it in future
2275
2276 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, &val) != eSIR_SUCCESS)
2277 {
2278 /**
2279 * Could not get auth rsp timeout value
2280 * from CFG. Log error.
2281 */
2282 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002283 FL("could not retrieve auth response timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 }
2285
2286 val = SYS_MS_TO_TICKS(val);
2287
2288 if (tx_timer_change(&pAuthNode->timer, val, 0) != TX_SUCCESS)
2289 {
2290 // Could not change auth rsp timer.
2291 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002292 limLog(pMac, LOGP, FL("unable to change auth rsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 }
2294 }
2295 break;
2296
Jeff Johnson295189b2012-06-20 16:38:30 -07002297
2298 default:
2299 // Invalid timerId. Log error
2300 break;
2301
2302 }
2303}
2304
2305
2306/**
2307 * limActivateCnfTimer()
2308 *
2309 *FUNCTION:
2310 * This function is called to activate a per STA timer
2311 *
2312 *LOGIC:
2313 *
2314 *ASSUMPTIONS:
2315 * NA
2316 *
2317 *NOTE:
2318 * NA
2319 *
2320 * @param pMac - Pointer to Global MAC structure
2321 * @param StaId - staId
2322 *
2323 * @return None
2324 */
2325
2326void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
2327{
Jeff Johnson295189b2012-06-20 16:38:30 -07002328 pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
2329 if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2330 != TX_SUCCESS)
2331 {
2332 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002333 FL("could not activate cnf wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002334 }
2335}
2336
2337/**
2338 * limActivateAuthRspTimer()
2339 *
2340 *FUNCTION:
2341 * This function is called to activate a per STA timer
2342 *
2343 *LOGIC:
2344 *
2345 *ASSUMPTIONS:
2346 * NA
2347 *
2348 *NOTE:
2349 * NA
2350 *
2351 * @param pMac - Pointer to Global MAC structure
2352 * @param id - id
2353 *
2354 * @return None
2355 */
2356
2357void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
2358{
Jeff Johnson295189b2012-06-20 16:38:30 -07002359 if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
2360 {
2361 /// Could not activate auth rsp timer.
2362 // Log error
2363 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002364 FL("could not activate auth rsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002365 }
2366}
2367
2368
2369/**
Jeff Johnson295189b2012-06-20 16:38:30 -07002370 * limAssocCnfWaitTmerHandler()
2371 *
2372 *FUNCTION:
2373 * This function post a message to send a disassociate frame out.
2374 *
2375 *LOGIC:
2376 *
2377 *ASSUMPTIONS:
2378 *
2379 *NOTE:
2380 * NA
2381 *
2382 * @param
2383 *
2384 * @return None
2385 */
2386
2387void
2388limCnfWaitTmerHandler(void *pMacGlobal, tANI_U32 param)
2389{
2390 tSirMsgQ msg;
2391 tANI_U32 statusCode;
2392 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2393
2394 msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
2395 msg.bodyval = (tANI_U32)param;
2396 msg.bodyptr = NULL;
2397
2398 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2399 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002400 FL("posting to LIM failed, reason=%d"), statusCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002401
2402}
2403
2404/**
2405 * limKeepaliveTmerHandler()
2406 *
2407 *FUNCTION:
2408 * This function post a message to send a NULL data frame.
2409 *
2410 *LOGIC:
2411 *
2412 *ASSUMPTIONS:
2413 *
2414 *NOTE:
2415 * NA
2416 *
2417 * @param
2418 *
2419 * @return None
2420 */
2421
2422void
2423limKeepaliveTmerHandler(void *pMacGlobal, tANI_U32 param)
2424{
2425 tSirMsgQ msg;
2426 tANI_U32 statusCode;
2427 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2428
2429 msg.type = SIR_LIM_KEEPALIVE_TIMEOUT;
2430 msg.bodyval = (tANI_U32)param;
2431 msg.bodyptr = NULL;
2432
2433 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2434 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002435 FL("posting to LIM failed, reason=%d"), statusCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002436
2437}
2438
2439void
2440limChannelSwitchTimerHandler(void *pMacGlobal, tANI_U32 param)
2441{
2442 tSirMsgQ msg;
2443 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2444
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302445 limLog(pMac, LOG1,
2446 FL("ChannelSwitch Timer expired. Posting msg to LIM "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002447
2448 msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
2449 msg.bodyval = (tANI_U32)param;
2450 msg.bodyptr = NULL;
2451
2452 limPostMsgApi(pMac, &msg);
2453}
2454
2455void
2456limQuietTimerHandler(void *pMacGlobal, tANI_U32 param)
2457{
2458 tSirMsgQ msg;
2459 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2460
2461 msg.type = SIR_LIM_QUIET_TIMEOUT;
2462 msg.bodyval = (tANI_U32)param;
2463 msg.bodyptr = NULL;
2464
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302465 limLog(pMac, LOG1,
2466 FL("Post SIR_LIM_QUIET_TIMEOUT msg. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002467 limPostMsgApi(pMac, &msg);
2468}
2469
2470void
2471limQuietBssTimerHandler(void *pMacGlobal, tANI_U32 param)
2472{
2473 tSirMsgQ msg;
2474 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2475
2476 msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
2477 msg.bodyval = (tANI_U32)param;
2478 msg.bodyptr = NULL;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302479 limLog(pMac, LOG1,
2480 FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 limPostMsgApi(pMac, &msg);
2482}
Jeff Johnson295189b2012-06-20 16:38:30 -07002483#if 0
2484void
2485limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
2486{
2487 tSirMsgQ msg;
2488 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2489
2490 msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
2491 msg.bodyval = (tANI_U32)param;
2492 msg.bodyptr = NULL;
2493 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002494 FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002495 limPostMsgApi(pMac, &msg);
2496}
2497#endif
Yathish9f22e662012-12-10 14:21:35 -08002498
2499#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2500/* ACTIVE_MODE_HB_OFFLOAD */
2501/**
2502 * limMissedBeaconInActiveMode()
2503 *
2504 *FUNCTION:
2505 * This function handle beacon miss indication from FW
2506 * in Active mode.
2507 *
2508 *LOGIC:
2509 *
2510 *ASSUMPTIONS:
2511 * NA
2512 *
2513 *NOTE:
2514 * NA
2515 *
2516 * @param param - Msg Type
2517 *
2518 * @return None
2519 */
2520void
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002521limMissedBeaconInActiveMode(void *pMacGlobal, tpPESession psessionEntry)
Yathish9f22e662012-12-10 14:21:35 -08002522{
2523 tANI_U32 statusCode;
2524 tSirMsgQ msg;
2525 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2526
2527 // Prepare and post message to LIM Message Queue
2528 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Jeff Johnson62c27982013-02-27 17:53:55 -08002529 {
Yathish9f22e662012-12-10 14:21:35 -08002530 msg.type = (tANI_U16) SIR_LIM_HEART_BEAT_TIMEOUT;
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002531 msg.bodyptr = psessionEntry;
Yathish9f22e662012-12-10 14:21:35 -08002532 msg.bodyval = 0;
2533 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002534 FL("Heartbeat failure from Riva"));
Yathish9f22e662012-12-10 14:21:35 -08002535 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2536 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002537 FL("posting message %X to LIM failed, reason=%d"),
Yathish9f22e662012-12-10 14:21:35 -08002538 msg.type, statusCode);
2539 }
2540}
2541#endif