hal_tx.h 31 KB

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