summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDundi Raviteja <dundi@codeaurora.org>2018-05-16 18:34:34 +0530
committerIsaac Chiou <isaacchiou@google.com>2020-05-27 18:50:42 +0800
commit60cc09490d380cf1e312b1cb3cec6d38e8b670a5 (patch)
treed1913154ceddf70ab1c6c67233d1194cb81cb497
parent1006aface86cc1742c22f1d834b79b5bea9a1b85 (diff)
downloadqcacld-60cc09490d380cf1e312b1cb3cec6d38e8b670a5.tar.gz
qcacld-3.0: Use request manager framework for LL stats response event
We are transitioning the usage of LL stats response event to request manager framework. Bug: 153415344 Change-Id: Ice8b3d53beb47b345ed569f2b4bf790e9f5ce506 CRs-Fixed: 2274933
-rw-r--r--core/hdd/src/wlan_hdd_main.c2
-rw-r--r--core/hdd/src/wlan_hdd_stats.c122
-rw-r--r--core/hdd/src/wlan_hdd_stats.h13
-rw-r--r--core/sme/inc/sme_api.h6
-rw-r--r--core/sme/inc/sme_internal.h3
-rw-r--r--core/sme/src/common/sme_api.c15
-rw-r--r--core/wma/src/wma_utils.c14
7 files changed, 97 insertions, 78 deletions
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 7b516aa046..4ecd4a85e1 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -8547,8 +8547,6 @@ static int hdd_context_init(hdd_context_t *hdd_ctx)
hdd_ctx->ioctl_scan_mode = eSIR_ACTIVE_SCAN;
hdd_ctx->max_intf_count = CSR_ROAM_SESSION_MAX;
- hdd_init_ll_stats_ctx();
-
init_completion(&hdd_ctx->chain_rssi_context.response_event);
init_completion(&hdd_ctx->mc_sus_event_var);
init_completion(&hdd_ctx->ready_to_suspend);
diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c
index b9f52a1444..4c1a561199 100644
--- a/core/hdd/src/wlan_hdd_stats.c
+++ b/core/hdd/src/wlan_hdd_stats.c
@@ -130,7 +130,6 @@ static int rssi_mcs_tbl[][10] = {
#ifdef WLAN_FEATURE_LINK_LAYER_STATS
-static struct hdd_ll_stats_context ll_stats_context;
/**
* put_wifi_rate_stat() - put wifi rate stats
@@ -1033,20 +1032,22 @@ static void hdd_ll_process_peer_stats(hdd_adapter_t *adapter,
* @ctx: Pointer to hdd context
* @indType: Indication type
* @pRsp: Pointer to response
+ * @cookie: Callback context
*
* After receiving Link Layer indications from FW.This callback converts the
* firmware data to the NL data and send the same to the kernel/upper layers.
*
* Return: None
*/
-void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx,
- int indType, void *pRsp)
+void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx, int indType,
+ void *pRsp, void *cookie)
{
hdd_context_t *pHddCtx = (hdd_context_t *) ctx;
- struct hdd_ll_stats_context *context;
+ struct hdd_ll_stats_priv *priv = NULL;
hdd_adapter_t *pAdapter = NULL;
tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults) pRsp;
int status;
+ struct hdd_request *request = NULL;
status = wlan_hdd_validate_context(pHddCtx);
if (status)
@@ -1055,7 +1056,7 @@ void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx,
pAdapter = hdd_get_adapter_by_vdev(pHddCtx,
linkLayerStatsResults->ifaceId);
- if (NULL == pAdapter) {
+ if (!pAdapter) {
hdd_err("vdev_id %d does not exist with host",
linkLayerStatsResults->ifaceId);
return;
@@ -1074,18 +1075,23 @@ void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx,
linkLayerStatsResults->num_radio,
linkLayerStatsResults->results);
- context = &ll_stats_context;
- spin_lock(&context->context_lock);
+ request = hdd_request_get(cookie);
+ if (!request) {
+ hdd_err("Obselete request");
+ return;
+ }
+
+ priv = hdd_request_priv(request);
+
/* validate response received from target */
- if ((context->request_id != linkLayerStatsResults->rspId) ||
- !(context->request_bitmap & linkLayerStatsResults->paramId)) {
- spin_unlock(&context->context_lock);
+ if ((priv->request_id != linkLayerStatsResults->rspId) ||
+ !(priv->request_bitmap & linkLayerStatsResults->paramId)) {
hdd_err("Error : Request id %d response id %d request bitmap 0x%x response bitmap 0x%x",
- context->request_id, linkLayerStatsResults->rspId,
- context->request_bitmap, linkLayerStatsResults->paramId);
+ priv->request_id, linkLayerStatsResults->rspId,
+ priv->request_bitmap, linkLayerStatsResults->paramId);
+ hdd_request_put(request);
return;
}
- spin_unlock(&context->context_lock);
if (linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO) {
hdd_ll_process_radio_stats(pAdapter,
@@ -1094,10 +1100,8 @@ void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx,
linkLayerStatsResults->num_radio,
linkLayerStatsResults->rspId);
- spin_lock(&context->context_lock);
if (!linkLayerStatsResults->moreResultToFollow)
- context->request_bitmap &= ~(WMI_LINK_STATS_RADIO);
- spin_unlock(&context->context_lock);
+ priv->request_bitmap &= ~(WMI_LINK_STATS_RADIO);
} else if (linkLayerStatsResults->paramId &
WMI_LINK_STATS_IFACE) {
@@ -1106,17 +1110,15 @@ void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx,
linkLayerStatsResults->num_peers,
linkLayerStatsResults->rspId);
- spin_lock(&context->context_lock);
/* Firmware doesn't send peerstats event if no peers are
* connected. HDD should not wait for any peerstats in
* this case and return the status to middleware after
* receiving iface stats
*/
if (!linkLayerStatsResults->num_peers)
- context->request_bitmap &=
+ priv->request_bitmap &=
~(WMI_LINK_STATS_ALL_PEER);
- context->request_bitmap &= ~(WMI_LINK_STATS_IFACE);
- spin_unlock(&context->context_lock);
+ priv->request_bitmap &= ~(WMI_LINK_STATS_IFACE);
} else if (linkLayerStatsResults->
paramId & WMI_LINK_STATS_ALL_PEER) {
@@ -1125,21 +1127,19 @@ void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx,
linkLayerStatsResults->results,
linkLayerStatsResults->rspId);
- spin_lock(&context->context_lock);
if (!linkLayerStatsResults->moreResultToFollow)
- context->request_bitmap &= ~(WMI_LINK_STATS_ALL_PEER);
- spin_unlock(&context->context_lock);
+ priv->request_bitmap &=
+ ~(WMI_LINK_STATS_ALL_PEER);
} else {
hdd_err("INVALID LL_STATS_NOTIFY RESPONSE");
}
- spin_lock(&context->context_lock);
/* complete response event if all requests are completed */
- if (0 == context->request_bitmap)
- complete(&context->response_event);
- spin_unlock(&context->context_lock);
+ if (!priv->request_bitmap)
+ hdd_request_complete(request);
+ hdd_request_put(request);
break;
}
default:
@@ -1304,34 +1304,59 @@ nla_policy
[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = {.type = NLA_U32}
};
+/**
+ * wlan_hdd_send_ll_stats_req() - send LL stats request
+ * @hdd_ctx: pointer to hdd context
+ * @req: pointer to LL stats get request
+ *
+ * Return: 0 if success, non-zero if failure
+ */
static int wlan_hdd_send_ll_stats_req(hdd_context_t *hdd_ctx,
tSirLLStatsGetReq *req)
{
- unsigned long rc;
- struct hdd_ll_stats_context *context;
+ int ret = 0;
+ struct hdd_ll_stats_priv *priv = NULL;
+ struct hdd_request *request = NULL;
+ void *cookie = NULL;
+ static const struct hdd_request_params params = {
+ .priv_size = sizeof(*priv),
+ .timeout_ms = WLAN_WAIT_TIME_LL_STATS,
+ };
+
+ ENTER();
+
+ request = hdd_request_alloc(&params);
+ if (!request) {
+ hdd_err("Request Allocation Failure");
+ return -ENOMEM;
+ }
+
+ cookie = hdd_request_cookie(request);
+
+ priv = hdd_request_priv(request);
- context = &ll_stats_context;
- spin_lock(&context->context_lock);
- context->request_id = req->reqId;
- context->request_bitmap = req->paramIdMask;
- INIT_COMPLETION(context->response_event);
- spin_unlock(&context->context_lock);
+ priv->request_id = req->reqId;
+ priv->request_bitmap = req->paramIdMask;
if (QDF_STATUS_SUCCESS !=
- sme_ll_stats_get_req(hdd_ctx->hHal, req)) {
+ sme_ll_stats_get_req(hdd_ctx->hHal, req, cookie)) {
hdd_err("sme_ll_stats_get_req Failed");
- return -EINVAL;
+ ret = -EINVAL;
+ goto exit;
}
- rc = wait_for_completion_timeout(&context->response_event,
- msecs_to_jiffies(WLAN_WAIT_TIME_LL_STATS));
- if (!rc) {
+ ret = hdd_request_wait_for_response(request);
+ if (ret) {
hdd_err("Target response timed out request id %d request bitmap 0x%x",
- context->request_id, context->request_bitmap);
- return -ETIMEDOUT;
+ priv->request_id, priv->request_bitmap);
+ ret = -ETIMEDOUT;
+ goto exit;
}
+ EXIT();
- return 0;
+exit:
+ hdd_request_put(request);
+ return ret;
}
int wlan_hdd_ll_stats_get(hdd_adapter_t *adapter, uint32_t req_id,
@@ -4838,17 +4863,6 @@ int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy,
return ret;
}
-/**
- * hdd_init_ll_stats_ctx() - initialize link layer stats context
- *
- * Return: none
- */
-inline void hdd_init_ll_stats_ctx(void)
-{
- spin_lock_init(&ll_stats_context.context_lock);
- init_completion(&ll_stats_context.response_event);
- ll_stats_context.request_bitmap = 0;
-}
/**
* hdd_display_hif_stats() - display hif stats
diff --git a/core/hdd/src/wlan_hdd_stats.h b/core/hdd/src/wlan_hdd_stats.h
index 06ede453e3..cb030553d1 100644
--- a/core/hdd/src/wlan_hdd_stats.h
+++ b/core/hdd/src/wlan_hdd_stats.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.
*
@@ -83,17 +83,14 @@ struct index_data_rate_type {
#ifdef WLAN_FEATURE_LINK_LAYER_STATS
/**
- * struct hdd_ll_stats_context - hdd link layer stats context
+ * struct hdd_ll_stats_priv - hdd link layer stats private
*
* @request_id: userspace-assigned link layer stats request id
* @request_bitmap: userspace-assigned link layer stats request bitmap
- * @response_event: LL stats request wait event
*/
-struct hdd_ll_stats_context {
+struct hdd_ll_stats_priv {
uint32_t request_id;
uint32_t request_bitmap;
- struct completion response_event;
- spinlock_t context_lock;
};
/*
@@ -286,8 +283,8 @@ void wlan_hdd_cfg80211_stats_ext_callback(void *ctx,
void wlan_hdd_cfg80211_stats_ext2_callback(void *ctx,
struct stats_ext2_event *pmsg);
-void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx,
- int indType, void *pRsp);
+void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx, int indType,
+ void *pRsp, void *context);
/**
* wlan_hdd_get_rcpi() - Wrapper to get current RCPI
diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h
index 5d51a47491..249d896f6d 100644
--- a/core/sme/inc/sme_api.h
+++ b/core/sme/inc/sme_api.h
@@ -1056,10 +1056,12 @@ QDF_STATUS sme_ll_stats_clear_req(tHalHandle hHal,
QDF_STATUS sme_ll_stats_set_req(tHalHandle hHal,
tSirLLStatsSetReq *psetStatsReq);
QDF_STATUS sme_ll_stats_get_req(tHalHandle hHal,
- tSirLLStatsGetReq *pgetStatsReq);
+ tSirLLStatsGetReq *pgetStatsReq,
+ void *context);
QDF_STATUS sme_set_link_layer_stats_ind_cb(tHalHandle hHal,
void (*callbackRoutine)(void *callbackCtx,
- int indType, void *pRsp));
+ int indType, void *pRsp,
+ void *cookie));
QDF_STATUS sme_set_link_layer_ext_cb(tHalHandle hal,
void (*ll_stats_ext_cb)(tHddHandle callback_ctx,
tSirLLStatsResults * rsp));
diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h
index 391233c74f..e7ba94ac4d 100644
--- a/core/sme/inc/sme_internal.h
+++ b/core/sme/inc/sme_internal.h
@@ -191,8 +191,9 @@ typedef struct tagSmeStruct {
void (*pChAvoidNotificationCb)(void *hdd_context, void *indi_param);
#endif /* FEATURE_WLAN_CH_AVOID */
#ifdef WLAN_FEATURE_LINK_LAYER_STATS
+ void *ll_stats_context;
void (*pLinkLayerStatsIndCallback)(void *callbackContext,
- int indType, void *pRsp);
+ int indType, void *pRsp, void *context);
void (*link_layer_stats_ext_cb)(tHddHandle callback_ctx,
tSirLLStatsResults *rsp);
#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 8e2cd34478..f016409908 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -14724,11 +14724,12 @@ QDF_STATUS sme_ll_stats_set_req(tHalHandle hHal, tSirLLStatsSetReq
*
* @hHal
* @pgetStatsReq: Link Layer get stats request params structure
+ * @context: Callback context for ll stats
*
* Return QDF_STATUS
*/
QDF_STATUS sme_ll_stats_get_req(tHalHandle hHal, tSirLLStatsGetReq
- *pgetStatsReq)
+ *pgetStatsReq, void *context)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
@@ -14747,6 +14748,7 @@ QDF_STATUS sme_ll_stats_get_req(tHalHandle hHal, tSirLLStatsGetReq
*get_stats_req = *pgetStatsReq;
+ pMac->sme.ll_stats_context = context;
if (QDF_STATUS_SUCCESS == sme_acquire_global_lock(&pMac->sme)) {
/* Serialize the req through MC thread */
cds_message.bodyptr = get_stats_req;
@@ -14776,16 +14778,17 @@ QDF_STATUS sme_ll_stats_get_req(tHalHandle hHal, tSirLLStatsGetReq
/**
* sme_set_link_layer_stats_ind_cb() - SME API to trigger the stats are
- * available after get request
+ * available after get request
*
- * @hHal
- * @callback_routine - HDD callback which needs to be invoked after
- * getting status notification from FW
+ * @hHal: handle in hdd context
+ * @callback_routine: HDD callback which needs to be invoked after
+ * getting status notification from FW
*
* Return QDF_STATUS
*/
QDF_STATUS sme_set_link_layer_stats_ind_cb(tHalHandle hHal,
- void (*callback_routine)(void *callbackCtx, int indType, void *pRsp))
+ void (*callback_routine)(void *callbackCtx, int indType, void *pRsp,
+ void *context))
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c
index 50068dcff7..d46b2a34f4 100644
--- a/core/wma/src/wma_utils.c
+++ b/core/wma/src/wma_utils.c
@@ -1413,7 +1413,8 @@ static int wma_unified_link_peer_stats_event_handler(void *handle,
*/
pMac->sme.pLinkLayerStatsIndCallback(pMac->hHdd,
WMA_LINK_LAYER_STATS_RESULTS_RSP,
- link_stats_results);
+ link_stats_results,
+ pMac->sme.ll_stats_context);
qdf_mem_free(link_stats_results);
return 0;
@@ -1617,8 +1618,9 @@ post_stats:
* used to retrieve the correct HDD context
*/
mac->sme.pLinkLayerStatsIndCallback(mac->hHdd,
- WMA_LINK_LAYER_STATS_RESULTS_RSP,
- link_stats_results);
+ WMA_LINK_LAYER_STATS_RESULTS_RSP,
+ link_stats_results,
+ mac->sme.ll_stats_context);
wma_unified_radio_tx_mem_free(handle);
return 0;
@@ -1841,7 +1843,8 @@ static int wma_unified_link_radio_stats_event_handler(void *handle,
pMac->sme.pLinkLayerStatsIndCallback(pMac->hHdd,
WMA_LINK_LAYER_STATS_RESULTS_RSP,
- link_stats_results);
+ link_stats_results,
+ pMac->sme.ll_stats_context);
wma_unified_radio_tx_mem_free(handle);
return 0;
@@ -2319,7 +2322,8 @@ int wma_unified_link_iface_stats_event_handler(void *handle,
*/
pMac->sme.pLinkLayerStatsIndCallback(pMac->hHdd,
WMA_LINK_LAYER_STATS_RESULTS_RSP,
- link_stats_results);
+ link_stats_results,
+ pMac->sme.ll_stats_context);
qdf_mem_free(link_stats_results);
return 0;