[PATCH v5 18/21] wifi: mt76: mt7925: add MBMC event handling

Sean Wang
2026-04-25T19:51:55Z

Handle MBMC unsolicited events from firmware to report the current MBMC
state. This helps validate MT7927 band setup.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 +
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 31 +++++++++++++++++++
.../net/wireless/mediatek/mt76/mt7925/mcu.h | 3 +-
3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index 4691b9b5e2be..6d0429f40b0f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -1069,6 +1069,7 @@ enum {
MCU_UNI_EVENT_SCAN_DONE = 0x0e,
MCU_UNI_EVENT_RDD_REPORT = 0x11,
MCU_UNI_EVENT_ROC = 0x27,
+ MCU_UNI_EVENT_MBMC = 0x28,
MCU_UNI_EVENT_TX_DONE = 0x2d,
MCU_UNI_EVENT_THERMAL = 0x35,
MCU_UNI_EVENT_RSSI_MONITOR = 0x41,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index f7e14cc53dac..4a06f0a1ce03 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -566,6 +566,34 @@ mt7925_mcu_uni_debug_msg_event(struct mt792x_dev *dev, struct sk_buff *skb)
}
}

+static void
+mt7925_mcu_handle_mbmc_event(struct mt792x_dev *dev, struct sk_buff *skb)
+{
+ struct mbmc_conf_tlv *tlv;
+ u32 tlv_len;
+
+ skb_pull(skb, sizeof(struct mt7925_mcu_rxd) + 4);
+ tlv_len = skb->len;
+ tlv = (struct mbmc_conf_tlv *)skb->data;
+
+ while (tlv_len >= sizeof(*tlv) &&
+ le16_to_cpu(tlv->len) >= sizeof(*tlv) &&
+ le16_to_cpu(tlv->len) <= tlv_len) {
+ u16 tag = le16_to_cpu(tlv->tag);
+
+ if (tag == UNI_MBMC_SETTING || tag == UNI_MBMC_NO_RESP_SETTING) {
+ dev_dbg(dev->mt76.dev,
+ "MBMC event: tag=%u mbmc_en=%u\n",
+ tag, tlv->mbmc_en);
+ break;
+ }
+
+ tlv_len -= le16_to_cpu(tlv->len);
+ tlv = (struct mbmc_conf_tlv *)
+ ((u8 *)tlv + le16_to_cpu(tlv->len));
+ }
+}
+
static void
mt7925_mcu_uni_rx_unsolicited_event(struct mt792x_dev *dev,
struct sk_buff *skb)
@@ -584,6 +612,9 @@ mt7925_mcu_uni_rx_unsolicited_event(struct mt792x_dev *dev,
case MCU_UNI_EVENT_ROC:
mt7925_mcu_uni_roc_event(dev, skb);
break;
+ case MCU_UNI_EVENT_MBMC:
+ mt7925_mcu_handle_mbmc_event(dev, skb);
+ break;
case MCU_UNI_EVENT_SCAN_DONE:
mt7925_mcu_scan_event(dev, skb);
return;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index 56e2772f3ffe..293f173b23dd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -143,7 +143,8 @@ enum {
};

enum {
- UNI_MBMC_SETTING,
+ UNI_MBMC_SETTING = 0,
+ UNI_MBMC_NO_RESP_SETTING = 1,
};

enum {
--
2.43.0