Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@toke.dk>
To: "Felix K." <fk@mutemail.de>, Mehmet Fide <mehmet.fide@gmail.com>
Cc: linux-wireless@vger.kernel.org, "Felix K." <fk@mutemail.de>,
	stable@vger.kernel.org
Subject: Re: [PATCH ath-next] wifi: ath9k_htc: fix beacon slot selection once TSF exceeds 2^42 us
Date: Fri, 23 Oct 2026 13:14:55 +0200	[thread overview]
Message-ID: <8733twsm6o.fsf@toke.dk> (raw)
In-Reply-To: <20261022105656.4175421-1-fk@mutemail.de>

"Felix K." <fk@mutemail.de> writes:

> ath9k_htc_choose_bslot() derives the beacon slot from the TSF reported
> in the SWBA event as
>
> 	tsftu = TSF_TO_TU(tsf >> 32, tsf);
> 	slot = ((tsftu % intval) * ATH9K_HTC_MAX_BCN_VIF) / intval;
>
> TSF_TO_TU() truncates its result to 32 bits, so tsftu is
> (tsf / 1024) mod 2^32 and wraps every 2^42 us (~50.9 days). 2^32 is not
> a multiple of the beacon interval (2^32 mod 100 = 96 for the default
> of 100 TU), so every wrap shifts the computed position within the
> beacon interval by 4 TU. Depending on where in the interval the SWBA
> event arrives, the wrong slot is chosen after one or more wraps. The
> state only recovers when the TSF is reset.
>
> Compute the offset within the beacon interval from the 64-bit TSF
> instead. For TSF values below 2^42 us and an even beacon interval the
> result is identical to the old calculation. TSF_TO_TU() in htc.h has no
> other user and is removed.
>
> This is the same issue as in ath9k_beacon_choose_slot(), which is fixed
> separately. Compile tested only, I do not have ath9k_htc hardware.
>
> Fixes: 832f6a18fc2a ("ath9k_htc: Add beacon slots")
> Cc: stable@vger.kernel.org
> Signed-off-by: Felix K. <fk@mutemail.de>

Mehmet, any chance you could test this one? :)

Thanks!

-Toke

  reply	other threads:[~2026-10-23 11:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 10:56 [PATCH ath-next] wifi: ath9k_htc: fix beacon slot selection once TSF exceeds 2^42 us Felix K.
2026-10-23 11:14 ` Toke Høiland-Jørgensen [this message]
2026-10-23 13:51   ` Mehmet Fide
2026-10-23 15:07     ` Toke Høiland-Jørgensen
2026-10-23 15:18 ` Toke Høiland-Jørgensen

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=8733twsm6o.fsf@toke.dk \
    --to=toke@toke.dk \
    --cc=fk@mutemail.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mehmet.fide@gmail.com \
    --cc=stable@vger.kernel.org \
    /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