qcacmn: add runtime PM stats for HTC layer
Runtime PM for HTC layer has multiple cases of GET/PUT operations. Adding runtime PM stats for HTC layer, this helps in debugging RTPM GET/PUT out of sync issues. Change-Id: Ib27efd73dce0bb5bd3ff030bd7ae1bc833f29610 CRs-Fixed: 2923250
This commit is contained in:

committed by
Madan Koyyalamudi

parent
bdb8bb9c35
commit
42c4fca998
@@ -1074,6 +1074,28 @@ enum hif_pm_link_state {
|
||||
HIF_PM_LINK_STATE_UP
|
||||
};
|
||||
|
||||
/**
|
||||
* enum hif_pm_htc_stats - hif runtime PM stats for HTC layer
|
||||
* HIF_PM_HTC_STATS_GET_HTT_RESPONSE: PM stats for RTPM GET for HTT packets
|
||||
with response
|
||||
* HIF_PM_HTC_STATS_GET_HTT_NO_RESPONSE: PM stats for RTPM GET for HTT packets
|
||||
with no response
|
||||
* HIF_PM_HTC_STATS_PUT_HTT_RESPONSE: PM stats for RTPM PUT for HTT packets
|
||||
with response
|
||||
* HIF_PM_HTC_STATS_PUT_HTT_NO_RESPONSE: PM stats for RTPM PUT for HTT packets
|
||||
with no response
|
||||
* HIF_PM_HTC_STATS_PUT_HTT_ERROR: PM stats for RTPM PUT for failed HTT packets
|
||||
* HIF_PM_HTC_STATS_PUT_HTC_CLEANUP: PM stats for RTPM PUT during HTC cleanup
|
||||
*/
|
||||
enum hif_pm_htc_stats {
|
||||
HIF_PM_HTC_STATS_GET_HTT_RESPONSE,
|
||||
HIF_PM_HTC_STATS_GET_HTT_NO_RESPONSE,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_RESPONSE,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_NO_RESPONSE,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_ERROR,
|
||||
HIF_PM_HTC_STATS_PUT_HTC_CLEANUP,
|
||||
};
|
||||
|
||||
#ifdef FEATURE_RUNTIME_PM
|
||||
struct hif_pm_runtime_lock;
|
||||
|
||||
@@ -1111,6 +1133,9 @@ void hif_pm_runtime_mark_dp_rx_busy(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_pm_runtime_is_dp_rx_busy(struct hif_opaque_softc *hif_ctx);
|
||||
qdf_time_t hif_pm_runtime_get_dp_rx_busy_mark(struct hif_opaque_softc *hif_ctx);
|
||||
int hif_pm_runtime_sync_resume(struct hif_opaque_softc *hif_ctx);
|
||||
void hif_pm_runtime_update_stats(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid,
|
||||
enum hif_pm_htc_stats stats);
|
||||
|
||||
/**
|
||||
* hif_pm_set_link_state() - set link state during RTPM
|
||||
@@ -1205,6 +1230,11 @@ static inline
|
||||
void hif_pm_set_link_state(struct hif_opaque_softc *hif_handle, uint8_t val)
|
||||
{}
|
||||
|
||||
static inline
|
||||
void hif_pm_runtime_update_stats(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid,
|
||||
enum hif_pm_htc_stats stats)
|
||||
{}
|
||||
#endif
|
||||
|
||||
void hif_enable_power_management(struct hif_opaque_softc *hif_ctx,
|
||||
|
@@ -1806,4 +1806,57 @@ uint8_t hif_pm_get_link_state(struct hif_opaque_softc *hif_handle)
|
||||
|
||||
return qdf_atomic_read(&scn->pm_link_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_pm_runtime_update_stats() - API to update RTPM stats for HTC layer
|
||||
* @scn: hif context
|
||||
* @rtpm_dbgid: RTPM dbg_id
|
||||
* @hif_pm_htc_stats: Stats category
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hif_pm_runtime_update_stats(struct hif_opaque_softc *hif_ctx,
|
||||
wlan_rtpm_dbgid rtpm_dbgid,
|
||||
enum hif_pm_htc_stats stats)
|
||||
{
|
||||
struct hif_softc *scn = HIF_GET_SOFTC(hif_ctx);
|
||||
struct hif_runtime_pm_ctx *rpm_ctx;
|
||||
|
||||
if (rtpm_dbgid != RTPM_ID_HTC)
|
||||
return;
|
||||
|
||||
if (!scn)
|
||||
return;
|
||||
|
||||
if (!hif_pci_pm_runtime_enabled(scn))
|
||||
return;
|
||||
|
||||
rpm_ctx = hif_bus_get_rpm_ctx(scn);
|
||||
if (!rpm_ctx)
|
||||
return;
|
||||
|
||||
switch (stats) {
|
||||
case HIF_PM_HTC_STATS_GET_HTT_RESPONSE:
|
||||
rpm_ctx->pm_stats.pm_stats_htc.rtpm_get_htt_resp++;
|
||||
break;
|
||||
case HIF_PM_HTC_STATS_GET_HTT_NO_RESPONSE:
|
||||
rpm_ctx->pm_stats.pm_stats_htc.rtpm_get_htt_no_resp++;
|
||||
break;
|
||||
case HIF_PM_HTC_STATS_PUT_HTT_RESPONSE:
|
||||
rpm_ctx->pm_stats.pm_stats_htc.rtpm_put_htt_resp++;
|
||||
break;
|
||||
case HIF_PM_HTC_STATS_PUT_HTT_NO_RESPONSE:
|
||||
rpm_ctx->pm_stats.pm_stats_htc.rtpm_put_htt_no_resp++;
|
||||
break;
|
||||
case HIF_PM_HTC_STATS_PUT_HTT_ERROR:
|
||||
rpm_ctx->pm_stats.pm_stats_htc.rtpm_put_htt_error++;
|
||||
break;
|
||||
case HIF_PM_HTC_STATS_PUT_HTC_CLEANUP:
|
||||
rpm_ctx->pm_stats.pm_stats_htc.rtpm_put_htc_cleanup++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* FEATURE_RUNTIME_PM */
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013-2021 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 above
|
||||
@@ -48,6 +48,16 @@ struct hif_pm_runtime_lock {
|
||||
const char *name;
|
||||
};
|
||||
|
||||
/* Debugging stats for RTPM for HTC layer */
|
||||
struct hif_pm_runtime_htc_stats {
|
||||
uint32_t rtpm_get_htt_resp;
|
||||
uint32_t rtpm_get_htt_no_resp;
|
||||
uint32_t rtpm_put_htt_resp;
|
||||
uint32_t rtpm_put_htt_no_resp;
|
||||
uint32_t rtpm_put_htt_error;
|
||||
uint32_t rtpm_put_htc_cleanup;
|
||||
};
|
||||
|
||||
/* Debugging stats for Runtime PM */
|
||||
struct hif_pci_pm_stats {
|
||||
u32 suspended;
|
||||
@@ -69,6 +79,7 @@ struct hif_pci_pm_stats {
|
||||
void *last_busy_marker;
|
||||
qdf_time_t last_busy_timestamp;
|
||||
unsigned long suspend_jiffies;
|
||||
struct hif_pm_runtime_htc_stats pm_stats_htc;
|
||||
};
|
||||
|
||||
struct hif_runtime_pm_ctx {
|
||||
|
10
htc/htc.c
10
htc/htc.c
@@ -154,8 +154,11 @@ static void htc_cleanup(HTC_TARGET *target)
|
||||
HTC_PACKET_QUEUE *pkt_queue;
|
||||
qdf_nbuf_t netbuf;
|
||||
|
||||
while (htc_dec_return_runtime_cnt((void *)target) >= 0)
|
||||
while (htc_dec_return_runtime_cnt((void *)target) >= 0) {
|
||||
hif_pm_runtime_put(target->hif_dev, RTPM_ID_HTC);
|
||||
hif_pm_runtime_update_stats(target->hif_dev, RTPM_ID_HTC,
|
||||
HIF_PM_HTC_STATS_PUT_HTC_CLEANUP);
|
||||
}
|
||||
|
||||
if (target->hif_dev) {
|
||||
hif_detach_htc(target->hif_dev);
|
||||
@@ -1181,8 +1184,9 @@ int htc_pm_runtime_put(HTC_HANDLE htc_handle)
|
||||
{
|
||||
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle);
|
||||
|
||||
return hif_pm_runtime_put(target->hif_dev,
|
||||
RTPM_ID_HTC);
|
||||
hif_pm_runtime_update_stats(target->hif_dev, RTPM_ID_HTC,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_RESPONSE);
|
||||
return hif_pm_runtime_put(target->hif_dev, RTPM_ID_HTC);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -863,12 +863,18 @@ static QDF_STATUS htc_issue_packets(HTC_TARGET *target,
|
||||
* do the runtime put here.
|
||||
* otherwise runtime put will be done when the fw response comes
|
||||
*/
|
||||
if (pPacket->PktInfo.AsTx.Tag == HTC_TX_PACKET_TAG_RUNTIME_PUT)
|
||||
if (pPacket->PktInfo.AsTx.Tag == HTC_TX_PACKET_TAG_RUNTIME_PUT) {
|
||||
rt_put = true;
|
||||
else if (pPacket->PktInfo.AsTx.Tag ==
|
||||
hif_pm_runtime_update_stats(
|
||||
target->hif_dev, RTPM_ID_HTC,
|
||||
HIF_PM_HTC_STATS_GET_HTT_NO_RESPONSE);
|
||||
} else if (pPacket->PktInfo.AsTx.Tag ==
|
||||
HTC_TX_PACKET_TAG_RTPM_PUT_RC) {
|
||||
rt_put_in_resp = true;
|
||||
htc_inc_runtime_cnt(target);
|
||||
hif_pm_runtime_update_stats(
|
||||
target->hif_dev, RTPM_ID_HTC,
|
||||
HIF_PM_HTC_STATS_GET_HTT_RESPONSE);
|
||||
}
|
||||
|
||||
#if DEBUG_BUNDLE
|
||||
@@ -962,6 +968,9 @@ static QDF_STATUS htc_issue_packets(HTC_TARGET *target,
|
||||
if (rt_put) {
|
||||
hif_pm_runtime_put(target->hif_dev,
|
||||
RTPM_ID_HTC);
|
||||
hif_pm_runtime_update_stats(
|
||||
target->hif_dev, RTPM_ID_HTC,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_NO_RESPONSE);
|
||||
rt_put = false;
|
||||
}
|
||||
}
|
||||
@@ -1694,9 +1703,13 @@ static enum HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
|
||||
rtpm_dbgid =
|
||||
htc_send_pkts_rtpm_dbgid_get(
|
||||
pEndpoint->service_id);
|
||||
for (i = HTC_PACKET_QUEUE_DEPTH(&sendQueue); i > 0; i--)
|
||||
for (i = HTC_PACKET_QUEUE_DEPTH(&sendQueue); i > 0; i--) {
|
||||
hif_pm_runtime_put(target->hif_dev,
|
||||
rtpm_dbgid);
|
||||
hif_pm_runtime_update_stats(
|
||||
target->hif_dev, rtpm_dbgid,
|
||||
HIF_PM_HTC_STATS_PUT_HTT_ERROR);
|
||||
}
|
||||
|
||||
if (!pEndpoint->async_update) {
|
||||
LOCK_HTC_TX(target);
|
||||
|
Reference in New Issue
Block a user