fw-api-tx.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  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. *
  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
  25. * in the file called COPYING.
  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 - 2014 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. #ifndef __fw_api_tx_h__
  63. #define __fw_api_tx_h__
  64. /**
  65. * enum iwl_tx_flags - bitmasks for tx_flags in TX command
  66. * @TX_CMD_FLG_PROT_REQUIRE: use RTS or CTS-to-self to protect the frame
  67. * @TX_CMD_FLG_WRITE_TX_POWER: update current tx power value in the mgmt frame
  68. * @TX_CMD_FLG_ACK: expect ACK from receiving station
  69. * @TX_CMD_FLG_STA_RATE: use RS table with initial index from the TX command.
  70. * Otherwise, use rate_n_flags from the TX command
  71. * @TX_CMD_FLG_BAR: this frame is a BA request, immediate BAR is expected
  72. * Must set TX_CMD_FLG_ACK with this flag.
  73. * @TX_CMD_FLG_VHT_NDPA: mark frame is NDPA for VHT beamformer sequence
  74. * @TX_CMD_FLG_HT_NDPA: mark frame is NDPA for HT beamformer sequence
  75. * @TX_CMD_FLG_CSI_FDBK2HOST: mark to send feedback to host (only if good CRC)
  76. * @TX_CMD_FLG_BT_PRIO_POS: the position of the BT priority (bit 11 is ignored
  77. * on old firmwares).
  78. * @TX_CMD_FLG_BT_DIS: disable BT priority for this frame
  79. * @TX_CMD_FLG_SEQ_CTL: set if FW should override the sequence control.
  80. * Should be set for mgmt, non-QOS data, mcast, bcast and in scan command
  81. * @TX_CMD_FLG_MORE_FRAG: this frame is non-last MPDU
  82. * @TX_CMD_FLG_TSF: FW should calculate and insert TSF in the frame
  83. * Should be set for beacons and probe responses
  84. * @TX_CMD_FLG_CALIB: activate PA TX power calibrations
  85. * @TX_CMD_FLG_KEEP_SEQ_CTL: if seq_ctl is set, don't increase inner seq count
  86. * @TX_CMD_FLG_MH_PAD: driver inserted 2 byte padding after MAC header.
  87. * Should be set for 26/30 length MAC headers
  88. * @TX_CMD_FLG_RESP_TO_DRV: zero this if the response should go only to FW
  89. * @TX_CMD_FLG_CCMP_AGG: this frame uses CCMP for aggregation acceleration
  90. * @TX_CMD_FLG_TKIP_MIC_DONE: FW already performed TKIP MIC calculation
  91. * @TX_CMD_FLG_DUR: disable duration overwriting used in PS-Poll Assoc-id
  92. * @TX_CMD_FLG_FW_DROP: FW should mark frame to be dropped
  93. * @TX_CMD_FLG_EXEC_PAPD: execute PAPD
  94. * @TX_CMD_FLG_PAPD_TYPE: 0 for reference power, 1 for nominal power
  95. * @TX_CMD_FLG_HCCA_CHUNK: mark start of TSPEC chunk
  96. */
  97. enum iwl_tx_flags {
  98. TX_CMD_FLG_PROT_REQUIRE = BIT(0),
  99. TX_CMD_FLG_WRITE_TX_POWER = BIT(1),
  100. TX_CMD_FLG_ACK = BIT(3),
  101. TX_CMD_FLG_STA_RATE = BIT(4),
  102. TX_CMD_FLG_BAR = BIT(6),
  103. TX_CMD_FLG_TXOP_PROT = BIT(7),
  104. TX_CMD_FLG_VHT_NDPA = BIT(8),
  105. TX_CMD_FLG_HT_NDPA = BIT(9),
  106. TX_CMD_FLG_CSI_FDBK2HOST = BIT(10),
  107. TX_CMD_FLG_BT_PRIO_POS = 11,
  108. TX_CMD_FLG_BT_DIS = BIT(12),
  109. TX_CMD_FLG_SEQ_CTL = BIT(13),
  110. TX_CMD_FLG_MORE_FRAG = BIT(14),
  111. TX_CMD_FLG_TSF = BIT(16),
  112. TX_CMD_FLG_CALIB = BIT(17),
  113. TX_CMD_FLG_KEEP_SEQ_CTL = BIT(18),
  114. TX_CMD_FLG_MH_PAD = BIT(20),
  115. TX_CMD_FLG_RESP_TO_DRV = BIT(21),
  116. TX_CMD_FLG_CCMP_AGG = BIT(22),
  117. TX_CMD_FLG_TKIP_MIC_DONE = BIT(23),
  118. TX_CMD_FLG_DUR = BIT(25),
  119. TX_CMD_FLG_FW_DROP = BIT(26),
  120. TX_CMD_FLG_EXEC_PAPD = BIT(27),
  121. TX_CMD_FLG_PAPD_TYPE = BIT(28),
  122. TX_CMD_FLG_HCCA_CHUNK = BIT(31)
  123. }; /* TX_FLAGS_BITS_API_S_VER_1 */
  124. /*
  125. * TX command security control
  126. */
  127. #define TX_CMD_SEC_WEP 0x01
  128. #define TX_CMD_SEC_CCM 0x02
  129. #define TX_CMD_SEC_TKIP 0x03
  130. #define TX_CMD_SEC_EXT 0x04
  131. #define TX_CMD_SEC_MSK 0x07
  132. #define TX_CMD_SEC_WEP_KEY_IDX_POS 6
  133. #define TX_CMD_SEC_WEP_KEY_IDX_MSK 0xc0
  134. #define TX_CMD_SEC_KEY128 0x08
  135. /* TODO: how does these values are OK with only 16 bit variable??? */
  136. /*
  137. * TX command next frame info
  138. *
  139. * bits 0:2 - security control (TX_CMD_SEC_*)
  140. * bit 3 - immediate ACK required
  141. * bit 4 - rate is taken from STA table
  142. * bit 5 - frame belongs to BA stream
  143. * bit 6 - immediate BA response expected
  144. * bit 7 - unused
  145. * bits 8:15 - Station ID
  146. * bits 16:31 - rate
  147. */
  148. #define TX_CMD_NEXT_FRAME_ACK_MSK (0x8)
  149. #define TX_CMD_NEXT_FRAME_STA_RATE_MSK (0x10)
  150. #define TX_CMD_NEXT_FRAME_BA_MSK (0x20)
  151. #define TX_CMD_NEXT_FRAME_IMM_BA_RSP_MSK (0x40)
  152. #define TX_CMD_NEXT_FRAME_FLAGS_MSK (0xf8)
  153. #define TX_CMD_NEXT_FRAME_STA_ID_MSK (0xff00)
  154. #define TX_CMD_NEXT_FRAME_STA_ID_POS (8)
  155. #define TX_CMD_NEXT_FRAME_RATE_MSK (0xffff0000)
  156. #define TX_CMD_NEXT_FRAME_RATE_POS (16)
  157. /*
  158. * TX command Frame life time in us - to be written in pm_frame_timeout
  159. */
  160. #define TX_CMD_LIFE_TIME_INFINITE 0xFFFFFFFF
  161. #define TX_CMD_LIFE_TIME_DEFAULT 2000000 /* 2000 ms*/
  162. #define TX_CMD_LIFE_TIME_PROBE_RESP 40000 /* 40 ms */
  163. #define TX_CMD_LIFE_TIME_EXPIRED_FRAME 0
  164. /*
  165. * TID for non QoS frames - to be written in tid_tspec
  166. */
  167. #define IWL_TID_NON_QOS IWL_MAX_TID_COUNT
  168. /*
  169. * Limits on the retransmissions - to be written in {data,rts}_retry_limit
  170. */
  171. #define IWL_DEFAULT_TX_RETRY 15
  172. #define IWL_MGMT_DFAULT_RETRY_LIMIT 3
  173. #define IWL_RTS_DFAULT_RETRY_LIMIT 60
  174. #define IWL_BAR_DFAULT_RETRY_LIMIT 60
  175. #define IWL_LOW_RETRY_LIMIT 7
  176. /* TODO: complete documentation for try_cnt and btkill_cnt */
  177. /**
  178. * struct iwl_tx_cmd - TX command struct to FW
  179. * ( TX_CMD = 0x1c )
  180. * @len: in bytes of the payload, see below for details
  181. * @tx_flags: combination of TX_CMD_FLG_*
  182. * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
  183. * cleared. Combination of RATE_MCS_*
  184. * @sta_id: index of destination station in FW station table
  185. * @sec_ctl: security control, TX_CMD_SEC_*
  186. * @initial_rate_index: index into the the rate table for initial TX attempt.
  187. * Applied if TX_CMD_FLG_STA_RATE_MSK is set, normally 0 for data frames.
  188. * @key: security key
  189. * @next_frame_flags: TX_CMD_SEC_* and TX_CMD_NEXT_FRAME_*
  190. * @life_time: frame life time (usecs??)
  191. * @dram_lsb_ptr: Physical address of scratch area in the command (try_cnt +
  192. * btkill_cnd + reserved), first 32 bits. "0" disables usage.
  193. * @dram_msb_ptr: upper bits of the scratch physical address
  194. * @rts_retry_limit: max attempts for RTS
  195. * @data_retry_limit: max attempts to send the data packet
  196. * @tid_spec: TID/tspec
  197. * @pm_frame_timeout: PM TX frame timeout
  198. *
  199. * The byte count (both len and next_frame_len) includes MAC header
  200. * (24/26/30/32 bytes)
  201. * + 2 bytes pad if 26/30 header size
  202. * + 8 byte IV for CCM or TKIP (not used for WEP)
  203. * + Data payload
  204. * + 8-byte MIC (not used for CCM/WEP)
  205. * It does not include post-MAC padding, i.e.,
  206. * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.
  207. * Range of len: 14-2342 bytes.
  208. *
  209. * After the struct fields the MAC header is placed, plus any padding,
  210. * and then the actial payload.
  211. */
  212. struct iwl_tx_cmd {
  213. __le16 len;
  214. __le16 next_frame_len;
  215. __le32 tx_flags;
  216. struct {
  217. u8 try_cnt;
  218. u8 btkill_cnt;
  219. __le16 reserved;
  220. } scratch; /* DRAM_SCRATCH_API_U_VER_1 */
  221. __le32 rate_n_flags;
  222. u8 sta_id;
  223. u8 sec_ctl;
  224. u8 initial_rate_index;
  225. u8 reserved2;
  226. u8 key[16];
  227. __le32 reserved3;
  228. __le32 life_time;
  229. __le32 dram_lsb_ptr;
  230. u8 dram_msb_ptr;
  231. u8 rts_retry_limit;
  232. u8 data_retry_limit;
  233. u8 tid_tspec;
  234. __le16 pm_frame_timeout;
  235. __le16 reserved4;
  236. u8 payload[0];
  237. struct ieee80211_hdr hdr[0];
  238. } __packed; /* TX_CMD_API_S_VER_3 */
  239. /*
  240. * TX response related data
  241. */
  242. /*
  243. * enum iwl_tx_status - status that is returned by the fw after attempts to Tx
  244. * @TX_STATUS_SUCCESS:
  245. * @TX_STATUS_DIRECT_DONE:
  246. * @TX_STATUS_POSTPONE_DELAY:
  247. * @TX_STATUS_POSTPONE_FEW_BYTES:
  248. * @TX_STATUS_POSTPONE_BT_PRIO:
  249. * @TX_STATUS_POSTPONE_QUIET_PERIOD:
  250. * @TX_STATUS_POSTPONE_CALC_TTAK:
  251. * @TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY:
  252. * @TX_STATUS_FAIL_SHORT_LIMIT:
  253. * @TX_STATUS_FAIL_LONG_LIMIT:
  254. * @TX_STATUS_FAIL_UNDERRUN:
  255. * @TX_STATUS_FAIL_DRAIN_FLOW:
  256. * @TX_STATUS_FAIL_RFKILL_FLUSH:
  257. * @TX_STATUS_FAIL_LIFE_EXPIRE:
  258. * @TX_STATUS_FAIL_DEST_PS:
  259. * @TX_STATUS_FAIL_HOST_ABORTED:
  260. * @TX_STATUS_FAIL_BT_RETRY:
  261. * @TX_STATUS_FAIL_STA_INVALID:
  262. * @TX_TATUS_FAIL_FRAG_DROPPED:
  263. * @TX_STATUS_FAIL_TID_DISABLE:
  264. * @TX_STATUS_FAIL_FIFO_FLUSHED:
  265. * @TX_STATUS_FAIL_SMALL_CF_POLL:
  266. * @TX_STATUS_FAIL_FW_DROP:
  267. * @TX_STATUS_FAIL_STA_COLOR_MISMATCH: mismatch between color of Tx cmd and
  268. * STA table
  269. * @TX_FRAME_STATUS_INTERNAL_ABORT:
  270. * @TX_MODE_MSK:
  271. * @TX_MODE_NO_BURST:
  272. * @TX_MODE_IN_BURST_SEQ:
  273. * @TX_MODE_FIRST_IN_BURST:
  274. * @TX_QUEUE_NUM_MSK:
  275. *
  276. * Valid only if frame_count =1
  277. * TODO: complete documentation
  278. */
  279. enum iwl_tx_status {
  280. TX_STATUS_MSK = 0x000000ff,
  281. TX_STATUS_SUCCESS = 0x01,
  282. TX_STATUS_DIRECT_DONE = 0x02,
  283. /* postpone TX */
  284. TX_STATUS_POSTPONE_DELAY = 0x40,
  285. TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
  286. TX_STATUS_POSTPONE_BT_PRIO = 0x42,
  287. TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
  288. TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
  289. /* abort TX */
  290. TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
  291. TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
  292. TX_STATUS_FAIL_LONG_LIMIT = 0x83,
  293. TX_STATUS_FAIL_UNDERRUN = 0x84,
  294. TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
  295. TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
  296. TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
  297. TX_STATUS_FAIL_DEST_PS = 0x88,
  298. TX_STATUS_FAIL_HOST_ABORTED = 0x89,
  299. TX_STATUS_FAIL_BT_RETRY = 0x8a,
  300. TX_STATUS_FAIL_STA_INVALID = 0x8b,
  301. TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
  302. TX_STATUS_FAIL_TID_DISABLE = 0x8d,
  303. TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
  304. TX_STATUS_FAIL_SMALL_CF_POLL = 0x8f,
  305. TX_STATUS_FAIL_FW_DROP = 0x90,
  306. TX_STATUS_FAIL_STA_COLOR_MISMATCH = 0x91,
  307. TX_STATUS_INTERNAL_ABORT = 0x92,
  308. TX_MODE_MSK = 0x00000f00,
  309. TX_MODE_NO_BURST = 0x00000000,
  310. TX_MODE_IN_BURST_SEQ = 0x00000100,
  311. TX_MODE_FIRST_IN_BURST = 0x00000200,
  312. TX_QUEUE_NUM_MSK = 0x0001f000,
  313. TX_NARROW_BW_MSK = 0x00060000,
  314. TX_NARROW_BW_1DIV2 = 0x00020000,
  315. TX_NARROW_BW_1DIV4 = 0x00040000,
  316. TX_NARROW_BW_1DIV8 = 0x00060000,
  317. };
  318. /*
  319. * enum iwl_tx_agg_status - TX aggregation status
  320. * @AGG_TX_STATE_STATUS_MSK:
  321. * @AGG_TX_STATE_TRANSMITTED:
  322. * @AGG_TX_STATE_UNDERRUN:
  323. * @AGG_TX_STATE_BT_PRIO:
  324. * @AGG_TX_STATE_FEW_BYTES:
  325. * @AGG_TX_STATE_ABORT:
  326. * @AGG_TX_STATE_LAST_SENT_TTL:
  327. * @AGG_TX_STATE_LAST_SENT_TRY_CNT:
  328. * @AGG_TX_STATE_LAST_SENT_BT_KILL:
  329. * @AGG_TX_STATE_SCD_QUERY:
  330. * @AGG_TX_STATE_TEST_BAD_CRC32:
  331. * @AGG_TX_STATE_RESPONSE:
  332. * @AGG_TX_STATE_DUMP_TX:
  333. * @AGG_TX_STATE_DELAY_TX:
  334. * @AGG_TX_STATE_TRY_CNT_MSK: Retry count for 1st frame in aggregation (retries
  335. * occur if tx failed for this frame when it was a member of a previous
  336. * aggregation block). If rate scaling is used, retry count indicates the
  337. * rate table entry used for all frames in the new agg.
  338. *@ AGG_TX_STATE_SEQ_NUM_MSK: Command ID and sequence number of Tx command for
  339. * this frame
  340. *
  341. * TODO: complete documentation
  342. */
  343. enum iwl_tx_agg_status {
  344. AGG_TX_STATE_STATUS_MSK = 0x00fff,
  345. AGG_TX_STATE_TRANSMITTED = 0x000,
  346. AGG_TX_STATE_UNDERRUN = 0x001,
  347. AGG_TX_STATE_BT_PRIO = 0x002,
  348. AGG_TX_STATE_FEW_BYTES = 0x004,
  349. AGG_TX_STATE_ABORT = 0x008,
  350. AGG_TX_STATE_LAST_SENT_TTL = 0x010,
  351. AGG_TX_STATE_LAST_SENT_TRY_CNT = 0x020,
  352. AGG_TX_STATE_LAST_SENT_BT_KILL = 0x040,
  353. AGG_TX_STATE_SCD_QUERY = 0x080,
  354. AGG_TX_STATE_TEST_BAD_CRC32 = 0x0100,
  355. AGG_TX_STATE_RESPONSE = 0x1ff,
  356. AGG_TX_STATE_DUMP_TX = 0x200,
  357. AGG_TX_STATE_DELAY_TX = 0x400,
  358. AGG_TX_STATE_TRY_CNT_POS = 12,
  359. AGG_TX_STATE_TRY_CNT_MSK = 0xf << AGG_TX_STATE_TRY_CNT_POS,
  360. };
  361. #define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL| \
  362. AGG_TX_STATE_LAST_SENT_TRY_CNT| \
  363. AGG_TX_STATE_LAST_SENT_BT_KILL)
  364. /*
  365. * The mask below describes a status where we are absolutely sure that the MPDU
  366. * wasn't sent. For BA/Underrun we cannot be that sure. All we know that we've
  367. * written the bytes to the TXE, but we know nothing about what the DSP did.
  368. */
  369. #define AGG_TX_STAT_FRAME_NOT_SENT (AGG_TX_STATE_FEW_BYTES | \
  370. AGG_TX_STATE_ABORT | \
  371. AGG_TX_STATE_SCD_QUERY)
  372. /*
  373. * REPLY_TX = 0x1c (response)
  374. *
  375. * This response may be in one of two slightly different formats, indicated
  376. * by the frame_count field:
  377. *
  378. * 1) No aggregation (frame_count == 1). This reports Tx results for a single
  379. * frame. Multiple attempts, at various bit rates, may have been made for
  380. * this frame.
  381. *
  382. * 2) Aggregation (frame_count > 1). This reports Tx results for two or more
  383. * frames that used block-acknowledge. All frames were transmitted at
  384. * same rate. Rate scaling may have been used if first frame in this new
  385. * agg block failed in previous agg block(s).
  386. *
  387. * Note that, for aggregation, ACK (block-ack) status is not delivered
  388. * here; block-ack has not been received by the time the device records
  389. * this status.
  390. * This status relates to reasons the tx might have been blocked or aborted
  391. * within the device, rather than whether it was received successfully by
  392. * the destination station.
  393. */
  394. /**
  395. * struct agg_tx_status - per packet TX aggregation status
  396. * @status: enum iwl_tx_agg_status
  397. * @sequence: Sequence # for this frame's Tx cmd (not SSN!)
  398. */
  399. struct agg_tx_status {
  400. __le16 status;
  401. __le16 sequence;
  402. } __packed;
  403. /*
  404. * definitions for initial rate index field
  405. * bits [3:0] initial rate index
  406. * bits [6:4] rate table color, used for the initial rate
  407. * bit-7 invalid rate indication
  408. */
  409. #define TX_RES_INIT_RATE_INDEX_MSK 0x0f
  410. #define TX_RES_RATE_TABLE_COLOR_MSK 0x70
  411. #define TX_RES_INV_RATE_INDEX_MSK 0x80
  412. #define IWL_MVM_TX_RES_GET_TID(_ra_tid) ((_ra_tid) & 0x0f)
  413. #define IWL_MVM_TX_RES_GET_RA(_ra_tid) ((_ra_tid) >> 4)
  414. /**
  415. * struct iwl_mvm_tx_resp - notifies that fw is TXing a packet
  416. * ( REPLY_TX = 0x1c )
  417. * @frame_count: 1 no aggregation, >1 aggregation
  418. * @bt_kill_count: num of times blocked by bluetooth (unused for agg)
  419. * @failure_rts: num of failures due to unsuccessful RTS
  420. * @failure_frame: num failures due to no ACK (unused for agg)
  421. * @initial_rate: for non-agg: rate of the successful Tx. For agg: rate of the
  422. * Tx of all the batch. RATE_MCS_*
  423. * @wireless_media_time: for non-agg: RTS + CTS + frame tx attempts time + ACK.
  424. * for agg: RTS + CTS + aggregation tx time + block-ack time.
  425. * in usec.
  426. * @pa_status: tx power info
  427. * @pa_integ_res_a: tx power info
  428. * @pa_integ_res_b: tx power info
  429. * @pa_integ_res_c: tx power info
  430. * @measurement_req_id: tx power info
  431. * @tfd_info: TFD information set by the FH
  432. * @seq_ctl: sequence control from the Tx cmd
  433. * @byte_cnt: byte count from the Tx cmd
  434. * @tlc_info: TLC rate info
  435. * @ra_tid: bits [3:0] = ra, bits [7:4] = tid
  436. * @frame_ctrl: frame control
  437. * @status: for non-agg: frame status TX_STATUS_*
  438. * for agg: status of 1st frame, AGG_TX_STATE_*; other frame status fields
  439. * follow this one, up to frame_count.
  440. *
  441. * After the array of statuses comes the SSN of the SCD. Look at
  442. * %iwl_mvm_get_scd_ssn for more details.
  443. */
  444. struct iwl_mvm_tx_resp {
  445. u8 frame_count;
  446. u8 bt_kill_count;
  447. u8 failure_rts;
  448. u8 failure_frame;
  449. __le32 initial_rate;
  450. __le16 wireless_media_time;
  451. u8 pa_status;
  452. u8 pa_integ_res_a[3];
  453. u8 pa_integ_res_b[3];
  454. u8 pa_integ_res_c[3];
  455. __le16 measurement_req_id;
  456. u8 reduced_tpc;
  457. u8 reserved;
  458. __le32 tfd_info;
  459. __le16 seq_ctl;
  460. __le16 byte_cnt;
  461. u8 tlc_info;
  462. u8 ra_tid;
  463. __le16 frame_ctrl;
  464. struct agg_tx_status status;
  465. } __packed; /* TX_RSP_API_S_VER_3 */
  466. /**
  467. * struct iwl_mvm_ba_notif - notifies about reception of BA
  468. * ( BA_NOTIF = 0xc5 )
  469. * @sta_addr_lo32: lower 32 bits of the MAC address
  470. * @sta_addr_hi16: upper 16 bits of the MAC address
  471. * @sta_id: Index of recipient (BA-sending) station in fw's station table
  472. * @tid: tid of the session
  473. * @seq_ctl:
  474. * @bitmap: the bitmap of the BA notification as seen in the air
  475. * @scd_flow: the tx queue this BA relates to
  476. * @scd_ssn: the index of the last contiguously sent packet
  477. * @txed: number of Txed frames in this batch
  478. * @txed_2_done: number of Acked frames in this batch
  479. */
  480. struct iwl_mvm_ba_notif {
  481. __le32 sta_addr_lo32;
  482. __le16 sta_addr_hi16;
  483. __le16 reserved;
  484. u8 sta_id;
  485. u8 tid;
  486. __le16 seq_ctl;
  487. __le64 bitmap;
  488. __le16 scd_flow;
  489. __le16 scd_ssn;
  490. u8 txed;
  491. u8 txed_2_done;
  492. __le16 reserved1;
  493. } __packed;
  494. /*
  495. * struct iwl_mac_beacon_cmd - beacon template command
  496. * @tx: the tx commands associated with the beacon frame
  497. * @template_id: currently equal to the mac context id of the coresponding
  498. * mac.
  499. * @tim_idx: the offset of the tim IE in the beacon
  500. * @tim_size: the length of the tim IE
  501. * @frame: the template of the beacon frame
  502. */
  503. struct iwl_mac_beacon_cmd {
  504. struct iwl_tx_cmd tx;
  505. __le32 template_id;
  506. __le32 tim_idx;
  507. __le32 tim_size;
  508. struct ieee80211_hdr frame[0];
  509. } __packed;
  510. struct iwl_beacon_notif {
  511. struct iwl_mvm_tx_resp beacon_notify_hdr;
  512. __le64 tsf;
  513. __le32 ibss_mgr_status;
  514. } __packed;
  515. /**
  516. * struct iwl_extended_beacon_notif - notifies about beacon transmission
  517. * @beacon_notify_hdr: tx response command associated with the beacon
  518. * @tsf: last beacon tsf
  519. * @ibss_mgr_status: whether IBSS is manager
  520. * @gp2: last beacon time in gp2
  521. */
  522. struct iwl_extended_beacon_notif {
  523. struct iwl_mvm_tx_resp beacon_notify_hdr;
  524. __le64 tsf;
  525. __le32 ibss_mgr_status;
  526. __le32 gp2;
  527. } __packed; /* BEACON_NTFY_API_S_VER_5 */
  528. /**
  529. * enum iwl_dump_control - dump (flush) control flags
  530. * @DUMP_TX_FIFO_FLUSH: Dump MSDUs until the the FIFO is empty
  531. * and the TFD queues are empty.
  532. */
  533. enum iwl_dump_control {
  534. DUMP_TX_FIFO_FLUSH = BIT(1),
  535. };
  536. /**
  537. * struct iwl_tx_path_flush_cmd -- queue/FIFO flush command
  538. * @queues_ctl: bitmap of queues to flush
  539. * @flush_ctl: control flags
  540. * @reserved: reserved
  541. */
  542. struct iwl_tx_path_flush_cmd {
  543. __le32 queues_ctl;
  544. __le16 flush_ctl;
  545. __le16 reserved;
  546. } __packed; /* TX_PATH_FLUSH_CMD_API_S_VER_1 */
  547. /**
  548. * iwl_mvm_get_scd_ssn - returns the SSN of the SCD
  549. * @tx_resp: the Tx response from the fw (agg or non-agg)
  550. *
  551. * When the fw sends an AMPDU, it fetches the MPDUs one after the other. Since
  552. * it can't know that everything will go well until the end of the AMPDU, it
  553. * can't know in advance the number of MPDUs that will be sent in the current
  554. * batch. This is why it writes the agg Tx response while it fetches the MPDUs.
  555. * Hence, it can't know in advance what the SSN of the SCD will be at the end
  556. * of the batch. This is why the SSN of the SCD is written at the end of the
  557. * whole struct at a variable offset. This function knows how to cope with the
  558. * variable offset and returns the SSN of the SCD.
  559. */
  560. static inline u32 iwl_mvm_get_scd_ssn(struct iwl_mvm_tx_resp *tx_resp)
  561. {
  562. return le32_to_cpup((__le32 *)&tx_resp->status +
  563. tx_resp->frame_count) & 0xfff;
  564. }
  565. /**
  566. * struct iwl_scd_txq_cfg_cmd - New txq hw scheduler config command
  567. * @token:
  568. * @sta_id: station id
  569. * @tid:
  570. * @scd_queue: scheduler queue to confiug
  571. * @enable: 1 queue enable, 0 queue disable
  572. * @aggregate: 1 aggregated queue, 0 otherwise
  573. * @tx_fifo: %enum iwl_mvm_tx_fifo
  574. * @window: BA window size
  575. * @ssn: SSN for the BA agreement
  576. */
  577. struct iwl_scd_txq_cfg_cmd {
  578. u8 token;
  579. u8 sta_id;
  580. u8 tid;
  581. u8 scd_queue;
  582. u8 enable;
  583. u8 aggregate;
  584. u8 tx_fifo;
  585. u8 window;
  586. __le16 ssn;
  587. __le16 reserved;
  588. } __packed; /* SCD_QUEUE_CFG_CMD_API_S_VER_1 */
  589. /**
  590. * struct iwl_scd_txq_cfg_rsp
  591. * @token: taken from the command
  592. * @sta_id: station id from the command
  593. * @tid: tid from the command
  594. * @scd_queue: scd_queue from the command
  595. */
  596. struct iwl_scd_txq_cfg_rsp {
  597. u8 token;
  598. u8 sta_id;
  599. u8 tid;
  600. u8 scd_queue;
  601. } __packed; /* SCD_QUEUE_CFG_RSP_API_S_VER_1 */
  602. #endif /* __fw_api_tx_h__ */