qcacmn: Do runtime pm sync resume when printing ring stats

Printing ring stats from requesting txrx stats needs access PCIe link
so make sure it is resumed by doing a sync resume if it is runtime PM
suspended. Also response of h2t_ext_stats_msg from FW is not guaranteed
so tag it properly so that in HTC layer, corresponding "put" API will
be called right after sending the packet.

Change-Id: Idc5797b38557ed5779d920c72200b9d28769ab58
CRs-fixed: 2487521
This commit is contained in:
Yue Ma
2019-07-16 18:47:52 -07:00
committed by nshrivas
parent 8eda31cab3
commit e92fe029df
4 changed files with 49 additions and 1 deletions

View File

@@ -3765,7 +3765,8 @@ QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
dp_htt_h2t_send_complete_free_netbuf, dp_htt_h2t_send_complete_free_netbuf,
qdf_nbuf_data(msg), qdf_nbuf_len(msg), qdf_nbuf_data(msg), qdf_nbuf_len(msg),
soc->htc_endpoint, soc->htc_endpoint,
1); /* tag - not relevant here */ /* tag for FW response msg not guaranteed */
HTC_TX_PACKET_TAG_RUNTIME_PUT);
SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_EXT_STATS_REQ, DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_EXT_STATS_REQ,

View File

@@ -4587,6 +4587,9 @@ dp_print_ring_stats(struct dp_pdev *pdev)
uint32_t i; uint32_t i;
int mac_id; int mac_id;
if (hif_pm_runtime_get_sync(pdev->soc->hif_handle))
return;
dp_print_ring_stat_from_hal(pdev->soc, dp_print_ring_stat_from_hal(pdev->soc,
&pdev->soc->reo_exception_ring, &pdev->soc->reo_exception_ring,
REO_EXCEPTION); REO_EXCEPTION);
@@ -4645,6 +4648,8 @@ dp_print_ring_stats(struct dp_pdev *pdev)
dp_print_ring_stat_from_hal(pdev->soc, dp_print_ring_stat_from_hal(pdev->soc,
&pdev->rxdma_err_dst_ring[i], &pdev->rxdma_err_dst_ring[i],
RXDMA_DST); RXDMA_DST);
hif_pm_runtime_put(pdev->soc->hif_handle);
} }
/** /**

View File

@@ -844,6 +844,7 @@ void hif_clear_stats(struct hif_opaque_softc *hif_ctx);
#ifdef FEATURE_RUNTIME_PM #ifdef FEATURE_RUNTIME_PM
struct hif_pm_runtime_lock; struct hif_pm_runtime_lock;
void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx); void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx); int hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx);
int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx); int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx);
void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx); void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx);
@@ -867,6 +868,8 @@ struct hif_pm_runtime_lock {
const char *name; const char *name;
}; };
static inline void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx) {} static inline void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx) {}
static inline int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx)
{ return 0; }
static inline int static inline int
hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx) hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx)
{ return 0; } { return 0; }

View File

@@ -3867,6 +3867,45 @@ void hif_pci_irq_disable(struct hif_softc *scn, int ce_id)
} }
#ifdef FEATURE_RUNTIME_PM #ifdef FEATURE_RUNTIME_PM
/**
* hif_pm_runtime_get_sync() - do a get opperation with sync resume
*
* A get opperation will prevent a runtime suspend until a corresponding
* put is done. Unlike hif_pm_runtime_get(), this API will do a sync
* resume instead of requesting a resume if it is runtime PM suspended
* so it can only be called in non-atomic context.
*
* @hif_ctx: pointer of HIF context
*
* Return: 0 if it is runtime PM resumed otherwise an error code.
*/
int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx)
{
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx);
int ret;
if (!sc)
return -EINVAL;
sc->pm_stats.runtime_get++;
ret = pm_runtime_get_sync(sc->dev);
/* Get can return 1 if the device is already active, just return
* success in that case.
*/
if (ret > 0)
ret = 0;
if (ret) {
sc->pm_stats.runtime_get_err++;
HIF_ERROR("Runtime PM Get Sync error in pm_state: %d, ret: %d",
qdf_atomic_read(&sc->pm_state), ret);
hif_pm_runtime_put(hif_ctx);
}
return ret;
}
int hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx) int hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx)
{ {
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx); struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(hif_ctx);