From 5397cd7b3af89e2b269a2b4b0edeee88ae61b90e Mon Sep 17 00:00:00 2001 From: sheenam monga Date: Tue, 2 Mar 2021 15:24:52 +0530 Subject: [PATCH] qcacld-3.0: Add support to extract big data params Add wmi support to extract params from WMI_VDEV_SEND_BIG_DATA_P2_EVENTID. Change-Id: I728c9eb407084bff2a6c1baec44e8bb12b989124 CRs-Fixed: 2889875 --- .../wmi/inc/wmi_unified_mc_cp_stats_api.h | 17 ++++- .../wmi/src/wmi_unified_mc_cp_stats_api.c | 15 ++++- .../wmi/src/wmi_unified_mc_cp_stats_tlv.c | 65 ++++++++++++++++++- 3 files changed, 94 insertions(+), 3 deletions(-) diff --git a/components/wmi/inc/wmi_unified_mc_cp_stats_api.h b/components/wmi/inc/wmi_unified_mc_cp_stats_api.h index 552df77ecb..a24811d98c 100644 --- a/components/wmi/inc/wmi_unified_mc_cp_stats_api.h +++ b/components/wmi/inc/wmi_unified_mc_cp_stats_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021, 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 above @@ -97,4 +97,19 @@ QDF_STATUS wmi_extract_peer_stats_info(wmi_unified_t wmi_handle, void *evt_buf, uint32_t index, wmi_host_peer_stats_info *peer_stats_info); + +#ifdef WLAN_FEATURE_BIG_DATA_STATS +/** + * wmi_extract_big_data_stats_param() - extract big data statsfrom event + * @wmi_handle: wmi handle + * @evt_buf: pointer to event buffer + * @stats_param: Pointer to hold stats + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS +wmi_extract_big_data_stats_param(wmi_unified_t wmi_handle, void *evt_buf, + struct big_data_stats_event *stats_param); +#endif + #endif /* _WMI_UNIFIED_MC_CP_STATS_API_H_ */ diff --git a/components/wmi/src/wmi_unified_mc_cp_stats_api.c b/components/wmi/src/wmi_unified_mc_cp_stats_api.c index 78660151e8..be4eca1a46 100644 --- a/components/wmi/src/wmi_unified_mc_cp_stats_api.c +++ b/components/wmi/src/wmi_unified_mc_cp_stats_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2021, 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 above @@ -90,3 +90,16 @@ wmi_extract_peer_stats_info(wmi_unified_t wmi_handle, void *evt_buf, return QDF_STATUS_E_FAILURE; } + +#ifdef WLAN_FEATURE_BIG_DATA_STATS +QDF_STATUS +wmi_extract_big_data_stats_param(wmi_unified_t wmi_handle, void *evt_buf, + struct big_data_stats_event *stats_param) +{ + if (wmi_handle->ops->extract_big_data_stats) + return wmi_handle->ops->extract_big_data_stats(wmi_handle, + evt_buf, stats_param); + + return QDF_STATUS_E_FAILURE; +} +#endif diff --git a/components/wmi/src/wmi_unified_mc_cp_stats_tlv.c b/components/wmi/src/wmi_unified_mc_cp_stats_tlv.c index 958a066d5e..069e46fb1e 100644 --- a/components/wmi/src/wmi_unified_mc_cp_stats_tlv.c +++ b/components/wmi/src/wmi_unified_mc_cp_stats_tlv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2021, 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 above @@ -417,6 +417,68 @@ extract_peer_stats_info_tlv(wmi_unified_t wmi_handle, void *evt_buf, return QDF_STATUS_SUCCESS; } +#ifdef WLAN_FEATURE_BIG_DATA_STATS +/** + * extract_big_data_stats_tlv() - extract big data from event + * @param wmi_handle: wmi handle + * @param evt_buf: pointer to event buffer + * @param stats_param: Pointer to hold big data stats + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +static QDF_STATUS +extract_big_data_stats_tlv(wmi_unified_t wmi_handle, void *evt_buf, + struct big_data_stats_event *stats) +{ + WMI_VDEV_SEND_BIG_DATA_P2_EVENTID_param_tlvs *param_buf; + wmi_vdev_send_big_data_p2_event_fixed_param *event; + wmi_big_data_dp_stats_tlv_param *dp_stats_param_buf; + + param_buf = (WMI_VDEV_SEND_BIG_DATA_P2_EVENTID_param_tlvs *)evt_buf; + if (!param_buf) { + wmi_err("invalid buffer"); + return QDF_STATUS_E_FAILURE; + } + + event = param_buf->fixed_param; + if (!event) { + wmi_err("invalid fixed param"); + return QDF_STATUS_E_FAILURE; + } + + dp_stats_param_buf = param_buf->big_data_dp_stats; + if (!dp_stats_param_buf) { + wmi_err("invalid dp stats param"); + return QDF_STATUS_E_FAILURE; + } + + stats->vdev_id = event->vdev_id; + stats->ani_level = event->ani_level; + stats->tsf_out_of_sync = event->tsf_out_of_sync; + + stats->last_data_tx_pwr = dp_stats_param_buf->last_data_tx_pwr; + stats->target_power_dsss = dp_stats_param_buf->target_power_dsss; + stats->target_power_ofdm = dp_stats_param_buf->target_power_ofdm; + stats->last_tx_data_rix = dp_stats_param_buf->last_tx_data_rix; + stats->last_tx_data_rate_kbps = + dp_stats_param_buf->last_tx_data_rate_kbps; + + return QDF_STATUS_SUCCESS; +} +#endif + +#ifdef WLAN_FEATURE_BIG_DATA_STATS +static void +wmi_attach_big_data_stats_handler(struct wmi_ops *ops) +{ + ops->extract_big_data_stats = extract_big_data_stats_tlv; +} +#else +static void +wmi_attach_big_data_stats_handler(struct wmi_ops *ops) +{} +#endif + void wmi_mc_cp_stats_attach_tlv(wmi_unified_t wmi_handle) { struct wmi_ops *ops = wmi_handle->ops; @@ -428,4 +490,5 @@ void wmi_mc_cp_stats_attach_tlv(wmi_unified_t wmi_handle) send_request_peer_stats_info_cmd_tlv; ops->extract_peer_stats_count = extract_peer_stats_count_tlv; ops->extract_peer_stats_info = extract_peer_stats_info_tlv; + wmi_attach_big_data_stats_handler(ops); }