wlan: Disallow suspend req from OS, when STA is associating with SAP
Disallow suspend req from OS, when STA is associating with SAP
Change-Id: I207e91a53e8e1276f3349a2b41a6d883323d71ef
CR-Fixed: 424985
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index c903cbf..124eca6 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -50,9 +50,7 @@
#include <wlan_hdd_wmm.h>
#include <wlan_hdd_cfg.h>
#include <linux/spinlock.h>
-#ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK
#include <linux/wakelock.h>
-#endif
#ifdef ANI_MANF_DIAG
#include <wlan_hdd_ftm.h>
#endif
@@ -145,6 +143,8 @@
#define HDD_WAKE_LOCK_DURATION 50
#endif
+#define HDD_SAP_WAKE_LOCK_DURATION 10000 //10 sec
+
typedef struct hdd_tx_rx_stats_s
{
// start_xmit stats
@@ -911,6 +911,8 @@
u_int8_t hdd_restart_retries;
hdd_scaninfo_t scan_info;
+
+ struct wake_lock sap_wake_lock;
};
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index 9d08a5a..99693c4 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -433,6 +433,7 @@
char maxAssocExceededEvent[IW_CUSTOM_MAX+1];
v_BYTE_t we_custom_start_event[64];
char *startBssEvent;
+ hdd_context_t *pHddCtx;
dev = (struct net_device *)usrDataForCallback;
pHostapdAdapter = netdev_priv(dev);
@@ -440,6 +441,7 @@
pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter);
sapEvent = pSapEvent->sapHddEventCode;
memset(&wrqu, '\0', sizeof(wrqu));
+ pHddCtx = (hdd_context_t*)(pHostapdAdapter->pHddCtx);
switch(sapEvent)
{
@@ -619,6 +621,11 @@
if (!VOS_IS_STATUS_SUCCESS(vos_status))
hddLog(LOGE, FL("Failed to start AP inactivity timer\n"));
}
+ if (wake_lock_active(&pHddCtx->sap_wake_lock))
+ {
+ wake_unlock(&pHddCtx->sap_wake_lock);
+ }
+ wake_lock_timeout(&pHddCtx->sap_wake_lock, HDD_SAP_WAKE_LOCK_DURATION);
#ifdef CONFIG_CFG80211
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
{
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 5aa92f9..72869e9 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -2933,6 +2933,8 @@
/* Destroy the wake lock */
wake_lock_destroy(&pHddCtx->rx_wake_lock);
#endif
+ /* Destroy the wake lock */
+ wake_lock_destroy(&pHddCtx->sap_wake_lock);
//Close VOSS
//This frees pMac(HAL) context. There should not be any call that requires pMac access after this.
@@ -3889,6 +3891,10 @@
WAKE_LOCK_SUSPEND,
"qcom_rx_wakelock");
#endif
+ /* Initialize the wake lcok */
+ wake_lock_init(&pHddCtx->sap_wake_lock,
+ WAKE_LOCK_SUSPEND,
+ "qcom_sap_wakelock");
vos_event_init(&pHddCtx->scan_info.scan_finished_event);
pHddCtx->scan_info.scan_pending_option = WEXT_SCAN_PENDING_GIVEUP;