hal_be_generic_api.h 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666
  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_GENERIC_API_H_
  20. #define _HAL_BE_GENERIC_API_H_
  21. #include <hal_be_hw_headers.h>
  22. #include "hal_be_tx.h"
  23. #include "hal_be_reo.h"
  24. #include <hal_api_mon.h>
  25. #include <hal_generic_api.h>
  26. #include <hal_be_api_mon.h>
  27. /**
  28. * Debug macro to print the TLV header tag
  29. */
  30. #define SHOW_DEFINED(x) do {} while (0)
  31. /**
  32. * hal_tx_comp_get_status() - TQM Release reason
  33. * @hal_desc: completion ring Tx status
  34. *
  35. * This function will parse the WBM completion descriptor and populate in
  36. * HAL structure
  37. *
  38. * Return: none
  39. */
  40. static inline void
  41. hal_tx_comp_get_status_generic_be(void *desc, void *ts1,
  42. struct hal_soc *hal)
  43. {
  44. uint8_t rate_stats_valid = 0;
  45. uint32_t rate_stats = 0;
  46. struct hal_tx_completion_status *ts =
  47. (struct hal_tx_completion_status *)ts1;
  48. ts->ppdu_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  49. TQM_STATUS_NUMBER);
  50. ts->ack_frame_rssi = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  51. ACK_FRAME_RSSI);
  52. ts->first_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  53. FIRST_MSDU);
  54. ts->last_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  55. LAST_MSDU);
  56. #if 0
  57. // TODO - This has to be calculated form first and last msdu
  58. ts->msdu_part_of_amsdu = HAL_TX_DESC_GET(desc,
  59. WBM2SW_COMPLETION_RING_TX,
  60. MSDU_PART_OF_AMSDU);
  61. #endif
  62. ts->peer_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  63. SW_PEER_ID);
  64. ts->tid = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX, TID);
  65. ts->transmit_cnt = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  66. TRANSMIT_COUNT);
  67. rate_stats = HAL_TX_DESC_GET(desc, HAL_TX_COMP, TX_RATE_STATS);
  68. rate_stats_valid = HAL_TX_MS(TX_RATE_STATS_INFO,
  69. TX_RATE_STATS_INFO_VALID, rate_stats);
  70. ts->valid = rate_stats_valid;
  71. if (rate_stats_valid) {
  72. ts->bw = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_BW,
  73. rate_stats);
  74. ts->pkt_type = HAL_TX_MS(TX_RATE_STATS_INFO,
  75. TRANSMIT_PKT_TYPE, rate_stats);
  76. ts->stbc = HAL_TX_MS(TX_RATE_STATS_INFO,
  77. TRANSMIT_STBC, rate_stats);
  78. ts->ldpc = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_LDPC,
  79. rate_stats);
  80. ts->sgi = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_SGI,
  81. rate_stats);
  82. ts->mcs = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_MCS,
  83. rate_stats);
  84. ts->ofdma = HAL_TX_MS(TX_RATE_STATS_INFO, OFDMA_TRANSMISSION,
  85. rate_stats);
  86. ts->tones_in_ru = HAL_TX_MS(TX_RATE_STATS_INFO, TONES_IN_RU,
  87. rate_stats);
  88. }
  89. ts->release_src = hal_tx_comp_get_buffer_source_generic_be(desc);
  90. ts->status = hal_tx_comp_get_release_reason(
  91. desc,
  92. hal_soc_to_hal_soc_handle(hal));
  93. ts->tsf = HAL_TX_DESC_GET(desc, UNIFIED_WBM_RELEASE_RING_6,
  94. TX_RATE_STATS_INFO_TX_RATE_STATS);
  95. }
  96. /**
  97. * hal_tx_set_pcp_tid_map_generic_be() - Configure default PCP to TID map table
  98. * @soc: HAL SoC context
  99. * @map: PCP-TID mapping table
  100. *
  101. * PCP are mapped to 8 TID values using TID values programmed
  102. * in one set of mapping registers PCP_TID_MAP_<0 to 6>
  103. * The mapping register has TID mapping for 8 PCP values
  104. *
  105. * Return: none
  106. */
  107. static void hal_tx_set_pcp_tid_map_generic_be(struct hal_soc *soc, uint8_t *map)
  108. {
  109. uint32_t addr, value;
  110. addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
  111. MAC_TCL_REG_REG_BASE);
  112. value = (map[0] |
  113. (map[1] << HWIO_TCL_R0_PCP_TID_MAP_PCP_1_SHFT) |
  114. (map[2] << HWIO_TCL_R0_PCP_TID_MAP_PCP_2_SHFT) |
  115. (map[3] << HWIO_TCL_R0_PCP_TID_MAP_PCP_3_SHFT) |
  116. (map[4] << HWIO_TCL_R0_PCP_TID_MAP_PCP_4_SHFT) |
  117. (map[5] << HWIO_TCL_R0_PCP_TID_MAP_PCP_5_SHFT) |
  118. (map[6] << HWIO_TCL_R0_PCP_TID_MAP_PCP_6_SHFT) |
  119. (map[7] << HWIO_TCL_R0_PCP_TID_MAP_PCP_7_SHFT));
  120. HAL_REG_WRITE(soc, addr, (value & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
  121. }
  122. /**
  123. * hal_tx_update_pcp_tid_generic_be() - Update the pcp tid map table with
  124. * value received from user-space
  125. * @soc: HAL SoC context
  126. * @pcp: pcp value
  127. * @tid : tid value
  128. *
  129. * Return: void
  130. */
  131. static void
  132. hal_tx_update_pcp_tid_generic_be(struct hal_soc *soc,
  133. uint8_t pcp, uint8_t tid)
  134. {
  135. uint32_t addr, value, regval;
  136. addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
  137. MAC_TCL_REG_REG_BASE);
  138. value = (uint32_t)tid << (HAL_TX_BITS_PER_TID * pcp);
  139. /* Read back previous PCP TID config and update
  140. * with new config.
  141. */
  142. regval = HAL_REG_READ(soc, addr);
  143. regval &= ~(HAL_TX_TID_BITS_MASK << (HAL_TX_BITS_PER_TID * pcp));
  144. regval |= value;
  145. HAL_REG_WRITE(soc, addr,
  146. (regval & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
  147. }
  148. /**
  149. * hal_tx_update_tidmap_prty_generic_be() - Update the tid map priority
  150. * @soc: HAL SoC context
  151. * @val: priority value
  152. *
  153. * Return: void
  154. */
  155. static
  156. void hal_tx_update_tidmap_prty_generic_be(struct hal_soc *soc, uint8_t value)
  157. {
  158. uint32_t addr;
  159. addr = HWIO_TCL_R0_TID_MAP_PRTY_ADDR(
  160. MAC_TCL_REG_REG_BASE);
  161. HAL_REG_WRITE(soc, addr,
  162. (value & HWIO_TCL_R0_TID_MAP_PRTY_RMSK));
  163. }
  164. /**
  165. * hal_rx_get_tlv_size_generic_be() - Get rx packet tlv size
  166. * @rx_pkt_tlv_size: TLV size for regular RX packets
  167. * @rx_mon_pkt_tlv_size: TLV size for monitor mode packets
  168. *
  169. * Return: size of rx pkt tlv before the actual data
  170. */
  171. static void hal_rx_get_tlv_size_generic_be(uint16_t *rx_pkt_tlv_size,
  172. uint16_t *rx_mon_pkt_tlv_size)
  173. {
  174. *rx_pkt_tlv_size = RX_PKT_TLVS_LEN;
  175. /* For now mon pkt tlv is same as rx pkt tlv */
  176. *rx_mon_pkt_tlv_size = RX_PKT_TLVS_LEN;
  177. }
  178. /**
  179. * hal_rx_flow_get_tuple_info_be() - Setup a flow search entry in HW FST
  180. * @fst: Pointer to the Rx Flow Search Table
  181. * @hal_hash: HAL 5 tuple hash
  182. * @tuple_info: 5-tuple info of the flow returned to the caller
  183. *
  184. * Return: Success/Failure
  185. */
  186. static void *
  187. hal_rx_flow_get_tuple_info_be(uint8_t *rx_fst, uint32_t hal_hash,
  188. uint8_t *flow_tuple_info)
  189. {
  190. struct hal_rx_fst *fst = (struct hal_rx_fst *)rx_fst;
  191. void *hal_fse = NULL;
  192. struct hal_flow_tuple_info *tuple_info
  193. = (struct hal_flow_tuple_info *)flow_tuple_info;
  194. hal_fse = (uint8_t *)fst->base_vaddr +
  195. (hal_hash * HAL_RX_FST_ENTRY_SIZE);
  196. if (!hal_fse || !tuple_info)
  197. return NULL;
  198. if (!HAL_GET_FLD(hal_fse, RX_FLOW_SEARCH_ENTRY, VALID))
  199. return NULL;
  200. tuple_info->src_ip_127_96 =
  201. qdf_ntohl(HAL_GET_FLD(hal_fse,
  202. RX_FLOW_SEARCH_ENTRY,
  203. SRC_IP_127_96));
  204. tuple_info->src_ip_95_64 =
  205. qdf_ntohl(HAL_GET_FLD(hal_fse,
  206. RX_FLOW_SEARCH_ENTRY,
  207. SRC_IP_95_64));
  208. tuple_info->src_ip_63_32 =
  209. qdf_ntohl(HAL_GET_FLD(hal_fse,
  210. RX_FLOW_SEARCH_ENTRY,
  211. SRC_IP_63_32));
  212. tuple_info->src_ip_31_0 =
  213. qdf_ntohl(HAL_GET_FLD(hal_fse,
  214. RX_FLOW_SEARCH_ENTRY,
  215. SRC_IP_31_0));
  216. tuple_info->dest_ip_127_96 =
  217. qdf_ntohl(HAL_GET_FLD(hal_fse,
  218. RX_FLOW_SEARCH_ENTRY,
  219. DEST_IP_127_96));
  220. tuple_info->dest_ip_95_64 =
  221. qdf_ntohl(HAL_GET_FLD(hal_fse,
  222. RX_FLOW_SEARCH_ENTRY,
  223. DEST_IP_95_64));
  224. tuple_info->dest_ip_63_32 =
  225. qdf_ntohl(HAL_GET_FLD(hal_fse,
  226. RX_FLOW_SEARCH_ENTRY,
  227. DEST_IP_63_32));
  228. tuple_info->dest_ip_31_0 =
  229. qdf_ntohl(HAL_GET_FLD(hal_fse,
  230. RX_FLOW_SEARCH_ENTRY,
  231. DEST_IP_31_0));
  232. tuple_info->dest_port = HAL_GET_FLD(hal_fse,
  233. RX_FLOW_SEARCH_ENTRY,
  234. DEST_PORT);
  235. tuple_info->src_port = HAL_GET_FLD(hal_fse,
  236. RX_FLOW_SEARCH_ENTRY,
  237. SRC_PORT);
  238. tuple_info->l4_protocol = HAL_GET_FLD(hal_fse,
  239. RX_FLOW_SEARCH_ENTRY,
  240. L4_PROTOCOL);
  241. return hal_fse;
  242. }
  243. /**
  244. * hal_rx_flow_delete_entry_be() - Setup a flow search entry in HW FST
  245. * @fst: Pointer to the Rx Flow Search Table
  246. * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
  247. *
  248. * Return: Success/Failure
  249. */
  250. static QDF_STATUS
  251. hal_rx_flow_delete_entry_be(uint8_t *rx_fst, void *hal_rx_fse)
  252. {
  253. uint8_t *fse = (uint8_t *)hal_rx_fse;
  254. if (!HAL_GET_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID))
  255. return QDF_STATUS_E_NOENT;
  256. HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID);
  257. return QDF_STATUS_SUCCESS;
  258. }
  259. /**
  260. * hal_rx_fst_get_fse_size_be() - Retrieve the size of each entry in Rx FST
  261. *
  262. * Return: size of each entry/flow in Rx FST
  263. */
  264. static inline uint32_t
  265. hal_rx_fst_get_fse_size_be(void)
  266. {
  267. return HAL_RX_FST_ENTRY_SIZE;
  268. }
  269. /*
  270. * TX MONITOR
  271. */
  272. #ifdef QCA_MONITOR_2_0_SUPPORT
  273. /**
  274. * hal_txmon_get_buffer_addr_generic_be() - api to get buffer address
  275. * @tx_tlv: pointer to TLV header
  276. * @status: hal mon buffer address status
  277. *
  278. * Return: Address to qdf_frag_t
  279. */
  280. static inline qdf_frag_t
  281. hal_txmon_get_buffer_addr_generic_be(void *tx_tlv,
  282. struct hal_mon_buf_addr_status *status)
  283. {
  284. struct mon_buffer_addr *hal_buffer_addr =
  285. (struct mon_buffer_addr *)((uint8_t *)tx_tlv +
  286. HAL_RX_TLV64_HDR_SIZE);
  287. qdf_frag_t buf_addr = NULL;
  288. buf_addr = (qdf_frag_t)(uintptr_t)((hal_buffer_addr->buffer_virt_addr_31_0 |
  289. ((unsigned long long)hal_buffer_addr->buffer_virt_addr_63_32 <<
  290. 32)));
  291. /* qdf_frag_t is derived from buffer address tlv */
  292. if (qdf_unlikely(status)) {
  293. qdf_mem_copy(status,
  294. (uint8_t *)tx_tlv + HAL_RX_TLV64_HDR_SIZE,
  295. sizeof(struct hal_mon_buf_addr_status));
  296. /* update hal_mon_buf_addr_status */
  297. }
  298. return buf_addr;
  299. }
  300. #if defined(TX_MONITOR_WORD_MASK)
  301. /**
  302. * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
  303. *
  304. * @tx_tlv: pointer to tx_fes_setup tlv header
  305. *
  306. * Return: number of users
  307. */
  308. static inline uint8_t
  309. hal_txmon_get_num_users(void *tx_tlv)
  310. {
  311. hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
  312. return tx_fes_setup->number_of_users;
  313. }
  314. /**
  315. * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
  316. *
  317. * @tx_tlv: pointer to tx_fes_setup tlv header
  318. * @ppdu_info: pointer to hal_tx_ppdu_info
  319. *
  320. * Return: void
  321. */
  322. static inline void
  323. hal_txmon_parse_tx_fes_setup(void *tx_tlv,
  324. struct hal_tx_ppdu_info *tx_ppdu_info)
  325. {
  326. hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
  327. tx_ppdu_info->num_users = tx_fes_setup->number_of_users;
  328. if (tx_ppdu_info->num_users == 0)
  329. tx_ppdu_info->num_users = 1;
  330. tx_ppdu_info->ppdu_id = tx_fes_setup->schedule_id;
  331. }
  332. /**
  333. * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
  334. *
  335. * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
  336. * @data_status_info: pointer to data hal_tx_status_info
  337. * @prot_status_info: pointer to protection hal_tx_status_info
  338. *
  339. * Return: void
  340. */
  341. static inline void
  342. hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
  343. struct hal_tx_status_info *data_status_info,
  344. struct hal_tx_status_info *prot_status_info)
  345. {
  346. }
  347. /**
  348. * hal_txmon_parse_peer_entry() - parse peer entry tlv
  349. *
  350. * @tx_tlv: pointer to peer_entry tlv header
  351. * @user_id: user_id
  352. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  353. * @tx_status_info: pointer to hal_tx_status_info
  354. *
  355. * Return: void
  356. */
  357. static inline void
  358. hal_txmon_parse_peer_entry(void *tx_tlv,
  359. uint8_t user_id,
  360. struct hal_tx_ppdu_info *tx_ppdu_info,
  361. struct hal_tx_status_info *tx_status_info)
  362. {
  363. }
  364. /**
  365. * hal_txmon_parse_queue_exten() - parse queue exten tlv
  366. *
  367. * @tx_tlv: pointer to queue exten tlv header
  368. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  369. *
  370. * Return: void
  371. */
  372. static inline void
  373. hal_txmon_parse_queue_exten(void *tx_tlv,
  374. struct hal_tx_ppdu_info *tx_ppdu_info)
  375. {
  376. }
  377. /**
  378. * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
  379. *
  380. * @tx_tlv: pointer to mpdu start tlv header
  381. * @user_id: user id
  382. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  383. *
  384. * Return: void
  385. */
  386. static inline void
  387. hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
  388. struct hal_tx_ppdu_info *tx_ppdu_info)
  389. {
  390. }
  391. #else
  392. /**
  393. * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
  394. *
  395. * @tx_tlv: pointer to tx_fes_setup tlv header
  396. *
  397. * Return: number of users
  398. */
  399. static inline uint8_t
  400. hal_txmon_get_num_users(void *tx_tlv)
  401. {
  402. uint8_t num_users = HAL_TX_DESC_GET_64(tx_tlv,
  403. TX_FES_SETUP, NUMBER_OF_USERS);
  404. return num_users;
  405. }
  406. /**
  407. * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
  408. *
  409. * @tx_tlv: pointer to tx_fes_setup tlv header
  410. * @ppdu_info: pointer to hal_tx_ppdu_info
  411. *
  412. * Return: void
  413. */
  414. static inline void
  415. hal_txmon_parse_tx_fes_setup(void *tx_tlv,
  416. struct hal_tx_ppdu_info *tx_ppdu_info)
  417. {
  418. uint32_t num_users = 0;
  419. uint32_t ppdu_id = 0;
  420. num_users = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, NUMBER_OF_USERS);
  421. ppdu_id = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, SCHEDULE_ID);
  422. if (num_users == 0)
  423. num_users = 1;
  424. tx_ppdu_info->num_users = num_users;
  425. tx_ppdu_info->ppdu_id = ppdu_id;
  426. }
  427. /**
  428. * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
  429. *
  430. * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
  431. * @data_status_info: pointer to data hal_tx_status_info
  432. * @prot_status_info: pointer to protection hal_tx_status_info
  433. *
  434. * Return: void
  435. */
  436. static inline void
  437. hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
  438. struct hal_tx_status_info *data_status_info,
  439. struct hal_tx_status_info *prot_status_info)
  440. {
  441. }
  442. /**
  443. * hal_txmon_parse_peer_entry() - parse peer entry tlv
  444. *
  445. * @tx_tlv: pointer to peer_entry tlv header
  446. * @user_id: user_id
  447. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  448. * @tx_status_info: pointer to hal_tx_status_info
  449. *
  450. * Return: void
  451. */
  452. static inline void
  453. hal_txmon_parse_peer_entry(void *tx_tlv,
  454. uint8_t user_id,
  455. struct hal_tx_ppdu_info *tx_ppdu_info,
  456. struct hal_tx_status_info *tx_status_info)
  457. {
  458. }
  459. /**
  460. * hal_txmon_parse_queue_exten() - parse queue exten tlv
  461. *
  462. * @tx_tlv: pointer to queue exten tlv header
  463. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  464. *
  465. * Return: void
  466. */
  467. static inline void
  468. hal_txmon_parse_queue_exten(void *tx_tlv,
  469. struct hal_tx_ppdu_info *tx_ppdu_info)
  470. {
  471. }
  472. /**
  473. * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
  474. *
  475. * @tx_tlv: pointer to mpdu start tlv header
  476. * @user_id: user id
  477. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  478. *
  479. * Return: void
  480. */
  481. static inline void
  482. hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
  483. struct hal_tx_ppdu_info *tx_ppdu_info)
  484. {
  485. }
  486. #endif
  487. /**
  488. * hal_txmon_status_get_num_users_generic_be() - api to get num users
  489. * from start of fes window
  490. *
  491. * @tx_tlv_hdr: pointer to TLV header
  492. * @num_users: reference to number of user
  493. *
  494. * Return: status
  495. */
  496. static inline uint32_t
  497. hal_txmon_status_get_num_users_generic_be(void *tx_tlv_hdr, uint8_t *num_users)
  498. {
  499. uint32_t tlv_tag, user_id, tlv_len;
  500. uint32_t tlv_status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
  501. void *tx_tlv;
  502. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(tx_tlv_hdr);
  503. user_id = HAL_RX_GET_USER_TLV32_USERID(tx_tlv_hdr);
  504. tlv_len = HAL_RX_GET_USER_TLV32_LEN(tx_tlv_hdr);
  505. tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
  506. /* window starts with either initiator or response */
  507. switch (tlv_tag) {
  508. case WIFITX_FES_SETUP_E:
  509. {
  510. *num_users = hal_txmon_get_num_users(tx_tlv);
  511. if (*num_users == 0)
  512. *num_users = 1;
  513. tlv_status = HAL_MON_TX_FES_SETUP;
  514. break;
  515. }
  516. case WIFIRX_RESPONSE_REQUIRED_INFO_E:
  517. {
  518. *num_users = HAL_TX_DESC_GET_64(tx_tlv,
  519. RX_RESPONSE_REQUIRED_INFO,
  520. RESPONSE_STA_COUNT);
  521. if (*num_users == 0)
  522. *num_users = 1;
  523. tlv_status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
  524. break;
  525. }
  526. };
  527. return tlv_status;
  528. }
  529. /**
  530. * hal_txmon_free_status_buffer() - api to free status buffer
  531. * @pdev_handle: DP_PDEV handle
  532. * @status_frag: qdf_frag_t buffer
  533. * @end_offset: end offset within buffer that has valid data
  534. *
  535. * Return status
  536. */
  537. static inline QDF_STATUS
  538. hal_txmon_status_free_buffer_generic_be(qdf_frag_t status_frag,
  539. uint32_t end_offset)
  540. {
  541. uint32_t tlv_tag, tlv_len;
  542. uint32_t tlv_status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
  543. uint8_t *tx_tlv;
  544. uint8_t *tx_tlv_start;
  545. qdf_frag_t frag_buf = NULL;
  546. QDF_STATUS status = QDF_STATUS_E_ABORTED;
  547. tx_tlv = (uint8_t *)status_frag;
  548. tx_tlv_start = tx_tlv;
  549. /* parse tlv and populate tx_ppdu_info */
  550. do {
  551. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv);
  552. tlv_len = HAL_RX_GET_USER_TLV64_LEN(tx_tlv);
  553. if (((tx_tlv - tx_tlv_start) + tlv_len) > end_offset)
  554. return QDF_STATUS_E_ABORTED;
  555. if (tlv_tag == WIFIMON_BUFFER_ADDR_E) {
  556. frag_buf = hal_txmon_get_buffer_addr_generic_be(tx_tlv,
  557. NULL);
  558. if (frag_buf)
  559. qdf_frag_free(frag_buf);
  560. frag_buf = NULL;
  561. }
  562. if (WIFITX_FES_STATUS_END_E == tlv_tag ||
  563. WIFIRESPONSE_END_STATUS_E == tlv_tag ||
  564. WIFIDUMMY_E == tlv_tag) {
  565. status = QDF_STATUS_SUCCESS;
  566. break;
  567. }
  568. /* need api definition for hal_tx_status_get_next_tlv */
  569. tx_tlv = hal_tx_status_get_next_tlv(tx_tlv);
  570. if ((tx_tlv - tx_tlv_start) >= end_offset)
  571. break;
  572. } while (tlv_status == HAL_MON_TX_STATUS_PPDU_NOT_DONE);
  573. return status;
  574. }
  575. /**
  576. * hal_tx_get_ppdu_info() - api to get tx ppdu info
  577. * @pdev_handle: DP_PDEV handle
  578. * @prot_ppdu_info: populate dp_ppdu_info protection
  579. * @tx_data_ppdu_info: populate dp_ppdu_info data
  580. * @tlv_tag: Tag
  581. *
  582. * Return: dp_tx_ppdu_info pointer
  583. */
  584. static inline void *
  585. hal_tx_get_ppdu_info(void *data_info, void *prot_info, uint32_t tlv_tag)
  586. {
  587. struct hal_tx_ppdu_info *prot_ppdu_info = prot_info;
  588. switch (tlv_tag) {
  589. case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
  590. case WIFITX_FLUSH_E:/* DOWNSTREAM */
  591. case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
  592. case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
  593. case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
  594. case WIFITX_MPDU_START_E:/* DOWNSTREAM */
  595. case WIFITX_MSDU_START_E:/* DOWNSTREAM */
  596. case WIFITX_DATA_E:/* DOWNSTREAM */
  597. case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
  598. case WIFITX_MPDU_END_E:/* DOWNSTREAM */
  599. case WIFITX_MSDU_END_E:/* DOWNSTREAM */
  600. case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
  601. case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
  602. case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
  603. case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
  604. case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
  605. case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
  606. case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
  607. case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
  608. case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
  609. case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
  610. case WIFISCHEDULER_END_E:/* DOWNSTREAM */
  611. case WIFITX_FES_STATUS_START_PPDU_E:/* UPSTREAM */
  612. {
  613. return data_info;
  614. }
  615. }
  616. /*
  617. * check current prot_tlv_status is start protection
  618. * check current tlv_tag is either start protection or end protection
  619. */
  620. if (TXMON_HAL(prot_ppdu_info,
  621. prot_tlv_status) == WIFITX_FES_STATUS_START_PROT_E) {
  622. return prot_info;
  623. } else if (tlv_tag == WIFITX_FES_STATUS_PROT_E ||
  624. tlv_tag == WIFITX_FES_STATUS_START_PROT_E) {
  625. TXMON_HAL(prot_ppdu_info, prot_tlv_status) = tlv_tag;
  626. return prot_info;
  627. } else {
  628. TXMON_HAL(prot_ppdu_info, prot_tlv_status) = tlv_tag;
  629. return data_info;
  630. }
  631. return data_info;
  632. }
  633. /**
  634. * hal_txmon_status_parse_tlv_generic_be() - api to parse status tlv.
  635. * @data_ppdu_info: hal_txmon data ppdu info
  636. * @prot_ppdu_info: hal_txmon prot ppdu info
  637. * @data_status_info: pointer to data status info
  638. * @prot_status_info: pointer to prot status info
  639. * @tx_tlv_hdr: fragment of tx_tlv_hdr
  640. * @status_frag: qdf_frag_t buffer
  641. *
  642. * Return: status
  643. */
  644. static inline uint32_t
  645. hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
  646. void *prot_ppdu_info,
  647. void *data_status_info,
  648. void *prot_status_info,
  649. void *tx_tlv_hdr,
  650. qdf_frag_t status_frag)
  651. {
  652. struct hal_tx_ppdu_info *ppdu_info;
  653. struct hal_tx_status_info *tx_status_info;
  654. uint32_t tlv_tag, user_id, tlv_len;
  655. qdf_frag_t frag_buf = NULL;
  656. uint32_t status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
  657. void *tx_tlv;
  658. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv_hdr);
  659. /* user_id start with 1, decrement by 1 to start from 0 */
  660. user_id = HAL_RX_GET_USER_TLV64_USERID(tx_tlv_hdr) - 1;
  661. tlv_len = HAL_RX_GET_USER_TLV64_LEN(tx_tlv_hdr);
  662. tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
  663. /* parse tlv and populate tx_ppdu_info */
  664. ppdu_info = hal_tx_get_ppdu_info(data_ppdu_info,
  665. prot_ppdu_info, tlv_tag);
  666. tx_status_info = (ppdu_info->is_data ? data_status_info :
  667. prot_status_info);
  668. user_id = user_id > ppdu_info->num_users ? 0 : ppdu_info->num_users;
  669. switch (tlv_tag) {
  670. /* start of initiator FES window */
  671. case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
  672. {
  673. /* initiator PPDU window start */
  674. hal_txmon_parse_tx_fes_setup(tx_tlv, ppdu_info);
  675. status = HAL_MON_TX_FES_SETUP;
  676. SHOW_DEFINED(WIFITX_FES_SETUP_E);
  677. break;
  678. }
  679. /* end of initiator FES window */
  680. case WIFITX_FES_STATUS_END_E:/* UPSTREAM */
  681. {
  682. /* initiator PPDU window end */
  683. status = HAL_MON_TX_FES_STATUS_END;
  684. SHOW_DEFINED(WIFITX_FES_STATUS_END_E);
  685. break;
  686. }
  687. /* response window open */
  688. case WIFIRX_RESPONSE_REQUIRED_INFO_E:/* UPSTREAM */
  689. {
  690. status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
  691. SHOW_DEFINED(WIFIRX_RESPONSE_REQUIRED_INFO_E);
  692. break;
  693. }
  694. /* Response window close */
  695. case WIFIRESPONSE_END_STATUS_E:/* UPSTREAM */
  696. {
  697. /* response PPDU window end */
  698. status = HAL_MON_RESPONSE_END_STATUS_INFO;
  699. SHOW_DEFINED(WIFIRESPONSE_END_STATUS_E);
  700. break;
  701. }
  702. case WIFITX_FLUSH_E:/* DOWNSTREAM */
  703. {
  704. SHOW_DEFINED(WIFITX_FLUSH_E);
  705. break;
  706. }
  707. /* Downstream tlv */
  708. case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
  709. {
  710. hal_txmon_parse_pcu_ppdu_setup_init(tx_tlv, data_status_info,
  711. prot_status_info);
  712. status = HAL_MON_TX_PCU_PPDU_SETUP_INIT;
  713. SHOW_DEFINED(WIFIPCU_PPDU_SETUP_INIT_E);
  714. break;
  715. }
  716. case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
  717. {
  718. hal_txmon_parse_peer_entry(tx_tlv, user_id,
  719. ppdu_info, tx_status_info);
  720. SHOW_DEFINED(WIFITX_PEER_ENTRY_E);
  721. break;
  722. }
  723. case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
  724. {
  725. hal_txmon_parse_queue_exten(tx_tlv, ppdu_info);
  726. SHOW_DEFINED(WIFITX_QUEUE_EXTENSION_E);
  727. break;
  728. }
  729. /* payload and data frame handling */
  730. case WIFITX_MPDU_START_E:/* DOWNSTREAM */
  731. {
  732. hal_txmon_parse_mpdu_start(tx_tlv, user_id, ppdu_info);
  733. status = HAL_MON_TX_MPDU_START;
  734. SHOW_DEFINED(WIFITX_MPDU_START_E);
  735. break;
  736. }
  737. case WIFITX_MSDU_START_E:/* DOWNSTREAM */
  738. {
  739. /* compacted */
  740. /* we expect frame to be 802.11 frame type */
  741. status = HAL_MON_TX_MSDU_START;
  742. SHOW_DEFINED(WIFITX_MSDU_START_E);
  743. break;
  744. }
  745. case WIFITX_DATA_E:/* DOWNSTREAM */
  746. {
  747. /*
  748. * reference of the status buffer will be held in
  749. * dp_tx_update_ppdu_info_status()
  750. */
  751. status = HAL_MON_TX_DATA;
  752. SHOW_DEFINED(WIFITX_DATA_E);
  753. break;
  754. }
  755. case WIFIMON_BUFFER_ADDR_E:
  756. {
  757. frag_buf = hal_txmon_get_buffer_addr_generic_be(tx_tlv, NULL);
  758. if (frag_buf)
  759. qdf_frag_free(frag_buf);
  760. frag_buf = NULL;
  761. status = HAL_MON_TX_BUFFER_ADDR;
  762. SHOW_DEFINED(WIFIMON_BUFFER_ADDR_E);
  763. break;
  764. }
  765. case WIFITX_MPDU_END_E:/* DOWNSTREAM */
  766. {
  767. /* no tlv content */
  768. SHOW_DEFINED(WIFITX_MPDU_END_E);
  769. break;
  770. }
  771. case WIFITX_MSDU_END_E:/* DOWNSTREAM */
  772. {
  773. /* no tlv content */
  774. SHOW_DEFINED(WIFITX_MSDU_END_E);
  775. break;
  776. }
  777. case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
  778. {
  779. /* no tlv content */
  780. SHOW_DEFINED(WIFITX_LAST_MPDU_FETCHED_E);
  781. break;
  782. }
  783. case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
  784. {
  785. /* no tlv content */
  786. SHOW_DEFINED(WIFITX_LAST_MPDU_END_E);
  787. break;
  788. }
  789. case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
  790. {
  791. /*
  792. * transmitting power
  793. * minimum transmitting power
  794. * desired nss
  795. * tx chain mask
  796. * desired bw
  797. * duration of transmit and response
  798. *
  799. * since most of the field we are deriving from other tlv
  800. * we don't need to enable this in our tlv.
  801. */
  802. SHOW_DEFINED(WIFICOEX_TX_REQ_E);
  803. break;
  804. }
  805. case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
  806. {
  807. /* user tlv */
  808. /*
  809. * All Tx monitor will have 802.11 hdr
  810. * we don't need to enable this TLV
  811. */
  812. SHOW_DEFINED(WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E);
  813. break;
  814. }
  815. case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
  816. {
  817. /*
  818. * no tlv content
  819. *
  820. * TLV that indicates to TXPCU that preamble phase for the NDP
  821. * frame transmission is now over
  822. */
  823. SHOW_DEFINED(WIFINDP_PREAMBLE_DONE_E);
  824. break;
  825. }
  826. case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
  827. {
  828. /*
  829. * no tlv content
  830. *
  831. * TLV indicates to the SCH that all timing critical TLV
  832. * has been passed on to the transmit path
  833. */
  834. SHOW_DEFINED(WIFISCH_CRITICAL_TLV_REFERENCE_E);
  835. break;
  836. }
  837. case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
  838. {
  839. /*
  840. * Loopback specific setup info - not needed for Tx monitor
  841. */
  842. SHOW_DEFINED(WIFITX_LOOPBACK_SETUP_E);
  843. break;
  844. }
  845. case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
  846. {
  847. /*
  848. * no tlv content
  849. *
  850. * TLV indicates that other modules besides the scheduler can
  851. * now also start generating TLV's
  852. * prevent colliding or generating TLV's out of order
  853. */
  854. SHOW_DEFINED(WIFITX_FES_SETUP_COMPLETE_E);
  855. break;
  856. }
  857. case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
  858. {
  859. /*
  860. * no tlv content
  861. *
  862. * TLV indicates to SCH that a burst of MPDU info will
  863. * start to come in over the TLV
  864. */
  865. SHOW_DEFINED(WIFITQM_MPDU_GLOBAL_START_E);
  866. break;
  867. }
  868. case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
  869. {
  870. SHOW_DEFINED(WIFITX_WUR_DATA_E);
  871. break;
  872. }
  873. case WIFISCHEDULER_END_E:/* DOWNSTREAM */
  874. {
  875. /*
  876. * no tlv content
  877. *
  878. * TLV indicates END of all TLV's within the scheduler TLV
  879. */
  880. SHOW_DEFINED(WIFISCHEDULER_END_E);
  881. break;
  882. }
  883. /* Upstream tlv */
  884. case WIFIPDG_TX_REQ_E:
  885. {
  886. SHOW_DEFINED(WIFIPDG_TX_REQ_E);
  887. break;
  888. }
  889. case WIFITX_FES_STATUS_START_E:
  890. {
  891. /*
  892. * TLV indicating that first transmission on the medium
  893. */
  894. status = HAL_MON_TX_FES_STATUS_START;
  895. SHOW_DEFINED(WIFITX_FES_STATUS_START_E);
  896. break;
  897. }
  898. case WIFITX_FES_STATUS_PROT_E:
  899. {
  900. /*
  901. * generated by TXPCU to indicate the result of having
  902. * received of the expected protection frame
  903. */
  904. status = HAL_MON_TX_FES_STATUS_PROT;
  905. SHOW_DEFINED(WIFITX_FES_STATUS_PROT_E);
  906. break;
  907. }
  908. case WIFITX_FES_STATUS_START_PROT_E:
  909. {
  910. status = HAL_MON_TX_FES_STATUS_START_PROT;
  911. SHOW_DEFINED(WIFITX_FES_STATUS_START_PROT_E);
  912. break;
  913. }
  914. case WIFIPROT_TX_END_E:
  915. {
  916. /*
  917. * no tlv content
  918. *
  919. * generated by TXPCU the moment that protection frame
  920. * transmission has finished on the medium
  921. */
  922. SHOW_DEFINED(WIFIPROT_TX_END_E);
  923. break;
  924. }
  925. case WIFITX_FES_STATUS_START_PPDU_E:
  926. {
  927. status = HAL_MON_TX_FES_STATUS_START_PPDU;
  928. SHOW_DEFINED(WIFITX_FES_STATUS_START_PPDU_E);
  929. break;
  930. }
  931. case WIFITX_FES_STATUS_USER_PPDU_E:
  932. {
  933. /* user tlv */
  934. status = HAL_MON_TX_FES_STATUS_USER_PPDU;
  935. SHOW_DEFINED(WIFITX_FES_STATUS_USER_PPDU_E);
  936. break;
  937. }
  938. case WIFIPPDU_TX_END_E:
  939. {
  940. /*
  941. * no tlv content
  942. *
  943. * generated by TXPCU the moment that PPDU transmission has
  944. * finished on the medium
  945. */
  946. SHOW_DEFINED(WIFIPPDU_TX_END_E);
  947. break;
  948. }
  949. case WIFITX_FES_STATUS_USER_RESPONSE_E:
  950. {
  951. /*
  952. * TLV contains the FES transmit result of the each
  953. * of the MAC users. TLV are forwarded to HWSCH
  954. */
  955. SHOW_DEFINED(WIFITX_FES_STATUS_USER_RESPONSE_E);
  956. break;
  957. }
  958. case WIFITX_FES_STATUS_ACK_OR_BA_E:
  959. {
  960. /* user tlv */
  961. /*
  962. * TLV generated by RXPCU and provide information related to
  963. * the received BA or ACK frame
  964. */
  965. SHOW_DEFINED(WIFITX_FES_STATUS_ACK_OR_BA_E);
  966. break;
  967. }
  968. case WIFITX_FES_STATUS_1K_BA_E:
  969. {
  970. /* user tlv */
  971. /*
  972. * TLV generated by RXPCU and providing information related
  973. * to the received BA frame in case of 512/1024 bitmaps
  974. */
  975. SHOW_DEFINED(WIFITX_FES_STATUS_1K_BA_E);
  976. break;
  977. }
  978. case WIFIRECEIVED_RESPONSE_USER_7_0_E:
  979. {
  980. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_7_0_E);
  981. break;
  982. }
  983. case WIFIRECEIVED_RESPONSE_USER_15_8_E:
  984. {
  985. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_15_8_E);
  986. break;
  987. }
  988. case WIFIRECEIVED_RESPONSE_USER_23_16_E:
  989. {
  990. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_23_16_E);
  991. break;
  992. }
  993. case WIFIRECEIVED_RESPONSE_USER_31_24_E:
  994. {
  995. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_31_24_E);
  996. break;
  997. }
  998. case WIFIRECEIVED_RESPONSE_USER_36_32_E:
  999. {
  1000. /*
  1001. * RXPCU generates this TLV when it receives a response frame
  1002. * that TXPCU pre-announced it was waiting for and in
  1003. * RXPCU_SETUP TLV, TLV generated before the
  1004. * RECEIVED_RESPONSE_INFO TLV.
  1005. *
  1006. * received info user fields are there which is not needed
  1007. * for TX monitor
  1008. */
  1009. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_36_32_E);
  1010. break;
  1011. }
  1012. case WIFITXPCU_BUFFER_STATUS_E:
  1013. {
  1014. SHOW_DEFINED(WIFITXPCU_BUFFER_STATUS_E);
  1015. break;
  1016. }
  1017. case WIFITXPCU_USER_BUFFER_STATUS_E:
  1018. {
  1019. /*
  1020. * WIFITXPCU_USER_BUFFER_STATUS_E - user tlv
  1021. * for TX monitor we aren't interested in this tlv
  1022. */
  1023. SHOW_DEFINED(WIFITXPCU_USER_BUFFER_STATUS_E);
  1024. break;
  1025. }
  1026. case WIFITXDMA_STOP_REQUEST_E:
  1027. {
  1028. /*
  1029. * no tlv content
  1030. *
  1031. * TLV is destined to TXDMA and informs TXDMA to stop
  1032. * pushing data into the transmit path.
  1033. */
  1034. SHOW_DEFINED(WIFITXDMA_STOP_REQUEST_E);
  1035. break;
  1036. }
  1037. case WIFITX_CBF_INFO_E:
  1038. {
  1039. /*
  1040. * After NDPA + NDP is received, RXPCU sends the TX_CBF_INFO to
  1041. * TXPCU to respond the CBF frame
  1042. *
  1043. * compressed beamforming pkt doesn't has mac header
  1044. * Tx monitor not interested in this pkt.
  1045. */
  1046. SHOW_DEFINED(WIFITX_CBF_INFO_E);
  1047. break;
  1048. }
  1049. case WIFITX_MPDU_COUNT_TRANSFER_END_E:
  1050. {
  1051. /*
  1052. * no tlv content
  1053. *
  1054. * TLV indicates that TXPCU has finished generating the
  1055. * TQM_UPDATE_TX_MPDU_COUNT TLV for all users
  1056. */
  1057. SHOW_DEFINED(WIFITX_MPDU_COUNT_TRANSFER_END_E);
  1058. break;
  1059. }
  1060. case WIFIPDG_RESPONSE_E:
  1061. {
  1062. /*
  1063. * most of the feilds are already covered in
  1064. * other TLV
  1065. * This is generated by TX_PCU to PDG to calculate
  1066. * all the PHY header info.
  1067. *
  1068. * some useful fields like min transmit power,
  1069. * rate used for transmitting packet is present.
  1070. */
  1071. SHOW_DEFINED(WIFIPDG_RESPONSE_E);
  1072. break;
  1073. }
  1074. case WIFIPDG_TRIG_RESPONSE_E:
  1075. {
  1076. /* no tlv content */
  1077. SHOW_DEFINED(WIFIPDG_TRIG_RESPONSE_E);
  1078. break;
  1079. }
  1080. case WIFIRECEIVED_TRIGGER_INFO_E:
  1081. {
  1082. /*
  1083. * TLV generated by RXPCU to inform the scheduler that
  1084. * a trigger frame has been received
  1085. */
  1086. SHOW_DEFINED(WIFIRECEIVED_TRIGGER_INFO_E);
  1087. break;
  1088. }
  1089. case WIFIOFDMA_TRIGGER_DETAILS_E:
  1090. {
  1091. SHOW_DEFINED(WIFIOFDMA_TRIGGER_DETAILS_E);
  1092. break;
  1093. }
  1094. case WIFIRX_FRAME_BITMAP_ACK_E:
  1095. {
  1096. /* user tlv */
  1097. status = HAL_MON_RX_FRAME_BITMAP_ACK;
  1098. SHOW_DEFINED(WIFIRX_FRAME_BITMAP_ACK_E);
  1099. break;
  1100. }
  1101. case WIFIRX_FRAME_1K_BITMAP_ACK_E:
  1102. {
  1103. /* user tlv */
  1104. status = HAL_MON_RX_FRAME_BITMAP_BLOCK_ACK_1K;
  1105. SHOW_DEFINED(WIFIRX_FRAME_1K_BITMAP_ACK_E);
  1106. break;
  1107. }
  1108. case WIFIRESPONSE_START_STATUS_E:
  1109. {
  1110. /*
  1111. * TLV indicates which HW response the TXPCU
  1112. * started generating
  1113. *
  1114. * HW generated frames like
  1115. * ACK frame - handled
  1116. * CTS frame - handled
  1117. * BA frame - handled
  1118. * MBA frame - handled
  1119. * CBF frame - no frame header
  1120. * Trigger response - TODO
  1121. * NDP LMR - no frame header
  1122. */
  1123. SHOW_DEFINED(WIFIRESPONSE_START_STATUS_E);
  1124. break;
  1125. }
  1126. case WIFIRX_START_PARAM_E:
  1127. {
  1128. /*
  1129. * RXPCU send this TLV after PHY RX detected a frame
  1130. * in the medium
  1131. *
  1132. * TX monitor not interested in this TLV
  1133. */
  1134. SHOW_DEFINED(WIFIRX_START_PARAM_E);
  1135. break;
  1136. }
  1137. case WIFIRXPCU_EARLY_RX_INDICATION_E:
  1138. {
  1139. /*
  1140. * early indication of pkt type and mcs rate
  1141. * already captured in other tlv
  1142. */
  1143. SHOW_DEFINED(WIFIRXPCU_EARLY_RX_INDICATION_E);
  1144. break;
  1145. }
  1146. case WIFIRX_PM_INFO_E:
  1147. {
  1148. SHOW_DEFINED(WIFIRX_PM_INFO_E);
  1149. break;
  1150. }
  1151. /* Active window */
  1152. case WIFITX_FLUSH_REQ_E:
  1153. {
  1154. SHOW_DEFINED(WIFITX_FLUSH_REQ_E);
  1155. break;
  1156. }
  1157. case WIFICOEX_TX_STATUS_E:
  1158. {
  1159. /* duration are retrieved from coex tx status */
  1160. status = HAL_MON_COEX_TX_STATUS;
  1161. SHOW_DEFINED(WIFICOEX_TX_STATUS_E);
  1162. break;
  1163. }
  1164. case WIFIR2R_STATUS_END_E:
  1165. {
  1166. SHOW_DEFINED(WIFIR2R_STATUS_END_E);
  1167. break;
  1168. }
  1169. case WIFIRX_PREAMBLE_E:
  1170. {
  1171. SHOW_DEFINED(WIFIRX_PREAMBLE_E);
  1172. break;
  1173. }
  1174. case WIFIMACTX_SERVICE_E:
  1175. {
  1176. SHOW_DEFINED(WIFIMACTX_SERVICE_E);
  1177. break;
  1178. }
  1179. case WIFIMACTX_U_SIG_EHT_SU_MU_E:
  1180. {
  1181. SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_SU_MU_E);
  1182. break;
  1183. }
  1184. case WIFIMACTX_U_SIG_EHT_TB_E:
  1185. {
  1186. /* TODO: no radiotap info available */
  1187. SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_TB_E);
  1188. break;
  1189. }
  1190. case WIFIMACTX_EHT_SIG_USR_OFDMA_E:
  1191. {
  1192. SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_OFDMA_E);
  1193. break;
  1194. }
  1195. case WIFIMACTX_EHT_SIG_USR_MU_MIMO_E:
  1196. {
  1197. SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_MU_MIMO_E);
  1198. break;
  1199. }
  1200. case WIFIMACTX_EHT_SIG_USR_SU_E:
  1201. {
  1202. SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_SU_E);
  1203. /* TODO: no radiotap info available */
  1204. break;
  1205. }
  1206. case WIFIMACTX_HE_SIG_A_SU_E:
  1207. {
  1208. SHOW_DEFINED(WIFIMACTX_HE_SIG_A_SU_E);
  1209. break;
  1210. }
  1211. case WIFIMACTX_HE_SIG_A_MU_DL_E:
  1212. {
  1213. SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_DL_E);
  1214. break;
  1215. }
  1216. case WIFIMACTX_HE_SIG_A_MU_UL_E:
  1217. {
  1218. SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_UL_E);
  1219. break;
  1220. }
  1221. case WIFIMACTX_HE_SIG_B1_MU_E:
  1222. {
  1223. status = HAL_MON_MACTX_HE_SIG_B1_MU;
  1224. SHOW_DEFINED(WIFIMACTX_HE_SIG_B1_MU_E);
  1225. break;
  1226. }
  1227. case WIFIMACTX_HE_SIG_B2_MU_E:
  1228. {
  1229. /* user tlv */
  1230. status = HAL_MON_MACTX_HE_SIG_B2_MU;
  1231. SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_MU_E);
  1232. break;
  1233. }
  1234. case WIFIMACTX_HE_SIG_B2_OFDMA_E:
  1235. {
  1236. /* user tlv */
  1237. status = HAL_MON_MACTX_HE_SIG_B2_OFDMA;
  1238. SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_OFDMA_E);
  1239. break;
  1240. }
  1241. case WIFIMACTX_L_SIG_A_E:
  1242. {
  1243. status = HAL_MON_MACTX_L_SIG_A;
  1244. SHOW_DEFINED(WIFIMACTX_L_SIG_A_E);
  1245. break;
  1246. }
  1247. case WIFIMACTX_L_SIG_B_E:
  1248. {
  1249. status = HAL_MON_MACTX_L_SIG_B;
  1250. SHOW_DEFINED(WIFIMACTX_L_SIG_B_E);
  1251. break;
  1252. }
  1253. case WIFIMACTX_HT_SIG_E:
  1254. {
  1255. status = HAL_MON_MACTX_HT_SIG;
  1256. SHOW_DEFINED(WIFIMACTX_HT_SIG_E);
  1257. break;
  1258. }
  1259. case WIFIMACTX_VHT_SIG_A_E:
  1260. {
  1261. status = HAL_MON_MACTX_VHT_SIG_A;
  1262. SHOW_DEFINED(WIFIMACTX_VHT_SIG_A_E);
  1263. break;
  1264. }
  1265. case WIFIMACTX_VHT_SIG_B_MU160_E:
  1266. {
  1267. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU160_E);
  1268. break;
  1269. }
  1270. case WIFIMACTX_VHT_SIG_B_MU80_E:
  1271. {
  1272. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU80_E);
  1273. break;
  1274. }
  1275. case WIFIMACTX_VHT_SIG_B_MU40_E:
  1276. {
  1277. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU40_E);
  1278. break;
  1279. }
  1280. case WIFIMACTX_VHT_SIG_B_MU20_E:
  1281. {
  1282. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU20_E);
  1283. break;
  1284. }
  1285. case WIFIMACTX_VHT_SIG_B_SU160_E:
  1286. {
  1287. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU160_E);
  1288. break;
  1289. }
  1290. case WIFIMACTX_VHT_SIG_B_SU80_E:
  1291. {
  1292. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU80_E);
  1293. break;
  1294. }
  1295. case WIFIMACTX_VHT_SIG_B_SU40_E:
  1296. {
  1297. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU40_E);
  1298. break;
  1299. }
  1300. case WIFIMACTX_VHT_SIG_B_SU20_E:
  1301. {
  1302. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU20_E);
  1303. break;
  1304. }
  1305. case WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E:
  1306. {
  1307. SHOW_DEFINED(WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E);
  1308. break;
  1309. }
  1310. case WIFIMACTX_USER_DESC_PER_USER_E:
  1311. {
  1312. status = HAL_MON_MACTX_USER_DESC_PER_USER;
  1313. SHOW_DEFINED(WIFIMACTX_USER_DESC_PER_USER_E);
  1314. break;
  1315. }
  1316. case WIFIMACTX_USER_DESC_COMMON_E:
  1317. {
  1318. SHOW_DEFINED(WIFIMACTX_USER_DESC_COMMON_E);
  1319. break;
  1320. }
  1321. case WIFIMACTX_PHY_DESC_E:
  1322. {
  1323. status = HAL_MON_MACTX_PHY_DESC;
  1324. SHOW_DEFINED(WIFIMACTX_PHY_DESC_E);
  1325. break;
  1326. }
  1327. case WIFICOEX_RX_STATUS_E:
  1328. {
  1329. SHOW_DEFINED(WIFICOEX_RX_STATUS_E);
  1330. break;
  1331. }
  1332. case WIFIRX_PPDU_ACK_REPORT_E:
  1333. {
  1334. SHOW_DEFINED(WIFIRX_PPDU_ACK_REPORT_E);
  1335. break;
  1336. }
  1337. case WIFIRX_PPDU_NO_ACK_REPORT_E:
  1338. {
  1339. SHOW_DEFINED(WIFIRX_PPDU_NO_ACK_REPORT_E);
  1340. break;
  1341. }
  1342. case WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E:
  1343. {
  1344. SHOW_DEFINED(WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E);
  1345. break;
  1346. }
  1347. case WIFITXPCU_PHYTX_DEBUG32_E:
  1348. {
  1349. SHOW_DEFINED(WIFITXPCU_PHYTX_DEBUG32_E);
  1350. break;
  1351. }
  1352. case WIFITXPCU_PREAMBLE_DONE_E:
  1353. {
  1354. SHOW_DEFINED(WIFITXPCU_PREAMBLE_DONE_E);
  1355. break;
  1356. }
  1357. case WIFIRX_PHY_SLEEP_E:
  1358. {
  1359. SHOW_DEFINED(WIFIRX_PHY_SLEEP_E);
  1360. break;
  1361. }
  1362. case WIFIRX_FRAME_BITMAP_REQ_E:
  1363. {
  1364. SHOW_DEFINED(WIFIRX_FRAME_BITMAP_REQ_E);
  1365. break;
  1366. }
  1367. case WIFIRXPCU_TX_SETUP_CLEAR_E:
  1368. {
  1369. SHOW_DEFINED(WIFIRXPCU_TX_SETUP_CLEAR_E);
  1370. break;
  1371. }
  1372. case WIFIRX_TRIG_INFO_E:
  1373. {
  1374. SHOW_DEFINED(WIFIRX_TRIG_INFO_E);
  1375. break;
  1376. }
  1377. case WIFIEXPECTED_RESPONSE_E:
  1378. {
  1379. SHOW_DEFINED(WIFIEXPECTED_RESPONSE_E);
  1380. break;
  1381. }
  1382. case WIFITRIGGER_RESPONSE_TX_DONE_E:
  1383. {
  1384. SHOW_DEFINED(WIFITRIGGER_RESPONSE_TX_DONE_E);
  1385. break;
  1386. }
  1387. }
  1388. return status;
  1389. }
  1390. #endif /* QCA_MONITOR_2_0_SUPPORT */
  1391. #ifdef REO_SHARED_QREF_TABLE_EN
  1392. static void hal_reo_shared_qaddr_cache_clear_be(hal_soc_handle_t hal_soc_hdl)
  1393. {
  1394. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  1395. uint32_t reg_val = 0;
  1396. /* Set Qdesc clear bit to erase REO internal storage for Qdesc pointers
  1397. * of 37 peer/tids
  1398. */
  1399. reg_val = HAL_REG_READ(hal, HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE));
  1400. reg_val |= HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1);
  1401. HAL_REG_WRITE(hal,
  1402. HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
  1403. reg_val);
  1404. /* Clear Qdesc clear bit to erase REO internal storage for Qdesc pointers
  1405. * of 37 peer/tids
  1406. */
  1407. reg_val &= ~(HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1));
  1408. HAL_REG_WRITE(hal,
  1409. HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
  1410. reg_val);
  1411. hal_verbose_debug("hal_soc: %pK :Setting CLEAR_DESC_ARRAY field of"
  1412. "WCSS_UMAC_REO_R0_QDESC_ADDR_READ and resetting back"
  1413. "to erase stale entries in reo storage: regval:%x", hal, reg_val);
  1414. }
  1415. /* hal_reo_shared_qaddr_write(): Write REO tid queue addr
  1416. * LUT shared by SW and HW at the index given by peer id
  1417. * and tid.
  1418. *
  1419. * @hal_soc: hal soc pointer
  1420. * @reo_qref_addr: pointer to index pointed to be peer_id
  1421. * and tid
  1422. * @tid: tid queue number
  1423. * @hw_qdesc_paddr: reo queue addr
  1424. */
  1425. static void hal_reo_shared_qaddr_write_be(hal_soc_handle_t hal_soc_hdl,
  1426. uint16_t peer_id,
  1427. int tid,
  1428. qdf_dma_addr_t hw_qdesc_paddr)
  1429. {
  1430. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  1431. struct rx_reo_queue_reference *reo_qref;
  1432. uint32_t peer_tid_idx;
  1433. /* Plug hw_desc_addr in Host reo queue reference table */
  1434. if (HAL_PEER_ID_IS_MLO(peer_id)) {
  1435. peer_tid_idx = ((peer_id - HAL_ML_PEER_ID_START) *
  1436. DP_MAX_TIDS) + tid;
  1437. reo_qref = (struct rx_reo_queue_reference *)
  1438. &hal->reo_qref.mlo_reo_qref_table_vaddr[peer_tid_idx];
  1439. } else {
  1440. peer_tid_idx = (peer_id * DP_MAX_TIDS) + tid;
  1441. reo_qref = (struct rx_reo_queue_reference *)
  1442. &hal->reo_qref.non_mlo_reo_qref_table_vaddr[peer_tid_idx];
  1443. }
  1444. reo_qref->rx_reo_queue_desc_addr_31_0 =
  1445. hw_qdesc_paddr & 0xffffffff;
  1446. reo_qref->rx_reo_queue_desc_addr_39_32 =
  1447. (hw_qdesc_paddr & 0xff00000000) >> 32;
  1448. if (hw_qdesc_paddr != 0)
  1449. reo_qref->receive_queue_number = tid;
  1450. else
  1451. reo_qref->receive_queue_number = 0;
  1452. hal_reo_shared_qaddr_cache_clear_be(hal_soc_hdl);
  1453. hal_verbose_debug("hw_qdesc_paddr: %pK, tid: %d, reo_qref:%pK,"
  1454. "rx_reo_queue_desc_addr_31_0: %x,"
  1455. "rx_reo_queue_desc_addr_39_32: %x",
  1456. (void *)hw_qdesc_paddr, tid, reo_qref,
  1457. reo_qref->rx_reo_queue_desc_addr_31_0,
  1458. reo_qref->rx_reo_queue_desc_addr_39_32);
  1459. }
  1460. /**
  1461. * hal_reo_shared_qaddr_setup() - Allocate MLO and Non MLO reo queue
  1462. * reference table shared between SW and HW and initialize in Qdesc Base0
  1463. * base1 registers provided by HW.
  1464. *
  1465. * @hal_soc: HAL Soc handle
  1466. *
  1467. * Return: None
  1468. */
  1469. static void hal_reo_shared_qaddr_setup_be(hal_soc_handle_t hal_soc_hdl)
  1470. {
  1471. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  1472. hal->reo_qref.reo_qref_table_en = 1;
  1473. hal->reo_qref.mlo_reo_qref_table_vaddr =
  1474. (uint64_t *)qdf_mem_alloc_consistent(
  1475. hal->qdf_dev, hal->qdf_dev->dev,
  1476. REO_QUEUE_REF_ML_TABLE_SIZE,
  1477. &hal->reo_qref.mlo_reo_qref_table_paddr);
  1478. hal->reo_qref.non_mlo_reo_qref_table_vaddr =
  1479. (uint64_t *)qdf_mem_alloc_consistent(
  1480. hal->qdf_dev, hal->qdf_dev->dev,
  1481. REO_QUEUE_REF_NON_ML_TABLE_SIZE,
  1482. &hal->reo_qref.non_mlo_reo_qref_table_paddr);
  1483. hal_verbose_debug("MLO table start paddr:%pK,"
  1484. "Non-MLO table start paddr:%pK,"
  1485. "MLO table start vaddr: %pK,"
  1486. "Non MLO table start vaddr: %pK",
  1487. (void *)hal->reo_qref.mlo_reo_qref_table_paddr,
  1488. (void *)hal->reo_qref.non_mlo_reo_qref_table_paddr,
  1489. hal->reo_qref.mlo_reo_qref_table_vaddr,
  1490. hal->reo_qref.non_mlo_reo_qref_table_vaddr);
  1491. }
  1492. /**
  1493. * hal_reo_shared_qaddr_init() - Zero out REO qref LUT and
  1494. * write start addr of MLO and Non MLO table in HW
  1495. *
  1496. * @hal_soc: HAL Soc handle
  1497. *
  1498. * Return: None
  1499. */
  1500. static void hal_reo_shared_qaddr_init_be(hal_soc_handle_t hal_soc_hdl)
  1501. {
  1502. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  1503. qdf_mem_zero(hal->reo_qref.mlo_reo_qref_table_vaddr,
  1504. REO_QUEUE_REF_ML_TABLE_SIZE);
  1505. qdf_mem_zero(hal->reo_qref.non_mlo_reo_qref_table_vaddr,
  1506. REO_QUEUE_REF_NON_ML_TABLE_SIZE);
  1507. /* LUT_BASE0 and BASE1 registers expect upper 32bits of LUT base address
  1508. * and lower 8 bits to be 0. Shift the physical address by 8 to plug
  1509. * upper 32bits only
  1510. */
  1511. HAL_REG_WRITE(hal,
  1512. HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
  1513. hal->reo_qref.non_mlo_reo_qref_table_paddr >> 8);
  1514. HAL_REG_WRITE(hal,
  1515. HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
  1516. hal->reo_qref.mlo_reo_qref_table_paddr >> 8);
  1517. HAL_REG_WRITE(hal,
  1518. HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
  1519. HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, LUT_FEATURE_ENABLE,
  1520. 1));
  1521. HAL_REG_WRITE(hal,
  1522. HWIO_REO_R0_QDESC_MAX_SW_PEER_ID_ADDR(REO_REG_REG_BASE),
  1523. HAL_MS(HWIO_REO_R0_QDESC, MAX_SW_PEER_ID_MAX_SUPPORTED,
  1524. 0x1fff));
  1525. }
  1526. /**
  1527. * hal_reo_shared_qaddr_detach() - Free MLO and Non MLO reo queue
  1528. * reference table shared between SW and HW
  1529. *
  1530. * @hal_soc: HAL Soc handle
  1531. *
  1532. * Return: None
  1533. */
  1534. static void hal_reo_shared_qaddr_detach_be(hal_soc_handle_t hal_soc_hdl)
  1535. {
  1536. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  1537. HAL_REG_WRITE(hal,
  1538. HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
  1539. 0);
  1540. HAL_REG_WRITE(hal,
  1541. HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
  1542. 0);
  1543. qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
  1544. REO_QUEUE_REF_ML_TABLE_SIZE,
  1545. hal->reo_qref.mlo_reo_qref_table_vaddr,
  1546. hal->reo_qref.mlo_reo_qref_table_paddr, 0);
  1547. qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
  1548. REO_QUEUE_REF_NON_ML_TABLE_SIZE,
  1549. hal->reo_qref.non_mlo_reo_qref_table_vaddr,
  1550. hal->reo_qref.non_mlo_reo_qref_table_paddr, 0);
  1551. }
  1552. #endif
  1553. #endif /* _HAL_BE_GENERIC_API_H_ */