wifi: iwlwifi: mld: add support for nan schedule config command version 2

Version 2 of the NAN schedule config command adds support for deferred
schedule update and passing the availability attribute blob to
firmware.
Add support for the new command version. Currently the new
functionality is not supported.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Link: https://patch.msgid.link/20260512222731.422e4bc47f84.I04b7dec6f3e48cfd950e7ff6f13484d0881d832e@changeid
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
This commit is contained in:
Avraham Stern
2026-05-12 22:34:39 +03:00
committed by Miri Korenblit
parent 050b99cb04
commit 9ac94f8404
2 changed files with 58 additions and 6 deletions

View File

@@ -1254,7 +1254,7 @@ struct iwl_nan_config_cmd {
} __packed; /* NAN_CONFIG_CMD_API_S_VER_1 */
/**
* struct iwl_nan_schedule_cmd - NAN schedule command
* struct iwl_nan_schedule_cmd_v1 - NAN schedule command
* @channels: per channel information
* @channels.availability_map: bitmap of slots this channel is advertising
* availability on, will be ULW'ed out if no link/inactive link is
@@ -1263,7 +1263,7 @@ struct iwl_nan_config_cmd {
* @channels.link_id: FW link ID, or %0xFF for unset
* @channels.reserved: (reserved)
*/
struct iwl_nan_schedule_cmd {
struct iwl_nan_schedule_cmd_v1 {
struct {
__le32 availability_map;
u8 channel_entry[6];
@@ -1272,6 +1272,44 @@ struct iwl_nan_schedule_cmd {
} __packed channels[NUM_PHY_CTX];
} __packed; /* NAN_SCHEDULE_CMD_API_S_VER_1 */
#define IWL_MAX_AVAILABILITY_ATTR_LEN 54
/**
* struct iwl_nan_schedule_cmd - NAN schedule command
* @channels: per channel information
* @channels.availability_map: bitmap of slots this channel is advertising
* availability on, will be ULW'ed out if no link/inactive link is
* referenced by the link ID below
* @channels.channel_entry: NAN channel entry descriptor
* @channels.link_id: FW link ID, or %0xFF for unset
* @channels.reserved: (reserved)
* @avail_attr: NAN availability attribute information
* @avail_attr.attr_len: length of the availability attribute
* @avail_attr.reserved: reserved
* @avail_attr.attr: the availability attribute including the attribute header
* @deferred: true if the firmware should defer applying the schedule until
* notifying all peers. For a deferred schedule update, the firmware should
* send a notification to the driver after the new schedule is applied.
* @reserved: reserved
*/
struct iwl_nan_schedule_cmd {
struct {
__le32 availability_map;
u8 channel_entry[6];
u8 link_id;
u8 reserved;
} __packed channels[NUM_PHY_CTX];
struct {
u8 attr_len;
u8 reserved;
u8 attr[IWL_MAX_AVAILABILITY_ATTR_LEN];
} __packed avail_attr;
u8 deferred;
u8 reserved[3];
} __packed; /* NAN_SCHEDULE_CMD_API_S_VER_2 */
/**
* struct iwl_nan_peer_cmd - NAN peer command
* @nmi_sta_id: NAN management station ID

View File

@@ -546,11 +546,27 @@ void iwl_mld_nan_vif_cfg_changed(struct iwl_mld *mld,
bool added_links = false;
bool empty_schedule = true;
int ret, i;
u16 cmd_size;
u32 cmd_id = WIDE_ID(MAC_CONF_GROUP, NAN_SCHEDULE_CMD);
u8 version = iwl_fw_lookup_cmd_ver(mld->fw, cmd_id, 0);
if (!(changes & BSS_CHANGED_NAN_LOCAL_SCHED))
return;
for (i = 0; i < ARRAY_SIZE(sched_cfg->channels); i++) {
switch (version) {
case 1:
cmd_size = sizeof(struct iwl_nan_schedule_cmd_v1);
break;
case 2:
cmd_size = sizeof(struct iwl_nan_schedule_cmd);
break;
default:
IWL_ERR(mld, "NAN: unsupported NAN schedule cmd version %d\n",
version);
return;
}
for (i = 0; i < ARRAY_SIZE(sched_cfg->channels); i++) {
if (!sched_cfg->channels[i].chanreq.oper.chan)
continue;
empty_schedule = false;
@@ -647,9 +663,7 @@ void iwl_mld_nan_vif_cfg_changed(struct iwl_mld *mld,
cmd.channels[chan_idx].availability_map |= cpu_to_le32(BIT(i));
}
ret = iwl_mld_send_cmd_pdu(mld,
WIDE_ID(MAC_CONF_GROUP, NAN_SCHEDULE_CMD),
&cmd);
ret = iwl_mld_send_cmd_pdu(mld, cmd_id, &cmd, cmd_size);
if (ret)
IWL_ERR(mld, "NAN: failed to update schedule (%d)\n", ret);