Kaynağa Gözat

qcacmn: Add WMI health monitor events

Add WMI health monitor events to send the health
monitor data to application.

Change-Id: I792b733822b03518dc964f38fe4a158132b0ac49
CRs-Fixed: 3266229
Sham Muthayyan 2 yıl önce
ebeveyn
işleme
1e28e45ce7

+ 2 - 0
target_if/core/inc/target_if.h

@@ -190,6 +190,7 @@ struct target_version_info {
  * @scan_radio_caps: scan radio capabilities
  * @device_mode: Global Device mode
  * @sbs_lower_band_end_freq: sbs lower band end frequency
+ * @health_mon_params: health monitor params
  */
 struct tgt_info {
 	struct host_fw_ver version;
@@ -224,6 +225,7 @@ struct tgt_info {
 	struct wlan_psoc_host_scan_radio_caps *scan_radio_caps;
 	uint32_t device_mode;
 	uint32_t sbs_lower_band_end_freq;
+	struct wmi_health_mon_params health_mon_param;
 };
 
 /**

+ 42 - 0
target_if/init_deinit/src/init_event_handler.c

@@ -954,6 +954,42 @@ exit:
 	return 0;
 }
 
+static int init_deinit_health_mon_event_handler(ol_scn_t scn_handle,
+						uint8_t *event,
+						uint32_t data_len)
+{
+	struct wlan_objmgr_psoc *psoc;
+	struct target_psoc_info *tgt_hdl;
+	struct wmi_unified *wmi_handle;
+	struct tgt_info *info;
+	struct wmi_health_mon_params *param;
+
+	if (!scn_handle) {
+		target_if_err("scn handle NULL");
+		return -EINVAL;
+	}
+
+	psoc = target_if_get_psoc_from_scn_hdl(scn_handle);
+	if (!psoc) {
+		target_if_err("psoc is null");
+		return -EINVAL;
+	}
+
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
+	if (!tgt_hdl) {
+		target_if_err("target_psoc_info is null");
+		return -EINVAL;
+	}
+
+	wmi_handle = target_psoc_get_wmi_hdl(tgt_hdl);
+	info = (&tgt_hdl->info);
+
+	param = (&info->health_mon_param);
+	wmi_extract_health_mon_event(wmi_handle, event, param);
+
+	return 0;
+}
+
 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
 static void init_deinit_mlo_setup_done_event(struct wlan_objmgr_psoc *psoc)
 {
@@ -1117,6 +1153,12 @@ QDF_STATUS init_deinit_register_tgt_psoc_ev_handlers(
 				WMI_RX_WORK_CTX);
 	retval = init_deinit_register_mlo_ev_handlers(wmi_handle);
 
+	retval = wmi_unified_register_event_handler(
+				wmi_handle,
+				wmi_extract_health_mon_init_done_info_eventid,
+				init_deinit_health_mon_event_handler,
+				WMI_RX_WORK_CTX);
+
 
 	return retval;
 }

+ 15 - 0
wmi/inc/wmi_unified_api.h

@@ -4954,4 +4954,19 @@ QDF_STATUS wmi_feature_set_cmd_send(
 			wmi_unified_t wmi_handle,
 			struct target_feature_set *feature_set);
 #endif
+
+/**
+ * wmi_extract_health_mon_event - extract health monitor params
+ * @wmi_handle: wmi handle
+ * @ev: pointer to event buffer
+ * @params: health monitor params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+
+QDF_STATUS wmi_extract_health_mon_event(
+		wmi_unified_t wmi_handle,
+		void *ev,
+		struct wmi_health_mon_params *param);
+
 #endif /* _WMI_UNIFIED_API_H_ */

+ 16 - 1
wmi/inc/wmi_unified_param.h

@@ -5105,6 +5105,7 @@ typedef enum {
 #ifdef WLAN_FEATURE_COAP
 	wmi_wow_coap_buf_info_eventid,
 #endif
+	wmi_extract_health_mon_init_done_info_eventid,
 	wmi_events_max,
 } wmi_conv_event_id;
 
@@ -5785,7 +5786,6 @@ typedef enum {
 #endif
 	wmi_service_is_my_mgmt_frame,
 	wmi_service_linkspeed_roam_trigger_support,
-
 #ifdef FEATURE_SET
 	wmi_service_feature_set_event_support,
 #endif
@@ -9036,4 +9036,19 @@ struct wmi_host_sw_cal_ver {
 	uint32_t ftm_cal_ver;
 	uint32_t status;
 };
+
+/**
+ * struct wmi_health_mon_params - Health mon params
+ * @ring_buf_paddr_low: Ring buffer physical address LOW
+ * @ring_buf_paddr_high:  Ring buffer physical address HIGH
+ * @initial_upload_period_ms: Health mon periodic time
+ * @read_index: ring element read_index
+ */
+struct wmi_health_mon_params {
+	uint32_t ring_buf_paddr_low;
+	uint32_t ring_buf_paddr_high;
+	uint32_t initial_upload_period_ms;
+	uint32_t read_index;
+};
+
 #endif /* _WMI_UNIFIED_PARAM_H_ */

+ 4 - 0
wmi/inc/wmi_unified_priv.h

@@ -3115,6 +3115,10 @@ QDF_STATUS
 QDF_STATUS (*extract_coap_buf_info)(wmi_unified_t wmi_handle, void *evt_buf,
 				    struct coap_buf_info *info);
 #endif
+QDF_STATUS
+(*extract_health_mon_init_done_info_event)(wmi_unified_t wmi_handle,
+					   void *evt_buf,
+					   struct wmi_health_mon_params *param);
 };
 
 /* Forward declartion for psoc*/

+ 11 - 0
wmi/src/wmi_unified_api.c

@@ -1440,6 +1440,17 @@ QDF_STATUS wmi_unified_thermal_mitigation_param_cmd_send(
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_extract_health_mon_event(
+		wmi_unified_t wmi_handle,
+		void *ev,
+		struct wmi_health_mon_params *param)
+{
+	if (wmi_handle->ops->extract_health_mon_init_done_info_event)
+		return wmi_handle->ops->extract_health_mon_init_done_info_event(
+						wmi_handle, ev, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
 QDF_STATUS
 wmi_unified_vdev_set_fwtest_param_cmd_send(wmi_unified_t wmi_handle,
 					   struct set_fwtest_params *param)

+ 34 - 0
wmi/src/wmi_unified_tlv.c

@@ -18806,6 +18806,36 @@ extract_pktlog_decode_info_event_tlv(wmi_unified_t wmi_handle, void *evt_buf,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * extract_health_mon_init_done_info_event_tlv() - Extract health monitor from
+ * fw
+ * @wmi_handle: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @params: health monitor params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS
+extract_health_mon_init_done_info_event_tlv(wmi_unified_t wmi_handle,
+					    void *evt_buf,
+					    struct wmi_health_mon_params *param)
+{
+	WMI_HEALTH_MON_INIT_DONE_EVENTID_param_tlvs *param_buf;
+	wmi_health_mon_init_done_fixed_param *event;
+
+	param_buf =
+		(WMI_HEALTH_MON_INIT_DONE_EVENTID_param_tlvs *)evt_buf;
+
+	event = param_buf->fixed_param;
+
+	param->ring_buf_paddr_low = event->ring_buf_paddr_low;
+	param->ring_buf_paddr_high = event->ring_buf_paddr_high;
+	param->initial_upload_period_ms = event->initial_upload_period_ms;
+	param->read_index = 0;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 /**
  * extract_pdev_telemetry_stats_tlv - extract pdev telemetry stats
  * @wmi_handle: wmi handle
@@ -19305,6 +19335,8 @@ struct wmi_ops tlv_ops =  {
 #ifdef FEATURE_SET
 	.feature_set_cmd_send = feature_set_cmd_send_tlv,
 #endif
+	.extract_health_mon_init_done_info_event =
+		extract_health_mon_init_done_info_event_tlv,
 };
 
 #ifdef WLAN_FEATURE_11BE_MLO
@@ -19795,6 +19827,8 @@ static void populate_tlv_events_id(uint32_t *event_ids)
 	event_ids[wmi_wow_coap_buf_info_eventid] =
 		WMI_WOW_COAP_BUF_INFO_EVENTID;
 #endif
+	event_ids[wmi_extract_health_mon_init_done_info_eventid] =
+		WMI_HEALTH_MON_INIT_DONE_EVENTID;
 }
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS