Browse Source

qcacld-3.0: 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: I1b2b6a60c5d8c7ec4375d328e58a66d749794e3f
CRs-Fixed: 2835903
Bapiraju Alla 4 years ago
parent
commit
19f4eb9bb6

+ 8 - 6
components/pmo/core/src/wlan_pmo_suspend_resume.c

@@ -847,6 +847,8 @@ pmo_core_enable_wow_in_fw(struct wlan_objmgr_psoc *psoc,
 		goto out;
 	}
 
+	pmo_tgt_update_target_suspend_acked_flag(psoc, true);
+
 	host_credits = pmo_tgt_psoc_get_host_credits(psoc);
 	wmi_pending_cmds = pmo_tgt_psoc_get_pending_cmnds(psoc);
 
@@ -895,6 +897,8 @@ QDF_STATUS pmo_core_psoc_suspend_target(struct wlan_objmgr_psoc *psoc,
 		pmo_tgt_update_target_suspend_flag(psoc, false);
 		if (!psoc_ctx->wow.target_suspend.force_set)
 			qdf_trigger_self_recovery(psoc, QDF_SUSPEND_TIMEOUT);
+	} else {
+		pmo_tgt_update_target_suspend_acked_flag(psoc, true);
 	}
 
 out:
@@ -1232,10 +1236,9 @@ QDF_STATUS pmo_core_psoc_send_host_wakeup_ind_to_fw(
 			qdf_trigger_self_recovery(psoc, QDF_RESUME_TIMEOUT);
 	} else {
 		pmo_debug("Host wakeup received");
-	}
-
-	if (status == QDF_STATUS_SUCCESS)
 		pmo_tgt_update_target_suspend_flag(psoc, false);
+		pmo_tgt_update_target_suspend_acked_flag(psoc, false);
+	}
 out:
 	pmo_exit();
 
@@ -1305,10 +1308,9 @@ QDF_STATUS pmo_core_psoc_resume_target(struct wlan_objmgr_psoc *psoc,
 			qdf_trigger_self_recovery(psoc, QDF_RESUME_TIMEOUT);
 	} else {
 		pmo_debug("Host wakeup received");
-	}
-
-	if (status == QDF_STATUS_SUCCESS)
 		pmo_tgt_update_target_suspend_flag(psoc, false);
+		pmo_tgt_update_target_suspend_acked_flag(psoc, false);
+	}
 out:
 	pmo_exit();
 

+ 3 - 1
components/pmo/dispatcher/inc/wlan_pmo_obj_mgmt_public_struct.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 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
@@ -209,6 +209,8 @@ struct wlan_pmo_tx_ops {
 			struct wlan_objmgr_psoc *psoc);
 	void (*update_target_suspend_flag)(
 		struct wlan_objmgr_psoc *psoc, uint8_t value);
+	void (*update_target_suspend_acked_flag)(
+		struct wlan_objmgr_psoc *psoc, uint8_t value);
 	bool (*is_target_suspended)(struct wlan_objmgr_psoc *psoc);
 	QDF_STATUS (*psoc_send_wow_enable_req)(struct wlan_objmgr_psoc *psoc,
 		struct pmo_wow_cmd_params *param);

+ 14 - 3
components/pmo/dispatcher/inc/wlan_pmo_tgt_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 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
@@ -377,10 +377,21 @@ int pmo_tgt_psoc_get_pending_cmnds(struct wlan_objmgr_psoc *psoc);
  * @psoc: objmgr psoc
  * @val: true on suspend false for resume
  *
- * Return: Pending WMI commands on success else EAGAIN on error
+ * Return: None
  */
 void pmo_tgt_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc,
-		uint8_t val);
+					uint8_t val);
+
+/**
+ * pmo_tgt_update_target_suspend_acked_flag() - Set WMI target Suspend acked
+ *                                              flag
+ * @psoc: objmgr psoc
+ * @val: true on suspend false for resume
+ *
+ * Return: None
+ */
+void pmo_tgt_update_target_suspend_acked_flag(struct wlan_objmgr_psoc *psoc,
+					      uint8_t val);
 
 /**
  * pmo_tgt_is_target_suspended() - Get WMI target Suspend flag

+ 14 - 1
components/pmo/dispatcher/src/wlan_pmo_tgt_suspend_resume.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 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
@@ -131,6 +131,19 @@ void pmo_tgt_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc,
 	pmo_tx_ops.update_target_suspend_flag(psoc, val);
 }
 
+void pmo_tgt_update_target_suspend_acked_flag(struct wlan_objmgr_psoc *psoc,
+					      uint8_t val)
+{
+	struct wlan_pmo_tx_ops pmo_tx_ops;
+
+	pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
+	if (!pmo_tx_ops.update_target_suspend_acked_flag) {
+		pmo_err("update_target_suspend_acked_flag is null");
+		return;
+	}
+	pmo_tx_ops.update_target_suspend_acked_flag(psoc, val);
+}
+
 bool pmo_tgt_is_target_suspended(struct wlan_objmgr_psoc *psoc)
 {
 	struct wlan_pmo_tx_ops pmo_tx_ops;

+ 14 - 2
components/target_if/pmo/inc/target_if_pmo.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 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
@@ -382,11 +382,23 @@ int target_if_pmo_psoc_get_pending_cmnds(struct wlan_objmgr_psoc *psoc);
  * @psoc: objmgr psoc
  * @value: value
  *
- * Return: return wmi pending commands
+ * Return: None
  */
 void target_if_pmo_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc,
 		uint8_t value);
 
+/**
+ * target_if_pmo_update_target_suspend_acked_flag() - set wmi target suspend
+ *                                                    acked flag
+ * @psoc: objmgr psoc
+ * @value: value
+ *
+ * Return: None
+ */
+void target_if_pmo_update_target_suspend_acked_flag(
+						struct wlan_objmgr_psoc *psoc,
+						uint8_t value);
+
 /**
  * target_if_pmo_is_target_suspended() - get wmi target suspend flag
  * @psoc: objmgr psoc

+ 3 - 1
components/target_if/pmo/src/target_if_pmo_main.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 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
@@ -103,6 +103,8 @@ void target_if_pmo_register_tx_ops(struct wlan_pmo_tx_ops *pmo_tx_ops)
 		target_if_pmo_psoc_get_pending_cmnds;
 	pmo_tx_ops->update_target_suspend_flag =
 		target_if_pmo_update_target_suspend_flag;
+	pmo_tx_ops->update_target_suspend_acked_flag =
+		target_if_pmo_update_target_suspend_acked_flag;
 	pmo_tx_ops->is_target_suspended =
 		target_if_pmo_is_target_suspended;
 	pmo_tx_ops->psoc_send_wow_enable_req =

+ 15 - 0
components/target_if/pmo/src/target_if_pmo_suspend_resume.c

@@ -201,6 +201,21 @@ void target_if_pmo_update_target_suspend_flag(struct wlan_objmgr_psoc *psoc,
 	wmi_set_target_suspend(wmi_handle, value);
 }
 
+void target_if_pmo_update_target_suspend_acked_flag(
+					struct wlan_objmgr_psoc *psoc,
+					uint8_t value)
+{
+	wmi_unified_t wmi_handle;
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("Invalid wmi handle");
+		return;
+	}
+
+	wmi_set_target_suspend_acked(wmi_handle, value);
+}
+
 bool target_if_pmo_is_target_suspended(struct wlan_objmgr_psoc *psoc)
 {
 	wmi_unified_t wmi_handle;