Jelajahi Sumber

qcacmn: Request stats over qmi only when target suspend is success

Currently, Stats request commands are sent over qmi right from the
target suspend request is sent to FW. This is leading to a crash in
FW since it is trying to access PCI when it is in suspend state.

To address this, send stats request over QMI only after the ack is
received for the target suspend command.

Change-Id: Id7a79d52740916f66476bf911e571c0ff466c7d3
CRs-Fixed: 2838737
Bapiraju Alla 4 tahun lalu
induk
melakukan
25509a1510
4 mengubah file dengan 49 tambahan dan 1 penghapusan
  1. 18 0
      wmi/inc/wmi_unified_api.h
  2. 1 0
      wmi/inc/wmi_unified_priv.h
  3. 29 0
      wmi/src/wmi_unified.c
  4. 1 1
      wmi/src/wmi_unified_tlv.c

+ 18 - 0
wmi/inc/wmi_unified_api.h

@@ -496,6 +496,13 @@ int wmi_get_pending_cmds(wmi_unified_t wmi_handle);
  */
 void wmi_set_target_suspend(wmi_unified_t wmi_handle, bool val);
 
+/**
+ *  WMI API to set target suspend command acked flag
+ *  @param wmi_handle      : handle to WMI.
+ *  @param val             : suspend command acked flag boolean
+ */
+void wmi_set_target_suspend_acked(wmi_unified_t wmi_handle, bool val);
+
 /**
  * wmi_is_target_suspended() - WMI API to check target suspend state
  * @wmi_handle: handle to WMI.
@@ -506,6 +513,17 @@ void wmi_set_target_suspend(wmi_unified_t wmi_handle, bool val);
  */
 bool wmi_is_target_suspended(struct wmi_unified *wmi_handle);
 
+/**
+ * wmi_is_target_suspend_acked() - WMI API to check target suspend command is
+ *                                 acked or not
+ * @wmi_handle: handle to WMI.
+ *
+ * WMI API to check whether the target suspend command is acked or not
+ *
+ * Return: true if target suspend command is acked, else false.
+ */
+bool wmi_is_target_suspend_acked(struct wmi_unified *wmi_handle);
+
 #ifdef WLAN_FEATURE_WMI_SEND_RECV_QMI
 /**
  *  wmi_set_qmi_stats() - WMI API to set qmi stats enabled/disabled

+ 1 - 0
wmi/inc/wmi_unified_priv.h

@@ -2532,6 +2532,7 @@ struct wmi_unified {
 #endif /*WMI_INTERFACE_EVENT_LOGGING */
 
 	qdf_atomic_t is_target_suspended;
+	qdf_atomic_t is_target_suspend_acked;
 #ifdef WLAN_FEATURE_WMI_SEND_RECV_QMI
 	bool is_qmi_stats_enabled;
 #endif

+ 29 - 0
wmi/src/wmi_unified.c

@@ -3117,6 +3117,7 @@ void *wmi_unified_attach(void *scn_handle,
 
 	qdf_atomic_init(&wmi_handle->pending_cmds);
 	qdf_atomic_init(&wmi_handle->is_target_suspended);
+	qdf_atomic_init(&wmi_handle->is_target_suspend_acked);
 	qdf_atomic_init(&wmi_handle->num_stats_over_qmi);
 	wmi_runtime_pm_init(wmi_handle);
 	wmi_interface_logging_init(wmi_handle, WMI_HOST_PDEV_ID_0);
@@ -3515,6 +3516,19 @@ void wmi_set_target_suspend(wmi_unified_t wmi_handle, A_BOOL val)
 	qdf_atomic_set(&wmi_handle->is_target_suspended, val);
 }
 
+/**
+ * wmi_set_target_suspend_acked() -  WMI API to set target suspend acked flag
+ *
+ * @wmi_handle: handle to WMI.
+ * @val: target suspend command acked flag.
+ *
+ * @Return: none.
+ */
+void wmi_set_target_suspend_acked(wmi_unified_t wmi_handle, A_BOOL val)
+{
+	qdf_atomic_set(&wmi_handle->is_target_suspend_acked, val);
+}
+
 /**
  * wmi_is_target_suspended() - WMI API to check target suspend state
  * @wmi_handle: handle to WMI.
@@ -3529,6 +3543,21 @@ bool wmi_is_target_suspended(struct wmi_unified *wmi_handle)
 }
 qdf_export_symbol(wmi_is_target_suspended);
 
+/**
+ * wmi_is_target_suspend_acked() - WMI API to check target suspend command is
+ *                                 acked or not
+ * @wmi_handle: handle to WMI.
+ *
+ * WMI API to check whether the target suspend command is acked or not
+ *
+ * Return: true if target suspend command is acked, else false.
+ */
+bool wmi_is_target_suspend_acked(struct wmi_unified *wmi_handle)
+{
+	return qdf_atomic_read(&wmi_handle->is_target_suspend_acked);
+}
+qdf_export_symbol(wmi_is_target_suspend_acked);
+
 #ifdef WLAN_FEATURE_WMI_SEND_RECV_QMI
 void wmi_set_qmi_stats(wmi_unified_t wmi_handle, bool val)
 {

+ 1 - 1
wmi/src/wmi_unified_tlv.c

@@ -723,7 +723,7 @@ QDF_STATUS wmi_unified_cmd_send_pm_chk(struct wmi_unified *wmi_handle,
 	if (!wmi_is_qmi_stats_enabled(wmi_handle))
 		goto send_over_wmi;
 
-	if (wmi_is_target_suspended(wmi_handle)) {
+	if (wmi_is_target_suspend_acked(wmi_handle)) {
 		if (QDF_IS_STATUS_SUCCESS(
 		    wmi_unified_cmd_send_over_qmi(wmi_handle, buf,
 						  buflen, cmd_id)))