From 6d75bcc06ae468dafeac123e7150fb7fd3ed3872 Mon Sep 17 00:00:00 2001 From: Avraham Stern Date: Fri, 15 May 2026 15:09:34 +0300 Subject: [PATCH] wifi: iwlwifi: mld: nan: add availability attribute to schedule config Add the availability attribute to the schedule config command. The firmware needs to add this attribute to schedule update frames (e.g. when ULW changed or the local schedule changed). Signed-off-by: Avraham Stern Link: https://patch.msgid.link/20260515150751.97809376508e.Ie7f00f97992016c6bb2f4a5c9fc201ac58eed8ce@changeid Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/mld/nan.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mld/nan.c b/drivers/net/wireless/intel/iwlwifi/mld/nan.c index 530ba263c5f0..d13b2374b642 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/nan.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/nan.c @@ -693,6 +693,14 @@ void iwl_mld_nan_vif_cfg_changed(struct iwl_mld *mld, break; case 2: cmd_size = sizeof(struct iwl_nan_schedule_cmd); + + if (sched_cfg->avail_blob_len && + !WARN_ON(sched_cfg->avail_blob_len > + sizeof(cmd.avail_attr.attr))) { + cmd.avail_attr.attr_len = sched_cfg->avail_blob_len; + memcpy(cmd.avail_attr.attr, sched_cfg->avail_blob, + sched_cfg->avail_blob_len); + } break; default: IWL_ERR(mld, "NAN: unsupported NAN schedule cmd version %d\n", @@ -727,6 +735,15 @@ void iwl_mld_nan_vif_cfg_changed(struct iwl_mld *mld, BUILD_BUG_ON(ARRAY_SIZE(sched_cfg->channels) != ARRAY_SIZE(cmd.channels)); + /* + * mac80211 removes unused channels before adding new ones, so it may + * update an empty schedule with an availability attribute because it + * is going to add channels later. Since the firmware does not expect + * an availability attribute without channels, ignore it in that case. + */ + if (empty_schedule) + cmd.avail_attr.attr_len = 0; + /* find links we can keep (same chanctx/PHY) */ for (i = 0; i < ARRAY_SIZE(sched_cfg->channels); i++) { struct ieee80211_chanctx_conf *chanctx;