blob: 941be6de785a30caabac3f15478cde9687ee2f4d [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Padma, Santhosh Kumarc56735f2017-09-13 18:14:26 +05302 * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/*
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080020 * This file lim_timer_utils.cc contains the utility functions
21 * LIM uses for handling various timers.
22 * Author: Chandra Modumudi
23 * Date: 02/13/02
24 * History:-
25 * Date Modified by Modification Information
26 * --------------------------------------------------------------------
27 */
28
29#include "lim_types.h"
30#include "lim_utils.h"
31#include "lim_assoc_utils.h"
32#include "lim_security_utils.h"
Arif Hussain9f93a642018-09-10 18:32:25 -070033#include "wlan_mlme_public_struct.h"
Padma, Santhosh Kumar95091352016-08-16 15:23:31 +053034#include <lim_api.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035
36/* channel Switch Timer in ticks */
37#define LIM_CHANNEL_SWITCH_TIMER_TICKS 1
38/* Lim Quite timer in ticks */
39#define LIM_QUIET_TIMER_TICKS 100
40/* Lim Quite BSS timer interval in ticks */
41#define LIM_QUIET_BSS_TIMER_TICK 100
42/* Lim KeepAlive timer default (3000)ms */
43#define LIM_KEEPALIVE_TIMER_MS 3000
44/* Lim JoinProbeRequest Retry timer default (200)ms */
45#define LIM_JOIN_PROBE_REQ_TIMER_MS 200
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +053046/* Lim Periodic Auth Retry timer default 60 ms */
47#define LIM_AUTH_RETRY_TIMER_MS 60
48
Padma, Santhosh Kumarc56735f2017-09-13 18:14:26 +053049/*
50 * SAE auth timer of 5secs. This is required for duration of entire SAE
51 * authentication.
52 */
53#define LIM_AUTH_SAE_TIMER_MS 5000
54
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080055
56/* This timer is a periodic timer which expires at every 1 sec to
57 convert ACTIVE DFS channel to DFS channels */
58#define ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT 1000
59
Jeff Johnson9320c1e2018-12-02 13:09:20 -080060static bool lim_create_non_ap_timers(struct mac_context *mac)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080061{
62 uint32_t cfgValue;
63 /* Create Channel Switch Timer */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -080064 if (tx_timer_create(mac, &mac->lim.limTimers.gLimChannelSwitchTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080065 "CHANNEL SWITCH TIMER",
66 lim_channel_switch_timer_handler, 0,
67 LIM_CHANNEL_SWITCH_TIMER_TICKS,
68 0, TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +053069 pe_err("failed to create Ch Switch timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080070 return false;
71 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080072
Arif Hussain9f93a642018-09-10 18:32:25 -070073 cfgValue = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -080074 mac->mlme_cfg->timeouts.join_failure_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080075 /* Create Join failure timer and activate it later */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -080076 if (tx_timer_create(mac, &mac->lim.limTimers.gLimJoinFailureTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080077 "JOIN FAILURE TIMEOUT",
78 lim_timer_handler, SIR_LIM_JOIN_FAIL_TIMEOUT,
79 cfgValue, 0,
80 TX_NO_ACTIVATE) != TX_SUCCESS) {
81 /* / Could not create Join failure timer. */
82 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +053083 pe_err("could not create Join failure timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080084 return false;
85 }
86 /* Send unicast probe req frame every 200 ms */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -080087 if (tx_timer_create(mac,
88 &mac->lim.limTimers.gLimPeriodicJoinProbeReqTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080089 "Periodic Join Probe Request Timer",
90 lim_timer_handler,
91 SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT,
92 SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS), 0,
93 TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +053094 pe_err("could not create Periodic Join Probe Request tmr");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080095 return false;
96 }
97
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +053098 /* Send Auth frame every 60 ms */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -080099 if ((tx_timer_create(mac,
100 &mac->lim.limTimers.g_lim_periodic_auth_retry_timer,
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +0530101 "Periodic AUTH Timer",
102 lim_timer_handler, SIR_LIM_AUTH_RETRY_TIMEOUT,
103 SYS_MS_TO_TICKS(LIM_AUTH_RETRY_TIMER_MS), 0,
104 TX_NO_ACTIVATE)) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530105 pe_err("could not create Periodic AUTH Timer");
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +0530106 return false;
107 }
108
Arif Hussain43e09712018-09-18 19:31:57 -0700109 cfgValue = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800110 mac->mlme_cfg->timeouts.assoc_failure_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800111 /* Create Association failure timer and activate it later */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800112 if (tx_timer_create(mac, &mac->lim.limTimers.gLimAssocFailureTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800113 "ASSOC FAILURE TIMEOUT",
114 lim_assoc_failure_timer_handler, LIM_ASSOC,
115 cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530116 pe_err("could not create Association failure timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800117 return false;
118 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800119
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800120 cfgValue = SYS_MS_TO_TICKS(mac->mlme_cfg->timeouts.addts_rsp_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800121
122 /* Create Addts response timer and activate it later */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800123 if (tx_timer_create(mac, &mac->lim.limTimers.gLimAddtsRspTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800124 "ADDTS RSP TIMEOUT",
125 lim_addts_response_timer_handler,
126 SIR_LIM_ADDTS_RSP_TIMEOUT,
127 cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530128 pe_err("could not create Addts response timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800129 return false;
130 }
131
Arif Hussain43e09712018-09-18 19:31:57 -0700132 cfgValue = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800133 mac->mlme_cfg->timeouts.auth_failure_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800134 /* Create Auth failure timer and activate it later */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800135 if (tx_timer_create(mac, &mac->lim.limTimers.gLimAuthFailureTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800136 "AUTH FAILURE TIMEOUT",
137 lim_timer_handler,
138 SIR_LIM_AUTH_FAIL_TIMEOUT,
139 cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530140 pe_err("could not create Auth failure timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800141 return false;
142 }
143
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800144 /* Change timer to reactivate it in future */
Arif Hussain43e09712018-09-18 19:31:57 -0700145 cfgValue = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800146 mac->mlme_cfg->timeouts.probe_after_hb_fail_timeout);
147 if (tx_timer_create(mac, &mac->lim.limTimers.gLimProbeAfterHBTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800148 "Probe after Heartbeat TIMEOUT",
149 lim_timer_handler,
150 SIR_LIM_PROBE_HB_FAILURE_TIMEOUT,
151 cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530152 pe_err("unable to create ProbeAfterHBTimer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800153 return false;
154 }
155
Padma, Santhosh Kumarc56735f2017-09-13 18:14:26 +0530156 /*
157 * SAE auth timer of 5secs. This is required for duration of entire SAE
158 * authentication.
159 */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800160 if ((tx_timer_create(mac,
161 &mac->lim.limTimers.sae_auth_timer,
Padma, Santhosh Kumarc56735f2017-09-13 18:14:26 +0530162 "SAE AUTH Timer",
163 lim_timer_handler, SIR_LIM_AUTH_SAE_TIMEOUT,
164 SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS), 0,
165 TX_NO_ACTIVATE)) != TX_SUCCESS) {
166 pe_err("could not create SAE AUTH Timer");
167 return false;
168 }
169
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800170 return true;
171}
172/**
173 * lim_create_timers()
174 *
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800175 * @mac : Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800176 *
177 * This function is called upon receiving
178 * 1. SME_START_REQ for STA in ESS role
179 * 2. SME_START_BSS_REQ for AP role & STA in IBSS role
180 *
181 * @return : status of operation
182 */
183
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800184uint32_t lim_create_timers(struct mac_context *mac)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185{
186 uint32_t cfgValue, i = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800187
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530188 pe_debug("Creating Timers used by LIM module in Role: %d",
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800189 mac->lim.gLimSystemRole);
Varun Reddy Yeturu32de0e42016-04-15 14:25:59 +0530190 /* Create timers required for host roaming feature */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800191 if (TX_SUCCESS != lim_create_timers_host_roam(mac))
Varun Reddy Yeturu32de0e42016-04-15 14:25:59 +0530192 return TX_TIMER_ERROR;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800193
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800194 if (mac->lim.gLimSystemRole != eLIM_AP_ROLE)
195 if (false == lim_create_non_ap_timers(mac))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800196 goto err_timer;
197
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800198 cfgValue = mac->mlme_cfg->sta.wait_cnf_timeout;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800199 cfgValue = SYS_MS_TO_TICKS(cfgValue);
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800200 for (i = 0; i < (mac->lim.maxStation + 1); i++) {
201 if (tx_timer_create(mac,
202 &mac->lim.limTimers.gpLimCnfWaitTimer[i],
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800203 "CNF_MISS_TIMEOUT",
204 lim_cnf_wait_tmer_handler,
205 (uint32_t) i, cfgValue,
206 0, TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530207 pe_err("Cannot create CNF wait timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800208 goto err_timer;
209 }
210 }
211
212 /* Alloc and init table for the preAuth timer list */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800213 cfgValue = mac->mlme_cfg->lfr.max_num_pre_auth;
214 mac->lim.gLimPreAuthTimerTable.numEntry = cfgValue;
215 mac->lim.gLimPreAuthTimerTable.pTable =
Naveen Rawate6ddcaa2016-02-05 16:50:18 -0800216 qdf_mem_malloc(cfgValue * sizeof(tLimPreAuthNode *));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800217
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800218 if (!mac->lim.gLimPreAuthTimerTable.pTable)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800219 goto err_timer;
Naveen Rawate6ddcaa2016-02-05 16:50:18 -0800220
221 for (i = 0; i < cfgValue; i++) {
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800222 mac->lim.gLimPreAuthTimerTable.pTable[i] =
Naveen Rawate6ddcaa2016-02-05 16:50:18 -0800223 qdf_mem_malloc(sizeof(tLimPreAuthNode));
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800224 if (mac->lim.gLimPreAuthTimerTable.pTable[i] == NULL) {
225 mac->lim.gLimPreAuthTimerTable.numEntry = 0;
Naveen Rawate6ddcaa2016-02-05 16:50:18 -0800226 goto err_timer;
227 }
228 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800229
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800230 lim_init_pre_auth_timer_table(mac, &mac->lim.gLimPreAuthTimerTable);
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530231 pe_debug("alloc and init table for preAuth timers");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800232
Arif Hussain43e09712018-09-18 19:31:57 -0700233 cfgValue = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800234 mac->mlme_cfg->timeouts.olbc_detect_timeout);
235 if (tx_timer_create(mac, &mac->lim.limTimers.gLimUpdateOlbcCacheTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800236 "OLBC UPDATE CACHE TIMEOUT",
237 lim_update_olbc_cache_timer_handler,
238 SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT, cfgValue,
239 cfgValue, TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530240 pe_err("Cannot create update OLBC cache tmr");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800241 goto err_timer;
242 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800243
244 cfgValue = 1000;
245 cfgValue = SYS_MS_TO_TICKS(cfgValue);
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800246 if (tx_timer_create(mac, &mac->lim.limTimers.gLimDisassocAckTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800247 "DISASSOC ACK TIMEOUT",
248 lim_timer_handler, SIR_LIM_DISASSOC_ACK_TIMEOUT,
249 cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530250 pe_err("could not DISASSOC ACK TIMEOUT timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800251 goto err_timer;
252 }
253
254 cfgValue = 1000;
255 cfgValue = SYS_MS_TO_TICKS(cfgValue);
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800256 if (tx_timer_create(mac, &mac->lim.limTimers.gLimDeauthAckTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800257 "DISASSOC ACK TIMEOUT",
258 lim_timer_handler, SIR_LIM_DEAUTH_ACK_TIMEOUT,
259 cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530260 pe_err("could not create DEAUTH ACK TIMEOUT timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800261 goto err_timer;
262 }
263
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800264 cfgValue = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
265 cfgValue = SYS_MS_TO_TICKS(cfgValue);
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800266 if (tx_timer_create(mac,
267 &mac->lim.limTimers.gLimActiveToPassiveChannelTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800268 "ACTIVE TO PASSIVE CHANNEL", lim_timer_handler,
269 SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE, cfgValue, 0,
270 TX_NO_ACTIVATE) != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530271 pe_warn("could not create timer for passive channel to active channel");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800272 goto err_timer;
273 }
274
275 return TX_SUCCESS;
276
277err_timer:
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800278 lim_delete_timers_host_roam(mac);
279 tx_timer_delete(&mac->lim.limTimers.gLimDeauthAckTimer);
280 tx_timer_delete(&mac->lim.limTimers.gLimDisassocAckTimer);
281 tx_timer_delete(&mac->lim.limTimers.gLimUpdateOlbcCacheTimer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800282 while (((int32_t)-- i) >= 0) {
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800283 tx_timer_delete(&mac->lim.limTimers.gpLimCnfWaitTimer[i]);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800284 }
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800285 tx_timer_delete(&mac->lim.limTimers.gLimProbeAfterHBTimer);
286 tx_timer_delete(&mac->lim.limTimers.gLimAuthFailureTimer);
287 tx_timer_delete(&mac->lim.limTimers.gLimAddtsRspTimer);
288 tx_timer_delete(&mac->lim.limTimers.gLimAssocFailureTimer);
289 tx_timer_delete(&mac->lim.limTimers.gLimJoinFailureTimer);
290 tx_timer_delete(&mac->lim.limTimers.gLimPeriodicJoinProbeReqTimer);
291 tx_timer_delete(&mac->lim.limTimers.g_lim_periodic_auth_retry_timer);
292 tx_timer_delete(&mac->lim.limTimers.gLimChannelSwitchTimer);
293 tx_timer_delete(&mac->lim.limTimers.gLimActiveToPassiveChannelTimer);
294 tx_timer_delete(&mac->lim.limTimers.sae_auth_timer);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800295
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800296 if (NULL != mac->lim.gLimPreAuthTimerTable.pTable) {
297 for (i = 0; i < mac->lim.gLimPreAuthTimerTable.numEntry; i++)
298 qdf_mem_free(mac->lim.gLimPreAuthTimerTable.pTable[i]);
299 qdf_mem_free(mac->lim.gLimPreAuthTimerTable.pTable);
300 mac->lim.gLimPreAuthTimerTable.pTable = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800301 }
302 return TX_TIMER_ERROR;
303} /****** end lim_create_timers() ******/
304
305/**
306 * lim_timer_handler()
307 *
308 ***FUNCTION:
309 * This function is called upon
310 * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning
311 * 2. JOIN_FAILURE timer expiration while joining a BSS
312 * 3. AUTH_FAILURE timer expiration while authenticating with a peer
313 * 4. Heartbeat timer expiration on STA
314 * 5. Background scan timer expiration on STA
315 * 6. AID release, Pre-auth cleanup and Link monitoring timer
316 * expiration on AP
317 *
318 ***LOGIC:
319 *
320 ***ASSUMPTIONS:
321 * NA
322 *
323 ***NOTE:
324 * NA
325 *
326 * @param param - Message corresponding to the timer that expired
327 *
328 * @return None
329 */
330
331void lim_timer_handler(void *pMacGlobal, uint32_t param)
332{
Jeff Johnsonc9f44622018-06-29 14:18:53 -0700333 QDF_STATUS status;
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700334 struct scheduler_msg msg = {0};
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800335 struct mac_context *mac = (struct mac_context *) pMacGlobal;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800336
337 /* Prepare and post message to LIM Message Queue */
338
339 msg.type = (uint16_t) param;
340 msg.bodyptr = NULL;
341 msg.bodyval = 0;
342
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800343 status = lim_post_msg_high_priority(mac, &msg);
Jeff Johnsonc9f44622018-06-29 14:18:53 -0700344 if (status != QDF_STATUS_SUCCESS)
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530345 pe_err("posting message: %X to LIM failed, reason: %d",
Jeff Johnsonc9f44622018-06-29 14:18:53 -0700346 msg.type, status);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800347} /****** end lim_timer_handler() ******/
348
349/**
350 * lim_addts_response_timer_handler()
351 *
352 ***FUNCTION:
353 * This function is called upon Addts response timer expiration on sta
354 *
355 ***LOGIC:
356 * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ
357 * when this function is executed.
358 *
359 ***ASSUMPTIONS:
360 * NA
361 *
362 ***NOTE:
363 * NA
364 *
365 * @param param - pointer to pre-auth node
366 *
367 * @return None
368 */
369
370void lim_addts_response_timer_handler(void *pMacGlobal, uint32_t param)
371{
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700372 struct scheduler_msg msg = {0};
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800373 struct mac_context *mac = (struct mac_context *) pMacGlobal;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800374
375 /* Prepare and post message to LIM Message Queue */
376
377 msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT;
378 msg.bodyval = param;
379 msg.bodyptr = NULL;
380
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800381 lim_post_msg_api(mac, &msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800382} /****** end lim_auth_response_timer_handler() ******/
383
384/**
385 * lim_auth_response_timer_handler()
386 *
387 ***FUNCTION:
388 * This function is called upon Auth response timer expiration on AP
389 *
390 ***LOGIC:
391 * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ
392 * when this function is executed.
393 *
394 ***ASSUMPTIONS:
395 * NA
396 *
397 ***NOTE:
398 * NA
399 *
400 * @param param - pointer to pre-auth node
401 *
402 * @return None
403 */
404
405void lim_auth_response_timer_handler(void *pMacGlobal, uint32_t param)
406{
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700407 struct scheduler_msg msg = {0};
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800408 struct mac_context *mac = (struct mac_context *) pMacGlobal;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800409
410 /* Prepare and post message to LIM Message Queue */
411
412 msg.type = SIR_LIM_AUTH_RSP_TIMEOUT;
413 msg.bodyptr = NULL;
414 msg.bodyval = (uint32_t) param;
415
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800416 lim_post_msg_api(mac, &msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800417} /****** end lim_auth_response_timer_handler() ******/
418
419/**
420 * lim_assoc_failure_timer_handler()
421 *
422 * @mac_global : Pointer to Global MAC structure
423 * @param : Indicates whether this is assoc or reassoc failure timeout
424 *
425 * This function is called upon Re/Assoc failure timer expiration on STA.
426 * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ when this
427 * function is executed.
428 *
429 * Return void
430 */
431void lim_assoc_failure_timer_handler(void *mac_global, uint32_t param)
432{
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700433 struct scheduler_msg msg = {0};
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800434 struct mac_context *mac_ctx = (struct mac_context *) mac_global;
Jeff Johnson396299a2018-11-18 22:13:58 -0800435 struct pe_session *session = NULL;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800436
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800437 session = mac_ctx->lim.pe_session;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800438 if (LIM_REASSOC == param && NULL != session
439 && session->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530440 pe_err("Reassoc timeout happened");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800441 if (mac_ctx->lim.reAssocRetryAttempt <
442 LIM_MAX_REASSOC_RETRY_LIMIT) {
443 lim_send_retry_reassoc_req_frame(mac_ctx,
444 session->pLimMlmReassocRetryReq, session);
445 mac_ctx->lim.reAssocRetryAttempt++;
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530446 pe_warn("Reassoc request retry is sent %d times",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800447 mac_ctx->lim.reAssocRetryAttempt);
448 return;
449 } else {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530450 pe_warn("Reassoc request retry MAX: %d reached",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800451 LIM_MAX_REASSOC_RETRY_LIMIT);
452 if (NULL != session->pLimMlmReassocRetryReq) {
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530453 qdf_mem_free(session->pLimMlmReassocRetryReq);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800454 session->pLimMlmReassocRetryReq = NULL;
455 }
456 }
457 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800458 /* Prepare and post message to LIM Message Queue */
459 msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT;
460 msg.bodyval = (uint32_t) param;
461 msg.bodyptr = NULL;
462 lim_post_msg_api(mac_ctx, &msg);
463} /****** end lim_assoc_failure_timer_handler() ******/
464
465/**
466 * lim_update_olbc_cache_timer_handler()
467 *
468 ***FUNCTION:
469 * This function is called upon update olbc cache timer expiration
470 * on STA
471 *
472 ***LOGIC:
473 * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ
474 * when this function is executed.
475 *
476 ***ASSUMPTIONS:
477 * NA
478 *
479 ***NOTE:
480 * NA
481 *
482 * @param
483 *
484 * @return None
485 */
486void lim_update_olbc_cache_timer_handler(void *pMacGlobal, uint32_t param)
487{
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700488 struct scheduler_msg msg = {0};
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800489 struct mac_context *mac = (struct mac_context *) pMacGlobal;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800490
491 /* Prepare and post message to LIM Message Queue */
492
493 msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT;
494 msg.bodyval = 0;
495 msg.bodyptr = NULL;
496
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800497 lim_post_msg_api(mac, &msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800498} /****** end lim_update_olbc_cache_timer_handler() ******/
499
500/**
501 * lim_deactivate_and_change_timer()
502 *
503 ***FUNCTION:
504 * This function is called to deactivate and change a timer
505 * for future re-activation
506 *
507 ***LOGIC:
508 *
509 ***ASSUMPTIONS:
510 * NA
511 *
512 ***NOTE:
513 * NA
514 *
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800515 * @param mac - Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800516 * @param timerId - enum of timer to be deactivated and changed
517 * This enum is defined in lim_utils.h file
518 *
519 * @return None
520 */
521
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800522void lim_deactivate_and_change_timer(struct mac_context *mac, uint32_t timerId)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800523{
524 uint32_t val = 0;
Jeff Johnson396299a2018-11-18 22:13:58 -0800525 struct pe_session * session_entry;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800526
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800527 switch (timerId) {
Varun Reddy Yeturu32de0e42016-04-15 14:25:59 +0530528 case eLIM_REASSOC_FAIL_TIMER:
529 case eLIM_FT_PREAUTH_RSP_TIMER:
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800530 lim_deactivate_and_change_timer_host_roam(mac, timerId);
Varun Reddy Yeturu32de0e42016-04-15 14:25:59 +0530531 break;
532
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800533 case eLIM_ADDTS_RSP_TIMER:
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800534 mac->lim.gLimAddtsRspTimerCount++;
535 if (tx_timer_deactivate(&mac->lim.limTimers.gLimAddtsRspTimer)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800536 != TX_SUCCESS) {
537 /* Could not deactivate AddtsRsp Timer */
538 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530539 pe_err("Unable to deactivate AddtsRsp timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800540 }
541 break;
542
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800543 case eLIM_JOIN_FAIL_TIMER:
544 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800545 (&mac->lim.limTimers.gLimJoinFailureTimer)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800546 != TX_SUCCESS) {
547 /**
548 * Could not deactivate Join Failure
549 * timer. Log error.
550 */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530551 pe_err("Unable to deactivate Join Failure timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800552 }
553
Arif Hussain9f93a642018-09-10 18:32:25 -0700554 val = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800555 mac->mlme_cfg->timeouts.join_failure_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800556
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800557 if (tx_timer_change(&mac->lim.limTimers.gLimJoinFailureTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800558 val, 0) != TX_SUCCESS) {
559 /**
560 * Could not change Join Failure
561 * timer. Log error.
562 */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530563 pe_err("Unable to change Join Failure timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800564 }
565
566 break;
567
568 case eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER:
569 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800570 (&mac->lim.limTimers.gLimPeriodicJoinProbeReqTimer)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800571 != TX_SUCCESS) {
572 /* Could not deactivate periodic join req Times. */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530573 pe_err("Unable to deactivate periodic join request timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800574 }
575
576 val = SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS);
577 if (tx_timer_change
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800578 (&mac->lim.limTimers.gLimPeriodicJoinProbeReqTimer, val,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800579 0) != TX_SUCCESS) {
580 /* Could not change periodic join req times. */
581 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530582 pe_err("Unable to change periodic join request timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800583 }
584
585 break;
586
587 case eLIM_AUTH_FAIL_TIMER:
588 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800589 (&mac->lim.limTimers.gLimAuthFailureTimer)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800590 != TX_SUCCESS) {
591 /* Could not deactivate Auth failure timer. */
592 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530593 pe_err("Unable to deactivate auth failure timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800594 }
595 /* Change timer to reactivate it in future */
Arif Hussain43e09712018-09-18 19:31:57 -0700596 val = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800597 mac->mlme_cfg->timeouts.auth_failure_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800598
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800599 if (tx_timer_change(&mac->lim.limTimers.gLimAuthFailureTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800600 val, 0) != TX_SUCCESS) {
601 /* Could not change Authentication failure timer. */
602 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530603 pe_err("unable to change Auth failure timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800604 }
605
606 break;
607
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +0530608 case eLIM_AUTH_RETRY_TIMER:
609
610 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800611 (&mac->lim.limTimers.g_lim_periodic_auth_retry_timer)
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +0530612 != TX_SUCCESS) {
613 /* Could not deactivate Auth Retry Timer. */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530614 pe_err("Unable to deactivate Auth Retry timer");
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +0530615 }
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800616 session_entry = pe_find_session_by_session_id(mac,
617 mac->lim.limTimers.
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +0530618 g_lim_periodic_auth_retry_timer.sessionId);
619 if (NULL == session_entry) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530620 pe_err("session does not exist for given SessionId : %d",
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800621 mac->lim.limTimers.
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +0530622 g_lim_periodic_auth_retry_timer.sessionId);
623 break;
624 }
625 /* 3/5 of the beacon interval */
626 val = (session_entry->beaconParams.beaconInterval * 3) / 5;
627 val = SYS_MS_TO_TICKS(val);
628 if (tx_timer_change
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800629 (&mac->lim.limTimers.g_lim_periodic_auth_retry_timer,
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +0530630 val, 0) != TX_SUCCESS) {
631 /* Could not change Auth Retry timer. */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530632 pe_err("Unable to change Auth Retry timer");
Abhishek Singh7d3bc3e2016-02-03 17:45:01 +0530633 }
634 break;
635
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800636 case eLIM_ASSOC_FAIL_TIMER:
637 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800638 (&mac->lim.limTimers.gLimAssocFailureTimer) !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800639 TX_SUCCESS) {
640 /* Could not deactivate Association failure timer. */
641 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530642 pe_err("unable to deactivate Association failure timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800643 }
644 /* Change timer to reactivate it in future */
Arif Hussain43e09712018-09-18 19:31:57 -0700645 val = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800646 mac->mlme_cfg->timeouts.assoc_failure_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800647
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800648 if (tx_timer_change(&mac->lim.limTimers.gLimAssocFailureTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800649 val, 0) != TX_SUCCESS) {
650 /* Could not change Association failure timer. */
651 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530652 pe_err("unable to change Assoc failure timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800653 }
654
655 break;
656
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800657 case eLIM_PROBE_AFTER_HB_TIMER:
658 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800659 (&mac->lim.limTimers.gLimProbeAfterHBTimer) !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800660 TX_SUCCESS) {
661 /* Could not deactivate Heartbeat timer. */
662 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530663 pe_err("unable to deactivate probeAfterHBTimer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800664 } else {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530665 pe_debug("Deactivated probe after hb timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800666 }
667
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800668 /* Change timer to reactivate it in future */
Arif Hussain43e09712018-09-18 19:31:57 -0700669 val = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800670 mac->mlme_cfg->timeouts.probe_after_hb_fail_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800671
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800672 if (tx_timer_change(&mac->lim.limTimers.gLimProbeAfterHBTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800673 val, 0) != TX_SUCCESS) {
674 /* Could not change HeartBeat timer. */
675 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530676 pe_err("unable to change ProbeAfterHBTimer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800677 } else {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530678 pe_debug("Probe after HB timer value is changed: %u",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800679 val);
680 }
681
682 break;
683
684 case eLIM_LEARN_DURATION_TIMER:
685 break;
686
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800687 case eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
688 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800689 (&mac->lim.limTimers.gLimActiveToPassiveChannelTimer) !=
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800690 TX_SUCCESS) {
691 /**
692 ** Could not deactivate Active to passive channel timer.
693 ** Log error.
694 **/
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530695 pe_err("Unable to Deactivate Active to passive channel timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800696 return;
697 }
698 val = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT;
699 val = SYS_MS_TO_TICKS(val);
700 if (tx_timer_change
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800701 (&mac->lim.limTimers.gLimActiveToPassiveChannelTimer, val,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800702 0) != TX_SUCCESS) {
703 /**
704 * Could not change timer to check scan type for passive channel.
705 * timer. Log error.
706 */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530707 pe_err("Unable to change timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800708 return;
709 }
710 break;
711
712 case eLIM_DISASSOC_ACK_TIMER:
713 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800714 (&mac->lim.limTimers.gLimDisassocAckTimer) != TX_SUCCESS) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800715 /**
716 ** Could not deactivate Join Failure
717 ** timer. Log error.
718 **/
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530719 pe_err("Unable to deactivate Disassoc ack timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800720 return;
721 }
722 val = 1000;
723 val = SYS_MS_TO_TICKS(val);
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800724 if (tx_timer_change(&mac->lim.limTimers.gLimDisassocAckTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800725 val, 0) != TX_SUCCESS) {
726 /**
727 * Could not change Join Failure
728 * timer. Log error.
729 */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530730 pe_err("Unable to change timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800731 return;
732 }
733 break;
734
735 case eLIM_DEAUTH_ACK_TIMER:
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800736 if (tx_timer_deactivate(&mac->lim.limTimers.gLimDeauthAckTimer)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800737 != TX_SUCCESS) {
738 /**
739 ** Could not deactivate Join Failure
740 ** timer. Log error.
741 **/
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530742 pe_err("Unable to deactivate Deauth ack timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800743 return;
744 }
745 val = 1000;
746 val = SYS_MS_TO_TICKS(val);
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800747 if (tx_timer_change(&mac->lim.limTimers.gLimDeauthAckTimer,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800748 val, 0) != TX_SUCCESS) {
749 /**
750 * Could not change Join Failure
751 * timer. Log error.
752 */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530753 pe_err("Unable to change timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800754 return;
755 }
756 break;
757
Padma, Santhosh Kumarc56735f2017-09-13 18:14:26 +0530758 case eLIM_AUTH_SAE_TIMER:
759 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800760 (&mac->lim.limTimers.sae_auth_timer)
Padma, Santhosh Kumarc56735f2017-09-13 18:14:26 +0530761 != TX_SUCCESS)
762 pe_err("Unable to deactivate SAE auth timer");
763
764 /* Change timer to reactivate it in future */
765 val = SYS_MS_TO_TICKS(LIM_AUTH_SAE_TIMER_MS);
766
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800767 if (tx_timer_change(&mac->lim.limTimers.sae_auth_timer,
Padma, Santhosh Kumarc56735f2017-09-13 18:14:26 +0530768 val, 0) != TX_SUCCESS)
769 pe_err("unable to change SAE auth timer");
770
771 break;
772
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800773 default:
774 /* Invalid timerId. Log error */
775 break;
776 }
777} /****** end lim_deactivate_and_change_timer() ******/
778
779/**
780 * lim_deactivate_and_change_per_sta_id_timer()
781 *
782 *
783 * @brief: This function is called to deactivate and change a per STA timer
784 * for future re-activation
785 *
786 ***LOGIC:
787 *
788 ***ASSUMPTIONS:
789 * NA
790 *
791 * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index.
792 *
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800793 * @param mac - Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800794 * @param timerId - enum of timer to be deactivated and changed
795 * This enum is defined in lim_utils.h file
796 * @param staId - staId
797 *
798 * @return None
799 */
800
801void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800802lim_deactivate_and_change_per_sta_id_timer(struct mac_context *mac, uint32_t timerId,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800803 uint16_t staId)
804{
805 uint32_t val;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800806
807 switch (timerId) {
808 case eLIM_CNF_WAIT_TIMER:
809
810 if (tx_timer_deactivate
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800811 (&mac->lim.limTimers.gpLimCnfWaitTimer[staId])
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800812 != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530813 pe_err("unable to deactivate CNF wait timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800814 }
815 /* Change timer to reactivate it in future */
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800816 val = mac->mlme_cfg->sta.wait_cnf_timeout;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800817 val = SYS_MS_TO_TICKS(val);
818
819 if (tx_timer_change
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800820 (&mac->lim.limTimers.gpLimCnfWaitTimer[staId], val,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800821 val) != TX_SUCCESS) {
822 /* Could not change cnf timer. */
823 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530824 pe_err("unable to change cnf wait timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800825 }
826
827 break;
828
829 case eLIM_AUTH_RSP_TIMER:
830 {
831 tLimPreAuthNode *pAuthNode;
832
833 pAuthNode =
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800834 lim_get_pre_auth_node_from_index(mac,
835 &mac->lim.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800836 gLimPreAuthTimerTable,
837 staId);
838
839 if (pAuthNode == NULL) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530840 pe_err("Invalid Pre Auth Index passed :%d",
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800841 staId);
842 break;
843 }
844
845 if (tx_timer_deactivate(&pAuthNode->timer) !=
846 TX_SUCCESS) {
847 /* Could not deactivate auth response timer. */
848 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530849 pe_err("unable to deactivate auth response timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800850 }
851 /* Change timer to reactivate it in future */
Arif Hussain43e09712018-09-18 19:31:57 -0700852 val = SYS_MS_TO_TICKS(
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800853 mac->mlme_cfg->timeouts.auth_rsp_timeout);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800854
855 if (tx_timer_change(&pAuthNode->timer, val, 0) !=
856 TX_SUCCESS) {
857 /* Could not change auth rsp timer. */
858 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530859 pe_err("unable to change auth rsp timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800860 }
861 }
862 break;
863
864 default:
865 /* Invalid timerId. Log error */
866 break;
867
868 }
869}
870
871/**
872 * lim_activate_cnf_timer()
873 *
874 ***FUNCTION:
875 * This function is called to activate a per STA timer
876 *
877 ***LOGIC:
878 *
879 ***ASSUMPTIONS:
880 * NA
881 *
882 ***NOTE:
883 * NA
884 *
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800885 * @param mac - Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800886 * @param StaId - staId
887 *
888 * @return None
889 */
890
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800891void lim_activate_cnf_timer(struct mac_context *mac, uint16_t staId,
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800892 struct pe_session *pe_session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800893{
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800894 mac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId =
Jeff Johnsonb5c13332018-12-03 09:54:51 -0800895 pe_session->peSessionId;
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800896 if (tx_timer_activate(&mac->lim.limTimers.gpLimCnfWaitTimer[staId])
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800897 != TX_SUCCESS) {
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530898 pe_err("could not activate cnf wait timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800899 }
900}
901
902/**
903 * lim_activate_auth_rsp_timer()
904 *
905 ***FUNCTION:
906 * This function is called to activate a per STA timer
907 *
908 ***LOGIC:
909 *
910 ***ASSUMPTIONS:
911 * NA
912 *
913 ***NOTE:
914 * NA
915 *
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800916 * @param mac - Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800917 * @param id - id
918 *
919 * @return None
920 */
921
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800922void lim_activate_auth_rsp_timer(struct mac_context *mac, tLimPreAuthNode *pAuthNode)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800923{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800924 if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS) {
925 /* / Could not activate auth rsp timer. */
926 /* Log error */
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530927 pe_err("could not activate auth rsp timer");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800928 }
929}
930
931/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800932 * limAssocCnfWaitTmerHandler()
933 *
934 ***FUNCTION:
935 * This function post a message to send a disassociate frame out.
936 *
937 ***LOGIC:
938 *
939 ***ASSUMPTIONS:
940 *
941 ***NOTE:
942 * NA
943 *
944 * @param
945 *
946 * @return None
947 */
948
949void lim_cnf_wait_tmer_handler(void *pMacGlobal, uint32_t param)
950{
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700951 struct scheduler_msg msg = {0};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800952 uint32_t statusCode;
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800953 struct mac_context *mac = (struct mac_context *) pMacGlobal;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800954
955 msg.type = SIR_LIM_CNF_WAIT_TIMEOUT;
956 msg.bodyval = (uint32_t) param;
957 msg.bodyptr = NULL;
958
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800959 statusCode = lim_post_msg_api(mac, &msg);
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700960 if (statusCode != QDF_STATUS_SUCCESS)
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530961 pe_err("posting to LIM failed, reason: %d", statusCode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800962
963}
964
965void lim_channel_switch_timer_handler(void *pMacGlobal, uint32_t param)
966{
Rajeev Kumarcf7bd802017-04-18 11:11:42 -0700967 struct scheduler_msg msg = {0};
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800968 struct mac_context *mac = (struct mac_context *) pMacGlobal;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800969
Nishank Aggarwalf0e344b2017-03-23 16:39:13 +0530970 pe_debug("ChannelSwitch Timer expired. Posting msg to LIM");
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800971
972 msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT;
973 msg.bodyval = (uint32_t) param;
974 msg.bodyptr = NULL;
975
Jeff Johnson1e5de5a2018-11-22 15:37:32 -0800976 lim_post_msg_api(mac, &msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800977}