xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h (revision a34b0e4e21d6be3c3d620aa7f9dfbf0e9550c19e)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018-2019, 2021-2025 Intel Corporation
4  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6  */
7 #ifndef __iwl_fw_api_mac_cfg_h__
8 #define __iwl_fw_api_mac_cfg_h__
9 
10 #include "mac.h"
11 
12 /**
13  * enum iwl_mac_conf_subcmd_ids - mac configuration command IDs
14  */
15 enum iwl_mac_conf_subcmd_ids {
16 	/**
17 	 * @LOW_LATENCY_CMD: &struct iwl_mac_low_latency_cmd
18 	 */
19 	LOW_LATENCY_CMD = 0x3,
20 	/**
21 	 * @CHANNEL_SWITCH_TIME_EVENT_CMD: &struct iwl_chan_switch_te_cmd
22 	 */
23 	CHANNEL_SWITCH_TIME_EVENT_CMD = 0x4,
24 	/**
25 	 * @MISSED_VAP_NOTIF: &struct iwl_missed_vap_notif
26 	 */
27 	MISSED_VAP_NOTIF = 0xFA,
28 	/**
29 	 * @SESSION_PROTECTION_CMD: &struct iwl_mvm_session_prot_cmd
30 	 */
31 	SESSION_PROTECTION_CMD = 0x5,
32 	/**
33 	 * @CANCEL_CHANNEL_SWITCH_CMD: &struct iwl_cancel_channel_switch_cmd
34 	 */
35 	CANCEL_CHANNEL_SWITCH_CMD = 0x6,
36 	/**
37 	 * @MAC_CONFIG_CMD: &struct iwl_mac_config_cmd
38 	 */
39 	MAC_CONFIG_CMD = 0x8,
40 	/**
41 	 * @LINK_CONFIG_CMD: &struct iwl_link_config_cmd
42 	 */
43 	LINK_CONFIG_CMD = 0x9,
44 	/**
45 	 * @STA_CONFIG_CMD: &struct iwl_sta_cfg_cmd
46 	 */
47 	STA_CONFIG_CMD = 0xA,
48 	/**
49 	 * @AUX_STA_CMD: &struct iwl_aux_sta_cmd
50 	 */
51 	AUX_STA_CMD = 0xB,
52 	/**
53 	 * @STA_REMOVE_CMD: &struct iwl_remove_sta_cmd
54 	 */
55 	STA_REMOVE_CMD = 0xC,
56 	/**
57 	 * @STA_DISABLE_TX_CMD: &struct iwl_mvm_sta_disable_tx_cmd
58 	 */
59 	STA_DISABLE_TX_CMD = 0xD,
60 	/**
61 	 * @ROC_CMD: &struct iwl_roc_req
62 	 */
63 	ROC_CMD = 0xE,
64 	/**
65 	 * @TWT_OPERATION_CMD: &struct iwl_twt_operation_cmd
66 	 */
67 	TWT_OPERATION_CMD = 0x10,
68 	/**
69 	 * @NAN_CFG_CMD: &struct iwl_nan_config_cmd
70 	 */
71 	NAN_CFG_CMD = 0x12,
72 	/**
73 	 * @NAN_DW_END_NOTIF: &struct iwl_nan_dw_end_notif
74 	 */
75 	NAN_DW_END_NOTIF = 0xf4,
76 	/**
77 	 * @NAN_JOINED_CLUSTER_NOTIF: &struct iwl_nan_cluster_notif
78 	 */
79 	NAN_JOINED_CLUSTER_NOTIF = 0xf5,
80 	/**
81 	 * @MISSED_BEACONS_NOTIF: &struct iwl_missed_beacons_notif
82 	 */
83 	MISSED_BEACONS_NOTIF = 0xF6,
84 	/**
85 	 * @EMLSR_TRANS_FAIL_NOTIF: &struct iwl_esr_trans_fail_notif
86 	 */
87 	EMLSR_TRANS_FAIL_NOTIF = 0xF7,
88 	/**
89 	 * @ROC_NOTIF: &struct iwl_roc_notif
90 	 */
91 	ROC_NOTIF = 0xF8,
92 	/**
93 	 * @SESSION_PROTECTION_NOTIF: &struct iwl_session_prot_notif
94 	 */
95 	SESSION_PROTECTION_NOTIF = 0xFB,
96 
97 	/**
98 	 * @PROBE_RESPONSE_DATA_NOTIF: &struct iwl_probe_resp_data_notif
99 	 */
100 	PROBE_RESPONSE_DATA_NOTIF = 0xFC,
101 
102 	/**
103 	 * @CHANNEL_SWITCH_START_NOTIF: &struct iwl_channel_switch_start_notif
104 	 */
105 	CHANNEL_SWITCH_START_NOTIF = 0xFF,
106 
107 	/**
108 	 *@CHANNEL_SWITCH_ERROR_NOTIF: &struct iwl_channel_switch_error_notif
109 	 */
110 	CHANNEL_SWITCH_ERROR_NOTIF = 0xF9,
111 };
112 
113 #define IWL_P2P_NOA_DESC_COUNT	(2)
114 
115 /**
116  * struct iwl_p2p_noa_attr - NOA attr contained in probe resp FW notification
117  *
118  * @id: attribute id
119  * @len_low: length low half
120  * @len_high: length high half
121  * @idx: instance of NoA timing
122  * @ctwin: GO's ct window and pwer save capability
123  * @desc: NoA descriptor
124  * @reserved: reserved for alignment purposes
125  */
126 struct iwl_p2p_noa_attr {
127 	u8 id;
128 	u8 len_low;
129 	u8 len_high;
130 	u8 idx;
131 	u8 ctwin;
132 	struct ieee80211_p2p_noa_desc desc[IWL_P2P_NOA_DESC_COUNT];
133 	u8 reserved;
134 } __packed;
135 
136 #define IWL_PROBE_RESP_DATA_NO_CSA (0xff)
137 
138 /**
139  * struct iwl_probe_resp_data_notif - notification with NOA and CSA counter
140  *
141  * @mac_id: the mac which should send the probe response
142  * @noa_active: notifies if the noa attribute should be handled
143  * @noa_attr: P2P NOA attribute
144  * @csa_counter: current csa counter
145  * @reserved: reserved for alignment purposes
146  */
147 struct iwl_probe_resp_data_notif {
148 	__le32 mac_id;
149 	__le32 noa_active;
150 	struct iwl_p2p_noa_attr noa_attr;
151 	u8 csa_counter;
152 	u8 reserved[3];
153 } __packed; /* PROBE_RESPONSE_DATA_NTFY_API_S_VER_1 */
154 
155 /**
156  * struct iwl_missed_vap_notif - notification of missing vap detection
157  *
158  * @mac_id: the mac for which the ucode sends the notification for
159  * @num_beacon_intervals_elapsed: beacons elpased with no vap profile inside
160  * @profile_periodicity: beacons period to have our profile inside
161  * @reserved: reserved for alignment purposes
162  */
163 struct iwl_missed_vap_notif {
164 	__le32 mac_id;
165 	u8 num_beacon_intervals_elapsed;
166 	u8 profile_periodicity;
167 	u8 reserved[2];
168 } __packed; /* MISSED_VAP_NTFY_API_S_VER_1 */
169 
170 /**
171  * struct iwl_channel_switch_start_notif_v1 - Channel switch start notification
172  *
173  * @id_and_color: ID and color of the MAC
174  */
175 struct iwl_channel_switch_start_notif_v1 {
176 	__le32 id_and_color;
177 } __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */
178 
179 /**
180  * struct iwl_channel_switch_start_notif - Channel switch start notification
181  *
182  * @link_id: FW link id
183  */
184 struct iwl_channel_switch_start_notif {
185 	__le32 link_id;
186 } __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_3 */
187 
188 #define CS_ERR_COUNT_ERROR BIT(0)
189 #define CS_ERR_LONG_DELAY_AFTER_CS BIT(1)
190 #define CS_ERR_LONG_TX_BLOCK BIT(2)
191 #define CS_ERR_TX_BLOCK_TIMER_EXPIRED BIT(3)
192 
193 /**
194  * struct iwl_channel_switch_error_notif_v1 - Channel switch error notification
195  *
196  * @mac_id: the mac for which the ucode sends the notification for
197  * @csa_err_mask: mask of channel switch error that can occur
198  */
199 struct iwl_channel_switch_error_notif_v1 {
200 	__le32 mac_id;
201 	__le32 csa_err_mask;
202 } __packed; /* CHANNEL_SWITCH_ERROR_NTFY_API_S_VER_1 */
203 
204 /**
205  * struct iwl_channel_switch_error_notif - Channel switch error notification
206  *
207  * @link_id: FW link id
208  * @csa_err_mask: mask of channel switch error that can occur
209  */
210 struct iwl_channel_switch_error_notif {
211 	__le32 link_id;
212 	__le32 csa_err_mask;
213 } __packed; /* CHANNEL_SWITCH_ERROR_NTFY_API_S_VER_2 */
214 
215 /**
216  * struct iwl_cancel_channel_switch_cmd - Cancel Channel Switch command
217  *
218  * @id: the id of the link or mac that should cancel the channel switch
219  */
220 struct iwl_cancel_channel_switch_cmd {
221 	__le32 id;
222 } __packed; /* MAC_CANCEL_CHANNEL_SWITCH_S_VER_1 */
223 
224 /**
225  * struct iwl_chan_switch_te_cmd - Channel Switch Time Event command
226  *
227  * @mac_id: MAC ID for channel switch
228  * @action: action to perform, see &enum iwl_ctxt_action
229  * @tsf: beacon tsf
230  * @cs_count: channel switch count from CSA/eCSA IE
231  * @cs_delayed_bcn_count: if set to N (!= 0) GO/AP can delay N beacon intervals
232  *	at the new channel after the channel switch, otherwise (N == 0) expect
233  *	beacon right after the channel switch.
234  * @cs_mode: 1 - quiet, 0 - otherwise
235  * @reserved: reserved for alignment purposes
236  */
237 struct iwl_chan_switch_te_cmd {
238 	__le32 mac_id;
239 	__le32 action;
240 	__le32 tsf;
241 	u8 cs_count;
242 	u8 cs_delayed_bcn_count;
243 	u8 cs_mode;
244 	u8 reserved;
245 } __packed; /* MAC_CHANNEL_SWITCH_TIME_EVENT_S_VER_2 */
246 
247 /**
248  * struct iwl_mac_low_latency_cmd - set/clear mac to 'low-latency mode'
249  *
250  * @mac_id: MAC ID to whom to apply the low-latency configurations
251  * @low_latency_rx: 1/0 to set/clear Rx low latency direction
252  * @low_latency_tx: 1/0 to set/clear Tx low latency direction
253  * @reserved: reserved for alignment purposes
254  */
255 struct iwl_mac_low_latency_cmd {
256 	__le32 mac_id;
257 	u8 low_latency_rx;
258 	u8 low_latency_tx;
259 	__le16 reserved;
260 } __packed; /* MAC_LOW_LATENCY_API_S_VER_1 */
261 
262 /**
263  * struct iwl_mac_client_data - configuration data for client MAC context
264  *
265  * @is_assoc: 1 for associated state, 0 otherwise
266  * @esr_transition_timeout: the timeout required by the AP for the
267  *	eSR transition.
268  *	Available only from version 2 of the command.
269  *	This value comes from the EMLSR transition delay in the EML
270  *	Capabilities subfield.
271  * @medium_sync_delay: the value as it appears in P802.11be_D2.2 Figure 9-1002j.
272  * @assoc_id: unique ID assigned by the AP during association
273  * @reserved1: alignment
274  * @data_policy: see &enum iwl_mac_data_policy
275  * @reserved2: alignment
276  * @ctwin: client traffic window in TU (period after TBTT when GO is present).
277  *	0 indicates that there is no CT window.
278  */
279 struct iwl_mac_client_data {
280 	u8 is_assoc;
281 	u8 esr_transition_timeout;
282 	__le16 medium_sync_delay;
283 
284 	__le16 assoc_id;
285 	__le16 reserved1;
286 	__le16 data_policy;
287 	__le16 reserved2;
288 	__le32 ctwin;
289 } __packed; /* MAC_CONTEXT_CONFIG_CLIENT_DATA_API_S_VER_2 */
290 
291 /**
292  * struct iwl_mac_p2p_dev_data  - configuration data for P2P device MAC context
293  *
294  * @is_disc_extended: if set to true, P2P Device discoverability is enabled on
295  *	other channels as well. This should be to true only in case that the
296  *	device is discoverable and there is an active GO. Note that setting this
297  *	field when not needed, will increase the number of interrupts and have
298  *	effect on the platform power, as this setting opens the Rx filters on
299  *	all macs.
300  */
301 struct iwl_mac_p2p_dev_data {
302 	__le32 is_disc_extended;
303 } __packed; /* MAC_CONTEXT_CONFIG_P2P_DEV_DATA_API_S_VER_1 */
304 
305 /**
306  * enum iwl_mac_config_filter_flags - MAC context configuration filter flags
307  *
308  * @MAC_CFG_FILTER_PROMISC: accept all data frames
309  * @MAC_CFG_FILTER_ACCEPT_CONTROL_AND_MGMT: pass all management and
310  *	control frames to the host
311  * @MAC_CFG_FILTER_ACCEPT_GRP: accept multicast frames
312  * @MAC_CFG_FILTER_ACCEPT_BEACON: accept beacon frames
313  * @MAC_CFG_FILTER_ACCEPT_BCAST_PROBE_RESP: accept broadcast probe response
314  * @MAC_CFG_FILTER_ACCEPT_PROBE_REQ: accept probe requests
315  */
316 enum iwl_mac_config_filter_flags {
317 	MAC_CFG_FILTER_PROMISC			= BIT(0),
318 	MAC_CFG_FILTER_ACCEPT_CONTROL_AND_MGMT	= BIT(1),
319 	MAC_CFG_FILTER_ACCEPT_GRP		= BIT(2),
320 	MAC_CFG_FILTER_ACCEPT_BEACON		= BIT(3),
321 	MAC_CFG_FILTER_ACCEPT_BCAST_PROBE_RESP	= BIT(4),
322 	MAC_CFG_FILTER_ACCEPT_PROBE_REQ		= BIT(5),
323 }; /* MAC_FILTER_FLAGS_MASK_E_VER_1 */
324 
325 /**
326  * struct iwl_mac_wifi_gen_support_v2 - parameters of iwl_mac_config_cmd
327  *	with support up to eht as in version 2 of the command
328  *
329  * @he_support: does this MAC support HE
330  * @he_ap_support: HE AP enabled, "pseudo HE", no trigger frame handling
331  * @eht_support: does this MAC support EHT. Requires he_support
332  */
333 struct iwl_mac_wifi_gen_support_v2 {
334 	__le16 he_support;
335 	__le16 he_ap_support;
336 	__le32 eht_support;
337 } __packed;
338 
339 /**
340  * struct iwl_mac_wifi_gen_support - parameters of iwl_mac_config_cmd
341  *	with support up to uhr as in version 3 of the command
342  * ( MAC_CONTEXT_CONFIG_CMD = 0x8 )
343  *
344  * @he_support: does this MAC support HE
345  * @he_ap_support: HE AP enabled, "pseudo HE", no trigger frame handling
346  * @eht_support: does this MAC support EHT. Requires he_support
347  * @uhr_support: does this MAC support UHR. Requires eht_support
348  * @reserved: reserved for alignment and to match version 2's size
349  */
350 struct iwl_mac_wifi_gen_support {
351 	u8 he_support;
352 	u8 he_ap_support;
353 	u8 eht_support;
354 	u8 uhr_support;
355 	__le32 reserved;
356 } __packed;
357 
358 /**
359  * struct iwl_mac_config_cmd - command structure to configure MAC contexts in
360  *	MLD API for versions 2 and 3
361  * ( MAC_CONTEXT_CONFIG_CMD = 0x8 )
362  *
363  * @id_and_color: ID and color of the MAC
364  * @action: action to perform, see &enum iwl_ctxt_action
365  * @mac_type: one of &enum iwl_mac_types
366  * @local_mld_addr: mld address
367  * @reserved_for_local_mld_addr: reserved
368  * @filter_flags: combination of &enum iwl_mac_config_filter_flags
369  * @wifi_gen_v2: he/eht parameters as in cmd version 2
370  * @wifi_gen: he/eht/uhr parameters as in cmd version 3
371  * @nic_not_ack_enabled: mark that the NIC doesn't support receiving
372  *	ACK-enabled AGG, (i.e. both BACK and non-BACK frames in single AGG).
373  *	If the NIC is not ACK_ENABLED it may use the EOF-bit in first non-0
374  *	len delim to determine if AGG or single.
375  * @client: client mac data
376  * @p2p_dev: mac data for p2p device
377  */
378 struct iwl_mac_config_cmd {
379 	__le32 id_and_color;
380 	__le32 action;
381 	/* MAC_CONTEXT_TYPE_API_E */
382 	__le32 mac_type;
383 	u8 local_mld_addr[6];
384 	__le16 reserved_for_local_mld_addr;
385 	__le32 filter_flags;
386 	union {
387 		struct iwl_mac_wifi_gen_support_v2 wifi_gen_v2;
388 		struct iwl_mac_wifi_gen_support wifi_gen;
389 	};
390 	__le32 nic_not_ack_enabled;
391 	/* MAC_CONTEXT_CONFIG_SPECIFIC_DATA_API_U_VER_2 */
392 	union {
393 		struct iwl_mac_client_data client;
394 		struct iwl_mac_p2p_dev_data p2p_dev;
395 	};
396 } __packed; /* MAC_CONTEXT_CONFIG_CMD_API_S_VER_2_VER_3 */
397 
398 /**
399  * enum iwl_link_ctx_modify_flags - indicate to the fw what fields are being
400  *	modified in &iwl_link_ctx_cfg_cmd
401  *
402  * @LINK_CONTEXT_MODIFY_ACTIVE: covers iwl_link_ctx_cfg_cmd::active
403  * @LINK_CONTEXT_MODIFY_RATES_INFO: covers iwl_link_ctx_cfg_cmd::cck_rates,
404  *	iwl_link_ctx_cfg_cmd::ofdm_rates,
405  *	iwl_link_ctx_cfg_cmd::cck_short_preamble,
406  *	iwl_link_ctx_cfg_cmd::short_slot
407  * @LINK_CONTEXT_MODIFY_PROTECT_FLAGS: covers
408  *	iwl_link_ctx_cfg_cmd::protection_flags
409  * @LINK_CONTEXT_MODIFY_QOS_PARAMS: covers iwl_link_ctx_cfg_cmd::qos_flags,
410  *	iwl_link_ctx_cfg_cmd::ac,
411  * @LINK_CONTEXT_MODIFY_BEACON_TIMING: covers iwl_link_ctx_cfg_cmd::bi,
412  *	iwl_link_ctx_cfg_cmd::dtim_interval,
413  *	iwl_link_ctx_cfg_cmd::dtim_time,
414  *	iwl_link_ctx_cfg_cmd::dtim_tsf,
415  *	iwl_link_ctx_cfg_cmd::assoc_beacon_arrive_time.
416  *	This flag can be set only once after assoc.
417  * @LINK_CONTEXT_MODIFY_HE_PARAMS: covers
418  *	iwl_link_ctx_cfg_cmd::htc_trig_based_pkt_ext
419  *	iwl_link_ctx_cfg_cmd::rand_alloc_ecwmin,
420  *	iwl_link_ctx_cfg_cmd::rand_alloc_ecwmax,
421  *	iwl_link_ctx_cfg_cmd::trig_based_txf,
422  *	iwl_link_ctx_cfg_cmd::bss_color,
423  *	iwl_link_ctx_cfg_cmd::ndp_fdbk_buff_th_exp,
424  *	iwl_link_ctx_cfg_cmd::ref_bssid_addr
425  *	iwl_link_ctx_cfg_cmd::bssid_index,
426  *	iwl_link_ctx_cfg_cmd::frame_time_rts_th.
427  *	This flag can be set any time.
428  * @LINK_CONTEXT_MODIFY_BSS_COLOR_DISABLE: covers
429  *	iwl_link_ctx_cfg_cmd::bss_color_disable
430  * @LINK_CONTEXT_MODIFY_EHT_PARAMS: covers iwl_link_ctx_cfg_cmd::puncture_mask.
431  *	This flag can be set only if the MAC that this link relates to has
432  *	eht_support set to true. No longer used since _VER_3 of this command.
433  * @LINK_CONTEXT_MODIFY_BANDWIDTH: Covers iwl_link_ctx_cfg_cmd::modify_bandwidth.
434  *	Request RX OMI to the AP to modify bandwidth of this link.
435  * @LINK_CONTEXT_MODIFY_UHR_PARAMS: covers iwl_link_ctx_cfg_cmd::npca_params and
436  *	iwl_link_ctx_cfg_cmd::prio_edca_params. Since _VER_7.
437  * @LINK_CONTEXT_MODIFY_ALL: set all above flags
438  */
439 enum iwl_link_ctx_modify_flags {
440 	LINK_CONTEXT_MODIFY_ACTIVE		= BIT(0),
441 	LINK_CONTEXT_MODIFY_RATES_INFO		= BIT(1),
442 	LINK_CONTEXT_MODIFY_PROTECT_FLAGS	= BIT(2),
443 	LINK_CONTEXT_MODIFY_QOS_PARAMS		= BIT(3),
444 	LINK_CONTEXT_MODIFY_BEACON_TIMING	= BIT(4),
445 	LINK_CONTEXT_MODIFY_HE_PARAMS		= BIT(5),
446 	LINK_CONTEXT_MODIFY_BSS_COLOR_DISABLE	= BIT(6),
447 	LINK_CONTEXT_MODIFY_EHT_PARAMS		= BIT(7),
448 	LINK_CONTEXT_MODIFY_BANDWIDTH		= BIT(8),
449 	LINK_CONTEXT_MODIFY_UHR_PARAMS		= BIT(9),
450 	LINK_CONTEXT_MODIFY_ALL			= 0xff,
451 }; /* LINK_CONTEXT_MODIFY_MASK_E_VER_1 */
452 
453 /**
454  * enum iwl_link_ctx_protection_flags - link protection flags
455  * @LINK_PROT_FLG_TGG_PROTECT: 11g protection when transmitting OFDM frames,
456  *	this will require CCK RTS/CTS2self.
457  *	RTS/CTS will protect full burst time.
458  * @LINK_PROT_FLG_HT_PROT: enable HT protection
459  * @LINK_PROT_FLG_FAT_PROT: protect 40 MHz transmissions
460  * @LINK_PROT_FLG_SELF_CTS_EN: allow CTS2self
461  */
462 enum iwl_link_ctx_protection_flags {
463 	LINK_PROT_FLG_TGG_PROTECT	= BIT(0),
464 	LINK_PROT_FLG_HT_PROT		= BIT(1),
465 	LINK_PROT_FLG_FAT_PROT		= BIT(2),
466 	LINK_PROT_FLG_SELF_CTS_EN	= BIT(3),
467 }; /* LINK_PROTECT_FLAGS_E_VER_1 */
468 
469 /**
470  * enum iwl_link_ctx_flags - link context flags
471  *
472  * @LINK_FLG_BSS_COLOR_DIS: BSS color disable, don't use the BSS
473  *	color for RX filter but use MAC header
474  *	enabled AGG, i.e. both BACK and non-BACK frames in a single AGG
475  * @LINK_FLG_MU_EDCA_CW: indicates that there is an element of MU EDCA
476  *	parameter set, i.e. the backoff counters for trig-based ACs
477  * @LINK_FLG_RU_2MHZ_BLOCK: indicates that 26-tone RU OFDMA transmission are
478  *      not allowed (as there are OBSS that might classify such transmissions as
479  *      radar pulses).
480  * @LINK_FLG_NDP_FEEDBACK_ENABLED: mark support for NDP feedback and change
481  *	of threshold
482  */
483 enum iwl_link_ctx_flags {
484 	LINK_FLG_BSS_COLOR_DIS		= BIT(0),
485 	LINK_FLG_MU_EDCA_CW		= BIT(1),
486 	LINK_FLG_RU_2MHZ_BLOCK		= BIT(2),
487 	LINK_FLG_NDP_FEEDBACK_ENABLED	= BIT(3),
488 }; /* LINK_CONTEXT_FLAG_E_VER_1 */
489 
490 /**
491  * enum iwl_link_modify_bandwidth - link modify (RX OMI) bandwidth
492  * @IWL_LINK_MODIFY_BW_20: request 20 MHz
493  * @IWL_LINK_MODIFY_BW_40: request 40 MHz
494  * @IWL_LINK_MODIFY_BW_80: request 80 MHz
495  * @IWL_LINK_MODIFY_BW_160: request 160 MHz
496  * @IWL_LINK_MODIFY_BW_320: request 320 MHz
497  */
498 enum iwl_link_modify_bandwidth {
499 	IWL_LINK_MODIFY_BW_20,
500 	IWL_LINK_MODIFY_BW_40,
501 	IWL_LINK_MODIFY_BW_80,
502 	IWL_LINK_MODIFY_BW_160,
503 	IWL_LINK_MODIFY_BW_320,
504 };
505 
506 /**
507  * enum iwl_npca_flags - NPCA flags
508  * @IWL_NPCA_FLAG_MAC_HDR_BASED: MAC header based NPCA operation
509  *	permitted in the BSS (MOPLEN)
510  */
511 enum iwl_npca_flags {
512 	IWL_NPCA_FLAG_MAC_HDR_BASED = BIT(0),
513 }; /* NPCA_FLAG_E */
514 
515 /**
516  * struct iwl_npca_params - NPCA parameters (non-primary channel access)
517  *
518  * @dis_subch_bmap: disabled subchannel bitmap for NPCA
519  * @switch_delay: after switch, delay TX according to destination AP
520  * @switch_back_delay: switch back to control channel before OBSS frame end
521  * @initial_qsrc: Indicates the value that is used to initialize the
522  *	EDCAF QSRC[AC] variables
523  * @min_dur_threshold: minimum PPDU time to switch to the non-primary
524  *	NPCA channel (usec)
525  * @flags: NPCA flags, see &enum iwl_npca_flags
526  * @reserved: reserved for alignment purposes
527  */
528 struct iwl_npca_params {
529 	__le16 dis_subch_bmap;
530 	u8 switch_delay;
531 	u8 switch_back_delay;
532 	u8 initial_qsrc;
533 	u8 min_dur_threshold;
534 	u8 flags;
535 	u8 reserved;
536 } __packed; /* NPCA_PARAM_API_S_VER_2 */
537 
538 /**
539  * struct iwl_link_config_cmd - command structure to configure the LINK context
540  *	in MLD API
541  * ( LINK_CONFIG_CMD =0x9 )
542  *
543  * @action: action to perform, see &enum iwl_ctxt_action
544  * @link_id: the id of the link that this cmd configures
545  * @mac_id: interface ID. Relevant only if action is FW_CTXT_ACTION_ADD
546  * @phy_id: PHY index. Can be changed only if the link was inactive
547  *	(and stays inactive). If the link is active (or becomes active),
548  *	this field is ignored.
549  * @local_link_addr: the links MAC address. Can be changed only if the link was
550  *	inactive (and stays inactive). If the link is active
551  *	(or becomes active), this field is ignored.
552  * @reserved_for_local_link_addr: reserved
553  * @modify_mask: from &enum iwl_link_ctx_modify_flags, selects what to change.
554  *	Relevant only if action is FW_CTXT_ACTION_MODIFY
555  * @active: indicates whether the link is active or not
556  * @listen_lmac: indicates whether the link should be allocated on the Listen
557  *	Lmac or on the Main Lmac. Cannot be changed on an active Link.
558  *	Relevant only for eSR.
559  * @block_tx: tell the firmware that this link can't Tx. This should be used
560  *	only when a link is de-activated because of CSA with mode = 1.
561  *	Available since version 5.
562  * @modify_bandwidth: bandwidth request value for RX OMI (see also
563  *	%LINK_CONTEXT_MODIFY_BANDWIDTH), from &enum iwl_link_modify_bandwidth.
564  * @reserved1: in version 2, listen_lmac became reserved
565  * @cck_rates: basic rates available for CCK
566  * @ofdm_rates: basic rates available for OFDM
567  * @cck_short_preamble: 1 for enabling short preamble, 0 otherwise
568  * @short_slot: 1 for enabling short slots, 0 otherwise
569  * @protection_flags: combination of &enum iwl_link_ctx_protection_flags
570  * @qos_flags: from &enum iwl_mac_qos_flags
571  * @ac: one iwl_mac_qos configuration for each AC
572  * @htc_trig_based_pkt_ext: default PE in 4us units
573  * @rand_alloc_ecwmin: random CWmin = 2**ECWmin-1
574  * @rand_alloc_ecwmax: random CWmax = 2**ECWmax-1
575  * @ndp_fdbk_buff_th_exp: set exponent for the NDP feedback buffered threshold
576  * @trig_based_txf: MU EDCA Parameter set for the trigger based traffic queues
577  * @bi: beacon interval in TU, applicable only when associated
578  * @dtim_interval: DTIM interval in TU.
579  *	Relevant only for GO, otherwise this is offloaded.
580  * @puncture_mask: puncture mask for EHT (removed in VER_3)
581  * @frame_time_rts_th: HE duration RTS threshold, in units of 32us
582  * @flags: a combination from &enum iwl_link_ctx_flags
583  * @flags_mask: what of %flags have changed. Also &enum iwl_link_ctx_flags
584  * Below fields are for multi-bssid:
585  * @ref_bssid_addr: reference BSSID used by the AP
586  * @reserved_for_ref_bssid_addr: reserved
587  * @bssid_index: index of the associated VAP
588  * @bss_color: 11ax AP ID that is used in the HE SIG-A to mark inter BSS frame
589  * @spec_link_id: link_id as the AP knows it
590  * @ul_mu_data_disable: OM Control UL MU Data Disable RX Support (bit 44) in
591  *	HE MAC Capabilities information field as defined in figure 9-897 in
592  *	IEEE802.11REVme-D5.0
593  * @ibss_bssid_addr: bssid for ibss
594  * @reserved_for_ibss_bssid_addr: reserved
595  * @npca_params: NPCA parameters
596  * @prio_edca_params: priority EDCA parameters for enhanced QoS
597  * @reserved3: reserved for future use
598  */
599 struct iwl_link_config_cmd {
600 	__le32 action;
601 	__le32 link_id;
602 	__le32 mac_id;
603 	__le32 phy_id;
604 	u8 local_link_addr[6];
605 	__le16 reserved_for_local_link_addr;
606 	__le32 modify_mask;
607 	__le32 active;
608 	union {
609 		__le32 listen_lmac; /* only _VER_1 */
610 		struct {
611 			u8 block_tx; /* since _VER_5 */
612 			u8 modify_bandwidth; /* since _VER_6 */
613 			u8 reserved1[2];
614 		};
615 	};
616 	__le32 cck_rates;
617 	__le32 ofdm_rates;
618 	__le32 cck_short_preamble;
619 	__le32 short_slot;
620 	__le32 protection_flags;
621 	/* MAC_QOS_PARAM_API_S_VER_1 */
622 	__le32 qos_flags;
623 	struct iwl_ac_qos ac[AC_NUM + 1];
624 	u8 htc_trig_based_pkt_ext;
625 	u8 rand_alloc_ecwmin;
626 	u8 rand_alloc_ecwmax;
627 	u8 ndp_fdbk_buff_th_exp;
628 	struct iwl_he_backoff_conf trig_based_txf[AC_NUM];
629 	__le32 bi;
630 	__le32 dtim_interval;
631 	__le16 puncture_mask; /* removed in _VER_3 */
632 	__le16 frame_time_rts_th;
633 	__le32 flags;
634 	__le32 flags_mask; /* removed in _VER_6 */
635 	/* The below fields are for multi-bssid */
636 	u8 ref_bssid_addr[6];
637 	__le16 reserved_for_ref_bssid_addr;
638 	u8 bssid_index;
639 	u8 bss_color;
640 	u8 spec_link_id;
641 	u8 ul_mu_data_disable;
642 	u8 ibss_bssid_addr[6];
643 	__le16 reserved_for_ibss_bssid_addr;
644 	struct iwl_npca_params npca_params; /* since _VER_7 */
645 	struct iwl_ac_qos prio_edca_params; /* since _VER_7 */
646 	__le32 reserved3[4];
647 } __packed; /* LINK_CONTEXT_CONFIG_CMD_API_S_VER_1, _VER_2, _VER_3, _VER_4,
648 	     *				    _VER_5, _VER_6, _VER_7, _VER_8 */
649 
650 /* Currently FW supports link ids in the range 0-3 and can have
651  * at most two active links for each vif.
652  */
653 #define IWL_FW_MAX_ACTIVE_LINKS_NUM 2
654 #define IWL_FW_MAX_LINK_ID 3
655 
656 /**
657  * enum iwl_fw_sta_type - FW station types
658  * @STATION_TYPE_PEER: represents a peer - AP in BSS, a TDLS sta, a client in
659  *	P2P.
660  * @STATION_TYPE_BCAST_MGMT: The station used to send beacons and
661  *	probe responses. Also used for traffic injection in sniffer mode
662  * @STATION_TYPE_MCAST: the station used for BCAST / MCAST in GO. Will be
663  *	suspended / resumed at the right timing depending on the clients'
664  *	power save state and the DTIM timing
665  * @STATION_TYPE_AUX: aux sta. In the FW there is no need for a special type
666  *	for the aux sta, so this type is only for driver - internal use.
667  */
668 enum iwl_fw_sta_type {
669 	STATION_TYPE_PEER,
670 	STATION_TYPE_BCAST_MGMT,
671 	STATION_TYPE_MCAST,
672 	STATION_TYPE_AUX,
673 }; /* STATION_TYPE_E_VER_1 */
674 
675 /**
676  * struct iwl_sta_cfg_cmd_v1 - cmd structure to add a peer sta to the uCode's
677  *	station table
678  * ( STA_CONFIG_CMD = 0xA )
679  *
680  * @sta_id: index of station in uCode's station table
681  * @link_id: the id of the link that is used to communicate with this sta
682  * @peer_mld_address: the peers mld address
683  * @reserved_for_peer_mld_address: reserved
684  * @peer_link_address: the address of the link that is used to communicate
685  *	with this sta
686  * @reserved_for_peer_link_address: reserved
687  * @station_type: type of this station. See &enum iwl_fw_sta_type
688  * @assoc_id: for GO only
689  * @beamform_flags: beam forming controls
690  * @mfp: indicates whether the STA uses management frame protection or not.
691  * @mimo: indicates whether the sta uses mimo or not
692  * @mimo_protection: indicates whether the sta uses mimo protection or not
693  * @ack_enabled: indicates that the AP supports receiving ACK-
694  *	enabled AGG, i.e. both BACK and non-BACK frames in a single AGG
695  * @trig_rnd_alloc: indicates that trigger based random allocation
696  *	is enabled according to UORA element existence
697  * @tx_ampdu_spacing: minimum A-MPDU spacing:
698  *	4 - 2us density, 5 - 4us density, 6 - 8us density, 7 - 16us density
699  * @tx_ampdu_max_size: maximum A-MPDU length: 0 - 8K, 1 - 16K, 2 - 32K,
700  *	3 - 64K, 4 - 128K, 5 - 256K, 6 - 512K, 7 - 1024K.
701  * @sp_length: the size of the SP in actual number of frames
702  * @uapsd_acs:  4 LS bits are trigger enabled ACs, 4 MS bits are the deliver
703  *	enabled ACs.
704  * @pkt_ext: optional, exists according to PPE-present bit in the HE/EHT-PHY
705  *	capa
706  * @htc_flags: which features are supported in HTC
707  */
708 struct iwl_sta_cfg_cmd_v1 {
709 	__le32 sta_id;
710 	__le32 link_id;
711 	u8 peer_mld_address[ETH_ALEN];
712 	__le16 reserved_for_peer_mld_address;
713 	u8 peer_link_address[ETH_ALEN];
714 	__le16 reserved_for_peer_link_address;
715 	__le32 station_type;
716 	__le32 assoc_id;
717 	__le32 beamform_flags;
718 	__le32 mfp;
719 	__le32 mimo;
720 	__le32 mimo_protection;
721 	__le32 ack_enabled;
722 	__le32 trig_rnd_alloc;
723 	__le32 tx_ampdu_spacing;
724 	__le32 tx_ampdu_max_size;
725 	__le32 sp_length;
726 	__le32 uapsd_acs;
727 	struct iwl_he_pkt_ext_v2 pkt_ext;
728 	__le32 htc_flags;
729 } __packed; /* STA_CMD_API_S_VER_1 */
730 
731 /**
732  * struct iwl_sta_cfg_cmd - cmd structure to add a peer sta to the uCode's
733  *	station table
734  * ( STA_CONFIG_CMD = 0xA )
735  *
736  * @sta_id: index of station in uCode's station table
737  * @link_id: the id of the link that is used to communicate with this sta
738  * @peer_mld_address: the peers mld address
739  * @reserved_for_peer_mld_address: reserved
740  * @peer_link_address: the address of the link that is used to communicate
741  *	with this sta
742  * @reserved_for_peer_link_address: reserved
743  * @station_type: type of this station. See &enum iwl_fw_sta_type
744  * @assoc_id: for GO only
745  * @beamform_flags: beam forming controls
746  * @mfp: indicates whether the STA uses management frame protection or not.
747  * @mimo: indicates whether the sta uses mimo or not
748  * @mimo_protection: indicates whether the sta uses mimo protection or not
749  * @ack_enabled: indicates that the AP supports receiving ACK-
750  *	enabled AGG, i.e. both BACK and non-BACK frames in a single AGG
751  * @trig_rnd_alloc: indicates that trigger based random allocation
752  *	is enabled according to UORA element existence
753  * @tx_ampdu_spacing: minimum A-MPDU spacing:
754  *	4 - 2us density, 5 - 4us density, 6 - 8us density, 7 - 16us density
755  * @tx_ampdu_max_size: maximum A-MPDU length: 0 - 8K, 1 - 16K, 2 - 32K,
756  *	3 - 64K, 4 - 128K, 5 - 256K, 6 - 512K, 7 - 1024K.
757  * @sp_length: the size of the SP in actual number of frames
758  * @uapsd_acs:  4 LS bits are trigger enabled ACs, 4 MS bits are the deliver
759  *	enabled ACs.
760  * @pkt_ext: optional, exists according to PPE-present bit in the HE/EHT-PHY
761  *	capa
762  * @htc_flags: which features are supported in HTC
763  * @use_ldpc_x2_cw: Indicates whether to use LDPC with double CW
764  * @use_icf: Indicates whether to use ICF instead of RTS
765  * @dps_pad_time: DPS (Dynamic Power Save) padding delay resolution to ensure
766  *	proper timing alignment
767  * @dps_trans_delay: DPS minimal time that takes the peer to return to low power
768  * @mic_prep_pad_delay: MIC prep time padding
769  * @mic_compute_pad_delay: MIC compute time padding
770  * @reserved: Reserved for alignment
771  */
772 struct iwl_sta_cfg_cmd {
773 	__le32 sta_id;
774 	__le32 link_id;
775 	u8 peer_mld_address[ETH_ALEN];
776 	__le16 reserved_for_peer_mld_address;
777 	u8 peer_link_address[ETH_ALEN];
778 	__le16 reserved_for_peer_link_address;
779 	__le32 station_type;
780 	__le32 assoc_id;
781 	__le32 beamform_flags;
782 	__le32 mfp;
783 	__le32 mimo;
784 	__le32 mimo_protection;
785 	__le32 ack_enabled;
786 	__le32 trig_rnd_alloc;
787 	__le32 tx_ampdu_spacing;
788 	__le32 tx_ampdu_max_size;
789 	__le32 sp_length;
790 	__le32 uapsd_acs;
791 	struct iwl_he_pkt_ext_v2 pkt_ext;
792 	__le32 htc_flags;
793 	u8 use_ldpc_x2_cw;
794 	u8 use_icf;
795 	u8 dps_pad_time;
796 	u8 dps_trans_delay;
797 	u8 mic_prep_pad_delay;
798 	u8 mic_compute_pad_delay;
799 	u8 reserved[2];
800 } __packed; /* STA_CMD_API_S_VER_2 */
801 
802 /**
803  * struct iwl_aux_sta_cmd - command for AUX STA configuration
804  * ( AUX_STA_CMD = 0xB )
805  *
806  * @sta_id: index of aux sta to configure
807  * @lmac_id: ?
808  * @mac_addr: mac addr of the auxilary sta
809  * @reserved_for_mac_addr: reserved
810  */
811 struct iwl_aux_sta_cmd {
812 	__le32 sta_id;
813 	__le32 lmac_id;
814 	u8 mac_addr[ETH_ALEN];
815 	__le16 reserved_for_mac_addr;
816 
817 } __packed; /* AUX_STA_CMD_API_S_VER_1 */
818 
819 /**
820  * struct iwl_remove_sta_cmd - a cmd structure to remove a sta added by
821  *	STA_CONFIG_CMD or AUX_STA_CONFIG_CMD
822  * ( STA_REMOVE_CMD = 0xC )
823  *
824  * @sta_id: index of station to remove
825  */
826 struct iwl_remove_sta_cmd {
827 	__le32 sta_id;
828 } __packed; /* REMOVE_STA_API_S_VER_1 */
829 
830 /**
831  * struct iwl_mvm_sta_disable_tx_cmd - disable / re-enable tx to a sta
832  * ( STA_DISABLE_TX_CMD = 0xD )
833  *
834  * @sta_id: index of the station to disable tx to
835  * @disable: indicates if to disable or re-enable tx
836  */
837 struct iwl_mvm_sta_disable_tx_cmd {
838 	__le32 sta_id;
839 	__le32 disable;
840 } __packed; /* STA_DISABLE_TX_API_S_VER_1 */
841 
842 /**
843  * enum iwl_mvm_fw_esr_recommendation - FW recommendation code
844  * @ESR_RECOMMEND_LEAVE: recommendation to leave EMLSR
845  * @ESR_FORCE_LEAVE: force exiting EMLSR
846  * @ESR_RECOMMEND_ENTER: recommendation to enter EMLSR
847  */
848 enum iwl_mvm_fw_esr_recommendation {
849 	ESR_RECOMMEND_LEAVE,
850 	ESR_FORCE_LEAVE,
851 	ESR_RECOMMEND_ENTER,
852 }; /* ESR_MODE_RECOMMENDATION_CODE_API_E_VER_1 */
853 
854 /**
855  * struct iwl_esr_mode_notif_v1 - FW recommendation/force for EMLSR mode
856  *
857  * @action: the action to apply on EMLSR state.
858  *	See &iwl_mvm_fw_esr_recommendation
859  */
860 struct iwl_esr_mode_notif_v1 {
861 	__le32 action;
862 } __packed; /* ESR_MODE_RECOMMENDATION_NTFY_API_S_VER_1 */
863 
864 /**
865  * enum iwl_esr_leave_reason - reasons for leaving EMLSR mode
866  *
867  * @ESR_LEAVE_REASON_OMI_MU_UL_DISALLOWED: OMI MU UL disallowed
868  * @ESR_LEAVE_REASON_NO_TRIG_FOR_ESR_STA: No trigger for EMLSR station
869  * @ESR_LEAVE_REASON_NO_ESR_STA_IN_MU_DL: No EMLSR station in MU DL
870  * @ESR_LEAVE_REASON_BAD_ACTIV_FRAME_TH: Bad activation frame threshold
871  * @ESR_LEAVE_REASON_RTS_IN_DUAL_LISTEN: RTS in dual listen
872  */
873 enum iwl_esr_leave_reason {
874 	ESR_LEAVE_REASON_OMI_MU_UL_DISALLOWED	= BIT(0),
875 	ESR_LEAVE_REASON_NO_TRIG_FOR_ESR_STA	= BIT(1),
876 	ESR_LEAVE_REASON_NO_ESR_STA_IN_MU_DL	= BIT(2),
877 	ESR_LEAVE_REASON_BAD_ACTIV_FRAME_TH	= BIT(3),
878 	ESR_LEAVE_REASON_RTS_IN_DUAL_LISTEN	= BIT(4),
879 };
880 
881 /**
882  * struct iwl_esr_mode_notif - FW recommendation/force for EMLSR mode
883  *
884  * @action: the action to apply on EMLSR state.
885  *	See &iwl_mvm_fw_esr_recommendation
886  * @leave_reason_mask: mask for various reasons to leave EMLSR mode.
887  *	See &iwl_esr_leave_reason
888  */
889 struct iwl_esr_mode_notif {
890 	__le32 action;
891 	__le32 leave_reason_mask;
892 } __packed; /* ESR_MODE_RECOMMENDATION_NTFY_API_S_VER_2 */
893 
894 /**
895  * struct iwl_missed_beacons_notif - sent when by the firmware upon beacon loss
896  *  ( MISSED_BEACONS_NOTIF = 0xF6 )
897  * @link_id: fw link ID
898  * @consec_missed_beacons_since_last_rx: number of consecutive missed
899  *	beacons since last RX.
900  * @consec_missed_beacons: number of consecutive missed beacons
901  * @other_link_id: used in EMLSR only. The fw link ID for
902  *	&consec_missed_beacons_other_link. IWL_MVM_FW_LINK_ID_INVALID (0xff) if
903  *	invalid.
904  * @consec_missed_beacons_other_link: number of consecutive missed beacons on
905  *	&other_link_id.
906  */
907 struct iwl_missed_beacons_notif {
908 	__le32 link_id;
909 	__le32 consec_missed_beacons_since_last_rx;
910 	__le32 consec_missed_beacons;
911 	__le32 other_link_id;
912 	__le32 consec_missed_beacons_other_link;
913 } __packed; /* MISSED_BEACON_NTFY_API_S_VER_5 */
914 
915 /*
916  * enum iwl_esr_trans_fail_code: to be used to parse the notif below
917  *
918  * @ESR_TRANS_FAILED_TX_STATUS_ERROR: failed to TX EML OMN frame
919  * @ESR_TRANSITION_FAILED_TX_TIMEOUT: timeout on the EML OMN frame
920  * @ESR_TRANSITION_FAILED_BEACONS_NOT_HEARD: can't get a beacon on the new link
921  */
922 enum iwl_esr_trans_fail_code {
923 	ESR_TRANS_FAILED_TX_STATUS_ERROR,
924 	ESR_TRANSITION_FAILED_TX_TIMEOUT,
925 	ESR_TRANSITION_FAILED_BEACONS_NOT_HEARD,
926 };
927 
928 /**
929  * struct iwl_esr_trans_fail_notif - FW reports a failure in EMLSR transition
930  *
931  * @link_id: the link_id that still works after the failure
932  * @activation: true if the link was activated, false otherwise
933  * @err_code: see &enum iwl_esr_trans_fail_code
934  */
935 struct iwl_esr_trans_fail_notif {
936 	__le32 link_id;
937 	__le32 activation;
938 	__le32 err_code;
939 } __packed; /* ESR_TRANSITION_FAILED_NTFY_API_S_VER_1 */
940 
941 /*
942  * enum iwl_twt_operation_type: TWT operation in a TWT action frame
943  *
944  * @TWT_OPERATION_REQUEST: TWT Request
945  * @TWT_OPERATION_SUGGEST: TWT Suggest
946  * @TWT_OPERATION_DEMAND: TWT Demand
947  * @TWT_OPERATION_GROUPING: TWT Grouping
948  * @TWT_OPERATION_ACCEPT: TWT Accept
949  * @TWT_OPERATION_ALTERNATE: TWT Alternate
950  * @TWT_OPERATION_DICTATE: TWT Dictate
951  * @TWT_OPERATION_REJECT: TWT Reject
952  * @TWT_OPERATION_TEARDOWN: TWT Teardown
953  * @TWT_OPERATION_UNAVAILABILITY: TWT Unavailability
954  */
955 enum iwl_twt_operation_type {
956 	TWT_OPERATION_REQUEST,
957 	TWT_OPERATION_SUGGEST,
958 	TWT_OPERATION_DEMAND,
959 	TWT_OPERATION_GROUPING,
960 	TWT_OPERATION_ACCEPT,
961 	TWT_OPERATION_ALTERNATE,
962 	TWT_OPERATION_DICTATE,
963 	TWT_OPERATION_REJECT,
964 	TWT_OPERATION_TEARDOWN,
965 	TWT_OPERATION_UNAVAILABILITY,
966 	TWT_OPERATION_MAX,
967 }; /* TWT_OPERATION_TYPE_E_VER_1 */
968 
969 /**
970  * struct iwl_twt_operation_cmd - initiate a TWT session from driver
971  *
972  * @link_id: FW link id to initiate the TWT
973  * @twt_operation: &enum iwl_twt_operation_type
974  * @target_wake_time: TSF time to start the TWT
975  * @interval_exponent: the exponent for the interval
976  * @interval_mantissa: the mantissa for the interval
977  * @minimum_wake_duration: the minimum duration for the wake period
978  * @trigger: is the TWT triggered or not
979  * @flow_type: is the TWT announced (0) or not (1)
980  * @flow_id: the TWT flow identifier 0 - 7
981  * @twt_protection: is the TWT protected
982  * @ndp_paging_indicator: is ndp paging indicator set
983  * @responder_pm_mode: is responder pm mode set
984  * @negotiation_type: if the responder wants to doze outside the TWT SP
985  * @twt_request: 1 for TWT request (STA), 0 for TWT response (AP)
986  * @implicit: is TWT implicit
987  * @twt_group_assignment: the TWT group assignment
988  * @twt_channel: the TWT channel
989  * @restricted_info_present: is this a restricted TWT
990  * @dl_bitmap_valid: is DL (download) bitmap valid (restricted TWT)
991  * @ul_bitmap_valid: is UL (upload) bitmap valid (restricted TWT)
992  * @dl_tid_bitmap: DL TID bitmap (restricted TWT)
993  * @ul_tid_bitmap: UL TID bitmap (restricted TWT)
994  */
995 struct iwl_twt_operation_cmd {
996 	__le32 link_id;
997 	__le32 twt_operation;
998 	__le64 target_wake_time;
999 	__le32 interval_exponent;
1000 	__le32 interval_mantissa;
1001 	__le32 minimum_wake_duration;
1002 	u8 trigger;
1003 	u8 flow_type;
1004 	u8 flow_id;
1005 	u8 twt_protection;
1006 	u8 ndp_paging_indicator;
1007 	u8 responder_pm_mode;
1008 	u8 negotiation_type;
1009 	u8 twt_request;
1010 	u8 implicit;
1011 	u8 twt_group_assignment;
1012 	u8 twt_channel;
1013 	u8 restricted_info_present;
1014 	u8 dl_bitmap_valid;
1015 	u8 ul_bitmap_valid;
1016 	u8 dl_tid_bitmap;
1017 	u8 ul_tid_bitmap;
1018 } __packed; /* TWT_OPERATION_API_S_VER_1 */
1019 
1020 enum iwl_nan_band {
1021 	IWL_NAN_BAND_5GHZ = 0,
1022 	IWL_NAN_BAND_2GHZ = 1,
1023 	IWL_NUM_NAN_BANDS,
1024 };
1025 
1026 /**
1027  * struct iwl_nan_band_config - NAN band configuration
1028  *
1029  * @rssi_close: RSSI threshold for close proximity in dBm
1030  * @rssi_middle: RSSI threshold for middle proximity in dBm
1031  * @dw_interval: Discovery Window (DW) interval for synchronization beacons and
1032  *	SDFs. Valid values of DW interval are: 1, 2, 3, 4 and 5 corresponding to
1033  *	1, 2, 4, 8, and 16 DWs.
1034  * @reserved: reserved
1035  */
1036 struct iwl_nan_band_config {
1037 	u8 rssi_close;
1038 	u8 rssi_middle;
1039 	u8 dw_interval;
1040 	u8 reserved;
1041 }; /* NAN_BAND_SPECIFIC_CONFIG_API_S_VER_1 */
1042 
1043 /**
1044  * enum iwl_nan_flags - flags for NAN configuration
1045  *
1046  * @IWL_NAN_FLAG_DW_END_NOTIF_ENABLED: indicates that the host wants to receive
1047  *	notifications when a DW ends.
1048  */
1049 enum iwl_nan_flags {
1050 	IWL_NAN_FLAG_DW_END_NOTIF_ENABLED = BIT(0),
1051 };
1052 
1053 /**
1054  * struct iwl_nan_config_cmd - NAN configuration command
1055  *
1056  * @action: action to perform, see &enum iwl_ctxt_action
1057  * @nmi_addr: NAN Management Interface (NMI) address
1058  * @reserved_for_nmi_addr: reserved
1059  * @discovery_beacon_interval: discovery beacon interval in TUs
1060  * @cluster_id: lower last two bytes of the cluster ID, in case the local
1061  *	device starts a cluster
1062  * @sta_id: station ID of the NAN station
1063  * @hb_channel: channel for 5 GHz if the device supports operation on 5 GHz.
1064  *	Valid values are 44 and 149, which correspond to the 5 GHz channel, and
1065  *	0 which means that NAN operation on the 5 GHz band is disabled.
1066  * @master_pref: master preference
1067  * @dwell_time: dwell time on the discovery channel during scan (milliseconds).
1068  *	If set to 0, the dwell time is determined by the firmware.
1069  * @scan_period: scan period in seconds. If set to 0, the scan period is
1070  *	determined by the firmware.
1071  * @flags: flags for NAN configuration, see &enum iwl_nan_flags
1072  * @band_config: band configuration for NAN, one for each band
1073  * @nan_attr_len: length of the NAN attributes to be added to the beacon (bytes)
1074  * @nan_vendor_elems_len: length of the NAN vendor elements to be added to the
1075  *	beacon (bytes)
1076  * @beacon_data: variable length data that contains the NAN attributes
1077  *	(&nan_attr_len) followed by the NAN vendor elements
1078  *	(&nan_vendor_elems_len).
1079  */
1080 struct iwl_nan_config_cmd {
1081 	__le32 action;
1082 	u8 nmi_addr[6];
1083 	__le16 reserved_for_nmi_addr;
1084 	__le32 discovery_beacon_interval;
1085 
1086 	u8 cluster_id[2];
1087 	u8 sta_id;
1088 	u8 hb_channel;
1089 
1090 	u8 master_pref;
1091 	u8 dwell_time;
1092 	u8 scan_period;
1093 	u8 flags;
1094 
1095 	struct iwl_nan_band_config band_config[IWL_NUM_NAN_BANDS];
1096 
1097 	__le32 nan_attr_len;
1098 	__le32 nan_vendor_elems_len;
1099 	u8 beacon_data[];
1100 } __packed; /*  NAN_CONFIG_CMD_API_S_VER_1 */
1101 
1102 /**
1103  * enum iwl_nan_cluster_notif_flags - flags for the cluster notification
1104  *
1105  * @IWL_NAN_CLUSTER_NOTIF_FLAG_NEW_CLUSTER: indicates that the device has
1106  *	started a new cluster. If not set, the device has joined an existing
1107  *	cluster.
1108  */
1109 enum iwl_nan_cluster_notif_flags {
1110 	IWL_NAN_CLUSTER_NOTIF_FLAG_NEW_CLUSTER	= BIT(0),
1111 }; /* NAN_JOINED_CLUSTER_FLAG_E_VER_1 */
1112 
1113 /**
1114  * struct iwl_nan_cluster_notif - event sent when the device starts or joins a
1115  *	NAN cluster.
1116  *
1117  * @cluster_id: the last two bytes of the cluster ID
1118  * @flags: combination of &enum iwl_nan_cluster_notif_flags
1119  * @reserved: reserved
1120  */
1121 struct iwl_nan_cluster_notif {
1122 	u8 cluster_id[2];
1123 	u8 flags;
1124 	u8 reserved;
1125 }; /* NAN_JOINED_CLUSTER_NTF_API_S_VER_1 */
1126 
1127 /**
1128  * struct iwl_nan_dw_end_notif - sent to notify the host the end of a DW.
1129  *
1130  * @band: band on which the DW ended. See &enum iwl_nan_band.
1131  * @reserved: reserved
1132  */
1133 struct iwl_nan_dw_end_notif {
1134 	u8 band;
1135 	u8 reserved[3];
1136 } __packed; /* NAN_DW_END_NTF_API_S_VER_1 */
1137 
1138 #endif /* __iwl_fw_api_mac_cfg_h__ */
1139