hal_tx.h 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090
  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. * @HAL_TX_TQM_RR_REM_CMD_DISABLE_QUEUE : Remove command where fw indicated that
  228. * remove reason is remove disable queue
  229. */
  230. enum hal_tx_tqm_release_reason {
  231. HAL_TX_TQM_RR_FRAME_ACKED,
  232. HAL_TX_TQM_RR_REM_CMD_REM,
  233. HAL_TX_TQM_RR_REM_CMD_TX,
  234. HAL_TX_TQM_RR_REM_CMD_NOTX,
  235. HAL_TX_TQM_RR_REM_CMD_AGED,
  236. HAL_TX_TQM_RR_FW_REASON1,
  237. HAL_TX_TQM_RR_FW_REASON2,
  238. HAL_TX_TQM_RR_FW_REASON3,
  239. HAL_TX_TQM_RR_REM_CMD_DISABLE_QUEUE,
  240. };
  241. /* enum - Table IDs for 2 DSCP-TID mapping Tables that TCL H/W supports
  242. * @HAL_TX_DSCP_TID_MAP_TABLE_DEFAULT: Default DSCP-TID mapping table
  243. * @HAL_TX_DSCP_TID_MAP_TABLE_OVERRIDE: DSCP-TID map override table
  244. */
  245. enum hal_tx_dscp_tid_table_id {
  246. HAL_TX_DSCP_TID_MAP_TABLE_DEFAULT,
  247. HAL_TX_DSCP_TID_MAP_TABLE_OVERRIDE,
  248. };
  249. /*---------------------------------------------------------------------------
  250. Function declarations and documentation
  251. ---------------------------------------------------------------------------*/
  252. /*---------------------------------------------------------------------------
  253. TCL Descriptor accessor APIs
  254. ---------------------------------------------------------------------------*/
  255. /**
  256. * hal_tx_desc_set_buf_length - Set Data length in bytes in Tx Descriptor
  257. * @desc: Handle to Tx Descriptor
  258. * @data_length: MSDU length in case of direct descriptor.
  259. * Length of link extension descriptor in case of Link extension
  260. * descriptor.Includes the length of Metadata
  261. * Return: None
  262. */
  263. static inline void hal_tx_desc_set_buf_length(void *desc,
  264. uint16_t data_length)
  265. {
  266. HAL_SET_FLD(desc, TCL_DATA_CMD_3, DATA_LENGTH) |=
  267. HAL_TX_SM(TCL_DATA_CMD_3, DATA_LENGTH, data_length);
  268. }
  269. /**
  270. * hal_tx_desc_set_buf_offset - Sets Packet Offset field in Tx descriptor
  271. * @desc: Handle to Tx Descriptor
  272. * @offset: Packet offset from Metadata in case of direct buffer descriptor.
  273. *
  274. * Return: void
  275. */
  276. static inline void hal_tx_desc_set_buf_offset(void *desc,
  277. uint8_t offset)
  278. {
  279. HAL_SET_FLD(desc, TCL_DATA_CMD_3, PACKET_OFFSET) |=
  280. HAL_TX_SM(TCL_DATA_CMD_3, PACKET_OFFSET, offset);
  281. }
  282. /**
  283. * hal_tx_desc_set_encap_type - Set encapsulation type in Tx Descriptor
  284. * @desc: Handle to Tx Descriptor
  285. * @encap_type: Encapsulation that HW will perform
  286. *
  287. * Return: void
  288. *
  289. */
  290. static inline void hal_tx_desc_set_encap_type(void *desc,
  291. enum hal_tx_encap_type encap_type)
  292. {
  293. HAL_SET_FLD(desc, TCL_DATA_CMD_2, ENCAP_TYPE) |=
  294. HAL_TX_SM(TCL_DATA_CMD_2, ENCAP_TYPE, encap_type);
  295. }
  296. /**
  297. * hal_tx_desc_set_encrypt_type - Sets the Encrypt Type in Tx Descriptor
  298. * @desc: Handle to Tx Descriptor
  299. * @type: Encrypt Type
  300. *
  301. * Return: void
  302. */
  303. static inline void hal_tx_desc_set_encrypt_type(void *desc,
  304. enum hal_tx_encrypt_type type)
  305. {
  306. HAL_SET_FLD(desc, TCL_DATA_CMD_2, ENCRYPT_TYPE) |=
  307. HAL_TX_SM(TCL_DATA_CMD_2, ENCRYPT_TYPE, type);
  308. }
  309. /**
  310. * hal_tx_desc_set_addr_search_flags - Enable AddrX and AddrY search flags
  311. * @desc: Handle to Tx Descriptor
  312. * @flags: Bit 0 - AddrY search enable, Bit 1 - AddrX search enable
  313. *
  314. * Return: void
  315. */
  316. static inline void hal_tx_desc_set_addr_search_flags(void *desc,
  317. uint8_t flags)
  318. {
  319. HAL_SET_FLD(desc, TCL_DATA_CMD_2, ADDRX_EN) |=
  320. HAL_TX_SM(TCL_DATA_CMD_2, ADDRX_EN, (flags & 0x1));
  321. HAL_SET_FLD(desc, TCL_DATA_CMD_2, ADDRY_EN) |=
  322. HAL_TX_SM(TCL_DATA_CMD_2, ADDRY_EN, (flags >> 1));
  323. }
  324. /**
  325. * hal_tx_desc_set_l4_checksum_en - Set TCP/IP checksum enable flags
  326. * Tx Descriptor for MSDU_buffer type
  327. * @desc: Handle to Tx Descriptor
  328. * @en: UDP/TCP over ipv4/ipv6 checksum enable flags (5 bits)
  329. *
  330. * Return: void
  331. */
  332. static inline void hal_tx_desc_set_l4_checksum_en(void *desc,
  333. uint8_t en)
  334. {
  335. HAL_SET_FLD(desc, TCL_DATA_CMD_3, IPV4_CHECKSUM_EN) |=
  336. (HAL_TX_SM(TCL_DATA_CMD_3, UDP_OVER_IPV4_CHECKSUM_EN, en) |
  337. HAL_TX_SM(TCL_DATA_CMD_3, UDP_OVER_IPV6_CHECKSUM_EN, en) |
  338. HAL_TX_SM(TCL_DATA_CMD_3, TCP_OVER_IPV4_CHECKSUM_EN, en) |
  339. HAL_TX_SM(TCL_DATA_CMD_3, TCP_OVER_IPV6_CHECKSUM_EN, en));
  340. }
  341. /**
  342. * hal_tx_desc_set_l3_checksum_en - Set IPv4 checksum enable flag in
  343. * Tx Descriptor for MSDU_buffer type
  344. * @desc: Handle to Tx Descriptor
  345. * @checksum_en_flags: ipv4 checksum enable flags
  346. *
  347. * Return: void
  348. */
  349. static inline void hal_tx_desc_set_l3_checksum_en(void *desc,
  350. uint8_t en)
  351. {
  352. HAL_SET_FLD(desc, TCL_DATA_CMD_3, IPV4_CHECKSUM_EN) |=
  353. HAL_TX_SM(TCL_DATA_CMD_3, IPV4_CHECKSUM_EN, en);
  354. }
  355. /**
  356. * hal_tx_desc_set_fw_metadata- Sets the metadata that is part of TCL descriptor
  357. * @desc:Handle to Tx Descriptor
  358. * @metadata: Metadata to be sent to Firmware
  359. *
  360. * Return: void
  361. */
  362. static inline void hal_tx_desc_set_fw_metadata(void *desc,
  363. uint16_t metadata)
  364. {
  365. HAL_SET_FLD(desc, TCL_DATA_CMD_2, TCL_CMD_NUMBER) |=
  366. HAL_TX_SM(TCL_DATA_CMD_2, TCL_CMD_NUMBER, metadata);
  367. }
  368. /**
  369. * hal_tx_desc_set_to_fw - Set To_FW bit in Tx Descriptor.
  370. * @desc:Handle to Tx Descriptor
  371. * @to_fw: if set, Forward packet to FW along with classification result
  372. *
  373. * Return: void
  374. */
  375. static inline void hal_tx_desc_set_to_fw(void *desc, uint8_t to_fw)
  376. {
  377. HAL_SET_FLD(desc, TCL_DATA_CMD_3, TO_FW) |=
  378. HAL_TX_SM(TCL_DATA_CMD_3, TO_FW, to_fw);
  379. }
  380. /**
  381. * hal_tx_desc_set_mesh_en - Set mesh_enable flag in Tx descriptor
  382. * @desc: Handle to Tx Descriptor
  383. * @en: For raw WiFi frames, this indicates transmission to a mesh STA,
  384. * enabling the interpretation of the 'Mesh Control Present' bit
  385. * (bit 8) of QoS Control (otherwise this bit is ignored),
  386. * For native WiFi frames, this indicates that a 'Mesh Control' field
  387. * is present between the header and the LLC.
  388. *
  389. * Return: void
  390. */
  391. static inline void hal_tx_desc_set_mesh_en(void *desc, uint8_t en)
  392. {
  393. HAL_SET_FLD(desc, TCL_DATA_CMD_4, MESH_ENABLE) |=
  394. HAL_TX_SM(TCL_DATA_CMD_4, MESH_ENABLE, en);
  395. }
  396. /**
  397. * hal_tx_desc_set_hlos_tid - Set the TID value (override DSCP/PCP fields in
  398. * frame) to be used for Tx Frame
  399. * @desc: Handle to Tx Descriptor
  400. * @hlos_tid: HLOS TID
  401. *
  402. * Return: void
  403. */
  404. static inline void hal_tx_desc_set_hlos_tid(void *desc,
  405. uint8_t hlos_tid)
  406. {
  407. HAL_SET_FLD(desc, TCL_DATA_CMD_4, HLOS_TID) |=
  408. HAL_TX_SM(TCL_DATA_CMD_4, HLOS_TID, hlos_tid);
  409. HAL_SET_FLD(desc, TCL_DATA_CMD_4, HLOS_TID_OVERWRITE) |=
  410. HAL_TX_SM(TCL_DATA_CMD_4, HLOS_TID_OVERWRITE, 1);
  411. }
  412. /**
  413. * hal_tx_desc_sync - Commit the descriptor to Hardware
  414. * @hal_tx_des_cached: Cached descriptor that software maintains
  415. * @hw_desc: Hardware descriptor to be updated
  416. */
  417. static inline void hal_tx_desc_sync(void *hal_tx_desc_cached,
  418. void *hw_desc)
  419. {
  420. qdf_mem_copy((hw_desc + sizeof(struct tlv_32_hdr)),
  421. hal_tx_desc_cached, HAL_TX_DESC_LEN_BYTES);
  422. }
  423. /*---------------------------------------------------------------------------
  424. Tx MSDU Extension Descriptor accessor APIs
  425. ---------------------------------------------------------------------------*/
  426. /**
  427. * hal_tx_ext_desc_set_tso_enable() - Set TSO Enable Flag
  428. * @desc: Handle to Tx MSDU Extension Descriptor
  429. * @tso_en: bool value set to true if TSO is enabled
  430. *
  431. * Return: none
  432. */
  433. static inline void hal_tx_ext_desc_set_tso_enable(void *desc,
  434. uint8_t tso_en)
  435. {
  436. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_0, TSO_ENABLE) |=
  437. HAL_TX_SM(TX_MSDU_EXTENSION_0, TSO_ENABLE, tso_en);
  438. }
  439. /**
  440. * hal_tx_ext_desc_set_tso_flags() - Set TSO Flags
  441. * @desc: Handle to Tx MSDU Extension Descriptor
  442. * @falgs: 32-bit word with all TSO flags consolidated
  443. *
  444. * Return: none
  445. */
  446. static inline void hal_tx_ext_desc_set_tso_flags(void *desc,
  447. uint32_t tso_flags)
  448. {
  449. HAL_SET_FLD_OFFSET(desc, TX_MSDU_EXTENSION_0, TSO_ENABLE, 0) =
  450. tso_flags;
  451. }
  452. /**
  453. * hal_tx_ext_desc_set_tcp_flags() - Enable HW Checksum offload
  454. * @desc: Handle to Tx MSDU Extension Descriptor
  455. * @tcp_flags: TCP flags {NS,CWR,ECE,URG,ACK,PSH, RST ,SYN,FIN}
  456. * @mask: TCP flag mask. Tcp_flag is inserted into the header
  457. * based on the mask, if tso is enabled
  458. *
  459. * Return: none
  460. */
  461. static inline void hal_tx_ext_desc_set_tcp_flags(void *desc,
  462. uint16_t tcp_flags,
  463. uint16_t mask)
  464. {
  465. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_0, TCP_FLAG) |=
  466. ((HAL_TX_SM(TX_MSDU_EXTENSION_0, TCP_FLAG, tcp_flags)) |
  467. (HAL_TX_SM(TX_MSDU_EXTENSION_0, TCP_FLAG_MASK, mask)));
  468. }
  469. /**
  470. * hal_tx_ext_desc_set_msdu_length() - Set L2 and IP Lengths
  471. * @desc: Handle to Tx MSDU Extension Descriptor
  472. * @l2_len: L2 length for the msdu, if tso is enabled
  473. * @ip_len: IP length for the msdu, if tso is enabled
  474. *
  475. * Return: none
  476. */
  477. static inline void hal_tx_ext_desc_set_msdu_length(void *desc,
  478. uint16_t l2_len,
  479. uint16_t ip_len)
  480. {
  481. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_1, L2_LENGTH) |=
  482. ((HAL_TX_SM(TX_MSDU_EXTENSION_1, L2_LENGTH, l2_len)) |
  483. (HAL_TX_SM(TX_MSDU_EXTENSION_1, IP_LENGTH, ip_len)));
  484. }
  485. /**
  486. * hal_tx_ext_desc_set_tcp_seq() - Set TCP Sequence number
  487. * @desc: Handle to Tx MSDU Extension Descriptor
  488. * @seq_num: Tcp_seq_number for the msdu, if tso is enabled
  489. *
  490. * Return: none
  491. */
  492. static inline void hal_tx_ext_desc_set_tcp_seq(void *desc,
  493. uint32_t seq_num)
  494. {
  495. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_2, TCP_SEQ_NUMBER) |=
  496. ((HAL_TX_SM(TX_MSDU_EXTENSION_2, TCP_SEQ_NUMBER, seq_num)));
  497. }
  498. /**
  499. * hal_tx_ext_desc_set_ip_id() - Set IP Identification field
  500. * @desc: Handle to Tx MSDU Extension Descriptor
  501. * @id: IP Id field for the msdu, if tso is enabled
  502. *
  503. * Return: none
  504. */
  505. static inline void hal_tx_ext_desc_set_ip_id(void *desc,
  506. uint16_t id)
  507. {
  508. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_3, IP_IDENTIFICATION) |=
  509. ((HAL_TX_SM(TX_MSDU_EXTENSION_3, IP_IDENTIFICATION, id)));
  510. }
  511. /**
  512. * hal_tx_ext_desc_set_buffer() - Set Buffer Pointer and Length for a fragment
  513. * @desc: Handle to Tx MSDU Extension Descriptor
  514. * @frag_num: Fragment number (value can be 0 to 5)
  515. * @paddr_lo: Lower 32-bit of Buffer Physical address
  516. * @paddr_hi: Upper 32-bit of Buffer Physical address
  517. * @length: Buffer Length
  518. *
  519. * Return: none
  520. */
  521. static inline void hal_tx_ext_desc_set_buffer(void *desc,
  522. uint8_t frag_num,
  523. uint32_t paddr_lo,
  524. uint16_t paddr_hi,
  525. uint16_t length)
  526. {
  527. HAL_SET_FLD_OFFSET(desc, TX_MSDU_EXTENSION_6, BUF0_PTR_31_0,
  528. (frag_num << 3)) |=
  529. ((HAL_TX_SM(TX_MSDU_EXTENSION_6, BUF0_PTR_31_0, paddr_lo)));
  530. HAL_SET_FLD_OFFSET(desc, TX_MSDU_EXTENSION_7, BUF0_PTR_39_32,
  531. (frag_num << 3)) |=
  532. ((HAL_TX_SM(TX_MSDU_EXTENSION_7, BUF0_PTR_39_32,
  533. (paddr_hi))));
  534. HAL_SET_FLD_OFFSET(desc, TX_MSDU_EXTENSION_7, BUF0_LEN,
  535. (frag_num << 3)) |=
  536. ((HAL_TX_SM(TX_MSDU_EXTENSION_7, BUF0_LEN, length)));
  537. }
  538. /**
  539. * hal_tx_ext_desc_set_buffer0_param() - Set Buffer 0 Pointer and Length
  540. * @desc: Handle to Tx MSDU Extension Descriptor
  541. * @paddr_lo: Lower 32-bit of Buffer Physical address
  542. * @paddr_hi: Upper 32-bit of Buffer Physical address
  543. * @length: Buffer 0 Length
  544. *
  545. * Return: none
  546. */
  547. static inline void hal_tx_ext_desc_set_buffer0_param(void *desc,
  548. uint32_t paddr_lo,
  549. uint16_t paddr_hi,
  550. uint16_t length)
  551. {
  552. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_6, BUF0_PTR_31_0) |=
  553. ((HAL_TX_SM(TX_MSDU_EXTENSION_6, BUF0_PTR_31_0, paddr_lo)));
  554. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_7, BUF0_PTR_39_32) |=
  555. ((HAL_TX_SM(TX_MSDU_EXTENSION_7,
  556. BUF0_PTR_39_32, paddr_hi)));
  557. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_7, BUF0_LEN) |=
  558. ((HAL_TX_SM(TX_MSDU_EXTENSION_7, BUF0_LEN, length)));
  559. }
  560. /**
  561. * hal_tx_ext_desc_set_buffer1_param() - Set Buffer 1 Pointer and Length
  562. * @desc: Handle to Tx MSDU Extension Descriptor
  563. * @paddr_lo: Lower 32-bit of Buffer Physical address
  564. * @paddr_hi: Upper 32-bit of Buffer Physical address
  565. * @length: Buffer 1 Length
  566. *
  567. * Return: none
  568. */
  569. static inline void hal_tx_ext_desc_set_buffer1_param(void *desc,
  570. uint32_t paddr_lo,
  571. uint16_t paddr_hi,
  572. uint16_t length)
  573. {
  574. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_8, BUF1_PTR_31_0) |=
  575. ((HAL_TX_SM(TX_MSDU_EXTENSION_8, BUF1_PTR_31_0, paddr_lo)));
  576. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_9, BUF1_PTR_39_32) |=
  577. ((HAL_TX_SM(TX_MSDU_EXTENSION_9,
  578. BUF1_PTR_39_32, paddr_hi)));
  579. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_9, BUF1_LEN) |=
  580. ((HAL_TX_SM(TX_MSDU_EXTENSION_9, BUF1_LEN, length)));
  581. }
  582. /**
  583. * hal_tx_ext_desc_set_buffer2_param() - Set Buffer 2 Pointer and Length
  584. * @desc: Handle to Tx MSDU Extension Descriptor
  585. * @paddr_lo: Lower 32-bit of Buffer Physical address
  586. * @paddr_hi: Upper 32-bit of Buffer Physical address
  587. * @length: Buffer 2 Length
  588. *
  589. * Return: none
  590. */
  591. static inline void hal_tx_ext_desc_set_buffer2_param(void *desc,
  592. uint32_t paddr_lo,
  593. uint16_t paddr_hi,
  594. uint16_t length)
  595. {
  596. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_10, BUF2_PTR_31_0) |=
  597. ((HAL_TX_SM(TX_MSDU_EXTENSION_10, BUF2_PTR_31_0,
  598. paddr_lo)));
  599. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_11, BUF2_PTR_39_32) |=
  600. ((HAL_TX_SM(TX_MSDU_EXTENSION_11, BUF2_PTR_39_32,
  601. paddr_hi)));
  602. HAL_SET_FLD(desc, TX_MSDU_EXTENSION_11, BUF2_LEN) |=
  603. ((HAL_TX_SM(TX_MSDU_EXTENSION_11, BUF2_LEN, length)));
  604. }
  605. /**
  606. * hal_tx_ext_desc_sync - Commit the descriptor to Hardware
  607. * @desc_cached: Cached descriptor that software maintains
  608. * @hw_desc: Hardware descriptor to be updated
  609. *
  610. * Return: none
  611. */
  612. static inline void hal_tx_ext_desc_sync(uint8_t *desc_cached,
  613. uint8_t *hw_desc)
  614. {
  615. qdf_mem_copy(&hw_desc[0], &desc_cached[0],
  616. HAL_TX_EXT_DESC_WITH_META_DATA);
  617. }
  618. /**
  619. * hal_tx_ext_desc_get_tso_enable() - Set TSO Enable Flag
  620. * @hal_tx_ext_desc: Handle to Tx MSDU Extension Descriptor
  621. *
  622. * Return: tso_enable value in the descriptor
  623. */
  624. static inline uint32_t hal_tx_ext_desc_get_tso_enable(void *hal_tx_ext_desc)
  625. {
  626. uint32_t *desc = (uint32_t *) hal_tx_ext_desc;
  627. return (*desc & TX_MSDU_EXTENSION_0_TSO_ENABLE_MASK) >>
  628. TX_MSDU_EXTENSION_0_TSO_ENABLE_LSB;
  629. }
  630. /*---------------------------------------------------------------------------
  631. WBM Descriptor accessor APIs for Tx completions
  632. ---------------------------------------------------------------------------*/
  633. /**
  634. * hal_tx_comp_get_desc_id() - Get TX descriptor id within comp descriptor
  635. * @hal_desc: completion ring descriptor pointer
  636. *
  637. * This function will tx descriptor id, cookie, within hardware completion
  638. * descriptor
  639. *
  640. * Return: cookie
  641. */
  642. static inline uint32_t hal_tx_comp_get_desc_id(void *hal_desc)
  643. {
  644. uint32_t comp_desc =
  645. *(uint32_t *) (((uint8_t *) hal_desc) +
  646. BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_OFFSET);
  647. /* Cookie is placed on 2nd word */
  648. return (comp_desc & BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_MASK) >>
  649. BUFFER_ADDR_INFO_1_SW_BUFFER_COOKIE_LSB;
  650. }
  651. /**
  652. * hal_tx_comp_get_paddr() - Get paddr within comp descriptor
  653. * @hal_desc: completion ring descriptor pointer
  654. *
  655. * This function will get buffer physical address within hardware completion
  656. * descriptor
  657. *
  658. * Return: Buffer physical address
  659. */
  660. static inline qdf_dma_addr_t hal_tx_comp_get_paddr(void *hal_desc)
  661. {
  662. uint32_t paddr_lo;
  663. uint32_t paddr_hi;
  664. paddr_lo = *(uint32_t *) (((uint8_t *) hal_desc) +
  665. BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_OFFSET);
  666. paddr_hi = *(uint32_t *) (((uint8_t *) hal_desc) +
  667. BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_OFFSET);
  668. paddr_hi = (paddr_hi & BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_MASK) >>
  669. BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_LSB;
  670. return (qdf_dma_addr_t) (paddr_lo | (((uint64_t) paddr_hi) << 32));
  671. }
  672. /**
  673. * hal_tx_comp_get_buffer_source() - Get buffer release source value
  674. * @hal_desc: completion ring descriptor pointer
  675. *
  676. * This function will get buffer release source from Tx completion descriptor
  677. *
  678. * Return: buffer release source
  679. */
  680. static inline uint32_t hal_tx_comp_get_buffer_source(void *hal_desc)
  681. {
  682. uint32_t comp_desc =
  683. *(uint32_t *) (((uint8_t *) hal_desc) +
  684. WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_OFFSET);
  685. return (comp_desc & WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_MASK) >>
  686. WBM_RELEASE_RING_2_RELEASE_SOURCE_MODULE_LSB;
  687. }
  688. /**
  689. * hal_tx_comp_get_buffer_type() - Buffer or Descriptor type
  690. * @hal_desc: completion ring descriptor pointer
  691. *
  692. * This function will return the type of pointer - buffer or descriptor
  693. *
  694. * Return: buffer type
  695. */
  696. static inline uint32_t hal_tx_comp_get_buffer_type(void *hal_desc)
  697. {
  698. uint32_t comp_desc =
  699. *(uint32_t *) (((uint8_t *) hal_desc) +
  700. WBM_RELEASE_RING_2_BUFFER_OR_DESC_TYPE_OFFSET);
  701. return (comp_desc & WBM_RELEASE_RING_2_BUFFER_OR_DESC_TYPE_MASK) >>
  702. WBM_RELEASE_RING_2_BUFFER_OR_DESC_TYPE_LSB;
  703. }
  704. /**
  705. * hal_tx_comp_get_release_reason() - TQM Release reason
  706. * @hal_desc: completion ring descriptor pointer
  707. *
  708. * This function will return the type of pointer - buffer or descriptor
  709. *
  710. * Return: buffer type
  711. */
  712. static inline
  713. uint8_t hal_tx_comp_get_release_reason(void *hal_desc,
  714. hal_soc_handle_t hal_soc_hdl)
  715. {
  716. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  717. return hal_soc->ops->hal_tx_comp_get_release_reason(hal_desc);
  718. }
  719. /**
  720. * hal_tx_comp_desc_sync() - collect hardware descriptor contents
  721. * @hal_desc: hardware descriptor pointer
  722. * @comp: software descriptor pointer
  723. * @read_status: 0 - Do not read status words from descriptors
  724. * 1 - Enable reading of status words from descriptor
  725. *
  726. * This function will collect hardware release ring element contents and
  727. * translate to software descriptor content
  728. *
  729. * Return: none
  730. */
  731. static inline void hal_tx_comp_desc_sync(void *hw_desc,
  732. struct hal_tx_desc_comp_s *comp,
  733. bool read_status)
  734. {
  735. if (!read_status)
  736. qdf_mem_copy(comp, hw_desc, HAL_TX_COMPLETION_DESC_BASE_LEN);
  737. else
  738. qdf_mem_copy(comp, hw_desc, HAL_TX_COMPLETION_DESC_LEN_BYTES);
  739. }
  740. /**
  741. * hal_dump_comp_desc() - dump tx completion descriptor
  742. * @hal_desc: hardware descriptor pointer
  743. *
  744. * This function will print tx completion descriptor
  745. *
  746. * Return: none
  747. */
  748. static inline void hal_dump_comp_desc(void *hw_desc)
  749. {
  750. struct hal_tx_desc_comp_s *comp =
  751. (struct hal_tx_desc_comp_s *)hw_desc;
  752. uint32_t i;
  753. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_FATAL,
  754. "Current tx completion descriptor is");
  755. for (i = 0; i < HAL_TX_COMPLETION_DESC_LEN_DWORDS; i++) {
  756. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_FATAL,
  757. "DWORD[i] = 0x%x", comp->desc[i]);
  758. }
  759. }
  760. /**
  761. * hal_tx_comp_get_htt_desc() - Read the HTT portion of WBM Descriptor
  762. * @hal_desc: Hardware (WBM) descriptor pointer
  763. * @htt_desc: Software HTT descriptor pointer
  764. *
  765. * This function will read the HTT structure overlaid on WBM descriptor
  766. * into a cached software descriptor
  767. *
  768. */
  769. static inline void hal_tx_comp_get_htt_desc(void *hw_desc, uint8_t *htt_desc)
  770. {
  771. uint8_t *desc = hw_desc + HAL_TX_COMP_HTT_STATUS_OFFSET;
  772. qdf_mem_copy(htt_desc, desc, HAL_TX_COMP_HTT_STATUS_LEN);
  773. }
  774. /**
  775. * hal_tx_init_data_ring() - Initialize all the TCL Descriptors in SRNG
  776. * @hal_soc_hdl: Handle to HAL SoC structure
  777. * @hal_srng: Handle to HAL SRNG structure
  778. *
  779. * Return: none
  780. */
  781. static inline void hal_tx_init_data_ring(hal_soc_handle_t hal_soc_hdl,
  782. hal_ring_handle_t hal_ring_hdl)
  783. {
  784. uint8_t *desc_addr;
  785. struct hal_srng_params srng_params;
  786. uint32_t desc_size;
  787. uint32_t num_desc;
  788. hal_get_srng_params(hal_soc_hdl, hal_ring_hdl, &srng_params);
  789. desc_addr = (uint8_t *)srng_params.ring_base_vaddr;
  790. desc_size = sizeof(struct tcl_data_cmd);
  791. num_desc = srng_params.num_entries;
  792. while (num_desc) {
  793. HAL_TX_DESC_SET_TLV_HDR(desc_addr, HAL_TX_TCL_DATA_TAG,
  794. desc_size);
  795. desc_addr += (desc_size + sizeof(struct tlv_32_hdr));
  796. num_desc--;
  797. }
  798. }
  799. /**
  800. * hal_tx_desc_set_dscp_tid_table_id() - Sets DSCP to TID conversion table ID
  801. * @hal_soc: Handle to HAL SoC structure
  802. * @desc: Handle to Tx Descriptor
  803. * @id: DSCP to tid conversion table to be used for this frame
  804. *
  805. * Return: void
  806. */
  807. static inline
  808. void hal_tx_desc_set_dscp_tid_table_id(hal_soc_handle_t hal_soc_hdl,
  809. void *desc, uint8_t id)
  810. {
  811. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  812. hal_soc->ops->hal_tx_desc_set_dscp_tid_table_id(desc, id);
  813. }
  814. /**
  815. * hal_tx_set_dscp_tid_map_default() - Configure default DSCP to TID map table
  816. *
  817. * @soc: HAL SoC context
  818. * @map: DSCP-TID mapping table
  819. * @id: mapping table ID - 0,1
  820. *
  821. * Return: void
  822. */
  823. static inline void hal_tx_set_dscp_tid_map(hal_soc_handle_t hal_soc_hdl,
  824. uint8_t *map, uint8_t id)
  825. {
  826. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  827. hal_soc->ops->hal_tx_set_dscp_tid_map(hal_soc, map, id);
  828. }
  829. /**
  830. * hal_tx_update_dscp_tid() - Update the dscp tid map table as updated by user
  831. *
  832. * @soc: HAL SoC context
  833. * @map: DSCP-TID mapping table
  834. * @id : MAP ID
  835. * @dscp: DSCP_TID map index
  836. *
  837. * Return: void
  838. */
  839. static inline
  840. void hal_tx_update_dscp_tid(hal_soc_handle_t hal_soc_hdl, uint8_t tid,
  841. uint8_t id, uint8_t dscp)
  842. {
  843. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  844. hal_soc->ops->hal_tx_update_dscp_tid(hal_soc, tid, id, dscp);
  845. }
  846. /**
  847. * hal_tx_desc_set_lmac_id - Set the lmac_id value
  848. * @desc: Handle to Tx Descriptor
  849. * @lmac_id: mac Id to ast matching
  850. * b00 – mac 0
  851. * b01 – mac 1
  852. * b10 – mac 2
  853. * b11 – all macs (legacy HK way)
  854. *
  855. * Return: void
  856. */
  857. static inline void hal_tx_desc_set_lmac_id(hal_soc_handle_t hal_soc_hdl,
  858. void *desc, uint8_t lmac_id)
  859. {
  860. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  861. hal_soc->ops->hal_tx_desc_set_lmac_id(desc, lmac_id);
  862. }
  863. /**
  864. * hal_tx_desc_set_search_type - Set the search type value
  865. * @desc: Handle to Tx Descriptor
  866. * @search_type: search type
  867. * 0 – Normal search
  868. * 1 – Index based address search
  869. * 2 – Index based flow search
  870. *
  871. * Return: void
  872. */
  873. static inline void hal_tx_desc_set_search_type(hal_soc_handle_t hal_soc_hdl,
  874. void *desc, uint8_t search_type)
  875. {
  876. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  877. hal_soc->ops->hal_tx_desc_set_search_type(desc, search_type);
  878. }
  879. /**
  880. * hal_tx_desc_set_search_index - Set the search index value
  881. * @desc: Handle to Tx Descriptor
  882. * @search_index: The index that will be used for index based address or
  883. * flow search. The field is valid when 'search_type' is
  884. * 1 0r 2
  885. *
  886. * Return: void
  887. */
  888. static inline void hal_tx_desc_set_search_index(hal_soc_handle_t hal_soc_hdl,
  889. void *desc,
  890. uint32_t search_index)
  891. {
  892. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  893. hal_soc->ops->hal_tx_desc_set_search_index(desc, search_index);
  894. }
  895. /**
  896. * hal_tx_comp_get_status() - TQM Release reason
  897. * @hal_desc: completion ring Tx status
  898. *
  899. * This function will parse the WBM completion descriptor and populate in
  900. * HAL structure
  901. *
  902. * Return: none
  903. */
  904. static inline void hal_tx_comp_get_status(void *desc, void *ts,
  905. hal_soc_handle_t hal_soc_hdl)
  906. {
  907. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  908. hal_soc->ops->hal_tx_comp_get_status(desc, ts, hal_soc);
  909. }
  910. /**
  911. * hal_tx_desc_set_buf_addr - Fill Buffer Address information in Tx Descriptor
  912. * @desc: Handle to Tx Descriptor
  913. * @paddr: Physical Address
  914. * @pool_id: Return Buffer Manager ID
  915. * @desc_id: Descriptor ID
  916. * @type: 0 - Address points to a MSDU buffer
  917. * 1 - Address points to MSDU extension descriptor
  918. *
  919. * Return: void
  920. */
  921. static inline
  922. void hal_tx_desc_set_buf_addr(void *desc, dma_addr_t paddr,
  923. uint8_t pool_id, uint32_t desc_id,
  924. uint8_t type, hal_soc_handle_t hal_soc_hdl)
  925. {
  926. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  927. hal_soc->ops->hal_tx_desc_set_buf_addr(desc, paddr, pool_id,
  928. desc_id, type);
  929. }
  930. /**
  931. * hal_tx_set_pcp_tid_map_default() - Configure default PCP to TID map table
  932. *
  933. * @soc: HAL SoC context
  934. * @map: PCP-TID mapping table
  935. *
  936. * Return: void
  937. */
  938. static inline void hal_tx_set_pcp_tid_map_default(hal_soc_handle_t hal_soc_hdl,
  939. uint8_t *map)
  940. {
  941. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  942. hal_soc->ops->hal_tx_set_pcp_tid_map(hal_soc, map);
  943. }
  944. /**
  945. * hal_tx_update_pcp_tid_map() - Update PCP to TID map table
  946. *
  947. * @soc: HAL SoC context
  948. * @pcp: pcp value
  949. * @tid: tid no
  950. *
  951. * Return: void
  952. */
  953. static inline void hal_tx_update_pcp_tid_map(hal_soc_handle_t hal_soc_hdl,
  954. uint8_t pcp, uint8_t tid)
  955. {
  956. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  957. hal_soc->ops->hal_tx_update_pcp_tid_map(hal_soc, tid, tid);
  958. }
  959. /**
  960. * hal_tx_set_tidmap_prty() - Configure TIDmap priority
  961. *
  962. * @soc: HAL SoC context
  963. * @val: priority value
  964. *
  965. * Return: void
  966. */
  967. static inline
  968. void hal_tx_set_tidmap_prty(hal_soc_handle_t hal_soc_hdl, uint8_t val)
  969. {
  970. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  971. hal_soc->ops->hal_tx_set_tidmap_prty(hal_soc, val);
  972. }
  973. #endif /* HAL_TX_H */