wlan: Don't process PNO START commands back-back
As both PNO START and PNO STOP commands are added to the HEAD
of SME pending queue, there is possibility of processing two PNO
START commands back-back, if framework issues PNO STOP followed
by PNO START commands(causing PNO START to be added to HEAD of
queue) while already PNO SCAN is going on.
Hence add PNO STOP/START commands to the head/tail of SME pending
queue respectively and return from PNO STOP command only after
getting confirmation that FW received PNO STOP command.
Change-Id: I1d517a14f78de5a3b1bd7e3bdb8fbddc6971f787
CRs-Fixed: 942697
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index b8a30ea..94f1dad 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -17024,6 +17024,11 @@
MTRACE(vos_trace(VOS_MODULE_ID_HDD,
TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP,
pAdapter->sessionId, pAdapter->device_mode));
+
+ INIT_COMPLETION(pAdapter->pno_comp_var);
+ pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb;
+ pnoRequest.callbackContext = pAdapter;
+ pAdapter->pno_req_status = 0;
status = sme_SetPreferredNetworkList(hHal, &pnoRequest,
pAdapter->sessionId,
NULL, pAdapter);
@@ -17034,7 +17039,22 @@
ret = -EINVAL;
goto error;
}
- pHddCtx->isPnoEnable = FALSE;
+ ret = wait_for_completion_timeout(
+ &pAdapter->pno_comp_var,
+ msecs_to_jiffies(WLAN_WAIT_TIME_PNO));
+ if (0 >= ret)
+ {
+ // Did not receive the response for PNO disable in time.
+ // Assuming the PNO disable was success.
+ // Returning error from here, because we timeout, results
+ // in side effect of Wifi (Wifi Setting) not to work.
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ FL("Timed out waiting for PNO to be disabled"));
+ ret = 0;
+ }
+
+ ret = pAdapter->pno_req_status;
+ pHddCtx->isPnoEnable = (ret == 0) ? FALSE : TRUE;
error:
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,