All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] wifi: mac80211: don't reset the TXQ scheduling round number
@ 2026-09-08 14:41 Julius Bairaktaris
  2026-09-09 10:54 ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 3+ messages in thread
From: Julius Bairaktaris @ 2026-09-08 14:41 UTC (permalink / raw)
  To: johannes; +Cc: toke, nbd, linux-wireless

A round is ended when ieee80211_next_txq() meets a txq whose remembered
round number is the current one, meaning it has gone full circle.

When the AC exceeds the airtime limit, ieee80211_txq_schedule_start()
sets the round number to 0 to close the round. The next open round is
1. A txq from an earlier round 1 still remembers the "1", so the next
round stops on it and serves nothing.

Fix: use a separate open/closed flag and let the round number keep
counting.

Testing: ~4200 skipped selections per 20s without the fix and 20
skipped selections per 20s with the fix on ath11k (with my AQL series
applied) at BE 500/1000.

Fixes: 8e4bac067105 ("wifi: mac80211: add a per-PHY AQL limit to improve fairness")
Assisted-by: Claude:claude-opus-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
---
v2: rewrote the message
v1: https://lore.kernel.org/linux-wireless/20260908135224.754049-1-julius@bairaktaris.de/

 net/mac80211/ieee80211_i.h | 1 +
 net/mac80211/tx.c          | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 53b0b08d3459..65311340db40 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1468,6 +1468,7 @@ struct ieee80211_local {
 	spinlock_t active_txq_lock[IEEE80211_NUM_ACS];
 	struct list_head active_txqs[IEEE80211_NUM_ACS];
 	u16 schedule_round[IEEE80211_NUM_ACS];
+	bool schedule_open[IEEE80211_NUM_ACS];
 
 	/* serializes ieee80211_handle_wake_tx_queue */
 	spinlock_t handle_wake_tx_queue_lock;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index c33092960df2..c665ced9c05c 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4122,7 +4122,7 @@ struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac)
 
 	spin_lock_bh(&local->active_txq_lock[ac]);
 
-	if (!local->schedule_round[ac])
+	if (!local->schedule_open[ac])
 		goto out;
 
  begin:
@@ -4347,12 +4347,12 @@ void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac)
 
 	spin_lock_bh(&local->active_txq_lock[ac]);
 
-	if (ieee80211_txq_schedule_airtime_check(local, ac)) {
+	local->schedule_open[ac] =
+		ieee80211_txq_schedule_airtime_check(local, ac);
+	if (local->schedule_open[ac]) {
 		local->schedule_round[ac]++;
 		if (!local->schedule_round[ac])
 			local->schedule_round[ac]++;
-	} else {
-		local->schedule_round[ac] = 0;
 	}
 
 	spin_unlock_bh(&local->active_txq_lock[ac]);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] wifi: mac80211: don't reset the TXQ scheduling round number
  2026-09-08 14:41 [PATCH v2] wifi: mac80211: don't reset the TXQ scheduling round number Julius Bairaktaris
@ 2026-09-09 10:54 ` Toke Høiland-Jørgensen
  2026-09-09 10:57   ` Julius Bairaktaris
  0 siblings, 1 reply; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-09-09 10:54 UTC (permalink / raw)
  To: Julius Bairaktaris, johannes; +Cc: nbd, linux-wireless

Julius Bairaktaris <julius@bairaktaris.de> writes:

> A round is ended when ieee80211_next_txq() meets a txq whose remembered
> round number is the current one, meaning it has gone full circle.
>
> When the AC exceeds the airtime limit, ieee80211_txq_schedule_start()
> sets the round number to 0 to close the round. The next open round is
> 1. A txq from an earlier round 1 still remembers the "1", so the next
> round stops on it and serves nothing.
>
> Fix: use a separate open/closed flag and let the round number keep
> counting.
>
> Testing: ~4200 skipped selections per 20s without the fix and 20
> skipped selections per 20s with the fix on ath11k (with my AQL series
> applied) at BE 500/1000.
>
> Fixes: 8e4bac067105 ("wifi: mac80211: add a per-PHY AQL limit to improve fairness")
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>

Seems reasonable:

Reviewed-by: Toke Høiland-Jørgensen <toke@toke.dk>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] wifi: mac80211: don't reset the TXQ scheduling round number
  2026-09-09 10:54 ` Toke Høiland-Jørgensen
@ 2026-09-09 10:57   ` Julius Bairaktaris
  0 siblings, 0 replies; 3+ messages in thread
From: Julius Bairaktaris @ 2026-09-09 10:57 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: johannes, nbd, linux-wireless

Thanks for the review!

Am Mi., 9. Sept. 2026 um 10:54 Uhr schrieb Toke Høiland-Jørgensen
<toke@toke.dk>:
>
> Julius Bairaktaris <julius@bairaktaris.de> writes:
>
> > A round is ended when ieee80211_next_txq() meets a txq whose remembered
> > round number is the current one, meaning it has gone full circle.
> >
> > When the AC exceeds the airtime limit, ieee80211_txq_schedule_start()
> > sets the round number to 0 to close the round. The next open round is
> > 1. A txq from an earlier round 1 still remembers the "1", so the next
> > round stops on it and serves nothing.
> >
> > Fix: use a separate open/closed flag and let the round number keep
> > counting.
> >
> > Testing: ~4200 skipped selections per 20s without the fix and 20
> > skipped selections per 20s with the fix on ath11k (with my AQL series
> > applied) at BE 500/1000.
> >
> > Fixes: 8e4bac067105 ("wifi: mac80211: add a per-PHY AQL limit to improve fairness")
> > Assisted-by: Claude:claude-opus-5
> > Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
>
> Seems reasonable:
>
> Reviewed-by: Toke Høiland-Jørgensen <toke@toke.dk>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-09 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08 14:41 [PATCH v2] wifi: mac80211: don't reset the TXQ scheduling round number Julius Bairaktaris
2026-09-09 10:54 ` Toke Høiland-Jørgensen
2026-09-09 10:57   ` Julius Bairaktaris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.