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