hal_tx.h 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  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_dump_comp_desc() - dump tx completion descriptor
  737. * @hal_desc: hardware descriptor pointer
  738. *
  739. * This function will print tx completion descriptor
  740. *
  741. * Return: none
  742. */
  743. static inline void hal_dump_comp_desc(void *hw_desc)
  744. {
  745. struct hal_tx_desc_comp_s *comp =
  746. (struct hal_tx_desc_comp_s *)hw_desc;
  747. uint32_t i;
  748. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_FATAL,
  749. "Current tx completion descriptor is");
  750. for (i = 0; i < HAL_TX_COMPLETION_DESC_LEN_DWORDS; i++) {
  751. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_FATAL,
  752. "DWORD[i] = 0x%x", comp->desc[i]);
  753. }
  754. }
  755. /**
  756. * hal_tx_comp_get_htt_desc() - Read the HTT portion of WBM Descriptor
  757. * @hal_desc: Hardware (WBM) descriptor pointer
  758. * @htt_desc: Software HTT descriptor pointer
  759. *
  760. * This function will read the HTT structure overlaid on WBM descriptor
  761. * into a cached software descriptor
  762. *
  763. */
  764. static inline void hal_tx_comp_get_htt_desc(void *hw_desc, uint8_t *htt_desc)
  765. {
  766. uint8_t *desc = hw_desc + HAL_TX_COMP_HTT_STATUS_OFFSET;
  767. qdf_mem_copy(htt_desc, desc, HAL_TX_COMP_HTT_STATUS_LEN);
  768. }
  769. /**
  770. * hal_tx_init_data_ring() - Initialize all the TCL Descriptors in SRNG
  771. * @hal_soc: Handle to HAL SoC structure
  772. * @hal_srng: Handle to HAL SRNG structure
  773. *
  774. * Return: none
  775. */
  776. static inline void hal_tx_init_data_ring(void *hal_soc, void *hal_srng)
  777. {
  778. uint8_t *desc_addr;
  779. struct hal_srng_params srng_params;
  780. uint32_t desc_size;
  781. uint32_t num_desc;
  782. hal_get_srng_params(hal_soc, hal_srng, &srng_params);
  783. desc_addr = (uint8_t *)srng_params.ring_base_vaddr;
  784. desc_size = sizeof(struct tcl_data_cmd);
  785. num_desc = srng_params.num_entries;
  786. while (num_desc) {
  787. HAL_TX_DESC_SET_TLV_HDR(desc_addr, HAL_TX_TCL_DATA_TAG,
  788. desc_size);
  789. desc_addr += (desc_size + sizeof(struct tlv_32_hdr));
  790. num_desc--;
  791. }
  792. }
  793. /**
  794. * hal_tx_desc_set_dscp_tid_table_id() - Sets DSCP to TID conversion table ID
  795. * @hal_soc: Handle to HAL SoC structure
  796. * @desc: Handle to Tx Descriptor
  797. * @id: DSCP to tid conversion table to be used for this frame
  798. *
  799. * Return: void
  800. */
  801. static inline void hal_tx_desc_set_dscp_tid_table_id(struct hal_soc *hal_soc,
  802. void *desc, uint8_t id)
  803. {
  804. hal_soc->ops->hal_tx_desc_set_dscp_tid_table_id(desc, id);
  805. }
  806. /**
  807. * hal_tx_set_dscp_tid_map_default() - Configure default DSCP to TID map table
  808. *
  809. * @soc: HAL SoC context
  810. * @map: DSCP-TID mapping table
  811. * @id: mapping table ID - 0,1
  812. *
  813. * Return: void
  814. */
  815. static inline void hal_tx_set_dscp_tid_map(struct hal_soc *hal_soc,
  816. uint8_t *map, uint8_t id)
  817. {
  818. hal_soc->ops->hal_tx_set_dscp_tid_map(hal_soc, map, id);
  819. }
  820. /**
  821. * hal_tx_update_dscp_tid() - Update the dscp tid map table as updated by user
  822. *
  823. * @soc: HAL SoC context
  824. * @map: DSCP-TID mapping table
  825. * @id : MAP ID
  826. * @dscp: DSCP_TID map index
  827. *
  828. * Return: void
  829. */
  830. static inline void hal_tx_update_dscp_tid(struct hal_soc *hal_soc, uint8_t tid,
  831. uint8_t id, uint8_t dscp)
  832. {
  833. hal_soc->ops->hal_tx_update_dscp_tid(hal_soc, tid, id, dscp);
  834. }
  835. /**
  836. * hal_tx_desc_set_lmac_id - Set the lmac_id value
  837. * @desc: Handle to Tx Descriptor
  838. * @lmac_id: mac Id to ast matching
  839. * b00 – mac 0
  840. * b01 – mac 1
  841. * b10 – mac 2
  842. * b11 – all macs (legacy HK way)
  843. *
  844. * Return: void
  845. */
  846. static inline void hal_tx_desc_set_lmac_id(struct hal_soc *hal_soc,
  847. void *desc, uint8_t lmac_id)
  848. {
  849. hal_soc->ops->hal_tx_desc_set_lmac_id(desc, lmac_id);
  850. }
  851. /**
  852. * hal_tx_desc_set_search_type - Set the search type value
  853. * @desc: Handle to Tx Descriptor
  854. * @search_type: search type
  855. * 0 – Normal search
  856. * 1 – Index based address search
  857. * 2 – Index based flow search
  858. *
  859. * Return: void
  860. */
  861. static inline void hal_tx_desc_set_search_type(struct hal_soc *hal_soc,
  862. void *desc, uint8_t search_type)
  863. {
  864. hal_soc->ops->hal_tx_desc_set_search_type(desc, search_type);
  865. }
  866. /**
  867. * hal_tx_desc_set_search_index - Set the search index value
  868. * @desc: Handle to Tx Descriptor
  869. * @search_index: The index that will be used for index based address or
  870. * flow search. The field is valid when 'search_type' is
  871. * 1 0r 2
  872. *
  873. * Return: void
  874. */
  875. static inline void hal_tx_desc_set_search_index(struct hal_soc *hal_soc,
  876. void *desc,
  877. uint32_t search_index)
  878. {
  879. hal_soc->ops->hal_tx_desc_set_search_index(desc, search_index);
  880. }
  881. /**
  882. * hal_tx_comp_get_status() - TQM Release reason
  883. * @hal_desc: completion ring Tx status
  884. *
  885. * This function will parse the WBM completion descriptor and populate in
  886. * HAL structure
  887. *
  888. * Return: none
  889. */
  890. static inline void hal_tx_comp_get_status(void *desc, void *ts, void *hal)
  891. {
  892. struct hal_soc *hal_soc = hal;
  893. hal_soc->ops->hal_tx_comp_get_status(desc, ts, hal);
  894. }
  895. /**
  896. * hal_tx_desc_set_buf_addr - Fill Buffer Address information in Tx Descriptor
  897. * @desc: Handle to Tx Descriptor
  898. * @paddr: Physical Address
  899. * @pool_id: Return Buffer Manager ID
  900. * @desc_id: Descriptor ID
  901. * @type: 0 - Address points to a MSDU buffer
  902. * 1 - Address points to MSDU extension descriptor
  903. *
  904. * Return: void
  905. */
  906. static inline void hal_tx_desc_set_buf_addr(void *desc, dma_addr_t paddr,
  907. uint8_t pool_id, uint32_t desc_id, uint8_t type, void *hal)
  908. {
  909. struct hal_soc *hal_soc = hal;
  910. hal_soc->ops->hal_tx_desc_set_buf_addr(desc, paddr, pool_id,
  911. desc_id, type);
  912. }
  913. /**
  914. * hal_tx_set_pcp_tid_map_default() - Configure default PCP to TID map table
  915. *
  916. * @soc: HAL SoC context
  917. * @map: PCP-TID mapping table
  918. *
  919. * Return: void
  920. */
  921. static inline void hal_tx_set_pcp_tid_map_default(struct hal_soc *hal_soc,
  922. uint8_t *map)
  923. {
  924. hal_soc->ops->hal_tx_set_pcp_tid_map(hal_soc, map);
  925. }
  926. /**
  927. * hal_tx_update_pcp_tid_map() - Update PCP to TID map table
  928. *
  929. * @soc: HAL SoC context
  930. * @pcp: pcp value
  931. * @tid: tid no
  932. *
  933. * Return: void
  934. */
  935. static inline void hal_tx_update_pcp_tid_map(struct hal_soc *hal_soc,
  936. uint8_t pcp, uint8_t tid)
  937. {
  938. hal_soc->ops->hal_tx_update_pcp_tid_map(hal_soc, tid, tid);
  939. }
  940. /**
  941. * hal_tx_set_tidmap_prty() - Configure TIDmap priority
  942. *
  943. * @soc: HAL SoC context
  944. * @val: priority value
  945. *
  946. * Return: void
  947. */
  948. static inline void hal_tx_set_tidmap_prty(struct hal_soc *hal_soc, uint8_t val)
  949. {
  950. hal_soc->ops->hal_tx_set_tidmap_prty(hal_soc, val);
  951. }
  952. #endif /* HAL_TX_H */