diff options
| author | Yun Park <yunp@codeaurora.org> | 2017-03-08 11:26:37 -0800 |
|---|---|---|
| committer | Prakash Dhavali <pdhavali@codeaurora.org> | 2017-03-09 21:08:41 -0800 |
| commit | 9cb00a8505d703a3999c4042c0af3cdef8f8e6d8 (patch) | |
| tree | b2a9c5b035ef3e5fa754814788963a80f06cacea | |
| parent | a8ce0c5aa4f33037c64a584eb2d61e48a047d718 (diff) | |
qcacld-3.0: Fix an htt memory leak
qcacld-2.0 to qcacld-3.0 propagation
With ATH_11AC_TXCOMPACT defined, host to target message send-completion
won't be called and messages are stored in htt_htc_pkt_misclist after
sending to HTC layer which will be freed upon htt_detach. This list
doesn't have a size limit and outgrow with more messages.
Add a fix to limit the size of this list which gives enough time for
firmware to process these messages before releasing it.
Change-Id: I6feb2d5700abe81a21dd93303163202616c739f5
CRs-Fixed: 902909
| -rw-r--r-- | core/dp/htt/htt.c | 30 | ||||
| -rw-r--r-- | core/dp/htt/htt_internal.h | 2 | ||||
| -rw-r--r-- | core/dp/htt/htt_types.h | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/core/dp/htt/htt.c b/core/dp/htt/htt.c index 61c5936a893c..9fc162d2baaa 100644 --- a/core/dp/htt/htt.c +++ b/core/dp/htt/htt.c @@ -106,6 +106,34 @@ void htt_htc_pkt_pool_free(struct htt_pdev_t *pdev) } #ifdef ATH_11AC_TXCOMPACT + +void +htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev, int level) +{ + struct htt_htc_pkt_union *pkt, *next, *prev = NULL; + int i = 0; + qdf_nbuf_t netbuf; + + HTT_TX_MUTEX_ACQUIRE(&pdev->htt_tx_mutex); + pkt = pdev->htt_htc_pkt_misclist; + while (pkt) { + next = pkt->u.next; + /* trim the out grown list*/ + if (++i > level) { + netbuf = (qdf_nbuf_t)(pkt->u.pkt.htc_pkt.pNetBufContext); + qdf_nbuf_unmap(pdev->osdev, netbuf, QDF_DMA_TO_DEVICE); + qdf_nbuf_free(netbuf); + qdf_mem_free(pkt); + pkt = NULL; + if (prev) + prev->u.next = NULL; + } + prev = pkt; + pkt = next; + } + HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex); +} + void htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt) { struct htt_htc_pkt_union *u_pkt = (struct htt_htc_pkt_union *)pkt; @@ -118,6 +146,8 @@ void htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt) pdev->htt_htc_pkt_misclist = u_pkt; } HTT_TX_MUTEX_RELEASE(&pdev->htt_tx_mutex); + + htt_htc_misc_pkt_list_trim(pdev, HTT_HTC_PKT_MISCLIST_SIZE); } void htt_htc_misc_pkt_pool_free(struct htt_pdev_t *pdev) diff --git a/core/dp/htt/htt_internal.h b/core/dp/htt/htt_internal.h index 673df242abd7..0020e419c221 100644 --- a/core/dp/htt/htt_internal.h +++ b/core/dp/htt/htt_internal.h @@ -525,6 +525,8 @@ void htt_htc_pkt_free(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt); void htt_htc_pkt_pool_free(struct htt_pdev_t *pdev); #ifdef ATH_11AC_TXCOMPACT +void htt_htc_misc_pkt_list_trim(struct htt_pdev_t *pdev, int level); + void htt_htc_misc_pkt_list_add(struct htt_pdev_t *pdev, struct htt_htc_pkt *pkt); diff --git a/core/dp/htt/htt_types.h b/core/dp/htt/htt_types.h index 6828e8887c87..e60e07de543d 100644 --- a/core/dp/htt/htt_types.h +++ b/core/dp/htt/htt_types.h @@ -48,6 +48,7 @@ #endif #endif /* QCA_TX_HTT2_SUPPORT */ +#define HTT_HTC_PKT_MISCLIST_SIZE 32 struct htt_htc_pkt { void *pdev_ctxt; |
