From e73dca7918cf91bcbe6127f926f1cb07dfd8c6de Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Mon, 12 Oct 2020 13:07:33 +0530 Subject: [PATCH] qcacmn: Increment htc runtime cnt prior to hif_send_head HTC runtime count is incremented after posting the HTT ver req message to CE4. There could be possibility of processing the ver response message from FW even before htc_runtime_cnt is incremented. This can casue RTPM put to not happen causing imbalance in get/put count. Fix is to increment htc_runtime_cnt before enqueuing the HTT message to CE. Change-Id: Ib9b69910cd14193c41ecfee804b390f8a6cdef49 CRs-Fixed: 2794451 --- dp/wifi3.0/dp_htt.c | 2 ++ dp/wifi3.0/dp_htt.h | 2 ++ htc/htc_send.c | 9 +++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index 8f6bbc469ec9..ccfa70268f41 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -4571,6 +4571,8 @@ static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt) */ if (htc_dec_return_runtime_cnt(soc->htc_soc) >= 0) htc_pm_runtime_put(soc->htc_soc); + else + soc->stats.htt_ver_req_put_skip++; soc->tgt_ver.major = HTT_VER_CONF_MAJOR_GET(*msg_word); soc->tgt_ver.minor = HTT_VER_CONF_MINOR_GET(*msg_word); QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_LOW, diff --git a/dp/wifi3.0/dp_htt.h b/dp/wifi3.0/dp_htt.h index 86fd548f3f4c..9d1350c9132e 100644 --- a/dp/wifi3.0/dp_htt.h +++ b/dp/wifi3.0/dp_htt.h @@ -194,6 +194,8 @@ struct htt_soc { struct { int htc_err_cnt; int htc_pkt_free; + /* rtpm put skip count for ver req msg */ + int htt_ver_req_put_skip; } stats; HTT_TX_MUTEX_TYPE htt_tx_mutex; diff --git a/htc/htc_send.c b/htc/htc_send.c index bbf078ef0695..9d532f77000c 100644 --- a/htc/htc_send.c +++ b/htc/htc_send.c @@ -857,8 +857,10 @@ static QDF_STATUS htc_issue_packets(HTC_TARGET *target, if (pPacket->PktInfo.AsTx.Tag == HTC_TX_PACKET_TAG_RUNTIME_PUT) rt_put = true; else if (pPacket->PktInfo.AsTx.Tag == - HTC_TX_PACKET_TAG_RTPM_PUT_RC) + HTC_TX_PACKET_TAG_RTPM_PUT_RC) { rt_put_in_resp = true; + htc_inc_runtime_cnt(target); + } #if DEBUG_BUNDLE qdf_print(" Send single EP%d buffer size:0x%x, total:0x%x.", @@ -878,6 +880,8 @@ static QDF_STATUS htc_issue_packets(HTC_TARGET *target, netbuf, data_attr); if (status != QDF_STATUS_SUCCESS) { + if (rt_put_in_resp) + htc_dec_return_runtime_cnt((void *)target); if (pEndpoint->EpCallBacks.ep_padding_credit_update) { if (used_extra_tx_credit) { ctx = pEndpoint->EpCallBacks.pContext; @@ -945,9 +949,6 @@ static QDF_STATUS htc_issue_packets(HTC_TARGET *target, RTPM_ID_HTC); rt_put = false; } - - if (rt_put_in_resp) - htc_inc_runtime_cnt(target); } if (qdf_unlikely(QDF_IS_STATUS_ERROR(status))) {