public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH mt76 01/11] wifi: mt76: fix multi-radio on-channel scanning
@ 2026-03-09  6:07 Felix Fietkau
  2026-03-09  6:07 ` [PATCH mt76 02/11] wifi: mt76: support upgrading passive scans to active Felix Fietkau
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Felix Fietkau @ 2026-03-09  6:07 UTC (permalink / raw)
  To: linux-wireless; +Cc: Chad Monroe

From: Chad Monroe <chad@monroe.io>

avoid unnecessary channel switch when performing an on-channel scan
using a multi-radio device.

Fixes: c56d6edebc1f ("wifi: mt76: mt7996: use emulated hardware scan support")
Signed-off-by: Chad Monroe <chad@monroe.io>
Link: https://patch.msgid.link/20251118102723.47997-1-nbd@nbd.name
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/scan.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/scan.c b/drivers/net/wireless/mediatek/mt76/scan.c
index ff9176cdee3d..89f16c23e352 100644
--- a/drivers/net/wireless/mediatek/mt76/scan.c
+++ b/drivers/net/wireless/mediatek/mt76/scan.c
@@ -16,7 +16,7 @@ static void mt76_scan_complete(struct mt76_dev *dev, bool abort)
 
 	clear_bit(MT76_SCANNING, &phy->state);
 
-	if (dev->scan.chan && phy->main_chandef.chan &&
+	if (dev->scan.chan && phy->main_chandef.chan && phy->offchannel &&
 	    !test_bit(MT76_MCU_RESET, &dev->phy.state))
 		mt76_set_channel(phy, &phy->main_chandef, false);
 	mt76_put_vif_phy_link(phy, dev->scan.vif, dev->scan.mlink);
@@ -87,6 +87,7 @@ void mt76_scan_work(struct work_struct *work)
 	struct cfg80211_chan_def chandef = {};
 	struct mt76_phy *phy = dev->scan.phy;
 	int duration = HZ / 9; /* ~110 ms */
+	bool offchannel = true;
 	int i;
 
 	if (dev->scan.chan_idx >= req->n_channels) {
@@ -94,7 +95,7 @@ void mt76_scan_work(struct work_struct *work)
 		return;
 	}
 
-	if (dev->scan.chan && phy->num_sta) {
+	if (dev->scan.chan && phy->num_sta && phy->offchannel) {
 		dev->scan.chan = NULL;
 		mt76_set_channel(phy, &phy->main_chandef, false);
 		goto out;
@@ -102,20 +103,26 @@ void mt76_scan_work(struct work_struct *work)
 
 	dev->scan.chan = req->channels[dev->scan.chan_idx++];
 	cfg80211_chandef_create(&chandef, dev->scan.chan, NL80211_CHAN_HT20);
-	mt76_set_channel(phy, &chandef, true);
+	if (phy->main_chandef.chan == dev->scan.chan) {
+		chandef = phy->main_chandef;
+		offchannel = false;
+	}
+
+	mt76_set_channel(phy, &chandef, offchannel);
 
 	if (!req->n_ssids ||
 	    chandef.chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR))
 		goto out;
 
-	duration = HZ / 16; /* ~60 ms */
+	if (phy->offchannel)
+		duration = HZ / 16; /* ~60 ms */
 	local_bh_disable();
 	for (i = 0; i < req->n_ssids; i++)
 		mt76_scan_send_probe(dev, &req->ssids[i]);
 	local_bh_enable();
 
 out:
-	if (dev->scan.chan)
+	if (dev->scan.chan && phy->offchannel)
 		duration = max_t(int, duration,
 			         msecs_to_jiffies(req->duration +
 						  (req->duration >> 5)));
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-03-09  6:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09  6:07 [PATCH mt76 01/11] wifi: mt76: fix multi-radio on-channel scanning Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 02/11] wifi: mt76: support upgrading passive scans to active Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 03/11] wifi: mt76: add offchannel check to mt76_roc_complete Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 04/11] wifi: mt76: check chanctx before restoring channel after ROC Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 05/11] wifi: mt76: abort ROC on chanctx changes Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 06/11] wifi: mt76: optimize ROC for same-channel case Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 07/11] wifi: mt76: send nullfunc PS frames on offchannel transitions Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 08/11] wifi: mt76: flush pending TX before channel switch Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 09/11] wifi: mt76: route nullfunc frames to PSD/ALTX queue Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 10/11] wifi: mt76: wait for firmware TX completion of mgmt frames before channel switch Felix Fietkau
2026-03-09  6:07 ` [PATCH mt76 11/11] wifi: mt76: add per-link beacon monitoring for MLO Felix Fietkau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox