From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 15/20] wifi: mt76: mt7996: resume the radar TX stop at an operating channel set
Date: Mon, 23 Nov 2026 14:49:14 +0100 [thread overview]
Message-ID: <20261123134920.154270-15-nbd@nbd.name> (raw)
In-Reply-To: <20261123134920.154270-1-nbd@nbd.name>
After a radar detection the firmware stops the data TX of every BSS of
the band. mt7996_mcu_rdd_resume_tx() lifts the stop only after a
completed channel switch announcement or when the last interface goes
down. A radar hit during a CAC ends with a new channel context and no
CSA. Stations then associate on the new channel, but no EAPOL frame
leaves, and a station interface on the band loses its data as well.
Send the resume when the driver sets the band to an operating channel
where no subchannel is unavailable after a radar detection. The MediaTek
feed sends it at the same place in its channel set. An off-channel set
for a scan or a ROC sends none, since the resume also lifts the station
pause of the firmware scan state. A scan or ROC set on the operating
channel sends it. A failed resume keeps phy->rdd_tx_paused set, so a
later channel set, channel switch or the removal of the last interface
sends it again. A chandef with an unavailable subchannel sends none, so
the band does not transmit on the channel of the hit again.
The test misses the time from the detection event until the mac80211
radar work marks the channel unavailable. The radar work does that after
it cancels the CAC.
Fixes: 45a09251d610 ("wifi: mt76: mt7996: fix the behavior of radar detection")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
.../net/wireless/mediatek/mt76/mt7996/main.c | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 5676379b2ca1..65b5012a0017 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -754,6 +754,32 @@ static void mt7996_remove_interface(struct ieee80211_hw *hw,
}
}
+static bool mt7996_chan_unavailable(struct ieee80211_channel *chan)
+{
+ return chan && (chan->flags & IEEE80211_CHAN_RADAR) &&
+ chan->dfs_state == NL80211_DFS_UNAVAILABLE;
+}
+
+static bool
+mt7996_chandef_unavailable(struct wiphy *wiphy,
+ const struct cfg80211_chan_def *chandef)
+{
+ int center[] = { chandef->center_freq1, chandef->center_freq2 };
+ int width = cfg80211_chandef_get_width(chandef);
+ int i, freq;
+
+ for (i = 0; i < ARRAY_SIZE(center) && center[i]; i++) {
+ for (freq = center[i] - width / 2 + 10;
+ freq < center[i] + width / 2; freq += 20) {
+ if (mt7996_chan_unavailable(ieee80211_get_channel(wiphy,
+ freq)))
+ return true;
+ }
+ }
+
+ return false;
+}
+
int mt7996_set_channel(struct mt76_phy *mphy)
{
struct mt7996_phy *phy = mphy->priv;
@@ -778,6 +804,15 @@ int mt7996_set_channel(struct mt76_phy *mphy)
if (ret)
goto out;
+ if (!mphy->offchannel && mphy->chanctx &&
+ !mt7996_chandef_unavailable(mphy->hw->wiphy, &mphy->chandef)) {
+ ret = mt7996_mcu_rdd_resume_tx(phy);
+ if (ret)
+ dev_warn_once(phy->dev->mt76.dev,
+ "failed to resume TX after radar: %d\n",
+ ret);
+ }
+
ret = mt7996_dfs_init_radar_detector(phy);
mt7996_mac_cca_stats_reset(phy);
--
2.47.3
next prev parent reply other threads:[~2026-11-23 13:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 13:49 [PATCH mt76-next 01/20] wifi: mt76: mt7925: undo the BSS of a failed interface add Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 02/20] wifi: mt76: mt7925: keep the embedded link's BMC wcid after a failed add Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 03/20] wifi: mt76: mt7915: read the PS sync state of mt7986 and mt7981 Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 04/20] wifi: mt76: mt7915: leave the BIP check of a group frame to mac80211 Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 05/20] wifi: mt76: mt7921: " Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 06/20] wifi: mt76: mt7925: " Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 07/20] wifi: mt76: mt7615: " Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 08/20] wifi: mt76: mt7925: use wcid_to_sta() in mt7925_mac_write_txwi_8023() Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 09/20] wifi: mt76: log the firmware status of a failed MCU command Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 10/20] wifi: mt76: mt7996: clear the ADM counters only in the airtime poll Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 11/20] wifi: mt76: mt7915: send mt7981 only the group units its firmware holds Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 12/20] wifi: mt76: take the DFS state from the off-channel flag Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 13/20] wifi: mt76: read roc_phy and roc_link once without the mutex Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 14/20] wifi: mt76: mt7996: add only the active links of a station MLD's peer Felix Fietkau
2026-11-23 13:49 ` Felix Fietkau [this message]
2026-11-23 13:49 ` [PATCH mt76-next 16/20] wifi: mt76: mt7996: divide by the full TWT wake interval Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 17/20] wifi: mt76: mt7915: " Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 18/20] wifi: mt76: mt7996: send the SRG bitmaps in one block per band Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 19/20] wifi: mt76: connac: set the band of an RX block ack scoreboard reset Felix Fietkau
2026-11-23 13:49 ` [PATCH mt76-next 20/20] wifi: mt76: mt7915: reset the CCA statistics of band 1 on mt7916 Felix Fietkau
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=20261123134920.154270-15-nbd@nbd.name \
--to=nbd@nbd.name \
--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