Explorar el Código

qcacld-3.0: Add diag event for suspend and resume

qcacld-2.0 to qcacld-3.0 propagation

Add diag event for EVENT_WLAN_SUSPEND_RESUME.
This contains info if driver has entered early suspend, suspend,
early resume or resume state.

Change-Id: Ic9bb815667ea9203d44a3c3cfcecbdbae573e717
CRs-Fixed: 934452
Abhishek Singh hace 9 años
padre
commit
baea27d52a

+ 24 - 0
core/hdd/inc/wlan_hdd_power.h

@@ -126,6 +126,22 @@ struct pkt_filter_cfg {
 
 #endif
 
+/**
+ * enum suspend_resume_state - Suspend resume state
+ * @HDD_WLAN_EARLY_SUSPEND: Early suspend state.
+ * @HDD_WLAN_SUSPEND: Suspend state.
+ * @HDD_WLAN_EARLY_RESUME: Early resume state.
+ * @HDD_WLAN_RESUME: Resume state.
+ *
+ * Suspend state to indicate in diag event of suspend resume.
+ */
+enum suspend_resume_state {
+	 HDD_WLAN_EARLY_SUSPEND,
+	 HDD_WLAN_SUSPEND,
+	 HDD_WLAN_EARLY_RESUME,
+	 HDD_WLAN_RESUME
+};
+
 
 /* SSR shutdown & re-init functions */
 QDF_STATUS hdd_wlan_shutdown(void);
@@ -171,4 +187,12 @@ int wlan_hdd_ipv4_changed(struct notifier_block *nb,
 int wlan_hdd_ipv6_changed(struct notifier_block *nb,
 				unsigned long data, void *arg);
 
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+void hdd_wlan_suspend_resume_event(uint8_t state);
+#else
+static inline
+void hdd_wlan_suspend_resume_event(uint8_t state) {}
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+
+
 #endif /* __WLAN_HDD_POWER_H */

+ 21 - 0
core/hdd/src/wlan_hdd_power.c

@@ -87,6 +87,25 @@ enum hdd_power_mode {
 	DRIVER_POWER_MODE_ACTIVE = 1,
 };
 
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+/**
+ * hdd_wlan_suspend_resume_event()- send suspend/resume state
+ * @state: suspend/resume state
+ *
+ * This Function send send suspend resume state diag event
+ *
+ * Return: void.
+ */
+void hdd_wlan_suspend_resume_event(uint8_t state)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(suspend_state, struct host_event_suspend);
+	qdf_mem_zero(&suspend_state, sizeof(suspend_state));
+
+	suspend_state.state = state;
+	WLAN_HOST_DIAG_EVENT_REPORT(&suspend_state, EVENT_WLAN_SUSPEND_RESUME);
+}
+#endif
+
 /* Function and variables declarations */
 
 extern struct notifier_block hdd_netdev_notifier;
@@ -1137,6 +1156,7 @@ hdd_suspend_wlan(void (*callback)(void *callbackContext, bool suspended),
 			callbackContext);
 
 	pHddCtx->hdd_wlan_suspended = true;
+	hdd_wlan_suspend_resume_event(HDD_WLAN_EARLY_SUSPEND);
 
 	return;
 }
@@ -1170,6 +1190,7 @@ static void hdd_resume_wlan(void)
 	}
 
 	pHddCtx->hdd_wlan_suspended = false;
+	hdd_wlan_suspend_resume_event(HDD_WLAN_EARLY_RESUME);
 
 	/*loop through all adapters. Concurrency */
 	status = hdd_get_front_adapter(pHddCtx, &pAdapterNode);

+ 10 - 0
core/utils/host_diag_log/inc/host_diag_core_event.h

@@ -327,6 +327,16 @@ struct host_event_tdls_enable_link {
 	uint8_t   is_off_chan_established;
 };
 
+/**
+ * struct host_event_suspend - suspend/resume state
+ * @state: suspend/resume state
+ *
+ * This structure contains suspend resume diag event info
+ */
+struct host_event_suspend {
+	uint8_t state;
+};
+
 /*-------------------------------------------------------------------------
    Function declarations and documenation
    ------------------------------------------------------------------------*/

+ 1 - 0
core/utils/host_diag_log/inc/host_diag_event_defs.h

@@ -56,6 +56,7 @@ typedef enum {
 	EVENT_WLAN_LOG_COMPLETE = 0xAA7, /* 16 bytes payload */
 	EVENT_WLAN_TDLS_TEARDOWN = 0xAB5,
 	EVENT_WLAN_TDLS_ENABLE_LINK = 0XAB6,
+	EVENT_WLAN_SUSPEND_RESUME = 0xAB7,
 
 	EVENT_MAX_ID = 0x0FFF
 } event_id_enum_type;