u8 beacon_data[];
} __packed; /* NAN_CONFIG_CMD_API_S_VER_1 */
+/**
+ * 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
+ * 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)
+ */
+struct iwl_nan_schedule_cmd_v1 {
+ struct {
+ __le32 availability_map;
+ u8 channel_entry[6];
+ u8 link_id;
+ u8 reserved;
+ } __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.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 {
u8 link_id;
u8 reserved;
} __packed channels[NUM_PHY_CTX];
-} __packed; /* NAN_SCHEDULE_CMD_API_S_VER_1 */
+
+ 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
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;
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);