hal_be_tx.h 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _HAL_BE_TX_H_
  20. #define _HAL_BE_TX_H_
  21. #include "hal_be_hw_headers.h"
  22. #include "hal_tx.h"
  23. /* Number of TX banks reserved i.e, will not be used by host driver. */
  24. /* MAX_TCL_BANK reserved for FW use */
  25. #define HAL_TX_NUM_RESERVED_BANKS 1
  26. /*
  27. * Number of Priority to TID mapping
  28. */
  29. #define HAL_BE_TX_MAP0_PRI2TID_MAX 10
  30. #define HAL_BE_TX_MAP1_PRI2TID_MAX 6
  31. enum hal_be_tx_ret_buf_manager {
  32. HAL_BE_WBM_SW0_BM_ID = 5,
  33. HAL_BE_WBM_SW1_BM_ID = 6,
  34. HAL_BE_WBM_SW2_BM_ID = 7,
  35. HAL_BE_WBM_SW3_BM_ID = 8,
  36. HAL_BE_WBM_SW4_BM_ID = 9,
  37. HAL_BE_WBM_SW5_BM_ID = 10,
  38. HAL_BE_WBM_SW6_BM_ID = 11,
  39. };
  40. enum hal_tx_mcast_ctrl {
  41. /* mcast traffic exceptioned to FW
  42. * valid only for AP VAP default for AP
  43. */
  44. HAL_TX_MCAST_CTRL_FW_EXCEPTION = 0,
  45. /* mcast traffic dropped in TCL*/
  46. HAL_TX_MCAST_CTRL_DROP,
  47. /* MEC notification are enabled
  48. * valid only for client VAP
  49. */
  50. HAL_TX_MCAST_CTRL_MEC_NOTIFY,
  51. /* no special routing for mcast
  52. * valid for client vap when index search is enabled
  53. */
  54. HAL_TX_MCAST_CTRL_NO_SPECIAL,
  55. };
  56. /**
  57. * enum hal_tx_vdev_mismatch_notify
  58. * @HAL_TX_VDEV_MISMATCH_TQM_NOTIFY: vdev mismatch exception routed to TQM
  59. * @HAL_TX_VDEV_MISMATCH_FW_NOTIFY: vdev mismatch exception routed to FW
  60. */
  61. enum hal_tx_vdev_mismatch_notify {
  62. HAL_TX_VDEV_MISMATCH_TQM_NOTIFY = 0,
  63. HAL_TX_VDEV_MISMATCH_FW_NOTIFY,
  64. };
  65. /* enum hal_tx_notify_frame_type - TX notify frame type
  66. * @NO_TX_NOTIFY: Not a notify frame
  67. * @TX_HARD_NOTIFY: Hard notify TX frame
  68. * @TX_SOFT_NOTIFY_E: Soft Notify Tx frame
  69. * @TX_SEMI_HARD_NOTIFY_E: Semi Hard notify TX frame
  70. */
  71. enum hal_tx_notify_frame_type {
  72. NO_TX_NOTIFY = 0,
  73. TX_HARD_NOTIFY = 1,
  74. TX_SOFT_NOTIFY_E = 2,
  75. TX_SEMI_HARD_NOTIFY_E = 3
  76. };
  77. /**
  78. * enum hal_tx_mcast_mlo_reinject_notify
  79. * @HAL_TX_MCAST_MLO_REINJECT_FW_NOTIFY: MLO Mcast reinject routed to FW
  80. * @HAL_TX_MCAST_MLO_REINJECT_TQM_NOTIFY: MLO Mcast reinject routed to TQM
  81. */
  82. enum hal_tx_mcast_mlo_reinject_notify {
  83. HAL_TX_MCAST_MLO_REINJECT_FW_NOTIFY = 0,
  84. HAL_TX_MCAST_MLO_REINJECT_TQM_NOTIFY,
  85. };
  86. /*---------------------------------------------------------------------------
  87. * Structures
  88. * ---------------------------------------------------------------------------
  89. */
  90. /**
  91. * struct hal_tx_bank_config - SW config bank params
  92. * @epd: EPD indication flag
  93. * @encap_type: encapsulation type
  94. * @encrypt_type: encrypt type
  95. * @src_buffer_swap: big-endia switch for packet buffer
  96. * @link_meta_swap: big-endian switch for link metadata
  97. * @index_lookup_enable: Enabel index lookup
  98. * @addrx_en: Address-X search
  99. * @addry_en: Address-Y search
  100. * @mesh_enable:mesh enable flag
  101. * @vdev_id_check_en: vdev id check
  102. * @pmac_id: mac id
  103. * @mcast_pkt_ctrl: mulitcast packet control
  104. * @val: value representing bank config
  105. */
  106. union hal_tx_bank_config {
  107. struct {
  108. uint32_t epd:1,
  109. encap_type:2,
  110. encrypt_type:4,
  111. src_buffer_swap:1,
  112. link_meta_swap:1,
  113. index_lookup_enable:1,
  114. addrx_en:1,
  115. addry_en:1,
  116. mesh_enable:2,
  117. vdev_id_check_en:1,
  118. pmac_id:2,
  119. mcast_pkt_ctrl:2,
  120. dscp_tid_map_id:6,
  121. reserved:7;
  122. };
  123. uint32_t val;
  124. };
  125. /**
  126. * struct hal_tx_cmn_config_ppe - SW config exception related parameters
  127. * @drop_prec_err - Exception drop_prec errors.
  128. * @fake_mac_hdr - Exception fake mac header.
  129. * @cpu_code_inv - Exception cpu code invalid.
  130. * @data_buff_err - Exception buffer length/offset erorors.
  131. * @l3_l4_err - Exception m3_l4 checksum errors
  132. * @data_offset_max - Maximum data offset allowed.
  133. * @data_len_max - Maximum data length allowed.
  134. */
  135. union hal_tx_cmn_config_ppe {
  136. struct {
  137. uint32_t drop_prec_err:1,
  138. fake_mac_hdr:1,
  139. cpu_code_inv:1,
  140. data_buff_err:1,
  141. l3_l4_err:1,
  142. data_offset_max:12,
  143. data_len_max:14;
  144. };
  145. uint32_t val;
  146. };
  147. /**
  148. * hal_tx_ppe_vp_config - SW config PPE VP table
  149. * @vp_num - Virtual port number
  150. * @pmac_id - Lmac ID
  151. * @bank_id: Bank ID correspondig to this I/F.
  152. * @vdev_id: VDEV ID of the I/F.
  153. * @search_idx_reg_num: Register number of this SI.
  154. * @use_ppe_int_pri: Use the PPE INT_PRI to TID table
  155. * @to_fw: Use FW
  156. * @drop_prec_enable: Enable precendance drop.
  157. */
  158. union hal_tx_ppe_vp_config {
  159. struct {
  160. uint32_t vp_num:8,
  161. pmac_id:2,
  162. bank_id:6,
  163. vdev_id:8,
  164. search_idx_reg_num:3,
  165. use_ppe_int_pri:1,
  166. to_fw:1,
  167. drop_prec_enable:1;
  168. };
  169. uint32_t val;
  170. };
  171. /**
  172. * hal_tx_cmn_ppe_idx_map_config: Use ppe index mapping table
  173. * @search_idx: Search index
  174. * @cache_set: Cache set number
  175. */
  176. union hal_tx_ppe_idx_map_config {
  177. struct {
  178. uint32_t search_idx:20,
  179. cache_set:4;
  180. };
  181. uint32_t val;
  182. };
  183. /**
  184. * hal_tx_ppe_pri2tid_map0_config : Configure ppe INT_PRI to tid map
  185. * @int_pri0: INT_PRI_0
  186. * @int_pri1: INT_PRI_1
  187. * @int_pri2: INT_PRI_2
  188. * @int_pri3: INT_PRI_3
  189. * @int_pri4: INT_PRI_4
  190. * @int_pri5: INT_PRI_5
  191. * @int_pri6: INT_PRI_6
  192. * @int_pri7: INT_PRI_7
  193. * @int_pri8: INT_PRI_8
  194. * @int_pri9: INT_PRI_9
  195. */
  196. union hal_tx_ppe_pri2tid_map0_config {
  197. struct {
  198. uint32_t int_pri0:3,
  199. int_pri1:3,
  200. int_pri2:3,
  201. int_pri3:3,
  202. int_pri4:3,
  203. int_pri5:3,
  204. int_pri6:3,
  205. int_pri7:3,
  206. int_pri8:3,
  207. int_pri9:3;
  208. };
  209. uint32_t val;
  210. };
  211. /**
  212. * hal_tx_ppe_pri2tid_map1_config : Configure ppe INT_PRI to tid map
  213. * @int_pri0: INT_PRI_10
  214. * @int_pri1: INT_PRI_11
  215. * @int_pri2: INT_PRI_12
  216. * @int_pri3: INT_PRI_13
  217. * @int_pri4: INT_PRI_14
  218. * @int_pri5: INT_PRI_15
  219. */
  220. union hal_tx_ppe_pri2tid_map1_config {
  221. struct {
  222. uint32_t int_pri10:3,
  223. int_pri11:3,
  224. int_pri12:3,
  225. int_pri13:3,
  226. int_pri14:3,
  227. int_pri15:3;
  228. };
  229. uint32_t val;
  230. };
  231. /*---------------------------------------------------------------------------
  232. * Function declarations and documentation
  233. * ---------------------------------------------------------------------------
  234. */
  235. /*---------------------------------------------------------------------------
  236. * TCL Descriptor accessor APIs
  237. *---------------------------------------------------------------------------
  238. */
  239. /**
  240. * hal_tx_desc_set_tx_notify_frame - Set TX notify_frame field in Tx desc
  241. * @desc: Handle to Tx Descriptor
  242. * @val: Value to be set
  243. *
  244. * Return: None
  245. */
  246. static inline void hal_tx_desc_set_tx_notify_frame(void *desc,
  247. uint8_t val)
  248. {
  249. HAL_SET_FLD(desc, TCL_DATA_CMD, TX_NOTIFY_FRAME) |=
  250. HAL_TX_SM(TCL_DATA_CMD, TX_NOTIFY_FRAME, val);
  251. }
  252. /**
  253. * hal_tx_desc_set_flow_override_enable - Set flow_override_enable field
  254. * @desc: Handle to Tx Descriptor
  255. * @val: Value to be set
  256. *
  257. * Return: None
  258. */
  259. static inline void hal_tx_desc_set_flow_override_enable(void *desc,
  260. uint8_t val)
  261. {
  262. HAL_SET_FLD(desc, TCL_DATA_CMD, FLOW_OVERRIDE_ENABLE) |=
  263. HAL_TX_SM(TCL_DATA_CMD, FLOW_OVERRIDE_ENABLE, val);
  264. }
  265. /**
  266. * hal_tx_desc_set_flow_override - Set flow_override field in TX desc
  267. * @desc: Handle to Tx Descriptor
  268. * @val: Value to be set
  269. *
  270. * Return: None
  271. */
  272. static inline void hal_tx_desc_set_flow_override(void *desc,
  273. uint8_t val)
  274. {
  275. HAL_SET_FLD(desc, TCL_DATA_CMD, FLOW_OVERRIDE) |=
  276. HAL_TX_SM(TCL_DATA_CMD, FLOW_OVERRIDE, val);
  277. }
  278. /**
  279. * hal_tx_desc_set_who_classify_info_sel - Set who_classify_info_sel field
  280. * @desc: Handle to Tx Descriptor
  281. * @val: Value to be set
  282. *
  283. * Return: None
  284. */
  285. static inline void hal_tx_desc_set_who_classify_info_sel(void *desc,
  286. uint8_t val)
  287. {
  288. HAL_SET_FLD(desc, TCL_DATA_CMD, WHO_CLASSIFY_INFO_SEL) |=
  289. HAL_TX_SM(TCL_DATA_CMD, WHO_CLASSIFY_INFO_SEL, val);
  290. }
  291. /**
  292. * hal_tx_desc_set_buf_length - Set Data length in bytes in Tx Descriptor
  293. * @desc: Handle to Tx Descriptor
  294. * @data_length: MSDU length in case of direct descriptor.
  295. * Length of link extension descriptor in case of Link extension
  296. * descriptor.Includes the length of Metadata
  297. * Return: None
  298. */
  299. static inline void hal_tx_desc_set_buf_length(void *desc,
  300. uint16_t data_length)
  301. {
  302. HAL_SET_FLD(desc, TCL_DATA_CMD, DATA_LENGTH) |=
  303. HAL_TX_SM(TCL_DATA_CMD, DATA_LENGTH, data_length);
  304. }
  305. /**
  306. * hal_tx_desc_set_buf_offset - Sets Packet Offset field in Tx descriptor
  307. * @desc: Handle to Tx Descriptor
  308. * @offset: Packet offset from Metadata in case of direct buffer descriptor.
  309. *
  310. * Return: void
  311. */
  312. static inline void hal_tx_desc_set_buf_offset(void *desc,
  313. uint8_t offset)
  314. {
  315. HAL_SET_FLD(desc, TCL_DATA_CMD, PACKET_OFFSET) |=
  316. HAL_TX_SM(TCL_DATA_CMD, PACKET_OFFSET, offset);
  317. }
  318. /**
  319. * hal_tx_desc_set_l4_checksum_en - Set TCP/IP checksum enable flags
  320. * Tx Descriptor for MSDU_buffer type
  321. * @desc: Handle to Tx Descriptor
  322. * @en: UDP/TCP over ipv4/ipv6 checksum enable flags (5 bits)
  323. *
  324. * Return: void
  325. */
  326. static inline void hal_tx_desc_set_l4_checksum_en(void *desc,
  327. uint8_t en)
  328. {
  329. HAL_SET_FLD(desc, TCL_DATA_CMD, IPV4_CHECKSUM_EN) |=
  330. (HAL_TX_SM(TCL_DATA_CMD, UDP_OVER_IPV4_CHECKSUM_EN, en) |
  331. HAL_TX_SM(TCL_DATA_CMD, UDP_OVER_IPV6_CHECKSUM_EN, en) |
  332. HAL_TX_SM(TCL_DATA_CMD, TCP_OVER_IPV4_CHECKSUM_EN, en) |
  333. HAL_TX_SM(TCL_DATA_CMD, TCP_OVER_IPV6_CHECKSUM_EN, en));
  334. }
  335. /**
  336. * hal_tx_desc_set_l3_checksum_en - Set IPv4 checksum enable flag in
  337. * Tx Descriptor for MSDU_buffer type
  338. * @desc: Handle to Tx Descriptor
  339. * @checksum_en_flags: ipv4 checksum enable flags
  340. *
  341. * Return: void
  342. */
  343. static inline void hal_tx_desc_set_l3_checksum_en(void *desc,
  344. uint8_t en)
  345. {
  346. HAL_SET_FLD(desc, TCL_DATA_CMD, IPV4_CHECKSUM_EN) |=
  347. HAL_TX_SM(TCL_DATA_CMD, IPV4_CHECKSUM_EN, en);
  348. }
  349. /**
  350. * hal_tx_desc_set_fw_metadata- Sets the metadata that is part of TCL descriptor
  351. * @desc:Handle to Tx Descriptor
  352. * @metadata: Metadata to be sent to Firmware
  353. *
  354. * Return: void
  355. */
  356. static inline void hal_tx_desc_set_fw_metadata(void *desc,
  357. uint16_t metadata)
  358. {
  359. HAL_SET_FLD(desc, TCL_DATA_CMD, TCL_CMD_NUMBER) |=
  360. HAL_TX_SM(TCL_DATA_CMD, TCL_CMD_NUMBER, metadata);
  361. }
  362. /**
  363. * hal_tx_desc_set_to_fw - Set To_FW bit in Tx Descriptor.
  364. * @desc:Handle to Tx Descriptor
  365. * @to_fw: if set, Forward packet to FW along with classification result
  366. *
  367. * Return: void
  368. */
  369. static inline void hal_tx_desc_set_to_fw(void *desc, uint8_t to_fw)
  370. {
  371. HAL_SET_FLD(desc, TCL_DATA_CMD, TO_FW) |=
  372. HAL_TX_SM(TCL_DATA_CMD, TO_FW, to_fw);
  373. }
  374. /**
  375. * hal_tx_desc_set_hlos_tid - Set the TID value (override DSCP/PCP fields in
  376. * frame) to be used for Tx Frame
  377. * @desc: Handle to Tx Descriptor
  378. * @hlos_tid: HLOS TID
  379. *
  380. * Return: void
  381. */
  382. static inline void hal_tx_desc_set_hlos_tid(void *desc,
  383. uint8_t hlos_tid)
  384. {
  385. HAL_SET_FLD(desc, TCL_DATA_CMD, HLOS_TID) |=
  386. HAL_TX_SM(TCL_DATA_CMD, HLOS_TID, hlos_tid);
  387. HAL_SET_FLD(desc, TCL_DATA_CMD, HLOS_TID_OVERWRITE) |=
  388. HAL_TX_SM(TCL_DATA_CMD, HLOS_TID_OVERWRITE, 1);
  389. }
  390. /**
  391. * hal_tx_desc_sync - Commit the descriptor to Hardware
  392. * @hal_tx_des_cached: Cached descriptor that software maintains
  393. * @hw_desc: Hardware descriptor to be updated
  394. */
  395. static inline void hal_tx_desc_sync(void *hal_tx_desc_cached,
  396. void *hw_desc)
  397. {
  398. qdf_mem_copy(hw_desc, hal_tx_desc_cached, HAL_TX_DESC_LEN_BYTES);
  399. }
  400. /**
  401. * hal_tx_desc_set_vdev_id - set vdev id to the descriptor to Hardware
  402. * @hal_tx_des_cached: Cached descriptor that software maintains
  403. * @vdev_id: vdev id
  404. */
  405. static inline void hal_tx_desc_set_vdev_id(void *desc, uint8_t vdev_id)
  406. {
  407. HAL_SET_FLD(desc, TCL_DATA_CMD, VDEV_ID) |=
  408. HAL_TX_SM(TCL_DATA_CMD, VDEV_ID, vdev_id);
  409. }
  410. /**
  411. * hal_tx_desc_set_bank_id - set bank id to the descriptor to Hardware
  412. * @hal_tx_des_cached: Cached descriptor that software maintains
  413. * @bank_id: bank id
  414. */
  415. static inline void hal_tx_desc_set_bank_id(void *desc, uint8_t bank_id)
  416. {
  417. HAL_SET_FLD(desc, TCL_DATA_CMD, BANK_ID) |=
  418. HAL_TX_SM(TCL_DATA_CMD, BANK_ID, bank_id);
  419. }
  420. /**
  421. * hal_tx_desc_set_tcl_cmd_type - set tcl command type to the descriptor
  422. * to Hardware
  423. * @hal_tx_des_cached: Cached descriptor that software maintains
  424. * @tcl_cmd_type: tcl command type
  425. */
  426. static inline void
  427. hal_tx_desc_set_tcl_cmd_type(void *desc, uint8_t tcl_cmd_type)
  428. {
  429. HAL_SET_FLD(desc, TCL_DATA_CMD, TCL_CMD_TYPE) |=
  430. HAL_TX_SM(TCL_DATA_CMD, TCL_CMD_TYPE, tcl_cmd_type);
  431. }
  432. /**
  433. * hal_tx_desc_set_lmac_id_be - set lmac id to the descriptor to Hardware
  434. * @hal_soc_hdl: hal soc handle
  435. * @hal_tx_des_cached: Cached descriptor that software maintains
  436. * @lmac_id: lmac id
  437. */
  438. static inline void
  439. hal_tx_desc_set_lmac_id_be(hal_soc_handle_t hal_soc_hdl, void *desc,
  440. uint8_t lmac_id)
  441. {
  442. HAL_SET_FLD(desc, TCL_DATA_CMD, PMAC_ID) |=
  443. HAL_TX_SM(TCL_DATA_CMD, PMAC_ID, lmac_id);
  444. }
  445. /**
  446. * hal_tx_desc_set_search_index_be - set search index to the
  447. * descriptor to Hardware
  448. * @hal_soc_hdl: hal soc handle
  449. * @hal_tx_des_cached: Cached descriptor that software maintains
  450. * @search_index: search index
  451. */
  452. static inline void
  453. hal_tx_desc_set_search_index_be(hal_soc_handle_t hal_soc_hdl, void *desc,
  454. uint32_t search_index)
  455. {
  456. HAL_SET_FLD(desc, TCL_DATA_CMD, SEARCH_INDEX) |=
  457. HAL_TX_SM(TCL_DATA_CMD, SEARCH_INDEX, search_index);
  458. }
  459. /**
  460. * hal_tx_desc_set_cache_set_num - set cache set num to the
  461. * descriptor to Hardware
  462. * @hal_soc_hdl: hal soc handle
  463. * @hal_tx_des_cached: Cached descriptor that software maintains
  464. * @cache_num: cache number
  465. */
  466. static inline void
  467. hal_tx_desc_set_cache_set_num(hal_soc_handle_t hal_soc_hdl, void *desc,
  468. uint8_t cache_num)
  469. {
  470. HAL_SET_FLD(desc, TCL_DATA_CMD, CACHE_SET_NUM) |=
  471. HAL_TX_SM(TCL_DATA_CMD, CACHE_SET_NUM, cache_num);
  472. }
  473. /*---------------------------------------------------------------------------
  474. * WBM Descriptor accessor APIs for Tx completions
  475. * ---------------------------------------------------------------------------
  476. */
  477. /**
  478. * hal_tx_get_wbm_sw0_bm_id() - Get the BM ID for first tx completion ring
  479. *
  480. * Return: BM ID for first tx completion ring
  481. */
  482. static inline uint32_t hal_tx_get_wbm_sw0_bm_id(void)
  483. {
  484. return HAL_BE_WBM_SW0_BM_ID;
  485. }
  486. /**
  487. * hal_tx_comp_get_desc_id() - Get TX descriptor id within comp descriptor
  488. * @hal_desc: completion ring descriptor pointer
  489. *
  490. * This function will tx descriptor id, cookie, within hardware completion
  491. * descriptor. For cases when cookie conversion is disabled, the sw_cookie
  492. * is present in the 2nd DWORD.
  493. *
  494. * Return: cookie
  495. */
  496. static inline uint32_t hal_tx_comp_get_desc_id(void *hal_desc)
  497. {
  498. uint32_t comp_desc =
  499. *(uint32_t *)(((uint8_t *)hal_desc) +
  500. BUFFER_ADDR_INFO_SW_BUFFER_COOKIE_OFFSET);
  501. /* Cookie is placed on 2nd word */
  502. return (comp_desc & BUFFER_ADDR_INFO_SW_BUFFER_COOKIE_MASK) >>
  503. BUFFER_ADDR_INFO_SW_BUFFER_COOKIE_LSB;
  504. }
  505. /**
  506. * hal_tx_comp_get_paddr() - Get paddr within comp descriptor
  507. * @hal_desc: completion ring descriptor pointer
  508. *
  509. * This function will get buffer physical address within hardware completion
  510. * descriptor
  511. *
  512. * Return: Buffer physical address
  513. */
  514. static inline qdf_dma_addr_t hal_tx_comp_get_paddr(void *hal_desc)
  515. {
  516. uint32_t paddr_lo;
  517. uint32_t paddr_hi;
  518. paddr_lo = *(uint32_t *)(((uint8_t *)hal_desc) +
  519. BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_OFFSET);
  520. paddr_hi = *(uint32_t *)(((uint8_t *)hal_desc) +
  521. BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_OFFSET);
  522. paddr_hi = (paddr_hi & BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_MASK) >>
  523. BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_LSB;
  524. return (qdf_dma_addr_t)(paddr_lo | (((uint64_t)paddr_hi) << 32));
  525. }
  526. #ifdef DP_HW_COOKIE_CONVERT_EXCEPTION
  527. /* HW set dowrd-2 bit30 to 1 if HW CC is done */
  528. #define HAL_WBM2SW_COMPLETION_RING_TX_CC_DONE_OFFSET 0x8
  529. #define HAL_WBM2SW_COMPLETION_RING_TX_CC_DONE_MASK 0x40000000
  530. #define HAL_WBM2SW_COMPLETION_RING_TX_CC_DONE_LSB 0x1E
  531. /**
  532. * hal_tx_comp_get_cookie_convert_done() - Get cookie conversion done flag
  533. * @hal_desc: completion ring descriptor pointer
  534. *
  535. * This function will get the bit value that indicate HW cookie
  536. * conversion done or not
  537. *
  538. * Return: 1 - HW cookie conversion done, 0 - not
  539. */
  540. static inline uint8_t hal_tx_comp_get_cookie_convert_done(void *hal_desc)
  541. {
  542. return HAL_TX_DESC_GET(hal_desc, HAL_WBM2SW_COMPLETION_RING_TX,
  543. CC_DONE);
  544. }
  545. #endif
  546. /**
  547. * hal_tx_comp_get_desc_va() - Get Desc virtual address within completion Desc
  548. * @hal_desc: completion ring descriptor pointer
  549. *
  550. * This function will get the TX Desc virtual address
  551. *
  552. * Return: TX desc virtual address
  553. */
  554. static inline uintptr_t hal_tx_comp_get_desc_va(void *hal_desc)
  555. {
  556. uint64_t va_from_desc;
  557. va_from_desc = HAL_TX_DESC_GET(hal_desc,
  558. WBM2SW_COMPLETION_RING_TX,
  559. BUFFER_VIRT_ADDR_31_0) |
  560. (((uint64_t)HAL_TX_DESC_GET(
  561. hal_desc,
  562. WBM2SW_COMPLETION_RING_TX,
  563. BUFFER_VIRT_ADDR_63_32)) << 32);
  564. return (uintptr_t)va_from_desc;
  565. }
  566. /*---------------------------------------------------------------------------
  567. * TX BANK register accessor APIs
  568. * ---------------------------------------------------------------------------
  569. */
  570. /**
  571. * hal_tx_get_num_tcl_banks() - Get number of banks for target
  572. *
  573. * Return: None
  574. */
  575. static inline uint8_t
  576. hal_tx_get_num_tcl_banks(hal_soc_handle_t hal_soc_hdl)
  577. {
  578. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  579. int hal_banks = 0;
  580. if (hal_soc->ops->hal_tx_get_num_tcl_banks) {
  581. hal_banks = hal_soc->ops->hal_tx_get_num_tcl_banks();
  582. hal_banks -= HAL_TX_NUM_RESERVED_BANKS;
  583. hal_banks = (hal_banks < 0) ? 0 : hal_banks;
  584. }
  585. return hal_banks;
  586. }
  587. /**
  588. * hal_tx_populate_bank_register() - populate the bank register with
  589. * the software configs.
  590. * @soc: HAL soc handle
  591. * @config: bank config
  592. * @bank_id: bank id to be configured
  593. *
  594. * Returns: None
  595. */
  596. #ifdef HWIO_TCL_R0_SW_CONFIG_BANK_n_MCAST_PACKET_CTRL_SHFT
  597. static inline void
  598. hal_tx_populate_bank_register(hal_soc_handle_t hal_soc_hdl,
  599. union hal_tx_bank_config *config,
  600. uint8_t bank_id)
  601. {
  602. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  603. uint32_t reg_addr, reg_val = 0;
  604. reg_addr = HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDR(MAC_TCL_REG_REG_BASE,
  605. bank_id);
  606. reg_val |= (config->epd << HWIO_TCL_R0_SW_CONFIG_BANK_n_EPD_SHFT);
  607. reg_val |= (config->encap_type <<
  608. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCAP_TYPE_SHFT);
  609. reg_val |= (config->encrypt_type <<
  610. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCRYPT_TYPE_SHFT);
  611. reg_val |= (config->src_buffer_swap <<
  612. HWIO_TCL_R0_SW_CONFIG_BANK_n_SRC_BUFFER_SWAP_SHFT);
  613. reg_val |= (config->link_meta_swap <<
  614. HWIO_TCL_R0_SW_CONFIG_BANK_n_LINK_META_SWAP_SHFT);
  615. reg_val |= (config->index_lookup_enable <<
  616. HWIO_TCL_R0_SW_CONFIG_BANK_n_INDEX_LOOKUP_ENABLE_SHFT);
  617. reg_val |= (config->addrx_en <<
  618. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRX_EN_SHFT);
  619. reg_val |= (config->addry_en <<
  620. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRY_EN_SHFT);
  621. reg_val |= (config->mesh_enable <<
  622. HWIO_TCL_R0_SW_CONFIG_BANK_n_MESH_ENABLE_SHFT);
  623. reg_val |= (config->vdev_id_check_en <<
  624. HWIO_TCL_R0_SW_CONFIG_BANK_n_VDEV_ID_CHECK_EN_SHFT);
  625. reg_val |= (config->pmac_id <<
  626. HWIO_TCL_R0_SW_CONFIG_BANK_n_PMAC_ID_SHFT);
  627. reg_val |= (config->mcast_pkt_ctrl <<
  628. HWIO_TCL_R0_SW_CONFIG_BANK_n_MCAST_PACKET_CTRL_SHFT);
  629. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  630. }
  631. #else
  632. static inline void
  633. hal_tx_populate_bank_register(hal_soc_handle_t hal_soc_hdl,
  634. union hal_tx_bank_config *config,
  635. uint8_t bank_id)
  636. {
  637. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  638. uint32_t reg_addr, reg_val = 0;
  639. reg_addr = HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDR(MAC_TCL_REG_REG_BASE,
  640. bank_id);
  641. reg_val |= (config->epd << HWIO_TCL_R0_SW_CONFIG_BANK_n_EPD_SHFT);
  642. reg_val |= (config->encap_type <<
  643. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCAP_TYPE_SHFT);
  644. reg_val |= (config->encrypt_type <<
  645. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCRYPT_TYPE_SHFT);
  646. reg_val |= (config->src_buffer_swap <<
  647. HWIO_TCL_R0_SW_CONFIG_BANK_n_SRC_BUFFER_SWAP_SHFT);
  648. reg_val |= (config->link_meta_swap <<
  649. HWIO_TCL_R0_SW_CONFIG_BANK_n_LINK_META_SWAP_SHFT);
  650. reg_val |= (config->index_lookup_enable <<
  651. HWIO_TCL_R0_SW_CONFIG_BANK_n_INDEX_LOOKUP_ENABLE_SHFT);
  652. reg_val |= (config->addrx_en <<
  653. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRX_EN_SHFT);
  654. reg_val |= (config->addry_en <<
  655. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRY_EN_SHFT);
  656. reg_val |= (config->mesh_enable <<
  657. HWIO_TCL_R0_SW_CONFIG_BANK_n_MESH_ENABLE_SHFT);
  658. reg_val |= (config->vdev_id_check_en <<
  659. HWIO_TCL_R0_SW_CONFIG_BANK_n_VDEV_ID_CHECK_EN_SHFT);
  660. reg_val |= (config->pmac_id <<
  661. HWIO_TCL_R0_SW_CONFIG_BANK_n_PMAC_ID_SHFT);
  662. reg_val |= (config->dscp_tid_map_id <<
  663. HWIO_TCL_R0_SW_CONFIG_BANK_n_DSCP_TID_TABLE_NUM_SHFT);
  664. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  665. }
  666. #endif
  667. #ifdef DP_TX_IMPLICIT_RBM_MAPPING
  668. #define RBM_MAPPING_BMSK HWIO_TCL_R0_RBM_MAPPING0_SW2TCL1_RING_BMSK
  669. #define RBM_MAPPING_SHFT HWIO_TCL_R0_RBM_MAPPING0_SW2TCL2_RING_SHFT
  670. #define RBM_PPE2TCL_OFFSET \
  671. (HWIO_TCL_R0_RBM_MAPPING0_PPE2TCL1_RING_SHFT >> 2)
  672. #define RBM_TCL_CMD_CREDIT_OFFSET \
  673. (HWIO_TCL_R0_RBM_MAPPING0_SW2TCL_CREDIT_RING_SHFT >> 2)
  674. /**
  675. * hal_tx_config_rbm_mapping_be() - Update return buffer manager ring id
  676. * @hal_soc: HAL SoC context
  677. * @hal_ring_hdl: Source ring pointer
  678. * @rbm_id: return buffer manager ring id
  679. *
  680. * Return: void
  681. */
  682. static inline void
  683. hal_tx_config_rbm_mapping_be(hal_soc_handle_t hal_soc_hdl,
  684. hal_ring_handle_t hal_ring_hdl,
  685. uint8_t rbm_id)
  686. {
  687. struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl;
  688. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  689. uint32_t reg_addr = 0;
  690. uint32_t reg_val = 0;
  691. uint32_t val = 0;
  692. uint8_t ring_num;
  693. enum hal_ring_type ring_type;
  694. ring_type = srng->ring_type;
  695. ring_num = hal_soc->hw_srng_table[ring_type].start_ring_id;
  696. ring_num = srng->ring_id - ring_num;
  697. reg_addr = HWIO_TCL_R0_RBM_MAPPING0_ADDR(MAC_TCL_REG_REG_BASE);
  698. if (ring_type == PPE2TCL)
  699. ring_num = ring_num + RBM_PPE2TCL_OFFSET;
  700. else if (ring_type == TCL_CMD_CREDIT)
  701. ring_num = ring_num + RBM_TCL_CMD_CREDIT_OFFSET;
  702. /* get current value stored in register address */
  703. val = HAL_REG_READ(hal_soc, reg_addr);
  704. /* mask out other stored value */
  705. val &= (~(RBM_MAPPING_BMSK << (RBM_MAPPING_SHFT * ring_num)));
  706. reg_val = val | ((RBM_MAPPING_BMSK & rbm_id) <<
  707. (RBM_MAPPING_SHFT * ring_num));
  708. /* write rbm mapped value to register address */
  709. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  710. }
  711. #else
  712. static inline void
  713. hal_tx_config_rbm_mapping_be(hal_soc_handle_t hal_soc_hdl,
  714. hal_ring_handle_t hal_ring_hdl,
  715. uint8_t rbm_id)
  716. {
  717. }
  718. #endif
  719. /**
  720. * hal_tx_desc_set_buf_addr_be - Fill Buffer Address information in Tx Desc
  721. * @desc: Handle to Tx Descriptor
  722. * @paddr: Physical Address
  723. * @pool_id: Return Buffer Manager ID
  724. * @desc_id: Descriptor ID
  725. * @type: 0 - Address points to a MSDU buffer
  726. * 1 - Address points to MSDU extension descriptor
  727. *
  728. * Return: void
  729. */
  730. #ifdef DP_TX_IMPLICIT_RBM_MAPPING
  731. static inline void
  732. hal_tx_desc_set_buf_addr_be(hal_soc_handle_t hal_soc_hdl, void *desc,
  733. dma_addr_t paddr, uint8_t rbm_id,
  734. uint32_t desc_id, uint8_t type)
  735. {
  736. /* Set buffer_addr_info.buffer_addr_31_0 */
  737. HAL_SET_FLD(desc, TCL_DATA_CMD,
  738. BUF_ADDR_INFO_BUFFER_ADDR_31_0) =
  739. HAL_TX_SM(TCL_DATA_CMD, BUF_ADDR_INFO_BUFFER_ADDR_31_0, paddr);
  740. /* Set buffer_addr_info.buffer_addr_39_32 */
  741. HAL_SET_FLD(desc, TCL_DATA_CMD,
  742. BUF_ADDR_INFO_BUFFER_ADDR_39_32) |=
  743. HAL_TX_SM(TCL_DATA_CMD, BUF_ADDR_INFO_BUFFER_ADDR_39_32,
  744. (((uint64_t)paddr) >> 32));
  745. /* Set buffer_addr_info.sw_buffer_cookie = desc_id */
  746. HAL_SET_FLD(desc, TCL_DATA_CMD,
  747. BUF_ADDR_INFO_SW_BUFFER_COOKIE) |=
  748. HAL_TX_SM(TCL_DATA_CMD, BUF_ADDR_INFO_SW_BUFFER_COOKIE,
  749. desc_id);
  750. /* Set Buffer or Ext Descriptor Type */
  751. HAL_SET_FLD(desc, TCL_DATA_CMD,
  752. BUF_OR_EXT_DESC_TYPE) |=
  753. HAL_TX_SM(TCL_DATA_CMD, BUF_OR_EXT_DESC_TYPE, type);
  754. }
  755. #else
  756. static inline void
  757. hal_tx_desc_set_buf_addr_be(hal_soc_handle_t hal_soc_hdl, void *desc,
  758. dma_addr_t paddr, uint8_t rbm_id,
  759. uint32_t desc_id, uint8_t type)
  760. {
  761. /* Set buffer_addr_info.buffer_addr_31_0 */
  762. HAL_SET_FLD(desc, TCL_DATA_CMD,
  763. BUF_ADDR_INFO_BUFFER_ADDR_31_0) =
  764. HAL_TX_SM(TCL_DATA_CMD, BUF_ADDR_INFO_BUFFER_ADDR_31_0, paddr);
  765. /* Set buffer_addr_info.buffer_addr_39_32 */
  766. HAL_SET_FLD(desc, TCL_DATA_CMD,
  767. BUF_ADDR_INFO_BUFFER_ADDR_39_32) |=
  768. HAL_TX_SM(TCL_DATA_CMD, BUF_ADDR_INFO_BUFFER_ADDR_39_32,
  769. (((uint64_t)paddr) >> 32));
  770. /* Set buffer_addr_info.return_buffer_manager = rbm id */
  771. HAL_SET_FLD(desc, TCL_DATA_CMD,
  772. BUF_ADDR_INFO_RETURN_BUFFER_MANAGER) |=
  773. HAL_TX_SM(TCL_DATA_CMD,
  774. BUF_ADDR_INFO_RETURN_BUFFER_MANAGER, rbm_id);
  775. /* Set buffer_addr_info.sw_buffer_cookie = desc_id */
  776. HAL_SET_FLD(desc, TCL_DATA_CMD,
  777. BUF_ADDR_INFO_SW_BUFFER_COOKIE) |=
  778. HAL_TX_SM(TCL_DATA_CMD, BUF_ADDR_INFO_SW_BUFFER_COOKIE,
  779. desc_id);
  780. /* Set Buffer or Ext Descriptor Type */
  781. HAL_SET_FLD(desc, TCL_DATA_CMD,
  782. BUF_OR_EXT_DESC_TYPE) |=
  783. HAL_TX_SM(TCL_DATA_CMD, BUF_OR_EXT_DESC_TYPE, type);
  784. }
  785. #endif
  786. #ifdef HWIO_TCL_R0_VDEV_MCAST_PACKET_CTRL_MAP_n_VAL_SHFT
  787. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_REG_ID(vdev_id) (vdev_id >> 0x4)
  788. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_INDEX_IN_REG(vdev_id) (vdev_id & 0xF)
  789. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK 0x3
  790. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT 0x2
  791. /**
  792. * hal_tx_vdev_mcast_ctrl_set - set mcast_ctrl value
  793. * @hal_soc: HAL SoC context
  794. * @mcast_ctrl_val: mcast ctrl value for this VAP
  795. *
  796. * Return: void
  797. */
  798. static inline void
  799. hal_tx_vdev_mcast_ctrl_set(hal_soc_handle_t hal_soc_hdl,
  800. uint8_t vdev_id,
  801. uint8_t mcast_ctrl_val)
  802. {
  803. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  804. uint32_t reg_addr, reg_val = 0;
  805. uint32_t val;
  806. uint8_t reg_idx = HAL_TCL_VDEV_MCAST_PACKET_CTRL_REG_ID(vdev_id);
  807. uint8_t index_in_reg =
  808. HAL_TCL_VDEV_MCAST_PACKET_CTRL_INDEX_IN_REG(vdev_id);
  809. reg_addr =
  810. HWIO_TCL_R0_VDEV_MCAST_PACKET_CTRL_MAP_n_ADDR(MAC_TCL_REG_REG_BASE,
  811. reg_idx);
  812. val = HAL_REG_READ(hal_soc, reg_addr);
  813. /* mask out other stored value */
  814. val &= (~(HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK <<
  815. (HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT * index_in_reg)));
  816. reg_val = val |
  817. ((HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK & mcast_ctrl_val) <<
  818. (HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT * index_in_reg));
  819. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  820. }
  821. #else
  822. static inline void
  823. hal_tx_vdev_mcast_ctrl_set(hal_soc_handle_t hal_soc_hdl,
  824. uint8_t vdev_id,
  825. uint8_t mcast_ctrl_val)
  826. {
  827. }
  828. #endif
  829. /**
  830. * hal_tx_vdev_mismatch_routing_set - set vdev mismatch exception routing
  831. * @hal_soc: HAL SoC context
  832. * @config: HAL_TX_VDEV_MISMATCH_TQM_NOTIFY - route via TQM
  833. * HAL_TX_VDEV_MISMATCH_FW_NOTIFY - route via FW
  834. *
  835. * Return: void
  836. */
  837. #ifdef HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_BMSK
  838. static inline void
  839. hal_tx_vdev_mismatch_routing_set(hal_soc_handle_t hal_soc_hdl,
  840. enum hal_tx_vdev_mismatch_notify config)
  841. {
  842. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  843. uint32_t reg_addr, reg_val = 0;
  844. uint32_t val = 0;
  845. reg_addr = HWIO_TCL_R0_CMN_CONFIG_ADDR(MAC_TCL_REG_REG_BASE);
  846. val = HAL_REG_READ(hal_soc, reg_addr);
  847. /* reset the corresponding bits in register */
  848. val &= (~(HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_BMSK));
  849. /* set config value */
  850. reg_val = val | (config <<
  851. HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_SHFT);
  852. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  853. }
  854. #else
  855. static inline void
  856. hal_tx_vdev_mismatch_routing_set(hal_soc_handle_t hal_soc_hdl,
  857. enum hal_tx_vdev_mismatch_notify config)
  858. {
  859. }
  860. #endif
  861. /**
  862. * hal_tx_mcast_mlo_reinject_routing_set - set MLO multicast reinject routing
  863. * @hal_soc: HAL SoC context
  864. * @config: HAL_TX_MCAST_MLO_REINJECT_FW_NOTIFY - route via FW
  865. * HAL_TX_MCAST_MLO_REINJECT_TQM_NOTIFY - route via TQM
  866. *
  867. * Return: void
  868. */
  869. #if defined(HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_BMSK) && \
  870. defined(WLAN_MCAST_MLO)
  871. static inline void
  872. hal_tx_mcast_mlo_reinject_routing_set(
  873. hal_soc_handle_t hal_soc_hdl,
  874. enum hal_tx_mcast_mlo_reinject_notify config)
  875. {
  876. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  877. uint32_t reg_addr, reg_val = 0;
  878. uint32_t val = 0;
  879. reg_addr = HWIO_TCL_R0_CMN_CONFIG_ADDR(MAC_TCL_REG_REG_BASE);
  880. val = HAL_REG_READ(hal_soc, reg_addr);
  881. /* reset the corresponding bits in register */
  882. val &= (~(HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_BMSK));
  883. /* set config value */
  884. reg_val = val | (config << HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_SHFT);
  885. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  886. }
  887. #else
  888. static inline void
  889. hal_tx_mcast_mlo_reinject_routing_set(
  890. hal_soc_handle_t hal_soc_hdl,
  891. enum hal_tx_mcast_mlo_reinject_notify config)
  892. {
  893. }
  894. #endif
  895. /*
  896. * hal_tx_get_num_ppe_vp_tbl_entries() - Get the total number of VP table
  897. * @hal_soc: HAL SoC Context
  898. *
  899. * Return: Total number of entries.
  900. */
  901. static inline
  902. uint32_t hal_tx_get_num_ppe_vp_tbl_entries(hal_soc_handle_t hal_soc_hdl)
  903. {
  904. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  905. return hal_soc->ops->hal_tx_get_num_ppe_vp_tbl_entries(hal_soc_hdl);
  906. }
  907. /**
  908. * hal_tx_set_ppe_cmn_cfg()- Set the PPE common config
  909. * @hal_soc: HAL SoC context
  910. * @cmn_cfg: HAL PPE VP common config
  911. *
  912. * Return: void
  913. */
  914. static inline void
  915. hal_tx_set_ppe_cmn_cfg(hal_soc_handle_t hal_soc_hdl,
  916. union hal_tx_cmn_config_ppe *cmn_cfg)
  917. {
  918. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  919. hal_soc->ops->hal_tx_set_ppe_cmn_cfg(hal_soc_hdl, cmn_cfg);
  920. }
  921. /**
  922. * hal_tx_populate_ppe_vp_entry - Populate ppe VP entry
  923. * @hal_soc: HAL SoC context
  924. * @vp_cfg: HAL PPE VP config
  925. * @ppe_vp_idx: PPE VP index
  926. *
  927. * Return: void
  928. */
  929. static inline void
  930. hal_tx_populate_ppe_vp_entry(hal_soc_handle_t hal_soc_hdl,
  931. union hal_tx_ppe_vp_config *vp_cfg,
  932. int ppe_vp_idx)
  933. {
  934. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  935. hal_soc->ops->hal_tx_set_ppe_vp_entry(hal_soc_hdl, vp_cfg, ppe_vp_idx);
  936. }
  937. /**
  938. * hal_tx_set_int_pri2id - Set the prit2tid table.
  939. * @hal_soc: HAL SoC context
  940. * @pri2tid: Reference to SW INT_PRI to TID table
  941. *
  942. * Return: void
  943. */
  944. static inline void
  945. hal_tx_set_int_pri2tid(hal_soc_handle_t hal_soc_hdl,
  946. uint32_t val, uint8_t map_no)
  947. {
  948. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  949. hal_soc->ops->hal_tx_set_ppe_pri2tid(hal_soc_hdl, val, map_no);
  950. }
  951. /**
  952. * hal_tx_update_int_pri2id - Populate the prit2tid table.
  953. * @hal_soc: HAL SoC context
  954. * @pri: INT_PRI value
  955. * @tid: Wi-Fi TID
  956. *
  957. * Return: void
  958. */
  959. static inline void
  960. hal_tx_update_int_pri2tid(hal_soc_handle_t hal_soc_hdl,
  961. uint8_t pri, uint8_t tid)
  962. {
  963. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  964. hal_soc->ops->hal_tx_update_ppe_pri2tid(hal_soc_hdl, pri, tid);
  965. }
  966. /**
  967. * hal_tx_dump_ppe_vp_entry - Dump the PPE VP entry
  968. * @hal_soc_hdl: HAL SoC context
  969. *
  970. * Return: void
  971. */
  972. static inline void
  973. hal_tx_dump_ppe_vp_entry(hal_soc_handle_t hal_soc_hdl)
  974. {
  975. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  976. hal_soc->ops->hal_tx_dump_ppe_vp_entry(hal_soc_hdl);
  977. }
  978. /**
  979. * hal_tx_enable_pri2tid_map- Enable the priority to tid mapping
  980. * @hal_soc_hdl: HAL SoC context
  981. * @val: True/False value
  982. *
  983. * Return: void
  984. */
  985. static inline void
  986. hal_tx_enable_pri2tid_map(hal_soc_handle_t hal_soc_hdl, bool val,
  987. uint8_t ppe_vp_idx)
  988. {
  989. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  990. hal_soc->ops->hal_tx_enable_pri2tid_map(hal_soc_hdl, val,
  991. ppe_vp_idx);
  992. }
  993. #endif /* _HAL_BE_TX_H_ */