Skip to contentSkip to conversation

wifi: ath11k: account TX before TCL publication

PATCH Superseded Giuseppe Piscitelli 1 participant 4 messages Nov 29 – Nov 30 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 wifi: ath11k: account TX before TCL publication

The host makes the TCL descriptor visible when it publishes the ring head. Completion processing can run before the subsequent pending count increment. Increment the count before publishing the ring head so a completion always has a pending frame to account for.

OpenAI Codex helped review the ordering and verify the AArch64 build.

Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")

---

drivers/net/wireless/ath/ath11k/dp_tx.c +1 -2
@@ -256,6 +256,7 @@
 	ath11k_hal_tx_cmd_desc_setup(ab, hal_tcl_desc +
 					 sizeof(struct hal_tlv_hdr), &ti);
 
+	atomic_inc(&ar->dp.num_tx_pending);
 	ath11k_hal_srng_access_end(ab, tcl_ring);
 
 	ath11k_dp_shadow_start_timer(ab, tcl_ring, &dp->tx_ring_timer[ti.ring_id]);
@@ -264,8 +265,6 @@
 
 	ath11k_dbg_dump(ab, ATH11K_DBG_DP_TX, NULL, "dp tx msdu: ",
 			skb->data, skb->len);
-
-	atomic_inc(&ar->dp.num_tx_pending);
 
 	return 0;
 
#1 lore raw

PATCH 2/2 wifi: ath11k: dump TX data before DMA mapping

The device can complete the descriptor once the ring head is published. Completion can release the skb before the late debug dump reads skb->data and skb->len. Dump the frame before mapping it for DMA, while the host still owns the buffer.

OpenAI Codex helped trace skb ownership and verify the AArch64 build.

Fixes aa2092a9bab3 ("ath11k: add raw mode and software crypto support")

---

drivers/net/wireless/ath/ath11k/dp_tx.c +3 -3
@@ -209,6 +209,9 @@
 		goto fail_remove_idr;
 	}
 
+	ath11k_dbg_dump(ab, ATH11K_DBG_DP_TX, NULL, "dp tx msdu: ",
+			skb->data, skb->len);
+
 	ti.paddr = dma_map_single(ab->dev, skb->data, skb->len, DMA_TO_DEVICE);
 	if (unlikely(dma_mapping_error(ab->dev, ti.paddr))) {
 		atomic_inc(&ab->soc_stats.tx_err.misc_fail);
@@ -262,9 +265,6 @@
 	ath11k_dp_shadow_start_timer(ab, tcl_ring, &dp->tx_ring_timer[ti.ring_id]);
 
 	spin_unlock_bh(&tcl_ring->lock);
-
-	ath11k_dbg_dump(ab, ATH11K_DBG_DP_TX, NULL, "dp tx msdu: ",
-			skb->data, skb->len);
 
 	return 0;
 
#2 lore raw

PATCH RESEND 2/2 wifi: ath11k: dump TX data before DMA mapping

The device can complete the descriptor once the ring head is published. Completion can release the skb before the late debug dump reads skb->data and skb->len. Dump the frame before mapping it for DMA, while the host still owns the buffer.

OpenAI Codex helped trace skb ownership and verify the AArch64 build.

Fixes aa2092a9bab3 ("ath11k: add raw mode and software crypto support")

---

drivers/net/wireless/ath/ath11k/dp_tx.c +3 -3
@@ -209,6 +209,9 @@
 		goto fail_remove_idr;
 	}
 
+	ath11k_dbg_dump(ab, ATH11K_DBG_DP_TX, NULL, "dp tx msdu: ",
+			skb->data, skb->len);
+
 	ti.paddr = dma_map_single(ab->dev, skb->data, skb->len, DMA_TO_DEVICE);
 	if (unlikely(dma_mapping_error(ab->dev, ti.paddr))) {
 		atomic_inc(&ab->soc_stats.tx_err.misc_fail);
@@ -262,9 +265,6 @@
 	ath11k_dp_shadow_start_timer(ab, tcl_ring, &dp->tx_ring_timer[ti.ring_id]);
 
 	spin_unlock_bh(&tcl_ring->lock);
-
-	ath11k_dbg_dump(ab, ATH11K_DBG_DP_TX, NULL, "dp tx msdu: ",
-			skb->data, skb->len);
 
 	return 0;
#3 lore raw

PATCH RESEND 1/2 wifi: ath11k: account TX before TCL publication

In reply to Giuseppe Piscitelli

The host makes the TCL descriptor visible when it publishes the ring head. Completion processing can run before the subsequent pending count increment. Increment the count before publishing the ring head so a completion always has a pending frame to account for.

OpenAI Codex helped review the ordering and verify the AArch64 build.

Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")

---

drivers/net/wireless/ath/ath11k/dp_tx.c +1 -2
@@ -256,6 +256,7 @@
 	ath11k_hal_tx_cmd_desc_setup(ab, hal_tcl_desc +
 					 sizeof(struct hal_tlv_hdr), &ti);
 
+	atomic_inc(&ar->dp.num_tx_pending);
 	ath11k_hal_srng_access_end(ab, tcl_ring);
 
 	ath11k_dp_shadow_start_timer(ab, tcl_ring, &dp->tx_ring_timer[ti.ring_id]);
@@ -264,8 +265,6 @@
 
 	ath11k_dbg_dump(ab, ATH11K_DBG_DP_TX, NULL, "dp tx msdu: ",
 			skb->data, skb->len);
-
-	atomic_inc(&ar->dp.num_tx_pending);
 
 	return 0;