blob: f5bb4d32aeda9a40e8054918c7627cb1a63ae545 [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 }
590
591 limInitPreAuthTimerTable(pMac, &pMac->lim.gLimPreAuthTimerTable);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700592 PELOG1(limLog(pMac, LOG1, FL("alloc and init table for preAuth timers"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700593
594
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 {
596 /**
597 * Create OLBC cache aging timer
598 */
599 if (wlan_cfgGetInt(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT,
600 &cfgValue) != eSIR_SUCCESS)
601 {
602 /**
603 * Could not get OLBC detect timeout value
604 * from CFG. Log error.
605 */
606 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700607 FL("could not retrieve OLBD detect timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 }
609
610 cfgValue = SYS_MS_TO_TICKS(cfgValue);
611
612 if (tx_timer_create(
613 &pMac->lim.limTimers.gLimUpdateOlbcCacheTimer,
614 "OLBC UPDATE CACHE TIMEOUT",
615 limUpdateOlbcCacheTimerHandler,
616 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT,
617 cfgValue,
618 cfgValue,
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -0700619 TX_NO_ACTIVATE) != TX_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 {
621 // Cannot create update OLBC cache timer
622 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700623 limLog(pMac, LOGP, FL("Cannot create update OLBC cache timer"));
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700624 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700625 }
626 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700627#ifdef WLAN_FEATURE_VOWIFI_11R
628 // In future we need to use the auth timer, cause
629 // the pre auth session will be introduced before sending
630 // Auth frame.
631 // We need to go off channel and come back to home channel
632 cfgValue = 1000;
633 cfgValue = SYS_MS_TO_TICKS(cfgValue);
634
635 if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
636 "FT PREAUTH RSP TIMEOUT",
637 limTimerHandler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT,
638 cfgValue, 0,
639 TX_NO_ACTIVATE) != TX_SUCCESS)
640 {
641 // Could not create Join failure timer.
642 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700643 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700644 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 }
646#endif
647
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530648#ifdef WLAN_FEATURE_LFR_MBB
649 cfgValue = PREAUTH_REASSOC_TIMEOUT;
650 cfgValue = SYS_MS_TO_TICKS(cfgValue);
651
652 if (tx_timer_create(&pMac->lim.limTimers.glim_pre_auth_mbb_rsp_timer,
653 "PREAUTH MBB RSP TIMEOUT",
654 limTimerHandler, SIR_LIM_PREAUTH_MBB_RSP_TIMEOUT,
655 cfgValue, 0,
656 TX_NO_ACTIVATE) != TX_SUCCESS)
657 {
658 limLog(pMac, LOGP, FL("could not create PREAUTH_MBB_RSP timer"));
659 goto err_timer;
660 }
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +0530661
662 cfgValue = PREAUTH_REASSOC_TIMEOUT;
663 cfgValue = SYS_MS_TO_TICKS(cfgValue);
664
665 if (tx_timer_create(&pMac->lim.limTimers.glim_reassoc_mbb_rsp_timer,
666 "REASSOC MBB RSP TIMEOUT",
667 limTimerHandler, SIR_LIM_REASSOC_MBB_RSP_TIMEOUT,
668 cfgValue, 0,
669 TX_NO_ACTIVATE) != TX_SUCCESS)
670 {
671 limLog(pMac, LOGP, FL("could not create REASSOC_MBB_RSP timer"));
672 goto err_timer;
673 }
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530674#endif
675
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800676#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 cfgValue = 5000;
678 cfgValue = SYS_MS_TO_TICKS(cfgValue);
679
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800680 if (tx_timer_create(&pMac->lim.limTimers.gLimEseTsmTimer,
681 "ESE TSM Stats TIMEOUT",
682 limTimerHandler, SIR_LIM_ESE_TSM_TIMEOUT,
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 cfgValue, 0,
684 TX_NO_ACTIVATE) != TX_SUCCESS)
685 {
686 // Could not create Join failure timer.
687 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700688 limLog(pMac, LOGP, FL("could not create Join failure timer"));
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700689 goto err_timer;
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800691#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -0700692
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 cfgValue = 1000;
694 cfgValue = SYS_MS_TO_TICKS(cfgValue);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800695 if (tx_timer_create(&pMac->lim.limTimers.gLimDisassocAckTimer,
696 "DISASSOC ACK TIMEOUT",
697 limTimerHandler, SIR_LIM_DISASSOC_ACK_TIMEOUT,
698 cfgValue, 0,
699 TX_NO_ACTIVATE) != TX_SUCCESS)
700 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700701 limLog(pMac, LOGP, FL("could not DISASSOC ACK TIMEOUT timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800702 goto err_timer;
703 }
704
705 cfgValue = 1000;
706 cfgValue = SYS_MS_TO_TICKS(cfgValue);
707 if (tx_timer_create(&pMac->lim.limTimers.gLimDeauthAckTimer,
708 "DISASSOC ACK TIMEOUT",
Viral Modid86bde22012-12-10 13:09:21 -0800709 limTimerHandler, SIR_LIM_DEAUTH_ACK_TIMEOUT,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800710 cfgValue, 0,
711 TX_NO_ACTIVATE) != TX_SUCCESS)
712 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700713 limLog(pMac, LOGP, FL("could not create DEAUTH ACK TIMEOUT timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800714 goto err_timer;
715 }
Viral Modid86bde22012-12-10 13:09:21 -0800716
Viral Modid86bde22012-12-10 13:09:21 -0800717 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)
718 cfgValue = SYS_MS_TO_TICKS(cfgValue);
719 if (tx_timer_create(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
720 "Single Shot NOA Insert timeout",
721 limTimerHandler, SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT,
722 cfgValue, 0,
723 TX_NO_ACTIVATE) != TX_SUCCESS)
724 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700725 limLog(pMac, LOGP, FL("could not create Single Shot NOA Insert Timeout timer"));
Viral Modid86bde22012-12-10 13:09:21 -0800726 goto err_timer;
727 }
Viral Modid86bde22012-12-10 13:09:21 -0800728
Hanumantha Reddy Pothula97ea0952015-10-09 11:29:39 +0530729 cfgValue = WNI_CFG_ACTIVE_PASSIVE_CON_MAX;
730 if (eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_PASSIVE_CON,
Hanumantha Reddy Pothula802d31d2015-09-29 17:39:11 +0530731 &cfgValue))
732 {
733 limLog(pMac, LOGP,
734 FL("could not retrieve WNI_CFG_ACTIVE_PASSIVE_CON"));
735 }
736 if (cfgValue)
737 {
738 cfgValue = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
739 cfgValue = SYS_MS_TO_TICKS(cfgValue);
740 if (tx_timer_create(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer,
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530741 "ACTIVE TO PASSIVE CHANNEL", limTimerHandler,
742 SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE, cfgValue, 0,
743 TX_NO_ACTIVATE) != TX_SUCCESS)
Hanumantha Reddy Pothula802d31d2015-09-29 17:39:11 +0530744 {
745 limLog(pMac, LOGW,FL("could not create timer for passive channel to active channel"));
746 goto err_timer;
747 }
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530748 }
Hanumantha Reddy Pothula802d31d2015-09-29 17:39:11 +0530749 else
750 {
751 limLog(pMac, LOG1,
752 FL("gLimActiveToPassiveChannelTimer not created %d"), cfgValue);
753 }
Abhishek Singh550aa8c2017-10-30 17:34:53 +0530754 cfgValue = WNI_CFG_BEACON_INTERVAL_STADEF;
755 cfgValue = SYS_MS_TO_TICKS(cfgValue);
756 if (tx_timer_create(&pMac->lim.limTimers.g_lim_ap_ecsa_timer,
757 "AP ECSA TIMER", limTimerHandler,
758 SIR_LIM_SAP_ECSA_TIMEOUT,
759 cfgValue, 0,
760 TX_NO_ACTIVATE) != TX_SUCCESS)
761 {
762 limLog(pMac, LOGW,FL("could not create timer for passive channel to active channel"));
763 goto err_timer;
764 }
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530765
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700766 return TX_SUCCESS;
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700767
768 err_timer:
Viral Modid86bde22012-12-10 13:09:21 -0800769 tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800770 tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800771#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
772 tx_timer_delete(&pMac->lim.limTimers.gLimEseTsmTimer);
773#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700774 tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer);
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530775#ifdef WLAN_FEATURE_LFR_MBB
776 tx_timer_delete(&pMac->lim.limTimers.glim_pre_auth_mbb_rsp_timer);
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +0530777 tx_timer_delete(&pMac->lim.limTimers.glim_reassoc_mbb_rsp_timer);
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +0530778#endif
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700779 tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer);
780 while(((tANI_S32)--i) >= 0)
781 {
782 tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[i]);
783 }
784 tx_timer_delete(&pMac->lim.limTimers.gLimKeepaliveTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700785 tx_timer_delete(&pMac->lim.limTimers.gLimBackgroundScanTimer);
786 tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer);
787 tx_timer_delete(&pMac->lim.limTimers.gLimHeartBeatTimer);
788 tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer);
789 tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer);
790 tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer);
791 tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer);
Jeff Johnson62c27982013-02-27 17:53:55 -0800792 tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer);
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -0800793 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
Sushant Kaushik9e923872015-04-02 17:09:31 +0530794 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700795 tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer);
796 tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer);
797 tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer);
798 tx_timer_delete(&pMac->lim.limTimers.gLimMaxChannelTimer);
799 tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer);
800 tx_timer_delete(&pMac->lim.limTimers.gLimMinChannelTimer);
Venkata Prathyusha Kuntupalli7a87ff02013-01-29 10:45:54 -0800801 tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer);
Gopichand Nakkalad492d202013-05-10 02:50:47 +0530802 tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer);
Abhishek Singh550aa8c2017-10-30 17:34:53 +0530803 tx_timer_delete(&pMac->lim.limTimers.g_lim_ap_ecsa_timer);
Abhinav Kumar626f8652019-08-05 16:20:39 +0530804 tx_timer_delete(&pMac->lim.limTimers.sae_auth_timer);
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700805
806 if(NULL != pMac->lim.gLimPreAuthTimerTable.pTable)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800807 {
Sushant Kaushikf4a27972015-04-16 16:48:00 +0530808 vos_mem_vfree(pMac->lim.gLimPreAuthTimerTable.pTable);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800809 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
810 }
Madan Mohan Koyyalamudi694f8d72012-10-11 16:32:55 -0700811
812 return TX_TIMER_ERROR;
813
Jeff Johnson295189b2012-06-20 16:38:30 -0700814} /****** end limCreateTimers() ******/
815
816
817
818/**
819 * limTimerHandler()
820 *
821 *FUNCTION:
822 * This function is called upon
823 * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
824 * 2. JOIN_FAILURE timer expiration while joining a BSS
825 * 3. AUTH_FAILURE timer expiration while authenticating with a peer
826 * 4. Heartbeat timer expiration on STA
827 * 5. Background scan timer expiration on STA
828 * 6. AID release, Pre-auth cleanup and Link monitoring timer
829 * expiration on AP
830 *
831 *LOGIC:
832 *
833 *ASSUMPTIONS:
834 * NA
835 *
836 *NOTE:
837 * NA
838 *
839 * @param param - Message corresponding to the timer that expired
840 *
841 * @return None
842 */
843
844void
845limTimerHandler(void *pMacGlobal, tANI_U32 param)
846{
847 tANI_U32 statusCode;
848 tSirMsgQ msg;
849 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
850
851 // Prepare and post message to LIM Message Queue
852
853 msg.type = (tANI_U16) param;
854 msg.bodyptr = NULL;
855 msg.bodyval = 0;
856
Padma, Santhosh Kumarb036fc72015-11-13 16:22:23 +0530857 if ((statusCode = limPostMsgApiHighPri(pMac, &msg)) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700859 FL("posting message %X to LIM failed, reason=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 msg.type, statusCode);
861} /****** end limTimerHandler() ******/
862
863
864/**
865 * limAddtsResponseTimerHandler()
866 *
867 *FUNCTION:
868 * This function is called upon Addts response timer expiration on sta
869 *
870 *LOGIC:
871 * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
872 * when this function is executed.
873 *
874 *ASSUMPTIONS:
875 * NA
876 *
877 *NOTE:
878 * NA
879 *
880 * @param param - pointer to pre-auth node
881 *
882 * @return None
883 */
884
885void
886limAddtsResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
887{
888 tSirMsgQ msg;
889 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
890
891 // Prepare and post message to LIM Message Queue
892
893 msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
894 msg.bodyval = param;
895 msg.bodyptr = NULL;
896
897 limPostMsgApi(pMac, &msg);
898} /****** end limAuthResponseTimerHandler() ******/
899
900
901/**
902 * limAuthResponseTimerHandler()
903 *
904 *FUNCTION:
905 * This function is called upon Auth response timer expiration on AP
906 *
907 *LOGIC:
908 * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
909 * when this function is executed.
910 *
911 *ASSUMPTIONS:
912 * NA
913 *
914 *NOTE:
915 * NA
916 *
917 * @param param - pointer to pre-auth node
918 *
919 * @return None
920 */
921
922void
923limAuthResponseTimerHandler(void *pMacGlobal, tANI_U32 param)
924{
925 tSirMsgQ msg;
926 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
927
928 // Prepare and post message to LIM Message Queue
929
930 msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
931 msg.bodyptr = NULL;
932 msg.bodyval = (tANI_U32)param;
933
934 limPostMsgApi(pMac, &msg);
935} /****** end limAuthResponseTimerHandler() ******/
936
937
938
939/**
940 * limAssocFailureTimerHandler()
941 *
942 *FUNCTION:
943 * This function is called upon Re/Assoc failure timer expiration
944 * on STA
945 *
946 *LOGIC:
947 * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ
948 * when this function is executed.
949 *
950 *ASSUMPTIONS:
951 * NA
952 *
953 *NOTE:
954 * NA
955 *
956 * @param param - Indicates whether this is assoc or reassoc
957 * failure timeout
958 * @return None
959 */
960
961void
962limAssocFailureTimerHandler(void *pMacGlobal, tANI_U32 param)
963{
964 tSirMsgQ msg;
965 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
966
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800967#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700968 if((LIM_REASSOC == param) &&
Kanchanapally, Vidyullathab6da2a62014-02-06 12:28:52 +0530969 (NULL != pMac->lim.pSessionEntry) &&
970 (pMac->lim.pSessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE))
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700971 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700972 limLog(pMac, LOGE, FL("Reassoc timeout happened"));
Sachin Ahuja07a43012015-01-30 17:04:38 +0530973#ifdef FEATURE_WLAN_ESE
974 if (((pMac->lim.pSessionEntry->isESEconnection) &&
975 (pMac->lim.reAssocRetryAttempt <
976 (LIM_MAX_REASSOC_RETRY_LIMIT - 1)))||
977 ((!pMac->lim.pSessionEntry->isESEconnection) &&
978 (pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT))
979 )
980#else
981 if (pMac->lim.reAssocRetryAttempt < LIM_MAX_REASSOC_RETRY_LIMIT)
982#endif
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700983 {
984 limSendRetryReassocReqFrame(pMac, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, pMac->lim.pSessionEntry);
985 pMac->lim.reAssocRetryAttempt++;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700986 limLog(pMac, LOGW, FL("Reassoc request retry is sent %d times"), pMac->lim.reAssocRetryAttempt);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700987 return;
988 }
989 else
990 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700991 limLog(pMac, LOGW, FL("Reassoc request retry MAX(%d) reached"), LIM_MAX_REASSOC_RETRY_LIMIT);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700992 if(NULL != pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
993 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530994 vos_mem_free( pMac->lim.pSessionEntry->pLimMlmReassocRetryReq);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700995 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = NULL;
996 }
997 }
998 }
999#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 // Prepare and post message to LIM Message Queue
1001
1002 msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
1003 msg.bodyval = (tANI_U32)param;
1004 msg.bodyptr = NULL;
1005
1006 limPostMsgApi(pMac, &msg);
1007} /****** end limAssocFailureTimerHandler() ******/
1008
1009
1010/**
1011 * limUpdateOlbcCacheTimerHandler()
1012 *
1013 *FUNCTION:
1014 * This function is called upon update olbc cache timer expiration
1015 * on STA
1016 *
1017 *LOGIC:
1018 * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
1019 * when this function is executed.
1020 *
1021 *ASSUMPTIONS:
1022 * NA
1023 *
1024 *NOTE:
1025 * NA
1026 *
1027 * @param
1028 *
1029 * @return None
1030 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001031void
1032limUpdateOlbcCacheTimerHandler(void *pMacGlobal, tANI_U32 param)
1033{
1034 tSirMsgQ msg;
1035 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
1036
1037 // Prepare and post message to LIM Message Queue
1038
1039 msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
1040 msg.bodyval = 0;
1041 msg.bodyptr = NULL;
1042
1043 limPostMsgApi(pMac, &msg);
1044} /****** end limUpdateOlbcCacheTimerHandler() ******/
Jeff Johnson295189b2012-06-20 16:38:30 -07001045
1046/**
1047 * limDeactivateAndChangeTimer()
1048 *
1049 *FUNCTION:
1050 * This function is called to deactivate and change a timer
1051 * for future re-activation
1052 *
1053 *LOGIC:
1054 *
1055 *ASSUMPTIONS:
1056 * NA
1057 *
1058 *NOTE:
1059 * NA
1060 *
1061 * @param pMac - Pointer to Global MAC structure
1062 * @param timerId - enum of timer to be deactivated and changed
1063 * This enum is defined in limUtils.h file
1064 *
1065 * @return None
1066 */
1067
1068void
1069limDeactivateAndChangeTimer(tpAniSirGlobal pMac, tANI_U32 timerId)
1070{
1071 tANI_U32 val=0, val1=0;
Sushant Kaushik9e923872015-04-02 17:09:31 +05301072 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001073
Jeff Johnson295189b2012-06-20 16:38:30 -07001074 switch (timerId)
1075 {
1076 case eLIM_ADDTS_RSP_TIMER:
1077 pMac->lim.gLimAddtsRspTimerCount++;
1078 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
1079 {
1080 // Could not deactivate AddtsRsp Timer
1081 // Log error
1082 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001083 FL("Unable to deactivate AddtsRsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 }
1085 break;
1086
1087 case eLIM_MIN_CHANNEL_TIMER:
1088 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMinChannelTimer)
1089 != TX_SUCCESS)
1090 {
1091 // Could not deactivate min channel timer.
1092 // Log error
1093 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001094 FL("Unable to deactivate min channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001095 }
1096
Jeff Johnsone7245742012-09-05 17:12:55 -07001097#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001098 // If a background was triggered via Quiet BSS,
1099 // then we need to adjust the MIN and MAX channel
1100 // timer's accordingly to the Quiet duration that
1101 // was specified
1102 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1103 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1104 {
1105 // gLimQuietDuration is already cached in units of
1106 // system ticks. No conversion is reqd...
1107 val = pMac->lim.gLimSpecMgmt.quietDuration;
1108 }
1109 else
1110 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001111#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001112 if(pMac->lim.gpLimMlmScanReq)
1113 {
1114 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime);
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301115 if (pMac->btc.btc_scan_compromise_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001116 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301117 if (pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001118 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301119 val = SYS_MS_TO_TICKS(
1120 pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001121 limLog(pMac, LOG1, FL("Using BTC Min Active Scan time"));
1122 }
1123 else
1124 {
1125 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1126 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301127 } else if (pMac->btc.btc_scan_compromise_sco &&
1128 pMac->roam.configParam.min_chntime_btc_sco) {
1129 val = SYS_MS_TO_TICKS(
1130 pMac->roam.configParam.min_chntime_btc_sco);
1131 limLog(pMac, LOG1,
1132 FL("Using BTC SCO Min Active Scan time %d"), val);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001133 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 }
1135 else
1136 {
1137 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1138 //No need to change min timer. This is not a scan
1139 break;
1140 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001141#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001142 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001143#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001144
1145 if (tx_timer_change(&pMac->lim.limTimers.gLimMinChannelTimer,
1146 val, 0) != TX_SUCCESS)
1147 {
1148 // Could not change min channel timer.
1149 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001150 limLog(pMac, LOGP, FL("Unable to change min channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001151 }
1152
1153 break;
1154
1155 case eLIM_PERIODIC_PROBE_REQ_TIMER:
1156 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer)
1157 != TX_SUCCESS)
1158 {
1159 // Could not deactivate min channel timer.
1160 // Log error
1161 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001162 FL("Unable to deactivate periodic timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001163 }
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301164 if(pMac->lim.gpLimMlmScanReq)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001165 {
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301166 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime)/2;
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301167 if (pMac->btc.btc_scan_compromise_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301168 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301169 if (pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301170 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301171 val = SYS_MS_TO_TICKS(
1172 pMac->lim.gpLimMlmScanReq->min_chntime_btc_esco)/2;
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301173 limLog(pMac, LOG1, FL("Using BTC Min Active Scan time"));
1174 }
1175 else
1176 {
1177 limLog(pMac, LOGE, FL("BTC Active Scan Min Time is Not Set"));
1178 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301179 } else if (pMac->btc.btc_scan_compromise_sco &&
1180 pMac->roam.configParam.min_chntime_btc_sco) {
1181 val = SYS_MS_TO_TICKS(
1182 pMac->roam.configParam.min_chntime_btc_sco / 2);
1183 limLog(pMac, LOG1,
1184 FL("Using BTC SCO Min Active Scan time %d"), val);
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301185 }
1186 }
1187 /*If val is 0 it means min Channel timer is 0 so take the value from maxChannelTimer*/
1188 if (!val)
1189 {
1190
1191 if(pMac->lim.gpLimMlmScanReq)
1192 {
1193 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime)/2;
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301194 if (pMac->btc.btc_scan_compromise_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301195 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301196 if (pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301197 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301198 val = SYS_MS_TO_TICKS(
1199 pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)/2;
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301200 limLog(pMac, LOG1, FL("Using BTC Max Active Scan time"));
1201 }
1202 else
1203 {
1204 limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set"));
1205 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301206 } else if (pMac->btc.btc_scan_compromise_sco &&
1207 pMac->roam.configParam.max_chntime_btc_sco) {
1208 val = SYS_MS_TO_TICKS(
1209 pMac->roam.configParam.max_chntime_btc_sco / 2);
1210 limLog(pMac, LOG1,
1211 FL("Using BTC SCO Max Active Scan time %d"), val);
Sachin Ahuja49dedd72014-11-24 16:35:24 +05301212 }
1213 }
1214 else
1215 {
1216 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1217 //No need to change max timer. This is not a scan
1218 break;
1219 }
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001220 }
Mahesh A Saptasagarbfcdcc32015-09-24 17:41:51 +05301221 if (val)
Jeff Johnson295189b2012-06-20 16:38:30 -07001222 {
Mahesh A Saptasagarbfcdcc32015-09-24 17:41:51 +05301223 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer,
1224 val, 0) != TX_SUCCESS)
1225 {
1226 // Could not change min channel timer.
1227 // Log error
1228 limLog(pMac, LOGE, FL("Unable to change periodic timer"));
1229 }
1230 }
1231 else
1232 {
1233 limLog(pMac, LOGE, FL("Do not change gLimPeriodicProbeReqTimer values,"
1234 "value = %d minchannel time = %d"
1235 "maxchannel time = %d"), val,
1236 pMac->lim.gpLimMlmScanReq->minChannelTime,
1237 pMac->lim.gpLimMlmScanReq->maxChannelTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 }
1239
1240 break;
1241
1242 case eLIM_MAX_CHANNEL_TIMER:
1243 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer)
1244 != TX_SUCCESS)
1245 {
1246 // Could not deactivate max channel timer.
1247 // Log error
1248 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001249 FL("Unable to deactivate max channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 }
1251
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 // If a background was triggered via Quiet BSS,
1253 // then we need to adjust the MIN and MAX channel
1254 // timer's accordingly to the Quiet duration that
1255 // was specified
1256 if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE)
1257 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001258#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001259
1260 if( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState &&
1261 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss )
1262 {
1263 // gLimQuietDuration is already cached in units of
1264 // system ticks. No conversion is reqd...
1265 val = pMac->lim.gLimSpecMgmt.quietDuration;
1266 }
1267 else
1268 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001269#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001270 if(pMac->lim.gpLimMlmScanReq)
1271 {
1272 val = SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->maxChannelTime);
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301273 if (pMac->btc.btc_scan_compromise_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001274 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301275 if (pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco)
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001276 {
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301277 val = SYS_MS_TO_TICKS(
1278 pMac->lim.gpLimMlmScanReq->max_chntime_btc_esco);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001279 limLog(pMac, LOG1, FL("Using BTC Max Active Scan time"));
1280 }
1281 else
1282 {
1283 limLog(pMac, LOGE, FL("BTC Active Scan Max Time is Not Set"));
1284 }
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301285 } else if (pMac->btc.btc_scan_compromise_sco &&
1286 pMac->roam.configParam.max_chntime_btc_sco) {
1287 val = SYS_MS_TO_TICKS(
1288 pMac->roam.configParam.max_chntime_btc_sco);
1289 limLog(pMac, LOG1,
1290 FL("Using BTC SCO Max Active Scan time %d"), val);
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001291 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 }
1293 else
1294 {
1295 limLog(pMac, LOGE, FL(" gpLimMlmScanReq is NULL "));
1296 //No need to change max timer. This is not a scan
1297 break;
1298 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001299#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001301#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001303
1304 if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer,
1305 val, 0) != TX_SUCCESS)
1306 {
1307 // Could not change max channel timer.
1308 // Log error
1309 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001310 FL("Unable to change max channel timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 }
1312
1313 break;
1314
1315 case eLIM_JOIN_FAIL_TIMER:
1316 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimJoinFailureTimer)
1317 != TX_SUCCESS)
1318 {
1319 /**
1320 * Could not deactivate Join Failure
1321 * timer. Log error.
1322 */
1323 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001324 FL("Unable to deactivate Join Failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 }
1326
1327 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT,
1328 &val) != eSIR_SUCCESS)
1329 {
1330 /**
1331 * Could not get JoinFailureTimeout value
1332 * from CFG. Log error.
1333 */
1334 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001335 FL("could not retrieve JoinFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 }
1337 val = SYS_MS_TO_TICKS(val);
1338
1339 if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer,
1340 val, 0) != TX_SUCCESS)
1341 {
1342 /**
1343 * Could not change Join Failure
1344 * timer. Log error.
1345 */
1346 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001347 FL("Unable to change Join Failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 }
1349
1350 break;
1351
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001352 case eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER:
1353 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer)
1354 != TX_SUCCESS)
1355 {
1356 // Could not deactivate periodic join req Times.
1357 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001358 FL("Unable to deactivate periodic join request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001359 }
1360
1361 val = SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS);
1362 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
1363 val, 0) != TX_SUCCESS)
1364 {
1365 // Could not change periodic join req times.
1366 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001367 limLog(pMac, LOGP, FL("Unable to change periodic join request timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001368 }
Jeff Johnson62c27982013-02-27 17:53:55 -08001369
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001370 break;
1371
Jeff Johnson295189b2012-06-20 16:38:30 -07001372 case eLIM_AUTH_FAIL_TIMER:
1373 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAuthFailureTimer)
1374 != TX_SUCCESS)
1375 {
1376 // Could not deactivate Auth failure timer.
1377 // Log error
1378 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001379 FL("Unable to deactivate auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001380 }
1381
1382 // Change timer to reactivate it in future
1383 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
1384 &val) != eSIR_SUCCESS)
1385 {
1386 /**
1387 * Could not get AuthFailureTimeout value
1388 * from CFG. Log error.
1389 */
1390 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001391 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 }
1393 val = SYS_MS_TO_TICKS(val);
1394
1395 if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer,
1396 val, 0) != TX_SUCCESS)
1397 {
1398 // Could not change Authentication failure timer.
1399 // Log error
1400 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001401 FL("unable to change Auth failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 }
1403
1404 break;
1405
Sushant Kaushik9e923872015-04-02 17:09:31 +05301406 case eLIM_AUTH_RETRY_TIMER:
1407
1408 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer)
1409 != TX_SUCCESS)
1410 {
1411 // Could not deactivate Auth Retry Timer.
1412 limLog(pMac, LOGP,
1413 FL("Unable to deactivate Auth Retry timer"));
1414 }
1415 if ((psessionEntry = peFindSessionBySessionId(pMac,
1416 pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId))
1417 == NULL)
1418 {
1419 limLog(pMac, LOGP,
1420 FL("session does not exist for given SessionId : %d"),
1421 pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId);
1422 break;
1423 }
1424 /* 3/5 of the beacon interval*/
1425 val = psessionEntry->beaconParams.beaconInterval * 3/5;
1426 val = SYS_MS_TO_TICKS(val);
1427 if (tx_timer_change(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer,
1428 val, 0) != TX_SUCCESS)
1429 {
1430 // Could not change Auth Retry timer.
1431 // Log error
1432 limLog(pMac, LOGP, FL("Unable to change Auth Retry timer"));
1433 }
1434
1435 break;
1436
Jeff Johnson295189b2012-06-20 16:38:30 -07001437 case eLIM_ASSOC_FAIL_TIMER:
1438 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAssocFailureTimer) !=
1439 TX_SUCCESS)
1440 {
1441 // Could not deactivate Association failure timer.
1442 // Log error
1443 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001444 FL("unable to deactivate Association failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001445 }
1446
1447 // Change timer to reactivate it in future
1448 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
1449 &val) != eSIR_SUCCESS)
1450 {
1451 /**
1452 * Could not get AssocFailureTimeout value
1453 * from CFG. Log error.
1454 */
1455 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001456 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 }
1458 val = SYS_MS_TO_TICKS(val);
1459
1460 if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer,
1461 val, 0) != TX_SUCCESS)
1462 {
1463 // Could not change Association failure timer.
1464 // Log error
1465 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001466 FL("unable to change Assoc failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 }
1468
1469 break;
1470
1471 case eLIM_REASSOC_FAIL_TIMER:
1472 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
1473 TX_SUCCESS)
1474 {
1475 // Could not deactivate Reassociation failure timer.
1476 // Log error
1477 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001478 FL("unable to deactivate Reassoc failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 }
1480
1481 // Change timer to reactivate it in future
1482 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1483 &val) != eSIR_SUCCESS)
1484 {
1485 /**
1486 * Could not get ReassocFailureTimeout value
1487 * from CFG. Log error.
1488 */
1489 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001490 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 }
1492 val = SYS_MS_TO_TICKS(val);
1493
1494 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
1495 val, 0) != TX_SUCCESS)
1496 {
1497 // Could not change Reassociation failure timer.
1498 // Log error
1499 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001500 FL("unable to change Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 }
1502
1503 break;
1504
1505 case eLIM_HEART_BEAT_TIMER:
1506 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) !=
1507 TX_SUCCESS)
1508 {
1509 // Could not deactivate Heartbeat timer.
1510 // Log error
1511 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001512 FL("unable to deactivate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001514 else
1515 {
1516 limLog(pMac, LOGW, FL("Deactivated heartbeat link monitoring"));
1517 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001518
1519 if (wlan_cfgGetInt(pMac, WNI_CFG_BEACON_INTERVAL,
1520 &val) != eSIR_SUCCESS)
1521 {
1522 /**
1523 * Could not get BEACON_INTERVAL value
1524 * from CFG. Log error.
1525 */
1526 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001527 FL("could not retrieve BEACON_INTERVAL value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001528 }
1529
1530 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
1531 eSIR_SUCCESS)
1532 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001533 FL("could not retrieve heartbeat failure value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001534
1535 // Change timer to reactivate it in future
1536 val = SYS_MS_TO_TICKS(val * val1);
1537
1538 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer,
1539 val, 0) != TX_SUCCESS)
1540 {
1541 // Could not change HeartBeat timer.
1542 // Log error
1543 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001544 FL("unable to change HeartBeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001546 else
1547 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001548 limLog(pMac, LOGW, FL("HeartBeat timer value is changed = %u"), val);
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001549 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001550 break;
1551
1552 case eLIM_PROBE_AFTER_HB_TIMER:
1553 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimProbeAfterHBTimer) !=
1554 TX_SUCCESS)
1555 {
1556 // Could not deactivate Heartbeat timer.
1557 // Log error
1558 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001559 FL("unable to deactivate probeAfterHBTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001561 else
1562 {
Kaushik, Sushant8489f472014-01-27 11:41:22 +05301563 limLog(pMac, LOG1, FL("Deactivated probe after hb timer"));
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001564 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001565
1566 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT,
1567 &val) != eSIR_SUCCESS)
1568 {
1569 /**
1570 * Could not get PROBE_AFTER_HB_FAILURE
1571 * value from CFG. Log error.
1572 */
1573 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001574 FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001575 }
1576
1577 // Change timer to reactivate it in future
1578 val = SYS_MS_TO_TICKS(val);
1579
1580 if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer,
1581 val, 0) != TX_SUCCESS)
1582 {
1583 // Could not change HeartBeat timer.
1584 // Log error
1585 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001586 FL("unable to change ProbeAfterHBTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 }
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001588 else
1589 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001590 limLog(pMac, LOGW, FL("Probe after HB timer value is changed = %u"), val);
Srinivas Girigowda3789b742013-04-08 16:14:44 -07001591 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001592
1593 break;
1594
1595 case eLIM_KEEPALIVE_TIMER:
1596 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimKeepaliveTimer)
1597 != TX_SUCCESS)
1598 {
1599 // Could not deactivate Keepalive timer.
1600 // Log error
1601 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001602 FL("unable to deactivate KeepaliveTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 }
1604
1605 // Change timer to reactivate it in future
1606
1607 if (wlan_cfgGetInt(pMac, WNI_CFG_KEEPALIVE_TIMEOUT,
1608 &val) != eSIR_SUCCESS)
1609 {
1610 /**
1611 * Could not get keepalive timeout value
1612 * from CFG. Log error.
1613 */
1614 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001615 FL("could not retrieve keepalive timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001616 }
1617 if (val == 0)
1618 {
1619 val = 3000;
1620 pMac->sch.keepAlive = 0;
1621 } else
1622 pMac->sch.keepAlive = 1;
1623
1624
1625
1626 val = SYS_MS_TO_TICKS(val + SYS_TICK_DUR_MS - 1);
1627
1628 if (tx_timer_change(&pMac->lim.limTimers.gLimKeepaliveTimer,
1629 val, val) != TX_SUCCESS)
1630 {
1631 // Could not change KeepaliveTimer timer.
1632 // Log error
1633 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001634 FL("unable to change KeepaliveTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001635 }
1636
1637 break;
1638
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 case eLIM_BACKGROUND_SCAN_TIMER:
1640 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimBackgroundScanTimer)
1641 != TX_SUCCESS)
1642 {
1643 // Could not deactivate BackgroundScanTimer timer.
1644 // Log error
1645 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001646 FL("unable to deactivate BackgroundScanTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 }
1648
1649 // Change timer to reactivate it in future
1650 if (wlan_cfgGetInt(pMac, WNI_CFG_BACKGROUND_SCAN_PERIOD,
1651 &val) != eSIR_SUCCESS)
1652 {
1653 /**
1654 * Could not get Background scan period value
1655 * from CFG. Log error.
1656 */
1657 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001658 FL("could not retrieve Background scan period value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 }
1660 if (val == 0)
1661 {
1662 val = LIM_BACKGROUND_SCAN_PERIOD_DEFAULT_MS;
1663 pMac->lim.gLimBackgroundScanDisable = true;
1664 }
1665 else
1666 pMac->lim.gLimBackgroundScanDisable = false;
1667
1668 val = SYS_MS_TO_TICKS(val);
1669
1670 if (tx_timer_change(&pMac->lim.limTimers.gLimBackgroundScanTimer,
1671 val, val) != TX_SUCCESS)
1672 {
1673 // Could not change BackgroundScanTimer timer.
1674 // Log error
1675 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001676 FL("unable to change BackgroundScanTimer timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 }
1678
1679 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001680
Jeff Johnsone7245742012-09-05 17:12:55 -07001681#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 case eLIM_CHANNEL_SWITCH_TIMER:
1683 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimChannelSwitchTimer) != eSIR_SUCCESS)
1684 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001685 limLog(pMac, LOGP, FL("tx_timer_deactivate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 return;
1687 }
1688
1689 if (tx_timer_change(&pMac->lim.limTimers.gLimChannelSwitchTimer,
1690 pMac->lim.gLimChannelSwitch.switchTimeoutValue,
1691 0) != TX_SUCCESS)
1692 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001693 limLog(pMac, LOGP, FL("tx_timer_change failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 return;
1695 }
1696 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001697#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001698
1699 case eLIM_LEARN_DURATION_TIMER:
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 break;
1701
Jeff Johnsone7245742012-09-05 17:12:55 -07001702#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 case eLIM_QUIET_BSS_TIMER:
1704 if (TX_SUCCESS !=
1705 tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietBssTimer))
1706 {
1707 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001708 FL("Unable to de-activate gLimQuietBssTimer! Will attempt to activate anyway..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001709 }
1710
1711 // gLimQuietDuration appears to be in units of ticks
1712 // Use it as is
1713 if (TX_SUCCESS !=
1714 tx_timer_change( &pMac->lim.limTimers.gLimQuietBssTimer,
1715 pMac->lim.gLimSpecMgmt.quietDuration,
1716 0))
1717 {
1718 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001719 FL("Unable to change gLimQuietBssTimer! Will still attempt to activate anyway..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001720 }
1721 break;
1722
1723 case eLIM_QUIET_TIMER:
1724 if( TX_SUCCESS != tx_timer_deactivate(&pMac->lim.limTimers.gLimQuietTimer))
1725 {
1726 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001727 FL( "Unable to deactivate gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 }
1729
1730 // Set the NEW timeout value, in ticks
1731 if( TX_SUCCESS != tx_timer_change( &pMac->lim.limTimers.gLimQuietTimer,
1732 SYS_MS_TO_TICKS(pMac->lim.gLimSpecMgmt.quietTimeoutValue), 0))
1733 {
1734 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001735 FL( "Unable to change gLimQuietTimer! Will still attempt to re-activate anyway..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001736 }
1737 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001738#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001739
Jeff Johnson295189b2012-06-20 16:38:30 -07001740#if 0
1741 case eLIM_WPS_OVERLAP_TIMER:
1742 {
1743 // Restart Learn Interval timer
1744
1745 tANI_U32 WPSOverlapTimer = SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS);
1746
1747 if (tx_timer_deactivate(
1748 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS)
1749 {
1750 // Could not deactivate Learn Interval timer.
1751 // Log error
1752 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001753 FL("Unable to deactivate WPS overlap timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001754 }
1755
1756 if (tx_timer_change(
1757 &pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer,
1758 WPSOverlapTimer, 0) != TX_SUCCESS)
1759 {
1760 // Could not change Learn Interval timer.
1761 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001762 limLog(pMac, LOGP, FL("Unable to change WPS overlap timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001763
1764 return;
1765 }
1766
1767 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001768 FL("Setting WPS overlap TIMER to %d ticks"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001769 WPSOverlapTimer);
1770 }
1771 break;
1772#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001773
1774#ifdef WLAN_FEATURE_VOWIFI_11R
1775 case eLIM_FT_PREAUTH_RSP_TIMER:
1776 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != TX_SUCCESS)
1777 {
1778 /**
1779 ** Could not deactivate Join Failure
1780 ** timer. Log error.
1781 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001782 limLog(pMac, LOGP, FL("Unable to deactivate Preauth response Failure timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001783 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001784 }
1785 val = 1000;
1786 val = SYS_MS_TO_TICKS(val);
1787 if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer,
1788 val, 0) != TX_SUCCESS)
1789 {
1790 /**
1791 * Could not change Join Failure
1792 * timer. Log error.
1793 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001794 limLog(pMac, LOGP, FL("Unable to change Join Failure timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001795 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 }
1797 break;
1798#endif
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301799
1800#ifdef WLAN_FEATURE_LFR_MBB
1801 case eLIM_PREAUTH_MBB_RSP_TIMER:
Padma, Santhosh Kumarce74fd82017-02-10 19:57:08 +05301802 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE,
1803 NO_SESSION, eLIM_PREAUTH_MBB_RSP_TIMER));
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301804 if (tx_timer_deactivate(&pMac->lim.limTimers.
1805 glim_pre_auth_mbb_rsp_timer) != TX_SUCCESS) {
1806 limLog(pMac, LOGP,
1807 FL("Unable to deactivate preauth response mbb timer"));
1808 return;
1809 }
1810 break;
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +05301811 case eLIM_REASSOC_MBB_RSP_TIMER:
Padma, Santhosh Kumarce74fd82017-02-10 19:57:08 +05301812 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE,
1813 NO_SESSION, eLIM_REASSOC_MBB_RSP_TIMER));
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +05301814 if (tx_timer_deactivate(&pMac->lim.limTimers.
1815 glim_reassoc_mbb_rsp_timer) != TX_SUCCESS) {
1816 limLog(pMac, LOGP,
1817 FL("Unable to deactivate reassoc response mbb timer"));
1818 return;
1819 }
1820 break;
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301821#endif
1822
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001823#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001824 case eLIM_TSM_TIMER:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001825 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimEseTsmTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 != TX_SUCCESS)
1827 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001828 limLog(pMac, LOGE, FL("Unable to deactivate TSM timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001829 }
1830 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001831#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
Gopichand Nakkalad492d202013-05-10 02:50:47 +05301832
1833 case eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
1834 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer) != TX_SUCCESS)
1835 {
1836 /**
1837 ** Could not deactivate Active to passive channel timer.
1838 ** Log error.
1839 **/
1840 limLog(pMac, LOGP, FL("Unable to Deactivate "
1841 "Active to passive channel timer"));
1842 return;
1843 }
1844 val = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
1845 val = SYS_MS_TO_TICKS(val);
1846 if (tx_timer_change(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer,
1847 val, 0) != TX_SUCCESS)
1848 {
1849 /**
1850 * Could not change timer to check scan type for passive channel.
1851 * timer. Log error.
1852 */
1853 limLog(pMac, LOGP, FL("Unable to change timer"));
1854 return;
1855 }
1856 break;
1857
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001858 case eLIM_DISASSOC_ACK_TIMER:
1859 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDisassocAckTimer) != TX_SUCCESS)
1860 {
1861 /**
1862 ** Could not deactivate Join Failure
1863 ** timer. Log error.
1864 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001865 limLog(pMac, LOGP, FL("Unable to deactivate Disassoc ack timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001866 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001867 }
1868 val = 1000;
1869 val = SYS_MS_TO_TICKS(val);
1870 if (tx_timer_change(&pMac->lim.limTimers.gLimDisassocAckTimer,
1871 val, 0) != TX_SUCCESS)
1872 {
1873 /**
1874 * Could not change Join Failure
1875 * timer. Log error.
1876 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001877 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001878 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001879 }
1880 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001881
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001882 case eLIM_DEAUTH_ACK_TIMER:
1883 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer) != TX_SUCCESS)
1884 {
1885 /**
1886 ** Could not deactivate Join Failure
1887 ** timer. Log error.
1888 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001889 limLog(pMac, LOGP, FL("Unable to deactivate Deauth ack timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001890 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001891 }
1892 val = 1000;
1893 val = SYS_MS_TO_TICKS(val);
1894 if (tx_timer_change(&pMac->lim.limTimers.gLimDeauthAckTimer,
1895 val, 0) != TX_SUCCESS)
1896 {
1897 /**
1898 * Could not change Join Failure
1899 * timer. Log error.
1900 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001901 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001902 return;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001903 }
1904 break;
Viral Modid86bde22012-12-10 13:09:21 -08001905
Viral Modid86bde22012-12-10 13:09:21 -08001906 case eLIM_INSERT_SINGLESHOT_NOA_TIMER:
1907 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer) != TX_SUCCESS)
1908 {
1909 /**
1910 ** Could not deactivate SingleShot NOA Insert
1911 ** timer. Log error.
1912 **/
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001913 limLog(pMac, LOGP, FL("Unable to deactivate SingleShot NOA Insert timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001914 return;
1915 }
1916 val = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE;
1917 val = SYS_MS_TO_TICKS(val);
1918 if (tx_timer_change(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer,
1919 val, 0) != TX_SUCCESS)
1920 {
1921 /**
1922 * Could not change Single Shot NOA Insert
1923 * timer. Log error.
1924 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001925 limLog(pMac, LOGP, FL("Unable to change timer"));
Viral Modid86bde22012-12-10 13:09:21 -08001926 return;
1927 }
1928 break;
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301929 case eLIM_AP_ECSA_TIMER:
1930 if (tx_timer_deactivate(
1931 &pMac->lim.limTimers.g_lim_ap_ecsa_timer) != TX_SUCCESS)
1932 {
1933 /*
1934 * Could not deactivate SingleShot NOA Insert
1935 * timer. Log error.
1936 */
1937 limLog(pMac, LOGE, FL("Unable to deactivate AP ecsa timer"));
1938 return;
1939 }
1940 if ((psessionEntry = peFindSessionBySessionId(pMac,
1941 pMac->lim.limTimers.g_lim_ap_ecsa_timer.sessionId)) == NULL)
1942 {
1943 limLog(pMac, LOGE,
1944 FL("session does not exist for given SessionId : %d, for AP ecsa timer"),
1945 pMac->lim.limTimers.g_lim_ap_ecsa_timer.sessionId);
1946 break;
1947 }
1948 val = psessionEntry->beaconParams.beaconInterval;
1949 val = SYS_MS_TO_TICKS(val);
1950 if (tx_timer_change(&pMac->lim.limTimers.g_lim_ap_ecsa_timer,
1951 val, 0) != TX_SUCCESS)
1952 {
1953 limLog(pMac, LOGE, FL("Unable to change g_lim_ap_ecsa_timer timer"));
1954 }
Jeff Johnson62c27982013-02-27 17:53:55 -08001955
Abhinav Kumar626f8652019-08-05 16:20:39 +05301956 case eLIM_AUTH_SAE_TIMER:
1957 if (tx_timer_deactivate(&pMac->lim.limTimers.sae_auth_timer)
1958 != TX_SUCCESS) {
1959 limLog(pMac, LOGP, FL("Unable to deactivate SAE auth timer"));
1960 return;
1961 }
1962 /* Change timer to reactivate it in future */
1963 val = SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS);
1964 if (tx_timer_change(&pMac->lim.limTimers.sae_auth_timer,
1965 val, 0) != TX_SUCCESS) {
1966 limLog(pMac, LOGP, FL("unable to change SAE auth timer"));
1967 return;
1968 }
1969 break;
1970
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301971 break;
1972 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 // Invalid timerId. Log error
1974 break;
1975 }
1976} /****** end limDeactivateAndChangeTimer() ******/
1977
1978
1979
1980/**---------------------------------------------------------------
1981\fn limHeartBeatDeactivateAndChangeTimer
1982\brief This function deactivates and changes the heart beat
1983\ timer, eLIM_HEART_BEAT_TIMER.
1984\
1985\param pMac
1986\param psessionEntry
1987\return None
1988------------------------------------------------------------------*/
1989void
1990limHeartBeatDeactivateAndChangeTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
1991{
Ravi Joshid0699502013-07-08 15:48:47 -07001992 tANI_U32 val, val1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001993
Siddharth Bhal224da542014-05-28 07:07:46 +05301994 if (NULL == psessionEntry)
1995 {
1996 limLog(pMac, LOGE, FL("%s: received session id NULL."
1997 " Heartbeat timer config failed"), __func__);
1998 return;
1999 }
2000
Yathish9f22e662012-12-10 14:21:35 -08002001#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
Ravi Joshid0699502013-07-08 15:48:47 -07002002 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2003 return;
Yathish9f22e662012-12-10 14:21:35 -08002004#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002005
Ravi Joshid0699502013-07-08 15:48:47 -07002006 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer) != TX_SUCCESS)
2007 limLog(pMac, LOGP, FL("Fail to deactivate HeartBeatTimer "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002008
Ravi Joshid0699502013-07-08 15:48:47 -07002009 /* HB Timer sessionisation: In case of 2 or more sessions, the HB interval keeps
2010 changing. to avoid this problem, HeartBeat interval is made constant, by
2011 fixing beacon interval to 100ms immaterial of the beacon interval of the session */
Jeff Johnson295189b2012-06-20 16:38:30 -07002012
Ravi Joshid0699502013-07-08 15:48:47 -07002013 //val = psessionEntry->beaconParams.beaconInterval;
2014 val = LIM_HB_TIMER_BEACON_INTERVAL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002015
Ravi Joshid0699502013-07-08 15:48:47 -07002016 if (wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) != eSIR_SUCCESS)
2017 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_HEART_BEAT_THRESHOLD "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002018
Ravi Joshid0699502013-07-08 15:48:47 -07002019 PELOGW(limLog(pMac,LOGW,
2020 FL("HB Timer Int.=100ms * %d, Beacon Int.=%dms,Session Id=%d "),
2021 val1, psessionEntry->beaconParams.beaconInterval,
2022 psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002023
Ravi Joshid0699502013-07-08 15:48:47 -07002024 /* The HB timer timeout value of 4 seconds (40 beacon intervals) is not
2025 * enough to judge the peer device inactivity when 32 peers are connected.
2026 * Hence increasing the HB timer timeout to
2027 * HBtimeout = (TBTT * num_beacons * num_peers)
2028 */
2029 if (eSIR_IBSS_MODE == psessionEntry->bssType &&
2030 pMac->lim.gLimNumIbssPeers > 0)
2031 {
Ravi Joshi92a4e142013-06-27 17:00:42 -07002032 val1 = val1 * pMac->lim.gLimNumIbssPeers;
Ravi Joshid0699502013-07-08 15:48:47 -07002033 }
Ravi Joshi92a4e142013-06-27 17:00:42 -07002034
Ravi Joshid0699502013-07-08 15:48:47 -07002035 // Change timer to reactivate it in future
2036 val = SYS_MS_TO_TICKS(val * val1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002037
Ravi Joshid0699502013-07-08 15:48:47 -07002038 if (tx_timer_change(&pMac->lim.limTimers.gLimHeartBeatTimer, val, 0) != TX_SUCCESS)
2039 limLog(pMac, LOGP, FL("Fail to change HeartBeatTimer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002040
2041} /****** end limHeartBeatDeactivateAndChangeTimer() ******/
2042
2043
2044/**---------------------------------------------------------------
2045\fn limReactivateHeartBeatTimer
2046\brief This function s called to deactivate, change and
2047\ activate a timer.
2048\
2049\param pMac - Pointer to Global MAC structure
2050\param psessionEntry
2051\return None
2052------------------------------------------------------------------*/
2053void
2054limReactivateHeartBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
2055{
Siddharth Bhald31c1252014-05-05 19:34:14 +05302056 if (NULL == psessionEntry)
2057 {
2058 limLog(pMac, LOGE, FL("%s: received session id NULL."
2059 " Heartbeat timer config failed"), __func__);
2060 return;
2061 }
2062
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002063 PELOG3(limLog(pMac, LOG3, FL("Rxed Heartbeat. Count=%d"), psessionEntry->LimRxedBeaconCntDuringHB);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002064
Yathish9f22e662012-12-10 14:21:35 -08002065#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2066 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07002067 {
2068 limLog(pMac, LOGW, FL("Active offload feature is enabled, FW takes care of HB monitoring"));
Yathish9f22e662012-12-10 14:21:35 -08002069 return;
Srinivas Girigowda35f6a712013-04-04 16:48:34 -07002070 }
Yathish9f22e662012-12-10 14:21:35 -08002071#endif
2072
Jeff Johnson295189b2012-06-20 16:38:30 -07002073 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002074
2075 //only start the hearbeat-timer if the timeout value is non-zero
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002076 if(pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs > 0)
2077 {
2078 /*
2079 * There is increasing need to limit the apps wakeup due to WLAN
2080 * activity. During HB monitoring, the beacons from peer are sent to
2081 * the host causing the host to wakeup. Hence, offloading the HB
2082 * monitoring to LMAC
2083 */
2084 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE &&
2085 IS_IBSS_HEARTBEAT_OFFLOAD_FEATURE_ENABLE)
2086 {
2087 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
2088 {
2089 limLog(pMac, LOGP,FL("IBSS HeartBeat Offloaded, Could not deactivate Heartbeat timer"));
2090 }
2091 else
2092 {
2093 limLog(pMac, LOGE, FL("IBSS HeartBeat Offloaded, Deactivated heartbeat link monitoring"));
2094 }
2095 }
2096 else
2097 {
2098 if (tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer)!= TX_SUCCESS)
2099 {
2100 limLog(pMac, LOGP,FL("could not activate Heartbeat timer"));
2101 }
2102 else
2103 {
2104 limLog(pMac, LOGW, FL("Reactivated heartbeat link monitoring"));
2105 }
2106 }
2107 limResetHBPktCount(psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 }
2109
2110} /****** end limReactivateHeartBeatTimer() ******/
2111
Jeff Johnson295189b2012-06-20 16:38:30 -07002112
2113/**
2114 * limActivateHearBeatTimer()
2115 *
2116 *
2117 * @brief: This function is called to activate heartbeat timer
2118 *
2119 *LOGIC:
2120 *
2121 *ASSUMPTIONS:
2122 * NA
2123 *
2124 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2125 *
2126 * @param pMac - Pointer to Global MAC structure
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002127 * @param psessionEntry - Session Entry
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 *
2129 * @return TX_SUCCESS - timer is activated
2130 * errors - fail to start the timer
2131 */
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002132v_UINT_t limActivateHearBeatTimer(tpAniSirGlobal pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002133{
2134 v_UINT_t status = TX_TIMER_ERROR;
2135
Yathish9f22e662012-12-10 14:21:35 -08002136#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2137 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Ravi Joshif7fe8d32013-09-21 17:02:11 -07002138 return (TX_SUCCESS);
Yathish9f22e662012-12-10 14:21:35 -08002139#endif
2140
Jeff Johnson295189b2012-06-20 16:38:30 -07002141 if(TX_AIRGO_TMR_SIGNATURE == pMac->lim.limTimers.gLimHeartBeatTimer.tmrSignature)
2142 {
2143 //consider 0 interval a ok case
2144 if( pMac->lim.limTimers.gLimHeartBeatTimer.initScheduleTimeInMsecs )
2145 {
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002146 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE &&
2147 IS_IBSS_HEARTBEAT_OFFLOAD_FEATURE_ENABLE)
2148 {
2149 /* HB offload in IBSS mode */
2150 status = tx_timer_deactivate(&pMac->lim.limTimers.gLimHeartBeatTimer);
2151 if (TX_SUCCESS != status)
2152 {
2153 PELOGE(limLog(pMac, LOGE,
2154 FL("IBSS HB Offload, Could not deactivate HB timer status(%d)"),
2155 status);)
2156 }
2157 else
2158 {
2159 PELOGE(limLog(pMac, LOGE,
2160 FL("%s] IBSS HB Offloaded, Heartbeat timer deactivated"),
2161 __func__);)
2162 }
2163
2164 }
2165 else
2166 {
2167 status = tx_timer_activate(&pMac->lim.limTimers.gLimHeartBeatTimer);
2168 if ( TX_SUCCESS != status )
2169 {
2170 PELOGE(limLog(pMac, LOGE,
2171 FL("could not activate Heartbeat timer status(%d)"), status);)
2172 }
2173 else
2174 {
2175 PELOGE(limLog(pMac, LOGW,
2176 FL("%s] Activated Heartbeat timer status(%d)"), __func__, status);)
2177 }
2178 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 }
2180 else
2181 {
2182 status = TX_SUCCESS;
2183 }
2184 }
2185
2186 return (status);
2187}
2188
2189
2190
2191/**
2192 * limDeactivateAndChangePerStaIdTimer()
2193 *
2194 *
2195 * @brief: This function is called to deactivate and change a per STA timer
2196 * for future re-activation
2197 *
2198 *LOGIC:
2199 *
2200 *ASSUMPTIONS:
2201 * NA
2202 *
2203 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
2204 *
2205 * @param pMac - Pointer to Global MAC structure
2206 * @param timerId - enum of timer to be deactivated and changed
2207 * This enum is defined in limUtils.h file
2208 * @param staId - staId
2209 *
2210 * @return None
2211 */
2212
2213void
2214limDeactivateAndChangePerStaIdTimer(tpAniSirGlobal pMac, tANI_U32 timerId, tANI_U16 staId)
2215{
2216 tANI_U32 val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002217
2218 switch (timerId)
2219 {
2220 case eLIM_CNF_WAIT_TIMER:
2221
2222 if (tx_timer_deactivate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2223 != TX_SUCCESS)
2224 {
2225 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002226 FL("unable to deactivate CNF wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002227
2228 }
2229
2230 // Change timer to reactivate it in future
2231
2232 if (wlan_cfgGetInt(pMac, WNI_CFG_WT_CNF_TIMEOUT,
2233 &val) != eSIR_SUCCESS)
2234 {
2235 /**
2236 * Could not get cnf timeout value
2237 * from CFG. Log error.
2238 */
2239 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002240 FL("could not retrieve cnf timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 }
2242 val = SYS_MS_TO_TICKS(val);
2243
2244 if (tx_timer_change(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId],
2245 val, val) != TX_SUCCESS)
2246 {
2247 // Could not change cnf timer.
2248 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002249 limLog(pMac, LOGP, FL("unable to change cnf wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 }
2251
2252 break;
2253
2254 case eLIM_AUTH_RSP_TIMER:
2255 {
2256 tLimPreAuthNode *pAuthNode;
2257
2258 pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, staId);
2259
2260 if (pAuthNode == NULL)
2261 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002262 limLog(pMac, LOGP, FL("Invalid Pre Auth Index passed :%d"), staId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 break;
2264 }
2265
2266 if (tx_timer_deactivate(&pAuthNode->timer) != TX_SUCCESS)
2267 {
2268 // Could not deactivate auth response timer.
2269 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002270 limLog(pMac, LOGP, FL("unable to deactivate auth response timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 }
2272
2273 // Change timer to reactivate it in future
2274
2275 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, &val) != eSIR_SUCCESS)
2276 {
2277 /**
2278 * Could not get auth rsp timeout value
2279 * from CFG. Log error.
2280 */
2281 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002282 FL("could not retrieve auth response timeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 }
2284
2285 val = SYS_MS_TO_TICKS(val);
2286
2287 if (tx_timer_change(&pAuthNode->timer, val, 0) != TX_SUCCESS)
2288 {
2289 // Could not change auth rsp timer.
2290 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002291 limLog(pMac, LOGP, FL("unable to change auth rsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 }
2293 }
2294 break;
2295
Jeff Johnson295189b2012-06-20 16:38:30 -07002296
2297 default:
2298 // Invalid timerId. Log error
2299 break;
2300
2301 }
2302}
2303
2304
2305/**
2306 * limActivateCnfTimer()
2307 *
2308 *FUNCTION:
2309 * This function is called to activate a per STA timer
2310 *
2311 *LOGIC:
2312 *
2313 *ASSUMPTIONS:
2314 * NA
2315 *
2316 *NOTE:
2317 * NA
2318 *
2319 * @param pMac - Pointer to Global MAC structure
2320 * @param StaId - staId
2321 *
2322 * @return None
2323 */
2324
2325void limActivateCnfTimer(tpAniSirGlobal pMac, tANI_U16 staId, tpPESession psessionEntry)
2326{
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = psessionEntry->peSessionId;
2328 if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId])
2329 != TX_SUCCESS)
2330 {
2331 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002332 FL("could not activate cnf wait timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 }
2334}
2335
2336/**
2337 * limActivateAuthRspTimer()
2338 *
2339 *FUNCTION:
2340 * This function is called to activate a per STA timer
2341 *
2342 *LOGIC:
2343 *
2344 *ASSUMPTIONS:
2345 * NA
2346 *
2347 *NOTE:
2348 * NA
2349 *
2350 * @param pMac - Pointer to Global MAC structure
2351 * @param id - id
2352 *
2353 * @return None
2354 */
2355
2356void limActivateAuthRspTimer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode)
2357{
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS)
2359 {
2360 /// Could not activate auth rsp timer.
2361 // Log error
2362 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002363 FL("could not activate auth rsp timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 }
2365}
2366
2367
2368/**
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 * limAssocCnfWaitTmerHandler()
2370 *
2371 *FUNCTION:
2372 * This function post a message to send a disassociate frame out.
2373 *
2374 *LOGIC:
2375 *
2376 *ASSUMPTIONS:
2377 *
2378 *NOTE:
2379 * NA
2380 *
2381 * @param
2382 *
2383 * @return None
2384 */
2385
2386void
2387limCnfWaitTmerHandler(void *pMacGlobal, tANI_U32 param)
2388{
2389 tSirMsgQ msg;
2390 tANI_U32 statusCode;
2391 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2392
2393 msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
2394 msg.bodyval = (tANI_U32)param;
2395 msg.bodyptr = NULL;
2396
2397 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2398 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002399 FL("posting to LIM failed, reason=%d"), statusCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002400
2401}
2402
2403/**
2404 * limKeepaliveTmerHandler()
2405 *
2406 *FUNCTION:
2407 * This function post a message to send a NULL data frame.
2408 *
2409 *LOGIC:
2410 *
2411 *ASSUMPTIONS:
2412 *
2413 *NOTE:
2414 * NA
2415 *
2416 * @param
2417 *
2418 * @return None
2419 */
2420
2421void
2422limKeepaliveTmerHandler(void *pMacGlobal, tANI_U32 param)
2423{
2424 tSirMsgQ msg;
2425 tANI_U32 statusCode;
2426 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2427
2428 msg.type = SIR_LIM_KEEPALIVE_TIMEOUT;
2429 msg.bodyval = (tANI_U32)param;
2430 msg.bodyptr = NULL;
2431
2432 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2433 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002434 FL("posting to LIM failed, reason=%d"), statusCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002435
2436}
2437
2438void
2439limChannelSwitchTimerHandler(void *pMacGlobal, tANI_U32 param)
2440{
2441 tSirMsgQ msg;
2442 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2443
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302444 limLog(pMac, LOG1,
2445 FL("ChannelSwitch Timer expired. Posting msg to LIM "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002446
2447 msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
2448 msg.bodyval = (tANI_U32)param;
2449 msg.bodyptr = NULL;
2450
2451 limPostMsgApi(pMac, &msg);
2452}
2453
2454void
2455limQuietTimerHandler(void *pMacGlobal, tANI_U32 param)
2456{
2457 tSirMsgQ msg;
2458 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2459
2460 msg.type = SIR_LIM_QUIET_TIMEOUT;
2461 msg.bodyval = (tANI_U32)param;
2462 msg.bodyptr = NULL;
2463
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302464 limLog(pMac, LOG1,
2465 FL("Post SIR_LIM_QUIET_TIMEOUT msg. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 limPostMsgApi(pMac, &msg);
2467}
2468
2469void
2470limQuietBssTimerHandler(void *pMacGlobal, tANI_U32 param)
2471{
2472 tSirMsgQ msg;
2473 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2474
2475 msg.type = SIR_LIM_QUIET_BSS_TIMEOUT;
2476 msg.bodyval = (tANI_U32)param;
2477 msg.bodyptr = NULL;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302478 limLog(pMac, LOG1,
2479 FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 limPostMsgApi(pMac, &msg);
2481}
Jeff Johnson295189b2012-06-20 16:38:30 -07002482#if 0
2483void
2484limWPSOverlapTimerHandler(void *pMacGlobal, tANI_U32 param)
2485{
2486 tSirMsgQ msg;
2487 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2488
2489 msg.type = SIR_LIM_WPS_OVERLAP_TIMEOUT;
2490 msg.bodyval = (tANI_U32)param;
2491 msg.bodyptr = NULL;
2492 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002493 FL("Post SIR_LIM_WPS_OVERLAP_TIMEOUT msg. "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 limPostMsgApi(pMac, &msg);
2495}
2496#endif
Yathish9f22e662012-12-10 14:21:35 -08002497
2498#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2499/* ACTIVE_MODE_HB_OFFLOAD */
2500/**
2501 * limMissedBeaconInActiveMode()
2502 *
2503 *FUNCTION:
2504 * This function handle beacon miss indication from FW
2505 * in Active mode.
2506 *
2507 *LOGIC:
2508 *
2509 *ASSUMPTIONS:
2510 * NA
2511 *
2512 *NOTE:
2513 * NA
2514 *
2515 * @param param - Msg Type
2516 *
2517 * @return None
2518 */
2519void
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002520limMissedBeaconInActiveMode(void *pMacGlobal, tpPESession psessionEntry)
Yathish9f22e662012-12-10 14:21:35 -08002521{
2522 tANI_U32 statusCode;
2523 tSirMsgQ msg;
2524 tpAniSirGlobal pMac = (tpAniSirGlobal)pMacGlobal;
2525
2526 // Prepare and post message to LIM Message Queue
2527 if(IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
Jeff Johnson62c27982013-02-27 17:53:55 -08002528 {
Yathish9f22e662012-12-10 14:21:35 -08002529 msg.type = (tANI_U16) SIR_LIM_HEART_BEAT_TIMEOUT;
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002530 msg.bodyptr = psessionEntry;
Yathish9f22e662012-12-10 14:21:35 -08002531 msg.bodyval = 0;
2532 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002533 FL("Heartbeat failure from Riva"));
Yathish9f22e662012-12-10 14:21:35 -08002534 if ((statusCode = limPostMsgApi(pMac, &msg)) != eSIR_SUCCESS)
2535 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002536 FL("posting message %X to LIM failed, reason=%d"),
Yathish9f22e662012-12-10 14:21:35 -08002537 msg.type, statusCode);
2538 }
2539}
2540#endif