From 0cf77a56eafe0a67e64f7b3b9d6549534c20ce64 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Mon, 5 Aug 2019 17:12:24 +0530 Subject: [PATCH] qcacmn: Process All the pdev stats events There are 2 issues in the driver: 1. Currently host incorrectly fills the pdev id value as 0 in stats request, If host sends the pdev id as 0 for stats request then FW sends the stats for all the pdevs. 2. If host requests pdev stats with pdev id as 0, FW can send multiple events for each pdev stats if one event buffer is not sufficient to fill the stats for all the pdevs. Curent host logic doesn't process multiple pdev stats events. Address above 2 issues with below fixes: 1. Send correct pdev id to FW in the stats command. 2. Add a logic in host to process all the pdev stats events received as part of the pdev stats request. Change-Id: I5b5bfcda2f30fb32749c653c6524ecbd2edc44a4 CRs-Fixed: 2503273 --- .../cp_stats/src/target_if_mc_cp_stats.c | 28 ------------------- .../dispatcher/src/wlan_cp_stats_mc_tgt_api.c | 11 ++++---- wmi/src/wmi_unified_tlv.c | 3 +- 3 files changed, 8 insertions(+), 34 deletions(-) diff --git a/target_if/cp_stats/src/target_if_mc_cp_stats.c b/target_if/cp_stats/src/target_if_mc_cp_stats.c index fa6bf1b36140..0b1fb62c94c6 100644 --- a/target_if/cp_stats/src/target_if_mc_cp_stats.c +++ b/target_if/cp_stats/src/target_if_mc_cp_stats.c @@ -34,9 +34,6 @@ #include #include #include "../../../umac/cmn_services/utils/inc/wlan_utility.h" -#ifdef WLAN_POLICY_MGR_ENABLE -#include -#endif static void target_if_cp_stats_free_stats_event(struct stats_event *ev) { @@ -598,30 +595,6 @@ static uint32_t get_stats_id(enum stats_req_type type) return 0; } -#ifdef WLAN_POLICY_MGR_ENABLE -static void -target_if_cp_stats_update_pdev_id(struct stats_request_params *param, - struct wlan_objmgr_psoc *psoc, - uint32_t vdev_id) -{ - uint8_t pdev_id; - QDF_STATUS status; - - status = policy_mgr_get_mac_id_by_session_id(psoc, vdev_id, &pdev_id); - if (!QDF_IS_STATUS_ERROR(status)) - param->pdev_id = pdev_id + 1; - - cp_stats_debug("pdev id is %d", param->pdev_id); -} -#else -static void -target_if_cp_stats_update_pdev_id(struct stats_request_params *data, - struct wlan_objmgr_psoc *psoc, - uint32_t vdev_id) -{ -} -#endif - /** * target_if_cp_stats_send_stats_req() - API to send stats request to wmi * @psoc: pointer to psoc object @@ -647,7 +620,6 @@ static QDF_STATUS target_if_cp_stats_send_stats_req( param.stats_id = get_stats_id(type); param.vdev_id = req->vdev_id; param.pdev_id = req->pdev_id; - target_if_cp_stats_update_pdev_id(¶m, psoc, req->vdev_id); return wmi_unified_stats_request_send(wmi_handle, req->peer_mac_addr, ¶m); diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c index e517fb87100c..27f6cef2ef05 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c @@ -110,14 +110,15 @@ static void tgt_mc_cp_stats_extract_tx_power(struct wlan_objmgr_psoc *psoc, pdev_mc_stats = pdev_cp_stats_priv->pdev_stats; max_pwr = pdev_mc_stats->max_pwr = ev->pdev_stats[pdev_id].max_pwr; wlan_cp_stats_pdev_obj_unlock(pdev_cp_stats_priv); - if (is_station_stats) goto end; - ucfg_mc_cp_stats_reset_pending_req(psoc, TYPE_CONNECTION_TX_POWER); - if (last_req.u.get_tx_power_cb) - last_req.u.get_tx_power_cb(max_pwr, last_req.cookie); - + if (tgt_mc_cp_stats_is_last_event(ev)) { + ucfg_mc_cp_stats_reset_pending_req(psoc, + TYPE_CONNECTION_TX_POWER); + if (last_req.u.get_tx_power_cb) + last_req.u.get_tx_power_cb(max_pwr, last_req.cookie); + } end: if (vdev) wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID); diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 9cc7f8a31693..2e946cdb9b52 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -2040,8 +2040,9 @@ static QDF_STATUS send_stats_request_cmd_tlv(wmi_unified_t wmi_handle, (wmi_request_stats_cmd_fixed_param)); cmd->stats_id = param->stats_id; cmd->vdev_id = param->vdev_id; - cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target( + cmd->pdev_id = wmi_handle->ops->convert_host_pdev_id_to_target( param->pdev_id); + WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr); WMI_LOGD("STATS REQ STATS_ID:%d VDEV_ID:%d PDEV_ID:%d-->",