From: Sean Wang <sean.wang@kernel.org>
To: nbd@nbd.name, lorenzo.bianconi@redhat.com
Cc: linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org, yu-ching.liu@mediatek.com,
jenhao.yang@mediatek.com, posh.sun@mediatek.com,
Sean Wang <sean.wang@mediatek.com>
Subject: [PATCH 10/15] wifi: mt76: mt7925: fill all DW intervals in NAN avail_map
Date: Mon, 24 Aug 2026 14:52:22 -0500 [thread overview]
Message-ID: <20260824195227.12589-11-sean.wang@kernel.org> (raw)
In-Reply-To: <20260824195227.12589-1-sean.wang@kernel.org>
From: Stella Liu <yu-ching.liu@mediatek.com>
Fill avail_map for all DW intervals instead of only DW index 0.
FW requires the bitmap to be set across all 16 DW intervals for
correct NAN scheduling. Without this, NDP ping latency is extremely
high (~200ms) because FW only schedules data in the first DW interval.
Also set ch_type = 1 for new channel entries to indicate
channel-based (non-band) availability.
Fixes: 0f3605e4f8de ("wifi: mt76: mt7925: wire up NAN operations")
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Stella Liu <yu-ching.liu@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/nan.c | 27 ++++++++++++++-----
.../net/wireless/mediatek/mt76/mt7925/nan.h | 3 +++
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/nan.c b/drivers/net/wireless/mediatek/mt76/mt7925/nan.c
index fc105e48eaca..4a1f80fac1b5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/nan.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/nan.c
@@ -491,9 +491,14 @@ static u32 mt7925_nan_slot_to_bitmap(struct ieee80211_vif *vif,
if (FIELD_GET(NAN_CH_CTRL_PRIMARY_CH, raw) ==
slot_chan->chan->hw_value) {
- u32 map = le32_to_cpu(ch_list[j].avail_map[0]);
+ u32 dw;
- ch_list[j].avail_map[0] = cpu_to_le32(map | BIT(i));
+ for (dw = 0; dw < NAN_TOTAL_DW; dw++) {
+ u32 map = le32_to_cpu(ch_list[j].avail_map[dw]);
+
+ ch_list[j].avail_map[dw] =
+ cpu_to_le32(map | BIT(i));
+ }
le32_add_cpu(&ch_list[j].num, 1);
is_found = true;
break;
@@ -501,12 +506,18 @@ static u32 mt7925_nan_slot_to_bitmap(struct ieee80211_vif *vif,
}
if (!is_found && num_channels < NAN_TIMELINE_MGMT_CHNL_LIST_NUM) {
+ u32 dw;
+
ch_list[num_channels].ch_info =
- cpu_to_le32(FIELD_PREP(NAN_CH_CTRL_OP_CLASS,
+ cpu_to_le32(FIELD_PREP(NAN_CH_CTRL_CH_TYPE,
+ NAN_BAND_CHANNEL_ENTRY_LIST_TYPE_CHANNEL) |
+ FIELD_PREP(NAN_CH_CTRL_OP_CLASS,
slot->channel_entry[0]) |
FIELD_PREP(NAN_CH_CTRL_PRIMARY_CH,
slot_chan->chan->hw_value));
- ch_list[num_channels].avail_map[0] = cpu_to_le32(BIT(i));
+ for (dw = 0; dw < NAN_TOTAL_DW; dw++)
+ ch_list[num_channels].avail_map[dw] =
+ cpu_to_le32(BIT(i));
le32_add_cpu(&ch_list[num_channels].num, 1);
ch_list[num_channels].is_valid++;
num_channels++;
@@ -681,17 +692,19 @@ mt7925_nan_fill_crb_committed(struct mt7925_nan_sched_update_crb_tlv *crb_tlv,
/*
* Convert peer schedule slots to FW avail_map bitmap.
- * Each bit in avail_map[0] represents one time slot where
- * the peer has committed availability.
+ * Each bit represents one time slot where the peer has
+ * committed availability. Fill all DW intervals the same.
*/
for (slot = 0; slot < CFG80211_NAN_SCHED_NUM_TIME_SLOTS;
slot++) {
struct ieee80211_nan_channel *ch = map->slots[slot];
+ u32 dw;
if (!ch || !ch->chanctx_conf)
continue;
- tl->avail_map[0] |= cpu_to_le32(BIT(slot));
+ for (dw = 0; dw < NAN_TOTAL_DW; dw++)
+ tl->avail_map[dw] |= cpu_to_le32(BIT(slot));
}
}
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/nan.h b/drivers/net/wireless/mediatek/mt76/mt7925/nan.h
index b03b909a98d2..32e2e9cfffc7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/nan.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/nan.h
@@ -117,12 +117,15 @@ enum nan_peer_supported_bands {
NAN_SUPPORTED_BN_NUM
};
+#define NAN_CH_CTRL_CH_TYPE BIT(0)
#define NAN_CH_CTRL_OP_CLASS GENMASK(15, 8)
#define NAN_CH_CTRL_PRIMARY_CH GENMASK(23, 16)
#define NAN_CRB_USE_DATA_PATH BIT(0)
#define NAN_CRB_AVAIL_6G_FORMAT GENMASK(2, 1)
+#define NAN_BAND_CHANNEL_ENTRY_LIST_TYPE_CHANNEL 1
+
struct mt7925_nan_social_ch_scan_params {
u8 dwell_time[NAN_MAX_SOCIAL_CHANNELS];
__le16 scan_period[NAN_MAX_SOCIAL_CHANNELS];
--
2.43.0
next prev parent reply other threads:[~2026-08-24 19:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 19:52 [PATCH 00/15] wifi: mt76: mt7925: fix NAN operation and NDP performance Sean Wang
2026-08-24 19:52 ` [PATCH 01/15] wifi: mt76: mt7925: fix NAN NDP STA record role index Sean Wang
2026-08-24 19:52 ` [PATCH 02/15] wifi: mt76: mt7925: fix NAN start failure Sean Wang
2026-08-24 19:52 ` [PATCH 03/15] wifi: mt76: mt7925: fix NAN committed CRB timeline layout Sean Wang
2026-08-24 19:52 ` [PATCH 04/15] wifi: mt76: mt7925: report only 2.4 GHz NAN supported band Sean Wang
2026-08-24 19:52 ` [PATCH 05/15] wifi: mt76: mt7925: drop unused NAN 2.4/5 GHz support config Sean Wang
2026-08-24 19:52 ` [PATCH 06/15] wifi: mt76: mt7925: drop deferred NAN local schedule update handling Sean Wang
2026-08-24 19:52 ` [PATCH 07/15] wifi: mt76: mt7925: use OFDM-only PHY mode for NAN STA records Sean Wang
2026-08-24 19:52 ` [PATCH 08/15] wifi: mt76: mt7925: share TLV setup for NAN enable command Sean Wang
2026-08-24 19:52 ` [PATCH 09/15] wifi: mt76: mt7925: replace NAN DW end event with DW start Sean Wang
2026-08-24 19:52 ` Sean Wang [this message]
2026-08-24 19:52 ` [PATCH 11/15] wifi: mt76: mt7925: clear CRB before deactivating NAN peer record Sean Wang
2026-08-24 19:52 ` [PATCH 12/15] wifi: mt76: mt7925: add ULW event handling and peer ULW update Sean Wang
2026-08-24 19:52 ` [PATCH 13/15] wifi: mt76: mt7925: configure NAN PHY setting on enable Sean Wang
2026-08-24 19:52 ` [PATCH 14/15] wifi: mt76: mt7925: support deferred NAN schedule update and cluster events Sean Wang
2026-08-24 19:52 ` [PATCH 15/15] wifi: mt76: mt7925: fix HT/VHT caps and rates for NAN NDP peers Sean Wang
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=20260824195227.12589-11-sean.wang@kernel.org \
--to=sean.wang@kernel.org \
--cc=jenhao.yang@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=posh.sun@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=yu-ching.liu@mediatek.com \
/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