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
This commit is contained in:
Dustin Brown 2016-10-03 16:27:59 -07:00 • committed by qcabuildsw
commit 105d790504
4 changed files with 66 additions and 3 deletions

View file

@ -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];
};
/*---------------------------------------------------------------------------

View file

@ -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

View file

@ -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;
}

View file

@ -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;
}