[PATCH 03/23] wifi: mt76: mt7925: implement NAN MAC address randomization

Felix Fietkau nbd at nbd.name
Tue Oct 6 02:18:13 PDT 2026


On 27.09.26 23:02, Sean Wang wrote:
> From: Chengwei Yu <chengwei.yu at mediatek.com>
> 
> Add mt7925_nan_start/stop_mac_randomization() using a per-vif
> delayed_work and period stored in struct mt792x_nan.
> 
> Per-vif (not per-dev) because the NAN iface combinations allow up
> to two concurrent NAN_DATA vifs; a single dev-wide field would
> silently lose randomization for the second NDI or let it overwrite
> the first vif's pending work.
> 
> delayed_work (not timer_list) because the work function calls
> mt7925_nan_set_nmi/ndi_address() which invokes mt76_mcu_send_msg()
> with wait_resp=true; that can sleep, which is not allowed in softirq
> context. This is consistent with scan_work, mlo_pm_work and ps_work
> in this driver.
> 
> stop_mac_randomization() must be called without holding the dev
> mutex since the work function acquires it. No caller is wired up
> yet; the next patch does that in add/remove_interface.
> 
> 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   | 59 +++++++++++++++++++
>   .../net/wireless/mediatek/mt76/mt7925/nan.h   |  7 +++
>   drivers/net/wireless/mediatek/mt76/mt792x.h   |  9 +++
>   3 files changed, 75 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/nan.c b/drivers/net/wireless/mediatek/mt76/mt7925/nan.c
> index abbd3f7b081c..0b94bd4005d4 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7925/nan.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/nan.c
> @@ -745,6 +745,65 @@ int mt7925_nan_set_ndi_address(struct ieee80211_vif *vif,
> [...]
> +void mt7925_nan_start_mac_randomization(struct ieee80211_vif *vif,
> +					u32 period_sec)
> +{
> +	struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
> +	struct mt792x_dev *dev = mvif->phy->dev;
> +
> +	if (!period_sec)
> +		return;
> +
> +	mvif->nan.mac_rand_period_sec = period_sec;
> +
> +	ieee80211_queue_delayed_work(mt76_hw(dev), &mvif->nan.mac_rand_work, 0);
> +}
This function is added, but not used in this series.

- Felix



More information about the Linux-mediatek mailing list