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