Debian Codegraph @

drivers/net/wireless/intel/iwlwifi/fw/api/tx.h

raw
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3 * Copyright (C) 2012-2014, 2018-2025 Intel Corporation
4 * Copyright (C) 2016-2017 Intel Deutschland GmbH
5 */
6 #ifndef __iwl_fw_api_tx_h__
7 #define __iwl_fw_api_tx_h__
8 #include <linux/ieee80211.h>
9
10 /**
11 * enum iwl_tx_flags - bitmasks for tx_flags in TX command
12 * @TX_CMD_FLG_PROT_REQUIRE: use RTS or CTS-to-self to protect the frame
13 * @TX_CMD_FLG_WRITE_TX_POWER: update current tx power value in the mgmt frame
14 * @TX_CMD_FLG_ACK: expect ACK from receiving station
15 * @TX_CMD_FLG_STA_RATE: use RS table with initial index from the TX command.
16 * Otherwise, use rate_n_flags from the TX command
17 * @TX_CMD_FLG_BAR: this frame is a BA request, immediate BAR is expected
18 * Must set TX_CMD_FLG_ACK with this flag.
19 * @TX_CMD_FLG_TXOP_PROT: TXOP protection requested
20 * @TX_CMD_FLG_VHT_NDPA: mark frame is NDPA for VHT beamformer sequence
21 * @TX_CMD_FLG_HT_NDPA: mark frame is NDPA for HT beamformer sequence
22 * @TX_CMD_FLG_CSI_FDBK2HOST: mark to send feedback to host (only if good CRC)
23 * @TX_CMD_FLG_BT_PRIO_MASK: BT priority value
24 * @TX_CMD_FLG_BT_PRIO_POS: the position of the BT priority (bit 11 is ignored
25 * on old firmwares).
26 * @TX_CMD_FLG_BT_DIS: disable BT priority for this frame
27 * @TX_CMD_FLG_SEQ_CTL: set if FW should override the sequence control.
28 * Should be set for mgmt, non-QOS data, mcast, bcast and in scan command
29 * @TX_CMD_FLG_MORE_FRAG: this frame is non-last MPDU
30 * @TX_CMD_FLG_TSF: FW should calculate and insert TSF in the frame
31 * Should be set for beacons and probe responses
32 * @TX_CMD_FLG_CALIB: activate PA TX power calibrations
33 * @TX_CMD_FLG_KEEP_SEQ_CTL: if seq_ctl is set, don't increase inner seq count
34 * @TX_CMD_FLG_MH_PAD: driver inserted 2 byte padding after MAC header.
35 * Should be set for 26/30 length MAC headers
36 * @TX_CMD_FLG_RESP_TO_DRV: zero this if the response should go only to FW
37 * @TX_CMD_FLG_TKIP_MIC_DONE: FW already performed TKIP MIC calculation
38 * @TX_CMD_FLG_DUR: disable duration overwriting used in PS-Poll Assoc-id
39 * @TX_CMD_FLG_FW_DROP: FW should mark frame to be dropped
40 * @TX_CMD_FLG_EXEC_PAPD: execute PAPD
41 * @TX_CMD_FLG_PAPD_TYPE: 0 for reference power, 1 for nominal power
42 * @TX_CMD_FLG_HCCA_CHUNK: mark start of TSPEC chunk
43 */
44 enum iwl_tx_flags {
45 TX_CMD_FLG_PROT_REQUIRE = BIT(0),
46 TX_CMD_FLG_WRITE_TX_POWER = BIT(1),
47 TX_CMD_FLG_ACK = BIT(3),
48 TX_CMD_FLG_STA_RATE = BIT(4),
49 TX_CMD_FLG_BAR = BIT(6),
50 TX_CMD_FLG_TXOP_PROT = BIT(7),
51 TX_CMD_FLG_VHT_NDPA = BIT(8),
52 TX_CMD_FLG_HT_NDPA = BIT(9),
53 TX_CMD_FLG_CSI_FDBK2HOST = BIT(10),
54 TX_CMD_FLG_BT_PRIO_POS = 11,
55 TX_CMD_FLG_BT_PRIO_MASK = BIT(11) | BIT(12),
56 TX_CMD_FLG_BT_DIS = BIT(12),
57 TX_CMD_FLG_SEQ_CTL = BIT(13),
58 TX_CMD_FLG_MORE_FRAG = BIT(14),
59 TX_CMD_FLG_TSF = BIT(16),
60 TX_CMD_FLG_CALIB = BIT(17),
61 TX_CMD_FLG_KEEP_SEQ_CTL = BIT(18),
62 TX_CMD_FLG_MH_PAD = BIT(20),
63 TX_CMD_FLG_RESP_TO_DRV = BIT(21),
64 TX_CMD_FLG_TKIP_MIC_DONE = BIT(23),
65 TX_CMD_FLG_DUR = BIT(25),
66 TX_CMD_FLG_FW_DROP = BIT(26),
67 TX_CMD_FLG_EXEC_PAPD = BIT(27),
68 TX_CMD_FLG_PAPD_TYPE = BIT(28),
69 TX_CMD_FLG_HCCA_CHUNK = BIT(31)
70 }; /* TX_FLAGS_BITS_API_S_VER_1 */
71
72 /**
73 * enum iwl_tx_cmd_flags - bitmasks for tx_flags in TX command for 22000
74 * @IWL_TX_FLAGS_CMD_RATE: use rate from the TX command
75 * @IWL_TX_FLAGS_ENCRYPT_DIS: frame should not be encrypted, even if it belongs
76 * to a secured STA
77 * @IWL_TX_FLAGS_HIGH_PRI: high priority frame (like EAPOL) - can affect rate
78 * selection, retry limits and BT kill
79 * @IWL_TX_FLAGS_RTS: firmware used an RTS
80 * @IWL_TX_FLAGS_CTS: firmware used CTS-to-self
81 */
82 enum iwl_tx_cmd_flags {
83 IWL_TX_FLAGS_CMD_RATE = BIT(0),
84 IWL_TX_FLAGS_ENCRYPT_DIS = BIT(1),
85 IWL_TX_FLAGS_HIGH_PRI = BIT(2),
86 /* Use these flags only from
87 * TX_FLAGS_BITS_API_S_VER_4 and above */
88 IWL_TX_FLAGS_RTS = BIT(3),
89 IWL_TX_FLAGS_CTS = BIT(4),
90 }; /* TX_FLAGS_BITS_API_S_VER_3 */
91
92 /**
93 * enum iwl_tx_pm_timeouts - pm timeout values in TX command
94 * @PM_FRAME_NONE: no need to suspend sleep mode
95 * @PM_FRAME_MGMT: fw suspend sleep mode for 100TU
96 * @PM_FRAME_ASSOC: fw suspend sleep mode for 10sec
97 */
98 enum iwl_tx_pm_timeouts {
99 PM_FRAME_NONE = 0,
100 PM_FRAME_MGMT = 2,
101 PM_FRAME_ASSOC = 3,
102 };
103
104 #define TX_CMD_SEC_MSK 0x07
105 #define TX_CMD_SEC_WEP_KEY_IDX_POS 6
106 #define TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0
107
108 /**
109 * enum iwl_tx_cmd_sec_ctrl - bitmasks for security control in TX command
110 * @TX_CMD_SEC_WEP: WEP encryption algorithm.
111 * @TX_CMD_SEC_CCM: CCM encryption algorithm.
112 * @TX_CMD_SEC_TKIP: TKIP encryption algorithm.
113 * @TX_CMD_SEC_EXT: extended cipher algorithm.
114 * @TX_CMD_SEC_GCMP: GCMP encryption algorithm.
115 * @TX_CMD_SEC_KEY128: set for 104 bits WEP key.
116 * @TX_CMD_SEC_KEY_FROM_TABLE: for a non-WEP key, set if the key should be taken
117 * from the table instead of from the TX command.
118 * If the key is taken from the key table its index should be given by the
119 * first byte of the TX command key field.
120 */
121 enum iwl_tx_cmd_sec_ctrl {
122 TX_CMD_SEC_WEP = 0x01,
123 TX_CMD_SEC_CCM = 0x02,
124 TX_CMD_SEC_TKIP = 0x03,
125 TX_CMD_SEC_EXT = 0x04,
126 TX_CMD_SEC_GCMP = 0x05,
127 TX_CMD_SEC_KEY128 = 0x08,
128 TX_CMD_SEC_KEY_FROM_TABLE = 0x10,
129 };
130
131 /*
132 * TX command Frame life time in us - to be written in pm_frame_timeout
133 */
134 #define TX_CMD_LIFE_TIME_INFINITE 0xFFFFFFFF
135 #define TX_CMD_LIFE_TIME_DEFAULT 2000000 /* 2000 ms*/
136 #define TX_CMD_LIFE_TIME_PROBE_RESP 40000 /* 40 ms */
137 #define TX_CMD_LIFE_TIME_EXPIRED_FRAME 0
138
139 /*
140 * TID for non QoS frames - to be written in tid_tspec
141 */
142 #define IWL_TID_NON_QOS 0
143
144 /*
145 * Limits on the retransmissions - to be written in {data,rts}_retry_limit
146 */
147 #define IWL_DEFAULT_TX_RETRY 15
148 #define IWL_MGMT_DFAULT_RETRY_LIMIT 3
149 #define IWL_RTS_DFAULT_RETRY_LIMIT 60
150 #define IWL_BAR_DFAULT_RETRY_LIMIT 60
151 #define IWL_LOW_RETRY_LIMIT 7
152
153 /**
154 * enum iwl_tx_offload_assist_flags_pos - set %iwl_tx_cmd_v6 offload_assist values
155 * @TX_CMD_OFFLD_IP_HDR: offset to start of IP header (in words)
156 * from mac header end. For normal case it is 4 words for SNAP.
157 * note: tx_cmd, mac header and pad are not counted in the offset.
158 * This is used to help the offload in case there is tunneling such as
159 * IPv6 in IPv4, in such case the ip header offset should point to the
160 * inner ip header and IPv4 checksum of the external header should be
161 * calculated by driver.
162 * @TX_CMD_OFFLD_L4_EN: enable TCP/UDP checksum
163 * @TX_CMD_OFFLD_L3_EN: enable IP header checksum
164 * @TX_CMD_OFFLD_MH_SIZE: size of the mac header in words. Includes the IV
165 * field. Doesn't include the pad.
166 * @TX_CMD_OFFLD_PAD: mark 2-byte pad was inserted after the mac header for
167 * alignment
168 * @TX_CMD_OFFLD_AMSDU: mark TX command is A-MSDU
169 */
170 enum iwl_tx_offload_assist_flags_pos {
171 TX_CMD_OFFLD_IP_HDR = 0,
172 TX_CMD_OFFLD_L4_EN = 6,
173 TX_CMD_OFFLD_L3_EN = 7,
174 TX_CMD_OFFLD_MH_SIZE = 8,
175 TX_CMD_OFFLD_PAD = 13,
176 TX_CMD_OFFLD_AMSDU = 14,
177 };
178
179 #define IWL_TX_CMD_OFFLD_MH_MASK 0x1f
180 #define IWL_TX_CMD_OFFLD_IP_HDR_MASK 0x3f
181
182 /* TODO: complete documentation for try_cnt and btkill_cnt */
183 /**
184 * struct iwl_tx_cmd_v6_params - parameters of the TX
185 *
186 * @len: in bytes of the payload, see below for details
187 * @offload_assist: TX offload configuration
188 * @tx_flags: combination of TX_CMD_FLG_*, see &enum iwl_tx_flags
189 * @scratch: scratch buffer used by the device
190 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
191 * cleared. Combination of RATE_MCS_*
192 * @sta_id: index of destination station in FW station table
193 * @sec_ctl: security control, TX_CMD_SEC_*
194 * @initial_rate_index: index into the rate table for initial TX attempt.
195 * Applied if TX_CMD_FLG_STA_RATE_MSK is set, normally 0 for data frames.
196 * @reserved2: reserved
197 * @key: security key
198 * @reserved3: reserved
199 * @life_time: frame life time (usecs??)
200 * @dram_lsb_ptr: Physical address of scratch area in the command (try_cnt +
201 * btkill_cnd + reserved), first 32 bits. "0" disables usage.
202 * @dram_msb_ptr: upper bits of the scratch physical address
203 * @rts_retry_limit: max attempts for RTS
204 * @data_retry_limit: max attempts to send the data packet
205 * @tid_tspec: TID/tspec
206 * @pm_frame_timeout: PM TX frame timeout
207 * @reserved4: reserved
208 *
209 * The byte count (both len and next_frame_len) includes MAC header
210 * (24/26/30/32 bytes)
211 * + 2 bytes pad if 26/30 header size
212 * + 8 byte IV for CCM or TKIP (not used for WEP)
213 * + Data payload
214 * + 8-byte MIC (not used for CCM/WEP)
215 * It does not include post-MAC padding, i.e.,
216 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.
217 * Range of len: 14-2342 bytes.
218 */
219 struct iwl_tx_cmd_v6_params {
220 __le16 len;
221 __le16 offload_assist;
222 __le32 tx_flags;
223 struct {
224 u8 try_cnt;
225 u8 btkill_cnt;
226 __le16 reserved;
227 } scratch; /* DRAM_SCRATCH_API_U_VER_1 */
228 __le32 rate_n_flags;
229 u8 sta_id;
230 u8 sec_ctl;
231 u8 initial_rate_index;
232 u8 reserved2;
233 u8 key[16];
234 __le32 reserved3;
235 __le32 life_time;
236 __le32 dram_lsb_ptr;
237 u8 dram_msb_ptr;
238 u8 rts_retry_limit;
239 u8 data_retry_limit;
240 u8 tid_tspec;
241 __le16 pm_frame_timeout;
242 __le16 reserved4;
243 } __packed; /* TX_CMD_API_S_VER_6 */
244
245 /**
246 * struct iwl_tx_cmd_v6 - TX command struct to FW
247 * ( TX_CMD = 0x1c )
248 * @params: parameters of the TX, see &struct iwl_tx_cmd_v6_tx_params
249 * @hdr: 802.11 header
250 *
251 * After &params, the MAC header is placed, plus any padding,
252 * and then the actual payload.
253 */
254 struct iwl_tx_cmd_v6 {
255 struct iwl_tx_cmd_v6_params params;
256 struct ieee80211_hdr hdr[];
257 } __packed; /* TX_CMD_API_S_VER_6 */
258
259 struct iwl_dram_sec_info {
260 __le32 pn_low;
261 __le16 pn_high;
262 __le16 aux_info;
263 } __packed; /* DRAM_SEC_INFO_API_S_VER_1 */
264
265 /**
266 * struct iwl_tx_cmd_v9 - TX command struct to FW for 22000 devices
267 * ( TX_CMD = 0x1c )
268 * @len: in bytes of the payload, see below for details
269 * @offload_assist: TX offload configuration
270 * @flags: combination of &enum iwl_tx_cmd_flags
271 * @dram_info: FW internal DRAM storage
272 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
273 * cleared. Combination of RATE_MCS_*
274 * @hdr: 802.11 header
275 */
276 struct iwl_tx_cmd_v9 {
277 __le16 len;
278 __le16 offload_assist;
279 __le32 flags;
280 struct iwl_dram_sec_info dram_info;
281 __le32 rate_n_flags;
282 struct ieee80211_hdr hdr[];
283 } __packed; /* TX_CMD_API_S_VER_7,
284 TX_CMD_API_S_VER_9 */
285
286 /**
287 * struct iwl_tx_cmd - TX command struct to FW for AX210+ devices
288 * ( TX_CMD = 0x1c )
289 * @len: in bytes of the payload, see below for details
290 * @flags: combination of &enum iwl_tx_cmd_flags
291 * @offload_assist: TX offload configuration
292 * @dram_info: FW internal DRAM storage
293 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
294 * cleared. Combination of RATE_MCS_*; format depends on version
295 * @reserved: reserved
296 * @hdr: 802.11 header
297 */
298 struct iwl_tx_cmd {
299 __le16 len;
300 __le16 flags;
301 __le32 offload_assist;
302 struct iwl_dram_sec_info dram_info;
303 __le32 rate_n_flags;
304 u8 reserved[8];
305 struct ieee80211_hdr hdr[];
306 } __packed; /* TX_CMD_API_S_VER_10,
307 * TX_CMD_API_S_VER_11
308 */
309
310 /*
311 * TX response related data
312 */
313
314 /*
315 * enum iwl_tx_status - status that is returned by the fw after attempts to Tx
316 * @TX_STATUS_SUCCESS:
317 * @TX_STATUS_DIRECT_DONE:
318 * @TX_STATUS_POSTPONE_DELAY:
319 * @TX_STATUS_POSTPONE_FEW_BYTES:
320 * @TX_STATUS_POSTPONE_BT_PRIO:
321 * @TX_STATUS_POSTPONE_QUIET_PERIOD:
322 * @TX_STATUS_POSTPONE_CALC_TTAK:
323 * @TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY:
324 * @TX_STATUS_FAIL_SHORT_LIMIT:
325 * @TX_STATUS_FAIL_LONG_LIMIT:
326 * @TX_STATUS_FAIL_UNDERRUN:
327 * @TX_STATUS_FAIL_DRAIN_FLOW:
328 * @TX_STATUS_FAIL_RFKILL_FLUSH:
329 * @TX_STATUS_FAIL_LIFE_EXPIRE:
330 * @TX_STATUS_FAIL_DEST_PS:
331 * @TX_STATUS_FAIL_HOST_ABORTED:
332 * @TX_STATUS_FAIL_BT_RETRY:
333 * @TX_STATUS_FAIL_STA_INVALID:
334 * @TX_TATUS_FAIL_FRAG_DROPPED:
335 * @TX_STATUS_FAIL_TID_DISABLE:
336 * @TX_STATUS_FAIL_FIFO_FLUSHED:
337 * @TX_STATUS_FAIL_SMALL_CF_POLL:
338 * @TX_STATUS_FAIL_FW_DROP:
339 * @TX_STATUS_FAIL_STA_COLOR_MISMATCH: mismatch between color of Tx cmd and
340 * STA table
341 * @TX_FRAME_STATUS_INTERNAL_ABORT:
342 * @TX_MODE_MSK:
343 * @TX_MODE_NO_BURST:
344 * @TX_MODE_IN_BURST_SEQ:
345 * @TX_MODE_FIRST_IN_BURST:
346 * @TX_QUEUE_NUM_MSK:
347 *
348 * Valid only if frame_count =1
349 * TODO: complete documentation
350 */
351 enum iwl_tx_status {
352 TX_STATUS_MSK = 0x000000ff,
353 TX_STATUS_SUCCESS = 0x01,
354 TX_STATUS_DIRECT_DONE = 0x02,
355 /* postpone TX */
356 TX_STATUS_POSTPONE_DELAY = 0x40,
357 TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
358 TX_STATUS_POSTPONE_BT_PRIO = 0x42,
359 TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
360 TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
361 /* abort TX */
362 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
363 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
364 TX_STATUS_FAIL_LONG_LIMIT = 0x83,
365 TX_STATUS_FAIL_UNDERRUN = 0x84,
366 TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
367 TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
368 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
369 TX_STATUS_FAIL_DEST_PS = 0x88,
370 TX_STATUS_FAIL_HOST_ABORTED = 0x89,
371 TX_STATUS_FAIL_BT_RETRY = 0x8a,
372 TX_STATUS_FAIL_STA_INVALID = 0x8b,
373 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
374 TX_STATUS_FAIL_TID_DISABLE = 0x8d,
375 TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
376 TX_STATUS_FAIL_SMALL_CF_POLL = 0x8f,
377 TX_STATUS_FAIL_FW_DROP = 0x90,
378 TX_STATUS_FAIL_STA_COLOR_MISMATCH = 0x91,
379 TX_STATUS_INTERNAL_ABORT = 0x92,
380 TX_MODE_MSK = 0x00000f00,
381 TX_MODE_NO_BURST = 0x00000000,
382 TX_MODE_IN_BURST_SEQ = 0x00000100,
383 TX_MODE_FIRST_IN_BURST = 0x00000200,
384 TX_QUEUE_NUM_MSK = 0x0001f000,
385 TX_NARROW_BW_MSK = 0x00060000,
386 TX_NARROW_BW_1DIV2 = 0x00020000,
387 TX_NARROW_BW_1DIV4 = 0x00040000,
388 TX_NARROW_BW_1DIV8 = 0x00060000,
389 };
390
391 /*
392 * enum iwl_tx_agg_status - TX aggregation status
393 * @AGG_TX_STATE_STATUS_MSK:
394 * @AGG_TX_STATE_TRANSMITTED:
395 * @AGG_TX_STATE_UNDERRUN:
396 * @AGG_TX_STATE_BT_PRIO:
397 * @AGG_TX_STATE_FEW_BYTES:
398 * @AGG_TX_STATE_ABORT:
399 * @AGG_TX_STATE_TX_ON_AIR_DROP: TX_ON_AIR signal drop without underrun or
400 * BT detection
401 * @AGG_TX_STATE_LAST_SENT_TRY_CNT:
402 * @AGG_TX_STATE_LAST_SENT_BT_KILL:
403 * @AGG_TX_STATE_SCD_QUERY:
404 * @AGG_TX_STATE_TEST_BAD_CRC32:
405 * @AGG_TX_STATE_RESPONSE:
406 * @AGG_TX_STATE_DUMP_TX:
407 * @AGG_TX_STATE_DELAY_TX:
408 * @AGG_TX_STATE_TRY_CNT_MSK: Retry count for 1st frame in aggregation (retries
409 * occur if tx failed for this frame when it was a member of a previous
410 * aggregation block). If rate scaling is used, retry count indicates the
411 * rate table entry used for all frames in the new agg.
412 * @AGG_TX_STATE_SEQ_NUM_MSK: Command ID and sequence number of Tx command for
413 * this frame
414 *
415 * TODO: complete documentation
416 */
417 enum iwl_tx_agg_status {
418 AGG_TX_STATE_STATUS_MSK = 0x00fff,
419 AGG_TX_STATE_TRANSMITTED = 0x000,
420 AGG_TX_STATE_UNDERRUN = 0x001,
421 AGG_TX_STATE_BT_PRIO = 0x002,
422 AGG_TX_STATE_FEW_BYTES = 0x004,
423 AGG_TX_STATE_ABORT = 0x008,
424 AGG_TX_STATE_TX_ON_AIR_DROP = 0x010,
425 AGG_TX_STATE_LAST_SENT_TRY_CNT = 0x020,
426 AGG_TX_STATE_LAST_SENT_BT_KILL = 0x040,
427 AGG_TX_STATE_SCD_QUERY = 0x080,
428 AGG_TX_STATE_TEST_BAD_CRC32 = 0x0100,
429 AGG_TX_STATE_RESPONSE = 0x1ff,
430 AGG_TX_STATE_DUMP_TX = 0x200,
431 AGG_TX_STATE_DELAY_TX = 0x400,
432 AGG_TX_STATE_TRY_CNT_POS = 12,
433 AGG_TX_STATE_TRY_CNT_MSK = 0xf << AGG_TX_STATE_TRY_CNT_POS,
434 };
435
436 /*
437 * The mask below describes a status where we are absolutely sure that the MPDU
438 * wasn't sent. For BA/Underrun we cannot be that sure. All we know that we've
439 * written the bytes to the TXE, but we know nothing about what the DSP did.
440 */
441 #define AGG_TX_STAT_FRAME_NOT_SENT (AGG_TX_STATE_FEW_BYTES | \
442 AGG_TX_STATE_ABORT | \
443 AGG_TX_STATE_SCD_QUERY)
444
445 /*
446 * REPLY_TX = 0x1c (response)
447 *
448 * This response may be in one of two slightly different formats, indicated
449 * by the frame_count field:
450 *
451 * 1) No aggregation (frame_count == 1). This reports Tx results for a single
452 * frame. Multiple attempts, at various bit rates, may have been made for
453 * this frame.
454 *
455 * 2) Aggregation (frame_count > 1). This reports Tx results for two or more
456 * frames that used block-acknowledge. All frames were transmitted at
457 * same rate. Rate scaling may have been used if first frame in this new
458 * agg block failed in previous agg block(s).
459 *
460 * Note that, for aggregation, ACK (block-ack) status is not delivered
461 * here; block-ack has not been received by the time the device records
462 * this status.
463 * This status relates to reasons the tx might have been blocked or aborted
464 * within the device, rather than whether it was received successfully by
465 * the destination station.
466 */
467
468 /**
469 * struct agg_tx_status - per packet TX aggregation status
470 * @status: See &enum iwl_tx_agg_status
471 * @sequence: Sequence # for this frame's Tx cmd (not SSN!)
472 */
473 struct agg_tx_status {
474 __le16 status;
475 __le16 sequence;
476 } __packed;
477
478 /*
479 * definitions for initial rate index field
480 * bits [3:0] initial rate index
481 * bits [6:4] rate table color, used for the initial rate
482 * bit-7 invalid rate indication
483 */
484 #define TX_RES_INIT_RATE_INDEX_MSK 0x0f
485 #define TX_RES_RATE_TABLE_COLOR_POS 4
486 #define TX_RES_RATE_TABLE_COLOR_MSK 0x70
487 #define TX_RES_INV_RATE_INDEX_MSK 0x80
488 #define TX_RES_RATE_TABLE_COL_GET(_f) (((_f) & TX_RES_RATE_TABLE_COLOR_MSK) >>\
489 TX_RES_RATE_TABLE_COLOR_POS)
490
491 #define IWL_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f)
492 #define IWL_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4)
493
494 /**
495 * struct iwl_tx_resp_v3 - notifies that fw is TXing a packet
496 * ( REPLY_TX = 0x1c )
497 * @frame_count: 1 no aggregation, >1 aggregation
498 * @bt_kill_count: num of times blocked by bluetooth (unused for agg)
499 * @failure_rts: num of failures due to unsuccessful RTS
500 * @failure_frame: num failures due to no ACK (unused for agg)
501 * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the
502 * Tx of all the batch. RATE_MCS_*
503 * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK.
504 * for agg: RTS + CTS + aggregation tx time + block-ack time.
505 * in usec.
506 * @pa_status: tx power info
507 * @pa_integ_res_a: tx power info
508 * @pa_integ_res_b: tx power info
509 * @pa_integ_res_c: tx power info
510 * @measurement_req_id: tx power info
511 * @reduced_tpc: transmit power reduction used
512 * @reserved: reserved
513 * @tfd_info: TFD information set by the FH
514 * @seq_ctl: sequence control from the Tx cmd
515 * @byte_cnt: byte count from the Tx cmd
516 * @tlc_info: TLC rate info
517 * @ra_tid: bits [3:0] = ra, bits [7:4] = tid
518 * @frame_ctrl: frame control
519 * @status: for non-agg: frame status TX_STATUS_*
520 * for agg: status of 1st frame, AGG_TX_STATE_*; other frame status fields
521 * follow this one, up to frame_count. Length in @frame_count.
522 *
523 * After the array of statuses comes the SSN of the SCD. Look at
524 * %iwl_mvm_get_scd_ssn for more details.
525 */
526 struct iwl_tx_resp_v3 {
527 u8 frame_count;
528 u8 bt_kill_count;
529 u8 failure_rts;
530 u8 failure_frame;
531 __le32 initial_rate;
532 __le16 wireless_media_time;
533
534 u8 pa_status;
535 u8 pa_integ_res_a[3];
536 u8 pa_integ_res_b[3];
537 u8 pa_integ_res_c[3];
538 __le16 measurement_req_id;
539 u8 reduced_tpc;
540 u8 reserved;
541
542 __le32 tfd_info;
543 __le16 seq_ctl;
544 __le16 byte_cnt;
545 u8 tlc_info;
546 u8 ra_tid;
547 __le16 frame_ctrl;
548 struct agg_tx_status status[];
549 } __packed; /* TX_RSP_API_S_VER_3 */
550
551 /**
552 * struct iwl_tx_resp - notifies that fw is TXing a packet
553 * ( REPLY_TX = 0x1c )
554 * @frame_count: 1 no aggregation, >1 aggregation
555 * @bt_kill_count: num of times blocked by bluetooth (unused for agg)
556 * @failure_rts: num of failures due to unsuccessful RTS
557 * @failure_frame: num failures due to no ACK (unused for agg)
558 * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the
559 * Tx of all the batch. RATE_MCS_*; format depends on command version
560 * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK.
561 * for agg: RTS + CTS + aggregation tx time + block-ack time.
562 * in usec.
563 * @pa_status: tx power info
564 * @pa_integ_res_a: tx power info
565 * @pa_integ_res_b: tx power info
566 * @pa_integ_res_c: tx power info
567 * @measurement_req_id: tx power info
568 * @reduced_tpc: transmit power reduction used
569 * @reserved: reserved
570 * @tfd_info: TFD information set by the FH
571 * @seq_ctl: sequence control from the Tx cmd
572 * @byte_cnt: byte count from the Tx cmd
573 * @tlc_info: TLC rate info
574 * @ra_tid: bits [3:0] = ra, bits [7:4] = tid
575 * @frame_ctrl: frame control
576 * @tx_queue: TX queue for this response
577 * @reserved2: reserved for padding/alignment
578 * @status: for non-agg: frame status TX_STATUS_*
579 * For version 6 TX response isn't received for aggregation at all.
580 *
581 * After the array of statuses comes the SSN of the SCD. Look at
582 * %iwl_mvm_get_scd_ssn for more details.
583 */
584 struct iwl_tx_resp {
585 u8 frame_count;
586 u8 bt_kill_count;
587 u8 failure_rts;
588 u8 failure_frame;
589 __le32 initial_rate;
590 __le16 wireless_media_time;
591
592 u8 pa_status;
593 u8 pa_integ_res_a[3];
594 u8 pa_integ_res_b[3];
595 u8 pa_integ_res_c[3];
596 __le16 measurement_req_id;
597 u8 reduced_tpc;
598 u8 reserved;
599
600 __le32 tfd_info;
601 __le16 seq_ctl;
602 __le16 byte_cnt;
603 u8 tlc_info;
604 u8 ra_tid;
605 __le16 frame_ctrl;
606 __le16 tx_queue;
607 __le16 reserved2;
608 struct agg_tx_status status;
609 } __packed; /* TX_RSP_API_S_VER_6,
610 * TX_RSP_API_S_VER_7,
611 * TX_RSP_API_S_VER_8,
612 * TX_RSP_API_S_VER_9
613 */
614
615 /**
616 * struct iwl_mvm_ba_notif - notifies about reception of BA
617 * ( BA_NOTIF = 0xc5 )
618 * @sta_addr: MAC address
619 * @reserved: reserved
620 * @sta_id: Index of recipient (BA-sending) station in fw's station table
621 * @tid: tid of the session
622 * @seq_ctl: sequence control field
623 * @bitmap: the bitmap of the BA notification as seen in the air
624 * @scd_flow: the tx queue this BA relates to
625 * @scd_ssn: the index of the last contiguously sent packet
626 * @txed: number of Txed frames in this batch
627 * @txed_2_done: number of Acked frames in this batch
628 * @reduced_txp: power reduced according to TPC. This is the actual value and
629 * not a copy from the LQ command. Thus, if not the first rate was used
630 * for Tx-ing then this value will be set to 0 by FW.
631 * @reserved1: reserved
632 */
633 struct iwl_mvm_ba_notif {
634 u8 sta_addr[ETH_ALEN];
635 __le16 reserved;
636
637 u8 sta_id;
638 u8 tid;
639 __le16 seq_ctl;
640 __le64 bitmap;
641 __le16 scd_flow;
642 __le16 scd_ssn;
643 u8 txed;
644 u8 txed_2_done;
645 u8 reduced_txp;
646 u8 reserved1;
647 } __packed;
648
649 /**
650 * struct iwl_compressed_ba_tfd - progress of a TFD queue
651 * @q_num: TFD queue number
652 * @tfd_index: Index of first un-acked frame in the TFD queue
653 * @scd_queue: For debug only - the physical queue the TFD queue is bound to
654 * @tid: TID of the queue (0-7)
655 * @reserved: reserved for alignment
656 */
657 struct iwl_compressed_ba_tfd {
658 __le16 q_num;
659 __le16 tfd_index;
660 u8 scd_queue;
661 u8 tid;
662 u8 reserved[2];
663 } __packed; /* COMPRESSED_BA_TFD_API_S_VER_1 */
664
665 /**
666 * struct iwl_compressed_ba_ratid - progress of a RA TID queue
667 * @q_num: RA TID queue number
668 * @tid: TID of the queue
669 * @ssn: BA window current SSN
670 */
671 struct iwl_compressed_ba_ratid {
672 u8 q_num;
673 u8 tid;
674 __le16 ssn;
675 } __packed; /* COMPRESSED_BA_RATID_API_S_VER_1 */
676
677 /*
678 * enum iwl_mvm_ba_resp_flags - TX aggregation status
679 * @IWL_MVM_BA_RESP_TX_AGG: generated due to BA
680 * @IWL_MVM_BA_RESP_TX_BAR: generated due to BA after BAR
681 * @IWL_MVM_BA_RESP_TX_AGG_FAIL: aggregation didn't receive BA
682 * @IWL_MVM_BA_RESP_TX_UNDERRUN: aggregation got underrun
683 * @IWL_MVM_BA_RESP_TX_BT_KILL: aggregation got BT-kill
684 * @IWL_MVM_BA_RESP_TX_DSP_TIMEOUT: aggregation didn't finish within the
685 * expected time
686 */
687 enum iwl_mvm_ba_resp_flags {
688 IWL_MVM_BA_RESP_TX_AGG,
689 IWL_MVM_BA_RESP_TX_BAR,
690 IWL_MVM_BA_RESP_TX_AGG_FAIL,
691 IWL_MVM_BA_RESP_TX_UNDERRUN,
692 IWL_MVM_BA_RESP_TX_BT_KILL,
693 IWL_MVM_BA_RESP_TX_DSP_TIMEOUT
694 };
695
696 /**
697 * struct iwl_compressed_ba_notif - notifies about reception of BA
698 * ( BA_NOTIF = 0xc5 )
699 * @flags: status flag, see the &iwl_mvm_ba_resp_flags
700 * @sta_id: Index of recipient (BA-sending) station in fw's station table
701 * @reduced_txp: power reduced according to TPC. This is the actual value and
702 * not a copy from the LQ command. Thus, if not the first rate was used
703 * for Tx-ing then this value will be set to 0 by FW.
704 * @tlc_rate_info: TLC rate info, initial rate index, TLC table color
705 * @retry_cnt: retry count
706 * @query_byte_cnt: SCD query byte count
707 * @query_frame_cnt: SCD query frame count
708 * @txed: number of frames sent in the aggregation (all-TIDs)
709 * @done: number of frames that were Acked by the BA (all-TIDs)
710 * @rts_retry_cnt: RTS retry count
711 * @reserved: reserved (for alignment)
712 * @wireless_time: Wireless-media time
713 * @tx_rate: the rate the aggregation was sent at. Format depends on command
714 * version.
715 * @tfd_cnt: number of TFD-Q elements
716 * @ra_tid_cnt: number of RATID-Q elements
717 * @tfd: array of TFD queue status updates. See &iwl_compressed_ba_tfd
718 * for details. Length in @tfd_cnt.
719 * @ra_tid: array of RA-TID queue status updates. For debug purposes only. See
720 * &iwl_compressed_ba_ratid for more details. Length in @ra_tid_cnt.
721 */
722 struct iwl_compressed_ba_notif {
723 __le32 flags;
724 u8 sta_id;
725 u8 reduced_txp;
726 u8 tlc_rate_info;
727 u8 retry_cnt;
728 __le32 query_byte_cnt;
729 __le16 query_frame_cnt;
730 __le16 txed;
731 __le16 done;
732 u8 rts_retry_cnt;
733 u8 reserved;
734 __le32 wireless_time;
735 __le32 tx_rate;
736 __le16 tfd_cnt;
737 __le16 ra_tid_cnt;
738 union {
739 DECLARE_FLEX_ARRAY(struct iwl_compressed_ba_ratid, ra_tid);
740 DECLARE_FLEX_ARRAY(struct iwl_compressed_ba_tfd, tfd);
741 };
742 } __packed; /* COMPRESSED_BA_RES_API_S_VER_4,
743 COMPRESSED_BA_RES_API_S_VER_6,
744 COMPRESSED_BA_RES_API_S_VER_7 */
745
746 /**
747 * struct iwl_mac_beacon_cmd_v6 - beacon template command
748 * @tx: the tx commands associated with the beacon frame
749 * @template_id: currently equal to the mac context id of the coresponding
750 * mac.
751 * @tim_idx: the offset of the tim IE in the beacon
752 * @tim_size: the length of the tim IE
753 * @frame: the template of the beacon frame
754 */
755 struct iwl_mac_beacon_cmd_v6 {
756 struct iwl_tx_cmd_v6_params tx;
757 __le32 template_id;
758 __le32 tim_idx;
759 __le32 tim_size;
760 struct ieee80211_hdr frame[];
761 } __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_6 */
762
763 /**
764 * struct iwl_mac_beacon_cmd_v7 - beacon template command with offloaded CSA
765 * @tx: the tx commands associated with the beacon frame
766 * @template_id: currently equal to the mac context id of the coresponding
767 * mac.
768 * @tim_idx: the offset of the tim IE in the beacon
769 * @tim_size: the length of the tim IE
770 * @ecsa_offset: offset to the ECSA IE if present
771 * @csa_offset: offset to the CSA IE if present
772 * @frame: the template of the beacon frame
773 */
774 struct iwl_mac_beacon_cmd_v7 {
775 struct iwl_tx_cmd_v6_params tx;
776 __le32 template_id;
777 __le32 tim_idx;
778 __le32 tim_size;
779 __le32 ecsa_offset;
780 __le32 csa_offset;
781 struct ieee80211_hdr frame[];
782 } __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_7 */
783
784 /* Bit flags for BEACON_TEMPLATE_CMD_API until version 10 */
785 enum iwl_mac_beacon_flags_v1 {
786 IWL_MAC_BEACON_CCK_V1 = BIT(8),
787 IWL_MAC_BEACON_ANT_A_V1 = BIT(9),
788 IWL_MAC_BEACON_ANT_B_V1 = BIT(10),
789 IWL_MAC_BEACON_FILS_V1 = BIT(12),
790 };
791
792 /* Bit flags for BEACON_TEMPLATE_CMD_API version 11 and above */
793 enum iwl_mac_beacon_flags {
794 IWL_MAC_BEACON_CCK = BIT(5),
795 IWL_MAC_BEACON_ANT_A = BIT(6),
796 IWL_MAC_BEACON_ANT_B = BIT(7),
797 IWL_MAC_BEACON_FILS = BIT(8),
798 };
799
800 /**
801 * struct iwl_mac_beacon_cmd - beacon template command with offloaded CSA
802 * @byte_cnt: byte count of the beacon frame.
803 * @flags: least significant byte for rate code. The most significant byte
804 * is &enum iwl_mac_beacon_flags.
805 * @short_ssid: Short SSID
806 * @reserved: reserved
807 * @link_id: the firmware id of the link that will use this beacon
808 * @tim_idx: the offset of the tim IE in the beacon
809 * @tim_size: the length of the tim IE (version < 14)
810 * @btwt_offset: offset to the broadcast TWT IE if present (version >= 14)
811 * @ecsa_offset: offset to the ECSA IE if present
812 * @csa_offset: offset to the CSA IE if present
813 * @frame: the template of the beacon frame
814 */
815 struct iwl_mac_beacon_cmd {
816 __le16 byte_cnt;
817 __le16 flags;
818 __le32 short_ssid;
819 __le32 reserved;
820 __le32 link_id;
821 __le32 tim_idx;
822 union {
823 __le32 tim_size;
824 __le32 btwt_offset;
825 };
826 __le32 ecsa_offset;
827 __le32 csa_offset;
828 struct ieee80211_hdr frame[];
829 } __packed; /* BEACON_TEMPLATE_CMD_API_S_VER_10,
830 * BEACON_TEMPLATE_CMD_API_S_VER_11,
831 * BEACON_TEMPLATE_CMD_API_S_VER_12,
832 * BEACON_TEMPLATE_CMD_API_S_VER_13,
833 * BEACON_TEMPLATE_CMD_API_S_VER_14
834 */
835
836 struct iwl_beacon_notif {
837 struct iwl_tx_resp beacon_notify_hdr;
838 __le64 tsf;
839 __le32 ibss_mgr_status;
840 } __packed;
841
842 /**
843 * struct iwl_extended_beacon_notif_v5 - notifies about beacon transmission
844 * @beacon_notify_hdr: tx response command associated with the beacon
845 * @tsf: last beacon tsf
846 * @ibss_mgr_status: whether IBSS is manager
847 * @gp2: last beacon time in gp2
848 */
849 struct iwl_extended_beacon_notif_v5 {
850 struct iwl_tx_resp beacon_notify_hdr;
851 __le64 tsf;
852 __le32 ibss_mgr_status;
853 __le32 gp2;
854 } __packed; /* BEACON_NTFY_API_S_VER_5 */
855
856 /**
857 * struct iwl_extended_beacon_notif - notifies about beacon transmission
858 * @status: the status of the Tx response of the beacon
859 * @tsf: last beacon tsf
860 * @ibss_mgr_status: whether IBSS is manager
861 * @gp2: last beacon time in gp2
862 */
863 struct iwl_extended_beacon_notif {
864 __le32 status;
865 __le64 tsf;
866 __le32 ibss_mgr_status;
867 __le32 gp2;
868 } __packed; /* BEACON_NTFY_API_S_VER_6_ */
869
870 /**
871 * enum iwl_dump_control - dump (flush) control flags
872 * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the FIFO is empty
873 * and the TFD queues are empty.
874 */
875 enum iwl_dump_control {
876 DUMP_TX_FIFO_FLUSH = BIT(1),
877 };
878
879 /**
880 * struct iwl_tx_path_flush_cmd_v1 -- queue/FIFO flush command
881 * @queues_ctl: bitmap of queues to flush
882 * @flush_ctl: control flags
883 * @reserved: reserved
884 */
885 struct iwl_tx_path_flush_cmd_v1 {
886 __le32 queues_ctl;
887 __le16 flush_ctl;
888 __le16 reserved;
889 } __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_1 */
890
891 /**
892 * struct iwl_tx_path_flush_cmd -- queue/FIFO flush command
893 * @sta_id: station ID to flush
894 * @tid_mask: TID mask to flush
895 * @reserved: reserved
896 */
897 struct iwl_tx_path_flush_cmd {
898 __le32 sta_id;
899 __le16 tid_mask;
900 __le16 reserved;
901 } __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_2 */
902
903 #define IWL_TX_FLUSH_QUEUE_RSP 16
904
905 /**
906 * struct iwl_flush_queue_info - virtual flush queue info
907 * @tid: the tid to flush
908 * @queue_num: virtual queue id
909 * @read_before_flush: read pointer before flush
910 * @read_after_flush: read pointer after flush
911 */
912 struct iwl_flush_queue_info {
913 __le16 tid;
914 __le16 queue_num;
915 __le16 read_before_flush;
916 __le16 read_after_flush;
917 } __packed; /* TFDQ_FLUSH_INFO_API_S_VER_1 */
918
919 /**
920 * struct iwl_tx_path_flush_cmd_rsp -- queue/FIFO flush command response
921 * @sta_id: the station for which the queue was flushed
922 * @num_flushed_queues: number of queues in queues array
923 * @queues: all flushed queues
924 */
925 struct iwl_tx_path_flush_cmd_rsp {
926 __le16 sta_id;
927 __le16 num_flushed_queues;
928 struct iwl_flush_queue_info queues[IWL_TX_FLUSH_QUEUE_RSP];
929 } __packed; /* TX_PATH_FLUSH_CMD_RSP_API_S_VER_1 */
930
931 /* Available options for the SCD_QUEUE_CFG HCMD */
932 enum iwl_scd_cfg_actions {
933 SCD_CFG_DISABLE_QUEUE = 0x0,
934 SCD_CFG_ENABLE_QUEUE = 0x1,
935 SCD_CFG_UPDATE_QUEUE_TID = 0x2,
936 };
937
938 /**
939 * struct iwl_scd_txq_cfg_cmd - New txq hw scheduler config command
940 * @token: unused
941 * @sta_id: station id
942 * @tid: TID
943 * @scd_queue: scheduler queue to confiug
944 * @action: 1 queue enable, 0 queue disable, 2 change txq's tid owner
945 * Value is one of &enum iwl_scd_cfg_actions options
946 * @aggregate: 1 aggregated queue, 0 otherwise
947 * @tx_fifo: &enum iwl_mvm_tx_fifo
948 * @window: BA window size
949 * @ssn: SSN for the BA agreement
950 * @reserved: reserved
951 */
952 struct iwl_scd_txq_cfg_cmd {
953 u8 token;
954 u8 sta_id;
955 u8 tid;
956 u8 scd_queue;
957 u8 action;
958 u8 aggregate;
959 u8 tx_fifo;
960 u8 window;
961 __le16 ssn;
962 __le16 reserved;
963 } __packed; /* SCD_QUEUE_CFG_CMD_API_S_VER_1 */
964
965 /**
966 * struct iwl_scd_txq_cfg_rsp - scheduler TXQ configuration response
967 * @token: taken from the command
968 * @sta_id: station id from the command
969 * @tid: tid from the command
970 * @scd_queue: scd_queue from the command
971 */
972 struct iwl_scd_txq_cfg_rsp {
973 u8 token;
974 u8 sta_id;
975 u8 tid;
976 u8 scd_queue;
977 } __packed; /* SCD_QUEUE_CFG_RSP_API_S_VER_1 */
978
979 #endif /* __iwl_fw_api_tx_h__ */