From: JB Tsai <jb.tsai@mediatek.com>
To: <nbd@nbd.name>, <lorenzo@kernel.org>
Cc: <linux-wireless@vger.kernel.org>,
<linux-mediatek@lists.infradead.org>, <Deren.Wu@mediatek.com>,
<Sean.Wang@mediatek.com>, <Quan.Zhou@mediatek.com>,
<Ryder.Lee@mediatek.com>, <Leon.Yen@mediatek.com>,
<litien.chang@mediatek.com>, <emery.hsin@mediatek.com>,
<jb.tsai@mediatek.com>, Xiong <xiong.huang@mediatek.com>
Subject: [PATCH 18/20] wifi: mt76: mt7925: align scan IE and EFUSE TLV lengths to 4 bytes for MT7928
Date: Fri, 12 Jun 2026 15:53:37 +0800 [thread overview]
Message-ID: <20260612075339.2578327-3-jb.tsai@mediatek.com> (raw)
In-Reply-To: <20260612075339.2578327-1-jb.tsai@mediatek.com>
From: Emery Hsin <emery.hsin@mediatek.com>
MT7928 firmware requires 4-byte aligned TLV payloads. Round up
UNI_SCAN_IE allocation with ALIGN(..., 4) and track padded length.
Signed-off-by: Xiong <xiong.huang@mediatek.com>
Signed-off-by: Emery Hsin <emery.hsin@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index ffe687afcf6e..e8edc8c1acca 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -1582,7 +1582,8 @@ int mt7925_mcu_set_eeprom(struct mt792x_dev *dev)
.tag = cpu_to_le16(UNI_EFUSE_BUFFER_MODE),
.len = cpu_to_le16(sizeof(req) - 4),
.buffer_mode = EE_MODE_EFUSE,
- .format = EE_FORMAT_WHOLE
+ .format = EE_FORMAT_WHOLE,
+ .buf_len = 0
};
return mt76_mcu_send_and_get_msg(&dev->mt76, MCU_UNI_CMD(EFUSE_CTRL),
@@ -3036,11 +3037,11 @@ mt7925_mcu_build_scan_ie_tlv(struct mt76_dev *mdev,
struct ieee80211_scan_ies *scan_ies)
{
u32 max_len = sizeof(struct scan_ie_tlv) + MT76_CONNAC_SCAN_IE_LEN;
+ u32 ies_len, alloc_len;
struct scan_ie_tlv *ie;
enum nl80211_band i;
struct tlv *tlv;
const u8 *ies;
- u16 ies_len;
for (i = 0; i <= NL80211_BAND_6GHZ; i++) {
if (i == NL80211_BAND_60GHZ)
@@ -3052,11 +3053,16 @@ mt7925_mcu_build_scan_ie_tlv(struct mt76_dev *mdev,
if (!ies || !ies_len)
continue;
- if (ies_len > max_len)
+ if (is_mt7928(mdev))
+ alloc_len = ALIGN(sizeof(*ie) + ies_len, 4);
+ else
+ alloc_len = sizeof(*ie) + ies_len;
+
+ if (alloc_len > max_len)
return;
tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_IE,
- sizeof(*ie) + ies_len);
+ alloc_len);
ie = (struct scan_ie_tlv *)tlv;
memcpy(ie->ies, ies, ies_len);
@@ -3074,7 +3080,7 @@ mt7925_mcu_build_scan_ie_tlv(struct mt76_dev *mdev,
break;
}
- max_len -= (sizeof(*ie) + ies_len);
+ max_len -= alloc_len;
}
}
--
2.45.2
next prev parent reply other threads:[~2026-06-12 7:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 7:53 [PATCH 16/20] wifi: mt76: mt7925: add MT7928 TXD/TXS/TX_DONE support JB Tsai
2026-06-12 7:53 ` [PATCH 17/20] wifi: mt76: mt7925: add MMIO register remapping table for MT7928 JB Tsai
2026-06-12 7:53 ` JB Tsai [this message]
2026-06-12 7:53 ` [PATCH 19/20] wifi: mt76: mt7925: add MT7928 per-chip PCIe register definitions JB Tsai
2026-06-12 7:53 ` [PATCH 20/20] wifi: mt76: mt7925: add MT7928 PCIe support JB Tsai
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=20260612075339.2578327-3-jb.tsai@mediatek.com \
--to=jb.tsai@mediatek.com \
--cc=Deren.Wu@mediatek.com \
--cc=Leon.Yen@mediatek.com \
--cc=Quan.Zhou@mediatek.com \
--cc=Ryder.Lee@mediatek.com \
--cc=Sean.Wang@mediatek.com \
--cc=emery.hsin@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=litien.chang@mediatek.com \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=xiong.huang@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