summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCNSS_WLAN Service <cnssbldsw@qualcomm.com>2018-04-03 06:33:02 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-04-03 06:33:02 -0700
commit6fdcc55a8bdfd598e14842c78a818e98b27f3156 (patch)
tree94bb377292d444c8f78104d6aaa59eaf0183b15d
parent06d9df13469981bc60035a634fef0ad048c9e8d4 (diff)
parent9048145ff167fb8f9f8d2a9845ee1d1b45c4884c (diff)
Merge "qcacld-2.0: Use request manager for full power" into wlan-cld2.driver.lnx.1.0
-rw-r--r--CORE/HDD/src/wlan_hdd_wext.c83
1 files changed, 27 insertions, 56 deletions
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index eeeeab621601..3b31b2f4cca2 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -3652,47 +3652,16 @@ static int iw_get_range(struct net_device *dev, struct iw_request_info *info,
static void iw_power_offload_callback_fn(void *context, tANI_U32 session_id,
eHalStatus status)
{
- struct statsContext *stats_context;
+ struct hdd_request *request;
- if (NULL == context) {
- hddLog(VOS_TRACE_LEVEL_ERROR,
- FL("Bad param, context [%pK]"),
- context);
- return;
- }
-
- stats_context = (struct statsContext *)context;
-
- /*
- * there is a race condition that exists between this callback
- * function and the caller since the caller could time out either
- * before or while this code is executing. we use a spinlock to
- * serialize these actions
- */
- spin_lock(&hdd_context_lock);
-
- if (POWER_CONTEXT_MAGIC != stats_context->magic) {
- /* the caller presumably timed out */
- spin_unlock(&hdd_context_lock);
- hddLog(VOS_TRACE_LEVEL_WARN,
- FL("Invalid context, magic [%08x]"),
- stats_context->magic);
-
- if (ioctl_debug)
- pr_info("%s: Invalid context, magic [%08x]\n",
- __func__, stats_context->magic);
+ request = hdd_request_get(context);
+ if (!request) {
+ hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Obsolete request", __func__);
return;
}
- /* context is valid so caller is still waiting */
- /* paranoia: invalidate the magic */
- stats_context->magic = 0;
-
- /* notify the caller */
- complete(&stats_context->completion);
-
- /* serialization is complete */
- spin_unlock(&hdd_context_lock);
+ hdd_request_complete(request);
+ hdd_request_put(request);
}
/* Callback function registered with PMC to know status of PMC request */
@@ -4417,7 +4386,12 @@ VOS_STATUS wlan_hdd_set_powersave(hdd_adapter_t *pAdapter, int mode)
{
hdd_context_t *pHddCtx;
eHalStatus status;
- struct statsContext context;
+ void *cookie;
+ struct hdd_request *request;
+ static const struct hdd_request_params params = {
+ .priv_size = 0,
+ .timeout_ms = WLAN_WAIT_TIME_POWER,
+ };
if (NULL == pAdapter)
{
@@ -4425,15 +4399,18 @@ VOS_STATUS wlan_hdd_set_powersave(hdd_adapter_t *pAdapter, int mode)
return VOS_STATUS_E_FAULT;
}
+ request = hdd_request_alloc(&params);
+ if (!request) {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ "%s: Request allocation failure", __func__);
+ return VOS_STATUS_E_NOMEM;
+ }
+ cookie = hdd_request_cookie(request);
+
hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "power mode=%d", mode);
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
- init_completion(&context.completion);
-
- context.pAdapter = pAdapter;
- context.magic = POWER_CONTEXT_MAGIC;
-
if (DRIVER_POWER_MODE_ACTIVE == mode)
{
hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s:Wlan driver Entering "
@@ -4444,20 +4421,16 @@ VOS_STATUS wlan_hdd_set_powersave(hdd_adapter_t *pAdapter, int mode)
* this means we are disconnected
*/
status = sme_PsOffloadDisablePowerSave(WLAN_HDD_GET_HAL_CTX(pAdapter),
- iw_power_offload_callback_fn, &context,
+ iw_power_offload_callback_fn, cookie,
pAdapter->sessionId);
if (eHAL_STATUS_PMC_PENDING == status) {
- unsigned long rc;
- /* request was sent -- wait for the response */
- rc = wait_for_completion_timeout(
- &context.completion,
- msecs_to_jiffies(WLAN_WAIT_TIME_POWER));
-
- if (!rc) {
- hddLog(VOS_TRACE_LEVEL_ERROR,
- FL("SME timed out while disabling power save"));
+ if (hdd_request_wait_for_response(request)) {
+ hddLog(VOS_TRACE_LEVEL_WARN,
+ FL("SME timed out while requesting full power"));
}
}
+ hdd_request_put(request);
+
if (pHddCtx->cfg_ini->fIsBmpsEnabled)
sme_ConfigDisablePowerSave(pHddCtx->hHal,
ePMC_BEACON_MODE_POWER_SAVE);
@@ -4484,9 +4457,7 @@ VOS_STATUS wlan_hdd_set_powersave(hdd_adapter_t *pAdapter, int mode)
"enabled in the cfg");
}
}
- spin_lock(&hdd_context_lock);
- context.magic = 0;
- spin_unlock(&hdd_context_lock);
+
return VOS_STATUS_SUCCESS;
}