From 79d116ce7e57068ec9e179353b1edea6275c5bc3 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Thu, 12 Mar 2020 16:07:34 +0530 Subject: [PATCH] qcacld-3.0: Do not start unsolicited timer back to back Currently there is no check to not start unsolicited timer if its callback is already in process. If once this timer expires and callback is invoked, and if this timer again tries to start before the callback completes there is no check to prevent this timer from starting. As the callback of the previous timer expiry is already in progress, there is no need to start the unsolicited timer again. To address this issue a check is added before starting the unsolicited timer to validate if the callback is still in progress. CRs-Fixed: 2635740 Change-Id: Ib008562be22356c3a286fab49a61f99d6867c54e --- core/hdd/inc/wlan_hdd_main.h | 1 + core/hdd/src/wlan_hdd_sar_limits.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index be9bc7419c3c..57408510eec5 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1894,6 +1894,7 @@ struct hdd_context { qdf_mc_timer_t sar_safety_timer; qdf_mc_timer_t sar_safety_unsolicited_timer; qdf_event_t sar_safety_req_resp_event; + qdf_atomic_t sar_safety_req_resp_event_in_progress; #endif qdf_time_t runtime_resume_start_time_stamp; diff --git a/core/hdd/src/wlan_hdd_sar_limits.c b/core/hdd/src/wlan_hdd_sar_limits.c index 04866b694fb4..bec6d26f3af3 100644 --- a/core/hdd/src/wlan_hdd_sar_limits.c +++ b/core/hdd/src/wlan_hdd_sar_limits.c @@ -502,6 +502,8 @@ static void hdd_sar_unsolicited_timer_cb(void *user_data) hdd_nofl_debug("Sar unsolicited timer expired"); + qdf_atomic_set(&hdd_ctx->sar_safety_req_resp_event_in_progress, 1); + for (i = 0; i < hdd_ctx->config->sar_safety_req_resp_retry; i++) { qdf_event_reset(&hdd_ctx->sar_safety_req_resp_event); hdd_send_sar_unsolicited_event(hdd_ctx); @@ -511,6 +513,7 @@ static void hdd_sar_unsolicited_timer_cb(void *user_data) if (QDF_IS_STATUS_SUCCESS(status)) break; } + qdf_atomic_set(&hdd_ctx->sar_safety_req_resp_event_in_progress, 0); if (i >= hdd_ctx->config->sar_safety_req_resp_retry) hdd_configure_sar_index(hdd_ctx, @@ -530,6 +533,10 @@ void wlan_hdd_sar_unsolicited_timer_start(struct hdd_context *hdd_ctx) if (!hdd_ctx->config->enable_sar_safety) return; + if (qdf_atomic_read( + &hdd_ctx->sar_safety_req_resp_event_in_progress) > 0) + return; + if (QDF_TIMER_STATE_RUNNING != qdf_mc_timer_get_current_state( &hdd_ctx->sar_safety_unsolicited_timer)) @@ -573,6 +580,7 @@ void wlan_hdd_sar_timers_init(struct hdd_context *hdd_ctx) QDF_TIMER_TYPE_SW, hdd_sar_unsolicited_timer_cb, hdd_ctx); + qdf_atomic_init(&hdd_ctx->sar_safety_req_resp_event_in_progress); qdf_event_create(&hdd_ctx->sar_safety_req_resp_event); }