From baea27d52a371e9e08637e648cc838a295446c19 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Wed, 27 Apr 2016 13:29:30 +0530 Subject: [PATCH] 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 --- core/hdd/inc/wlan_hdd_power.h | 24 +++++++++++++++++++ core/hdd/src/wlan_hdd_power.c | 21 ++++++++++++++++ .../host_diag_log/inc/host_diag_core_event.h | 10 ++++++++ .../host_diag_log/inc/host_diag_event_defs.h | 1 + 4 files changed, 56 insertions(+) diff --git a/core/hdd/inc/wlan_hdd_power.h b/core/hdd/inc/wlan_hdd_power.h index 2ce7f2dd2957..d872fae107ac 100644 --- a/core/hdd/inc/wlan_hdd_power.h +++ b/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 */ diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 7961eb5a626d..a78ef1174af2 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/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); diff --git a/core/utils/host_diag_log/inc/host_diag_core_event.h b/core/utils/host_diag_log/inc/host_diag_core_event.h index f2929c4f7b40..91d87f90e527 100644 --- a/core/utils/host_diag_log/inc/host_diag_core_event.h +++ b/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 ------------------------------------------------------------------------*/ diff --git a/core/utils/host_diag_log/inc/host_diag_event_defs.h b/core/utils/host_diag_log/inc/host_diag_event_defs.h index ed174e12d54b..65dcab2d07f6 100644 --- a/core/utils/host_diag_log/inc/host_diag_event_defs.h +++ b/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;