mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mehmet Fide <mehmet.fide@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "Simon Wunderlich" <sw@simonwunderlich.de>,
	"Toke Høiland-Jørgensen" <toke@toke.dk>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	mehmet.fide@screeningeagle.com
Subject: [PATCH wireless-next] wifi: mac80211: replace the CSA beacon before clearing csa_active
Date: Tue, 17 Nov 2026 16:31:54 +0100	[thread overview]
Message-ID: <20261117153154.1804945-1-mehmet.fide@gmail.com> (raw)

From: Mehmet Fide <mehmet.fide@screeningeagle.com>

__ieee80211_csa_finalize() clears csa_active and only then replaces the
CSA beacon with the one for after the switch. A driver that fetches its
beacons with ieee80211_beacon_get() and skips them once the countdown
is complete, as ath9k does in ath9k_csa_is_finished(), tests csa_active
first. A beacon fetched between the two steps passes that test and gets
the CSA beacon again, which goes out on the new channel, and
ieee80211_beacon_get() reports "beacon TX faster than countdown".

Replace the beacon first, as the finalize work did before the clear was
moved ahead of it. csa_active is still cleared when replacing the
beacon fails.

Fixes: e487eaeb076a ("cfg80211/mac80211/ath6kl: acquire wdev lock outside ch_switch_notify")
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---

Notes:
    Tested on rtw-next on an i.MX8MP board with an AR9271 as AP, ath9k_htc
    with "wifi: ath9k_htc: do not fetch the beacon of a finished countdown"
    v2 (link below), hostapd switching between channel 1 and 6, one sniffer
    on each channel counting CSA beacons heard on the new channel. Before:
    3 in 200 switches with a count of 5, and a print in the driver showed 3
    fetches between the two steps. After: none in 200 switches with a count
    of 5 and 80 with a count of 2. With v1 of that driver patch,
    back-to-back switches and AP stops in and out of a countdown gave no
    warning from mac80211. The rtw88 AP channel switch under review
    (RTL8822BU, RTL8822CE) counts down on the air as before.
    
    https://lore.kernel.org/r/20261117151703.1802556-1-mehmet.fide@gmail.com/

 net/mac80211/cfg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9e47360ee8f5..9458838bfe63 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4776,9 +4776,8 @@ static int __ieee80211_csa_finalize(struct ieee80211_link_data *link_data)
 					&link_data->csa.chanreq.oper))
 		return -EINVAL;
 
-	link_conf->csa_active = false;
-
 	err = ieee80211_set_after_csa_beacon(link_data, &changed);
+	link_conf->csa_active = false;
 	if (err)
 		return err;
 

base-commit: 5dbf2415ca9821a611d09308e3b29d2c37e7cd77
-- 
2.56.0


                 reply	other threads:[~2026-11-17 15:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261117153154.1804945-1-mehmet.fide@gmail.com \
    --to=mehmet.fide@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mehmet.fide@screeningeagle.com \
    --cc=sw@simonwunderlich.de \
    --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®