summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CORE/HDD/inc/wlan_hdd_cfg80211.h6
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h4
-rw-r--r--CORE/HDD/src/wlan_hdd_cfg80211.c24
-rw-r--r--CORE/HDD/src/wlan_hdd_early_suspend.c14
-rw-r--r--CORE/HDD/src/wlan_hdd_main.c5
-rw-r--r--CORE/MAC/inc/aniGlobal.h4
-rw-r--r--CORE/MAC/inc/sirApi.h7
-rw-r--r--CORE/MAC/inc/wniApi.h1
-rw-r--r--CORE/SME/inc/csrApi.h3
-rw-r--r--CORE/SME/inc/sme_Api.h6
-rw-r--r--CORE/SME/src/sme_common/sme_Api.c56
11 files changed, 122 insertions, 8 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h
index fcecb6331eec..e67f226f8139 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg80211.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h
@@ -162,4 +162,10 @@ extern void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext
void wlan_hdd_testmode_rx_event(void *buf, size_t buf_len);
#endif
+#ifdef QCA_WIFI_2_0
+void hdd_suspend_wlan(void (*callback)(void *callbackContext),
+ void *callbackContext);
+void hdd_resume_wlan(void);
+#endif
+
#endif
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 32a7d190f371..3e8cc9f2caf6 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -112,6 +112,9 @@
/** Maximum time(ms) to wait for mc thread suspend **/
#define WLAN_WAIT_TIME_MCTHREAD_SUSPEND 1200
+/** Maximum time(ms) to wait for target to be ready for suspend **/
+#define WLAN_WAIT_TIME_READY_TO_SUSPEND 2000
+
#endif
/** Maximum time(ms) to wait for tdls add sta to complete **/
@@ -990,6 +993,7 @@ struct hdd_context_s
#ifdef QCA_WIFI_2_0
v_U32_t target_type;
v_U32_t target_fw_version;
+ struct completion ready_to_suspend;
#endif
};
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 7b5392aa4906..d86447dd3b35 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -8230,6 +8230,14 @@ static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy,
#endif
#ifdef QCA_WIFI_2_0
+
+void wlan_hdd_cfg80211_ready_to_suspend(void *callbackContext)
+{
+ hdd_context_t *pHddCtx = (hdd_context_t *)callbackContext;
+
+ complete(&pHddCtx->ready_to_suspend);
+}
+
int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
struct cfg80211_wowlan *wow)
{
@@ -8268,6 +8276,20 @@ int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
pAdapterNode = pNext;
}
+ /* Wait for the target to be ready for suspend */
+ INIT_COMPLETION(pHddCtx->ready_to_suspend);
+
+ hdd_suspend_wlan(&wlan_hdd_cfg80211_ready_to_suspend, pHddCtx);
+
+ rc = wait_for_completion_interruptible_timeout(&pHddCtx->ready_to_suspend,
+ msecs_to_jiffies(WLAN_WAIT_TIME_READY_TO_SUSPEND));
+ if (!rc)
+ {
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: Failed to get ready to suspend", __func__);
+ return -ETIME;
+ }
+
/* Suspend MC thread */
set_bit(MC_SUSPEND_EVENT_MASK, &vosSchedContext->mcEventFlag);
wake_up_interruptible(&vosSchedContext->mcWaitQueue);
@@ -8298,6 +8320,8 @@ int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy)
pHddCtx->isMcThreadSuspended = FALSE;
+ hdd_resume_wlan();
+
return 0;
}
#endif
diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c
index 45dec1247060..529baddc5c25 100644
--- a/CORE/HDD/src/wlan_hdd_early_suspend.c
+++ b/CORE/HDD/src/wlan_hdd_early_suspend.c
@@ -863,7 +863,9 @@ void hdd_conf_mcastbcast_filter(hdd_context_t* pHddCtx, v_BOOL_t setfilter)
}
static void hdd_conf_suspend_ind(hdd_context_t* pHddCtx,
- hdd_adapter_t *pAdapter)
+ hdd_adapter_t *pAdapter,
+ void (*callback)(void *callbackContext),
+ void *callbackContext)
{
eHalStatus halStatus = eHAL_STATUS_FAILURE;
tpSirWlanSuspendParam wlanSuspendParam =
@@ -914,7 +916,8 @@ static void hdd_conf_suspend_ind(hdd_context_t* pHddCtx,
wlanSuspendParam->connectedState = FALSE;
wlanSuspendParam->sessionId = pAdapter->sessionId;
- halStatus = sme_ConfigureSuspendInd(pHddCtx->hHal, wlanSuspendParam);
+ halStatus = sme_ConfigureSuspendInd(pHddCtx->hHal, wlanSuspendParam,
+ callback, callbackContext);
if(eHAL_STATUS_SUCCESS == halStatus)
{
pHddCtx->hdd_mcastbcast_filter_set = TRUE;
@@ -973,7 +976,8 @@ static void hdd_conf_resume_ind(hdd_adapter_t *pAdapter)
}
//Suspend routine registered with Android OS
-void hdd_suspend_wlan(void)
+void hdd_suspend_wlan(void (*callback)(void *callbackContext),
+ void *callbackContext)
{
hdd_context_t *pHddCtx = NULL;
v_CONTEXT_t pVosContext = NULL;
@@ -1103,7 +1107,7 @@ send_suspend_ind:
/* Keep this suspend indication at the end (before processing next adaptor)
* for discrete. This indication is considered as trigger point to start
* WOW (if wow is enabled). */
- hdd_conf_suspend_ind(pHddCtx, pAdapter);
+ hdd_conf_suspend_ind(pHddCtx, pAdapter, callback, callbackContext);
status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext );
pAdapterNode = pNext;
@@ -1427,7 +1431,7 @@ VOS_STATUS hdd_wlan_reset_initialization(void)
void hdd_set_wlan_suspend_mode(bool suspend)
{
if (suspend)
- hdd_suspend_wlan();
+ hdd_suspend_wlan(NULL, NULL);
else
hdd_resume_wlan();
}
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 9a5981e272e3..60f90013c11e 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -675,11 +675,13 @@ int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
else if(strncmp(command, "SETSUSPENDMODE", 14) == 0)
{
+#ifndef QCA_WIFI_2_0
int suspend = 0;
tANI_U8 *ptr = (tANI_U8*)command + 15;
suspend = *ptr - '0';
hdd_set_wlan_suspend_mode(suspend);
+#endif
}
#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
else if (strncmp(command, "SETROAMTRIGGER", 14) == 0)
@@ -3263,6 +3265,9 @@ static hdd_adapter_t* hdd_alloc_station_adapter( hdd_context_t *pHddCtx, tSirMac
#endif
init_completion(&pHddCtx->mc_sus_event_var);
init_completion(&pHddCtx->tx_sus_event_var);
+#ifdef QCA_WIFI_2_0
+ init_completion(&pHddCtx->ready_to_suspend);
+#endif
init_completion(&pAdapter->ula_complete);
init_completion(&pAdapter->scan_info.scan_req_completion_event);
init_completion(&pAdapter->scan_info.abortscan_event_var);
diff --git a/CORE/MAC/inc/aniGlobal.h b/CORE/MAC/inc/aniGlobal.h
index b8cb894cbe6d..15e708872e17 100644
--- a/CORE/MAC/inc/aniGlobal.h
+++ b/CORE/MAC/inc/aniGlobal.h
@@ -1054,6 +1054,10 @@ typedef struct sAniSirGlobal
/* PNO offload */
v_BOOL_t pnoOffload;
+
+ csrReadyToSuspendCallback readyToSuspendCallback;
+ void *readyToSuspendContext;
+
} tAniSirGlobal;
#ifdef FEATURE_WLAN_TDLS
diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h
index be5c302a2475..1ff0bdd6089c 100644
--- a/CORE/MAC/inc/sirApi.h
+++ b/CORE/MAC/inc/sirApi.h
@@ -4286,4 +4286,11 @@ typedef struct sSirRateUpdateInd
tTxrateinfoflags mcastDataRate5GHzTxFlag;
} tSirRateUpdateInd, *tpSirRateUpdateInd;
+
+typedef struct
+{
+ tANI_U16 mesgType;
+ tANI_U16 mesgLen;
+} tSirReadyToSuspendInd, *tpSirReadyToSuspendInd;
+
#endif /* __SIR_API_H */
diff --git a/CORE/MAC/inc/wniApi.h b/CORE/MAC/inc/wniApi.h
index 70216a1ef06f..2fecff450451 100644
--- a/CORE/MAC/inc/wniApi.h
+++ b/CORE/MAC/inc/wniApi.h
@@ -358,6 +358,7 @@ enum eWniMsgTypes
eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP,
#endif // WLAN_FEATURE_GTK_OFFLOAD
eWNI_SME_CANDIDATE_FOUND_IND, //ROAM candidate indication from FW
+ eWNI_SME_READY_TO_SUSPEND_IND,
eWNI_SME_MSG_TYPES_END
};
diff --git a/CORE/SME/inc/csrApi.h b/CORE/SME/inc/csrApi.h
index 88eea1083e04..e5f226e9a779 100644
--- a/CORE/SME/inc/csrApi.h
+++ b/CORE/SME/inc/csrApi.h
@@ -1512,5 +1512,8 @@ eHalStatus csrSetBand(tHalHandle hHal, eCsrBand eBand);
---------------------------------------------------------------------------*/
eCsrBand csrGetCurrentBand (tHalHandle hHal);
+
+typedef void (*csrReadyToSuspendCallback)(void *pContext);
+
#endif
diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h
index cee18a1df35f..c44a18eef8ab 100644
--- a/CORE/SME/inc/sme_Api.h
+++ b/CORE/SME/inc/sme_Api.h
@@ -1854,8 +1854,10 @@ eHalStatus sme_ConfigureAppsCpuWakeupState( tHalHandle hHal, tANI_BOOLEAN isApp
--------------------------------------------------------------------------- */
-eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
- tpSirWlanSuspendParam wlanSuspendParam);
+eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
+ tpSirWlanSuspendParam wlanSuspendParam,
+ csrReadyToSuspendCallback,
+ void *callbackContext);
/* ---------------------------------------------------------------------------
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 76a3958d29c6..dd5a89cd446b 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -1503,6 +1503,39 @@ void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
}
#endif
+/*--------------------------------------------------------------------------
+
+ \fn - sme_ProcessReadyToSuspend
+ \brief - On getting ready to suspend indication, this function calls
+ callback registered (HDD callbacks) with SME to inform
+ ready to suspend indication.
+
+ \param hHal - Handle returned by macOpen.
+
+ \return None
+
+ \sa
+
+ --------------------------------------------------------------------------*/
+void sme_ProcessReadyToSuspend( tHalHandle hHal,
+ tpSirReadyToSuspendInd pReadyToSuspend)
+{
+ tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
+
+ if (NULL == pMac)
+ {
+ VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
+ "%s: pMac is null", __func__);
+ return ;
+ }
+
+ if (NULL != pMac->readyToSuspendCallback)
+ {
+ pMac->readyToSuspendCallback (pMac->readyToSuspendContext);
+ pMac->readyToSuspendCallback = NULL;
+ }
+}
+
/* ---------------------------------------------------------------------------
\fn sme_ChangeConfigParams
\brief The SME API exposed for HDD to provide config params to SME during
@@ -2150,6 +2183,18 @@ eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
}
break ;
#endif
+ case eWNI_SME_READY_TO_SUSPEND_IND:
+ if (pMsg->bodyptr)
+ {
+ sme_ProcessReadyToSuspend(pMac, pMsg->bodyptr);
+ vos_mem_free(pMsg->bodyptr);
+ }
+ else
+ {
+ smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_READY_TO_SUSPEND_IND), nothing to process");
+ }
+ break ;
+
default:
if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
@@ -6268,7 +6313,9 @@ eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
--------------------------------------------------------------------------- */
eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
- tpSirWlanSuspendParam wlanSuspendParam)
+ tpSirWlanSuspendParam wlanSuspendParam,
+ csrReadyToSuspendCallback callback,
+ void *callbackContext)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
@@ -6287,6 +6334,13 @@ eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
}
sme_ReleaseGlobalLock( &pMac->sme );
}
+
+ if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
+ {
+ pMac->readyToSuspendCallback = callback;
+ pMac->readyToSuspendContext = callbackContext;
+ }
+
return(status);
}