Linux Audio

Check our new training course

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