aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiachao Wu <jiacwu@codeaurora.org>2018-08-01 14:41:29 +0800
committerPrashanth Swaminathan <prashanthsw@google.com>2018-09-07 16:11:10 -0700
commite4eff584ecdd17150a930feeb2d99e08d3e21528 (patch)
tree69fd1a9389ff2f3ce0342f093bb90dbfcd8f08e3
parenta398a6b3a872a91dfe712ef7c9c84fae56329501 (diff)
downloadqcom-msm-v4.9-e4eff584ecdd17150a930feeb2d99e08d3e21528.tar.gz
qcacld-2.0: Use request manager for linkspeed
We are transitioning to the new request manager framework. Change wlan_hdd_get_linkspeed_for_peermac() to this framework. Note that this framework provides the infrastructure to pass data from the response thread to the request thread and hence eliminates the need to maintain tSirLinkSpeedInfo in the HDD adapter struct. CRs-Fixed: 2207694 Bug: 111906763 Test: None Change-Id: Ie0c84c271cee188e8bd1663095022daefd703f97
-rw-r--r--techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_wext.h3
-rw-r--r--techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_hostapd.c114
-rw-r--r--techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c50
3 files changed, 73 insertions, 94 deletions
diff --git a/techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_wext.h b/techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_wext.h
index e01555f79268..5ce50fb63d61 100644
--- a/techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_wext.h
+++ b/techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_wext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -429,7 +429,6 @@ extern void *mem_alloc_copy_from_user_helper(const void *wrqu_data, size_t len);
extern VOS_STATUS wlan_hdd_get_linkspeed_for_peermac(hdd_adapter_t *pAdapter,
tSirMacAddr macAddress);
void hdd_clearRoamProfileIe( hdd_adapter_t *pAdapter);
-void hdd_GetLink_SpeedCB(tSirLinkSpeedInfo *pLinkSpeed, void *pContext);
VOS_STATUS wlan_hdd_check_ula_done(hdd_adapter_t *pAdapter);
diff --git a/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_hostapd.c b/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_hostapd.c
index 8bfba0aeea62..e8bb9ac40c0f 100644
--- a/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -6361,69 +6361,99 @@ iw_set_ap_genie(struct net_device *dev,
return ret;
}
+struct linkspeed_priv {
+ tSirLinkSpeedInfo linkspeed_info;
+};
+
+static void
+hdd_get_link_speed_cb(tSirLinkSpeedInfo *linkspeed_info, void *cookie)
+{
+ struct hdd_request *request;
+ struct linkspeed_priv *priv;
+
+ if (NULL == linkspeed_info)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ "%s: Bad param, linkspeed_info [%pK] cookie [%pK]",
+ __func__, linkspeed_info, cookie);
+ return;
+ }
+
+ request = hdd_request_get(cookie);
+ if (!request) {
+ hddLog(VOS_TRACE_LEVEL_ERROR,"Obsolete request");
+ return;
+ }
+
+ priv = hdd_request_priv(request);
+ priv->linkspeed_info = *linkspeed_info;
+ hdd_request_complete(request);
+ hdd_request_put(request);
+}
VOS_STATUS wlan_hdd_get_linkspeed_for_peermac(hdd_adapter_t *pAdapter,
tSirMacAddr macAddress)
{
eHalStatus hstatus;
- unsigned long rc;
- struct linkspeedContext context;
- tSirLinkSpeedInfo *linkspeed_req;
+ VOS_STATUS status = VOS_STATUS_SUCCESS;
+ void *cookie;
+ tSirLinkSpeedInfo *linkspeed_info;
+ int ret;
+ struct hdd_request *request;
+ struct linkspeed_priv *priv;
+ static const struct hdd_request_params params = {
+ .priv_size = sizeof(*priv),
+ .timeout_ms = WLAN_WAIT_TIME_STATS,
+ };
if (NULL == pAdapter)
{
hddLog(VOS_TRACE_LEVEL_ERROR, "%s: pAdapter is NULL", __func__);
return VOS_STATUS_E_FAULT;
}
- linkspeed_req = (tSirLinkSpeedInfo *)vos_mem_malloc(sizeof(*linkspeed_req));
- if (NULL == linkspeed_req)
- {
+
+ request = hdd_request_alloc(&params);
+ if (!request) {
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s Request Buffer Alloc Fail", __func__);
return VOS_STATUS_E_INVAL;
}
- init_completion(&context.completion);
- context.pAdapter = pAdapter;
- context.magic = LINK_CONTEXT_MAGIC;
-
- vos_mem_copy(linkspeed_req->peer_macaddr, macAddress, sizeof(tSirMacAddr) );
- hstatus = sme_GetLinkSpeed( WLAN_HDD_GET_HAL_CTX(pAdapter),
- linkspeed_req,
- &context,
- hdd_GetLink_SpeedCB);
+ cookie = hdd_request_cookie(request);
+ priv = hdd_request_priv(request);
+
+ linkspeed_info = &priv->linkspeed_info;
+ vos_mem_copy(linkspeed_info->peer_macaddr, macAddress, sizeof(tSirMacAddr) );
+ hstatus = sme_GetLinkSpeed(WLAN_HDD_GET_HAL_CTX(pAdapter),
+ linkspeed_info,
+ cookie,
+ hdd_get_link_speed_cb);
+
if (eHAL_STATUS_SUCCESS != hstatus)
{
hddLog(VOS_TRACE_LEVEL_ERROR,
- "%s: Unable to retrieve statistics for link speed",
- __func__);
- vos_mem_free(linkspeed_req);
+ "%s: Unable to retrieve statistics for link speed, ret(%d)",
+ __func__, hstatus);
+ status = VOS_STATUS_E_INVAL;
+ goto cleanup;
}
- else
- {
- rc = wait_for_completion_timeout(&context.completion,
- msecs_to_jiffies(WLAN_WAIT_TIME_STATS));
- if (!rc) {
- hddLog(VOS_TRACE_LEVEL_ERROR,
- "%s: SME timed out while retrieving link speed",
- __func__);
- }
+ ret = hdd_request_wait_for_response(request);
+ if (!ret) {
+ hddLog(VOS_TRACE_LEVEL_ERROR,
+ "%s: SME timed out while retrieving link speed,ret(%d)",
+ __func__, ret);
+ status = VOS_STATUS_E_INVAL;
+ goto cleanup;
}
+ pAdapter->ls_stats.estLinkSpeed = linkspeed_info->estLinkSpeed;
- /* either we never sent a request, we sent a request and received a
- response or we sent a request and timed out. if we never sent a
- request or if we sent a request and got a response, we want to
- clear the magic out of paranoia. if we timed out there is a
- race condition such that the callback function could be
- executing at the same time we are. of primary concern is if the
- callback function had already verified the "magic" but had not
- yet set the completion variable when a timeout occurred. we
- serialize these activities by invalidating the magic while
- holding a shared spinlock which will cause us to block if the
- callback is currently executing */
- spin_lock(&hdd_context_lock);
- context.magic = 0;
- spin_unlock(&hdd_context_lock);
- return VOS_STATUS_SUCCESS;
+cleanup:
+ /*
+ * either we never sent a request, we sent a request and
+ * received a response or we sent a request and timed out.
+ * regardless we are done with the request.
+ */
+ hdd_request_put(request);
+ return status;
}
diff --git a/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c b/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c
index f26f08aad6b2..ca8355734140 100644
--- a/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c
+++ b/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_wext.c
@@ -3450,56 +3450,6 @@ void hdd_tx_per_hit_cb (void *pCallbackContext)
wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, tx_fail);
}
-void hdd_GetLink_SpeedCB(tSirLinkSpeedInfo *pLinkSpeed, void *pContext)
-{
- struct linkspeedContext *pLinkSpeedContext;
- hdd_adapter_t *pAdapter;
-
- if ((NULL == pLinkSpeed) || (NULL == pContext))
- {
- hddLog(VOS_TRACE_LEVEL_ERROR,
- "%s: Bad param, pLinkSpeed [%pK] pContext [%pK]",
- __func__, pLinkSpeed, pContext);
- return;
- }
- spin_lock(&hdd_context_lock);
- pLinkSpeedContext = pContext;
- pAdapter = pLinkSpeedContext->pAdapter;
-
- /* 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 */
-
- if ((NULL == pAdapter) || (LINK_CONTEXT_MAGIC != pLinkSpeedContext->magic))
- {
- /* the caller presumably timed out so there is nothing we can do */
- spin_unlock(&hdd_context_lock);
- hddLog(VOS_TRACE_LEVEL_WARN,
- "%s: Invalid context, pAdapter [%pK] magic [%08x]",
- __func__, pAdapter, pLinkSpeedContext->magic);
- if (ioctl_debug)
- {
- pr_info("%s: Invalid context, pAdapter [%pK] magic [%08x]\n",
- __func__, pAdapter, pLinkSpeedContext->magic);
- }
- return;
- }
- /* context is valid so caller is still waiting */
-
- /* paranoia: invalidate the magic */
- pLinkSpeedContext->magic = 0;
-
- /* copy over the stats. do so as a struct copy */
- pAdapter->ls_stats = *pLinkSpeed;
-
- /* notify the caller */
- complete(&pLinkSpeedContext->completion);
-
- /* serialization is complete */
- spin_unlock(&hdd_context_lock);
-}
-
struct class_a_stats {
tCsrGlobalClassAStatsInfo class_a_stats;
};