Commit | Line | Data |
---|---|---|
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 | * | |
8 | * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of version 2 of the GNU General Public License as | |
12 | * published by the Free Software Foundation. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, but | |
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | |
22 | * USA | |
23 | * | |
24 | * The full GNU General Public License is included in this distribution | |
410dc5aa | 25 | * in the file called COPYING. |
8ca151b5 JB |
26 | * |
27 | * Contact Information: | |
28 | * Intel Linux Wireless <ilw@linux.intel.com> | |
29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | |
30 | * | |
31 | * BSD LICENSE | |
32 | * | |
33 | * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved. | |
34 | * All rights reserved. | |
35 | * | |
36 | * Redistribution and use in source and binary forms, with or without | |
37 | * modification, are permitted provided that the following conditions | |
38 | * are met: | |
39 | * | |
40 | * * Redistributions of source code must retain the above copyright | |
41 | * notice, this list of conditions and the following disclaimer. | |
42 | * * Redistributions in binary form must reproduce the above copyright | |
43 | * notice, this list of conditions and the following disclaimer in | |
44 | * the documentation and/or other materials provided with the | |
45 | * distribution. | |
46 | * * Neither the name Intel Corporation nor the names of its | |
47 | * contributors may be used to endorse or promote products derived | |
48 | * from this software without specific prior written permission. | |
49 | * | |
50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
61 | *****************************************************************************/ | |
62 | ||
63 | #ifndef __fw_api_tx_h__ | |
64 | #define __fw_api_tx_h__ | |
65 | ||
66 | /** | |
67 | * enum iwl_tx_flags - bitmasks for tx_flags in TX command | |
68 | * @TX_CMD_FLG_PROT_REQUIRE: use RTS or CTS-to-self to protect the frame | |
69 | * @TX_CMD_FLG_ACK: expect ACK from receiving station | |
70 | * @TX_CMD_FLG_STA_RATE: use RS table with initial index from the TX command. | |
71 | * Otherwise, use rate_n_flags from the TX command | |
72 | * @TX_CMD_FLG_BA: this frame is a block ack | |
73 | * @TX_CMD_FLG_BAR: this frame is a BA request, immediate BAR is expected | |
74 | * Must set TX_CMD_FLG_ACK with this flag. | |
75 | * @TX_CMD_FLG_TXOP_PROT: protect frame with full TXOP protection | |
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_DIS: disable BT priority for this frame | |
80 | * @TX_CMD_FLG_SEQ_CTL: set if FW should override the sequence control. | |
81 | * Should be set for mgmt, non-QOS data, mcast, bcast and in scan command | |
82 | * @TX_CMD_FLG_MORE_FRAG: this frame is non-last MPDU | |
83 | * @TX_CMD_FLG_NEXT_FRAME: this frame includes information of the next frame | |
84 | * @TX_CMD_FLG_TSF: FW should calculate and insert TSF in the frame | |
85 | * Should be set for beacons and probe responses | |
86 | * @TX_CMD_FLG_CALIB: activate PA TX power calibrations | |
87 | * @TX_CMD_FLG_KEEP_SEQ_CTL: if seq_ctl is set, don't increase inner seq count | |
88 | * @TX_CMD_FLG_AGG_START: allow this frame to start aggregation | |
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_CTS_ONLY: send CTS only, no data after that | |
95 | * @TX_CMD_FLG_DUR: disable duration overwriting used in PS-Poll Assoc-id | |
96 | * @TX_CMD_FLG_FW_DROP: FW should mark frame to be dropped | |
97 | * @TX_CMD_FLG_EXEC_PAPD: execute PAPD | |
98 | * @TX_CMD_FLG_PAPD_TYPE: 0 for reference power, 1 for nominal power | |
99 | * @TX_CMD_FLG_HCCA_CHUNK: mark start of TSPEC chunk | |
100 | */ | |
101 | enum iwl_tx_flags { | |
102 | TX_CMD_FLG_PROT_REQUIRE = BIT(0), | |
103 | TX_CMD_FLG_ACK = BIT(3), | |
104 | TX_CMD_FLG_STA_RATE = BIT(4), | |
105 | TX_CMD_FLG_BA = BIT(5), | |
106 | TX_CMD_FLG_BAR = BIT(6), | |
107 | TX_CMD_FLG_TXOP_PROT = BIT(7), | |
108 | TX_CMD_FLG_VHT_NDPA = BIT(8), | |
109 | TX_CMD_FLG_HT_NDPA = BIT(9), | |
110 | TX_CMD_FLG_CSI_FDBK2HOST = BIT(10), | |
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_NEXT_FRAME = BIT(15), | |
115 | TX_CMD_FLG_TSF = BIT(16), | |
116 | TX_CMD_FLG_CALIB = BIT(17), | |
117 | TX_CMD_FLG_KEEP_SEQ_CTL = BIT(18), | |
118 | TX_CMD_FLG_AGG_START = BIT(19), | |
119 | TX_CMD_FLG_MH_PAD = BIT(20), | |
120 | TX_CMD_FLG_RESP_TO_DRV = BIT(21), | |
121 | TX_CMD_FLG_CCMP_AGG = BIT(22), | |
122 | TX_CMD_FLG_TKIP_MIC_DONE = BIT(23), | |
123 | TX_CMD_FLG_CTS_ONLY = BIT(24), | |
124 | TX_CMD_FLG_DUR = BIT(25), | |
125 | TX_CMD_FLG_FW_DROP = BIT(26), | |
126 | TX_CMD_FLG_EXEC_PAPD = BIT(27), | |
127 | TX_CMD_FLG_PAPD_TYPE = BIT(28), | |
128 | TX_CMD_FLG_HCCA_CHUNK = BIT(31) | |
129 | }; /* TX_FLAGS_BITS_API_S_VER_1 */ | |
130 | ||
131 | /* | |
132 | * TX command security control | |
133 | */ | |
134 | #define TX_CMD_SEC_WEP 0x01 | |
135 | #define TX_CMD_SEC_CCM 0x02 | |
136 | #define TX_CMD_SEC_TKIP 0x03 | |
137 | #define TX_CMD_SEC_WEP_KEY_IDX_POS 6 | |
138 | #define TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0 | |
139 | #define TX_CMD_SEC_KEY128 0x08 | |
140 | ||
141 | /* TODO: how does these values are OK with only 16 bit variable??? */ | |
142 | /* | |
143 | * TX command next frame info | |
144 | * | |
145 | * bits 0:2 - security control (TX_CMD_SEC_*) | |
146 | * bit 3 - immediate ACK required | |
147 | * bit 4 - rate is taken from STA table | |
148 | * bit 5 - frame belongs to BA stream | |
149 | * bit 6 - immediate BA response expected | |
150 | * bit 7 - unused | |
151 | * bits 8:15 - Station ID | |
152 | * bits 16:31 - rate | |
153 | */ | |
154 | #define TX_CMD_NEXT_FRAME_ACK_MSK (0x8) | |
155 | #define TX_CMD_NEXT_FRAME_STA_RATE_MSK (0x10) | |
156 | #define TX_CMD_NEXT_FRAME_BA_MSK (0x20) | |
157 | #define TX_CMD_NEXT_FRAME_IMM_BA_RSP_MSK (0x40) | |
158 | #define TX_CMD_NEXT_FRAME_FLAGS_MSK (0xf8) | |
159 | #define TX_CMD_NEXT_FRAME_STA_ID_MSK (0xff00) | |
160 | #define TX_CMD_NEXT_FRAME_STA_ID_POS (8) | |
161 | #define TX_CMD_NEXT_FRAME_RATE_MSK (0xffff0000) | |
162 | #define TX_CMD_NEXT_FRAME_RATE_POS (16) | |
163 | ||
164 | /* | |
165 | * TX command Frame life time in us - to be written in pm_frame_timeout | |
166 | */ | |
167 | #define TX_CMD_LIFE_TIME_INFINITE 0xFFFFFFFF | |
168 | #define TX_CMD_LIFE_TIME_DEFAULT 2000000 /* 2000 ms*/ | |
169 | #define TX_CMD_LIFE_TIME_PROBE_RESP 40000 /* 40 ms */ | |
170 | #define TX_CMD_LIFE_TIME_EXPIRED_FRAME 0 | |
171 | ||
172 | /* | |
173 | * TID for non QoS frames - to be written in tid_tspec | |
174 | */ | |
175 | #define IWL_TID_NON_QOS IWL_MAX_TID_COUNT | |
176 | ||
177 | /* | |
178 | * Limits on the retransmissions - to be written in {data,rts}_retry_limit | |
179 | */ | |
180 | #define IWL_DEFAULT_TX_RETRY 15 | |
181 | #define IWL_MGMT_DFAULT_RETRY_LIMIT 3 | |
182 | #define IWL_RTS_DFAULT_RETRY_LIMIT 60 | |
183 | #define IWL_BAR_DFAULT_RETRY_LIMIT 60 | |
184 | #define IWL_LOW_RETRY_LIMIT 7 | |
185 | ||
186 | /* TODO: complete documentation for try_cnt and btkill_cnt */ | |
187 | /** | |
188 | * struct iwl_tx_cmd - TX command struct to FW | |
189 | * ( TX_CMD = 0x1c ) | |
190 | * @len: in bytes of the payload, see below for details | |
191 | * @next_frame_len: same as len, but for next frame (0 if not applicable) | |
192 | * Used for fragmentation and bursting, but not in 11n aggregation. | |
193 | * @tx_flags: combination of TX_CMD_FLG_* | |
194 | * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is | |
195 | * cleared. Combination of RATE_MCS_* | |
196 | * @sta_id: index of destination station in FW station table | |
197 | * @sec_ctl: security control, TX_CMD_SEC_* | |
198 | * @initial_rate_index: index into the the rate table for initial TX attempt. | |
199 | * Applied if TX_CMD_FLG_STA_RATE_MSK is set, normally 0 for data frames. | |
200 | * @key: security key | |
201 | * @next_frame_flags: TX_CMD_SEC_* and TX_CMD_NEXT_FRAME_* | |
202 | * @life_time: frame life time (usecs??) | |
203 | * @dram_lsb_ptr: Physical address of scratch area in the command (try_cnt + | |
204 | * btkill_cnd + reserved), first 32 bits. "0" disables usage. | |
205 | * @dram_msb_ptr: upper bits of the scratch physical address | |
206 | * @rts_retry_limit: max attempts for RTS | |
207 | * @data_retry_limit: max attempts to send the data packet | |
208 | * @tid_spec: TID/tspec | |
209 | * @pm_frame_timeout: PM TX frame timeout | |
210 | * @driver_txop: duration od EDCA TXOP, in 32-usec units. Set this if not | |
211 | * specified by HCCA protocol | |
212 | * | |
213 | * The byte count (both len and next_frame_len) includes MAC header | |
214 | * (24/26/30/32 bytes) | |
215 | * + 2 bytes pad if 26/30 header size | |
216 | * + 8 byte IV for CCM or TKIP (not used for WEP) | |
217 | * + Data payload | |
218 | * + 8-byte MIC (not used for CCM/WEP) | |
219 | * It does not include post-MAC padding, i.e., | |
220 | * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes. | |
221 | * Range of len: 14-2342 bytes. | |
222 | * | |
223 | * After the struct fields the MAC header is placed, plus any padding, | |
224 | * and then the actial payload. | |
225 | */ | |
226 | struct iwl_tx_cmd { | |
227 | __le16 len; | |
228 | __le16 next_frame_len; | |
229 | __le32 tx_flags; | |
230 | /* DRAM_SCRATCH_API_U_VER_1 */ | |
231 | u8 try_cnt; | |
232 | u8 btkill_cnt; | |
233 | __le16 reserved; | |
234 | __le32 rate_n_flags; | |
235 | u8 sta_id; | |
236 | u8 sec_ctl; | |
237 | u8 initial_rate_index; | |
238 | u8 reserved2; | |
239 | u8 key[16]; | |
240 | __le16 next_frame_flags; | |
241 | __le16 reserved3; | |
242 | __le32 life_time; | |
243 | __le32 dram_lsb_ptr; | |
244 | u8 dram_msb_ptr; | |
245 | u8 rts_retry_limit; | |
246 | u8 data_retry_limit; | |
247 | u8 tid_tspec; | |
248 | __le16 pm_frame_timeout; | |
249 | __le16 driver_txop; | |
250 | u8 payload[0]; | |
251 | struct ieee80211_hdr hdr[0]; | |
252 | } __packed; /* TX_CMD_API_S_VER_3 */ | |
253 | ||
254 | /* | |
255 | * TX response related data | |
256 | */ | |
257 | ||
258 | /* | |
259 | * enum iwl_tx_status - status that is returned by the fw after attempts to Tx | |
260 | * @TX_STATUS_SUCCESS: | |
261 | * @TX_STATUS_DIRECT_DONE: | |
262 | * @TX_STATUS_POSTPONE_DELAY: | |
263 | * @TX_STATUS_POSTPONE_FEW_BYTES: | |
264 | * @TX_STATUS_POSTPONE_BT_PRIO: | |
265 | * @TX_STATUS_POSTPONE_QUIET_PERIOD: | |
266 | * @TX_STATUS_POSTPONE_CALC_TTAK: | |
267 | * @TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY: | |
268 | * @TX_STATUS_FAIL_SHORT_LIMIT: | |
269 | * @TX_STATUS_FAIL_LONG_LIMIT: | |
270 | * @TX_STATUS_FAIL_UNDERRUN: | |
271 | * @TX_STATUS_FAIL_DRAIN_FLOW: | |
272 | * @TX_STATUS_FAIL_RFKILL_FLUSH: | |
273 | * @TX_STATUS_FAIL_LIFE_EXPIRE: | |
274 | * @TX_STATUS_FAIL_DEST_PS: | |
275 | * @TX_STATUS_FAIL_HOST_ABORTED: | |
276 | * @TX_STATUS_FAIL_BT_RETRY: | |
277 | * @TX_STATUS_FAIL_STA_INVALID: | |
278 | * @TX_TATUS_FAIL_FRAG_DROPPED: | |
279 | * @TX_STATUS_FAIL_TID_DISABLE: | |
280 | * @TX_STATUS_FAIL_FIFO_FLUSHED: | |
281 | * @TX_STATUS_FAIL_SMALL_CF_POLL: | |
282 | * @TX_STATUS_FAIL_FW_DROP: | |
283 | * @TX_STATUS_FAIL_STA_COLOR_MISMATCH: mismatch between color of Tx cmd and | |
284 | * STA table | |
285 | * @TX_FRAME_STATUS_INTERNAL_ABORT: | |
286 | * @TX_MODE_MSK: | |
287 | * @TX_MODE_NO_BURST: | |
288 | * @TX_MODE_IN_BURST_SEQ: | |
289 | * @TX_MODE_FIRST_IN_BURST: | |
290 | * @TX_QUEUE_NUM_MSK: | |
291 | * | |
292 | * Valid only if frame_count =1 | |
293 | * TODO: complete documentation | |
294 | */ | |
295 | enum iwl_tx_status { | |
296 | TX_STATUS_MSK = 0x000000ff, | |
297 | TX_STATUS_SUCCESS = 0x01, | |
298 | TX_STATUS_DIRECT_DONE = 0x02, | |
299 | /* postpone TX */ | |
300 | TX_STATUS_POSTPONE_DELAY = 0x40, | |
301 | TX_STATUS_POSTPONE_FEW_BYTES = 0x41, | |
302 | TX_STATUS_POSTPONE_BT_PRIO = 0x42, | |
303 | TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43, | |
304 | TX_STATUS_POSTPONE_CALC_TTAK = 0x44, | |
305 | /* abort TX */ | |
306 | TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81, | |
307 | TX_STATUS_FAIL_SHORT_LIMIT = 0x82, | |
308 | TX_STATUS_FAIL_LONG_LIMIT = 0x83, | |
309 | TX_STATUS_FAIL_UNDERRUN = 0x84, | |
310 | TX_STATUS_FAIL_DRAIN_FLOW = 0x85, | |
311 | TX_STATUS_FAIL_RFKILL_FLUSH = 0x86, | |
312 | TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, | |
313 | TX_STATUS_FAIL_DEST_PS = 0x88, | |
314 | TX_STATUS_FAIL_HOST_ABORTED = 0x89, | |
315 | TX_STATUS_FAIL_BT_RETRY = 0x8a, | |
316 | TX_STATUS_FAIL_STA_INVALID = 0x8b, | |
317 | TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, | |
318 | TX_STATUS_FAIL_TID_DISABLE = 0x8d, | |
319 | TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e, | |
320 | TX_STATUS_FAIL_SMALL_CF_POLL = 0x8f, | |
321 | TX_STATUS_FAIL_FW_DROP = 0x90, | |
322 | TX_STATUS_FAIL_STA_COLOR_MISMATCH = 0x91, | |
323 | TX_STATUS_INTERNAL_ABORT = 0x92, | |
324 | TX_MODE_MSK = 0x00000f00, | |
325 | TX_MODE_NO_BURST = 0x00000000, | |
326 | TX_MODE_IN_BURST_SEQ = 0x00000100, | |
327 | TX_MODE_FIRST_IN_BURST = 0x00000200, | |
328 | TX_QUEUE_NUM_MSK = 0x0001f000, | |
329 | TX_NARROW_BW_MSK = 0x00060000, | |
330 | TX_NARROW_BW_1DIV2 = 0x00020000, | |
331 | TX_NARROW_BW_1DIV4 = 0x00040000, | |
332 | TX_NARROW_BW_1DIV8 = 0x00060000, | |
333 | }; | |
334 | ||
335 | /* | |
336 | * enum iwl_tx_agg_status - TX aggregation status | |
337 | * @AGG_TX_STATE_STATUS_MSK: | |
338 | * @AGG_TX_STATE_TRANSMITTED: | |
339 | * @AGG_TX_STATE_UNDERRUN: | |
340 | * @AGG_TX_STATE_BT_PRIO: | |
341 | * @AGG_TX_STATE_FEW_BYTES: | |
342 | * @AGG_TX_STATE_ABORT: | |
343 | * @AGG_TX_STATE_LAST_SENT_TTL: | |
344 | * @AGG_TX_STATE_LAST_SENT_TRY_CNT: | |
345 | * @AGG_TX_STATE_LAST_SENT_BT_KILL: | |
346 | * @AGG_TX_STATE_SCD_QUERY: | |
347 | * @AGG_TX_STATE_TEST_BAD_CRC32: | |
348 | * @AGG_TX_STATE_RESPONSE: | |
349 | * @AGG_TX_STATE_DUMP_TX: | |
350 | * @AGG_TX_STATE_DELAY_TX: | |
351 | * @AGG_TX_STATE_TRY_CNT_MSK: Retry count for 1st frame in aggregation (retries | |
352 | * occur if tx failed for this frame when it was a member of a previous | |
353 | * aggregation block). If rate scaling is used, retry count indicates the | |
354 | * rate table entry used for all frames in the new agg. | |
355 | *@ AGG_TX_STATE_SEQ_NUM_MSK: Command ID and sequence number of Tx command for | |
356 | * this frame | |
357 | * | |
358 | * TODO: complete documentation | |
359 | */ | |
360 | enum iwl_tx_agg_status { | |
361 | AGG_TX_STATE_STATUS_MSK = 0x00fff, | |
362 | AGG_TX_STATE_TRANSMITTED = 0x000, | |
363 | AGG_TX_STATE_UNDERRUN = 0x001, | |
364 | AGG_TX_STATE_BT_PRIO = 0x002, | |
365 | AGG_TX_STATE_FEW_BYTES = 0x004, | |
366 | AGG_TX_STATE_ABORT = 0x008, | |
367 | AGG_TX_STATE_LAST_SENT_TTL = 0x010, | |
368 | AGG_TX_STATE_LAST_SENT_TRY_CNT = 0x020, | |
369 | AGG_TX_STATE_LAST_SENT_BT_KILL = 0x040, | |
370 | AGG_TX_STATE_SCD_QUERY = 0x080, | |
371 | AGG_TX_STATE_TEST_BAD_CRC32 = 0x0100, | |
372 | AGG_TX_STATE_RESPONSE = 0x1ff, | |
373 | AGG_TX_STATE_DUMP_TX = 0x200, | |
374 | AGG_TX_STATE_DELAY_TX = 0x400, | |
375 | AGG_TX_STATE_TRY_CNT_POS = 12, | |
376 | AGG_TX_STATE_TRY_CNT_MSK = 0xf << AGG_TX_STATE_TRY_CNT_POS, | |
377 | }; | |
378 | ||
379 | #define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL| \ | |
380 | AGG_TX_STATE_LAST_SENT_TRY_CNT| \ | |
381 | AGG_TX_STATE_LAST_SENT_BT_KILL) | |
382 | ||
383 | /* | |
384 | * The mask below describes a status where we are absolutely sure that the MPDU | |
385 | * wasn't sent. For BA/Underrun we cannot be that sure. All we know that we've | |
386 | * written the bytes to the TXE, but we know nothing about what the DSP did. | |
387 | */ | |
388 | #define AGG_TX_STAT_FRAME_NOT_SENT (AGG_TX_STATE_FEW_BYTES | \ | |
389 | AGG_TX_STATE_ABORT | \ | |
390 | AGG_TX_STATE_SCD_QUERY) | |
391 | ||
392 | /* | |
393 | * REPLY_TX = 0x1c (response) | |
394 | * | |
395 | * This response may be in one of two slightly different formats, indicated | |
396 | * by the frame_count field: | |
397 | * | |
398 | * 1) No aggregation (frame_count == 1). This reports Tx results for a single | |
399 | * frame. Multiple attempts, at various bit rates, may have been made for | |
400 | * this frame. | |
401 | * | |
402 | * 2) Aggregation (frame_count > 1). This reports Tx results for two or more | |
403 | * frames that used block-acknowledge. All frames were transmitted at | |
404 | * same rate. Rate scaling may have been used if first frame in this new | |
405 | * agg block failed in previous agg block(s). | |
406 | * | |
407 | * Note that, for aggregation, ACK (block-ack) status is not delivered | |
408 | * here; block-ack has not been received by the time the device records | |
409 | * this status. | |
410 | * This status relates to reasons the tx might have been blocked or aborted | |
411 | * within the device, rather than whether it was received successfully by | |
412 | * the destination station. | |
413 | */ | |
414 | ||
415 | /** | |
416 | * struct agg_tx_status - per packet TX aggregation status | |
417 | * @status: enum iwl_tx_agg_status | |
418 | * @sequence: Sequence # for this frame's Tx cmd (not SSN!) | |
419 | */ | |
420 | struct agg_tx_status { | |
421 | __le16 status; | |
422 | __le16 sequence; | |
423 | } __packed; | |
424 | ||
425 | /* | |
426 | * definitions for initial rate index field | |
427 | * bits [3:0] initial rate index | |
428 | * bits [6:4] rate table color, used for the initial rate | |
429 | * bit-7 invalid rate indication | |
430 | */ | |
431 | #define TX_RES_INIT_RATE_INDEX_MSK 0x0f | |
432 | #define TX_RES_RATE_TABLE_COLOR_MSK 0x70 | |
433 | #define TX_RES_INV_RATE_INDEX_MSK 0x80 | |
434 | ||
435 | #define IWL_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f) | |
436 | #define IWL_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4) | |
437 | ||
438 | /** | |
439 | * struct iwl_mvm_tx_resp - notifies that fw is TXing a packet | |
440 | * ( REPLY_TX = 0x1c ) | |
441 | * @frame_count: 1 no aggregation, >1 aggregation | |
442 | * @bt_kill_count: num of times blocked by bluetooth (unused for agg) | |
443 | * @failure_rts: num of failures due to unsuccessful RTS | |
444 | * @failure_frame: num failures due to no ACK (unused for agg) | |
445 | * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the | |
446 | * Tx of all the batch. RATE_MCS_* | |
447 | * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK. | |
448 | * for agg: RTS + CTS + aggregation tx time + block-ack time. | |
449 | * in usec. | |
450 | * @pa_status: tx power info | |
451 | * @pa_integ_res_a: tx power info | |
452 | * @pa_integ_res_b: tx power info | |
453 | * @pa_integ_res_c: tx power info | |
454 | * @measurement_req_id: tx power info | |
455 | * @tfd_info: TFD information set by the FH | |
456 | * @seq_ctl: sequence control from the Tx cmd | |
457 | * @byte_cnt: byte count from the Tx cmd | |
458 | * @tlc_info: TLC rate info | |
459 | * @ra_tid: bits [3:0] = ra, bits [7:4] = tid | |
460 | * @frame_ctrl: frame control | |
461 | * @status: for non-agg: frame status TX_STATUS_* | |
462 | * for agg: status of 1st frame, AGG_TX_STATE_*; other frame status fields | |
463 | * follow this one, up to frame_count. | |
464 | * | |
465 | * After the array of statuses comes the SSN of the SCD. Look at | |
466 | * %iwl_mvm_get_scd_ssn for more details. | |
467 | */ | |
468 | struct iwl_mvm_tx_resp { | |
469 | u8 frame_count; | |
470 | u8 bt_kill_count; | |
471 | u8 failure_rts; | |
472 | u8 failure_frame; | |
473 | __le32 initial_rate; | |
474 | __le16 wireless_media_time; | |
475 | ||
476 | u8 pa_status; | |
477 | u8 pa_integ_res_a[3]; | |
478 | u8 pa_integ_res_b[3]; | |
479 | u8 pa_integ_res_c[3]; | |
480 | __le16 measurement_req_id; | |
481 | __le16 reserved; | |
482 | ||
483 | __le32 tfd_info; | |
484 | __le16 seq_ctl; | |
485 | __le16 byte_cnt; | |
486 | u8 tlc_info; | |
487 | u8 ra_tid; | |
488 | __le16 frame_ctrl; | |
489 | ||
490 | struct agg_tx_status status; | |
491 | } __packed; /* TX_RSP_API_S_VER_3 */ | |
492 | ||
493 | /** | |
494 | * struct iwl_mvm_ba_notif - notifies about reception of BA | |
495 | * ( BA_NOTIF = 0xc5 ) | |
496 | * @sta_addr_lo32: lower 32 bits of the MAC address | |
497 | * @sta_addr_hi16: upper 16 bits of the MAC address | |
498 | * @sta_id: Index of recipient (BA-sending) station in fw's station table | |
499 | * @tid: tid of the session | |
500 | * @seq_ctl: | |
501 | * @bitmap: the bitmap of the BA notification as seen in the air | |
502 | * @scd_flow: the tx queue this BA relates to | |
503 | * @scd_ssn: the index of the last contiguously sent packet | |
504 | * @txed: number of Txed frames in this batch | |
505 | * @txed_2_done: number of Acked frames in this batch | |
506 | */ | |
507 | struct iwl_mvm_ba_notif { | |
508 | __le32 sta_addr_lo32; | |
509 | __le16 sta_addr_hi16; | |
510 | __le16 reserved; | |
511 | ||
512 | u8 sta_id; | |
513 | u8 tid; | |
514 | __le16 seq_ctl; | |
515 | __le64 bitmap; | |
516 | __le16 scd_flow; | |
517 | __le16 scd_ssn; | |
518 | u8 txed; | |
519 | u8 txed_2_done; | |
520 | __le16 reserved1; | |
521 | } __packed; | |
522 | ||
523 | /* | |
524 | * struct iwl_mac_beacon_cmd - beacon template command | |
525 | * @tx: the tx commands associated with the beacon frame | |
526 | * @template_id: currently equal to the mac context id of the coresponding | |
527 | * mac. | |
528 | * @tim_idx: the offset of the tim IE in the beacon | |
529 | * @tim_size: the length of the tim IE | |
530 | * @frame: the template of the beacon frame | |
531 | */ | |
532 | struct iwl_mac_beacon_cmd { | |
533 | struct iwl_tx_cmd tx; | |
534 | __le32 template_id; | |
535 | __le32 tim_idx; | |
536 | __le32 tim_size; | |
537 | struct ieee80211_hdr frame[0]; | |
538 | } __packed; | |
539 | ||
540 | /** | |
541 | * enum iwl_dump_control - dump (flush) control flags | |
542 | * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty | |
543 | * and the TFD queues are empty. | |
544 | */ | |
545 | enum iwl_dump_control { | |
546 | DUMP_TX_FIFO_FLUSH = BIT(1), | |
547 | }; | |
548 | ||
549 | /** | |
550 | * struct iwl_tx_path_flush_cmd -- queue/FIFO flush command | |
551 | * @queues_ctl: bitmap of queues to flush | |
552 | * @flush_ctl: control flags | |
553 | * @reserved: reserved | |
554 | */ | |
555 | struct iwl_tx_path_flush_cmd { | |
556 | __le32 queues_ctl; | |
557 | __le16 flush_ctl; | |
558 | __le16 reserved; | |
559 | } __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_1 */ | |
560 | ||
561 | /** | |
562 | * iwl_mvm_get_scd_ssn - returns the SSN of the SCD | |
563 | * @tx_resp: the Tx response from the fw (agg or non-agg) | |
564 | * | |
565 | * When the fw sends an AMPDU, it fetches the MPDUs one after the other. Since | |
566 | * it can't know that everything will go well until the end of the AMPDU, it | |
567 | * can't know in advance the number of MPDUs that will be sent in the current | |
568 | * batch. This is why it writes the agg Tx response while it fetches the MPDUs. | |
569 | * Hence, it can't know in advance what the SSN of the SCD will be at the end | |
570 | * of the batch. This is why the SSN of the SCD is written at the end of the | |
571 | * whole struct at a variable offset. This function knows how to cope with the | |
572 | * variable offset and returns the SSN of the SCD. | |
573 | */ | |
574 | static inline u32 iwl_mvm_get_scd_ssn(struct iwl_mvm_tx_resp *tx_resp) | |
575 | { | |
576 | return le32_to_cpup((__le32 *)&tx_resp->status + | |
577 | tx_resp->frame_count) & 0xfff; | |
578 | } | |
579 | ||
580 | #endif /* __fw_api_tx_h__ */ |