* [PATCH ath-next] wifi: ath9k_htc: count a frame as queued before it is sent
@ 2026-11-11 21:59 Mehmet Fide
2026-11-16 16:54 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 3+ messages in thread
From: Mehmet Fide @ 2026-11-11 21:59 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: John W . Linville, Sujith Manoharan, linux-wireless,
linux-kernel, mehmet.fide
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
ath9k_htc_tx() hands the frame to the device and counts it in
tx.queued_cnt afterwards. The TX status of the frame is handled in the
WMI event tasklet, which can run before the sender gets to the counter.
ath9k_htc_tx_process() then takes the counter below zero, warns and
sets it to zero, and the sender's increment leaves it one too high for
good:
WARNING: CPU: 0 PID: 348 at drivers/net/wireless/ath/ath9k/htc_drv_txrx.c:510 ath9k_htc_tx_process+0x400/0x558 [ath9k_htc]
Call trace:
ath9k_htc_tx_process+0x400/0x558 [ath9k_htc]
ath9k_htc_txstatus+0x58/0x140 [ath9k_htc]
ath9k_wmi_event_tasklet+0x16c/0x17c [ath9k_htc]
tasklet_action_common+0x108/0x150
Count the frame before it is sent and take it back if the send fails.
Fixes: 8e86a54715c4 ("ath9k_htc: Fix TX queue management")
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 0d6272ac0dac..ee87352d1241 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -888,17 +888,21 @@ static void ath9k_htc_tx(struct ieee80211_hw *hw,
goto fail_tx;
}
+ ath9k_htc_check_stop_queues(priv);
+
ret = ath9k_htc_tx_start(priv, control->sta, skb, slot, false);
if (ret != 0) {
ath_dbg(common, XMIT, "Tx failed\n");
goto clear_slot;
}
- ath9k_htc_check_stop_queues(priv);
-
return;
clear_slot:
+ spin_lock_bh(&priv->tx.tx_lock);
+ priv->tx.queued_cnt--;
+ spin_unlock_bh(&priv->tx.tx_lock);
+ ath9k_htc_check_wake_queues(priv);
ath9k_htc_tx_clear_slot(priv, slot);
fail_tx:
dev_kfree_skb_any(skb);
base-commit: ff4c7359e310744a7abe53cf66d921fa2969eb19
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH ath-next] wifi: ath9k_htc: count a frame as queued before it is sent
2026-11-11 21:59 [PATCH ath-next] wifi: ath9k_htc: count a frame as queued before it is sent Mehmet Fide
@ 2026-11-16 16:54 ` Toke Høiland-Jørgensen
2026-11-17 7:14 ` Mehmet Fide
0 siblings, 1 reply; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-11-16 16:54 UTC (permalink / raw)
To: Mehmet Fide
Cc: Toke Høiland-Jørgensen, John W . Linville,
Sujith Manoharan, linux-wireless, linux-kernel, mehmet.fide
On Wed, 11 Nov 2026 22:59:02 +0100, Mehmet Fide <mehmet.fide@gmail.com> wrote:
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> index b46be3682f21..9467b8e512a6 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
> @@ -888,17 +888,21 @@ static void ath9k_htc_tx(struct ieee80211_hw *hw,
> [ ... skip 14 lines ... ]
>
> clear_slot:
> + spin_lock_bh(&priv->tx.tx_lock);
> + priv->tx.queued_cnt--;
> + spin_unlock_bh(&priv->tx.tx_lock);
> + ath9k_htc_check_wake_queues(priv);
Hmm, so this results in taking the lock twice, once for decrementing and once
for checking. How about we define a __ath9k_htc_check_wake_queues() function which
takes a boolean "decrement" as the second parameter, and does the decrement
under the lock if set? Then we can turn ath9k_htc_check_wake_queues(priv) into a
wrapper which just calls __ath9k_htc_check_wake_queues(priv, false).
-Toke
--
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH ath-next] wifi: ath9k_htc: count a frame as queued before it is sent
2026-11-16 16:54 ` Toke Høiland-Jørgensen
@ 2026-11-17 7:14 ` Mehmet Fide
0 siblings, 0 replies; 3+ messages in thread
From: Mehmet Fide @ 2026-11-17 7:14 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: John W . Linville, Sujith Manoharan, linux-wireless,
linux-kernel, mehmet.fide
Hi Toke,
> How about we define a __ath9k_htc_check_wake_queues() function which
> takes a boolean "decrement" as the second parameter, and does the decrement
> under the lock if set? Then we can turn ath9k_htc_check_wake_queues(priv) into a
> wrapper which just calls __ath9k_htc_check_wake_queues(priv, false).
Sure, will do in v2.
Mehmet
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-17 7:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 21:59 [PATCH ath-next] wifi: ath9k_htc: count a frame as queued before it is sent Mehmet Fide
2026-11-16 16:54 ` Toke Høiland-Jørgensen
2026-11-17 7:14 ` Mehmet Fide
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®