aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Qian <zhangq@codeaurora.org>2018-08-01 15:08:15 +0800
committerPrashanth Swaminathan <prashanthsw@google.com>2018-09-07 16:11:10 -0700
commitad3ca152893faa3198d46dbf5a101c579d550e79 (patch)
tree97ef4ed414e22fab832b823fc3d2dca4eb070b47
parentbf46c5ce71c53852fd5a2d13cfec86da3efa2367 (diff)
downloadqcom-msm-v4.9-ad3ca152893faa3198d46dbf5a101c579d550e79.tar.gz
qcacld-2.0: Use hdd request manager for get tsf timer
Change wlan_hdd_cfg80211_ocb_get_tsf_timer to HDD request manager framework. CRs-Fixed: 2230953 Bug: 111906763 Test: None Change-Id: I731cd303cfdee056039f0546408406fc70ab3448
-rw-r--r--techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_main.h1
-rw-r--r--techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_ocb.c86
2 files changed, 52 insertions, 35 deletions
diff --git a/techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_main.h b/techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_main.h
index bcad09c68fe8..da4ea523772b 100644
--- a/techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_main.h
+++ b/techpack/qcacld-2.0/CORE/HDD/inc/wlan_hdd_main.h
@@ -1413,7 +1413,6 @@ struct hdd_adapter_s
/* State for synchronous OCB requests to WMI */
struct sir_ocb_set_config_response ocb_set_config_resp;
- struct sir_ocb_get_tsf_timer_response ocb_get_tsf_timer_resp;
struct dsrc_radio_chan_stats_ctxt dsrc_chan_stats;
#ifdef WLAN_FEATURE_DSRC
/* MAC addresses used for OCB interfaces */
diff --git a/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_ocb.c b/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_ocb.c
index 51066f89cad8..508d23fa3652 100644
--- a/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_ocb.c
+++ b/techpack/qcacld-2.0/CORE/HDD/src/wlan_hdd_ocb.c
@@ -1484,6 +1484,16 @@ int wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
}
/**
+ * hdd_ocb_get_tsf_timer_priv - private parameters for get tsf timer
+ * @response: response from SME
+ * @status: status of response
+ */
+struct hdd_ocb_get_tsf_timer_priv {
+ struct sir_ocb_get_tsf_timer_response response;
+ int status;
+};
+
+/**
* hdd_ocb_get_tsf_timer_callback() - Callback to get TSF command
* @context_ptr: request context
* @response_ptr: response data
@@ -1491,23 +1501,25 @@ int wlan_hdd_cfg80211_ocb_stop_timing_advert(struct wiphy *wiphy,
static void hdd_ocb_get_tsf_timer_callback(void *context_ptr,
void *response_ptr)
{
- struct hdd_ocb_ctxt *context = context_ptr;
+ struct hdd_request *hdd_request;
+ struct hdd_ocb_get_tsf_timer_priv *priv;
struct sir_ocb_get_tsf_timer_response *response = response_ptr;
- if (!context)
+ hdd_request = hdd_request_get(context_ptr);
+ if (!hdd_request) {
+ hddLog(LOGE, FL("Obsolete request"));
return;
+ }
- spin_lock(&hdd_context_lock);
- if (context->magic == HDD_OCB_MAGIC) {
- if (response) {
- context->adapter->ocb_get_tsf_timer_resp = *response;
- context->status = 0;
- } else {
- context->status = -EINVAL;
- }
- complete(&context->completion_evt);
+ priv = hdd_request_priv(hdd_request);
+ if (response) {
+ priv->response = *response;
+ priv->status = 0;
+ } else {
+ priv->status = -EINVAL;
}
- spin_unlock(&hdd_context_lock);
+ hdd_request_complete(hdd_request);
+ hdd_request_put(hdd_request);
}
/**
@@ -1531,7 +1543,13 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
int rc = -EINVAL;
struct sir_ocb_get_tsf_timer request = {0};
- struct hdd_ocb_ctxt context = {0};
+ void *cookie;
+ struct hdd_request *hdd_request;
+ struct hdd_ocb_get_tsf_timer_priv *priv;
+ static const struct hdd_request_params params = {
+ .priv_size = sizeof(*priv),
+ .timeout_ms = WLAN_WAIT_TIME_OCB_CMD,
+ };
ENTER();
@@ -1554,39 +1572,41 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
}
/* Initialize the callback context */
- init_completion(&context.completion_evt);
- context.adapter = adapter;
- context.magic = HDD_OCB_MAGIC;
+ hdd_request = hdd_request_alloc(&params);
+ if (!hdd_request) {
+ hddLog(LOGE, FL("Request allocation failure"));
+ return -ENOMEM;
+ }
+ cookie = hdd_request_cookie(hdd_request);
request.vdev_id = adapter->sessionId;
/* Call the SME function */
- rc = sme_ocb_get_tsf_timer(hdd_ctx->hHal, &context,
+ rc = sme_ocb_get_tsf_timer(hdd_ctx->hHal, cookie,
hdd_ocb_get_tsf_timer_callback,
&request);
if (rc) {
hddLog(LOGE, FL("Error calling SME function"));
/* Need to convert from eHalStatus to errno. */
- return -EINVAL;
+ rc = -EINVAL;
+ goto end;
}
- rc = wait_for_completion_timeout(&context.completion_evt,
- msecs_to_jiffies(WLAN_WAIT_TIME_OCB_CMD));
- if (rc == 0) {
+ rc = hdd_request_wait_for_response(hdd_request);
+ if (rc) {
hddLog(LOGE, FL("Operation timed out"));
- rc = -ETIMEDOUT;
goto end;
}
- rc = 0;
- if (context.status) {
- hddLog(LOGE, FL("Operation failed: %d"), context.status);
- rc = context.status;
+ priv = hdd_request_priv(hdd_request);
+ rc = priv->status;
+ if (rc) {
+ hddLog(LOGE, FL("Operation failed: %d"), rc);
goto end;
}
/* Allocate the buffer for the response. */
nl_resp = cfg80211_vendor_cmd_alloc_reply_skb(wiphy,
- 2 * sizeof(uint32_t) + NLMSG_HDRLEN);
+ 2 * (NLA_HDRLEN + sizeof(uint32_t)) + NLMSG_HDRLEN);
if (!nl_resp) {
hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed"));
@@ -1595,18 +1615,18 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
}
hddLog(LOGE, FL("Got TSF timer response, high=%d, low=%d"),
- adapter->ocb_get_tsf_timer_resp.timer_high,
- adapter->ocb_get_tsf_timer_resp.timer_low);
+ priv->response.timer_high,
+ priv->response.timer_low);
/* Populate the response. */
rc = nla_put_u32(nl_resp,
QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_HIGH,
- adapter->ocb_get_tsf_timer_resp.timer_high);
+ priv->response.timer_high);
if (rc)
goto end;
rc = nla_put_u32(nl_resp,
QCA_WLAN_VENDOR_ATTR_OCB_GET_TSF_RESP_TIMER_LOW,
- adapter->ocb_get_tsf_timer_resp.timer_low);
+ priv->response.timer_low);
if (rc)
goto end;
@@ -1619,9 +1639,7 @@ __wlan_hdd_cfg80211_ocb_get_tsf_timer(struct wiphy *wiphy,
}
end:
- spin_lock(&hdd_context_lock);
- context.magic = 0;
- spin_unlock(&hdd_context_lock);
+ hdd_request_put(hdd_request);
if (nl_resp)
kfree_skb(nl_resp);
return rc;