diff --git a/Kbuild b/Kbuild index a7d143a44280..4e137d3c1881 100644 --- a/Kbuild +++ b/Kbuild @@ -2857,6 +2857,7 @@ cppflags-$(CONFIG_LITHIUM) += -DSERIALIZE_QUEUE_SETUP cppflags-$(CONFIG_LITHIUM) += -DDP_RX_PKT_NO_PEER_DELIVER cppflags-$(CONFIG_LITHIUM) += -DFEATURE_ALIGN_STATS_FROM_DP cppflags-$(CONFIG_LITHIUM) += -DDROP_RXDMA_DECRYPT_ERR +cppflags-$(CONFIG_LITHIUM) += -DFEATURE_STATS_EXT_V2 cppflags-$(CONFIG_VERBOSE_DEBUG) += -DENABLE_VERBOSE_DEBUG cppflags-$(CONFIG_RX_DESC_DEBUG_CHECK) += -DRX_DESC_DEBUG_CHECK cppflags-$(CONFIG_REGISTER_OP_DEBUG) += -DHAL_REGISTER_WRITE_DEBUG diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 9e5d20f9a4fb..65c8bfd4f3b6 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -42,6 +42,7 @@ #include "wlan_mlme_ucfg_api.h" #include "wlan_mlme_ucfg_api.h" #include "wlan_hdd_sta_info.h" +#include "cdp_txrx_misc.h" #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && !defined(WITH_BACKPORTS) #define HDD_INFO_SIGNAL STATION_INFO_SIGNAL @@ -2892,6 +2893,7 @@ static int __wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy, int ret_val; QDF_STATUS status; struct hdd_context *hdd_ctx = wiphy_priv(wiphy); + ol_txrx_soc_handle soc = cds_get_context(QDF_MODULE_ID_SOC); hdd_enter_dev(dev); @@ -2907,10 +2909,19 @@ static int __wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy, stats_ext_req.request_data_len = data_len; stats_ext_req.request_data = (void *)data; + status = cdp_request_rx_hw_stats(soc, adapter->vdev_id); + + if (QDF_STATUS_SUCCESS != status) { + hdd_err_rl("Failed to get hw stats: %u", status); + ret_val = -EINVAL; + } + status = sme_stats_ext_request(adapter->vdev_id, &stats_ext_req); - if (QDF_STATUS_SUCCESS != status) + if (QDF_STATUS_SUCCESS != status) { + hdd_err_rl("Failed to get fw stats: %u", status); ret_val = -EINVAL; + } return ret_val; } diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index 20733f57670b..76a63be30d87 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -1205,6 +1205,14 @@ int wma_fast_tx_fail_event_handler(void *handle, uint8_t *data, */ #ifdef WLAN_FEATURE_STATS_EXT +/** + * wma_stats_ext_event_handler() - extended stats event handler + * @handle: wma handle + * @event_buf: event buffer received from fw + * @len: length of data + * + * Return: 0 for success or error code + */ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf, uint32_t len); #endif @@ -1457,6 +1465,13 @@ QDF_STATUS wma_process_del_periodic_tx_ptrn_ind(WMA_HANDLE handle, pDelPeriodicTxPtrnParams); #ifdef WLAN_FEATURE_STATS_EXT +/** + * wma_stats_ext_req() - request ext stats from fw + * @wma_ptr: wma handle + * @preq: stats ext params + * + * Return: QDF status + */ QDF_STATUS wma_stats_ext_req(void *wma_ptr, tpStatsExtRequest preq); #endif diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 953a678668a8..59f8dbf7d35c 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -3388,13 +3388,6 @@ QDF_STATUS wma_process_del_periodic_tx_ptrn_ind(WMA_HANDLE handle, } #ifdef WLAN_FEATURE_STATS_EXT -/** - * wma_stats_ext_req() - request ext stats from fw - * @wma_ptr: wma handle - * @preq: stats ext params - * - * Return: QDF status - */ QDF_STATUS wma_stats_ext_req(void *wma_ptr, tpStatsExtRequest preq) { tp_wma_handle wma = (tp_wma_handle) wma_ptr; diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index 95a62ebe71ba..4210a0b42e99 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -64,6 +64,7 @@ #include "host_diag_core_log.h" #include #include <../../core/src/vdev_mgr_ops.h> +#include "cdp_txrx_misc.h" /* MCS Based rate table */ /* HT MCS parameters with Nss = 1 */ @@ -658,14 +659,76 @@ int wma_smps_mode_to_force_mode_param(uint8_t smps_mode) } #ifdef WLAN_FEATURE_STATS_EXT -/** - * wma_stats_ext_event_handler() - extended stats event handler - * @handle: wma handle - * @event_buf: event buffer received from fw - * @len: length of data - * - * Return: 0 for success or error code - */ +#ifdef FEATURE_STATS_EXT_V2 +int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf, + uint32_t len) +{ + WMI_STATS_EXT_EVENTID_param_tlvs *param_buf; + tSirStatsExtEvent *stats_ext_event; + wmi_stats_ext_event_fixed_param *stats_ext_info; + QDF_STATUS status; + struct scheduler_msg cds_msg = {0}; + uint8_t *buf_ptr; + uint32_t alloc_len; + struct cdp_txrx_ext_stats ext_stats = {0}; + struct cdp_soc_t *soc_hdl = cds_get_context(QDF_MODULE_ID_SOC); + + wma_debug("%s: Posting stats ext event to SME", __func__); + + param_buf = (WMI_STATS_EXT_EVENTID_param_tlvs *)event_buf; + if (!param_buf) { + wma_err("%s: Invalid stats ext event buf", __func__); + return -EINVAL; + } + + stats_ext_info = param_buf->fixed_param; + buf_ptr = (uint8_t *)stats_ext_info; + + alloc_len = sizeof(tSirStatsExtEvent); + alloc_len += stats_ext_info->data_len; + alloc_len += sizeof(struct cdp_txrx_ext_stats); + + if (stats_ext_info->data_len > (WMI_SVC_MSG_MAX_SIZE - + WMI_TLV_HDR_SIZE - sizeof(*stats_ext_info)) || + stats_ext_info->data_len > param_buf->num_data) { + wma_err("Excess data_len:%d, num_data:%d", + stats_ext_info->data_len, param_buf->num_data); + return -EINVAL; + } + stats_ext_event = qdf_mem_malloc(alloc_len); + if (!stats_ext_event) + return -ENOMEM; + + buf_ptr += sizeof(wmi_stats_ext_event_fixed_param) + WMI_TLV_HDR_SIZE; + + stats_ext_event->vdev_id = stats_ext_info->vdev_id; + stats_ext_event->event_data_len = stats_ext_info->data_len; + qdf_mem_copy(stats_ext_event->event_data, + buf_ptr, stats_ext_event->event_data_len); + + cdp_txrx_ext_stats_request(soc_hdl, OL_TXRX_PDEV_ID, &ext_stats); + qdf_mem_copy(stats_ext_event->event_data + + stats_ext_event->event_data_len, + &ext_stats, sizeof(struct cdp_txrx_ext_stats)); + + stats_ext_event->event_data_len += sizeof(struct cdp_txrx_ext_stats); + + cds_msg.type = eWNI_SME_STATS_EXT_EVENT; + cds_msg.bodyptr = (void *)stats_ext_event; + cds_msg.bodyval = 0; + + status = scheduler_post_message(QDF_MODULE_ID_WMA, + QDF_MODULE_ID_SME, + QDF_MODULE_ID_SME, &cds_msg); + if (status != QDF_STATUS_SUCCESS) { + qdf_mem_free(stats_ext_event); + return -EFAULT; + } + + wma_debug("%s: stats ext event Posted to SME", __func__); + return 0; +} +#else int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf, uint32_t len) { @@ -679,14 +742,14 @@ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf, WMA_LOGD("%s: Posting stats ext event to SME", __func__); - param_buf = (WMI_STATS_EXT_EVENTID_param_tlvs *) event_buf; + param_buf = (WMI_STATS_EXT_EVENTID_param_tlvs *)event_buf; if (!param_buf) { WMA_LOGE("%s: Invalid stats ext event buf", __func__); return -EINVAL; } stats_ext_info = param_buf->fixed_param; - buf_ptr = (uint8_t *) stats_ext_info; + buf_ptr = (uint8_t *)stats_ext_info; alloc_len = sizeof(tSirStatsExtEvent); alloc_len += stats_ext_info->data_len; @@ -724,9 +787,9 @@ int wma_stats_ext_event_handler(void *handle, uint8_t *event_buf, WMA_LOGD("%s: stats ext event Posted to SME", __func__); return 0; } +#endif #endif /* WLAN_FEATURE_STATS_EXT */ - /** * wma_profile_data_report_event_handler() - fw profiling handler * @handle: wma handle