diff options
| author | Dustin Brown <dustinb@codeaurora.org> | 2016-10-03 16:27:59 -0700 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2016-10-10 13:01:03 -0700 |
| commit | 105d790504fe44853ff8e7d72f1342b62938e172 (patch) | |
| tree | b6e252be753340470c0a5fc6042281947402bf56 | |
| parent | d53d1a85c67919ebb07b28ec02131576d81b1644 (diff) | |
qcacld-3.0: Log suspend failure reasons
Increment counters for the various reasons a suspend might fail, and
log them via print messages at time of failure.
Change-Id: Ie1fb700577aee5f1b3a0d29277b81299a13dbde3
CRs-Fixed: 1073824
| -rw-r--r-- | core/hdd/inc/wlan_hdd_main.h | 22 | ||||
| -rw-r--r-- | core/hdd/inc/wlan_hdd_power.h | 14 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_driver_ops.c | 8 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_power.c | 25 |
4 files changed, 66 insertions, 3 deletions
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 7d9926e58aac..284cb7bce939 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1235,8 +1235,25 @@ struct acs_dfs_policy { uint8_t acs_channel; }; -/** Adapter structure definition */ +/** + * enum suspend_fail_reason: Reasons a WLAN suspend might fail + * SUSPEND_FAIL_IPA: IPA in progress + * SUSPEND_FAIL_RADAR: radar scan in progress + * SUSPEND_FAIL_ROAM: roaming in progress + * SUSPEND_FAIL_SCAN: scan in progress + * SUSPEND_FAIL_INITIAL_WAKEUP: received initial wakeup from firmware + * SUSPEND_FAIL_MAX_COUNT: the number of wakeup reasons, always at the end + */ +enum suspend_fail_reason { + SUSPEND_FAIL_IPA, + SUSPEND_FAIL_RADAR, + SUSPEND_FAIL_ROAM, + SUSPEND_FAIL_SCAN, + SUSPEND_FAIL_INITIAL_WAKEUP, + SUSPEND_FAIL_MAX_COUNT +}; +/** Adapter structure definition */ struct hdd_context_s { /** Global CDS context */ v_CONTEXT_t pcds_context; @@ -1510,6 +1527,9 @@ struct hdd_context_s { bool update_mac_addr_to_fw; struct acs_dfs_policy acs_policy; uint16_t wmi_max_len; + + /* counters for failed suspend reasons */ + uint32_t suspend_fail_stats[SUSPEND_FAIL_MAX_COUNT]; }; /*--------------------------------------------------------------------------- diff --git a/core/hdd/inc/wlan_hdd_power.h b/core/hdd/inc/wlan_hdd_power.h index fee466599820..abb69bd56e66 100644 --- a/core/hdd/inc/wlan_hdd_power.h +++ b/core/hdd/inc/wlan_hdd_power.h @@ -199,6 +199,20 @@ static inline void hdd_wlan_suspend_resume_event(uint8_t state) {} #endif /* FEATURE_WLAN_DIAG_SUPPORT */ +/** + * wlan_hdd_inc_suspend_stats() - Prints, then increments, then prints suspend + * failed statistics. + * @hdd_ctx: The HDD context to operate on + * @reason: The suspend failed reason to increment + * + * This function prints all of the suspend failed statistics, increments the + * specified suspend fail reason statistic, and prints the them all again. This + * is for easily keeping track of the most common reasons suspend fails. + * + * Return: none + */ +void wlan_hdd_inc_suspend_stats(hdd_context_t *hdd_ctx, + enum suspend_fail_reason reason); /* * Unit-test suspend/resume is a testing feature that allows putting firmware diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index a5a714834542..70295b12bcd0 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -618,10 +618,14 @@ resume_hif_noirq: status = hif_bus_resume_noirq(hif_ctx); QDF_BUG(!status); done: - if (err == -EAGAIN) + if (err == -EAGAIN) { hdd_err("Firmware attempting wakeup, try again"); - else + wlan_hdd_inc_suspend_stats(hdd_ctx, + SUSPEND_FAIL_INITIAL_WAKEUP); + } else { hdd_err("suspend_noirq failed, status = %d", err); + } + return err; } diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index ae0e24fed9c5..87fdfdacaa21 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1667,6 +1667,24 @@ static int wlan_hdd_set_powersave(hdd_adapter_t *adapter, return 0; } +static void wlan_hdd_print_suspend_fail_stats(hdd_context_t *hdd_ctx) +{ + hdd_err("ipa:%d, radar:%d, roam:%d, scan:%d, initial_wakeup:%d", + hdd_ctx->suspend_fail_stats[SUSPEND_FAIL_IPA], + hdd_ctx->suspend_fail_stats[SUSPEND_FAIL_RADAR], + hdd_ctx->suspend_fail_stats[SUSPEND_FAIL_ROAM], + hdd_ctx->suspend_fail_stats[SUSPEND_FAIL_SCAN], + hdd_ctx->suspend_fail_stats[SUSPEND_FAIL_INITIAL_WAKEUP]); +} + +void wlan_hdd_inc_suspend_stats(hdd_context_t *hdd_ctx, + enum suspend_fail_reason reason) +{ + wlan_hdd_print_suspend_fail_stats(hdd_ctx); + hdd_ctx->suspend_fail_stats[reason]++; + wlan_hdd_print_suspend_fail_stats(hdd_ctx); +} + /** * __wlan_hdd_cfg80211_resume_wlan() - cfg80211 resume callback * @wiphy: Pointer to wiphy @@ -1859,6 +1877,8 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, WLAN_HDD_GET_AP_CTX_PTR(pAdapter)-> dfs_cac_block_tx) { hdd_err("RADAR detection in progress, do not allow suspend"); + wlan_hdd_inc_suspend_stats(pHddCtx, + SUSPEND_FAIL_RADAR); return -EAGAIN; } else if (!pHddCtx->config->enableSapSuspend) { /* return -EOPNOTSUPP if SAP does not support @@ -1891,6 +1911,8 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, if (sme_sta_in_middle_of_roaming (pHddCtx->hHal, pAdapter->sessionId)) { hdd_err("Roaming in progress, do not allow suspend"); + wlan_hdd_inc_suspend_stats(pHddCtx, + SUSPEND_FAIL_ROAM); return -EAGAIN; } @@ -1905,6 +1927,8 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, msecs_to_jiffies(WLAN_WAIT_TIME_ABORTSCAN)); if (!status) { hdd_err("Timeout occurred while waiting for abort scan"); + wlan_hdd_inc_suspend_stats(pHddCtx, + SUSPEND_FAIL_SCAN); return -ETIME; } } @@ -1918,6 +1942,7 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, */ if (hdd_ipa_suspend(pHddCtx)) { hdd_err("IPA not ready to suspend!"); + wlan_hdd_inc_suspend_stats(pHddCtx, SUSPEND_FAIL_IPA); return -EAGAIN; } |
