summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhinav Kumar <abhikuma@codeaurora.org>2018-11-02 15:31:46 +0530
committerIsaac Chiou <isaacchiou@google.com>2020-08-14 08:33:29 +0000
commite71dddf14ba09cb4e53d9deb34a2f0bb681e486a (patch)
treed7ceab8b92c8617e06272ada0b5c6547941430fb
parentf9d54215e9aead406c43008c1bc9b73751a00adf (diff)
downloadqcacld-e71dddf14ba09cb4e53d9deb34a2f0bb681e486a.tar.gz
qcacld-3.0: Acquire wake lock timeout for rrm scan
Currently driver acquires wakelock for scans received from hdd. But for RRM scan initiated from AP for beacon reports, the wakelock is not acquired and if host goes to suspend while scan is in progress,FW asserts. Fix is to avoid the system suspend by taking the wakelock before rrm scan start. Change-Id: I02ddc9b5e6ba5f1782d00e34f044ace34c54d0b0 CRs-Fixed: 2331741 Bug: 161624543 Signed-off-by: Vamsi Krishna <quic_vamsin@quicinc.com>
-rw-r--r--core/sme/inc/sme_rrm_internal.h1
-rw-r--r--core/sme/src/rrm/sme_rrm.c43
2 files changed, 44 insertions, 0 deletions
diff --git a/core/sme/inc/sme_rrm_internal.h b/core/sme/inc/sme_rrm_internal.h
index 48dc39b6ce..5057f89e2e 100644
--- a/core/sme/inc/sme_rrm_internal.h
+++ b/core/sme/inc/sme_rrm_internal.h
@@ -93,6 +93,7 @@ typedef struct sRrmSMEContext {
bool eseBcnReqInProgress;
#endif /* FEATURE_WLAN_ESE */
tRrmMsgReqSource msgSource;
+ qdf_wake_lock_t scan_wake_lock;
} tRrmSMEContext, *tpRrmSMEContext;
typedef struct sRrmNeighborReq {
diff --git a/core/sme/src/rrm/sme_rrm.c b/core/sme/src/rrm/sme_rrm.c
index 1cfe063b5a..31f8253976 100644
--- a/core/sme/src/rrm/sme_rrm.c
+++ b/core/sme/src/rrm/sme_rrm.c
@@ -825,6 +825,38 @@ free_ch_lst:
}
/**
+ * sme_rrm_calculate_total_scan_time() - calculate total time req for
+ * scan for all channels
+ * @mac_ctx: The handle returned by mac_open.
+ *
+ * Return: total rrm scan time
+ */
+static uint32_t sme_rrm_calculate_total_scan_time(tpAniSirGlobal mac_ctx)
+{
+ uint32_t dwell_time_active;
+ uint16_t interval;
+ tpRrmSMEContext pSmeRrmContext = &mac_ctx->rrm.rrmSmeContext;
+ uint8_t num_channels;
+ uint32_t rrm_scan_time = 0;
+
+ num_channels = pSmeRrmContext->channelList.numOfChannels;
+
+ interval = pSmeRrmContext->randnIntvl + 10;
+
+ dwell_time_active = pSmeRrmContext->duration[0];
+
+ /*
+ * Add 1 sec extra in actual total rrm scan time
+ * to accommodate any delay
+ */
+ if (num_channels)
+ rrm_scan_time = ((num_channels * dwell_time_active) +
+ ((num_channels - 1) * interval) + 1000);
+
+ return rrm_scan_time;
+}
+
+/**
* sme_rrm_process_beacon_report_req_ind() -Process beacon report request
* @pMac:- Global Mac structure
* @pMsgBuf:- a pointer to a buffer that maps to various structures base
@@ -842,6 +874,7 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(tpAniSirGlobal pMac,
tpSirBeaconReportReqInd pBeaconReq = (tpSirBeaconReportReqInd) pMsgBuf;
tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
uint32_t len = 0, i = 0;
+ uint32_t total_rrm_scan_time;
sme_debug("Received Beacon report request ind Channel = %d",
pBeaconReq->channelInfo.channelNum);
@@ -941,6 +974,12 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(tpAniSirGlobal pMac,
pSmeRrmContext->token, pSmeRrmContext->regClass,
pSmeRrmContext->randnIntvl, pSmeRrmContext->msgSource);
+ total_rrm_scan_time = sme_rrm_calculate_total_scan_time(pMac);
+
+ if (total_rrm_scan_time)
+ qdf_wake_lock_timeout_acquire(&pSmeRrmContext->scan_wake_lock,
+ total_rrm_scan_time);
+
return sme_rrm_issue_scan_req(pMac);
}
@@ -1345,6 +1384,8 @@ QDF_STATUS rrm_open(tpAniSirGlobal pMac)
QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS;
pSmeRrmContext->rrmConfig.max_randn_interval = 50; /* ms */
+ qdf_wake_lock_create(&pSmeRrmContext->scan_wake_lock,
+ "wlan_rrm_scan_wl");
qdf_status = qdf_mc_timer_init(&pSmeRrmContext->IterMeasTimer,
QDF_TIMER_TYPE_SW,
@@ -1446,6 +1487,8 @@ QDF_STATUS rrm_close(tpAniSirGlobal pMac)
csr_ll_close(&pSmeRrmContext->neighborReportCache);
+ qdf_wake_lock_destroy(&pSmeRrmContext->scan_wake_lock);
+
return qdf_status;
}