mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrei-Alexandru Bleortu <me@andrei-z.com>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: <ath11k@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<linux-wireless@vger.kernel.org>
Subject: [PATCH ath-next 2/5] wifi: ath11k: count down channel switch announcements in mac80211
Date: Sun, 4 Oct 2026 14:18:04 +0300	[thread overview]
Message-ID: <8d40acb1fc26b8f18b0cffcbb17b408f0746f529.1791111135.git.me@andrei-z.com> (raw)
In-Reply-To: <cover.1791111135.2.git.me@andrei-z.com>

ath11k handled the CSA switch count event only once the count reached
zero, to finish the switch, and did not ask the firmware for an event at
any other count. mac80211's countdown therefore never moved: Probe
Response frames, which mac80211 fills from it, and every beacon template
uploaded during the switch carried the initial Channel Switch Count,
although IEEE Std 802.11-2024, 9.4.2.17 has it give the number of TBTTs
left until the switch.

Request an event for every count in the beacon template command and
decrement mac80211's countdown on each one that matches the expected
count; a beacon that failed to go out repeats the previous count, which
is then skipped. This is how ath12k handles the same event.

Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1

Assisted-by: LLM
Signed-off-by: Andrei-Alexandru Bleortu <me@andrei-z.com>
---
 drivers/net/wireless/ath/ath11k/core.h |  2 ++
 drivers/net/wireless/ath/ath11k/wmi.c  | 23 ++++++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index a0d725923e..0b10dac706 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -395,6 +395,8 @@ struct ath11k_vif {
 
 	bool is_started;
 	bool is_up;
+	/* CSA countdown value the firmware is expected to report next */
+	u8 current_cntdown_counter;
 	bool ftm_responder;
 	bool spectral_enabled;
 	bool ps;
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 08fd6795ed..b7944f98a6 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -1806,6 +1806,9 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id,
 	if (vif->bss_conf.csa_active) {
 		cmd->csa_switch_count_offset = offs->cntdwn_counter_offs[0];
 		cmd->ext_csa_switch_count_offset = offs->cntdwn_counter_offs[1];
+		/* a switch count event for every count, not just the last */
+		cmd->csa_event_bitmap = 0xffffffff;
+		arvif->current_cntdown_counter = bcn->data[offs->cntdwn_counter_offs[0]];
 	}
 
 	cmd->buf_len = bcn->len;
@@ -8385,10 +8388,6 @@ ath11k_wmi_process_csa_switch_count_event(struct ath11k_base *ab,
 	struct ath11k_vif *arvif;
 	int i;
 
-	/* Finish CSA once the switch count becomes NULL */
-	if (ev->current_switch_count)
-		return;
-
 	if (num_vdevs > vdev_ids_len / sizeof(*vdev_ids)) {
 		ath11k_warn(ab, "csa switch count num_vdevs %u exceeds tlv array length %u\n",
 			    num_vdevs, vdev_ids_len);
@@ -8405,8 +8404,22 @@ ath11k_wmi_process_csa_switch_count_event(struct ath11k_base *ab,
 			continue;
 		}
 
-		if (arvif->is_up && arvif->vif->bss_conf.csa_active)
+		if (!arvif->is_up || !arvif->vif->bss_conf.csa_active)
+			continue;
+
+		if (!ev->current_switch_count) {
 			ieee80211_csa_finish(arvif->vif, 0);
+			arvif->current_cntdown_counter = 0;
+		} else if (ev->current_switch_count > 1) {
+			/* A beacon that failed to go out repeats the previous
+			 * count; mac80211 counts down once per beacon sent.
+			 */
+			if (ev->current_switch_count != arvif->current_cntdown_counter)
+				continue;
+
+			arvif->current_cntdown_counter =
+				ieee80211_beacon_update_cntdwn(arvif->vif, 0);
+		}
 	}
 	rcu_read_unlock();
 }
-- 
2.47.3



  parent reply	other threads:[~2026-10-04 11:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04 11:18 [PATCH ath-next 0/5] wifi: ath11k: WMI services debugfs and HE AP fixes Andrei-Alexandru Bleortu
2026-10-04 11:18 ` [PATCH ath-next 1/5] wifi: ath11k: add a debugfs file listing the firmware WMI services Andrei-Alexandru Bleortu
2026-10-04 11:18 ` Andrei-Alexandru Bleortu [this message]
2026-10-04 11:18 ` [PATCH ath-next 3/5] wifi: ath11k: leave OBSS PD off when spatial reuse is not configured Andrei-Alexandru Bleortu
2026-10-04 11:18 ` [PATCH ath-next 4/5] wifi: ath11k: set the 6 GHz transmit power limits of an AP Andrei-Alexandru Bleortu
2026-10-04 11:18 ` [PATCH ath-next 5/5] wifi: ath11k: map DSCP to TID as cfg80211 does by default Andrei-Alexandru Bleortu

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=8d40acb1fc26b8f18b0cffcbb17b408f0746f529.1791111135.git.me@andrei-z.com \
    --to=me@andrei-z.com \
    --cc=ath11k@lists.infradead.org \
    --cc=jjohnson@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@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

all inboxes | Powered by JetHome®