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