hal_tx.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923
  1. /*
  2. * Copyright (c) 2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #if !defined(HAL_TX_H)
  19. #define HAL_TX_H
  20. /*---------------------------------------------------------------------------
  21. Include files
  22. ---------------------------------------------------------------------------*/
  23. #include "hal_api.h"
  24. #include <hal_internal.h>
  25. #include <qdf_types.h>
  26. #include "qdf_mem.h"
  27. #include "hw/data/datastruct/wbm_release_ring.h"
  28. #include "hw/data/tlv_32/tcl_data_cmd.h"
  29. #include "hw/data/datastruct/tx_msdu_extension.h"
  30. /*---------------------------------------------------------------------------
  31. Preprocessor definitions and constants
  32. ---------------------------------------------------------------------------*/
  33. #define HAL_OFFSET(block, field) block ## _ ## field ## _OFFSET
  34. #define HAL_SET_FLD(desc, block , field) \
  35. (*(uint32_t *) ((uint8_t *) desc + HAL_OFFSET(block, field)))
  36. #define HAL_SET_FLD_OFFSET(desc, block , field, offset) \
  37. (*(uint32_t *) ((uint8_t *) desc + HAL_OFFSET(block, field) + (offset)))
  38. #define HAL_TX_DESC_SET_TLV_HDR(desc, tag, len) \
  39. do { \
  40. ((struct tlv_32_hdr *) desc)->tlv_tag = (tag); \
  41. ((struct tlv_32_hdr *) desc)->tlv_len = (len); \
  42. } while (0)
  43. #define HAL_TX_TCL_DATA_TAG WIFITCL_DATA_CMD_E
  44. #define HAL_TX_TCL_CMD_TAG WIFITCL_GSE_CMD_E
  45. #define HAL_TX_SM(block, field, value) \
  46. ((value << (block ## _ ## field ## _LSB)) & \
  47. (block ## _ ## field ## _MASK))
  48. #define HAL_TX_DESC_LEN_DWORDS (NUM_OF_DWORDS_TCL_DATA_CMD)
  49. #define HAL_TX_DESC_LEN_BYTES (NUM_OF_DWORDS_TCL_DATA_CMD * 4)
  50. #define HAL_TX_EXTENSION_DESC_LEN_DWORDS (NUM_OF_DWORDS_TX_MSDU_EXTENSION)
  51. #define HAL_TX_EXTENSION_DESC_LEN_BYTES (NUM_OF_DWORDS_TX_MSDU_EXTENSION * 4)
  52. #define HAL_TX_COMPLETION_DESC_LEN_DWORDS (NUM_OF_DWORDS_WBM_RELEASE_RING)
  53. #define HAL_TX_COMPLETION_DESC_LEN_BYTES (NUM_OF_DWORDS_WBM_RELEASE_RING*4)
  54. /* Length of WBM release ring without the status words */
  55. #define HAL_TX_COMPLETION_DESC_BASE_LEN 12
  56. #define HAL_TX_COMP_RELEASE_SOURCE_TQM 0
  57. #define HAL_TX_COMP_RELEASE_SOURCE_FW 3
  58. /*
  59. * Offset of HTT Tx Descriptor in WBM Completion
  60. * HTT Tx Desc structure is passed from firmware to host overlayed
  61. * on wbm_release_ring DWORD 3 and 4 for software based completions
  62. * (Exception frames and TQM bypass frames)
  63. */
  64. #define HAL_TX_COMP_HTT_STATUS_OFFSET 12
  65. #define HAL_TX_COMP_HTT_STATUS_LEN 8
  66. #define HAL_TX_BUF_TYPE_BUFFER 0
  67. #define HAL_TX_BUF_TYPE_EXT_DESC 2
  68. #define HAL_TX_EXT_DESC_BUF_OFFSET TX_MSDU_EXTENSION_6_BUF0_PTR_31_0_OFFSET
  69. #define HAL_TX_EXT_BUF_LOW_MASK TX_MSDU_EXTENSION_6_BUF0_PTR_31_0_MASK
  70. #define HAL_TX_EXT_BUF_HI_MASK TX_MSDU_EXTENSION_7_BUF0_PTR_39_32_MASK
  71. #define HAL_TX_EXT_BUF_LEN_MASK TX_MSDU_EXTENSION_7_BUF0_LEN_MASK
  72. #define HAL_TX_EXT_BUF_LEN_LSB TX_MSDU_EXTENSION_7_BUF0_LEN_LSB
  73. #define HAL_TX_EXT_BUF_WD_SIZE 2
  74. enum hal_tx_ret_buf_manager {
  75. HAL_WBM_SW0_BM_ID = 3,
  76. HAL_WBM_SW1_BM_ID = 4,
  77. HAL_WBM_SW2_BM_ID = 5,
  78. HAL_WBM_SW3_BM_ID = 6,
  79. };
  80. /*---------------------------------------------------------------------------
  81. Structures
  82. ---------------------------------------------------------------------------*/
  83. /**
  84. * struct hal_tx_completion_status - HAL Tx completion descriptor contents
  85. * @ack_frame_rssi: RSSI of the received ACK or BA frame
  86. * @first_msdu: Indicates this MSDU is the first MSDU in AMSDU
  87. * @last_msdu: Indicates this MSDU is the last MSDU in AMSDU
  88. * @msdu_part_of_amsdu : Indicates this MSDU was part of an A-MSDU in MPDU
  89. * @bw: Indicates the BW of the upcoming transmission -
  90. * <enum 0 transmit_bw_20_MHz>
  91. * <enum 1 transmit_bw_40_MHz>
  92. * <enum 2 transmit_bw_80_MHz>
  93. * <enum 3 transmit_bw_160_MHz>
  94. * @pkt_type: Transmit Packet Type
  95. * @stbc: When set, STBC transmission rate was used
  96. * @ldpc: When set, use LDPC transmission rates
  97. * @sgi: <enum 0 0_8_us_sgi > Legacy normal GI
  98. * <enum 1 0_4_us_sgi > Legacy short GI
  99. * <enum 2 1_6_us_sgi > HE related GI
  100. * <enum 3 3_2_us_sgi > HE
  101. * @mcs: Transmit MCS Rate
  102. * @ofdma: Set when the transmission was an OFDMA transmission
  103. * @tones_in_ru: The number of tones in the RU used.
  104. * @tsf: Lower 32 bits of the TSF
  105. * @ppdu_id: TSF, snapshot of this value when transmission of the
  106. * PPDU containing the frame finished.
  107. * @transmit_cnt: Number of times this frame has been transmitted
  108. * @tid: TID of the flow or MPDU queue
  109. * @peer_id: Peer ID of the flow or MPDU queue
  110. */
  111. struct hal_tx_completion_status {
  112. uint8_t ack_frame_rssi;
  113. uint8_t first_msdu:1,
  114. last_msdu:1,
  115. msdu_part_of_amsdu:1;
  116. uint32_t bw:2,
  117. pkt_type:4,
  118. stbc:1,
  119. ldpc:1,
  120. sgi:2,
  121. mcs:2,
  122. ofdma:1,
  123. tones_in_ru:10;
  124. uint32_t tsf;
  125. uint32_t ppdu_id;
  126. uint8_t transmit_cnt;
  127. uint8_t tid;
  128. uint16_t peer_id;
  129. };
  130. /**
  131. * struct hal_tx_desc_comp_s - hal tx completion descriptor contents
  132. * @desc: Transmit status information from descriptor
  133. */
  134. struct hal_tx_desc_comp_s {
  135. uint32_t desc[HAL_TX_COMPLETION_DESC_LEN_DWORDS];
  136. };
  137. /*
  138. * enum hal_tx_encrypt_type - Type of decrypt cipher used (valid only for RAW)
  139. * @HAL_TX_ENCRYPT_TYPE_WEP_40: WEP 40-bit
  140. * @HAL_TX_ENCRYPT_TYPE_WEP_10: WEP 10-bit
  141. * @HAL_TX_ENCRYPT_TYPE_TKIP_NO_MIC: TKIP without MIC
  142. * @HAL_TX_ENCRYPT_TYPE_WEP_128: WEP_128
  143. * @HAL_TX_ENCRYPT_TYPE_TKIP_WITH_MIC: TKIP_WITH_MIC
  144. * @HAL_TX_ENCRYPT_TYPE_WAPI: WAPI
  145. * @HAL_TX_ENCRYPT_TYPE_AES_CCMP_128: AES_CCMP_128
  146. * @HAL_TX_ENCRYPT_TYPE_NO_CIPHER: NO CIPHER
  147. * @HAL_TX_ENCRYPT_TYPE_AES_CCMP_256: AES_CCMP_256
  148. * @HAL_TX_ENCRYPT_TYPE_AES_GCMP_128: AES_GCMP_128
  149. * @HAL_TX_ENCRYPT_TYPE_AES_GCMP_256: AES_GCMP_256
  150. * @HAL_TX_ENCRYPT_TYPE_WAPI_GCM_SM4: WAPI GCM SM4
  151. */
  152. enum hal_tx_encrypt_type {
  153. HAL_TX_ENCRYPT_TYPE_WEP_40 = 0,
  154. HAL_TX_ENCRYPT_TYPE_WEP_104 = 1 ,
  155. HAL_TX_ENCRYPT_TYPE_TKIP_NO_MIC = 2,
  156. HAL_TX_ENCRYPT_TYPE_WEP_128 = 3,
  157. HAL_TX_ENCRYPT_TYPE_TKIP_WITH_MIC = 4,
  158. HAL_TX_ENCRYPT_TYPE_WAPI = 5,
  159. HAL_TX_ENCRYPT_TYPE_AES_CCMP_128 = 6,
  160. HAL_TX_ENCRYPT_TYPE_NO_CIPHER = 7,
  161. HAL_TX_ENCRYPT_TYPE_AES_CCMP_256 = 8,
  162. HAL_TX_ENCRYPT_TYPE_AES_GCMP_128 = 9,
  163. HAL_TX_ENCRYPT_TYPE_AES_GCMP_256 = 10,
  164. HAL_TX_ENCRYPT_TYPE_WAPI_GCM_SM4 = 11,
  165. };
  166. /*
  167. * enum hal_tx_encap_type - Encapsulation type that HW will perform
  168. * @HAL_TX_ENCAP_TYPE_RAW: Raw Packet Type
  169. * @HAL_TX_ENCAP_TYPE_NWIFI: Native WiFi Type
  170. * @HAL_TX_ENCAP_TYPE_ETHERNET: Ethernet
  171. * @HAL_TX_ENCAP_TYPE_802_3: 802.3 Frame
  172. */
  173. enum hal_tx_encap_type {
  174. HAL_TX_ENCAP_TYPE_RAW = 0,
  175. HAL_TX_ENCAP_TYPE_NWIFI = 1,
  176. HAL_TX_ENCAP_TYPE_ETHERNET = 2,
  177. HAL_TX_ENCAP_TYPE_802_3 = 3,
  178. };
  179. /**
  180. * enum hal_tx_tqm_release_reason - TQM Release reason codes
  181. *
  182. * @HAL_TX_TQM_RR_FRAME_ACKED : ACK of BA for it was received
  183. * @HAL_TX_TQM_RR_REM_CMD_REM : Remove cmd of type “Remove_mpdus” initiated
  184. * by SW
  185. * @HAL_TX_TQM_RR_REM_CMD_TX : Remove command of type Remove_transmitted_mpdus
  186. * initiated by SW
  187. * @HAL_TX_TQM_RR_REM_CMD_NOTX : Remove cmd of type Remove_untransmitted_mpdus
  188. * initiated by SW
  189. * @HAL_TX_TQM_RR_REM_CMD_AGED : Remove command of type “Remove_aged_mpdus” or
  190. * “Remove_aged_msdus” initiated by SW
  191. * @HAL_TX_TQM_RR_FW_REASON1 : Remove command where fw indicated that
  192. * remove reason is fw_reason1
  193. * @HAL_TX_TQM_RR_FW_REASON2 : Remove command where fw indicated that
  194. * remove reason is fw_reason2
  195. * @HAL_TX_TQM_RR_FW_REASON3 : Remove command where fw indicated that
  196. * remove reason is fw_reason3
  197. */
  198. enum hal_tx_tqm_release_reason {
  199. HAL_TX_TQM_RR_FRAME_ACKED,
  200. HAL_TX_TQM_RR_REM_CMD_REM,
  201. HAL_TX_TQM_RR_REM_CMD_TX,
  202. HAL_TX_TQM_RR_REM_CMD_NOTX,
  203. HAL_TX_TQM_RR_REM_CMD_AGED,
  204. HAL_TX_TQM_RR_FW_REASON1,
  205. HAL_TX_TQM_RR_FW_REASON2,
  206. HAL_TX_TQM_RR_FW_REASON3,
  207. };
  208. /* enum - Table IDs for 2 DSCP-TID mapping Tables that TCL H/W supports
  209. * @HAL_TX_DSCP_TID_MAP_TABLE_DEFAULT: Default DSCP-TID mapping table
  210. * @HAL_TX_DSCP_TID_MAP_TABLE_OVERRIDE: DSCP-TID map override table
  211. */
  212. enum hal_tx_dscp_tid_table_id {
  213. HAL_TX_DSCP_TID_MAP_TABLE_DEFAULT,
  214. HAL_TX_DSCP_TID_MAP_TABLE_OVERRIDE,
  215. };
  216. /*---------------------------------------------------------------------------
  217. Function declarations and documentation
  218. ---------------------------------------------------------------------------*/
  219. /*---------------------------------------------------------------------------
  220. TCL Descriptor accessor APIs
  221. ---------------------------------------------------------------------------*/
  222. /**
  223. * hal_tx_desc_set_buf_addr - Fill Buffer Address information in Tx Descriptor
  224. * @desc: Handle to Tx Descriptor
  225. * @paddr: Physical Address
  226. * @pool_id: Return Buffer Manager ID
  227. * @desc_id: Descriptor ID
  228. * @type: 0 - Address points to a MSDU buffer
  229. * 1 - Address points to MSDU extension descriptor
  230. *
  231. * Return: void
  232. */
  233. static inline void hal_tx_desc_set_buf_addr(void *desc,
  234. dma_addr_t paddr, uint8_t pool_id,
  235. uint32_t desc_id, uint8_t type)
  236. {
  237. /* Set buffer_addr_info.buffer_addr_31_0 */
  238. HAL_SET_FLD(desc, TCL_DATA_CMD_0, BUFFER_ADDR_INFO_BUF_ADDR_INFO) =
  239. HAL_TX_SM(BUFFER_ADDR_INFO_0, BUFFER_ADDR_31_0, paddr);
  240. /* Set buffer_addr_info.buffer_addr_39_32 */
  241. HAL_SET_FLD(desc, TCL_DATA_CMD_1,
  242. BUFFER_ADDR_INFO_BUF_ADDR_INFO) |=
  243. HAL_TX_SM(BUFFER_ADDR_INFO_1, BUFFER_ADDR_39_32,
  244. (((uint64_t) paddr) << 32));
  245. /* Set buffer_addr_info.return_buffer_manager = pool id */
  246. HAL_SET_FLD(desc, TCL_DATA_CMD_1,
  247. BUFFER_ADDR_INFO_BUF_ADDR_INFO) |=
  248. HAL_TX_SM(BUFFER_ADDR_INFO_1,
  249. RETURN_BUFFER_MANAGER, (pool_id + HAL_WBM_SW0_BM_ID));
  250. /* Set buffer_addr_info.sw_buffer_cookie = desc_id */
  251. HAL_SET_FLD(desc, TCL_DATA_CMD_1,
  252. BUFFER_ADDR_INFO_BUF_ADDR_INFO) |=
  253. HAL_TX_SM(BUFFER_ADDR_INFO_1, SW_BUFFER_COOKIE, desc_id);
  254. /* Set Buffer or Ext Descriptor Type */
  255. HAL_SET_FLD(desc, TCL_DATA_CMD_1,
  256. BUFFER_ADDR_INFO_BUF_ADDR_INFO) |=
  257. HAL_TX_SM(TCL_DATA_CMD_2, BUF_OR_EXT_DESC_TYPE, type);
  258. }
  259. /**
  260. * hal_tx_desc_set_buf_length - Set Data length in bytes in Tx Descriptor
  261. * @desc: Handle to Tx Descriptor
  262. * @data_length: MSDU length in case of direct descriptor.
  263. * Length of link extension descriptor in case of Link extension
  264. * descriptor.Includes the length of Metadata
  265. * Return: None
  266. */
  267. static inline void hal_tx_desc_set_buf_length(void *desc,
  268. uint16_t data_length)
  269. {
  270. HAL_SET_FLD(desc, TCL_DATA_CMD_3, DATA_LENGTH) |=
  271. HAL_TX_SM(TCL_DATA_CMD_3, DATA_LENGTH, data_length);
  272. }
  273. /**
  274. * hal_tx_desc_set_buf_offset - Sets Packet Offset field in Tx descriptor
  275. * @desc: Handle to Tx Descriptor
  276. * @offset: Packet offset from Metadata in case of direct buffer descriptor.
  277. *
  278. * Return: void
  279. */
  280. static inline void hal_tx_desc_set_buf_offset(void *desc,
  281. uint8_t offset)
  282. {
  283. HAL_SET_FLD(desc, TCL_DATA_CMD_3, PACKET_OFFSET) |=
  284. HAL_TX_SM(TCL_DATA_CMD_3, PACKET_OFFSET, offset);
  285. }
  286. /**
  287. * hal_tx_desc_set_encap_type - Set encapsulation type in Tx Descriptor
  288. * @desc: Handle to Tx Descriptor
  289. * @encap_type: Encapsulation that HW will perform
  290. *
  291. * Return: void
  292. *
  293. */
  294. static inline void hal_tx_desc_set_encap_type(void *desc,
  295. enum hal_tx_encap_type encap_type)
  296. {
  297. HAL_SET_FLD(desc, TCL_DATA_CMD_2, ENCAP_TYPE) |=
  298. HAL_TX_SM(TCL_DATA_CMD_2, ENCAP_TYPE, encap_type);
  299. }
  300. /**
  301. * hal_tx_desc_set_encrypt_type - Sets the Encrypt Type in Tx Descriptor
  302. * @desc: Handle to Tx Descriptor
  303. * @type: Encrypt Type
  304. *
  305. * Return: void
  306. */
  307. static inline void hal_tx_desc_set_encrypt_type(void *desc,
  308. enum hal_tx_encrypt_type type)
  309. {
  310. HAL_SET_FLD(desc, TCL_DATA_CMD_2, ENCRYPT_TYPE) |=
  311. HAL_TX_SM(TCL_DATA_CMD_2, ENCRYPT_TYPE, type);
  312. }
  313. /**
  314. * hal_tx_desc_set_addr_search_flags - Enable AddrX and AddrY search flags
  315. * @desc: Handle to Tx Descriptor
  316. * @flags: Bit 0 - AddrY search enable, Bit 1 - AddrX search enable
  317. *
  318. * Return: void
  319. */
  320. static inline void hal_tx_desc_set_addr_search_flags(void *desc,
  321. uint8_t flags)
  322. {
  323. HAL_SET_FLD(desc, TCL_DATA_CMD_2, ADDRX_EN) |=
  324. HAL_TX_SM(TCL_DATA_CMD_2, ADDRX_EN, (flags & 0x1));
  325. HAL_SET_FLD(desc, TCL_DATA_CMD_2, ADDRY_EN) |=
  326. HAL_TX_SM(TCL_DATA_CMD_2, ADDRY_EN, (flags >> 1));
  327. }
  328. /**
  329. * hal_tx_desc_set_l4_checksum_en - Set TCP/IP checksum enable flags
  330. * Tx Descriptor for MSDU_buffer type
  331. * @desc: Handle to Tx Descriptor
  332. * @en: UDP/TCP over ipv4/ipv6 checksum enable flags (5 bits)
  333. *
  334. * Return: void
  335. */
  336. static inline void hal_tx_desc_set_l4_checksum_en(void *desc,
  337. uint8_t en)
  338. {
  339. HAL_SET_FLD(desc, TCL_DATA_CMD_3, IPV4_CHECKSUM_EN) |=
  340. (HAL_TX_SM(TCL_DATA_CMD_3, UDP_OVER_IPV4_CHECKSUM_EN, en) |
  341. HAL_TX_SM(TCL_DATA_CMD_3, UDP_OVER_IPV6_CHECKSUM_EN, en) |
  342. HAL_TX_SM(TCL_DATA_CMD_3, TCP_OVER_IPV4_CHECKSUM_EN, en) |
  343. HAL_TX_SM(TCL_DATA_CMD_3, TCP_OVER_IPV6_CHECKSUM_EN, en));
  344. }
  345. /**
  346. * hal_tx_desc_set_l3_checksum_en - Set IPv4 checksum enable flag in
  347. * Tx Descriptor for MSDU_buffer type
  348. * @desc: Handle to Tx Descriptor
  349. * @checksum_en_flags: ipv4 checksum enable flags
  350. *
  351. * Return: void
  352. */
  353. static inline void hal_tx_desc_set_l3_checksum_en(void *desc,
  354. uint8_t en)
  355. {
  356. HAL_SET_FLD(desc, TCL_DATA_CMD_3, IPV4_CHECKSUM_EN) |=
  357. HAL_TX_SM(TCL_DATA_CMD_3, IPV4_CHECKSUM_EN, en);
  358. }
  359. /**
  360. * hal_tx_desc_set_fw_metadata- Sets the metadata that is part of TCL descriptor
  361. * @desc:Handle to Tx Descriptor
  362. * @metadata: Metadata to be sent to Firmware
  363. *
  364. * Return: void
  365. */
  366. static inline void hal_tx_desc_set_fw_metadata(void *desc,
  367. uint16_t metadata)
  368. {
  369. HAL_SET_FLD(desc, TCL_DATA_CMD_2, TCL_CMD_NUMBER) |=
  370. HAL_TX_SM(TCL_DATA_CMD_2, TCL_CMD_NUMBER, metadata);
  371. }
  372. /**
  373. * hal_tx_desc_set_to_fw - Set To_FW bit in Tx Descriptor.
  374. * @desc:Handle to Tx Descriptor
  375. * @to_fw: if set, Forward packet to FW along with classification result
  376. *
  377. * Return: void
  378. */
  379. static inline void hal_tx_desc_set_to_fw(void *desc, uint8_t to_fw)
  380. {
  381. HAL_SET_FLD(desc, TCL_DATA_CMD_3, TO_FW) |=
  382. HAL_TX_SM(TCL_DATA_CMD_3, TO_FW, to_fw);
  383. }
  384. /**
  385. * hal_tx_desc_set_dscp_tid_table_id - Sets DSCP to TID conversion table ID
  386. * @desc: Handle to Tx Descriptor
  387. * @id: DSCP to tid conversion table to be used for this frame
  388. *
  389. * Return: void
  390. */
  391. static inline void hal_tx_desc_set_dscp_tid_table_id(void *desc,
  392. uint8_t id)
  393. {
  394. HAL_SET_FLD(desc, TCL_DATA_CMD_3,
  395. DSCP_TO_TID_PRIORITY_TABLE_ID) |=
  396. HAL_TX_SM(TCL_DATA_CMD_3,
  397. DSCP_TO_TID_PRIORITY_TABLE_ID, id);
  398. }
  399. /**
  400. * hal_tx_desc_set_mesh_en - Set mesh_enable flag in Tx descriptor
  401. * @desc: Handle to Tx Descriptor
  402. * @en: For raw WiFi frames, this indicates transmission to a mesh STA,
  403. * enabling the interpretation of the 'Mesh Control Present' bit
  404. * (bit 8) of QoS Control (otherwise this bit is ignored),
  405. * For native WiFi frames, this indicates that a 'Mesh Control' field
  406. * is present between the header and the LLC.
  407. *
  408. * Return: void
  409. */
  410. static inline void hal_tx_desc_set_mesh_en(void *desc, uint8_t en)
  411. {
  412. HAL_SET_FLD(desc, TCL_DATA_CMD_4, MESH_ENABLE) |=
  413. HAL_TX_SM(TCL_DATA_CMD_4, MESH_ENABLE, en);
  414. }
  415. /**
  416. * hal_tx_desc_set_hlos_tid - Set the TID value (override DSCP/PCP fields in
  417. * frame) to be used for Tx Frame
  418. * @desc: Handle to Tx Descriptor
  419. * @hlos_tid: HLOS TID
  420. *
  421. * Return: void
  422. */
  423. static inline void hal_tx_desc_set_hlos_tid(void *desc,
  424. uint8_t hlos_tid)
  425. {
  426. HAL_SET_FLD(desc, TCL_DATA_CMD_4, HLOS_TID) |=
  427. HAL_TX_SM(TCL_DATA_CMD_4, HLOS_TID, hlos_tid);
  428. HAL_SET_FLD(desc, TCL_DATA_CMD_4, HLOS_TID_OVERWRITE) |=
  429. HAL_TX_SM(TCL_DATA_CMD_4, HLOS_TID_OVERWRITE, 1);
  430. }
  431. /**
  432. * hal_tx_desc_sync - Commit the descriptor to Hardware
  433. * @hal_tx_des_cached: Cached descriptor that software maintains
  434. * @hw_desc: Hardware descriptor to be updated
  435. */
  436. static inline void hal_tx_desc_sync(void *hal_tx_desc_cached,
  437. void *hw_desc)
  438. {
  439. qdf_mem_copy((hw_desc + sizeof(struct tlv_32_hdr)),
  440. hal_tx_desc_cached, 20);
  441. }
  442. /*---------------------------------------------------------------------------
  443. Tx MSDU Extension Descriptor accessor APIs
  444. ---------------------------------------------------------------------------*/
  445. /**
  446. * hal_tx_ext_desc_set_tso_enable() - Set TSO Enable Flag
  447. * @desc: Handle to Tx MSDU Extension Descriptor
  448. * @tso_en: bool value set to true if TSO is enabled
  449. *
  450. * Return: none
  451. */
  452. static inline void hal_tx_ext_desc_set_tso_enable(void *desc,
  453. uint8_t tso_en)
  454. {
  455. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_0, TSO_ENABLE) |=
  456. HAL_TX_SM(TX_MSDU_EXTENSION_0, TSO_ENABLE, tso_en);
  457. }
  458. /**
  459. * hal_tx_ext_desc_set_checksum_en() - Enable HW Checksum offload
  460. * @desc: Handle to Tx MSDU Extension Descriptor
  461. * @en: Checksum offload enable
  462. *
  463. * Return: none
  464. */
  465. static inline void hal_tx_ext_desc_set_checksum_en(void *desc,
  466. uint8_t en)
  467. {
  468. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_0, IPV4_CHECKSUM_EN) |=
  469. ((HAL_TX_SM(TX_MSDU_EXTENSION_0, IPV4_CHECKSUM_EN, en)) |
  470. (HAL_TX_SM(TX_MSDU_EXTENSION_0, UDP_OVER_IPV4_CHECKSUM_EN, en)) |
  471. (HAL_TX_SM(TX_MSDU_EXTENSION_0, UDP_OVER_IPV6_CHECKSUM_EN, en)) |
  472. (HAL_TX_SM(TX_MSDU_EXTENSION_0, TCP_OVER_IPV4_CHECKSUM_EN, en)) |
  473. (HAL_TX_SM(TX_MSDU_EXTENSION_0, TCP_OVER_IPV6_CHECKSUM_EN, en)));
  474. }
  475. /**
  476. * hal_tx_ext_desc_set_tcp_flags() - Enable HW Checksum offload
  477. * @desc: Handle to Tx MSDU Extension Descriptor
  478. * @tcp_flags: TCP flags {NS,CWR,ECE,URG,ACK,PSH, RST ,SYN,FIN}
  479. * @mask: TCP flag mask. Tcp_flag is inserted into the header
  480. * based on the mask, if tso is enabled
  481. *
  482. * Return: none
  483. */
  484. static inline void hal_tx_ext_desc_set_tcp_flags(void *desc,
  485. uint16_t tcp_flags,
  486. uint16_t mask)
  487. {
  488. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_0, TCP_FLAG) |=
  489. ((HAL_TX_SM(TX_MSDU_EXTENSION_0, TCP_FLAG, tcp_flags)) |
  490. (HAL_TX_SM(TX_MSDU_EXTENSION_0, TCP_FLAG_MASK, mask)));
  491. }
  492. /**
  493. * hal_tx_ext_desc_set_msdu_length() - Set L2 and IP Lengths
  494. * @desc: Handle to Tx MSDU Extension Descriptor
  495. * @l2_len: L2 length for the msdu, if tso is enabled
  496. * @ip_len: IP length for the msdu, if tso is enabled
  497. *
  498. * Return: none
  499. */
  500. static inline void hal_tx_ext_desc_set_msdu_length(void *desc,
  501. uint16_t l2_len,
  502. uint16_t ip_len)
  503. {
  504. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_1, L2_LENGTH) |=
  505. ((HAL_TX_SM(TX_MSDU_EXTENSION_1, L2_LENGTH, l2_len)) |
  506. (HAL_TX_SM(TX_MSDU_EXTENSION_1, IP_LENGTH, ip_len)));
  507. }
  508. /**
  509. * hal_tx_ext_desc_set_tcp_seq() - Set TCP Sequence number
  510. * @desc: Handle to Tx MSDU Extension Descriptor
  511. * @seq_num: Tcp_seq_number for the msdu, if tso is enabled
  512. *
  513. * Return: none
  514. */
  515. static inline void hal_tx_ext_desc_set_tcp_seq(void *desc,
  516. uint32_t seq_num)
  517. {
  518. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_2, TCP_SEQ_NUMBER) |=
  519. ((HAL_TX_SM(TX_MSDU_EXTENSION_2, TCP_SEQ_NUMBER, seq_num)));
  520. }
  521. /**
  522. * hal_tx_ext_desc_set_buffer() - Set Buffer Pointer and Length for a fragment
  523. * @desc: Handle to Tx MSDU Extension Descriptor
  524. * @frag_num: Fragment number (value can be 0 to 5)
  525. * @paddr_lo: Lower 32-bit of Buffer Physical address
  526. * @paddr_hi: Upper 32-bit of Buffer Physical address
  527. * @length: Buffer Length
  528. *
  529. * Return: none
  530. */
  531. static inline void hal_tx_ext_desc_set_buffer(void *desc,
  532. uint8_t frag_num,
  533. uint32_t paddr_lo,
  534. uint16_t paddr_hi,
  535. uint16_t length)
  536. {
  537. HAL_SET_FLD_OFFSET(desc, TX_MSDU_EXTENSION_6, BUF0_PTR_31_0,
  538. (frag_num << 3)) |=
  539. ((HAL_TX_SM(TX_MSDU_EXTENSION_6, BUF0_PTR_31_0, paddr_lo)));
  540. HAL_SET_FLD_OFFSET(desc, TX_MSDU_EXTENSION_7, BUF0_PTR_39_32,
  541. (frag_num << 3)) |=
  542. ((HAL_TX_SM(TX_MSDU_EXTENSION_7, BUF0_PTR_39_32,
  543. (paddr_hi))));
  544. HAL_SET_FLD_OFFSET(desc, TX_MSDU_EXTENSION_7, BUF0_LEN,
  545. (frag_num << 3)) |=
  546. ((HAL_TX_SM(TX_MSDU_EXTENSION_7, BUF0_LEN, length)));
  547. }
  548. /**
  549. * hal_tx_ext_desc_set_buffer0_param() - Set Buffer 0 Pointer and Length
  550. * @desc: Handle to Tx MSDU Extension Descriptor
  551. * @paddr_lo: Lower 32-bit of Buffer Physical address
  552. * @paddr_hi: Upper 32-bit of Buffer Physical address
  553. * @length: Buffer 0 Length
  554. *
  555. * Return: none
  556. */
  557. static inline void hal_tx_ext_desc_set_buffer0_param(void *desc,
  558. uint32_t paddr_lo,
  559. uint16_t paddr_hi,
  560. uint16_t length)
  561. {
  562. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_6, BUF0_PTR_31_0) |=
  563. ((HAL_TX_SM(TX_MSDU_EXTENSION_6, BUF0_PTR_31_0, paddr_lo)));
  564. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_7, BUF0_PTR_39_32) |=
  565. ((HAL_TX_SM(TX_MSDU_EXTENSION_7,
  566. BUF0_PTR_39_32, paddr_hi)));
  567. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_7, BUF0_LEN) |=
  568. ((HAL_TX_SM(TX_MSDU_EXTENSION_7, BUF0_LEN, length)));
  569. }
  570. /**
  571. * hal_tx_ext_desc_set_buffer1_param() - Set Buffer 1 Pointer and Length
  572. * @desc: Handle to Tx MSDU Extension Descriptor
  573. * @paddr_lo: Lower 32-bit of Buffer Physical address
  574. * @paddr_hi: Upper 32-bit of Buffer Physical address
  575. * @length: Buffer 1 Length
  576. *
  577. * Return: none
  578. */
  579. static inline void hal_tx_ext_desc_set_buffer1_param(void *desc,
  580. uint32_t paddr_lo,
  581. uint16_t paddr_hi,
  582. uint16_t length)
  583. {
  584. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_8, BUF1_PTR_31_0) |=
  585. ((HAL_TX_SM(TX_MSDU_EXTENSION_8, BUF1_PTR_31_0, paddr_lo)));
  586. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_9, BUF1_PTR_39_32) |=
  587. ((HAL_TX_SM(TX_MSDU_EXTENSION_9,
  588. BUF1_PTR_39_32, paddr_hi)));
  589. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_9, BUF1_LEN) |=
  590. ((HAL_TX_SM(TX_MSDU_EXTENSION_9, BUF1_LEN, length)));
  591. }
  592. /**
  593. * hal_tx_ext_desc_set_buffer2_param() - Set Buffer 2 Pointer and Length
  594. * @desc: Handle to Tx MSDU Extension Descriptor
  595. * @paddr_lo: Lower 32-bit of Buffer Physical address
  596. * @paddr_hi: Upper 32-bit of Buffer Physical address
  597. * @length: Buffer 2 Length
  598. *
  599. * Return: none
  600. */
  601. static inline void hal_tx_ext_desc_set_buffer2_param(void *desc,
  602. uint32_t paddr_lo,
  603. uint16_t paddr_hi,
  604. uint16_t length)
  605. {
  606. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_10, BUF2_PTR_31_0) |=
  607. ((HAL_TX_SM(TX_MSDU_EXTENSION_10, BUF2_PTR_31_0,
  608. paddr_lo)));
  609. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_11, BUF2_PTR_39_32) |=
  610. ((HAL_TX_SM(TX_MSDU_EXTENSION_11, BUF2_PTR_39_32,
  611. paddr_hi)));
  612. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_11, BUF2_LEN) |=
  613. ((HAL_TX_SM(TX_MSDU_EXTENSION_11, BUF2_LEN, length)));
  614. }
  615. /**
  616. * hal_tx_ext_desc_sync - Commit the descriptor to Hardware
  617. * @desc_cached: Cached descriptor that software maintains
  618. * @hw_desc: Hardware descriptor to be updated
  619. *
  620. * Return: none
  621. */
  622. static inline void hal_tx_ext_desc_sync(uint8_t *desc_cached,
  623. uint8_t *hw_desc)
  624. {
  625. qdf_mem_copy(&hw_desc[0], &desc_cached[0],
  626. HAL_TX_EXTENSION_DESC_LEN_BYTES);
  627. }
  628. /**
  629. * hal_tx_ext_desc_get_tso_enable() - Set TSO Enable Flag
  630. * @hal_tx_ext_desc: Handle to Tx MSDU Extension Descriptor
  631. *
  632. * Return: tso_enable value in the descriptor
  633. */
  634. static inline uint32_t hal_tx_ext_desc_get_tso_enable(void *hal_tx_ext_desc)
  635. {
  636. uint32_t *desc = (uint32_t *) hal_tx_ext_desc;
  637. return (*desc & TX_MSDU_EXTENSION_0_TSO_ENABLE_MASK) >>
  638. TX_MSDU_EXTENSION_0_TSO_ENABLE_LSB;
  639. }
  640. /*---------------------------------------------------------------------------
  641. WBM Descriptor accessor APIs for Tx completions
  642. ---------------------------------------------------------------------------*/
  643. /**
  644. * hal_tx_comp_get_desc_id() - Get TX descriptor id within comp descriptor
  645. * @hal_desc: completion ring descriptor pointer
  646. *
  647. * This function will tx descriptor id, cookie, within hardware completion
  648. * descriptor
  649. *
  650. * Return: cookie
  651. */
  652. static inline uint32_t hal_tx_comp_get_desc_id(void *hal_desc)
  653. {
  654. uint32_t comp_desc =
  655. *(uint32_t *) (((uint8_t *) hal_desc) +
  656. BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET);
  657. /* Cookie is placed on 2nd word */
  658. return (comp_desc & BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_MASK) >>
  659. BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_LSB;
  660. }
  661. /**
  662. * hal_tx_comp_get_paddr() - Get paddr within comp descriptor
  663. * @hal_desc: completion ring descriptor pointer
  664. *
  665. * This function will get buffer physical address within hardware completion
  666. * descriptor
  667. *
  668. * Return: Buffer physical address
  669. */
  670. static inline qdf_dma_addr_t hal_tx_comp_get_paddr(void *hal_desc)
  671. {
  672. uint32_t paddr_lo;
  673. uint32_t paddr_hi;
  674. paddr_lo = *(uint32_t *) (((uint8_t *) hal_desc) +
  675. BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_OFFSET);
  676. paddr_hi = *(uint32_t *) (((uint8_t *) hal_desc) +
  677. BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_OFFSET);
  678. paddr_hi = (paddr_hi & BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_MASK) >>
  679. BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_LSB;
  680. return (qdf_dma_addr_t) (paddr_lo | (((uint64_t) paddr_hi) << 32));
  681. }
  682. /**
  683. * hal_tx_comp_get_buffer_source() - Get buffer release source value
  684. * @hal_desc: completion ring descriptor pointer
  685. *
  686. * This function will get buffer release source from Tx completion descriptor
  687. *
  688. * Return: buffer release source
  689. */
  690. static inline uint32_t hal_tx_comp_get_buffer_source(void *hal_desc)
  691. {
  692. uint32_t comp_desc =
  693. *(uint32_t *) (((uint8_t *) hal_desc) +
  694. WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_OFFSET);
  695. return (comp_desc & WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_MASK) >>
  696. WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_LSB;
  697. }
  698. /**
  699. * hal_tx_comp_get_buffer_type() - Buffer or Descriptor type
  700. * @hal_desc: completion ring descriptor pointer
  701. *
  702. * This function will return the type of pointer - buffer or descriptor
  703. *
  704. * Return: buffer type
  705. */
  706. static inline uint32_t hal_tx_comp_get_buffer_type(void *hal_desc)
  707. {
  708. uint32_t comp_desc =
  709. *(uint32_t *) (((uint8_t *) hal_desc) +
  710. WBM_RELEASE_RING_2_BUFFER_OR_DESC_TYPE_OFFSET);
  711. return (comp_desc & WBM_RELEASE_RING_2_BUFFER_OR_DESC_TYPE_MASK) >>
  712. WBM_RELEASE_RING_2_BUFFER_OR_DESC_TYPE_LSB;
  713. }
  714. /**
  715. * hal_tx_comp_get_release_reason() - TQM Release reason
  716. * @hal_desc: completion ring descriptor pointer
  717. *
  718. * This function will return the type of pointer - buffer or descriptor
  719. *
  720. * Return: buffer type
  721. */
  722. static inline uint8_t hal_tx_comp_get_release_reason(void *hal_desc)
  723. {
  724. uint32_t comp_desc =
  725. *(uint32_t *) (((uint8_t *) hal_desc) +
  726. WBM_RELEASE_RING_2_TQM_RELEASE_REASON_OFFSET);
  727. return (comp_desc & WBM_RELEASE_RING_2_TQM_RELEASE_REASON_MASK) >>
  728. WBM_RELEASE_RING_2_TQM_RELEASE_REASON_LSB;
  729. }
  730. /**
  731. * hal_tx_comp_desc_sync() - collect hardware descriptor contents
  732. * @hal_desc: hardware descriptor pointer
  733. * @comp: software descriptor pointer
  734. * @read_status: 0 - Do not read status words from descriptors
  735. * 1 - Enable reading of status words from descriptor
  736. *
  737. * This function will collect hardware release ring element contents and
  738. * translate to software descriptor content
  739. *
  740. * Return: none
  741. */
  742. static inline void hal_tx_comp_desc_sync(void *hw_desc,
  743. struct hal_tx_desc_comp_s *comp,
  744. bool read_status)
  745. {
  746. if (!read_status)
  747. qdf_mem_copy(comp, hw_desc, HAL_TX_COMPLETION_DESC_BASE_LEN);
  748. else
  749. qdf_mem_copy(comp, hw_desc, HAL_TX_COMPLETION_DESC_LEN_BYTES);
  750. }
  751. /**
  752. * hal_tx_comp_get_htt_desc() - Read the HTT portion of WBM Descriptor
  753. * @hal_desc: Hardware (WBM) descriptor pointer
  754. * @htt_desc: Software HTT descriptor pointer
  755. *
  756. * This function will read the HTT structure overlaid on WBM descriptor
  757. * into a cached software descriptor
  758. *
  759. */
  760. static inline void hal_tx_comp_get_htt_desc(void *hw_desc, uint8_t *htt_desc)
  761. {
  762. uint8_t *desc = hw_desc + HAL_TX_COMP_HTT_STATUS_OFFSET;
  763. qdf_mem_copy(htt_desc, desc, HAL_TX_COMP_HTT_STATUS_LEN);
  764. }
  765. /**
  766. * hal_tx_set_dscp_tid_map_default() - Configure default DSCP to TID map table
  767. * @soc: HAL SoC context
  768. * @map: DSCP-TID mapping table
  769. * @id: mapping table ID - 0,1
  770. *
  771. * DSCP are mapped to 8 TID values using TID values programmed
  772. * in two set of mapping registers DSCP_TID1_MAP_<0 to 6> (id = 0)
  773. * and DSCP_TID2_MAP_<0 to 6> (id = 1)
  774. * Each mapping register has TID mapping for 10 DSCP values
  775. *
  776. * Return: none
  777. */
  778. static inline void hal_tx_set_dscp_tid_map(void *hal_soc, uint8_t *map,
  779. uint8_t id)
  780. {
  781. int i;
  782. uint32_t addr;
  783. uint32_t value;
  784. struct hal_soc *soc = (struct hal_soc *)hal_soc;
  785. if (id == HAL_TX_DSCP_TID_MAP_TABLE_DEFAULT) {
  786. addr =
  787. HWIO_TCL_R0_DSCP_TID1_MAP_0_ADDR(
  788. SEQ_WCSS_UMAC_MAC_TCL_REG_OFFSET);
  789. } else {
  790. addr =
  791. HWIO_TCL_R0_DSCP_TID2_MAP_0_ADDR(
  792. SEQ_WCSS_UMAC_MAC_TCL_REG_OFFSET);
  793. }
  794. for (i = 0; i < 64; i += 10) {
  795. value = (map[i] |
  796. (map[i+1] << HWIO_TCL_R0_DSCP_TID1_MAP_0_DSCP_1_SHFT) |
  797. (map[i+2] << HWIO_TCL_R0_DSCP_TID1_MAP_0_DSCP_2_SHFT) |
  798. (map[i+3] << HWIO_TCL_R0_DSCP_TID1_MAP_0_DSCP_3_SHFT) |
  799. (map[i+4] << HWIO_TCL_R0_DSCP_TID1_MAP_0_DSCP_4_SHFT) |
  800. (map[i+5] << HWIO_TCL_R0_DSCP_TID1_MAP_0_DSCP_5_SHFT) |
  801. (map[i+6] << HWIO_TCL_R0_DSCP_TID1_MAP_0_DSCP_6_SHFT) |
  802. (map[i+7] << HWIO_TCL_R0_DSCP_TID1_MAP_0_DSCP_7_SHFT) |
  803. (map[i+8] << HWIO_TCL_R0_DSCP_TID1_MAP_0_DSCP_8_SHFT) |
  804. (map[i+9] << HWIO_TCL_R0_DSCP_TID1_MAP_0_DSCP_9_SHFT));
  805. HAL_REG_WRITE(soc, addr,
  806. (value & HWIO_TCL_R0_DSCP_TID1_MAP_1_RMSK));
  807. addr += 4;
  808. }
  809. }
  810. /**
  811. * hal_tx_init_data_ring() - Initialize all the TCL Descriptors in SRNG
  812. * @hal_soc: Handle to HAL SoC structure
  813. * @hal_srng: Handle to HAL SRNG structure
  814. *
  815. * Return: none
  816. */
  817. static inline void hal_tx_init_data_ring(void *hal_soc, void *hal_srng)
  818. {
  819. uint8_t *desc_addr;
  820. struct hal_srng_params srng_params;
  821. uint32_t desc_size;
  822. uint32_t num_desc;
  823. hal_get_srng_params(hal_soc, hal_srng, &srng_params);
  824. desc_addr = (uint8_t *) srng_params.ring_base_vaddr;
  825. desc_size = sizeof(struct tcl_data_cmd);
  826. num_desc = srng_params.num_entries;
  827. while (num_desc) {
  828. HAL_TX_DESC_SET_TLV_HDR(desc_addr, HAL_TX_TCL_DATA_TAG,
  829. desc_size);
  830. desc_addr += (desc_size + sizeof(struct tlv_32_hdr));
  831. num_desc--;
  832. }
  833. }
  834. #endif /* HAL_TX_H */