From 017e502efaa6c86a44db3b5e76e16fa19ce89336 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Tue, 23 Jul 2019 20:58:11 +0530 Subject: [PATCH] qcacld-3.0: Add support to get last available vdev info FW sends vdev stats on vdev down, current host implementation does not process this event as host is only processing the stats events for which stats are requested. On vdev down FW sends the last available vdev stats and based on that host updates it's RSSI on disconnect. With CP stats infrastructure host is not processing this event and is not updating rssi on disconnect. To resolve this issue, add support to get last available vdev stats from cp stats component with the help of a callback registration. Change-Id: If0741281140509624f6fdda4a270d99e2f58b61a CRs-Fixed: 2493965 --- core/hdd/src/wlan_hdd_main.c | 3 ++ core/hdd/src/wlan_hdd_stats.c | 52 +++++++++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_stats.h | 10 +++++++ 3 files changed, 65 insertions(+) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index f53fa8f4f353..c94f867a85fc 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -12646,6 +12646,9 @@ int hdd_register_cb(struct hdd_context *hdd_ctx) status = sme_set_lost_link_info_cb(mac_handle, hdd_lost_link_info_cb); + + wlan_hdd_register_cp_stats_cb(hdd_ctx); + /* print error and not block the startup process */ if (!QDF_IS_STATUS_SUCCESS(status)) hdd_err("set lost link info callback failed"); diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index fac15c4f1691..0ea7ec99f5aa 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -37,6 +37,7 @@ #include "wlan_hdd_debugfs_llstat.h" #include "wlan_reg_services_api.h" #include +#include "wlan_cp_stats_mc_ucfg_api.h" #include "wlan_mlme_ucfg_api.h" #include "wlan_mlme_ucfg_api.h" @@ -5793,3 +5794,54 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx) qdf_atomic_read(&ctx->disable_rx_ol_in_low_tput)); } } + +/** + * hdd_lost_link_cp_stats_info_cb() - callback function to get lost + * link information + * @stats_ev: Stats event pointer + * FW sends vdev stats on vdev down, this callback is registered + * with cp_stats component to get the last available vdev stats + * From the FW. + * + * Return: None + */ + +static void hdd_lost_link_cp_stats_info_cb(void *stats_ev) +{ + struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + struct hdd_adapter *adapter; + struct stats_event *ev = stats_ev; + uint8_t i; + struct hdd_station_ctx *sta_ctx; + + if (wlan_hdd_validate_context(hdd_ctx)) + return; + + for (i = 0; i < ev->num_summary_stats; i++) { + adapter = hdd_get_adapter_by_vdev( + hdd_ctx, + ev->vdev_summary_stats[i].vdev_id); + if (!adapter) { + hdd_debug("invalid adapter"); + continue; + } + sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); + if ((sta_ctx) && + (eConnectionState_Associated != + sta_ctx->conn_info.conn_state)) { + adapter->rssi_on_disconnect = + ev->vdev_summary_stats[i].stats.rssi; + hdd_debug("rssi on disconnect %d for " QDF_MAC_ADDR_STR, + adapter->rssi_on_disconnect, + QDF_MAC_ADDR_ARRAY(adapter->mac_addr.bytes)); + } + } +} + +void wlan_hdd_register_cp_stats_cb(struct hdd_context *hdd_ctx) +{ + ucfg_mc_cp_stats_register_lost_link_info_cb( + hdd_ctx->psoc, + hdd_lost_link_cp_stats_info_cb); +} + diff --git a/core/hdd/src/wlan_hdd_stats.h b/core/hdd/src/wlan_hdd_stats.h index 1d087e33f92d..1a50b49b94c9 100644 --- a/core/hdd/src/wlan_hdd_stats.h +++ b/core/hdd/src/wlan_hdd_stats.h @@ -461,4 +461,14 @@ bool hdd_report_max_rate(mac_handle_t mac_handle, uint8_t mcs_index, uint16_t fw_rate, uint8_t nss); +/** + * wlan_hdd_register_cp_stats_cb() - Register hdd stats specific + * callbacks to the cp stats component + * @hdd_ctx: hdd context + * + * Return: none + */ + +void wlan_hdd_register_cp_stats_cb(struct hdd_context *hdd_ctx); + #endif /* end #if !defined(WLAN_HDD_STATS_H) */