hal_tx.h 32 KB

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