Merge tag 'hsi-for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi
[deliverable/linux.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 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 * 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
70 * @TX_CMD_FLG_WRITE_TX_POWER: update current tx power value in the mgmt frame
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
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.
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)
79 * @TX_CMD_FLG_BT_PRIO_POS: the position of the BT priority (bit 11 is ignored
80 * on old firmwares).
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
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
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
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_CCMP_AGG = BIT(22),
120 TX_CMD_FLG_TKIP_MIC_DONE = BIT(23),
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
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 */
134 enum iwl_tx_pm_timeouts {
135 PM_FRAME_NONE = 0,
136 PM_FRAME_MGMT = 2,
137 PM_FRAME_ASSOC = 3,
138 };
139
140 /*
141 * TX command security control
142 */
143 #define TX_CMD_SEC_WEP 0x01
144 #define TX_CMD_SEC_CCM 0x02
145 #define TX_CMD_SEC_TKIP 0x03
146 #define TX_CMD_SEC_EXT 0x04
147 #define TX_CMD_SEC_MSK 0x07
148 #define TX_CMD_SEC_WEP_KEY_IDX_POS 6
149 #define TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0
150 #define TX_CMD_SEC_KEY128 0x08
151
152 /* TODO: how does these values are OK with only 16 bit variable??? */
153 /*
154 * TX command next frame info
155 *
156 * bits 0:2 - security control (TX_CMD_SEC_*)
157 * bit 3 - immediate ACK required
158 * bit 4 - rate is taken from STA table
159 * bit 5 - frame belongs to BA stream
160 * bit 6 - immediate BA response expected
161 * bit 7 - unused
162 * bits 8:15 - Station ID
163 * bits 16:31 - rate
164 */
165 #define TX_CMD_NEXT_FRAME_ACK_MSK (0x8)
166 #define TX_CMD_NEXT_FRAME_STA_RATE_MSK (0x10)
167 #define TX_CMD_NEXT_FRAME_BA_MSK (0x20)
168 #define TX_CMD_NEXT_FRAME_IMM_BA_RSP_MSK (0x40)
169 #define TX_CMD_NEXT_FRAME_FLAGS_MSK (0xf8)
170 #define TX_CMD_NEXT_FRAME_STA_ID_MSK (0xff00)
171 #define TX_CMD_NEXT_FRAME_STA_ID_POS (8)
172 #define TX_CMD_NEXT_FRAME_RATE_MSK (0xffff0000)
173 #define TX_CMD_NEXT_FRAME_RATE_POS (16)
174
175 /*
176 * TX command Frame life time in us - to be written in pm_frame_timeout
177 */
178 #define TX_CMD_LIFE_TIME_INFINITE 0xFFFFFFFF
179 #define TX_CMD_LIFE_TIME_DEFAULT 2000000 /* 2000 ms*/
180 #define TX_CMD_LIFE_TIME_PROBE_RESP 40000 /* 40 ms */
181 #define TX_CMD_LIFE_TIME_EXPIRED_FRAME 0
182
183 /*
184 * TID for non QoS frames - to be written in tid_tspec
185 */
186 #define IWL_TID_NON_QOS IWL_MAX_TID_COUNT
187
188 /*
189 * Limits on the retransmissions - to be written in {data,rts}_retry_limit
190 */
191 #define IWL_DEFAULT_TX_RETRY 15
192 #define IWL_MGMT_DFAULT_RETRY_LIMIT 3
193 #define IWL_RTS_DFAULT_RETRY_LIMIT 60
194 #define IWL_BAR_DFAULT_RETRY_LIMIT 60
195 #define IWL_LOW_RETRY_LIMIT 7
196
197 /**
198 * enum iwl_tx_offload_assist_flags_pos - set %iwl_tx_cmd offload_assist values
199 * @TX_CMD_OFFLD_IP_HDR_OFFSET: offset to start of IP header (in words)
200 * from mac header end. For normal case it is 4 words for SNAP.
201 * note: tx_cmd, mac header and pad are not counted in the offset.
202 * This is used to help the offload in case there is tunneling such as
203 * IPv6 in IPv4, in such case the ip header offset should point to the
204 * inner ip header and IPv4 checksum of the external header should be
205 * calculated by driver.
206 * @TX_CMD_OFFLD_L4_EN: enable TCP/UDP checksum
207 * @TX_CMD_OFFLD_L3_EN: enable IP header checksum
208 * @TX_CMD_OFFLD_MH_SIZE: size of the mac header in words. Includes the IV
209 * field. Doesn't include the pad.
210 * @TX_CMD_OFFLD_PAD: mark 2-byte pad was inserted after the mac header for
211 * alignment
212 * @TX_CMD_OFFLD_AMSDU: mark TX command is A-MSDU
213 */
214 enum iwl_tx_offload_assist_flags_pos {
215 TX_CMD_OFFLD_IP_HDR = 0,
216 TX_CMD_OFFLD_L4_EN = 6,
217 TX_CMD_OFFLD_L3_EN = 7,
218 TX_CMD_OFFLD_MH_SIZE = 8,
219 TX_CMD_OFFLD_PAD = 13,
220 TX_CMD_OFFLD_AMSDU = 14,
221 };
222
223 #define IWL_TX_CMD_OFFLD_MH_MASK 0x1f
224 #define IWL_TX_CMD_OFFLD_IP_HDR_MASK 0x3f
225
226 /* TODO: complete documentation for try_cnt and btkill_cnt */
227 /**
228 * struct iwl_tx_cmd - TX command struct to FW
229 * ( TX_CMD = 0x1c )
230 * @len: in bytes of the payload, see below for details
231 * @offload_assist: TX offload configuration
232 * @tx_flags: combination of TX_CMD_FLG_*
233 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
234 * cleared. Combination of RATE_MCS_*
235 * @sta_id: index of destination station in FW station table
236 * @sec_ctl: security control, TX_CMD_SEC_*
237 * @initial_rate_index: index into the the rate table for initial TX attempt.
238 * Applied if TX_CMD_FLG_STA_RATE_MSK is set, normally 0 for data frames.
239 * @key: security key
240 * @next_frame_flags: TX_CMD_SEC_* and TX_CMD_NEXT_FRAME_*
241 * @life_time: frame life time (usecs??)
242 * @dram_lsb_ptr: Physical address of scratch area in the command (try_cnt +
243 * btkill_cnd + reserved), first 32 bits. "0" disables usage.
244 * @dram_msb_ptr: upper bits of the scratch physical address
245 * @rts_retry_limit: max attempts for RTS
246 * @data_retry_limit: max attempts to send the data packet
247 * @tid_spec: TID/tspec
248 * @pm_frame_timeout: PM TX frame timeout
249 *
250 * The byte count (both len and next_frame_len) includes MAC header
251 * (24/26/30/32 bytes)
252 * + 2 bytes pad if 26/30 header size
253 * + 8 byte IV for CCM or TKIP (not used for WEP)
254 * + Data payload
255 * + 8-byte MIC (not used for CCM/WEP)
256 * It does not include post-MAC padding, i.e.,
257 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.
258 * Range of len: 14-2342 bytes.
259 *
260 * After the struct fields the MAC header is placed, plus any padding,
261 * and then the actial payload.
262 */
263 struct iwl_tx_cmd {
264 __le16 len;
265 __le16 offload_assist;
266 __le32 tx_flags;
267 struct {
268 u8 try_cnt;
269 u8 btkill_cnt;
270 __le16 reserved;
271 } scratch; /* DRAM_SCRATCH_API_U_VER_1 */
272 __le32 rate_n_flags;
273 u8 sta_id;
274 u8 sec_ctl;
275 u8 initial_rate_index;
276 u8 reserved2;
277 u8 key[16];
278 __le32 reserved3;
279 __le32 life_time;
280 __le32 dram_lsb_ptr;
281 u8 dram_msb_ptr;
282 u8 rts_retry_limit;
283 u8 data_retry_limit;
284 u8 tid_tspec;
285 __le16 pm_frame_timeout;
286 __le16 reserved4;
287 u8 payload[0];
288 struct ieee80211_hdr hdr[0];
289 } __packed; /* TX_CMD_API_S_VER_6 */
290
291 /*
292 * TX response related data
293 */
294
295 /*
296 * enum iwl_tx_status - status that is returned by the fw after attempts to Tx
297 * @TX_STATUS_SUCCESS:
298 * @TX_STATUS_DIRECT_DONE:
299 * @TX_STATUS_POSTPONE_DELAY:
300 * @TX_STATUS_POSTPONE_FEW_BYTES:
301 * @TX_STATUS_POSTPONE_BT_PRIO:
302 * @TX_STATUS_POSTPONE_QUIET_PERIOD:
303 * @TX_STATUS_POSTPONE_CALC_TTAK:
304 * @TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY:
305 * @TX_STATUS_FAIL_SHORT_LIMIT:
306 * @TX_STATUS_FAIL_LONG_LIMIT:
307 * @TX_STATUS_FAIL_UNDERRUN:
308 * @TX_STATUS_FAIL_DRAIN_FLOW:
309 * @TX_STATUS_FAIL_RFKILL_FLUSH:
310 * @TX_STATUS_FAIL_LIFE_EXPIRE:
311 * @TX_STATUS_FAIL_DEST_PS:
312 * @TX_STATUS_FAIL_HOST_ABORTED:
313 * @TX_STATUS_FAIL_BT_RETRY:
314 * @TX_STATUS_FAIL_STA_INVALID:
315 * @TX_TATUS_FAIL_FRAG_DROPPED:
316 * @TX_STATUS_FAIL_TID_DISABLE:
317 * @TX_STATUS_FAIL_FIFO_FLUSHED:
318 * @TX_STATUS_FAIL_SMALL_CF_POLL:
319 * @TX_STATUS_FAIL_FW_DROP:
320 * @TX_STATUS_FAIL_STA_COLOR_MISMATCH: mismatch between color of Tx cmd and
321 * STA table
322 * @TX_FRAME_STATUS_INTERNAL_ABORT:
323 * @TX_MODE_MSK:
324 * @TX_MODE_NO_BURST:
325 * @TX_MODE_IN_BURST_SEQ:
326 * @TX_MODE_FIRST_IN_BURST:
327 * @TX_QUEUE_NUM_MSK:
328 *
329 * Valid only if frame_count =1
330 * TODO: complete documentation
331 */
332 enum iwl_tx_status {
333 TX_STATUS_MSK = 0x000000ff,
334 TX_STATUS_SUCCESS = 0x01,
335 TX_STATUS_DIRECT_DONE = 0x02,
336 /* postpone TX */
337 TX_STATUS_POSTPONE_DELAY = 0x40,
338 TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
339 TX_STATUS_POSTPONE_BT_PRIO = 0x42,
340 TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
341 TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
342 /* abort TX */
343 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
344 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
345 TX_STATUS_FAIL_LONG_LIMIT = 0x83,
346 TX_STATUS_FAIL_UNDERRUN = 0x84,
347 TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
348 TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
349 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
350 TX_STATUS_FAIL_DEST_PS = 0x88,
351 TX_STATUS_FAIL_HOST_ABORTED = 0x89,
352 TX_STATUS_FAIL_BT_RETRY = 0x8a,
353 TX_STATUS_FAIL_STA_INVALID = 0x8b,
354 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
355 TX_STATUS_FAIL_TID_DISABLE = 0x8d,
356 TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
357 TX_STATUS_FAIL_SMALL_CF_POLL = 0x8f,
358 TX_STATUS_FAIL_FW_DROP = 0x90,
359 TX_STATUS_FAIL_STA_COLOR_MISMATCH = 0x91,
360 TX_STATUS_INTERNAL_ABORT = 0x92,
361 TX_MODE_MSK = 0x00000f00,
362 TX_MODE_NO_BURST = 0x00000000,
363 TX_MODE_IN_BURST_SEQ = 0x00000100,
364 TX_MODE_FIRST_IN_BURST = 0x00000200,
365 TX_QUEUE_NUM_MSK = 0x0001f000,
366 TX_NARROW_BW_MSK = 0x00060000,
367 TX_NARROW_BW_1DIV2 = 0x00020000,
368 TX_NARROW_BW_1DIV4 = 0x00040000,
369 TX_NARROW_BW_1DIV8 = 0x00060000,
370 };
371
372 /*
373 * enum iwl_tx_agg_status - TX aggregation status
374 * @AGG_TX_STATE_STATUS_MSK:
375 * @AGG_TX_STATE_TRANSMITTED:
376 * @AGG_TX_STATE_UNDERRUN:
377 * @AGG_TX_STATE_BT_PRIO:
378 * @AGG_TX_STATE_FEW_BYTES:
379 * @AGG_TX_STATE_ABORT:
380 * @AGG_TX_STATE_LAST_SENT_TTL:
381 * @AGG_TX_STATE_LAST_SENT_TRY_CNT:
382 * @AGG_TX_STATE_LAST_SENT_BT_KILL:
383 * @AGG_TX_STATE_SCD_QUERY:
384 * @AGG_TX_STATE_TEST_BAD_CRC32:
385 * @AGG_TX_STATE_RESPONSE:
386 * @AGG_TX_STATE_DUMP_TX:
387 * @AGG_TX_STATE_DELAY_TX:
388 * @AGG_TX_STATE_TRY_CNT_MSK: Retry count for 1st frame in aggregation (retries
389 * occur if tx failed for this frame when it was a member of a previous
390 * aggregation block). If rate scaling is used, retry count indicates the
391 * rate table entry used for all frames in the new agg.
392 *@ AGG_TX_STATE_SEQ_NUM_MSK: Command ID and sequence number of Tx command for
393 * this frame
394 *
395 * TODO: complete documentation
396 */
397 enum iwl_tx_agg_status {
398 AGG_TX_STATE_STATUS_MSK = 0x00fff,
399 AGG_TX_STATE_TRANSMITTED = 0x000,
400 AGG_TX_STATE_UNDERRUN = 0x001,
401 AGG_TX_STATE_BT_PRIO = 0x002,
402 AGG_TX_STATE_FEW_BYTES = 0x004,
403 AGG_TX_STATE_ABORT = 0x008,
404 AGG_TX_STATE_LAST_SENT_TTL = 0x010,
405 AGG_TX_STATE_LAST_SENT_TRY_CNT = 0x020,
406 AGG_TX_STATE_LAST_SENT_BT_KILL = 0x040,
407 AGG_TX_STATE_SCD_QUERY = 0x080,
408 AGG_TX_STATE_TEST_BAD_CRC32 = 0x0100,
409 AGG_TX_STATE_RESPONSE = 0x1ff,
410 AGG_TX_STATE_DUMP_TX = 0x200,
411 AGG_TX_STATE_DELAY_TX = 0x400,
412 AGG_TX_STATE_TRY_CNT_POS = 12,
413 AGG_TX_STATE_TRY_CNT_MSK = 0xf << AGG_TX_STATE_TRY_CNT_POS,
414 };
415
416 #define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL| \
417 AGG_TX_STATE_LAST_SENT_TRY_CNT| \
418 AGG_TX_STATE_LAST_SENT_BT_KILL)
419
420 /*
421 * The mask below describes a status where we are absolutely sure that the MPDU
422 * wasn't sent. For BA/Underrun we cannot be that sure. All we know that we've
423 * written the bytes to the TXE, but we know nothing about what the DSP did.
424 */
425 #define AGG_TX_STAT_FRAME_NOT_SENT (AGG_TX_STATE_FEW_BYTES | \
426 AGG_TX_STATE_ABORT | \
427 AGG_TX_STATE_SCD_QUERY)
428
429 /*
430 * REPLY_TX = 0x1c (response)
431 *
432 * This response may be in one of two slightly different formats, indicated
433 * by the frame_count field:
434 *
435 * 1) No aggregation (frame_count == 1). This reports Tx results for a single
436 * frame. Multiple attempts, at various bit rates, may have been made for
437 * this frame.
438 *
439 * 2) Aggregation (frame_count > 1). This reports Tx results for two or more
440 * frames that used block-acknowledge. All frames were transmitted at
441 * same rate. Rate scaling may have been used if first frame in this new
442 * agg block failed in previous agg block(s).
443 *
444 * Note that, for aggregation, ACK (block-ack) status is not delivered
445 * here; block-ack has not been received by the time the device records
446 * this status.
447 * This status relates to reasons the tx might have been blocked or aborted
448 * within the device, rather than whether it was received successfully by
449 * the destination station.
450 */
451
452 /**
453 * struct agg_tx_status - per packet TX aggregation status
454 * @status: enum iwl_tx_agg_status
455 * @sequence: Sequence # for this frame's Tx cmd (not SSN!)
456 */
457 struct agg_tx_status {
458 __le16 status;
459 __le16 sequence;
460 } __packed;
461
462 /*
463 * definitions for initial rate index field
464 * bits [3:0] initial rate index
465 * bits [6:4] rate table color, used for the initial rate
466 * bit-7 invalid rate indication
467 */
468 #define TX_RES_INIT_RATE_INDEX_MSK 0x0f
469 #define TX_RES_RATE_TABLE_COLOR_MSK 0x70
470 #define TX_RES_INV_RATE_INDEX_MSK 0x80
471
472 #define IWL_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f)
473 #define IWL_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4)
474
475 /**
476 * struct iwl_mvm_tx_resp - notifies that fw is TXing a packet
477 * ( REPLY_TX = 0x1c )
478 * @frame_count: 1 no aggregation, >1 aggregation
479 * @bt_kill_count: num of times blocked by bluetooth (unused for agg)
480 * @failure_rts: num of failures due to unsuccessful RTS
481 * @failure_frame: num failures due to no ACK (unused for agg)
482 * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the
483 * Tx of all the batch. RATE_MCS_*
484 * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK.
485 * for agg: RTS + CTS + aggregation tx time + block-ack time.
486 * in usec.
487 * @pa_status: tx power info
488 * @pa_integ_res_a: tx power info
489 * @pa_integ_res_b: tx power info
490 * @pa_integ_res_c: tx power info
491 * @measurement_req_id: tx power info
492 * @tfd_info: TFD information set by the FH
493 * @seq_ctl: sequence control from the Tx cmd
494 * @byte_cnt: byte count from the Tx cmd
495 * @tlc_info: TLC rate info
496 * @ra_tid: bits [3:0] = ra, bits [7:4] = tid
497 * @frame_ctrl: frame control
498 * @status: for non-agg: frame status TX_STATUS_*
499 * for agg: status of 1st frame, AGG_TX_STATE_*; other frame status fields
500 * follow this one, up to frame_count.
501 *
502 * After the array of statuses comes the SSN of the SCD. Look at
503 * %iwl_mvm_get_scd_ssn for more details.
504 */
505 struct iwl_mvm_tx_resp {
506 u8 frame_count;
507 u8 bt_kill_count;
508 u8 failure_rts;
509 u8 failure_frame;
510 __le32 initial_rate;
511 __le16 wireless_media_time;
512
513 u8 pa_status;
514 u8 pa_integ_res_a[3];
515 u8 pa_integ_res_b[3];
516 u8 pa_integ_res_c[3];
517 __le16 measurement_req_id;
518 u8 reduced_tpc;
519 u8 reserved;
520
521 __le32 tfd_info;
522 __le16 seq_ctl;
523 __le16 byte_cnt;
524 u8 tlc_info;
525 u8 ra_tid;
526 __le16 frame_ctrl;
527
528 struct agg_tx_status status;
529 } __packed; /* TX_RSP_API_S_VER_3 */
530
531 /**
532 * struct iwl_mvm_ba_notif - notifies about reception of BA
533 * ( BA_NOTIF = 0xc5 )
534 * @sta_addr_lo32: lower 32 bits of the MAC address
535 * @sta_addr_hi16: upper 16 bits of the MAC address
536 * @sta_id: Index of recipient (BA-sending) station in fw's station table
537 * @tid: tid of the session
538 * @seq_ctl:
539 * @bitmap: the bitmap of the BA notification as seen in the air
540 * @scd_flow: the tx queue this BA relates to
541 * @scd_ssn: the index of the last contiguously sent packet
542 * @txed: number of Txed frames in this batch
543 * @txed_2_done: number of Acked frames in this batch
544 * @reduced_txp: power reduced according to TPC. This is the actual value and
545 * not a copy from the LQ command. Thus, if not the first rate was used
546 * for Tx-ing then this value will be set to 0 by FW.
547 */
548 struct iwl_mvm_ba_notif {
549 __le32 sta_addr_lo32;
550 __le16 sta_addr_hi16;
551 __le16 reserved;
552
553 u8 sta_id;
554 u8 tid;
555 __le16 seq_ctl;
556 __le64 bitmap;
557 __le16 scd_flow;
558 __le16 scd_ssn;
559 u8 txed;
560 u8 txed_2_done;
561 u8 reduced_txp;
562 u8 reserved1;
563 } __packed;
564
565 /*
566 * struct iwl_mac_beacon_cmd - beacon template command
567 * @tx: the tx commands associated with the beacon frame
568 * @template_id: currently equal to the mac context id of the coresponding
569 * mac.
570 * @tim_idx: the offset of the tim IE in the beacon
571 * @tim_size: the length of the tim IE
572 * @frame: the template of the beacon frame
573 */
574 struct iwl_mac_beacon_cmd {
575 struct iwl_tx_cmd tx;
576 __le32 template_id;
577 __le32 tim_idx;
578 __le32 tim_size;
579 struct ieee80211_hdr frame[0];
580 } __packed;
581
582 struct iwl_beacon_notif {
583 struct iwl_mvm_tx_resp beacon_notify_hdr;
584 __le64 tsf;
585 __le32 ibss_mgr_status;
586 } __packed;
587
588 /**
589 * struct iwl_extended_beacon_notif - notifies about beacon transmission
590 * @beacon_notify_hdr: tx response command associated with the beacon
591 * @tsf: last beacon tsf
592 * @ibss_mgr_status: whether IBSS is manager
593 * @gp2: last beacon time in gp2
594 */
595 struct iwl_extended_beacon_notif {
596 struct iwl_mvm_tx_resp beacon_notify_hdr;
597 __le64 tsf;
598 __le32 ibss_mgr_status;
599 __le32 gp2;
600 } __packed; /* BEACON_NTFY_API_S_VER_5 */
601
602 /**
603 * enum iwl_dump_control - dump (flush) control flags
604 * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty
605 * and the TFD queues are empty.
606 */
607 enum iwl_dump_control {
608 DUMP_TX_FIFO_FLUSH = BIT(1),
609 };
610
611 /**
612 * struct iwl_tx_path_flush_cmd -- queue/FIFO flush command
613 * @queues_ctl: bitmap of queues to flush
614 * @flush_ctl: control flags
615 * @reserved: reserved
616 */
617 struct iwl_tx_path_flush_cmd {
618 __le32 queues_ctl;
619 __le16 flush_ctl;
620 __le16 reserved;
621 } __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_1 */
622
623 /**
624 * iwl_mvm_get_scd_ssn - returns the SSN of the SCD
625 * @tx_resp: the Tx response from the fw (agg or non-agg)
626 *
627 * When the fw sends an AMPDU, it fetches the MPDUs one after the other. Since
628 * it can't know that everything will go well until the end of the AMPDU, it
629 * can't know in advance the number of MPDUs that will be sent in the current
630 * batch. This is why it writes the agg Tx response while it fetches the MPDUs.
631 * Hence, it can't know in advance what the SSN of the SCD will be at the end
632 * of the batch. This is why the SSN of the SCD is written at the end of the
633 * whole struct at a variable offset. This function knows how to cope with the
634 * variable offset and returns the SSN of the SCD.
635 */
636 static inline u32 iwl_mvm_get_scd_ssn(struct iwl_mvm_tx_resp *tx_resp)
637 {
638 return le32_to_cpup((__le32 *)&tx_resp->status +
639 tx_resp->frame_count) & 0xfff;
640 }
641
642 /**
643 * struct iwl_scd_txq_cfg_cmd - New txq hw scheduler config command
644 * @token:
645 * @sta_id: station id
646 * @tid:
647 * @scd_queue: scheduler queue to confiug
648 * @enable: 1 queue enable, 0 queue disable
649 * @aggregate: 1 aggregated queue, 0 otherwise
650 * @tx_fifo: %enum iwl_mvm_tx_fifo
651 * @window: BA window size
652 * @ssn: SSN for the BA agreement
653 */
654 struct iwl_scd_txq_cfg_cmd {
655 u8 token;
656 u8 sta_id;
657 u8 tid;
658 u8 scd_queue;
659 u8 enable;
660 u8 aggregate;
661 u8 tx_fifo;
662 u8 window;
663 __le16 ssn;
664 __le16 reserved;
665 } __packed; /* SCD_QUEUE_CFG_CMD_API_S_VER_1 */
666
667 /**
668 * struct iwl_scd_txq_cfg_rsp
669 * @token: taken from the command
670 * @sta_id: station id from the command
671 * @tid: tid from the command
672 * @scd_queue: scd_queue from the command
673 */
674 struct iwl_scd_txq_cfg_rsp {
675 u8 token;
676 u8 sta_id;
677 u8 tid;
678 u8 scd_queue;
679 } __packed; /* SCD_QUEUE_CFG_RSP_API_S_VER_1 */
680
681 #endif /* __fw_api_tx_h__ */
This page took 0.045894 seconds and 6 git commands to generate.