Skip to contentSkip to conversation

ath10k: htt fixes

PATCH New Michal Kazior 2 participants 4 messages Apr 24, 2013 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath10k: htt fixes

This one addresses a rare memory leak when FW hangs leaving some HTT tx transactions unfinished.

Michal Kazior (2):
ath10k: clear pending_tx[] upon tx completion
ath10k: cleanup htt pending tx

 drivers/net/wireless/ath/ath10k/htt_tx.c |   28 ++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/txrx.c   |    1 +
 2 files changed, 29 insertions(+)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 ath10k: clear pending_tx[] upon tx completion

We validate the pending_tx[] upon tx completion so it makes sense to clear the items.

---
 drivers/net/wireless/ath/ath10k/txrx.c |    1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath10k/txrx.c +1 -0
index ea99d06..cfe3b52 100644
@@ -93,6 +93,7 @@ void ath10k_txrx_tx_unref(struct ath10k_htt *htt, struct sk_buff *txdesc)
 
 exit:
 	spin_lock_bh(&htt->tx_lock);
+	htt->pending_tx[ATH10K_SKB_CB(txdesc)->htt.msdu_id] = NULL;
 	ath10k_htt_tx_free_msdu_id(htt, ATH10K_SKB_CB(txdesc)->htt.msdu_id);
 	if (bitmap_empty(htt->used_msdu_ids, HTT_MAX_NUM_PENDING_TX))
 		wake_up(&htt->empty_tx_wq);
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 ath10k: cleanup htt pending tx

In reply to Michal Kazior

This fixes memory leak. It could be seen in the
following scenario:

* submit htt tx frame
* receive htc tx completion
* FW hangs
* rmmod
* txed frame never freed

---
 drivers/net/wireless/ath/ath10k/htt_tx.c |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/net/wireless/ath/ath10k/htt_tx.c +28 -0
index 2058923..7ac3681 100644
@@ -53,8 +53,36 @@ void ath10k_htt_tx_attach(struct ath10k_htt *htt)
 	init_waitqueue_head(&htt->empty_tx_wq);
 }
 
+static void ath10k_htt_tx_cleanup_pending(struct ath10k_htt *htt)
+{
+	struct sk_buff *txdesc;
+	int msdu_id;
+
+	/* No locks needed. Called after communication with the device has
+	 * been stopped. */
+
+	for (msdu_id = 0; msdu_id < HTT_MAX_NUM_PENDING_TX; msdu_id++) {
+		if (!test_bit(msdu_id, htt->used_msdu_ids))
+			continue;
+
+		txdesc = htt->pending_tx[msdu_id];
+		if (!txdesc)
+			continue;
+
+		ath10k_dbg(ATH10K_DBG_HTT, "force cleanup msdu_id %hu\n",
+			   msdu_id);
+
+		if (ATH10K_SKB_CB(txdesc)->htt.refcount > 0)
+			ATH10K_SKB_CB(txdesc)->htt.refcount = 1;
+
+		ATH10K_SKB_CB(txdesc)->htt.discard = true;
+		ath10k_txrx_tx_unref(htt, txdesc);
+	}
+}
+
 void ath10k_htt_tx_detach(struct ath10k_htt *htt)
 {
+	ath10k_htt_tx_cleanup_pending(htt);
 	return;
 }
 
Signature · 1 line
1.7.9.5
Applied
#3 lore raw

cover ath10k: htt fixes

In reply to Michal Kazior
Quoted 6 lines · Michal Kazior

This one addresses a rare memory leak when FW hangs leaving some HTT tx transactions unfinished.

Michal Kazior (2):
ath10k: clear pending_tx[] upon tx completion
ath10k: cleanup htt pending tx

Thanks, applied.

Signature · 1 line
Kalle Valo