mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julius Bairaktaris <julius@bairaktaris.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
	"Jeff Johnson" <jjohnson@kernel.org>,
	"Baochen Qiang" <baochen.qiang@oss.qualcomm.com>,
	"Felix Fietkau" <nbd@nbd.name>,
	"Toke Høiland-Jørgensen" <toke@toke.dk>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	ath11k@lists.infradead.org, ath12k@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH wireless-next v2 3/7] wifi: mac80211: clamp the AQL airtime estimate before narrowing it
Date: Sat, 28 Nov 2026 17:03:31 +0100	[thread overview]
Message-ID: <20261128160335.1815537-4-julius@bairaktaris.de> (raw)
In-Reply-To: <20261128160335.1815537-1-julius@bairaktaris.de>

ieee80211_info_set_tx_time_est() takes the estimate as u16 and clamps it
to 4095 us, but ieee80211_tx_dequeue() passes a u32. An estimate of
65536 us or more loses its upper bits before the clamp: 65540 us is
charged as 4 us.

Take the estimate as u32.

Found by an LLM review (Claude) of the airtime code.

Fixes: 7a89233ac504 ("mac80211: Use Airtime-based Queue Limits (AQL) on packet dequeue")
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
---
v2:
- New.

 include/net/mac80211.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f768ef9184eb..ba16096fea3a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1425,12 +1425,12 @@ struct ieee80211_tx_info {
 };
 
 static inline u16
-ieee80211_info_set_tx_time_est(struct ieee80211_tx_info *info, u16 tx_time_est)
+ieee80211_info_set_tx_time_est(struct ieee80211_tx_info *info, u32 tx_time_est)
 {
 	/* We only have 10 bits in tx_time_est, so store airtime
 	 * in increments of 4us and clamp the maximum to 2**12-1
 	 */
-	info->tx_time_est = min_t(u16, tx_time_est, 4095) >> 2;
+	info->tx_time_est = min_t(u32, tx_time_est, 4095) >> 2;
 	return info->tx_time_est << 2;
 }
 
-- 
2.53.0


  parent reply	other threads:[~2026-11-28 16:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 16:03 [PATCH wireless-next v2 0/7] wifi: mac80211: TSO and SG for encap offload, and the TID of 802.3 RX frames Julius Bairaktaris
2026-11-28 16:03 ` [PATCH wireless-next v2 1/7] wifi: mac80211: compute the airtime estimate in 64 bits Julius Bairaktaris
2026-11-28 16:03 ` [PATCH wireless-next v2 2/7] wifi: mac80211: use the ampdu argument of ieee80211_calc_expected_tx_airtime() Julius Bairaktaris
2026-11-28 16:03 ` Julius Bairaktaris [this message]
2026-11-28 16:03 ` [PATCH wireless-next v2 4/7] wifi: mac80211: advertise TSO and SG for encap offloaded frames Julius Bairaktaris
2026-11-28 16:03 ` [PATCH wireless-next v2 5/7] wifi: mac80211: take the TID of an 802.3 frame from the driver Julius Bairaktaris
2026-11-28 16:03 ` [PATCH wireless-next v2 6/7] wifi: ath11k: pass the TID of a received 802.3 frame to mac80211 Julius Bairaktaris
2026-11-28 16:03 ` [PATCH wireless-next v2 7/7] wifi: ath12k: " Julius Bairaktaris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128160335.1815537-4-julius@bairaktaris.de \
    --to=julius@bairaktaris.de \
    --cc=ath11k@lists.infradead.org \
    --cc=ath12k@lists.infradead.org \
    --cc=baochen.qiang@oss.qualcomm.com \
    --cc=jjohnson@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=toke@redhat.com \
    --cc=toke@toke.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®