Linux wireless drivers development
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Subject: [PATCH mt76-next 19/20] wifi: mt76: mt7925: apply the dwell time of a scan request
Date: Sun, 29 Nov 2026 20:31:29 +0100	[thread overview]
Message-ID: <20261129193131.3367661-19-nbd@nbd.name> (raw)
In-Reply-To: <20261129193131.3367661-1-nbd@nbd.name>

mt792x_init_wiphy() advertises NL80211_EXT_FEATURE_SET_SCAN_DWELL, but
mt7925_mcu_hw_scan() ignores the duration of the scan request. Since
commit efeaabc5680c ("wifi: mt76: mt7925: config the dwell time by
firmware") it leaves the dwell fields of the scan command at 0, so the
firmware uses its default dwell time on every channel. That default is
shorter than a beacon interval. A scan for a beacon report with a
duration of 150 TU thus misses APs whose beacon does not fall into the
dwell and whose probe response comes late.

Pass the duration of the request, converted to ms, as the minimum and
the maximum dwell time. The firmware sends its probe requests only
within the minimum dwell time, so both carry the same value. A request
without a duration keeps the firmware default, which that commit chose
for a shorter scan.

Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 8 ++++++++
 drivers/net/wireless/mediatek/mt76/mt7925/mcu.c      | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index bd0ae510202f..2ced2a526fb9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -2093,6 +2093,14 @@ mt76_connac_mcu_he_ldpc(struct ieee80211_bss_conf *link_conf)
 	return link_conf->vif->type != NL80211_IFTYPE_AP || link_conf->he_ldpc;
 }
 
+static inline u16
+mt76_connac_mcu_scan_dwell(struct cfg80211_scan_request *sreq)
+{
+	return min_t(unsigned long,
+		     ieee80211_tu_to_usec(sreq->duration) / USEC_PER_MSEC,
+		     U16_MAX);
+}
+
 int mt76_connac_mcu_set_channel_domain(struct mt76_phy *phy);
 int mt76_connac_mcu_set_vif_ps(struct mt76_dev *dev, struct ieee80211_vif *vif);
 void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 86b01c522a55..f01172f01984 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -3459,6 +3459,9 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
 	req = (struct scan_req_tlv *)tlv;
 	req->scan_type = sreq->n_ssids ? 1 : 0;
 	req->probe_req_num = sreq->n_ssids ? 2 : 0;
+	req->channel_min_dwell_time =
+		cpu_to_le16(mt76_connac_mcu_scan_dwell(sreq));
+	req->channel_dwell_time = req->channel_min_dwell_time;
 
 	tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_SSID, sizeof(*ssid));
 	ssid = (struct scan_ssid_tlv *)tlv;
-- 
2.47.3


  parent reply	other threads:[~2026-11-29 19:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 19:31 [PATCH mt76-next 01/20] wifi: mt76: mt7996: hold the wiphy lock in the L1 SER reset work Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 02/20] wifi: mt76: mt7996: report the TX statistics of each link of a station Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 03/20] wifi: mt76: mt7996: stop the hardware when the probe fails Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 04/20] wifi: mt76: mt7996: clean up the DMA when the NPU RX queue init fails Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 05/20] wifi: mt76: mt7996: name the link and the error of a failed key install Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 06/20] wifi: mt76: mt7925: send the HE capabilities of each link of a peer Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 07/20] wifi: mt76: connac: mask the LDPC capabilities of an AP peer Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 08/20] wifi: mt76: mt7925: " Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 09/20] wifi: mt76: mt7996: read the EHT capabilities of a station as LE Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 10/20] wifi: mt76: mt7925: " Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 11/20] wifi: mt76: mt7615: drop RX frame with a header gap past its end Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 12/20] wifi: mt76: connac: drop a first fragment without an Ethernet header Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 13/20] wifi: mt76: mt7915: drop RX frame with a header gap past its end Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 14/20] wifi: mt76: mt7921: " Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 15/20] wifi: mt76: mt7996: " Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 16/20] wifi: mt76: mt7925: bound the header gap by the linear data of a frame Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 17/20] wifi: mt76: mt7921: fix out-of-bounds read in mt7921_mac_add_txs Felix Fietkau
2026-11-29 19:31 ` [PATCH mt76-next 18/20] wifi: mt76: mt7925: fix out-of-bounds read in mt7925_mac_add_txs Felix Fietkau
2026-11-29 19:31 ` Felix Fietkau [this message]
2026-11-29 19:31 ` [PATCH mt76-next 20/20] wifi: mt76: connac: apply the dwell time of a scan request on mt7663 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=20261129193131.3367661-19-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