Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * 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 | /* |
| 29 | * This file lim_timer_utils.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 "lim_types.h" |
| 39 | #include "lim_utils.h" |
| 40 | #include "lim_assoc_utils.h" |
| 41 | #include "lim_security_utils.h" |
| 42 | |
| 43 | /* channel Switch Timer in ticks */ |
| 44 | #define LIM_CHANNEL_SWITCH_TIMER_TICKS 1 |
| 45 | /* Lim Quite timer in ticks */ |
| 46 | #define LIM_QUIET_TIMER_TICKS 100 |
| 47 | /* Lim Quite BSS timer interval in ticks */ |
| 48 | #define LIM_QUIET_BSS_TIMER_TICK 100 |
| 49 | /* Lim KeepAlive timer default (3000)ms */ |
| 50 | #define LIM_KEEPALIVE_TIMER_MS 3000 |
| 51 | /* Lim JoinProbeRequest Retry timer default (200)ms */ |
| 52 | #define LIM_JOIN_PROBE_REQ_TIMER_MS 200 |
| 53 | |
| 54 | /* This timer is a periodic timer which expires at every 1 sec to |
| 55 | convert ACTIVE DFS channel to DFS channels */ |
| 56 | #define ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT 1000 |
| 57 | |
| 58 | static bool |
| 59 | lim_create_non_ap_timers(tpAniSirGlobal pMac) |
| 60 | { |
| 61 | uint32_t cfgValue; |
| 62 | /* Create Channel Switch Timer */ |
| 63 | if (tx_timer_create(&pMac->lim.limTimers.gLimChannelSwitchTimer, |
| 64 | "CHANNEL SWITCH TIMER", |
| 65 | lim_channel_switch_timer_handler, 0, |
| 66 | LIM_CHANNEL_SWITCH_TIMER_TICKS, |
| 67 | 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 68 | lim_log(pMac, LOGP, FL("failed to create Ch Switch timer")); |
| 69 | return false; |
| 70 | } |
| 71 | /* Create Quiet Timer |
| 72 | * This is used on the STA to go and shut-off Tx/Rx "after" the |
| 73 | * specified quiteInterval |
| 74 | */ |
| 75 | if (tx_timer_create(&pMac->lim.limTimers.gLimQuietTimer, |
| 76 | "QUIET TIMER", lim_quiet_timer_handler, |
| 77 | SIR_LIM_QUIET_TIMEOUT, LIM_QUIET_TIMER_TICKS, |
| 78 | 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 79 | lim_log(pMac, LOGP, FL("failed to create Quiet Begin Timer")); |
| 80 | return false; |
| 81 | } |
| 82 | /* Create Quiet BSS Timer |
| 83 | * After the specified quiteInterval, determined by gLimQuietTimer, this |
| 84 | * timer, gLimQuietBssTimer, trigger and put the STA to sleep for the |
| 85 | * specified gLimQuietDuration |
| 86 | */ |
| 87 | if (tx_timer_create(&pMac->lim.limTimers.gLimQuietBssTimer, |
| 88 | "QUIET BSS TIMER", lim_quiet_bss_timer_handler, |
| 89 | SIR_LIM_QUIET_BSS_TIMEOUT, LIM_QUIET_BSS_TIMER_TICK, |
| 90 | 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 91 | lim_log(pMac, LOGP, FL("failed to create Quiet Bss Timer")); |
| 92 | return false; |
| 93 | } |
| 94 | |
| 95 | if (wlan_cfg_get_int(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, |
| 96 | &cfgValue) != eSIR_SUCCESS) |
| 97 | lim_log(pMac, LOGP, |
| 98 | FL("could not retrieve JoinFailureTimeout value")); |
| 99 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 100 | /* Create Join failure timer and activate it later */ |
| 101 | if (tx_timer_create(&pMac->lim.limTimers.gLimJoinFailureTimer, |
| 102 | "JOIN FAILURE TIMEOUT", |
| 103 | lim_timer_handler, SIR_LIM_JOIN_FAIL_TIMEOUT, |
| 104 | cfgValue, 0, |
| 105 | TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 106 | /* / Could not create Join failure timer. */ |
| 107 | /* Log error */ |
| 108 | lim_log(pMac, LOGP, |
| 109 | FL("could not create Join failure timer")); |
| 110 | return false; |
| 111 | } |
| 112 | /* Send unicast probe req frame every 200 ms */ |
| 113 | if (tx_timer_create(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer, |
| 114 | "Periodic Join Probe Request Timer", |
| 115 | lim_timer_handler, |
| 116 | SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT, |
| 117 | SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS), 0, |
| 118 | TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 119 | lim_log(pMac, LOGP, |
| 120 | FL("could not create Periodic Join Probe Request tmr")); |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | if (wlan_cfg_get_int(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT, |
| 125 | &cfgValue) != eSIR_SUCCESS) |
| 126 | lim_log(pMac, LOGP, |
| 127 | FL("could not retrieve AssocFailureTimeout value")); |
| 128 | |
| 129 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 130 | /* Create Association failure timer and activate it later */ |
| 131 | if (tx_timer_create(&pMac->lim.limTimers.gLimAssocFailureTimer, |
| 132 | "ASSOC FAILURE TIMEOUT", |
| 133 | lim_assoc_failure_timer_handler, LIM_ASSOC, |
| 134 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 135 | lim_log(pMac, LOGP, |
| 136 | FL("could not create Association failure timer")); |
| 137 | return false; |
| 138 | } |
| 139 | if (wlan_cfg_get_int(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT, |
| 140 | &cfgValue) != eSIR_SUCCESS) |
| 141 | lim_log(pMac, LOGP, |
| 142 | FL("could not retrieve ReassocFailureTimeout value")); |
| 143 | |
| 144 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 145 | /* Create Association failure timer and activate it later */ |
| 146 | if (tx_timer_create |
| 147 | (&pMac->lim.limTimers.gLimReassocFailureTimer, |
| 148 | "REASSOC FAILURE TIMEOUT", lim_assoc_failure_timer_handler, |
| 149 | LIM_REASSOC, cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 150 | lim_log(pMac, LOGP, |
| 151 | FL("could not create Reassociation failure timer")); |
| 152 | return false; |
| 153 | } |
| 154 | |
| 155 | if (wlan_cfg_get_int(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &cfgValue) |
| 156 | != eSIR_SUCCESS) |
| 157 | lim_log(pMac, LOGP, |
| 158 | FL("Fail to get WNI_CFG_ADDTS_RSP_TIMEOUT ")); |
| 159 | |
| 160 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 161 | |
| 162 | /* Create Addts response timer and activate it later */ |
| 163 | if (tx_timer_create(&pMac->lim.limTimers.gLimAddtsRspTimer, |
| 164 | "ADDTS RSP TIMEOUT", |
| 165 | lim_addts_response_timer_handler, |
| 166 | SIR_LIM_ADDTS_RSP_TIMEOUT, |
| 167 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 168 | lim_log(pMac, LOGP, |
| 169 | FL("could not create Addts response timer")); |
| 170 | return false; |
| 171 | } |
| 172 | |
| 173 | if (wlan_cfg_get_int(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT, |
| 174 | &cfgValue) != eSIR_SUCCESS) |
| 175 | lim_log(pMac, LOGP, |
| 176 | FL("could not retrieve AuthFailureTimeout value")); |
| 177 | |
| 178 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 179 | /* Create Auth failure timer and activate it later */ |
| 180 | if (tx_timer_create(&pMac->lim.limTimers.gLimAuthFailureTimer, |
| 181 | "AUTH FAILURE TIMEOUT", |
| 182 | lim_timer_handler, |
| 183 | SIR_LIM_AUTH_FAIL_TIMEOUT, |
| 184 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 185 | lim_log(pMac, LOGP, FL("could not create Auth failure timer")); |
| 186 | return false; |
| 187 | } |
| 188 | |
| 189 | if (wlan_cfg_get_int(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT, |
| 190 | &cfgValue) != eSIR_SUCCESS) |
| 191 | lim_log(pMac, LOGP, |
| 192 | FL("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value")); |
| 193 | |
| 194 | /* Change timer to reactivate it in future */ |
| 195 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 196 | if (tx_timer_create(&pMac->lim.limTimers.gLimProbeAfterHBTimer, |
| 197 | "Probe after Heartbeat TIMEOUT", |
| 198 | lim_timer_handler, |
| 199 | SIR_LIM_PROBE_HB_FAILURE_TIMEOUT, |
| 200 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 201 | lim_log(pMac, LOGP, FL("unable to create ProbeAfterHBTimer")); |
| 202 | return false; |
| 203 | } |
| 204 | |
| 205 | return true; |
| 206 | } |
| 207 | /** |
| 208 | * lim_create_timers() |
| 209 | * |
| 210 | * @pMac : Pointer to Global MAC structure |
| 211 | * |
| 212 | * This function is called upon receiving |
| 213 | * 1. SME_START_REQ for STA in ESS role |
| 214 | * 2. SME_START_BSS_REQ for AP role & STA in IBSS role |
| 215 | * |
| 216 | * @return : status of operation |
| 217 | */ |
| 218 | |
| 219 | uint32_t lim_create_timers(tpAniSirGlobal pMac) |
| 220 | { |
| 221 | uint32_t cfgValue, i = 0; |
| 222 | uint32_t cfgValue1; |
| 223 | |
| 224 | PELOG1(lim_log(pMac, LOG1, |
| 225 | FL("Creating Timers used by LIM module in Role %d"), |
| 226 | pMac->lim.gLimSystemRole);) |
| 227 | |
| 228 | if (wlan_cfg_get_int(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME, |
| 229 | &cfgValue) != eSIR_SUCCESS) { |
| 230 | lim_log(pMac, LOGP, |
| 231 | FL("could not retrieve MinChannelTimeout value")); |
| 232 | } |
| 233 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 234 | /* Periodic probe request timer value is half of the Min channel |
| 235 | * timer. Probe request sends periodically till min/max channel |
| 236 | * timer expires |
| 237 | */ |
| 238 | cfgValue1 = cfgValue / 2; |
| 239 | /* Create periodic probe request timer and activate them later */ |
| 240 | if (cfgValue1 >= 1 |
| 241 | && (tx_timer_create(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer, |
| 242 | "Periodic Probe Request Timer", lim_timer_handler, |
| 243 | SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT, cfgValue1, 0, |
| 244 | TX_NO_ACTIVATE) != TX_SUCCESS)) { |
| 245 | lim_log(pMac, LOGP, |
| 246 | FL("could not create periodic probe timer")); |
| 247 | goto err_timer; |
| 248 | } |
| 249 | |
| 250 | if (wlan_cfg_get_int(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME, |
| 251 | &cfgValue) != eSIR_SUCCESS) |
| 252 | lim_log(pMac, LOGP, |
| 253 | FL("could not retrieve MAXChannelTimeout value")); |
| 254 | |
| 255 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 256 | /* Limiting max numm of probe req for each channel scan */ |
| 257 | pMac->lim.maxProbe = (cfgValue / cfgValue1); |
| 258 | |
| 259 | if (pMac->lim.gLimSystemRole != eLIM_AP_ROLE) |
| 260 | if (false == lim_create_non_ap_timers(pMac)) |
| 261 | goto err_timer; |
| 262 | |
| 263 | cfgValue = SYS_MS_TO_TICKS(LIM_HASH_MISS_TIMER_MS); |
| 264 | |
| 265 | if (tx_timer_create( |
| 266 | &pMac->lim.limTimers.gLimSendDisassocFrameThresholdTimer, |
| 267 | "Disassoc throttle TIMEOUT", |
| 268 | lim_send_disassoc_frame_threshold_handler, |
| 269 | SIR_LIM_HASH_MISS_THRES_TIMEOUT, cfgValue, cfgValue, |
| 270 | TX_AUTO_ACTIVATE) != TX_SUCCESS) { |
| 271 | lim_log(pMac, LOGP, |
| 272 | FL("create Disassociate throttle timer failed")); |
| 273 | goto err_timer; |
| 274 | } |
| 275 | PELOG1(lim_log(pMac, LOG1, FL("Created Disassociate throttle timer "));) |
| 276 | |
| 277 | /* Create all CNF_WAIT Timers upfront */ |
| 278 | if (wlan_cfg_get_int(pMac, WNI_CFG_WT_CNF_TIMEOUT, &cfgValue) |
| 279 | != eSIR_SUCCESS) { |
| 280 | lim_log(pMac, LOGP, FL("could not retrieve CNF timeout value")); |
| 281 | } |
| 282 | |
| 283 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 284 | for (i = 0; i < (pMac->lim.maxStation + 1); i++) { |
| 285 | if (tx_timer_create(&pMac->lim.limTimers.gpLimCnfWaitTimer[i], |
| 286 | "CNF_MISS_TIMEOUT", |
| 287 | lim_cnf_wait_tmer_handler, |
| 288 | (uint32_t) i, cfgValue, |
| 289 | 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 290 | lim_log(pMac, LOGP, FL("Cannot create CNF wait timer")); |
| 291 | goto err_timer; |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | /* Alloc and init table for the preAuth timer list */ |
| 296 | if (wlan_cfg_get_int(pMac, WNI_CFG_MAX_NUM_PRE_AUTH, |
| 297 | &cfgValue) != eSIR_SUCCESS) |
| 298 | lim_log(pMac, LOGP, FL("could not retrieve mac preauth value")); |
| 299 | pMac->lim.gLimPreAuthTimerTable.numEntry = cfgValue; |
| 300 | pMac->lim.gLimPreAuthTimerTable.pTable = |
| 301 | cdf_mem_malloc(cfgValue * sizeof(tLimPreAuthNode)); |
| 302 | |
| 303 | if (pMac->lim.gLimPreAuthTimerTable.pTable == NULL) { |
| 304 | lim_log(pMac, LOGP, FL("AllocateMemory failed!")); |
| 305 | goto err_timer; |
| 306 | } |
| 307 | |
| 308 | lim_init_pre_auth_timer_table(pMac, &pMac->lim.gLimPreAuthTimerTable); |
| 309 | PELOG1(lim_log(pMac, LOG1, |
| 310 | FL("alloc and init table for preAuth timers"));) |
| 311 | |
| 312 | if (wlan_cfg_get_int(pMac, WNI_CFG_OLBC_DETECT_TIMEOUT, |
| 313 | &cfgValue) != eSIR_SUCCESS) |
| 314 | lim_log(pMac, LOGP, |
| 315 | FL("could not retrieve OLBD detect timeout value")); |
| 316 | |
| 317 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 318 | if (tx_timer_create(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer, |
| 319 | "OLBC UPDATE CACHE TIMEOUT", |
| 320 | lim_update_olbc_cache_timer_handler, |
| 321 | SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT, cfgValue, |
| 322 | cfgValue, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 323 | lim_log(pMac, LOGP, FL("Cannot create update OLBC cache tmr")); |
| 324 | goto err_timer; |
| 325 | } |
| 326 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 327 | /* In future we need to use the auth timer, cause the pre auth session |
| 328 | * will be introduced before sending Auth frame. We need to go off |
| 329 | * channel and come back to home channel |
| 330 | */ |
| 331 | cfgValue = 1000; |
| 332 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 333 | if (tx_timer_create(&pMac->lim.limTimers.gLimFTPreAuthRspTimer, |
| 334 | "FT PREAUTH RSP TIMEOUT", |
| 335 | lim_timer_handler, SIR_LIM_FT_PREAUTH_RSP_TIMEOUT, |
| 336 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 337 | lim_log(pMac, LOGP, FL("could not create Join failure timer")); |
| 338 | goto err_timer; |
| 339 | } |
| 340 | #endif |
| 341 | cfgValue = 1000; |
| 342 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 343 | if (tx_timer_create(&pMac->lim.limTimers.gLimRemainOnChannelTimer, |
| 344 | "FT PREAUTH RSP TIMEOUT", |
| 345 | lim_timer_handler, SIR_LIM_REMAIN_CHN_TIMEOUT, |
| 346 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 347 | lim_log(pMac, LOGP, FL("could not create Join failure timer")); |
| 348 | goto err_timer; |
| 349 | } |
| 350 | |
| 351 | cfgValue = 1000; |
| 352 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 353 | if (tx_timer_create(&pMac->lim.limTimers.gLimDisassocAckTimer, |
| 354 | "DISASSOC ACK TIMEOUT", |
| 355 | lim_timer_handler, SIR_LIM_DISASSOC_ACK_TIMEOUT, |
| 356 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 357 | lim_log(pMac, LOGP, FL("could not DISASSOC ACK TIMEOUT timer")); |
| 358 | goto err_timer; |
| 359 | } |
| 360 | |
| 361 | cfgValue = 1000; |
| 362 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 363 | if (tx_timer_create(&pMac->lim.limTimers.gLimDeauthAckTimer, |
| 364 | "DISASSOC ACK TIMEOUT", |
| 365 | lim_timer_handler, SIR_LIM_DEAUTH_ACK_TIMEOUT, |
| 366 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 367 | lim_log(pMac, LOGP, |
| 368 | FL("could not create DEAUTH ACK TIMEOUT timer")); |
| 369 | goto err_timer; |
| 370 | } |
| 371 | |
| 372 | /* (> no of BI* no of TUs per BI * 1TU in msec + |
| 373 | * p2p start time offset*1 TU in msec = 2*100*1.024 + 5*1.024 |
| 374 | * = 204.8 + 5.12 = 209.20) |
| 375 | */ |
| 376 | cfgValue = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE; |
| 377 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 378 | if (tx_timer_create( |
| 379 | &pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer, |
| 380 | "Single Shot NOA Insert timeout", lim_timer_handler, |
| 381 | SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT, cfgValue, 0, |
| 382 | TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 383 | lim_log(pMac, LOGP, |
| 384 | FL("Can't create Single Shot NOA Insert Timeout tmr")); |
| 385 | goto err_timer; |
| 386 | } |
| 387 | |
| 388 | cfgValue = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT; |
| 389 | cfgValue = SYS_MS_TO_TICKS(cfgValue); |
| 390 | if (tx_timer_create( |
| 391 | &pMac->lim.limTimers.gLimActiveToPassiveChannelTimer, |
| 392 | "ACTIVE TO PASSIVE CHANNEL", lim_timer_handler, |
| 393 | SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE, cfgValue, 0, |
| 394 | TX_NO_ACTIVATE) != TX_SUCCESS) { |
| 395 | lim_log(pMac, LOGW, |
| 396 | FL("could not create timer for passive channel to active channel")); |
| 397 | goto err_timer; |
| 398 | } |
| 399 | |
| 400 | return TX_SUCCESS; |
| 401 | |
| 402 | err_timer: |
| 403 | tx_timer_delete(&pMac->lim.limTimers.gLimDeauthAckTimer); |
| 404 | tx_timer_delete(&pMac->lim.limTimers.gLimDisassocAckTimer); |
| 405 | tx_timer_delete(&pMac->lim.limTimers.gLimRemainOnChannelTimer); |
| 406 | tx_timer_delete(&pMac->lim.limTimers.gLimFTPreAuthRspTimer); |
| 407 | tx_timer_delete(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer); |
| 408 | while (((int32_t)-- i) >= 0) { |
| 409 | tx_timer_delete(&pMac->lim.limTimers.gpLimCnfWaitTimer[i]); |
| 410 | } |
| 411 | tx_timer_delete(&pMac->lim.limTimers. |
| 412 | gLimSendDisassocFrameThresholdTimer); |
| 413 | tx_timer_delete(&pMac->lim.limTimers.gLimProbeAfterHBTimer); |
| 414 | tx_timer_delete(&pMac->lim.limTimers.gLimAuthFailureTimer); |
| 415 | tx_timer_delete(&pMac->lim.limTimers.gLimAddtsRspTimer); |
| 416 | tx_timer_delete(&pMac->lim.limTimers.gLimReassocFailureTimer); |
| 417 | tx_timer_delete(&pMac->lim.limTimers.gLimAssocFailureTimer); |
| 418 | tx_timer_delete(&pMac->lim.limTimers.gLimJoinFailureTimer); |
| 419 | tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer); |
| 420 | tx_timer_delete(&pMac->lim.limTimers.gLimQuietBssTimer); |
| 421 | tx_timer_delete(&pMac->lim.limTimers.gLimQuietTimer); |
| 422 | tx_timer_delete(&pMac->lim.limTimers.gLimChannelSwitchTimer); |
| 423 | tx_timer_delete(&pMac->lim.limTimers.gLimPeriodicProbeReqTimer); |
| 424 | tx_timer_delete(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer); |
| 425 | tx_timer_delete(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer); |
| 426 | |
| 427 | if (NULL != pMac->lim.gLimPreAuthTimerTable.pTable) { |
| 428 | cdf_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable); |
| 429 | pMac->lim.gLimPreAuthTimerTable.pTable = NULL; |
| 430 | } |
| 431 | return TX_TIMER_ERROR; |
| 432 | } /****** end lim_create_timers() ******/ |
| 433 | |
| 434 | /** |
| 435 | * lim_timer_handler() |
| 436 | * |
| 437 | ***FUNCTION: |
| 438 | * This function is called upon |
| 439 | * 1. MIN_CHANNEL, MAX_CHANNEL timer expiration during scanning |
| 440 | * 2. JOIN_FAILURE timer expiration while joining a BSS |
| 441 | * 3. AUTH_FAILURE timer expiration while authenticating with a peer |
| 442 | * 4. Heartbeat timer expiration on STA |
| 443 | * 5. Background scan timer expiration on STA |
| 444 | * 6. AID release, Pre-auth cleanup and Link monitoring timer |
| 445 | * expiration on AP |
| 446 | * |
| 447 | ***LOGIC: |
| 448 | * |
| 449 | ***ASSUMPTIONS: |
| 450 | * NA |
| 451 | * |
| 452 | ***NOTE: |
| 453 | * NA |
| 454 | * |
| 455 | * @param param - Message corresponding to the timer that expired |
| 456 | * |
| 457 | * @return None |
| 458 | */ |
| 459 | |
| 460 | void lim_timer_handler(void *pMacGlobal, uint32_t param) |
| 461 | { |
| 462 | uint32_t statusCode; |
| 463 | tSirMsgQ msg; |
| 464 | tpAniSirGlobal pMac = (tpAniSirGlobal) pMacGlobal; |
| 465 | |
| 466 | /* Prepare and post message to LIM Message Queue */ |
| 467 | |
| 468 | msg.type = (uint16_t) param; |
| 469 | msg.bodyptr = NULL; |
| 470 | msg.bodyval = 0; |
| 471 | |
| 472 | if ((statusCode = lim_post_msg_api(pMac, &msg)) != eSIR_SUCCESS) |
| 473 | lim_log(pMac, LOGE, |
| 474 | FL("posting message %X to LIM failed, reason=%d"), |
| 475 | msg.type, statusCode); |
| 476 | } /****** end lim_timer_handler() ******/ |
| 477 | |
| 478 | /** |
| 479 | * lim_addts_response_timer_handler() |
| 480 | * |
| 481 | ***FUNCTION: |
| 482 | * This function is called upon Addts response timer expiration on sta |
| 483 | * |
| 484 | ***LOGIC: |
| 485 | * Message SIR_LIM_ADDTS_RSP_TIMEOUT is posted to gSirLimMsgQ |
| 486 | * when this function is executed. |
| 487 | * |
| 488 | ***ASSUMPTIONS: |
| 489 | * NA |
| 490 | * |
| 491 | ***NOTE: |
| 492 | * NA |
| 493 | * |
| 494 | * @param param - pointer to pre-auth node |
| 495 | * |
| 496 | * @return None |
| 497 | */ |
| 498 | |
| 499 | void lim_addts_response_timer_handler(void *pMacGlobal, uint32_t param) |
| 500 | { |
| 501 | tSirMsgQ msg; |
| 502 | tpAniSirGlobal pMac = (tpAniSirGlobal) pMacGlobal; |
| 503 | |
| 504 | /* Prepare and post message to LIM Message Queue */ |
| 505 | |
| 506 | msg.type = SIR_LIM_ADDTS_RSP_TIMEOUT; |
| 507 | msg.bodyval = param; |
| 508 | msg.bodyptr = NULL; |
| 509 | |
| 510 | lim_post_msg_api(pMac, &msg); |
| 511 | } /****** end lim_auth_response_timer_handler() ******/ |
| 512 | |
| 513 | /** |
| 514 | * lim_auth_response_timer_handler() |
| 515 | * |
| 516 | ***FUNCTION: |
| 517 | * This function is called upon Auth response timer expiration on AP |
| 518 | * |
| 519 | ***LOGIC: |
| 520 | * Message SIR_LIM_AUTH_RSP_TIMEOUT is posted to gSirLimMsgQ |
| 521 | * when this function is executed. |
| 522 | * |
| 523 | ***ASSUMPTIONS: |
| 524 | * NA |
| 525 | * |
| 526 | ***NOTE: |
| 527 | * NA |
| 528 | * |
| 529 | * @param param - pointer to pre-auth node |
| 530 | * |
| 531 | * @return None |
| 532 | */ |
| 533 | |
| 534 | void lim_auth_response_timer_handler(void *pMacGlobal, uint32_t param) |
| 535 | { |
| 536 | tSirMsgQ msg; |
| 537 | tpAniSirGlobal pMac = (tpAniSirGlobal) pMacGlobal; |
| 538 | |
| 539 | /* Prepare and post message to LIM Message Queue */ |
| 540 | |
| 541 | msg.type = SIR_LIM_AUTH_RSP_TIMEOUT; |
| 542 | msg.bodyptr = NULL; |
| 543 | msg.bodyval = (uint32_t) param; |
| 544 | |
| 545 | lim_post_msg_api(pMac, &msg); |
| 546 | } /****** end lim_auth_response_timer_handler() ******/ |
| 547 | |
| 548 | /** |
| 549 | * lim_assoc_failure_timer_handler() |
| 550 | * |
| 551 | * @mac_global : Pointer to Global MAC structure |
| 552 | * @param : Indicates whether this is assoc or reassoc failure timeout |
| 553 | * |
| 554 | * This function is called upon Re/Assoc failure timer expiration on STA. |
| 555 | * Message SIR_LIM_ASSOC_FAIL_TIMEOUT is posted to gSirLimMsgQ when this |
| 556 | * function is executed. |
| 557 | * |
| 558 | * Return void |
| 559 | */ |
| 560 | void lim_assoc_failure_timer_handler(void *mac_global, uint32_t param) |
| 561 | { |
| 562 | tSirMsgQ msg; |
| 563 | tpAniSirGlobal mac_ctx = (tpAniSirGlobal) mac_global; |
| 564 | tpPESession session = NULL; |
| 565 | |
| 566 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
| 567 | session = mac_ctx->lim.pSessionEntry; |
| 568 | if (LIM_REASSOC == param && NULL != session |
| 569 | && session->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE) { |
| 570 | lim_log(mac_ctx, LOGE, FL("Reassoc timeout happened")); |
| 571 | if (mac_ctx->lim.reAssocRetryAttempt < |
| 572 | LIM_MAX_REASSOC_RETRY_LIMIT) { |
| 573 | lim_send_retry_reassoc_req_frame(mac_ctx, |
| 574 | session->pLimMlmReassocRetryReq, session); |
| 575 | mac_ctx->lim.reAssocRetryAttempt++; |
| 576 | lim_log(mac_ctx, LOGW, |
| 577 | FL("Reassoc request retry is sent %d times"), |
| 578 | mac_ctx->lim.reAssocRetryAttempt); |
| 579 | return; |
| 580 | } else { |
| 581 | lim_log(mac_ctx, LOGW, |
| 582 | FL("Reassoc request retry MAX(%d) reached"), |
| 583 | LIM_MAX_REASSOC_RETRY_LIMIT); |
| 584 | if (NULL != session->pLimMlmReassocRetryReq) { |
| 585 | cdf_mem_free(session->pLimMlmReassocRetryReq); |
| 586 | session->pLimMlmReassocRetryReq = NULL; |
| 587 | } |
| 588 | } |
| 589 | } |
| 590 | #endif |
| 591 | /* Prepare and post message to LIM Message Queue */ |
| 592 | msg.type = SIR_LIM_ASSOC_FAIL_TIMEOUT; |
| 593 | msg.bodyval = (uint32_t) param; |
| 594 | msg.bodyptr = NULL; |
| 595 | lim_post_msg_api(mac_ctx, &msg); |
| 596 | } /****** end lim_assoc_failure_timer_handler() ******/ |
| 597 | |
| 598 | /** |
| 599 | * lim_update_olbc_cache_timer_handler() |
| 600 | * |
| 601 | ***FUNCTION: |
| 602 | * This function is called upon update olbc cache timer expiration |
| 603 | * on STA |
| 604 | * |
| 605 | ***LOGIC: |
| 606 | * Message SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT is posted to gSirLimMsgQ |
| 607 | * when this function is executed. |
| 608 | * |
| 609 | ***ASSUMPTIONS: |
| 610 | * NA |
| 611 | * |
| 612 | ***NOTE: |
| 613 | * NA |
| 614 | * |
| 615 | * @param |
| 616 | * |
| 617 | * @return None |
| 618 | */ |
| 619 | void lim_update_olbc_cache_timer_handler(void *pMacGlobal, uint32_t param) |
| 620 | { |
| 621 | tSirMsgQ msg; |
| 622 | tpAniSirGlobal pMac = (tpAniSirGlobal) pMacGlobal; |
| 623 | |
| 624 | /* Prepare and post message to LIM Message Queue */ |
| 625 | |
| 626 | msg.type = SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT; |
| 627 | msg.bodyval = 0; |
| 628 | msg.bodyptr = NULL; |
| 629 | |
| 630 | lim_post_msg_api(pMac, &msg); |
| 631 | } /****** end lim_update_olbc_cache_timer_handler() ******/ |
| 632 | |
| 633 | /** |
| 634 | * lim_deactivate_and_change_timer() |
| 635 | * |
| 636 | ***FUNCTION: |
| 637 | * This function is called to deactivate and change a timer |
| 638 | * for future re-activation |
| 639 | * |
| 640 | ***LOGIC: |
| 641 | * |
| 642 | ***ASSUMPTIONS: |
| 643 | * NA |
| 644 | * |
| 645 | ***NOTE: |
| 646 | * NA |
| 647 | * |
| 648 | * @param pMac - Pointer to Global MAC structure |
| 649 | * @param timerId - enum of timer to be deactivated and changed |
| 650 | * This enum is defined in lim_utils.h file |
| 651 | * |
| 652 | * @return None |
| 653 | */ |
| 654 | |
| 655 | void lim_deactivate_and_change_timer(tpAniSirGlobal pMac, uint32_t timerId) |
| 656 | { |
| 657 | uint32_t val = 0; |
| 658 | |
| 659 | MTRACE(mac_trace |
| 660 | (pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId)); |
| 661 | |
| 662 | switch (timerId) { |
| 663 | case eLIM_ADDTS_RSP_TIMER: |
| 664 | pMac->lim.gLimAddtsRspTimerCount++; |
| 665 | if (tx_timer_deactivate(&pMac->lim.limTimers.gLimAddtsRspTimer) |
| 666 | != TX_SUCCESS) { |
| 667 | /* Could not deactivate AddtsRsp Timer */ |
| 668 | /* Log error */ |
| 669 | lim_log(pMac, LOGP, |
| 670 | FL("Unable to deactivate AddtsRsp timer")); |
| 671 | } |
| 672 | break; |
| 673 | |
| 674 | case eLIM_PERIODIC_PROBE_REQ_TIMER: |
| 675 | if (tx_timer_deactivate |
| 676 | (&pMac->lim.limTimers.gLimPeriodicProbeReqTimer) |
| 677 | != TX_SUCCESS) { |
| 678 | /* Could not deactivate min channel timer. */ |
| 679 | /* Log error */ |
| 680 | lim_log(pMac, LOGP, |
| 681 | FL("Unable to deactivate periodic timer")); |
| 682 | } |
| 683 | |
| 684 | val = |
| 685 | SYS_MS_TO_TICKS(pMac->lim.gpLimMlmScanReq->minChannelTime) / |
| 686 | 2; |
| 687 | if (tx_timer_change |
| 688 | (&pMac->lim.limTimers.gLimPeriodicProbeReqTimer, val, |
| 689 | 0) != TX_SUCCESS) { |
| 690 | /* Could not change min channel timer. */ |
| 691 | /* Log error */ |
| 692 | lim_log(pMac, LOGP, |
| 693 | FL("Unable to change periodic timer")); |
| 694 | } |
| 695 | |
| 696 | break; |
| 697 | |
| 698 | case eLIM_JOIN_FAIL_TIMER: |
| 699 | if (tx_timer_deactivate |
| 700 | (&pMac->lim.limTimers.gLimJoinFailureTimer) |
| 701 | != TX_SUCCESS) { |
| 702 | /** |
| 703 | * Could not deactivate Join Failure |
| 704 | * timer. Log error. |
| 705 | */ |
| 706 | lim_log(pMac, LOGP, |
| 707 | FL("Unable to deactivate Join Failure timer")); |
| 708 | } |
| 709 | |
| 710 | if (wlan_cfg_get_int(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, |
| 711 | &val) != eSIR_SUCCESS) { |
| 712 | /** |
| 713 | * Could not get JoinFailureTimeout value |
| 714 | * from CFG. Log error. |
| 715 | */ |
| 716 | lim_log(pMac, LOGP, |
| 717 | FL |
| 718 | ("could not retrieve JoinFailureTimeout value")); |
| 719 | } |
| 720 | val = SYS_MS_TO_TICKS(val); |
| 721 | |
| 722 | if (tx_timer_change(&pMac->lim.limTimers.gLimJoinFailureTimer, |
| 723 | val, 0) != TX_SUCCESS) { |
| 724 | /** |
| 725 | * Could not change Join Failure |
| 726 | * timer. Log error. |
| 727 | */ |
| 728 | lim_log(pMac, LOGP, |
| 729 | FL("Unable to change Join Failure timer")); |
| 730 | } |
| 731 | |
| 732 | break; |
| 733 | |
| 734 | case eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER: |
| 735 | if (tx_timer_deactivate |
| 736 | (&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) |
| 737 | != TX_SUCCESS) { |
| 738 | /* Could not deactivate periodic join req Times. */ |
| 739 | lim_log(pMac, LOGP, |
| 740 | FL |
| 741 | ("Unable to deactivate periodic join request timer")); |
| 742 | } |
| 743 | |
| 744 | val = SYS_MS_TO_TICKS(LIM_JOIN_PROBE_REQ_TIMER_MS); |
| 745 | if (tx_timer_change |
| 746 | (&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer, val, |
| 747 | 0) != TX_SUCCESS) { |
| 748 | /* Could not change periodic join req times. */ |
| 749 | /* Log error */ |
| 750 | lim_log(pMac, LOGP, |
| 751 | FL |
| 752 | ("Unable to change periodic join request timer")); |
| 753 | } |
| 754 | |
| 755 | break; |
| 756 | |
| 757 | case eLIM_AUTH_FAIL_TIMER: |
| 758 | if (tx_timer_deactivate |
| 759 | (&pMac->lim.limTimers.gLimAuthFailureTimer) |
| 760 | != TX_SUCCESS) { |
| 761 | /* Could not deactivate Auth failure timer. */ |
| 762 | /* Log error */ |
| 763 | lim_log(pMac, LOGP, |
| 764 | FL("Unable to deactivate auth failure timer")); |
| 765 | } |
| 766 | /* Change timer to reactivate it in future */ |
| 767 | if (wlan_cfg_get_int(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT, |
| 768 | &val) != eSIR_SUCCESS) { |
| 769 | /** |
| 770 | * Could not get AuthFailureTimeout value |
| 771 | * from CFG. Log error. |
| 772 | */ |
| 773 | lim_log(pMac, LOGP, |
| 774 | FL |
| 775 | ("could not retrieve AuthFailureTimeout value")); |
| 776 | } |
| 777 | val = SYS_MS_TO_TICKS(val); |
| 778 | |
| 779 | if (tx_timer_change(&pMac->lim.limTimers.gLimAuthFailureTimer, |
| 780 | val, 0) != TX_SUCCESS) { |
| 781 | /* Could not change Authentication failure timer. */ |
| 782 | /* Log error */ |
| 783 | lim_log(pMac, LOGP, |
| 784 | FL("unable to change Auth failure timer")); |
| 785 | } |
| 786 | |
| 787 | break; |
| 788 | |
| 789 | case eLIM_ASSOC_FAIL_TIMER: |
| 790 | if (tx_timer_deactivate |
| 791 | (&pMac->lim.limTimers.gLimAssocFailureTimer) != |
| 792 | TX_SUCCESS) { |
| 793 | /* Could not deactivate Association failure timer. */ |
| 794 | /* Log error */ |
| 795 | lim_log(pMac, LOGP, |
| 796 | FL |
| 797 | ("unable to deactivate Association failure timer")); |
| 798 | } |
| 799 | /* Change timer to reactivate it in future */ |
| 800 | if (wlan_cfg_get_int(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT, |
| 801 | &val) != eSIR_SUCCESS) { |
| 802 | /** |
| 803 | * Could not get AssocFailureTimeout value |
| 804 | * from CFG. Log error. |
| 805 | */ |
| 806 | lim_log(pMac, LOGP, |
| 807 | FL |
| 808 | ("could not retrieve AssocFailureTimeout value")); |
| 809 | } |
| 810 | val = SYS_MS_TO_TICKS(val); |
| 811 | |
| 812 | if (tx_timer_change(&pMac->lim.limTimers.gLimAssocFailureTimer, |
| 813 | val, 0) != TX_SUCCESS) { |
| 814 | /* Could not change Association failure timer. */ |
| 815 | /* Log error */ |
| 816 | lim_log(pMac, LOGP, |
| 817 | FL("unable to change Assoc failure timer")); |
| 818 | } |
| 819 | |
| 820 | break; |
| 821 | |
| 822 | case eLIM_REASSOC_FAIL_TIMER: |
| 823 | if (tx_timer_deactivate |
| 824 | (&pMac->lim.limTimers.gLimReassocFailureTimer) != |
| 825 | TX_SUCCESS) { |
| 826 | /* Could not deactivate Reassociation failure timer. */ |
| 827 | /* Log error */ |
| 828 | lim_log(pMac, LOGP, |
| 829 | FL |
| 830 | ("unable to deactivate Reassoc failure timer")); |
| 831 | } |
| 832 | /* Change timer to reactivate it in future */ |
| 833 | if (wlan_cfg_get_int(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT, |
| 834 | &val) != eSIR_SUCCESS) { |
| 835 | /** |
| 836 | * Could not get ReassocFailureTimeout value |
| 837 | * from CFG. Log error. |
| 838 | */ |
| 839 | lim_log(pMac, LOGP, |
| 840 | FL |
| 841 | ("could not retrieve ReassocFailureTimeout value")); |
| 842 | } |
| 843 | val = SYS_MS_TO_TICKS(val); |
| 844 | |
| 845 | if (tx_timer_change |
| 846 | (&pMac->lim.limTimers.gLimReassocFailureTimer, val, |
| 847 | 0) != TX_SUCCESS) { |
| 848 | /* Could not change Reassociation failure timer. */ |
| 849 | /* Log error */ |
| 850 | lim_log(pMac, LOGP, |
| 851 | FL |
| 852 | ("unable to change Reassociation failure timer")); |
| 853 | } |
| 854 | |
| 855 | break; |
| 856 | |
| 857 | case eLIM_PROBE_AFTER_HB_TIMER: |
| 858 | if (tx_timer_deactivate |
| 859 | (&pMac->lim.limTimers.gLimProbeAfterHBTimer) != |
| 860 | TX_SUCCESS) { |
| 861 | /* Could not deactivate Heartbeat timer. */ |
| 862 | /* Log error */ |
| 863 | lim_log(pMac, LOGP, |
| 864 | FL("unable to deactivate probeAfterHBTimer")); |
| 865 | } else { |
| 866 | lim_log(pMac, LOG1, |
| 867 | FL("Deactivated probe after hb timer")); |
| 868 | } |
| 869 | |
| 870 | if (wlan_cfg_get_int(pMac, WNI_CFG_PROBE_AFTER_HB_FAIL_TIMEOUT, |
| 871 | &val) != eSIR_SUCCESS) { |
| 872 | /** |
| 873 | * Could not get PROBE_AFTER_HB_FAILURE |
| 874 | * value from CFG. Log error. |
| 875 | */ |
| 876 | lim_log(pMac, LOGP, |
| 877 | FL |
| 878 | ("could not retrieve PROBE_AFTER_HB_FAIL_TIMEOUT value")); |
| 879 | } |
| 880 | /* Change timer to reactivate it in future */ |
| 881 | val = SYS_MS_TO_TICKS(val); |
| 882 | |
| 883 | if (tx_timer_change(&pMac->lim.limTimers.gLimProbeAfterHBTimer, |
| 884 | val, 0) != TX_SUCCESS) { |
| 885 | /* Could not change HeartBeat timer. */ |
| 886 | /* Log error */ |
| 887 | lim_log(pMac, LOGP, |
| 888 | FL("unable to change ProbeAfterHBTimer")); |
| 889 | } else { |
| 890 | lim_log(pMac, LOGW, |
| 891 | FL("Probe after HB timer value is changed = %u"), |
| 892 | val); |
| 893 | } |
| 894 | |
| 895 | break; |
| 896 | |
| 897 | case eLIM_LEARN_DURATION_TIMER: |
| 898 | break; |
| 899 | |
| 900 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 901 | case eLIM_FT_PREAUTH_RSP_TIMER: |
| 902 | if (tx_timer_deactivate |
| 903 | (&pMac->lim.limTimers.gLimFTPreAuthRspTimer) != |
| 904 | TX_SUCCESS) { |
| 905 | /** |
| 906 | ** Could not deactivate Join Failure |
| 907 | ** timer. Log error. |
| 908 | **/ |
| 909 | lim_log(pMac, LOGP, |
| 910 | FL |
| 911 | ("Unable to deactivate Preauth response Failure timer")); |
| 912 | return; |
| 913 | } |
| 914 | val = 1000; |
| 915 | val = SYS_MS_TO_TICKS(val); |
| 916 | if (tx_timer_change(&pMac->lim.limTimers.gLimFTPreAuthRspTimer, |
| 917 | val, 0) != TX_SUCCESS) { |
| 918 | /** |
| 919 | * Could not change Join Failure |
| 920 | * timer. Log error. |
| 921 | */ |
| 922 | lim_log(pMac, LOGP, |
| 923 | FL("Unable to change Join Failure timer")); |
| 924 | return; |
| 925 | } |
| 926 | break; |
| 927 | #endif |
| 928 | case eLIM_REMAIN_CHN_TIMER: |
| 929 | if (tx_timer_deactivate |
| 930 | (&pMac->lim.limTimers.gLimRemainOnChannelTimer) != |
| 931 | TX_SUCCESS) { |
| 932 | /** |
| 933 | ** Could not deactivate Join Failure |
| 934 | ** timer. Log error. |
| 935 | **/ |
| 936 | lim_log(pMac, LOGP, |
| 937 | FL("Unable to deactivate Remain on Chn timer")); |
| 938 | return; |
| 939 | } |
| 940 | val = 1000; |
| 941 | val = SYS_MS_TO_TICKS(val); |
| 942 | if (tx_timer_change |
| 943 | (&pMac->lim.limTimers.gLimRemainOnChannelTimer, val, |
| 944 | 0) != TX_SUCCESS) { |
| 945 | /** |
| 946 | * Could not change Join Failure |
| 947 | * timer. Log error. |
| 948 | */ |
| 949 | lim_log(pMac, LOGP, FL("Unable to change timer")); |
| 950 | return; |
| 951 | } |
| 952 | break; |
| 953 | |
| 954 | case eLIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE: |
| 955 | if (tx_timer_deactivate |
| 956 | (&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer) != |
| 957 | TX_SUCCESS) { |
| 958 | /** |
| 959 | ** Could not deactivate Active to passive channel timer. |
| 960 | ** Log error. |
| 961 | **/ |
| 962 | lim_log(pMac, LOGP, FL("Unable to Deactivate " |
| 963 | "Active to passive channel timer")); |
| 964 | return; |
| 965 | } |
| 966 | val = ACTIVE_TO_PASSIVE_CONVERISON_TIMEOUT; |
| 967 | val = SYS_MS_TO_TICKS(val); |
| 968 | if (tx_timer_change |
| 969 | (&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer, val, |
| 970 | 0) != TX_SUCCESS) { |
| 971 | /** |
| 972 | * Could not change timer to check scan type for passive channel. |
| 973 | * timer. Log error. |
| 974 | */ |
| 975 | lim_log(pMac, LOGP, FL("Unable to change timer")); |
| 976 | return; |
| 977 | } |
| 978 | break; |
| 979 | |
| 980 | case eLIM_DISASSOC_ACK_TIMER: |
| 981 | if (tx_timer_deactivate |
| 982 | (&pMac->lim.limTimers.gLimDisassocAckTimer) != TX_SUCCESS) { |
| 983 | /** |
| 984 | ** Could not deactivate Join Failure |
| 985 | ** timer. Log error. |
| 986 | **/ |
| 987 | lim_log(pMac, LOGP, |
| 988 | FL("Unable to deactivate Disassoc ack timer")); |
| 989 | return; |
| 990 | } |
| 991 | val = 1000; |
| 992 | val = SYS_MS_TO_TICKS(val); |
| 993 | if (tx_timer_change(&pMac->lim.limTimers.gLimDisassocAckTimer, |
| 994 | val, 0) != TX_SUCCESS) { |
| 995 | /** |
| 996 | * Could not change Join Failure |
| 997 | * timer. Log error. |
| 998 | */ |
| 999 | lim_log(pMac, LOGP, FL("Unable to change timer")); |
| 1000 | return; |
| 1001 | } |
| 1002 | break; |
| 1003 | |
| 1004 | case eLIM_DEAUTH_ACK_TIMER: |
| 1005 | if (tx_timer_deactivate(&pMac->lim.limTimers.gLimDeauthAckTimer) |
| 1006 | != TX_SUCCESS) { |
| 1007 | /** |
| 1008 | ** Could not deactivate Join Failure |
| 1009 | ** timer. Log error. |
| 1010 | **/ |
| 1011 | lim_log(pMac, LOGP, |
| 1012 | FL("Unable to deactivate Deauth ack timer")); |
| 1013 | return; |
| 1014 | } |
| 1015 | val = 1000; |
| 1016 | val = SYS_MS_TO_TICKS(val); |
| 1017 | if (tx_timer_change(&pMac->lim.limTimers.gLimDeauthAckTimer, |
| 1018 | val, 0) != TX_SUCCESS) { |
| 1019 | /** |
| 1020 | * Could not change Join Failure |
| 1021 | * timer. Log error. |
| 1022 | */ |
| 1023 | lim_log(pMac, LOGP, FL("Unable to change timer")); |
| 1024 | return; |
| 1025 | } |
| 1026 | break; |
| 1027 | |
| 1028 | case eLIM_INSERT_SINGLESHOT_NOA_TIMER: |
| 1029 | if (tx_timer_deactivate |
| 1030 | (&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer) != |
| 1031 | TX_SUCCESS) { |
| 1032 | /** |
| 1033 | ** Could not deactivate SingleShot NOA Insert |
| 1034 | ** timer. Log error. |
| 1035 | **/ |
| 1036 | lim_log(pMac, LOGP, |
| 1037 | FL |
| 1038 | ("Unable to deactivate SingleShot NOA Insert timer")); |
| 1039 | return; |
| 1040 | } |
| 1041 | val = LIM_INSERT_SINGLESHOTNOA_TIMEOUT_VALUE; |
| 1042 | val = SYS_MS_TO_TICKS(val); |
| 1043 | if (tx_timer_change |
| 1044 | (&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer, val, |
| 1045 | 0) != TX_SUCCESS) { |
| 1046 | /** |
| 1047 | * Could not change Single Shot NOA Insert |
| 1048 | * timer. Log error. |
| 1049 | */ |
| 1050 | lim_log(pMac, LOGP, FL("Unable to change timer")); |
| 1051 | return; |
| 1052 | } |
| 1053 | break; |
| 1054 | |
| 1055 | default: |
| 1056 | /* Invalid timerId. Log error */ |
| 1057 | break; |
| 1058 | } |
| 1059 | } /****** end lim_deactivate_and_change_timer() ******/ |
| 1060 | |
| 1061 | /** |
| 1062 | * lim_deactivate_and_change_per_sta_id_timer() |
| 1063 | * |
| 1064 | * |
| 1065 | * @brief: This function is called to deactivate and change a per STA timer |
| 1066 | * for future re-activation |
| 1067 | * |
| 1068 | ***LOGIC: |
| 1069 | * |
| 1070 | ***ASSUMPTIONS: |
| 1071 | * NA |
| 1072 | * |
| 1073 | * @note staId for eLIM_AUTH_RSP_TIMER is auth Node Index. |
| 1074 | * |
| 1075 | * @param pMac - Pointer to Global MAC structure |
| 1076 | * @param timerId - enum of timer to be deactivated and changed |
| 1077 | * This enum is defined in lim_utils.h file |
| 1078 | * @param staId - staId |
| 1079 | * |
| 1080 | * @return None |
| 1081 | */ |
| 1082 | |
| 1083 | void |
| 1084 | lim_deactivate_and_change_per_sta_id_timer(tpAniSirGlobal pMac, uint32_t timerId, |
| 1085 | uint16_t staId) |
| 1086 | { |
| 1087 | uint32_t val; |
| 1088 | MTRACE(mac_trace |
| 1089 | (pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, timerId)); |
| 1090 | |
| 1091 | switch (timerId) { |
| 1092 | case eLIM_CNF_WAIT_TIMER: |
| 1093 | |
| 1094 | if (tx_timer_deactivate |
| 1095 | (&pMac->lim.limTimers.gpLimCnfWaitTimer[staId]) |
| 1096 | != TX_SUCCESS) { |
| 1097 | lim_log(pMac, LOGP, |
| 1098 | FL("unable to deactivate CNF wait timer")); |
| 1099 | |
| 1100 | } |
| 1101 | /* Change timer to reactivate it in future */ |
| 1102 | |
| 1103 | if (wlan_cfg_get_int(pMac, WNI_CFG_WT_CNF_TIMEOUT, |
| 1104 | &val) != eSIR_SUCCESS) { |
| 1105 | /** |
| 1106 | * Could not get cnf timeout value |
| 1107 | * from CFG. Log error. |
| 1108 | */ |
| 1109 | lim_log(pMac, LOGP, |
| 1110 | FL("could not retrieve cnf timeout value")); |
| 1111 | } |
| 1112 | val = SYS_MS_TO_TICKS(val); |
| 1113 | |
| 1114 | if (tx_timer_change |
| 1115 | (&pMac->lim.limTimers.gpLimCnfWaitTimer[staId], val, |
| 1116 | val) != TX_SUCCESS) { |
| 1117 | /* Could not change cnf timer. */ |
| 1118 | /* Log error */ |
| 1119 | lim_log(pMac, LOGP, |
| 1120 | FL("unable to change cnf wait timer")); |
| 1121 | } |
| 1122 | |
| 1123 | break; |
| 1124 | |
| 1125 | case eLIM_AUTH_RSP_TIMER: |
| 1126 | { |
| 1127 | tLimPreAuthNode *pAuthNode; |
| 1128 | |
| 1129 | pAuthNode = |
| 1130 | lim_get_pre_auth_node_from_index(pMac, |
| 1131 | &pMac->lim. |
| 1132 | gLimPreAuthTimerTable, |
| 1133 | staId); |
| 1134 | |
| 1135 | if (pAuthNode == NULL) { |
| 1136 | lim_log(pMac, LOGP, |
| 1137 | FL("Invalid Pre Auth Index passed :%d"), |
| 1138 | staId); |
| 1139 | break; |
| 1140 | } |
| 1141 | |
| 1142 | if (tx_timer_deactivate(&pAuthNode->timer) != |
| 1143 | TX_SUCCESS) { |
| 1144 | /* Could not deactivate auth response timer. */ |
| 1145 | /* Log error */ |
| 1146 | lim_log(pMac, LOGP, |
| 1147 | FL |
| 1148 | ("unable to deactivate auth response timer")); |
| 1149 | } |
| 1150 | /* Change timer to reactivate it in future */ |
| 1151 | |
| 1152 | if (wlan_cfg_get_int |
| 1153 | (pMac, WNI_CFG_AUTHENTICATE_RSP_TIMEOUT, |
| 1154 | &val) != eSIR_SUCCESS) { |
| 1155 | /** |
| 1156 | * Could not get auth rsp timeout value |
| 1157 | * from CFG. Log error. |
| 1158 | */ |
| 1159 | lim_log(pMac, LOGP, |
| 1160 | FL |
| 1161 | ("could not retrieve auth response timeout value")); |
| 1162 | } |
| 1163 | |
| 1164 | val = SYS_MS_TO_TICKS(val); |
| 1165 | |
| 1166 | if (tx_timer_change(&pAuthNode->timer, val, 0) != |
| 1167 | TX_SUCCESS) { |
| 1168 | /* Could not change auth rsp timer. */ |
| 1169 | /* Log error */ |
| 1170 | lim_log(pMac, LOGP, |
| 1171 | FL("unable to change auth rsp timer")); |
| 1172 | } |
| 1173 | } |
| 1174 | break; |
| 1175 | |
| 1176 | default: |
| 1177 | /* Invalid timerId. Log error */ |
| 1178 | break; |
| 1179 | |
| 1180 | } |
| 1181 | } |
| 1182 | |
| 1183 | /** |
| 1184 | * lim_activate_cnf_timer() |
| 1185 | * |
| 1186 | ***FUNCTION: |
| 1187 | * This function is called to activate a per STA timer |
| 1188 | * |
| 1189 | ***LOGIC: |
| 1190 | * |
| 1191 | ***ASSUMPTIONS: |
| 1192 | * NA |
| 1193 | * |
| 1194 | ***NOTE: |
| 1195 | * NA |
| 1196 | * |
| 1197 | * @param pMac - Pointer to Global MAC structure |
| 1198 | * @param StaId - staId |
| 1199 | * |
| 1200 | * @return None |
| 1201 | */ |
| 1202 | |
| 1203 | void lim_activate_cnf_timer(tpAniSirGlobal pMac, uint16_t staId, |
| 1204 | tpPESession psessionEntry) |
| 1205 | { |
| 1206 | MTRACE(mac_trace |
| 1207 | (pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, |
| 1208 | eLIM_CNF_WAIT_TIMER)); |
| 1209 | pMac->lim.limTimers.gpLimCnfWaitTimer[staId].sessionId = |
| 1210 | psessionEntry->peSessionId; |
| 1211 | if (tx_timer_activate(&pMac->lim.limTimers.gpLimCnfWaitTimer[staId]) |
| 1212 | != TX_SUCCESS) { |
| 1213 | lim_log(pMac, LOGP, FL("could not activate cnf wait timer")); |
| 1214 | } |
| 1215 | } |
| 1216 | |
| 1217 | /** |
| 1218 | * lim_activate_auth_rsp_timer() |
| 1219 | * |
| 1220 | ***FUNCTION: |
| 1221 | * This function is called to activate a per STA timer |
| 1222 | * |
| 1223 | ***LOGIC: |
| 1224 | * |
| 1225 | ***ASSUMPTIONS: |
| 1226 | * NA |
| 1227 | * |
| 1228 | ***NOTE: |
| 1229 | * NA |
| 1230 | * |
| 1231 | * @param pMac - Pointer to Global MAC structure |
| 1232 | * @param id - id |
| 1233 | * |
| 1234 | * @return None |
| 1235 | */ |
| 1236 | |
| 1237 | void lim_activate_auth_rsp_timer(tpAniSirGlobal pMac, tLimPreAuthNode *pAuthNode) |
| 1238 | { |
| 1239 | MTRACE(mac_trace |
| 1240 | (pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, |
| 1241 | eLIM_AUTH_RESP_TIMER)); |
| 1242 | if (tx_timer_activate(&pAuthNode->timer) != TX_SUCCESS) { |
| 1243 | /* / Could not activate auth rsp timer. */ |
| 1244 | /* Log error */ |
| 1245 | lim_log(pMac, LOGP, FL("could not activate auth rsp timer")); |
| 1246 | } |
| 1247 | } |
| 1248 | |
| 1249 | /** |
| 1250 | * lim_send_disassoc_frame_threshold_handler() |
| 1251 | * |
| 1252 | ***FUNCTION: |
| 1253 | * This function reloads the credit to the send disassociate frame bucket |
| 1254 | * |
| 1255 | ***LOGIC: |
| 1256 | * |
| 1257 | ***ASSUMPTIONS: |
| 1258 | * |
| 1259 | ***NOTE: |
| 1260 | * NA |
| 1261 | * |
| 1262 | * @param |
| 1263 | * |
| 1264 | * @return None |
| 1265 | */ |
| 1266 | |
| 1267 | void lim_send_disassoc_frame_threshold_handler(void *pMacGlobal, uint32_t param) |
| 1268 | { |
| 1269 | tSirMsgQ msg; |
| 1270 | uint32_t statusCode; |
| 1271 | tpAniSirGlobal pMac = (tpAniSirGlobal) pMacGlobal; |
| 1272 | |
| 1273 | msg.type = SIR_LIM_HASH_MISS_THRES_TIMEOUT; |
| 1274 | msg.bodyval = 0; |
| 1275 | msg.bodyptr = NULL; |
| 1276 | |
| 1277 | if ((statusCode = lim_post_msg_api(pMac, &msg)) != eSIR_SUCCESS) |
| 1278 | lim_log(pMac, LOGE, |
| 1279 | FL("posting to LIM failed, reason=%d"), statusCode); |
| 1280 | |
| 1281 | } |
| 1282 | |
| 1283 | /** |
| 1284 | * limAssocCnfWaitTmerHandler() |
| 1285 | * |
| 1286 | ***FUNCTION: |
| 1287 | * This function post a message to send a disassociate frame out. |
| 1288 | * |
| 1289 | ***LOGIC: |
| 1290 | * |
| 1291 | ***ASSUMPTIONS: |
| 1292 | * |
| 1293 | ***NOTE: |
| 1294 | * NA |
| 1295 | * |
| 1296 | * @param |
| 1297 | * |
| 1298 | * @return None |
| 1299 | */ |
| 1300 | |
| 1301 | void lim_cnf_wait_tmer_handler(void *pMacGlobal, uint32_t param) |
| 1302 | { |
| 1303 | tSirMsgQ msg; |
| 1304 | uint32_t statusCode; |
| 1305 | tpAniSirGlobal pMac = (tpAniSirGlobal) pMacGlobal; |
| 1306 | |
| 1307 | msg.type = SIR_LIM_CNF_WAIT_TIMEOUT; |
| 1308 | msg.bodyval = (uint32_t) param; |
| 1309 | msg.bodyptr = NULL; |
| 1310 | |
| 1311 | if ((statusCode = lim_post_msg_api(pMac, &msg)) != eSIR_SUCCESS) |
| 1312 | lim_log(pMac, LOGE, |
| 1313 | FL("posting to LIM failed, reason=%d"), statusCode); |
| 1314 | |
| 1315 | } |
| 1316 | |
| 1317 | void lim_channel_switch_timer_handler(void *pMacGlobal, uint32_t param) |
| 1318 | { |
| 1319 | tSirMsgQ msg; |
| 1320 | tpAniSirGlobal pMac = (tpAniSirGlobal) pMacGlobal; |
| 1321 | |
| 1322 | PELOG1(lim_log(pMac, LOG1, |
| 1323 | FL("ChannelSwitch Timer expired. Posting msg to LIM ")); |
| 1324 | ) |
| 1325 | |
| 1326 | msg.type = SIR_LIM_CHANNEL_SWITCH_TIMEOUT; |
| 1327 | msg.bodyval = (uint32_t) param; |
| 1328 | msg.bodyptr = NULL; |
| 1329 | |
| 1330 | lim_post_msg_api(pMac, &msg); |
| 1331 | } |
| 1332 | |
| 1333 | void lim_quiet_timer_handler(void *pMacGlobal, uint32_t param) |
| 1334 | { |
| 1335 | tSirMsgQ msg; |
| 1336 | tpAniSirGlobal pMac = (tpAniSirGlobal) pMacGlobal; |
| 1337 | |
| 1338 | msg.type = SIR_LIM_QUIET_TIMEOUT; |
| 1339 | msg.bodyval = (uint32_t) param; |
| 1340 | msg.bodyptr = NULL; |
| 1341 | |
| 1342 | PELOG1(lim_log(pMac, LOG1, FL("Post SIR_LIM_QUIET_TIMEOUT msg. "));) |
| 1343 | lim_post_msg_api(pMac, &msg); |
| 1344 | } |
| 1345 | |
| 1346 | void lim_quiet_bss_timer_handler(void *pMacGlobal, uint32_t param) |
| 1347 | { |
| 1348 | tSirMsgQ msg; |
| 1349 | tpAniSirGlobal pMac = (tpAniSirGlobal) pMacGlobal; |
| 1350 | |
| 1351 | msg.type = SIR_LIM_QUIET_BSS_TIMEOUT; |
| 1352 | msg.bodyval = (uint32_t) param; |
| 1353 | msg.bodyptr = NULL; |
| 1354 | PELOG1(lim_log(pMac, LOG1, FL("Post SIR_LIM_QUIET_BSS_TIMEOUT msg. "));) |
| 1355 | lim_post_msg_api(pMac, &msg); |
| 1356 | } |
| 1357 | |