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 --- 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