[PATCH 02/23] wifi: mt76: mt7925: add NMI/NDI MAC address setter helpers
Felix Fietkau
nbd at nbd.name
Tue Oct 6 02:25:55 PDT 2026
On 27.09.26 23:02, Sean Wang wrote:
> From: Chengwei Yu <chengwei.yu at mediatek.com>
>
> Add mt7925_nan_set_nmi_address() and mt7925_nan_set_ndi_address() for
> runtime MAC address changes: NMI goes through the MCU (firmware owns
> the hardware address), NDI updates vif->addr directly.
>
> Co-developed-by: Sean Wang <sean.wang at mediatek.com>
> Signed-off-by: Sean Wang <sean.wang at mediatek.com>
> Signed-off-by: Chengwei Yu <chengwei.yu at mediatek.com>
> ---
> .../net/wireless/mediatek/mt76/mt7925/nan.c | 48 +++++++++++++++++++
> .../net/wireless/mediatek/mt76/mt7925/nan.h | 8 ++++
> 2 files changed, 56 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/nan.c b/drivers/net/wireless/mediatek/mt76/mt7925/nan.c
> index 8a59f7b1aee2..abbd3f7b081c 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7925/nan.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/nan.c
> @@ -697,6 +697,54 @@ void mt7925_nan_mcu_event(struct mt792x_dev *dev, struct sk_buff *skb)
> }
> }
>
> +int mt7925_nan_set_nmi_address(struct ieee80211_vif *vif,
> + struct mt792x_dev *dev,
> + const u8 *mac_address)
> +{
> + struct mt76_dev *mdev = &dev->mt76;
> + struct {
> + u8 rsv[4];
> + struct mt7925_nan_nmi_addr_tlv nmi_addr_tlv;
> + } nmi_cmd = {
> + .nmi_addr_tlv = {
> + .tag = cpu_to_le16(NAN_UNI_CMD_CHANGE_NMI_ADDRESS),
> + .len = cpu_to_le16(sizeof(struct mt7925_nan_nmi_addr_tlv)),
> + },
> + };
> +
> + if (!dev || !vif || !mac_address)
> + return -EINVAL;
> +
> + if (is_zero_ether_addr(mac_address) ||
> + is_multicast_ether_addr(mac_address))
> + return -EINVAL;
> +
> + memcpy(nmi_cmd.nmi_addr_tlv.nmi_addr, mac_address, ETH_ALEN);
> +
> + return mt76_mcu_send_msg(mdev, MCU_UNI_CMD(NAN), &nmi_cmd,
> + sizeof(nmi_cmd), true);
> +}
> +
> +int mt7925_nan_set_ndi_address(struct ieee80211_vif *vif,
> + struct mt792x_dev *dev,
> + const u8 *mac_address)
> +{
> + if (!dev || !vif || !mac_address)
> + return -EINVAL;
> +
> + if (is_zero_ether_addr(mac_address) ||
> + is_multicast_ether_addr(mac_address))
> + return -EINVAL;
> +
> + /*
> + * The NDI address is not managed by firmware; it is the vif's own
> + * hardware address, so updating it locally is sufficient.
> + */
> + memcpy(vif->addr, mac_address, ETH_ALEN);
What about bss_conf->addr and the netdev addr. Do those need to be updated?
- Felix
More information about the Linux-mediatek
mailing list