fw-api-tx.h 28 KB

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