[PATCH wireless] wifi: mt76: mt7925: add the common scan IEs back to probe requests
Devin Wittmayer
lucid_duck at justthetip.ca
Mon Nov 2 11:08:11 PST 2026
Wi-Fi Direct search can no longer find devices in Listen state, such as
Miracast sinks. The probe requests lack the P2P IE, which mac80211 puts
in the common IEs, and only the per-band IEs are sent to the firmware.
Add the common IEs to each band of a normal scan, as long as the band
still fits in one byte of length: the firmware ignores the high byte.
Leave scheduled scans alone, since the firmware can time out on them
when their IEs grow.
Fixes: 9f8f4a51f3c1 ("wifi: mt76: mt7925: fix incorrect scan probe IE handling for hw_scan")
Reported-by: Sven Besser <sven.besser at sql-ag.de>
Closes: https://lore.kernel.org/linux-wireless/FRVP281MB5672AE5BBD61EF0802D42370A0942@FRVP281MB5672.DEUP281.PROD.OUTLOOK.COM/
Suggested-by: Sven Besser <sven.besser at sql-ag.de>
Signed-off-by: Devin Wittmayer <lucid_duck at justthetip.ca>
---
Tested with wpa_supplicant: one radio searching, a peer listening on
channel 6, and a third radio capturing the search probes.
probes with peer
the P2P IE found
MT7925U, wireless-next 0 of 162 no
with this patch 98 of 98 yes
9f8f4a51f3c1 reverted 19 of 19 yes
MT7927, 7.3.1, out-of-tree 0 of 231 no
with this patch 228 of 228 yes
A Miracast-style search, with a Wi-Fi Display subelement and the longest
allowed device name, stays under the limit and finds the peer on both.
Without the two limits, longer probes went out cut short and scheduled
scans sometimes reset the chip. Plain scans and joins are unchanged. Not
tested on mt7928.
Sven, thanks for tracking this down.
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 25 ++++++++++++++-----
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 50f5f57b740e..b614653debd1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -3259,10 +3259,10 @@ EXPORT_SYMBOL_GPL(mt7925_mcu_set_dbdc);
static void
mt7925_mcu_build_scan_ie_tlv(struct mt76_dev *mdev,
struct sk_buff *skb,
- struct ieee80211_scan_ies *scan_ies)
+ struct ieee80211_scan_ies *scan_ies, bool common)
{
u32 max_len = sizeof(struct scan_ie_tlv) + MT76_CONNAC_SCAN_IE_LEN;
- u32 ies_len, alloc_len;
+ u32 ies_len, common_len, alloc_len;
struct scan_ie_tlv *ie;
enum nl80211_band i;
struct tlv *tlv;
@@ -3278,6 +3278,15 @@ mt7925_mcu_build_scan_ie_tlv(struct mt76_dev *mdev,
if (!ies || !ies_len)
continue;
+ /* The vendor IEs (P2P, WPS, WFD, ...) are in common_ies. The
+ * firmware keeps only the low byte of a band's IE length, so
+ * add them only where the band stays within 255 bytes.
+ */
+ common_len = 0;
+ if (common && ies_len + scan_ies->common_ie_len <= U8_MAX)
+ common_len = scan_ies->common_ie_len;
+ ies_len += common_len;
+
if (is_mt7928(mdev))
alloc_len = ALIGN(sizeof(*ie) + ies_len, 4);
else
@@ -3290,7 +3299,9 @@ mt7925_mcu_build_scan_ie_tlv(struct mt76_dev *mdev,
alloc_len);
ie = (struct scan_ie_tlv *)tlv;
- memcpy(ie->ies, ies, ies_len);
+ memcpy(ie->ies, ies, ies_len - common_len);
+ memcpy(ie->ies + ies_len - common_len, scan_ies->common_ies,
+ common_len);
ie->ies_len = cpu_to_le16(ies_len);
switch (i) {
@@ -3428,7 +3439,7 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
}
/* Append scan probe IEs as the last tlv */
- mt7925_mcu_build_scan_ie_tlv(mdev, skb, &scan_req->ies);
+ mt7925_mcu_build_scan_ie_tlv(mdev, skb, &scan_req->ies, true);
err = mt76_mcu_skb_send_msg(mdev, skb, MCU_UNI_CMD(SCAN_REQ),
true);
@@ -3530,8 +3541,10 @@ int mt7925_mcu_sched_scan_req(struct mt76_phy *phy,
}
chan_info->channel_type = sreq->n_channels ? 4 : 0;
- /* Append scan probe IEs as the last tlv */
- mt7925_mcu_build_scan_ie_tlv(mdev, skb, ies);
+ /* Append scan probe IEs as the last tlv. A scheduled scan keeps the
+ * band IEs alone: the firmware stops answering it with more.
+ */
+ mt7925_mcu_build_scan_ie_tlv(mdev, skb, ies, false);
return mt76_mcu_skb_send_msg(mdev, skb, MCU_UNI_CMD(SCAN_REQ),
true);
--
2.56.0
More information about the Linux-mediatek
mailing list