From 6663105f9b0b4df3562b632090e7913641271484 Mon Sep 17 00:00:00 2001 From: Surabhi Vishnoi Date: Tue, 15 Jun 2021 19:11:40 +0530 Subject: [PATCH] qcacmn: Add support to handle wmi smart monitor event Add functions to parse and extract wmi smart monitor event received from target. Change-Id: Ic18e3134b684c5f8e12839e997d628909a7e27c9 CRs-Fixed: 2969247 --- wmi/inc/wmi_unified_api.h | 14 ++++++++++++++ wmi/inc/wmi_unified_param.h | 3 +++ wmi/inc/wmi_unified_priv.h | 7 +++++++ wmi/src/wmi_unified_api.c | 14 ++++++++++++++ wmi/src/wmi_unified_tlv.c | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index e417b4810a..77a03b271c 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -4139,6 +4139,20 @@ wmi_unified_extract_vdev_mgmt_offload_event(wmi_unified_t wmi, void *evt_buf, struct mgmt_offload_event_params *params); #endif +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 +/** + * wmi_unified_extract_smart_monitor_event() - Extract smu event params + * @wmi: WMI handle + * @evt_buf: Event buffer + * @params: Smart monitor event params + * + * Return: QDF_STATUS + */ +QDF_STATUS +wmi_unified_extract_smart_monitor_event(wmi_unified_t wmi, void *evt_buf, + struct smu_event_params *params); +#endif + #ifdef FEATURE_WLAN_TIME_SYNC_FTM /** * wmi_unified_send_wlan_time_sync_ftm_trigger() - send ftm timesync trigger cmd diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index be4bb7a3c7..b179446597 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -4672,6 +4672,9 @@ typedef enum { wmi_pdev_cp_fwstats_eventid, wmi_vdev_send_big_data_p2_eventid, wmi_pdev_get_dpd_status_event_id, +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 + wmi_vdev_smart_monitor_event_id, +#endif wmi_events_max, } wmi_conv_event_id; diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 1f2abe7ddd..5ece381bfd 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -2455,6 +2455,13 @@ QDF_STATUS (*extract_vdev_mgmt_offload_event)( struct mgmt_offload_event_params *params); #endif /* WLAN_FEATURE_PKT_CAPTURE */ +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 +QDF_STATUS (*extract_smart_monitor_event)( + void *handle, + void *event_buf, + struct smu_event_params *params); +#endif /* WLAN_FEATURE_PKT_CAPTURE_V2 */ + QDF_STATUS (*multisoc_tbtt_sync_cmd)(wmi_unified_t wmi_handle, struct rnr_tbtt_multisoc_sync_param *param); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index cf26ef39bf..6c767ad54f 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -3251,6 +3251,20 @@ wmi_unified_extract_vdev_mgmt_offload_event( } #endif /* WLAN_FEATURE_PKT_CAPTURE */ +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 +QDF_STATUS +wmi_unified_extract_smart_monitor_event( + wmi_unified_t wmi, void *evt_buf, + struct smu_event_params *params) +{ + if (wmi->ops->extract_smart_monitor_event) + return wmi->ops->extract_smart_monitor_event(wmi, evt_buf, + params); + + return QDF_STATUS_E_FAILURE; +} +#endif /* WLAN_FEATURE_PKT_CAPTURE_V2 */ + QDF_STATUS wmi_unified_extract_roam_result_stats(wmi_unified_t wmi, void *buf, struct wmi_roam_result *dst, diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index aab9418d51..4822ed2a64 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -14716,6 +14716,36 @@ extract_vdev_mgmt_offload_event_tlv(void *handle, void *evt_buf, } #endif /* WLAN_FEATURE_PKT_CAPTURE */ +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 +static QDF_STATUS +extract_smart_monitor_event_tlv(void *handle, void *evt_buf, + struct smu_event_params *params) +{ + WMI_VDEV_SMART_MONITOR_EVENTID_param_tlvs *param_buf = NULL; + wmi_vdev_smart_monitor_event_fixed_param *smu_event = NULL; + + param_buf = (WMI_VDEV_SMART_MONITOR_EVENTID_param_tlvs *)evt_buf; + if (!param_buf) { + wmi_err("Invalid smart monitor event"); + return QDF_STATUS_E_INVAL; + } + + smu_event = param_buf->fixed_param; + if (!smu_event) { + wmi_err("smart monitor event fixed param is NULL"); + return QDF_STATUS_E_INVAL; + } + + params->vdev_id = smu_event->vdev_id; + if (params->vdev_id >= WLAN_UMAC_PDEV_MAX_VDEVS) + return QDF_STATUS_E_INVAL; + + params->rx_avg_rssi = smu_event->avg_rssi_data_dbm; + + return QDF_STATUS_SUCCESS; +} +#endif /* WLAN_FEATURE_PKT_CAPTURE_V2 */ + #ifdef FEATURE_WLAN_TIME_SYNC_FTM /** * send_wlan_ts_ftm_trigger_cmd_tlv(): send wlan time sync cmd to FW @@ -15448,6 +15478,9 @@ struct wmi_ops tlv_ops = { #ifdef WLAN_FEATURE_PKT_CAPTURE .extract_vdev_mgmt_offload_event = extract_vdev_mgmt_offload_event_tlv, #endif +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 + .extract_smart_monitor_event = extract_smart_monitor_event_tlv, +#endif #ifdef FEATURE_WLAN_TIME_SYNC_FTM .send_wlan_time_sync_ftm_trigger_cmd = send_wlan_ts_ftm_trigger_cmd_tlv, @@ -15878,6 +15911,10 @@ event_ids[wmi_roam_scan_chan_list_id] = WMI_VDEV_SEND_BIG_DATA_P2_EVENTID; event_ids[wmi_pdev_get_dpd_status_event_id] = WMI_PDEV_GET_DPD_STATUS_EVENTID; +#ifdef WLAN_FEATURE_PKT_CAPTURE_V2 + event_ids[wmi_vdev_smart_monitor_event_id] = + WMI_VDEV_SMART_MONITOR_EVENTID; +#endif } #ifdef WLAN_FEATURE_LINK_LAYER_STATS