From f587adff9256db599c53194073890cdc674f1ec9 Mon Sep 17 00:00:00 2001 From: Sandeep Puligilla Date: Thu, 27 Apr 2017 19:53:21 -0700 Subject: [PATCH] qcacld-3.0: Serialize IPA stats command in low priority queue Currently IPA stats command request gets scheduled at every 100ms and posts message to WMA queue which can cause MC thread to prioritize these request messages over other messages in pe queue. This can cause delayed processing of association related messages in pe queue in noisy environement. To avoid this serialize IPA stats cmd to lower priority SME queue. Change-Id: I1f8257b869dacd65a61e52e34f001ee24c108c4a CRs-Fixed: 2040579 --- core/hdd/src/wlan_hdd_ipa.c | 6 +-- core/mac/inc/sir_api.h | 20 +++++++++ core/mac/inc/wni_api.h | 1 + core/sme/inc/sme_api.h | 12 ++++++ core/sme/src/common/sme_api.c | 79 +++++++++++++++++++++++++++++++++++ core/wma/inc/wma.h | 8 ++++ core/wma/src/wma_main.c | 7 ++++ 7 files changed, 130 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index f67def7dcf97..90203977ea60 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -1763,9 +1763,9 @@ static void __hdd_ipa_uc_stat_request(hdd_adapter_t *adapter, uint8_t reason) (false == hdd_ipa->resource_loading)) { hdd_ipa->stat_req_reason = reason; qdf_mutex_release(&hdd_ipa->ipa_lock); - wma_cli_set_command( - (int)adapter->sessionId, - (int)WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID, + sme_ipa_uc_stat_request(WLAN_HDD_GET_HAL_CTX(adapter), + adapter->sessionId, + WMA_VDEV_TXRX_GET_IPA_UC_FW_STATS_CMDID, 0, VDEV_CMD); } else { qdf_mutex_release(&hdd_ipa->ipa_lock); diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index f20023c72520..e43e1e0fe31d 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -7175,4 +7175,24 @@ enum scan_reject_states { EAPOL_IN_PROGRESS, SAP_EAPOL_IN_PROGRESS, }; + +/** + * struct ani_ipa_stat_req - IPA stats request + * @msg_type: Message type + * @msg_len: Message Length + * @vdev_id: Vdev Id + * @param_id: param id + * @param_val: param value + * @req_type: request type + * + * IPA stats request message structure + */ +struct ani_ipa_stat_req { + uint16_t msg_type; + uint16_t msg_len; + uint16_t vdev_id; + uint32_t param_id; + uint32_t param_val; + uint32_t req_type; +}; #endif /* __SIR_API_H */ diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h index a7147774925b..da9aea31ff74 100644 --- a/core/mac/inc/wni_api.h +++ b/core/mac/inc/wni_api.h @@ -258,6 +258,7 @@ enum eWniMsgTypes { eWNI_SME_RSO_CMD_STATUS_IND, eWMI_SME_LL_STATS_IND, eWNI_SME_DFS_CAC_COMPLETE, + eWNI_SME_IPA_STATS_REQ_CMD, eWNI_SME_MSG_TYPES_END }; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 7d4885028a81..e2a134560111 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1506,4 +1506,16 @@ QDF_STATUS sme_set_dbs_scan_selection_config(tHalHandle hal, */ void sme_store_pdev(tHalHandle hal, struct wlan_objmgr_pdev *pdev); +/** + * sme_ipa_uc_stat_request() - set ipa config parameters + * @vdev_id: virtual device for the command + * @param_id: parameter id + * @param_val: parameter value + * @req_cat: parameter category + * + * Return: QDF_STATUS_SUCCESS or non-zero on failure + */ +QDF_STATUS sme_ipa_uc_stat_request(tHalHandle hal, + uint32_t vdev_id, uint32_t param_id, + uint32_t param_val, uint32_t req_cat); #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 90a7eb44ec1c..aeb8d3db6bc9 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -1373,6 +1373,33 @@ QDF_STATUS sme_start(tHalHandle hHal) return status; } +static QDF_STATUS sme_handle_ipa_uc_stat_request( + tpAniSirGlobal mac_ctx, void *msg) +{ + wma_cli_set_cmd_t *iwcmd; + struct ani_ipa_stat_req *ipa_stat_msg; + + ipa_stat_msg = msg; + iwcmd = qdf_mem_malloc(sizeof(*iwcmd)); + if (!iwcmd) { + sme_err("Failed alloc memory for iwcmd"); + return QDF_STATUS_E_NOMEM; + } + + qdf_mem_zero(iwcmd, sizeof(*iwcmd)); + iwcmd->param_sec_value = 0; + iwcmd->param_vdev_id = ipa_stat_msg->vdev_id; + iwcmd->param_id = ipa_stat_msg->param_id; + iwcmd->param_vp_dev = ipa_stat_msg->req_type; + iwcmd->param_value = ipa_stat_msg->param_val; + + sme_info("param_id %d", iwcmd->param_id); + wma_ipa_uc_stat_request(iwcmd); + qdf_mem_free(iwcmd); + + return QDF_STATUS_SUCCESS; +} + /** * sme_handle_scan_req() - Scan request handler * @mac_ctx: MAC global context @@ -2635,6 +2662,17 @@ QDF_STATUS sme_process_msg(tHalHandle hHal, struct scheduler_msg *pMsg) pMsg->bodyptr); qdf_mem_free(pMsg->bodyptr); break; + + case eWNI_SME_IPA_STATS_REQ_CMD: + if (pMsg->bodyptr) { + status = sme_handle_ipa_uc_stat_request(pMac, + pMsg->bodyptr); + qdf_mem_free(pMsg->bodyptr); + } else { + sme_err("Empty message for: %d", pMsg->type); + } + break; + default: if ((pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN) @@ -16145,3 +16183,44 @@ QDF_STATUS sme_congestion_register_callback(tHalHandle hal, return status; } + +QDF_STATUS sme_ipa_uc_stat_request(tHalHandle hal, uint32_t vdev_id, + uint32_t param_id, uint32_t param_val, uint32_t req_cat) +{ + struct ani_ipa_stat_req *ipa_stat_msg; + struct scheduler_msg msg = {0}; + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + QDF_STATUS status; + + status = sme_acquire_global_lock(&mac_ctx->sme); + if (!QDF_IS_STATUS_SUCCESS(status)) { + sme_err("Unable to acquire lock"); + return status; + } + + ipa_stat_msg = qdf_mem_malloc(sizeof(struct ani_ipa_stat_req)); + if (NULL == ipa_stat_msg) { + sme_release_global_lock(&mac_ctx->sme); + sme_err("Failed to allocate memory for ipa_stat_msg"); + return QDF_STATUS_E_NOMEM; + } + ipa_stat_msg->msg_type = eWNI_SME_IPA_STATS_REQ_CMD; + ipa_stat_msg->msg_len = (uint16_t) sizeof(struct ani_ipa_stat_req); + ipa_stat_msg->vdev_id = vdev_id; + ipa_stat_msg->param_id = param_id; + ipa_stat_msg->param_val = param_val; + ipa_stat_msg->req_type = req_cat; + msg.type = eWNI_SME_IPA_STATS_REQ_CMD; + msg.bodyptr = ipa_stat_msg; + msg.reserved = 0; + msg.bodyval = 0; + if (QDF_STATUS_SUCCESS != + scheduler_post_msg(QDF_MODULE_ID_SME, &msg)) { + sme_err("sme_ipa_uc_stat_request failed to post msg"); + qdf_mem_free(ipa_stat_msg); + status = QDF_STATUS_E_FAILURE; + } + sme_release_global_lock(&mac_ctx->sme); + + return status; +} diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 26ce076cd7b1..239d7f31d7c3 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -2479,4 +2479,12 @@ static inline void wma_print_wmi_mgmt_event_log(uint32_t count, } #endif /* WMI_INTERFACE_EVENT_LOGGING */ +/** + * wma_ipa_uc_stat_request() - set ipa config parameters + * @privcmd: private command + * + * Return: None + */ +void wma_ipa_uc_stat_request(wma_cli_set_cmd_t *privcmd); + #endif diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 4b7a53f0e712..1ba7f83cd27c 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -7497,3 +7497,10 @@ int wma_peer_rx_reorder_queue_remove(void *scn_handle, } +void wma_ipa_uc_stat_request(wma_cli_set_cmd_t *privcmd) +{ + tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); + + if (wma_set_priv_cfg(wma, privcmd)) + WMA_LOGE("Failed to set wma priv congiuration"); +}