diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h index 75b477319096..dd850aeebdec 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h @@ -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 diff --git a/drivers/net/wireless/intel/iwlwifi/mld/nan.c b/drivers/net/wireless/intel/iwlwifi/mld/nan.c index 913f0acf172a..53a0c3b9bb33 100644 --- a/drivers/net/wireless/intel/iwlwifi/mld/nan.c +++ b/drivers/net/wireless/intel/iwlwifi/mld/nan.c @@ -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);