xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/api/mac.h (revision 91a4855d6c03e770e42f17c798a36a3c46e63de2)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018-2022, 2024-2025 Intel Corporation
4  * Copyright (C) 2017 Intel Deutschland GmbH
5  */
6 #ifndef __iwl_fw_api_mac_h__
7 #define __iwl_fw_api_mac_h__
8 
9 /*
10  * The first MAC indices (starting from 0) are available to the driver,
11  * AUX indices follows - 1 for non-CDB, 2 for CDB.
12  */
13 #define MAC_INDEX_AUX		4
14 #define MAC_INDEX_MIN_DRIVER	0
15 #define NUM_MAC_INDEX_DRIVER	MAC_INDEX_AUX
16 #define NUM_MAC_INDEX		(NUM_MAC_INDEX_DRIVER + 1)
17 #define NUM_MAC_INDEX_CDB	(NUM_MAC_INDEX_DRIVER + 2)
18 
19 #define IWL_STATION_COUNT_MAX	16
20 #define IWL_INVALID_STA		0xFF
21 
22 enum iwl_ac {
23 	AC_BK,
24 	AC_BE,
25 	AC_VI,
26 	AC_VO,
27 	AC_NUM,
28 };
29 
30 /**
31  * enum iwl_mac_protection_flags - MAC context flags
32  * @MAC_PROT_FLG_TGG_PROTECT: 11g protection when transmitting OFDM frames,
33  *	this will require CCK RTS/CTS2self.
34  *	RTS/CTS will protect full burst time.
35  * @MAC_PROT_FLG_HT_PROT: enable HT protection
36  * @MAC_PROT_FLG_FAT_PROT: protect 40 MHz transmissions
37  * @MAC_PROT_FLG_SELF_CTS_EN: allow CTS2self
38  */
39 enum iwl_mac_protection_flags {
40 	MAC_PROT_FLG_TGG_PROTECT	= BIT(3),
41 	MAC_PROT_FLG_HT_PROT		= BIT(23),
42 	MAC_PROT_FLG_FAT_PROT		= BIT(24),
43 	MAC_PROT_FLG_SELF_CTS_EN	= BIT(30),
44 };
45 
46 #define MAC_FLG_SHORT_SLOT		BIT(4)
47 #define MAC_FLG_SHORT_PREAMBLE		BIT(5)
48 
49 /**
50  * enum iwl_mac_types - Supported MAC types
51  * @FW_MAC_TYPE_FIRST: lowest supported MAC type
52  * @FW_MAC_TYPE_AUX: Auxiliary MAC (internal)
53  * @FW_MAC_TYPE_LISTENER: monitor MAC type (?)
54  * @FW_MAC_TYPE_PIBSS: Pseudo-IBSS
55  * @FW_MAC_TYPE_IBSS: IBSS
56  * @FW_MAC_TYPE_BSS_STA: BSS (managed) station
57  * @FW_MAC_TYPE_P2P_DEVICE: P2P Device
58  * @FW_MAC_TYPE_P2P_STA: P2P client
59  * @FW_MAC_TYPE_GO: P2P GO
60  * @FW_MAC_TYPE_NAN: NAN (since version 4)
61  */
62 enum iwl_mac_types {
63 	FW_MAC_TYPE_FIRST = 1,
64 	FW_MAC_TYPE_AUX = FW_MAC_TYPE_FIRST,
65 	FW_MAC_TYPE_LISTENER,
66 	FW_MAC_TYPE_PIBSS,
67 	FW_MAC_TYPE_IBSS,
68 	FW_MAC_TYPE_BSS_STA,
69 	FW_MAC_TYPE_P2P_DEVICE,
70 	FW_MAC_TYPE_P2P_STA,
71 	FW_MAC_TYPE_GO,
72 	FW_MAC_TYPE_NAN,
73 }; /* MAC_CONTEXT_TYPE_API_E_VER_1 */
74 
75 /**
76  * enum iwl_tsf_id - TSF hw timer ID
77  * @TSF_ID_A: use TSF A
78  * @TSF_ID_B: use TSF B
79  * @TSF_ID_C: use TSF C
80  * @TSF_ID_D: use TSF D
81  * @NUM_TSF_IDS: number of TSF timers available
82  */
83 enum iwl_tsf_id {
84 	TSF_ID_A = 0,
85 	TSF_ID_B = 1,
86 	TSF_ID_C = 2,
87 	TSF_ID_D = 3,
88 	NUM_TSF_IDS = 4,
89 }; /* TSF_ID_API_E_VER_1 */
90 
91 /**
92  * struct iwl_mac_data_ap - configuration data for AP MAC context
93  * @beacon_time: beacon transmit time in system time
94  * @beacon_tsf: beacon transmit time in TSF
95  * @bi: beacon interval in TU
96  * @reserved1: reserved
97  * @dtim_interval: dtim transmit time in TU
98  * @reserved2: reserved
99  * @mcast_qid: queue ID for multicast traffic.
100  *	NOTE: obsolete from VER2 and on
101  * @beacon_template: beacon template ID
102  */
103 struct iwl_mac_data_ap {
104 	__le32 beacon_time;
105 	__le64 beacon_tsf;
106 	__le32 bi;
107 	__le32 reserved1;
108 	__le32 dtim_interval;
109 	__le32 reserved2;
110 	__le32 mcast_qid;
111 	__le32 beacon_template;
112 } __packed; /* AP_MAC_DATA_API_S_VER_2 */
113 
114 /**
115  * struct iwl_mac_data_ibss - configuration data for IBSS MAC context
116  * @beacon_time: beacon transmit time in system time
117  * @beacon_tsf: beacon transmit time in TSF
118  * @bi: beacon interval in TU
119  * @reserved: reserved
120  * @beacon_template: beacon template ID
121  */
122 struct iwl_mac_data_ibss {
123 	__le32 beacon_time;
124 	__le64 beacon_tsf;
125 	__le32 bi;
126 	__le32 reserved;
127 	__le32 beacon_template;
128 } __packed; /* IBSS_MAC_DATA_API_S_VER_1 */
129 
130 /**
131  * enum iwl_mac_data_policy - policy of the data path for this MAC
132  * @TWT_SUPPORTED: twt is supported
133  * @MORE_DATA_ACK_SUPPORTED: AP supports More Data Ack according to
134  *	paragraph 9.4.1.17 in P802.11ax_D4 specification. Used for TWT
135  *	early termination detection.
136  * @FLEXIBLE_TWT_SUPPORTED: AP supports flexible TWT schedule
137  * @PROTECTED_TWT_SUPPORTED: AP supports protected TWT frames (with 11w)
138  * @BROADCAST_TWT_SUPPORTED: AP and STA support broadcast TWT
139  * @COEX_HIGH_PRIORITY_ENABLE: high priority mode for BT coex, to be used
140  *	during 802.1X negotiation (and allowed during 4-way-HS)
141  */
142 enum iwl_mac_data_policy {
143 	TWT_SUPPORTED = BIT(0),
144 	MORE_DATA_ACK_SUPPORTED = BIT(1),
145 	FLEXIBLE_TWT_SUPPORTED = BIT(2),
146 	PROTECTED_TWT_SUPPORTED = BIT(3),
147 	BROADCAST_TWT_SUPPORTED = BIT(4),
148 	COEX_HIGH_PRIORITY_ENABLE = BIT(5),
149 };
150 
151 /**
152  * struct iwl_mac_data_sta - configuration data for station MAC context
153  * @is_assoc: 1 for associated state, 0 otherwise
154  * @dtim_time: DTIM arrival time in system time
155  * @dtim_tsf: DTIM arrival time in TSF
156  * @bi: beacon interval in TU, applicable only when associated
157  * @reserved1: reserved
158  * @dtim_interval: DTIM interval in TU, applicable only when associated
159  * @data_policy: see &enum iwl_mac_data_policy
160  * @listen_interval: in beacon intervals, applicable only when associated
161  * @assoc_id: unique ID assigned by the AP during association
162  * @assoc_beacon_arrive_time: TSF of first beacon after association
163  */
164 struct iwl_mac_data_sta {
165 	__le32 is_assoc;
166 	__le32 dtim_time;
167 	__le64 dtim_tsf;
168 	__le32 bi;
169 	__le32 reserved1;
170 	__le32 dtim_interval;
171 	__le32 data_policy;
172 	__le32 listen_interval;
173 	__le32 assoc_id;
174 	__le32 assoc_beacon_arrive_time;
175 } __packed; /* STA_MAC_DATA_API_S_VER_2 */
176 
177 /**
178  * struct iwl_mac_data_go - configuration data for P2P GO MAC context
179  * @ap: iwl_mac_data_ap struct with most config data
180  * @ctwin: client traffic window in TU (period after TBTT when GO is present).
181  *	0 indicates that there is no CT window.
182  * @opp_ps_enabled: indicate that opportunistic PS allowed
183  */
184 struct iwl_mac_data_go {
185 	struct iwl_mac_data_ap ap;
186 	__le32 ctwin;
187 	__le32 opp_ps_enabled;
188 } __packed; /* GO_MAC_DATA_API_S_VER_1 */
189 
190 /**
191  * struct iwl_mac_data_p2p_sta - configuration data for P2P client MAC context
192  * @sta: iwl_mac_data_sta struct with most config data
193  * @ctwin: client traffic window in TU (period after TBTT when GO is present).
194  *	0 indicates that there is no CT window.
195  */
196 struct iwl_mac_data_p2p_sta {
197 	struct iwl_mac_data_sta sta;
198 	__le32 ctwin;
199 } __packed; /* P2P_STA_MAC_DATA_API_S_VER_2 */
200 
201 /**
202  * struct iwl_mac_data_pibss - Pseudo IBSS config data
203  * @stats_interval: interval in TU between statistics notifications to host.
204  */
205 struct iwl_mac_data_pibss {
206 	__le32 stats_interval;
207 } __packed; /* PIBSS_MAC_DATA_API_S_VER_1 */
208 
209 /*
210  * struct iwl_mac_data_p2p_dev - configuration data for the P2P Device MAC
211  * context.
212  * @is_disc_extended: if set to true, P2P Device discoverability is enabled on
213  *	other channels as well. This should be to true only in case that the
214  *	device is discoverable and there is an active GO. Note that setting this
215  *	field when not needed, will increase the number of interrupts and have
216  *	effect on the platform power, as this setting opens the Rx filters on
217  *	all macs.
218  */
219 struct iwl_mac_data_p2p_dev {
220 	__le32 is_disc_extended;
221 } __packed; /* _P2P_DEV_MAC_DATA_API_S_VER_1 */
222 
223 /**
224  * enum iwl_mac_filter_flags - MAC context filter flags
225  * @MAC_FILTER_IN_PROMISC: accept all data frames
226  * @MAC_FILTER_IN_CONTROL_AND_MGMT: pass all management and
227  *	control frames to the host
228  * @MAC_FILTER_ACCEPT_GRP: accept multicast frames
229  * @MAC_FILTER_DIS_DECRYPT: don't decrypt unicast frames
230  * @MAC_FILTER_DIS_GRP_DECRYPT: don't decrypt multicast frames
231  * @MAC_FILTER_IN_BEACON: transfer foreign BSS's beacons to host
232  *	(in station mode when associated)
233  * @MAC_FILTER_OUT_BCAST: filter out all broadcast frames
234  * @MAC_FILTER_IN_CRC32: extract FCS and append it to frames
235  * @MAC_FILTER_IN_PROBE_REQUEST: pass probe requests to host
236  */
237 enum iwl_mac_filter_flags {
238 	MAC_FILTER_IN_PROMISC		= BIT(0),
239 	MAC_FILTER_IN_CONTROL_AND_MGMT	= BIT(1),
240 	MAC_FILTER_ACCEPT_GRP		= BIT(2),
241 	MAC_FILTER_DIS_DECRYPT		= BIT(3),
242 	MAC_FILTER_DIS_GRP_DECRYPT	= BIT(4),
243 	MAC_FILTER_IN_BEACON		= BIT(6),
244 	MAC_FILTER_OUT_BCAST		= BIT(8),
245 	MAC_FILTER_IN_CRC32		= BIT(11),
246 	MAC_FILTER_IN_PROBE_REQUEST	= BIT(12),
247 	/**
248 	 * @MAC_FILTER_IN_11AX: mark BSS as supporting 802.11ax
249 	 */
250 	MAC_FILTER_IN_11AX		= BIT(14),
251 };
252 
253 /**
254  * enum iwl_mac_qos_flags - QoS flags
255  * @MAC_QOS_FLG_UPDATE_EDCA: ?
256  * @MAC_QOS_FLG_TGN: HT is enabled
257  * @MAC_QOS_FLG_TXOP_TYPE: ?
258  *
259  */
260 enum iwl_mac_qos_flags {
261 	MAC_QOS_FLG_UPDATE_EDCA	= BIT(0),
262 	MAC_QOS_FLG_TGN		= BIT(1),
263 	MAC_QOS_FLG_TXOP_TYPE	= BIT(4),
264 };
265 
266 /**
267  * struct iwl_ac_qos - QOS timing params for MAC_CONTEXT_CMD
268  * @cw_min: Contention window, start value in numbers of slots.
269  *	Should be a power-of-2, minus 1.  Device's default is 0x0f.
270  * @cw_max: Contention window, max value in numbers of slots.
271  *	Should be a power-of-2, minus 1.  Device's default is 0x3f.
272  * @aifsn:  Number of slots in Arbitration Interframe Space (before
273  *	performing random backoff timing prior to Tx).  Device default 1.
274  * @fifos_mask: FIFOs used by this MAC for this AC
275  * @edca_txop:  Length of Tx opportunity, in uSecs.  Device default is 0.
276  *
277  * One instance of this config struct for each of 4 EDCA access categories
278  * in struct iwl_qosparam_cmd.
279  *
280  * Device will automatically increase contention window by (2*CW) + 1 for each
281  * transmission retry.  Device uses cw_max as a bit mask, ANDed with new CW
282  * value, to cap the CW value.
283  */
284 struct iwl_ac_qos {
285 	__le16 cw_min;
286 	__le16 cw_max;
287 	u8 aifsn;
288 	u8 fifos_mask; /* not in use since _VER_3 */
289 	__le16 edca_txop;
290 } __packed; /* AC_QOS_API_S_VER_2, _VER_3 */
291 
292 /**
293  * struct iwl_mac_ctx_cmd - command structure to configure MAC contexts
294  * ( MAC_CONTEXT_CMD = 0x28 )
295  * @id_and_color: ID and color of the MAC
296  * @action: action to perform, see &enum iwl_ctxt_action
297  * @mac_type: one of &enum iwl_mac_types
298  * @tsf_id: TSF HW timer, one of &enum iwl_tsf_id
299  * @node_addr: MAC address
300  * @reserved_for_node_addr: reserved
301  * @bssid_addr: BSSID
302  * @reserved_for_bssid_addr: reserved
303  * @cck_rates: basic rates available for CCK
304  * @ofdm_rates: basic rates available for OFDM
305  * @protection_flags: combination of &enum iwl_mac_protection_flags
306  * @cck_short_preamble: 0x20 for enabling short preamble, 0 otherwise
307  * @short_slot: 0x10 for enabling short slots, 0 otherwise
308  * @filter_flags: combination of &enum iwl_mac_filter_flags
309  * @qos_flags: from &enum iwl_mac_qos_flags
310  * @ac: one iwl_mac_qos configuration for each AC
311  * @ap: AP specific config data, see &struct iwl_mac_data_ap
312  * @go: GO specific config data, see &struct iwl_mac_data_go
313  * @sta: BSS client specific config data, see &struct iwl_mac_data_sta
314  * @p2p_sta: P2P client specific config data, see &struct iwl_mac_data_p2p_sta
315  * @p2p_dev: P2P-device specific config data, see &struct iwl_mac_data_p2p_dev
316  * @pibss: Pseudo-IBSS specific data, unused; see struct iwl_mac_data_pibss
317  * @ibss: IBSS specific config data, see &struct iwl_mac_data_ibss
318  */
319 struct iwl_mac_ctx_cmd {
320 	/* COMMON_INDEX_HDR_API_S_VER_1 */
321 	__le32 id_and_color;
322 	__le32 action;
323 	/* MAC_CONTEXT_COMMON_DATA_API_S_VER_1 */
324 	__le32 mac_type;
325 	__le32 tsf_id;
326 	u8 node_addr[6];
327 	__le16 reserved_for_node_addr;
328 	u8 bssid_addr[6];
329 	__le16 reserved_for_bssid_addr;
330 	__le32 cck_rates;
331 	__le32 ofdm_rates;
332 	__le32 protection_flags;
333 	__le32 cck_short_preamble;
334 	__le32 short_slot;
335 	__le32 filter_flags;
336 	/* MAC_QOS_PARAM_API_S_VER_1 */
337 	__le32 qos_flags;
338 	struct iwl_ac_qos ac[AC_NUM+1];
339 	/* MAC_CONTEXT_COMMON_DATA_API_S */
340 	union {
341 		struct iwl_mac_data_ap ap;
342 		struct iwl_mac_data_go go;
343 		struct iwl_mac_data_sta sta;
344 		struct iwl_mac_data_p2p_sta p2p_sta;
345 		struct iwl_mac_data_p2p_dev p2p_dev;
346 		struct iwl_mac_data_pibss pibss;
347 		struct iwl_mac_data_ibss ibss;
348 	};
349 } __packed; /* MAC_CONTEXT_CMD_API_S_VER_1 */
350 
351 #define IWL_NONQOS_SEQ_GET	0x1
352 #define IWL_NONQOS_SEQ_SET	0x2
353 struct iwl_nonqos_seq_query_cmd {
354 	__le32 get_set_flag;
355 	__le32 mac_id_n_color;
356 	__le16 value;
357 	__le16 reserved;
358 } __packed; /* NON_QOS_TX_COUNTER_GET_SET_API_S_VER_1 */
359 
360 /**
361  * struct iwl_missed_beacons_notif_ver_3 - information on missed beacons
362  * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
363  * @mac_id: interface ID
364  * @consec_missed_beacons_since_last_rx: number of consecutive missed
365  *	beacons since last RX.
366  * @consec_missed_beacons: number of consecutive missed beacons
367  * @num_expected_beacons: number of expected beacons
368  * @num_recvd_beacons: number of received beacons
369  */
370 struct iwl_missed_beacons_notif_ver_3 {
371 	__le32 mac_id;
372 	__le32 consec_missed_beacons_since_last_rx;
373 	__le32 consec_missed_beacons;
374 	__le32 num_expected_beacons;
375 	__le32 num_recvd_beacons;
376 } __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
377 
378 /**
379  * struct iwl_missed_beacons_notif_v4 - information on missed beacons
380  * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
381  * @link_id: fw link ID
382  * @consec_missed_beacons_since_last_rx: number of consecutive missed
383  *	beacons since last RX.
384  * @consec_missed_beacons: number of consecutive missed beacons
385  * @num_expected_beacons: number of expected beacons
386  * @num_recvd_beacons: number of received beacons
387  */
388 struct iwl_missed_beacons_notif_v4 {
389 	__le32 link_id;
390 	__le32 consec_missed_beacons_since_last_rx;
391 	__le32 consec_missed_beacons;
392 	__le32 num_expected_beacons;
393 	__le32 num_recvd_beacons;
394 } __packed; /* MISSED_BEACON_NTFY_API_S_VER_4 */
395 
396 /**
397  * struct iwl_he_backoff_conf - used for backoff configuration
398  * Per each trigger-based AC, (set by MU EDCA Parameter set info-element)
399  * used for backoff configuration of TXF5..TXF8 trigger based.
400  * The MU-TIMER is reloaded w/ MU_TIME each time a frame from the AC is sent via
401  * trigger-based TX.
402  * @cwmin: CW min
403  * @cwmax: CW max
404  * @aifsn: AIFSN
405  *	AIFSN=0, means that no backoff from the specified TRIG-BASED AC is
406  *	allowed till the MU-TIMER is 0
407  * @mu_time: MU time in 8TU units
408  */
409 struct iwl_he_backoff_conf {
410 	__le16 cwmin;
411 	__le16 cwmax;
412 	__le16 aifsn;
413 	__le16 mu_time;
414 } __packed; /* AC_QOS_DOT11AX_API_S */
415 
416 /**
417  * enum iwl_he_pkt_ext_constellations - PPE constellation indices
418  * @IWL_HE_PKT_EXT_BPSK: BPSK
419  * @IWL_HE_PKT_EXT_QPSK:  QPSK
420  * @IWL_HE_PKT_EXT_16QAM: 16-QAM
421  * @IWL_HE_PKT_EXT_64QAM: 64-QAM
422  * @IWL_HE_PKT_EXT_256QAM: 256-QAM
423  * @IWL_HE_PKT_EXT_1024QAM: 1024-QAM
424  * @IWL_HE_PKT_EXT_4096QAM: 4096-QAM, for EHT only
425  * @IWL_HE_PKT_EXT_NONE: not defined
426  */
427 enum iwl_he_pkt_ext_constellations {
428 	IWL_HE_PKT_EXT_BPSK = 0,
429 	IWL_HE_PKT_EXT_QPSK,
430 	IWL_HE_PKT_EXT_16QAM,
431 	IWL_HE_PKT_EXT_64QAM,
432 	IWL_HE_PKT_EXT_256QAM,
433 	IWL_HE_PKT_EXT_1024QAM,
434 	IWL_HE_PKT_EXT_4096QAM,
435 	IWL_HE_PKT_EXT_NONE,
436 };
437 
438 #define MAX_HE_SUPP_NSS	2
439 #define MAX_CHANNEL_BW_INDX_API_D_VER_1	4
440 #define MAX_CHANNEL_BW_INDX_API_D_VER_2	5
441 
442 /**
443  * struct iwl_he_pkt_ext_v1 - QAM thresholds
444  * The required PPE is set via HE Capabilities IE, per Nss x BW x MCS
445  * The IE is organized in the following way:
446  * Support for Nss x BW (or RU) matrix:
447  *	(0=SISO, 1=MIMO2) x (0-20MHz, 1-40MHz, 2-80MHz, 3-160MHz)
448  * Each entry contains 2 QAM thresholds for 8us and 16us:
449  *	0=BPSK, 1=QPSK, 2=16QAM, 3=64QAM, 4=256QAM, 5=1024QAM, 6=RES, 7=NONE
450  * i.e. QAM_th1 < QAM_th2 such if TX uses QAM_tx:
451  *	QAM_tx < QAM_th1            --> PPE=0us
452  *	QAM_th1 <= QAM_tx < QAM_th2 --> PPE=8us
453  *	QAM_th2 <= QAM_tx           --> PPE=16us
454  * @pkt_ext_qam_th: QAM thresholds
455  *	For each Nss/Bw define 2 QAM thrsholds (0..5)
456  *	For rates below the low_th, no need for PPE
457  *	For rates between low_th and high_th, need 8us PPE
458  *	For rates equal or higher then the high_th, need 16us PPE
459  *	Nss (0-siso, 1-mimo2) x BW (0-20MHz, 1-40MHz, 2-80MHz, 3-160MHz) x
460  *		(0-low_th, 1-high_th)
461  */
462 struct iwl_he_pkt_ext_v1 {
463 	u8 pkt_ext_qam_th[MAX_HE_SUPP_NSS][MAX_CHANNEL_BW_INDX_API_D_VER_1][2];
464 } __packed; /* PKT_EXT_DOT11AX_API_S_VER_1 */
465 
466 /**
467  * struct iwl_he_pkt_ext_v2 - QAM thresholds
468  * The required PPE is set via HE Capabilities IE, per Nss x BW x MCS
469  * The IE is organized in the following way:
470  * Support for Nss x BW (or RU) matrix:
471  *	(0=SISO, 1=MIMO2) x (0-20MHz, 1-40MHz, 2-80MHz, 3-160MHz)
472  * Each entry contains 2 QAM thresholds for 8us and 16us:
473  *	0=BPSK, 1=QPSK, 2=16QAM, 3=64QAM, 4=256QAM, 5=1024QAM, 6=RES, 7=NONE
474  * i.e. QAM_th1 < QAM_th2 such if TX uses QAM_tx:
475  *	QAM_tx < QAM_th1            --> PPE=0us
476  *	QAM_th1 <= QAM_tx < QAM_th2 --> PPE=8us
477  *	QAM_th2 <= QAM_tx           --> PPE=16us
478  * @pkt_ext_qam_th: QAM thresholds
479  *	For each Nss/Bw define 2 QAM thrsholds (0..5)
480  *	For rates below the low_th, no need for PPE
481  *	For rates between low_th and high_th, need 8us PPE
482  *	For rates equal or higher then the high_th, need 16us PPE
483  *	Nss (0-siso, 1-mimo2) x
484  *	BW (0-20MHz, 1-40MHz, 2-80MHz, 3-160MHz, 4-320MHz) x
485  *	(0-low_th, 1-high_th)
486  */
487 struct iwl_he_pkt_ext_v2 {
488 	u8 pkt_ext_qam_th[MAX_HE_SUPP_NSS][MAX_CHANNEL_BW_INDX_API_D_VER_2][2];
489 } __packed; /* PKT_EXT_DOT11AX_API_S_VER_2 */
490 
491 /**
492  * enum iwl_he_sta_ctxt_flags - HE STA context flags
493  * @STA_CTXT_HE_REF_BSSID_VALID: ref bssid addr valid (for receiving specific
494  *	control frames such as TRIG, NDPA, BACK)
495  * @STA_CTXT_HE_BSS_COLOR_DIS: BSS color disable, don't use the BSS
496  *	color for RX filter but use MAC header
497  * @STA_CTXT_HE_PARTIAL_BSS_COLOR: partial BSS color allocation
498  * @STA_CTXT_HE_32BIT_BA_BITMAP: indicates the receiver supports BA bitmap
499  *	of 32-bits
500  * @STA_CTXT_HE_PACKET_EXT: indicates that the packet-extension info is valid
501  *	and should be used
502  * @STA_CTXT_HE_TRIG_RND_ALLOC: indicates that trigger based random allocation
503  *	is enabled according to UORA element existence
504  * @STA_CTXT_HE_CONST_TRIG_RND_ALLOC: used for AV testing
505  * @STA_CTXT_HE_ACK_ENABLED: indicates that the AP supports receiving ACK-
506  *	enabled AGG, i.e. both BACK and non-BACK frames in a single AGG
507  * @STA_CTXT_HE_MU_EDCA_CW: indicates that there is an element of MU EDCA
508  *	parameter set, i.e. the backoff counters for trig-based ACs
509  * @STA_CTXT_HE_NIC_NOT_ACK_ENABLED: mark that the NIC doesn't support receiving
510  *	ACK-enabled AGG, (i.e. both BACK and non-BACK frames in single AGG).
511  *	If the NIC is not ACK_ENABLED it may use the EOF-bit in first non-0
512  *	len delim to determine if AGG or single.
513  * @STA_CTXT_HE_RU_2MHZ_BLOCK: indicates that 26-tone RU OFDMA transmission are
514  *      not allowed (as there are OBSS that might classify such transmissions as
515  *      radar pulses).
516  * @STA_CTXT_HE_NDP_FEEDBACK_ENABLED: mark support for NDP feedback and change
517  *	of threshold
518  * @STA_CTXT_EHT_PUNCTURE_MASK_VALID: indicates the puncture_mask field is valid
519  * @STA_CTXT_EHT_LONG_PPE_ENABLED: indicates the PPE requirement should be
520  *	extended to 20us for BW > 160Mhz or for MCS w/ 4096-QAM.
521  */
522 enum iwl_he_sta_ctxt_flags {
523 	STA_CTXT_HE_REF_BSSID_VALID		= BIT(4),
524 	STA_CTXT_HE_BSS_COLOR_DIS		= BIT(5),
525 	STA_CTXT_HE_PARTIAL_BSS_COLOR		= BIT(6),
526 	STA_CTXT_HE_32BIT_BA_BITMAP		= BIT(7),
527 	STA_CTXT_HE_PACKET_EXT			= BIT(8),
528 	STA_CTXT_HE_TRIG_RND_ALLOC		= BIT(9),
529 	STA_CTXT_HE_CONST_TRIG_RND_ALLOC	= BIT(10),
530 	STA_CTXT_HE_ACK_ENABLED			= BIT(11),
531 	STA_CTXT_HE_MU_EDCA_CW			= BIT(12),
532 	STA_CTXT_HE_NIC_NOT_ACK_ENABLED		= BIT(13),
533 	STA_CTXT_HE_RU_2MHZ_BLOCK		= BIT(14),
534 	STA_CTXT_HE_NDP_FEEDBACK_ENABLED	= BIT(15),
535 	STA_CTXT_EHT_PUNCTURE_MASK_VALID	= BIT(16),
536 	STA_CTXT_EHT_LONG_PPE_ENABLED		= BIT(17),
537 };
538 
539 /**
540  * enum iwl_he_htc_flags - HE HTC support flags
541  * @IWL_HE_HTC_SUPPORT: HE-HTC support
542  * @IWL_HE_HTC_UL_MU_RESP_SCHED: HE UL MU response schedule
543  *	support via A-control field
544  * @IWL_HE_HTC_BSR_SUPP: BSR support in A-control field
545  * @IWL_HE_HTC_OMI_SUPP: A-OMI support in A-control field
546  * @IWL_HE_HTC_BQR_SUPP: A-BQR support in A-control field
547  */
548 enum iwl_he_htc_flags {
549 	IWL_HE_HTC_SUPPORT			= BIT(0),
550 	IWL_HE_HTC_UL_MU_RESP_SCHED		= BIT(3),
551 	IWL_HE_HTC_BSR_SUPP			= BIT(4),
552 	IWL_HE_HTC_OMI_SUPP			= BIT(5),
553 	IWL_HE_HTC_BQR_SUPP			= BIT(6),
554 };
555 
556 /*
557  * @IWL_HE_HTC_LINK_ADAP_NO_FEEDBACK: the STA does not provide HE MFB
558  * @IWL_HE_HTC_LINK_ADAP_UNSOLICITED: the STA provides only unsolicited HE MFB
559  * @IWL_HE_HTC_LINK_ADAP_BOTH: the STA is capable of providing HE MFB in
560  *      response to HE MRQ and if the STA provides unsolicited HE MFB
561  */
562 #define IWL_HE_HTC_LINK_ADAP_POS		(1)
563 #define IWL_HE_HTC_LINK_ADAP_NO_FEEDBACK	(0)
564 #define IWL_HE_HTC_LINK_ADAP_UNSOLICITED	(2 << IWL_HE_HTC_LINK_ADAP_POS)
565 #define IWL_HE_HTC_LINK_ADAP_BOTH		(3 << IWL_HE_HTC_LINK_ADAP_POS)
566 
567 /**
568  * struct iwl_he_sta_context_cmd_v1 - configure FW to work with HE AP
569  * @sta_id: STA id
570  * @tid_limit: max num of TIDs in TX HE-SU multi-TID agg
571  *	0 - bad value, 1 - multi-tid not supported, 2..8 - tid limit
572  * @reserved1: reserved byte for future use
573  * @reserved2: reserved byte for future use
574  * @flags: see %iwl_11ax_sta_ctxt_flags
575  * @ref_bssid_addr: reference BSSID used by the AP
576  * @reserved0: reserved 2 bytes for aligning the ref_bssid_addr field to 8 bytes
577  * @htc_flags: which features are supported in HTC
578  * @frag_flags: frag support in A-MSDU
579  * @frag_level: frag support level
580  * @frag_max_num: max num of "open" MSDUs in the receiver (in power of 2)
581  * @frag_min_size: min frag size (except last frag)
582  * @pkt_ext: optional, exists according to PPE-present bit in the HE-PHY capa
583  * @bss_color: 11ax AP ID that is used in the HE SIG-A to mark inter BSS frame
584  * @htc_trig_based_pkt_ext: default PE in 4us units
585  * @frame_time_rts_th: HE duration RTS threshold, in units of 32us
586  * @rand_alloc_ecwmin: random CWmin = 2**ECWmin-1
587  * @rand_alloc_ecwmax: random CWmax = 2**ECWmax-1
588  * @reserved3: reserved byte for future use
589  * @trig_based_txf: MU EDCA Parameter set for the trigger based traffic queues
590  */
591 struct iwl_he_sta_context_cmd_v1 {
592 	u8 sta_id;
593 	u8 tid_limit;
594 	u8 reserved1;
595 	u8 reserved2;
596 	__le32 flags;
597 
598 	/* The below fields are set via Multiple BSSID IE */
599 	u8 ref_bssid_addr[6];
600 	__le16 reserved0;
601 
602 	/* The below fields are set via HE-capabilities IE */
603 	__le32 htc_flags;
604 
605 	u8 frag_flags;
606 	u8 frag_level;
607 	u8 frag_max_num;
608 	u8 frag_min_size;
609 
610 	/* The below fields are set via PPE thresholds element */
611 	struct iwl_he_pkt_ext_v1 pkt_ext;
612 
613 	/* The below fields are set via HE-Operation IE */
614 	u8 bss_color;
615 	u8 htc_trig_based_pkt_ext;
616 	__le16 frame_time_rts_th;
617 
618 	/* Random access parameter set (i.e. RAPS) */
619 	u8 rand_alloc_ecwmin;
620 	u8 rand_alloc_ecwmax;
621 	__le16 reserved3;
622 
623 	/* The below fields are set via MU EDCA parameter set element */
624 	struct iwl_he_backoff_conf trig_based_txf[AC_NUM];
625 } __packed; /* STA_CONTEXT_DOT11AX_API_S_VER_1 */
626 
627 /**
628  * struct iwl_he_sta_context_cmd_v2 - configure FW to work with HE AP
629  * @sta_id: STA id
630  * @tid_limit: max num of TIDs in TX HE-SU multi-TID agg
631  *	0 - bad value, 1 - multi-tid not supported, 2..8 - tid limit
632  * @reserved1: reserved byte for future use
633  * @reserved2: reserved byte for future use
634  * @flags: see %iwl_11ax_sta_ctxt_flags
635  * @ref_bssid_addr: reference BSSID used by the AP
636  * @reserved0: reserved 2 bytes for aligning the ref_bssid_addr field to 8 bytes
637  * @htc_flags: which features are supported in HTC
638  * @frag_flags: frag support in A-MSDU
639  * @frag_level: frag support level
640  * @frag_max_num: max num of "open" MSDUs in the receiver (in power of 2)
641  * @frag_min_size: min frag size (except last frag)
642  * @pkt_ext: optional, exists according to PPE-present bit in the HE-PHY capa
643  * @bss_color: 11ax AP ID that is used in the HE SIG-A to mark inter BSS frame
644  * @htc_trig_based_pkt_ext: default PE in 4us units
645  * @frame_time_rts_th: HE duration RTS threshold, in units of 32us
646  * @rand_alloc_ecwmin: random CWmin = 2**ECWmin-1
647  * @rand_alloc_ecwmax: random CWmax = 2**ECWmax-1
648  * @reserved3: reserved byte for future use
649  * @trig_based_txf: MU EDCA Parameter set for the trigger based traffic queues
650  * @max_bssid_indicator: indicator of the max bssid supported on the associated
651  *	bss
652  * @bssid_index: index of the associated VAP
653  * @ema_ap: AP supports enhanced Multi BSSID advertisement
654  * @profile_periodicity: number of Beacon periods that are needed to receive the
655  *	complete VAPs info
656  * @bssid_count: actual number of VAPs in the MultiBSS Set
657  * @reserved4: alignment
658  */
659 struct iwl_he_sta_context_cmd_v2 {
660 	u8 sta_id;
661 	u8 tid_limit;
662 	u8 reserved1;
663 	u8 reserved2;
664 	__le32 flags;
665 
666 	/* The below fields are set via Multiple BSSID IE */
667 	u8 ref_bssid_addr[6];
668 	__le16 reserved0;
669 
670 	/* The below fields are set via HE-capabilities IE */
671 	__le32 htc_flags;
672 
673 	u8 frag_flags;
674 	u8 frag_level;
675 	u8 frag_max_num;
676 	u8 frag_min_size;
677 
678 	/* The below fields are set via PPE thresholds element */
679 	struct iwl_he_pkt_ext_v1 pkt_ext;
680 
681 	/* The below fields are set via HE-Operation IE */
682 	u8 bss_color;
683 	u8 htc_trig_based_pkt_ext;
684 	__le16 frame_time_rts_th;
685 
686 	/* Random access parameter set (i.e. RAPS) */
687 	u8 rand_alloc_ecwmin;
688 	u8 rand_alloc_ecwmax;
689 	__le16 reserved3;
690 
691 	/* The below fields are set via MU EDCA parameter set element */
692 	struct iwl_he_backoff_conf trig_based_txf[AC_NUM];
693 
694 	u8 max_bssid_indicator;
695 	u8 bssid_index;
696 	u8 ema_ap;
697 	u8 profile_periodicity;
698 	u8 bssid_count;
699 	u8 reserved4[3];
700 } __packed; /* STA_CONTEXT_DOT11AX_API_S_VER_2 */
701 
702 /**
703  * struct iwl_he_sta_context_cmd_v3 - configure FW to work with HE AP
704  * @sta_id: STA id
705  * @tid_limit: max num of TIDs in TX HE-SU multi-TID agg
706  *	0 - bad value, 1 - multi-tid not supported, 2..8 - tid limit
707  * @reserved1: reserved byte for future use
708  * @reserved2: reserved byte for future use
709  * @flags: see %iwl_11ax_sta_ctxt_flags
710  * @ref_bssid_addr: reference BSSID used by the AP
711  * @reserved0: reserved 2 bytes for aligning the ref_bssid_addr field to 8 bytes
712  * @htc_flags: which features are supported in HTC
713  * @frag_flags: frag support in A-MSDU
714  * @frag_level: frag support level
715  * @frag_max_num: max num of "open" MSDUs in the receiver (in power of 2)
716  * @frag_min_size: min frag size (except last frag)
717  * @pkt_ext: optional, exists according to PPE-present bit in the HE-PHY capa
718  * @bss_color: 11ax AP ID that is used in the HE SIG-A to mark inter BSS frame
719  * @htc_trig_based_pkt_ext: default PE in 4us units
720  * @frame_time_rts_th: HE duration RTS threshold, in units of 32us
721  * @rand_alloc_ecwmin: random CWmin = 2**ECWmin-1
722  * @rand_alloc_ecwmax: random CWmax = 2**ECWmax-1
723  * @puncture_mask: puncture mask for EHT
724  * @trig_based_txf: MU EDCA Parameter set for the trigger based traffic queues
725  * @max_bssid_indicator: indicator of the max bssid supported on the associated
726  *	bss
727  * @bssid_index: index of the associated VAP
728  * @ema_ap: AP supports enhanced Multi BSSID advertisement
729  * @profile_periodicity: number of Beacon periods that are needed to receive the
730  *	complete VAPs info
731  * @bssid_count: actual number of VAPs in the MultiBSS Set
732  * @reserved4: alignment
733  */
734 struct iwl_he_sta_context_cmd_v3 {
735 	u8 sta_id;
736 	u8 tid_limit;
737 	u8 reserved1;
738 	u8 reserved2;
739 	__le32 flags;
740 
741 	/* The below fields are set via Multiple BSSID IE */
742 	u8 ref_bssid_addr[6];
743 	__le16 reserved0;
744 
745 	/* The below fields are set via HE-capabilities IE */
746 	__le32 htc_flags;
747 
748 	u8 frag_flags;
749 	u8 frag_level;
750 	u8 frag_max_num;
751 	u8 frag_min_size;
752 
753 	/* The below fields are set via PPE thresholds element */
754 	struct iwl_he_pkt_ext_v2 pkt_ext;
755 
756 	/* The below fields are set via HE-Operation IE */
757 	u8 bss_color;
758 	u8 htc_trig_based_pkt_ext;
759 	__le16 frame_time_rts_th;
760 
761 	/* Random access parameter set (i.e. RAPS) */
762 	u8 rand_alloc_ecwmin;
763 	u8 rand_alloc_ecwmax;
764 	__le16 puncture_mask;
765 
766 	/* The below fields are set via MU EDCA parameter set element */
767 	struct iwl_he_backoff_conf trig_based_txf[AC_NUM];
768 
769 	u8 max_bssid_indicator;
770 	u8 bssid_index;
771 	u8 ema_ap;
772 	u8 profile_periodicity;
773 	u8 bssid_count;
774 	u8 reserved4[3];
775 } __packed; /* STA_CONTEXT_DOT11AX_API_S_VER_2 */
776 
777 /**
778  * struct iwl_he_monitor_cmd - configure air sniffer for HE
779  * @bssid: the BSSID to sniff for
780  * @reserved1: reserved for dword alignment
781  * @aid: the AID to track on for HE MU
782  * @reserved2: reserved for future use
783  */
784 struct iwl_he_monitor_cmd {
785 	u8 bssid[6];
786 	__le16 reserved1;
787 	__le16 aid;
788 	u8 reserved2[6];
789 } __packed; /* HE_AIR_SNIFFER_CONFIG_CMD_API_S_VER_1 */
790 
791 #endif /* __iwl_fw_api_mac_h__ */
792