tx.h 30 KB

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