From fa408b37c1bc9052f84fd427ea657b427d5d2136 Mon Sep 17 00:00:00 2001 From: Bapiraju Alla Date: Mon, 20 Jul 2020 14:11:16 +0530 Subject: [PATCH] qcacld-3.0: Add support for tx_time and rx_time in wifi_channel_stats Currently wifi_channel_stats has cca_busy_time statistic which is measured after excluding own tx_time but not own rx_time. By definition, CCA busy time means amount of time for which channel is detected as busy after excluding it's own tx and rx time. Add support for tx and rx time in the channel statistics. This will enable provision to calculate CCA busy time with including/excluding channel tx and rx time. Change-Id: I8e295ed4cd7b2ceca44b64140977603a4d8e8764 CRs-Fixed: 2732018 --- core/hdd/inc/wlan_hdd_main.h | 1 + core/hdd/src/wlan_hdd_debugfs_llstat.c | 13 ++++++++++++- core/hdd/src/wlan_hdd_main.c | 2 ++ core/mac/inc/sir_api.h | 7 ++++++- core/wma/inc/wma_tgt_cfg.h | 2 ++ core/wma/src/wma_main.c | 4 ++++ core/wma/src/wma_utils.c | 22 ++++++++++++++++------ 7 files changed, 43 insertions(+), 8 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 3868d80e5f85..4f43d91921c2 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -2069,6 +2069,7 @@ struct hdd_context { int current_pcie_gen_speed; qdf_workqueue_t *adapter_ops_wq; struct hdd_adapter_ops_history adapter_ops_history; + bool ll_stats_per_chan_rx_tx_time; }; /** diff --git a/core/hdd/src/wlan_hdd_debugfs_llstat.c b/core/hdd/src/wlan_hdd_debugfs_llstat.c index 916b84b884af..036284424257 100644 --- a/core/hdd/src/wlan_hdd_debugfs_llstat.c +++ b/core/hdd/src/wlan_hdd_debugfs_llstat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -286,6 +286,17 @@ void hdd_debugfs_process_radio_stats(struct hdd_adapter *adapter, chan_stat->channel.center_freq0, chan_stat->channel.center_freq1, chan_stat->on_time, chan_stat->cca_busy_time); + + if (adapter->hdd_ctx && + adapter->hdd_ctx->ll_stats_per_chan_rx_tx_time) { + buffer += len; + ll_stats.len += len; + len = scnprintf( + buffer, + DEBUGFS_LLSTATS_BUF_SIZE - ll_stats.len, + "tx time %u rx time %u", + chan_stat->tx_time, chan_stat->rx_time); + } } radio_stat++; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 31ed14123aff..45c56f61aad8 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1668,6 +1668,8 @@ static void hdd_update_tgt_services(struct hdd_context *hdd_ctx, hdd_update_tdls_config(hdd_ctx); sme_update_tgt_services(hdd_ctx->mac_handle, cfg); hdd_ctx->roam_ch_from_fw_supported = cfg->is_roam_scan_ch_to_host; + hdd_ctx->ll_stats_per_chan_rx_tx_time = + cfg->ll_stats_per_chan_rx_tx_time; } /** diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index e2c887e304e7..cbf71b8d5067 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -3530,12 +3530,17 @@ struct wifi_rate_info { * struct wifi_channel_stats - channel statistics * @channel: channel for which the stats are applicable * @on_time: msecs the radio is awake - * @cca_busy_time: secs the CCA register is busy + * @cca_busy_time: secs the CCA register is busy excluding own tx_time + * @tx_time: msecs the radio is transmitting on this channel + * @rx_time: msecs the radio is in active receive on this channel */ struct wifi_channel_stats { struct wifi_channel_info channel; uint32_t on_time; uint32_t cca_busy_time; + uint32_t tx_time; + uint32_t rx_time; + }; /** diff --git a/core/wma/inc/wma_tgt_cfg.h b/core/wma/inc/wma_tgt_cfg.h index f14ccc6a4b17..faffe1e7a1ae 100644 --- a/core/wma/inc/wma_tgt_cfg.h +++ b/core/wma/inc/wma_tgt_cfg.h @@ -44,6 +44,7 @@ * @twt_responder: TWT responder capability * @bcn_reception_stats: Beacon Reception stats capability * @is_roam_scan_ch_to_host: Get roam scan channels from fw supported + * @ll_stats_per_chan_rx_tx_time: Per channel tx and rx time support in ll stats */ struct wma_tgt_services { uint32_t sta_power_save; @@ -77,6 +78,7 @@ struct wma_tgt_services { bool obss_scan_offload; bool bcn_reception_stats; bool is_roam_scan_ch_to_host; + bool ll_stats_per_chan_rx_tx_time; }; /** diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 7387ad9bcc33..e3cb206cfee7 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -4614,6 +4614,10 @@ static inline void wma_update_target_services(struct wmi_unified *wmi_handle, if (wmi_service_enabled(wmi_handle, wmi_roam_scan_chan_list_to_host_support)) cfg->is_roam_scan_ch_to_host = true; + + cfg->ll_stats_per_chan_rx_tx_time = + wmi_service_enabled(wmi_handle, + wmi_service_ll_stats_per_chan_rx_tx_time); } /** diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index 2e2dfaa324ab..349503a5c980 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -2155,12 +2155,22 @@ static int wma_unified_link_radio_stats_event_handler(void *handle, wma_debug("Channel Stats Info"); for (count = 0; count < radio_stats->num_channels; count++) { wma_nofl_debug("freq %u width %u freq0 %u freq1 %u awake time %u cca busy time %u", - channel_stats->center_freq, - channel_stats->channel_width, - channel_stats->center_freq0, - channel_stats->center_freq1, - channel_stats->radio_awake_time, - channel_stats->cca_busy_time); + channel_stats->center_freq, + channel_stats->channel_width, + channel_stats->center_freq0, + channel_stats->center_freq1, + channel_stats->radio_awake_time, + channel_stats->cca_busy_time); + if (wmi_service_enabled( + wma_handle->wmi_handle, + wmi_service_ll_stats_per_chan_rx_tx_time)) { + wma_nofl_debug("tx time %u rx time %u", + channel_stats->tx_time, + channel_stats->rx_time); + } else { + wma_nofl_debug("LL Stats per channel tx time and rx time are not supported."); + } + channel_stats++; qdf_mem_copy(chn_results,