1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018-2021 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  */
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 };
149 
150 /**
151  * struct iwl_mac_data_sta - configuration data for station MAC context
152  * @is_assoc: 1 for associated state, 0 otherwise
153  * @dtim_time: DTIM arrival time in system time
154  * @dtim_tsf: DTIM arrival time in TSF
155  * @bi: beacon interval in TU, applicable only when associated
156  * @reserved1: reserved
157  * @dtim_interval: DTIM interval in TU, applicable only when associated
158  * @data_policy: see &enum iwl_mac_data_policy
159  * @listen_interval: in beacon intervals, applicable only when associated
160  * @assoc_id: unique ID assigned by the AP during association
161  * @assoc_beacon_arrive_time: TSF of first beacon after association
162  */
163 struct iwl_mac_data_sta {
164 	__le32 is_assoc;
165 	__le32 dtim_time;
166 	__le64 dtim_tsf;
167 	__le32 bi;
168 	__le32 reserved1;
169 	__le32 dtim_interval;
170 	__le32 data_policy;
171 	__le32 listen_interval;
172 	__le32 assoc_id;
173 	__le32 assoc_beacon_arrive_time;
174 } __packed; /* STA_MAC_DATA_API_S_VER_2 */
175 
176 /**
177  * struct iwl_mac_data_go - configuration data for P2P GO MAC context
178  * @ap: iwl_mac_data_ap struct with most config data
179  * @ctwin: client traffic window in TU (period after TBTT when GO is present).
180  *	0 indicates that there is no CT window.
181  * @opp_ps_enabled: indicate that opportunistic PS allowed
182  */
183 struct iwl_mac_data_go {
184 	struct iwl_mac_data_ap ap;
185 	__le32 ctwin;
186 	__le32 opp_ps_enabled;
187 } __packed; /* GO_MAC_DATA_API_S_VER_1 */
188 
189 /**
190  * struct iwl_mac_data_p2p_sta - configuration data for P2P client MAC context
191  * @sta: iwl_mac_data_sta struct with most config data
192  * @ctwin: client traffic window in TU (period after TBTT when GO is present).
193  *	0 indicates that there is no CT window.
194  */
195 struct iwl_mac_data_p2p_sta {
196 	struct iwl_mac_data_sta sta;
197 	__le32 ctwin;
198 } __packed; /* P2P_STA_MAC_DATA_API_S_VER_2 */
199 
200 /**
201  * struct iwl_mac_data_pibss - Pseudo IBSS config data
202  * @stats_interval: interval in TU between statistics notifications to host.
203  */
204 struct iwl_mac_data_pibss {
205 	__le32 stats_interval;
206 } __packed; /* PIBSS_MAC_DATA_API_S_VER_1 */
207 
208 /*
209  * struct iwl_mac_data_p2p_dev - configuration data for the P2P Device MAC
210  * context.
211  * @is_disc_extended: if set to true, P2P Device discoverability is enabled on
212  *	other channels as well. This should be to true only in case that the
213  *	device is discoverable and there is an active GO. Note that setting this
214  *	field when not needed, will increase the number of interrupts and have
215  *	effect on the platform power, as this setting opens the Rx filters on
216  *	all macs.
217  */
218 struct iwl_mac_data_p2p_dev {
219 	__le32 is_disc_extended;
220 } __packed; /* _P2P_DEV_MAC_DATA_API_S_VER_1 */
221 
222 /**
223  * enum iwl_mac_filter_flags - MAC context filter flags
224  * @MAC_FILTER_IN_PROMISC: accept all data frames
225  * @MAC_FILTER_IN_CONTROL_AND_MGMT: pass all management and
226  *	control frames to the host
227  * @MAC_FILTER_ACCEPT_GRP: accept multicast frames
228  * @MAC_FILTER_DIS_DECRYPT: don't decrypt unicast frames
229  * @MAC_FILTER_DIS_GRP_DECRYPT: don't decrypt multicast frames
230  * @MAC_FILTER_IN_BEACON: transfer foreign BSS's beacons to host
231  *	(in station mode when associated)
232  * @MAC_FILTER_OUT_BCAST: filter out all broadcast frames
233  * @MAC_FILTER_IN_CRC32: extract FCS and append it to frames
234  * @MAC_FILTER_IN_PROBE_REQUEST: pass probe requests to host
235  */
236 enum iwl_mac_filter_flags {
237 	MAC_FILTER_IN_PROMISC		= BIT(0),
238 	MAC_FILTER_IN_CONTROL_AND_MGMT	= BIT(1),
239 	MAC_FILTER_ACCEPT_GRP		= BIT(2),
240 	MAC_FILTER_DIS_DECRYPT		= BIT(3),
241 	MAC_FILTER_DIS_GRP_DECRYPT	= BIT(4),
242 	MAC_FILTER_IN_BEACON		= BIT(6),
243 	MAC_FILTER_OUT_BCAST		= BIT(8),
244 	MAC_FILTER_IN_CRC32		= BIT(11),
245 	MAC_FILTER_IN_PROBE_REQUEST	= BIT(12),
246 	/**
247 	 * @MAC_FILTER_IN_11AX: mark BSS as supporting 802.11ax
248 	 */
249 	MAC_FILTER_IN_11AX		= BIT(14),
250 };
251 
252 /**
253  * enum iwl_mac_qos_flags - QoS flags
254  * @MAC_QOS_FLG_UPDATE_EDCA: ?
255  * @MAC_QOS_FLG_TGN: HT is enabled
256  * @MAC_QOS_FLG_TXOP_TYPE: ?
257  *
258  */
259 enum iwl_mac_qos_flags {
260 	MAC_QOS_FLG_UPDATE_EDCA	= BIT(0),
261 	MAC_QOS_FLG_TGN		= BIT(1),
262 	MAC_QOS_FLG_TXOP_TYPE	= BIT(4),
263 };
264 
265 /**
266  * struct iwl_ac_qos - QOS timing params for MAC_CONTEXT_CMD
267  * @cw_min: Contention window, start value in numbers of slots.
268  *	Should be a power-of-2, minus 1.  Device's default is 0x0f.
269  * @cw_max: Contention window, max value in numbers of slots.
270  *	Should be a power-of-2, minus 1.  Device's default is 0x3f.
271  * @aifsn:  Number of slots in Arbitration Interframe Space (before
272  *	performing random backoff timing prior to Tx).  Device default 1.
273  * @fifos_mask: FIFOs used by this MAC for this AC
274  * @edca_txop:  Length of Tx opportunity, in uSecs.  Device default is 0.
275  *
276  * One instance of this config struct for each of 4 EDCA access categories
277  * in struct iwl_qosparam_cmd.
278  *
279  * Device will automatically increase contention window by (2*CW) + 1 for each
280  * transmission retry.  Device uses cw_max as a bit mask, ANDed with new CW
281  * value, to cap the CW value.
282  */
283 struct iwl_ac_qos {
284 	__le16 cw_min;
285 	__le16 cw_max;
286 	u8 aifsn;
287 	u8 fifos_mask;
288 	__le16 edca_txop;
289 } __packed; /* AC_QOS_API_S_VER_2 */
290 
291 /**
292  * struct iwl_mac_ctx_cmd - command structure to configure MAC contexts
293  * ( MAC_CONTEXT_CMD = 0x28 )
294  * @id_and_color: ID and color of the MAC
295  * @action: action to perform, one of FW_CTXT_ACTION_*
296  * @mac_type: one of &enum iwl_mac_types
297  * @tsf_id: TSF HW timer, one of &enum iwl_tsf_id
298  * @node_addr: MAC address
299  * @reserved_for_node_addr: reserved
300  * @bssid_addr: BSSID
301  * @reserved_for_bssid_addr: reserved
302  * @cck_rates: basic rates available for CCK
303  * @ofdm_rates: basic rates available for OFDM
304  * @protection_flags: combination of &enum iwl_mac_protection_flags
305  * @cck_short_preamble: 0x20 for enabling short preamble, 0 otherwise
306  * @short_slot: 0x10 for enabling short slots, 0 otherwise
307  * @filter_flags: combination of &enum iwl_mac_filter_flags
308  * @qos_flags: from &enum iwl_mac_qos_flags
309  * @ac: one iwl_mac_qos configuration for each AC
310  */
311 struct iwl_mac_ctx_cmd {
312 	/* COMMON_INDEX_HDR_API_S_VER_1 */
313 	__le32 id_and_color;
314 	__le32 action;
315 	/* MAC_CONTEXT_COMMON_DATA_API_S_VER_1 */
316 	__le32 mac_type;
317 	__le32 tsf_id;
318 	u8 node_addr[6];
319 	__le16 reserved_for_node_addr;
320 	u8 bssid_addr[6];
321 	__le16 reserved_for_bssid_addr;
322 	__le32 cck_rates;
323 	__le32 ofdm_rates;
324 	__le32 protection_flags;
325 	__le32 cck_short_preamble;
326 	__le32 short_slot;
327 	__le32 filter_flags;
328 	/* MAC_QOS_PARAM_API_S_VER_1 */
329 	__le32 qos_flags;
330 	struct iwl_ac_qos ac[AC_NUM+1];
331 	/* MAC_CONTEXT_COMMON_DATA_API_S */
332 	union {
333 		struct iwl_mac_data_ap ap;
334 		struct iwl_mac_data_go go;
335 		struct iwl_mac_data_sta sta;
336 		struct iwl_mac_data_p2p_sta p2p_sta;
337 		struct iwl_mac_data_p2p_dev p2p_dev;
338 		struct iwl_mac_data_pibss pibss;
339 		struct iwl_mac_data_ibss ibss;
340 	};
341 } __packed; /* MAC_CONTEXT_CMD_API_S_VER_1 */
342 
343 #define IWL_NONQOS_SEQ_GET	0x1
344 #define IWL_NONQOS_SEQ_SET	0x2
345 struct iwl_nonqos_seq_query_cmd {
346 	__le32 get_set_flag;
347 	__le32 mac_id_n_color;
348 	__le16 value;
349 	__le16 reserved;
350 } __packed; /* NON_QOS_TX_COUNTER_GET_SET_API_S_VER_1 */
351 
352 /**
353  * struct iwl_missed_beacons_notif - information on missed beacons
354  * ( MISSED_BEACONS_NOTIFICATION = 0xa2 )
355  * @mac_id: interface ID
356  * @consec_missed_beacons_since_last_rx: number of consecutive missed
357  *	beacons since last RX.
358  * @consec_missed_beacons: number of consecutive missed beacons
359  * @num_expected_beacons: number of expected beacons
360  * @num_recvd_beacons: number of received beacons
361  */
362 struct iwl_missed_beacons_notif {
363 	__le32 mac_id;
364 	__le32 consec_missed_beacons_since_last_rx;
365 	__le32 consec_missed_beacons;
366 	__le32 num_expected_beacons;
367 	__le32 num_recvd_beacons;
368 } __packed; /* MISSED_BEACON_NTFY_API_S_VER_3 */
369 
370 /**
371  * struct iwl_he_backoff_conf - used for backoff configuration
372  * Per each trigger-based AC, (set by MU EDCA Parameter set info-element)
373  * used for backoff configuration of TXF5..TXF8 trigger based.
374  * The MU-TIMER is reloaded w/ MU_TIME each time a frame from the AC is sent via
375  * trigger-based TX.
376  * @cwmin: CW min
377  * @cwmax: CW max
378  * @aifsn: AIFSN
379  *	AIFSN=0, means that no backoff from the specified TRIG-BASED AC is
380  *	allowed till the MU-TIMER is 0
381  * @mu_time: MU time in 8TU units
382  */
383 struct iwl_he_backoff_conf {
384 	__le16 cwmin;
385 	__le16 cwmax;
386 	__le16 aifsn;
387 	__le16 mu_time;
388 } __packed; /* AC_QOS_DOT11AX_API_S */
389 
390 /**
391  * enum iwl_he_pkt_ext_constellations - PPE constellation indices
392  * @IWL_HE_PKT_EXT_BPSK: BPSK
393  * @IWL_HE_PKT_EXT_QPSK:  QPSK
394  * @IWL_HE_PKT_EXT_16QAM: 16-QAM
395  * @IWL_HE_PKT_EXT_64QAM: 64-QAM
396  * @IWL_HE_PKT_EXT_256QAM: 256-QAM
397  * @IWL_HE_PKT_EXT_1024QAM: 1024-QAM
398  * @IWL_HE_PKT_EXT_RESERVED: reserved value
399  * @IWL_HE_PKT_EXT_NONE: not defined
400  */
401 enum iwl_he_pkt_ext_constellations {
402 	IWL_HE_PKT_EXT_BPSK = 0,
403 	IWL_HE_PKT_EXT_QPSK,
404 	IWL_HE_PKT_EXT_16QAM,
405 	IWL_HE_PKT_EXT_64QAM,
406 	IWL_HE_PKT_EXT_256QAM,
407 	IWL_HE_PKT_EXT_1024QAM,
408 	IWL_HE_PKT_EXT_RESERVED,
409 	IWL_HE_PKT_EXT_NONE,
410 };
411 
412 #define MAX_HE_SUPP_NSS	2
413 #define MAX_HE_CHANNEL_BW_INDX	4
414 
415 /**
416  * struct iwl_he_pkt_ext - QAM thresholds
417  * The required PPE is set via HE Capabilities IE, per Nss x BW x MCS
418  * The IE is organized in the following way:
419  * Support for Nss x BW (or RU) matrix:
420  *	(0=SISO, 1=MIMO2) x (0-20MHz, 1-40MHz, 2-80MHz, 3-160MHz)
421  * Each entry contains 2 QAM thresholds for 8us and 16us:
422  *	0=BPSK, 1=QPSK, 2=16QAM, 3=64QAM, 4=256QAM, 5=1024QAM, 6=RES, 7=NONE
423  * i.e. QAM_th1 < QAM_th2 such if TX uses QAM_tx:
424  *	QAM_tx < QAM_th1            --> PPE=0us
425  *	QAM_th1 <= QAM_tx < QAM_th2 --> PPE=8us
426  *	QAM_th2 <= QAM_tx           --> PPE=16us
427  * @pkt_ext_qam_th: QAM thresholds
428  *	For each Nss/Bw define 2 QAM thrsholds (0..5)
429  *	For rates below the low_th, no need for PPE
430  *	For rates between low_th and high_th, need 8us PPE
431  *	For rates equal or higher then the high_th, need 16us PPE
432  *	Nss (0-siso, 1-mimo2) x BW (0-20MHz, 1-40MHz, 2-80MHz, 3-160MHz) x
433  *		(0-low_th, 1-high_th)
434  */
435 struct iwl_he_pkt_ext {
436 	u8 pkt_ext_qam_th[MAX_HE_SUPP_NSS][MAX_HE_CHANNEL_BW_INDX][2];
437 } __packed; /* PKT_EXT_DOT11AX_API_S */
438 
439 /**
440  * enum iwl_he_sta_ctxt_flags - HE STA context flags
441  * @STA_CTXT_HE_REF_BSSID_VALID: ref bssid addr valid (for receiving specific
442  *	control frames such as TRIG, NDPA, BACK)
443  * @STA_CTXT_HE_BSS_COLOR_DIS: BSS color disable, don't use the BSS
444  *	color for RX filter but use MAC header
445  * @STA_CTXT_HE_PARTIAL_BSS_COLOR: partial BSS color allocation
446  * @STA_CTXT_HE_32BIT_BA_BITMAP: indicates the receiver supports BA bitmap
447  *	of 32-bits
448  * @STA_CTXT_HE_PACKET_EXT: indicates that the packet-extension info is valid
449  *	and should be used
450  * @STA_CTXT_HE_TRIG_RND_ALLOC: indicates that trigger based random allocation
451  *	is enabled according to UORA element existence
452  * @STA_CTXT_HE_CONST_TRIG_RND_ALLOC: used for AV testing
453  * @STA_CTXT_HE_ACK_ENABLED: indicates that the AP supports receiving ACK-
454  *	enabled AGG, i.e. both BACK and non-BACK frames in a single AGG
455  * @STA_CTXT_HE_MU_EDCA_CW: indicates that there is an element of MU EDCA
456  *	parameter set, i.e. the backoff counters for trig-based ACs
457  * @STA_CTXT_HE_NIC_NOT_ACK_ENABLED: mark that the NIC doesn't support receiving
458  *	ACK-enabled AGG, (i.e. both BACK and non-BACK frames in single AGG).
459  *	If the NIC is not ACK_ENABLED it may use the EOF-bit in first non-0
460  *	len delim to determine if AGG or single.
461  * @STA_CTXT_HE_RU_2MHZ_BLOCK: indicates that 26-tone RU OFDMA transmission are
462  *      not allowed (as there are OBSS that might classify such transmissions as
463  *      radar pulses).
464  */
465 enum iwl_he_sta_ctxt_flags {
466 	STA_CTXT_HE_REF_BSSID_VALID		= BIT(4),
467 	STA_CTXT_HE_BSS_COLOR_DIS		= BIT(5),
468 	STA_CTXT_HE_PARTIAL_BSS_COLOR		= BIT(6),
469 	STA_CTXT_HE_32BIT_BA_BITMAP		= BIT(7),
470 	STA_CTXT_HE_PACKET_EXT			= BIT(8),
471 	STA_CTXT_HE_TRIG_RND_ALLOC		= BIT(9),
472 	STA_CTXT_HE_CONST_TRIG_RND_ALLOC	= BIT(10),
473 	STA_CTXT_HE_ACK_ENABLED			= BIT(11),
474 	STA_CTXT_HE_MU_EDCA_CW			= BIT(12),
475 	STA_CTXT_HE_NIC_NOT_ACK_ENABLED		= BIT(13),
476 	STA_CTXT_HE_RU_2MHZ_BLOCK		= BIT(14),
477 };
478 
479 /**
480  * enum iwl_he_htc_flags - HE HTC support flags
481  * @IWL_HE_HTC_SUPPORT: HE-HTC support
482  * @IWL_HE_HTC_UL_MU_RESP_SCHED: HE UL MU response schedule
483  *	support via A-control field
484  * @IWL_HE_HTC_BSR_SUPP: BSR support in A-control field
485  * @IWL_HE_HTC_OMI_SUPP: A-OMI support in A-control field
486  * @IWL_HE_HTC_BQR_SUPP: A-BQR support in A-control field
487  */
488 enum iwl_he_htc_flags {
489 	IWL_HE_HTC_SUPPORT			= BIT(0),
490 	IWL_HE_HTC_UL_MU_RESP_SCHED		= BIT(3),
491 	IWL_HE_HTC_BSR_SUPP			= BIT(4),
492 	IWL_HE_HTC_OMI_SUPP			= BIT(5),
493 	IWL_HE_HTC_BQR_SUPP			= BIT(6),
494 };
495 
496 /*
497  * @IWL_HE_HTC_LINK_ADAP_NO_FEEDBACK: the STA does not provide HE MFB
498  * @IWL_HE_HTC_LINK_ADAP_UNSOLICITED: the STA provides only unsolicited HE MFB
499  * @IWL_HE_HTC_LINK_ADAP_BOTH: the STA is capable of providing HE MFB in
500  *      response to HE MRQ and if the STA provides unsolicited HE MFB
501  */
502 #define IWL_HE_HTC_LINK_ADAP_POS		(1)
503 #define IWL_HE_HTC_LINK_ADAP_NO_FEEDBACK	(0)
504 #define IWL_HE_HTC_LINK_ADAP_UNSOLICITED	(2 << IWL_HE_HTC_LINK_ADAP_POS)
505 #define IWL_HE_HTC_LINK_ADAP_BOTH		(3 << IWL_HE_HTC_LINK_ADAP_POS)
506 
507 /**
508  * struct iwl_he_sta_context_cmd_v1 - configure FW to work with HE AP
509  * @sta_id: STA id
510  * @tid_limit: max num of TIDs in TX HE-SU multi-TID agg
511  *	0 - bad value, 1 - multi-tid not supported, 2..8 - tid limit
512  * @reserved1: reserved byte for future use
513  * @reserved2: reserved byte for future use
514  * @flags: see %iwl_11ax_sta_ctxt_flags
515  * @ref_bssid_addr: reference BSSID used by the AP
516  * @reserved0: reserved 2 bytes for aligning the ref_bssid_addr field to 8 bytes
517  * @htc_flags: which features are supported in HTC
518  * @frag_flags: frag support in A-MSDU
519  * @frag_level: frag support level
520  * @frag_max_num: max num of "open" MSDUs in the receiver (in power of 2)
521  * @frag_min_size: min frag size (except last frag)
522  * @pkt_ext: optional, exists according to PPE-present bit in the HE-PHY capa
523  * @bss_color: 11ax AP ID that is used in the HE SIG-A to mark inter BSS frame
524  * @htc_trig_based_pkt_ext: default PE in 4us units
525  * @frame_time_rts_th: HE duration RTS threshold, in units of 32us
526  * @rand_alloc_ecwmin: random CWmin = 2**ECWmin-1
527  * @rand_alloc_ecwmax: random CWmax = 2**ECWmax-1
528  * @reserved3: reserved byte for future use
529  * @trig_based_txf: MU EDCA Parameter set for the trigger based traffic queues
530  */
531 struct iwl_he_sta_context_cmd_v1 {
532 	u8 sta_id;
533 	u8 tid_limit;
534 	u8 reserved1;
535 	u8 reserved2;
536 	__le32 flags;
537 
538 	/* The below fields are set via Multiple BSSID IE */
539 	u8 ref_bssid_addr[6];
540 	__le16 reserved0;
541 
542 	/* The below fields are set via HE-capabilities IE */
543 	__le32 htc_flags;
544 
545 	u8 frag_flags;
546 	u8 frag_level;
547 	u8 frag_max_num;
548 	u8 frag_min_size;
549 
550 	/* The below fields are set via PPE thresholds element */
551 	struct iwl_he_pkt_ext pkt_ext;
552 
553 	/* The below fields are set via HE-Operation IE */
554 	u8 bss_color;
555 	u8 htc_trig_based_pkt_ext;
556 	__le16 frame_time_rts_th;
557 
558 	/* Random access parameter set (i.e. RAPS) */
559 	u8 rand_alloc_ecwmin;
560 	u8 rand_alloc_ecwmax;
561 	__le16 reserved3;
562 
563 	/* The below fields are set via MU EDCA parameter set element */
564 	struct iwl_he_backoff_conf trig_based_txf[AC_NUM];
565 } __packed; /* STA_CONTEXT_DOT11AX_API_S_VER_1 */
566 
567 /**
568  * struct iwl_he_sta_context_cmd - 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  * @max_bssid_indicator: indicator of the max bssid supported on the associated
591  *	bss
592  * @bssid_index: index of the associated VAP
593  * @ema_ap: AP supports enhanced Multi BSSID advertisement
594  * @profile_periodicity: number of Beacon periods that are needed to receive the
595  *	complete VAPs info
596  * @bssid_count: actual number of VAPs in the MultiBSS Set
597  * @reserved4: alignment
598  */
599 struct iwl_he_sta_context_cmd {
600 	u8 sta_id;
601 	u8 tid_limit;
602 	u8 reserved1;
603 	u8 reserved2;
604 	__le32 flags;
605 
606 	/* The below fields are set via Multiple BSSID IE */
607 	u8 ref_bssid_addr[6];
608 	__le16 reserved0;
609 
610 	/* The below fields are set via HE-capabilities IE */
611 	__le32 htc_flags;
612 
613 	u8 frag_flags;
614 	u8 frag_level;
615 	u8 frag_max_num;
616 	u8 frag_min_size;
617 
618 	/* The below fields are set via PPE thresholds element */
619 	struct iwl_he_pkt_ext pkt_ext;
620 
621 	/* The below fields are set via HE-Operation IE */
622 	u8 bss_color;
623 	u8 htc_trig_based_pkt_ext;
624 	__le16 frame_time_rts_th;
625 
626 	/* Random access parameter set (i.e. RAPS) */
627 	u8 rand_alloc_ecwmin;
628 	u8 rand_alloc_ecwmax;
629 	__le16 reserved3;
630 
631 	/* The below fields are set via MU EDCA parameter set element */
632 	struct iwl_he_backoff_conf trig_based_txf[AC_NUM];
633 
634 	u8 max_bssid_indicator;
635 	u8 bssid_index;
636 	u8 ema_ap;
637 	u8 profile_periodicity;
638 	u8 bssid_count;
639 	u8 reserved4[3];
640 } __packed; /* STA_CONTEXT_DOT11AX_API_S_VER_2 */
641 
642 /**
643  * struct iwl_he_monitor_cmd - configure air sniffer for HE
644  * @bssid: the BSSID to sniff for
645  * @reserved1: reserved for dword alignment
646  * @aid: the AID to track on for HE MU
647  * @reserved2: reserved for future use
648  */
649 struct iwl_he_monitor_cmd {
650 	u8 bssid[6];
651 	__le16 reserved1;
652 	__le16 aid;
653 	u8 reserved2[6];
654 } __packed; /* HE_AIR_SNIFFER_CONFIG_CMD_API_S_VER_1 */
655 
656 #endif /* __iwl_fw_api_mac_h__ */
657