hal_be_generic_api.h 102 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607
  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. #if defined(WLAN_FEATURE_TSF_UPLINK_DELAY) || defined(WLAN_CONFIG_TX_DELAY)
  32. static inline void
  33. hal_tx_comp_get_buffer_timestamp_be(void *desc,
  34. struct hal_tx_completion_status *ts)
  35. {
  36. ts->buffer_timestamp = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  37. BUFFER_TIMESTAMP);
  38. }
  39. #else /* !WLAN_FEATURE_TSF_UPLINK_DELAY || WLAN_CONFIG_TX_DELAY */
  40. static inline void
  41. hal_tx_comp_get_buffer_timestamp_be(void *desc,
  42. struct hal_tx_completion_status *ts)
  43. {
  44. }
  45. #endif /* WLAN_FEATURE_TSF_UPLINK_DELAY || CONFIG_SAWF */
  46. /**
  47. * hal_tx_comp_get_status() - TQM Release reason
  48. * @hal_desc: completion ring Tx status
  49. *
  50. * This function will parse the WBM completion descriptor and populate in
  51. * HAL structure
  52. *
  53. * Return: none
  54. */
  55. static inline void
  56. hal_tx_comp_get_status_generic_be(void *desc, void *ts1,
  57. struct hal_soc *hal)
  58. {
  59. uint8_t rate_stats_valid = 0;
  60. uint32_t rate_stats = 0;
  61. struct hal_tx_completion_status *ts =
  62. (struct hal_tx_completion_status *)ts1;
  63. ts->ppdu_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  64. TQM_STATUS_NUMBER);
  65. ts->ack_frame_rssi = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  66. ACK_FRAME_RSSI);
  67. ts->first_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  68. FIRST_MSDU);
  69. ts->last_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  70. LAST_MSDU);
  71. #if 0
  72. // TODO - This has to be calculated form first and last msdu
  73. ts->msdu_part_of_amsdu = HAL_TX_DESC_GET(desc,
  74. WBM2SW_COMPLETION_RING_TX,
  75. MSDU_PART_OF_AMSDU);
  76. #endif
  77. ts->peer_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  78. SW_PEER_ID);
  79. ts->tid = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX, TID);
  80. ts->transmit_cnt = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  81. TRANSMIT_COUNT);
  82. rate_stats = HAL_TX_DESC_GET(desc, HAL_TX_COMP, TX_RATE_STATS);
  83. rate_stats_valid = HAL_TX_MS(TX_RATE_STATS_INFO,
  84. TX_RATE_STATS_INFO_VALID, rate_stats);
  85. ts->valid = rate_stats_valid;
  86. if (rate_stats_valid) {
  87. ts->bw = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_BW,
  88. rate_stats);
  89. ts->pkt_type = HAL_TX_MS(TX_RATE_STATS_INFO,
  90. TRANSMIT_PKT_TYPE, rate_stats);
  91. ts->stbc = HAL_TX_MS(TX_RATE_STATS_INFO,
  92. TRANSMIT_STBC, rate_stats);
  93. ts->ldpc = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_LDPC,
  94. rate_stats);
  95. ts->sgi = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_SGI,
  96. rate_stats);
  97. ts->mcs = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_MCS,
  98. rate_stats);
  99. ts->ofdma = HAL_TX_MS(TX_RATE_STATS_INFO, OFDMA_TRANSMISSION,
  100. rate_stats);
  101. ts->tones_in_ru = HAL_TX_MS(TX_RATE_STATS_INFO, TONES_IN_RU,
  102. rate_stats);
  103. }
  104. ts->release_src = hal_tx_comp_get_buffer_source_generic_be(desc);
  105. ts->status = hal_tx_comp_get_release_reason(
  106. desc,
  107. hal_soc_to_hal_soc_handle(hal));
  108. ts->tsf = HAL_TX_DESC_GET(desc, UNIFIED_WBM_RELEASE_RING_6,
  109. TX_RATE_STATS_INFO_TX_RATE_STATS);
  110. hal_tx_comp_get_buffer_timestamp_be(desc, ts);
  111. }
  112. /**
  113. * hal_tx_set_pcp_tid_map_generic_be() - Configure default PCP to TID map table
  114. * @soc: HAL SoC context
  115. * @map: PCP-TID mapping table
  116. *
  117. * PCP are mapped to 8 TID values using TID values programmed
  118. * in one set of mapping registers PCP_TID_MAP_<0 to 6>
  119. * The mapping register has TID mapping for 8 PCP values
  120. *
  121. * Return: none
  122. */
  123. static void hal_tx_set_pcp_tid_map_generic_be(struct hal_soc *soc, uint8_t *map)
  124. {
  125. uint32_t addr, value;
  126. addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
  127. MAC_TCL_REG_REG_BASE);
  128. value = (map[0] |
  129. (map[1] << HWIO_TCL_R0_PCP_TID_MAP_PCP_1_SHFT) |
  130. (map[2] << HWIO_TCL_R0_PCP_TID_MAP_PCP_2_SHFT) |
  131. (map[3] << HWIO_TCL_R0_PCP_TID_MAP_PCP_3_SHFT) |
  132. (map[4] << HWIO_TCL_R0_PCP_TID_MAP_PCP_4_SHFT) |
  133. (map[5] << HWIO_TCL_R0_PCP_TID_MAP_PCP_5_SHFT) |
  134. (map[6] << HWIO_TCL_R0_PCP_TID_MAP_PCP_6_SHFT) |
  135. (map[7] << HWIO_TCL_R0_PCP_TID_MAP_PCP_7_SHFT));
  136. HAL_REG_WRITE(soc, addr, (value & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
  137. }
  138. /**
  139. * hal_tx_update_pcp_tid_generic_be() - Update the pcp tid map table with
  140. * value received from user-space
  141. * @soc: HAL SoC context
  142. * @pcp: pcp value
  143. * @tid : tid value
  144. *
  145. * Return: void
  146. */
  147. static void
  148. hal_tx_update_pcp_tid_generic_be(struct hal_soc *soc,
  149. uint8_t pcp, uint8_t tid)
  150. {
  151. uint32_t addr, value, regval;
  152. addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
  153. MAC_TCL_REG_REG_BASE);
  154. value = (uint32_t)tid << (HAL_TX_BITS_PER_TID * pcp);
  155. /* Read back previous PCP TID config and update
  156. * with new config.
  157. */
  158. regval = HAL_REG_READ(soc, addr);
  159. regval &= ~(HAL_TX_TID_BITS_MASK << (HAL_TX_BITS_PER_TID * pcp));
  160. regval |= value;
  161. HAL_REG_WRITE(soc, addr,
  162. (regval & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
  163. }
  164. /**
  165. * hal_tx_update_tidmap_prty_generic_be() - Update the tid map priority
  166. * @soc: HAL SoC context
  167. * @val: priority value
  168. *
  169. * Return: void
  170. */
  171. static
  172. void hal_tx_update_tidmap_prty_generic_be(struct hal_soc *soc, uint8_t value)
  173. {
  174. uint32_t addr;
  175. addr = HWIO_TCL_R0_TID_MAP_PRTY_ADDR(
  176. MAC_TCL_REG_REG_BASE);
  177. HAL_REG_WRITE(soc, addr,
  178. (value & HWIO_TCL_R0_TID_MAP_PRTY_RMSK));
  179. }
  180. /**
  181. * hal_rx_get_tlv_size_generic_be() - Get rx packet tlv size
  182. * @rx_pkt_tlv_size: TLV size for regular RX packets
  183. * @rx_mon_pkt_tlv_size: TLV size for monitor mode packets
  184. *
  185. * Return: size of rx pkt tlv before the actual data
  186. */
  187. static void hal_rx_get_tlv_size_generic_be(uint16_t *rx_pkt_tlv_size,
  188. uint16_t *rx_mon_pkt_tlv_size)
  189. {
  190. *rx_pkt_tlv_size = RX_PKT_TLVS_LEN;
  191. /* For now mon pkt tlv is same as rx pkt tlv */
  192. *rx_mon_pkt_tlv_size = MON_RX_PKT_TLVS_LEN;
  193. }
  194. /**
  195. * hal_rx_flow_get_tuple_info_be() - Setup a flow search entry in HW FST
  196. * @fst: Pointer to the Rx Flow Search Table
  197. * @hal_hash: HAL 5 tuple hash
  198. * @tuple_info: 5-tuple info of the flow returned to the caller
  199. *
  200. * Return: Success/Failure
  201. */
  202. static void *
  203. hal_rx_flow_get_tuple_info_be(uint8_t *rx_fst, uint32_t hal_hash,
  204. uint8_t *flow_tuple_info)
  205. {
  206. struct hal_rx_fst *fst = (struct hal_rx_fst *)rx_fst;
  207. void *hal_fse = NULL;
  208. struct hal_flow_tuple_info *tuple_info
  209. = (struct hal_flow_tuple_info *)flow_tuple_info;
  210. hal_fse = (uint8_t *)fst->base_vaddr +
  211. (hal_hash * HAL_RX_FST_ENTRY_SIZE);
  212. if (!hal_fse || !tuple_info)
  213. return NULL;
  214. if (!HAL_GET_FLD(hal_fse, RX_FLOW_SEARCH_ENTRY, VALID))
  215. return NULL;
  216. tuple_info->src_ip_127_96 =
  217. qdf_ntohl(HAL_GET_FLD(hal_fse,
  218. RX_FLOW_SEARCH_ENTRY,
  219. SRC_IP_127_96));
  220. tuple_info->src_ip_95_64 =
  221. qdf_ntohl(HAL_GET_FLD(hal_fse,
  222. RX_FLOW_SEARCH_ENTRY,
  223. SRC_IP_95_64));
  224. tuple_info->src_ip_63_32 =
  225. qdf_ntohl(HAL_GET_FLD(hal_fse,
  226. RX_FLOW_SEARCH_ENTRY,
  227. SRC_IP_63_32));
  228. tuple_info->src_ip_31_0 =
  229. qdf_ntohl(HAL_GET_FLD(hal_fse,
  230. RX_FLOW_SEARCH_ENTRY,
  231. SRC_IP_31_0));
  232. tuple_info->dest_ip_127_96 =
  233. qdf_ntohl(HAL_GET_FLD(hal_fse,
  234. RX_FLOW_SEARCH_ENTRY,
  235. DEST_IP_127_96));
  236. tuple_info->dest_ip_95_64 =
  237. qdf_ntohl(HAL_GET_FLD(hal_fse,
  238. RX_FLOW_SEARCH_ENTRY,
  239. DEST_IP_95_64));
  240. tuple_info->dest_ip_63_32 =
  241. qdf_ntohl(HAL_GET_FLD(hal_fse,
  242. RX_FLOW_SEARCH_ENTRY,
  243. DEST_IP_63_32));
  244. tuple_info->dest_ip_31_0 =
  245. qdf_ntohl(HAL_GET_FLD(hal_fse,
  246. RX_FLOW_SEARCH_ENTRY,
  247. DEST_IP_31_0));
  248. tuple_info->dest_port = HAL_GET_FLD(hal_fse,
  249. RX_FLOW_SEARCH_ENTRY,
  250. DEST_PORT);
  251. tuple_info->src_port = HAL_GET_FLD(hal_fse,
  252. RX_FLOW_SEARCH_ENTRY,
  253. SRC_PORT);
  254. tuple_info->l4_protocol = HAL_GET_FLD(hal_fse,
  255. RX_FLOW_SEARCH_ENTRY,
  256. L4_PROTOCOL);
  257. return hal_fse;
  258. }
  259. /**
  260. * hal_rx_flow_delete_entry_be() - Setup a flow search entry in HW FST
  261. * @fst: Pointer to the Rx Flow Search Table
  262. * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
  263. *
  264. * Return: Success/Failure
  265. */
  266. static QDF_STATUS
  267. hal_rx_flow_delete_entry_be(uint8_t *rx_fst, void *hal_rx_fse)
  268. {
  269. uint8_t *fse = (uint8_t *)hal_rx_fse;
  270. if (!HAL_GET_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID))
  271. return QDF_STATUS_E_NOENT;
  272. HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID);
  273. return QDF_STATUS_SUCCESS;
  274. }
  275. /**
  276. * hal_rx_fst_get_fse_size_be() - Retrieve the size of each entry in Rx FST
  277. *
  278. * Return: size of each entry/flow in Rx FST
  279. */
  280. static inline uint32_t
  281. hal_rx_fst_get_fse_size_be(void)
  282. {
  283. return HAL_RX_FST_ENTRY_SIZE;
  284. }
  285. /*
  286. * TX MONITOR
  287. */
  288. #ifdef QCA_MONITOR_2_0_SUPPORT
  289. /**
  290. * hal_txmon_is_mon_buf_addr_tlv_generic_be() - api to find mon buffer tlv
  291. * @tx_tlv: pointer to TLV header
  292. *
  293. * Return: bool based on tlv tag matches monitor buffer address tlv
  294. */
  295. static inline bool
  296. hal_txmon_is_mon_buf_addr_tlv_generic_be(void *tx_tlv_hdr)
  297. {
  298. uint32_t tlv_tag;
  299. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv_hdr);
  300. if (WIFIMON_BUFFER_ADDR_E == tlv_tag)
  301. return true;
  302. return false;
  303. }
  304. /**
  305. * hal_txmon_populate_packet_info_generic_be() - api to populate packet info
  306. * @tx_tlv: pointer to TLV header
  307. * @packet_info: place holder for packet info
  308. *
  309. * Return: Address to void
  310. */
  311. static inline void
  312. hal_txmon_populate_packet_info_generic_be(void *tx_tlv, void *packet_info)
  313. {
  314. struct hal_mon_packet_info *pkt_info;
  315. struct mon_buffer_addr *addr = (struct mon_buffer_addr *)tx_tlv;
  316. pkt_info = (struct hal_mon_packet_info *)packet_info;
  317. pkt_info->sw_cookie = (((uint64_t)addr->buffer_virt_addr_63_32 << 32) |
  318. (addr->buffer_virt_addr_31_0));
  319. pkt_info->dma_length = addr->dma_length + 1;
  320. pkt_info->msdu_continuation = addr->msdu_continuation;
  321. pkt_info->truncated = addr->truncated;
  322. }
  323. #if defined(TX_MONITOR_WORD_MASK)
  324. /**
  325. * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
  326. *
  327. * @tx_tlv: pointer to tx_fes_setup tlv header
  328. *
  329. * Return: number of users
  330. */
  331. static inline uint8_t
  332. hal_txmon_get_num_users(void *tx_tlv)
  333. {
  334. hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
  335. return tx_fes_setup->number_of_users;
  336. }
  337. /**
  338. * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
  339. *
  340. * @tx_tlv: pointer to tx_fes_setup tlv header
  341. * @ppdu_info: pointer to hal_tx_ppdu_info
  342. *
  343. * Return: void
  344. */
  345. static inline void
  346. hal_txmon_parse_tx_fes_setup(void *tx_tlv,
  347. struct hal_tx_ppdu_info *tx_ppdu_info)
  348. {
  349. hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
  350. tx_ppdu_info->num_users = tx_fes_setup->number_of_users;
  351. if (tx_ppdu_info->num_users == 0)
  352. tx_ppdu_info->num_users = 1;
  353. TXMON_HAL(tx_ppdu_info, ppdu_id) = tx_fes_setup->schedule_id;
  354. TXMON_HAL_STATUS(tx_ppdu_info, ppdu_id) = tx_fes_setup->schedule_id;
  355. }
  356. /**
  357. * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
  358. *
  359. * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
  360. * @data_status_info: pointer to data hal_tx_status_info
  361. * @prot_status_info: pointer to protection hal_tx_status_info
  362. *
  363. * Return: void
  364. */
  365. static inline void
  366. hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
  367. struct hal_tx_status_info *data_status_info,
  368. struct hal_tx_status_info *prot_status_info)
  369. {
  370. }
  371. /**
  372. * hal_txmon_parse_peer_entry() - parse peer entry tlv
  373. *
  374. * @tx_tlv: pointer to peer_entry tlv header
  375. * @user_id: user_id
  376. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  377. * @tx_status_info: pointer to hal_tx_status_info
  378. *
  379. * Return: void
  380. */
  381. static inline void
  382. hal_txmon_parse_peer_entry(void *tx_tlv,
  383. uint8_t user_id,
  384. struct hal_tx_ppdu_info *tx_ppdu_info,
  385. struct hal_tx_status_info *tx_status_info)
  386. {
  387. }
  388. /**
  389. * hal_txmon_parse_queue_exten() - parse queue exten tlv
  390. *
  391. * @tx_tlv: pointer to queue exten tlv header
  392. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  393. *
  394. * Return: void
  395. */
  396. static inline void
  397. hal_txmon_parse_queue_exten(void *tx_tlv,
  398. struct hal_tx_ppdu_info *tx_ppdu_info)
  399. {
  400. }
  401. /**
  402. * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
  403. *
  404. * @tx_tlv: pointer to mpdu start tlv header
  405. * @user_id: user id
  406. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  407. *
  408. * Return: void
  409. */
  410. static inline void
  411. hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
  412. struct hal_tx_ppdu_info *tx_ppdu_info)
  413. {
  414. }
  415. #else
  416. /**
  417. * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
  418. *
  419. * @tx_tlv: pointer to tx_fes_setup tlv header
  420. *
  421. * Return: number of users
  422. */
  423. static inline uint8_t
  424. hal_txmon_get_num_users(void *tx_tlv)
  425. {
  426. uint8_t num_users = HAL_TX_DESC_GET_64(tx_tlv,
  427. TX_FES_SETUP, NUMBER_OF_USERS);
  428. return num_users;
  429. }
  430. /**
  431. * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
  432. *
  433. * @tx_tlv: pointer to tx_fes_setup tlv header
  434. * @ppdu_info: pointer to hal_tx_ppdu_info
  435. *
  436. * Return: void
  437. */
  438. static inline void
  439. hal_txmon_parse_tx_fes_setup(void *tx_tlv,
  440. struct hal_tx_ppdu_info *tx_ppdu_info)
  441. {
  442. uint32_t num_users = 0;
  443. uint32_t ppdu_id = 0;
  444. num_users = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, NUMBER_OF_USERS);
  445. ppdu_id = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, SCHEDULE_ID);
  446. if (num_users == 0)
  447. num_users = 1;
  448. tx_ppdu_info->num_users = num_users;
  449. TXMON_HAL(tx_ppdu_info, ppdu_id) = ppdu_id;
  450. TXMON_HAL_STATUS(tx_ppdu_info, ppdu_id) = ppdu_id;
  451. }
  452. /**
  453. * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
  454. *
  455. * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
  456. * @data_status_info: pointer to data hal_tx_status_info
  457. * @prot_status_info: pointer to protection hal_tx_status_info
  458. *
  459. * Return: void
  460. */
  461. static inline void
  462. hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
  463. struct hal_tx_status_info *data_status_info,
  464. struct hal_tx_status_info *prot_status_info)
  465. {
  466. prot_status_info->protection_addr =
  467. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  468. USE_ADDRESS_FIELDS_FOR_PROTECTION);
  469. /* protection frame address 1 */
  470. *(uint32_t *)&prot_status_info->addr1[0] =
  471. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  472. PROTECTION_FRAME_AD1_31_0);
  473. *(uint32_t *)&prot_status_info->addr1[4] =
  474. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  475. PROTECTION_FRAME_AD1_47_32);
  476. /* protection frame address 2 */
  477. *(uint32_t *)&prot_status_info->addr2[0] =
  478. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  479. PROTECTION_FRAME_AD2_15_0);
  480. *(uint32_t *)&prot_status_info->addr2[2] =
  481. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  482. PROTECTION_FRAME_AD2_47_16);
  483. /* protection frame address 3 */
  484. *(uint32_t *)&prot_status_info->addr3[0] =
  485. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  486. PROTECTION_FRAME_AD3_31_0);
  487. *(uint32_t *)&prot_status_info->addr3[4] =
  488. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  489. PROTECTION_FRAME_AD3_47_32);
  490. /* protection frame address 4 */
  491. *(uint32_t *)&prot_status_info->addr4[0] =
  492. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  493. PROTECTION_FRAME_AD4_15_0);
  494. *(uint32_t *)&prot_status_info->addr4[2] =
  495. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  496. PROTECTION_FRAME_AD4_47_16);
  497. }
  498. /**
  499. * hal_txmon_parse_peer_entry() - parse peer entry tlv
  500. *
  501. * @tx_tlv: pointer to peer_entry tlv header
  502. * @user_id: user_id
  503. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  504. * @tx_status_info: pointer to hal_tx_status_info
  505. *
  506. * Return: void
  507. */
  508. static inline void
  509. hal_txmon_parse_peer_entry(void *tx_tlv,
  510. uint8_t user_id,
  511. struct hal_tx_ppdu_info *tx_ppdu_info,
  512. struct hal_tx_status_info *tx_status_info)
  513. {
  514. *(uint32_t *)&tx_status_info->addr1[0] =
  515. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_31_0);
  516. *(uint32_t *)&tx_status_info->addr1[4] =
  517. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_47_32);
  518. *(uint32_t *)&tx_status_info->addr2[0] =
  519. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_15_0);
  520. *(uint32_t *)&tx_status_info->addr2[2] =
  521. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_47_16);
  522. TXMON_HAL_USER(tx_ppdu_info, user_id, sw_peer_id) =
  523. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, SW_PEER_ID);
  524. }
  525. /**
  526. * hal_txmon_parse_queue_exten() - parse queue exten tlv
  527. *
  528. * @tx_tlv: pointer to queue exten tlv header
  529. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  530. *
  531. * Return: void
  532. */
  533. static inline void
  534. hal_txmon_parse_queue_exten(void *tx_tlv,
  535. struct hal_tx_ppdu_info *tx_ppdu_info)
  536. {
  537. TXMON_HAL_STATUS(tx_ppdu_info, frame_control) =
  538. HAL_TX_DESC_GET_64(tx_tlv, TX_QUEUE_EXTENSION,
  539. FRAME_CTL);
  540. TXMON_HAL_STATUS(tx_ppdu_info, frame_control_info_valid) = true;
  541. }
  542. /**
  543. * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
  544. *
  545. * @tx_tlv: pointer to mpdu start tlv header
  546. * @user_id: user id
  547. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  548. *
  549. * Return: void
  550. */
  551. static inline void
  552. hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
  553. struct hal_tx_ppdu_info *tx_ppdu_info)
  554. {
  555. TXMON_HAL_USER(tx_ppdu_info, user_id,
  556. start_seq) = HAL_TX_DESC_GET_64(tx_tlv, TX_MPDU_START,
  557. MPDU_SEQUENCE_NUMBER);
  558. TXMON_HAL(tx_ppdu_info, cur_usr_idx) = user_id;
  559. }
  560. #endif
  561. /**
  562. * get_ru_offset_from_start_index() - api to get ru offset from ru index
  563. *
  564. * @ru_size: RU size
  565. * @start_idx: Start index
  566. *
  567. * Return: uint8_t ru allocation offset
  568. */
  569. static inline
  570. uint8_t get_ru_offset_from_start_index(uint8_t ru_size, uint8_t start_idx)
  571. {
  572. uint8_t ru_alloc_offset[HAL_MAX_DL_MU_USERS][HAL_MAX_RU_INDEX] = {
  573. {0, 0, 0, 0, 0, 0, 0},
  574. {1, 0, 0, 0, 0, 0, 0},
  575. {2, 1, 0, 0, 0, 0, 0},
  576. {3, 1, 0, 0, 0, 0, 0},
  577. {4, 0, 0, 0, 0, 0, 0},
  578. {5, 2, 1, 0, 0, 0, 0},
  579. {6, 2, 1, 0, 0, 0, 0},
  580. {7, 3, 1, 0, 0, 0, 0},
  581. {8, 3, 1, 0, 0, 0, 0},
  582. {9, 4, 2, 1, 0, 0, 0},
  583. {10, 4, 2, 1, 0, 0, 0},
  584. {11, 5, 2, 1, 0, 0, 0},
  585. {12, 5, 2, 1, 0, 0, 0},
  586. {13, 0, 0, 1, 0, 0, 0},
  587. {14, 6, 3, 1, 0, 0, 0},
  588. {15, 6, 3, 1, 0, 0, 0},
  589. {16, 7, 3, 1, 0, 0, 0},
  590. {17, 7, 3, 1, 0, 0, 0},
  591. {18, 0, 0, 0, 0, 0, 0},
  592. {19, 8, 4, 2, 1, 0, 0},
  593. {20, 8, 4, 2, 1, 0, 0},
  594. {21, 9, 4, 2, 1, 0, 0},
  595. {22, 9, 4, 2, 1, 0, 0},
  596. {23, 0, 0, 2, 1, 0, 0},
  597. {24, 10, 5, 2, 1, 0, 0},
  598. {25, 10, 5, 2, 1, 0, 0},
  599. {26, 11, 5, 2, 1, 0, 0},
  600. {27, 11, 5, 2, 1, 0, 0},
  601. {28, 12, 6, 3, 1, 0, 0},
  602. {29, 12, 6, 3, 1, 0, 0},
  603. {30, 13, 6, 3, 1, 0, 0},
  604. {31, 13, 6, 3, 1, 0, 0},
  605. {32, 0, 0, 3, 1, 0, 0},
  606. {33, 14, 7, 3, 1, 0, 0},
  607. {34, 14, 7, 3, 1, 0, 0},
  608. {35, 15, 7, 3, 1, 0, 0},
  609. {36, 15, 7, 3, 1, 0, 0},
  610. };
  611. if (start_idx >= HAL_MAX_UL_MU_USERS || ru_size >= HAL_MAX_RU_INDEX)
  612. return 0;
  613. return ru_alloc_offset[start_idx][ru_size];
  614. }
  615. /**
  616. * hal_txmon_status_get_num_users_generic_be() - api to get num users
  617. * from start of fes window
  618. *
  619. * @tx_tlv_hdr: pointer to TLV header
  620. * @num_users: reference to number of user
  621. *
  622. * Return: status
  623. */
  624. static inline uint32_t
  625. hal_txmon_status_get_num_users_generic_be(void *tx_tlv_hdr, uint8_t *num_users)
  626. {
  627. uint32_t tlv_tag, user_id, tlv_len;
  628. uint32_t tlv_status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
  629. void *tx_tlv;
  630. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(tx_tlv_hdr);
  631. user_id = HAL_RX_GET_USER_TLV32_USERID(tx_tlv_hdr);
  632. tlv_len = HAL_RX_GET_USER_TLV32_LEN(tx_tlv_hdr);
  633. tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
  634. /* window starts with either initiator or response */
  635. switch (tlv_tag) {
  636. case WIFITX_FES_SETUP_E:
  637. {
  638. *num_users = hal_txmon_get_num_users(tx_tlv);
  639. if (*num_users == 0)
  640. *num_users = 1;
  641. tlv_status = HAL_MON_TX_FES_SETUP;
  642. break;
  643. }
  644. case WIFIRX_RESPONSE_REQUIRED_INFO_E:
  645. {
  646. *num_users = HAL_TX_DESC_GET_64(tx_tlv,
  647. RX_RESPONSE_REQUIRED_INFO,
  648. RESPONSE_STA_COUNT);
  649. if (*num_users == 0)
  650. *num_users = 1;
  651. tlv_status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
  652. break;
  653. }
  654. };
  655. return tlv_status;
  656. }
  657. /**
  658. * hal_tx_get_ppdu_info() - api to get tx ppdu info
  659. * @pdev_handle: DP_PDEV handle
  660. * @prot_ppdu_info: populate dp_ppdu_info protection
  661. * @tx_data_ppdu_info: populate dp_ppdu_info data
  662. * @tlv_tag: Tag
  663. *
  664. * Return: dp_tx_ppdu_info pointer
  665. */
  666. static inline void *
  667. hal_tx_get_ppdu_info(void *data_info, void *prot_info, uint32_t tlv_tag)
  668. {
  669. struct hal_tx_ppdu_info *prot_ppdu_info = prot_info;
  670. switch (tlv_tag) {
  671. case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
  672. case WIFITX_FLUSH_E:/* DOWNSTREAM */
  673. case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
  674. case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
  675. case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
  676. case WIFITX_MPDU_START_E:/* DOWNSTREAM */
  677. case WIFITX_MSDU_START_E:/* DOWNSTREAM */
  678. case WIFITX_DATA_E:/* DOWNSTREAM */
  679. case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
  680. case WIFITX_MPDU_END_E:/* DOWNSTREAM */
  681. case WIFITX_MSDU_END_E:/* DOWNSTREAM */
  682. case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
  683. case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
  684. case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
  685. case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
  686. case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
  687. case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
  688. case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
  689. case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
  690. case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
  691. case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
  692. case WIFISCHEDULER_END_E:/* DOWNSTREAM */
  693. case WIFITX_FES_STATUS_START_PPDU_E:/* UPSTREAM */
  694. {
  695. return data_info;
  696. }
  697. }
  698. /*
  699. * check current prot_tlv_status is start protection
  700. * check current tlv_tag is either start protection or end protection
  701. */
  702. if (TXMON_HAL(prot_ppdu_info,
  703. prot_tlv_status) == WIFITX_FES_STATUS_START_PROT_E) {
  704. return prot_info;
  705. } else if (tlv_tag == WIFITX_FES_STATUS_PROT_E ||
  706. tlv_tag == WIFITX_FES_STATUS_START_PROT_E) {
  707. TXMON_HAL(prot_ppdu_info, prot_tlv_status) = tlv_tag;
  708. return prot_info;
  709. }
  710. return data_info;
  711. }
  712. /**
  713. * hal_txmon_status_parse_tlv_generic_be() - api to parse status tlv.
  714. * @data_ppdu_info: hal_txmon data ppdu info
  715. * @prot_ppdu_info: hal_txmon prot ppdu info
  716. * @data_status_info: pointer to data status info
  717. * @prot_status_info: pointer to prot status info
  718. * @tx_tlv_hdr: fragment of tx_tlv_hdr
  719. * @status_frag: qdf_frag_t buffer
  720. *
  721. * Return: status
  722. */
  723. static inline uint32_t
  724. hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
  725. void *prot_ppdu_info,
  726. void *data_status_info,
  727. void *prot_status_info,
  728. void *tx_tlv_hdr,
  729. qdf_frag_t status_frag)
  730. {
  731. struct hal_tx_ppdu_info *ppdu_info;
  732. struct hal_tx_status_info *tx_status_info;
  733. struct hal_mon_packet_info *packet_info = NULL;
  734. uint32_t tlv_tag, user_id, tlv_len;
  735. uint32_t status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
  736. void *tx_tlv;
  737. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv_hdr);
  738. /* user_id start with 1, decrement by 1 to start from 0 */
  739. user_id = HAL_RX_GET_USER_TLV64_USERID(tx_tlv_hdr);
  740. tlv_len = HAL_RX_GET_USER_TLV64_LEN(tx_tlv_hdr);
  741. tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
  742. /* parse tlv and populate tx_ppdu_info */
  743. ppdu_info = hal_tx_get_ppdu_info(data_ppdu_info,
  744. prot_ppdu_info, tlv_tag);
  745. tx_status_info = (ppdu_info->is_data ? data_status_info :
  746. prot_status_info);
  747. user_id = user_id > ppdu_info->num_users ? 0 : user_id;
  748. switch (tlv_tag) {
  749. /* start of initiator FES window */
  750. case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
  751. {
  752. /* initiator PPDU window start */
  753. hal_txmon_parse_tx_fes_setup(tx_tlv, ppdu_info);
  754. status = HAL_MON_TX_FES_SETUP;
  755. SHOW_DEFINED(WIFITX_FES_SETUP_E);
  756. break;
  757. }
  758. /* end of initiator FES window */
  759. case WIFITX_FES_STATUS_END_E:/* UPSTREAM */
  760. {
  761. /* initiator PPDU window end */
  762. uint32_t ppdu_timestamp_start = 0;
  763. uint32_t ppdu_timestamp_end = 0;
  764. uint16_t phy_abort_reason = 0;
  765. uint8_t phy_abort_is_valid = 0;
  766. uint8_t abort_usr_id = 0;
  767. uint8_t response_type = 0;
  768. uint8_t r2r_end_status_follow = 0;
  769. status = HAL_MON_TX_FES_STATUS_END;
  770. ppdu_timestamp_start =
  771. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  772. START_OF_FRAME_TIMESTAMP_15_0) |
  773. (HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  774. START_OF_FRAME_TIMESTAMP_31_16) <<
  775. HAL_TX_LSB(TX_FES_STATUS_END,
  776. START_OF_FRAME_TIMESTAMP_31_16));
  777. ppdu_timestamp_end =
  778. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  779. END_OF_FRAME_TIMESTAMP_15_0) |
  780. (HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  781. END_OF_FRAME_TIMESTAMP_31_16) <<
  782. HAL_TX_LSB(TX_FES_STATUS_END,
  783. END_OF_FRAME_TIMESTAMP_31_16));
  784. response_type = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  785. RESPONSE_TYPE);
  786. /*
  787. * r2r end status follow to inform whether to look for
  788. * rx_response_required_info
  789. */
  790. r2r_end_status_follow =
  791. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  792. R2R_END_STATUS_TO_FOLLOW);
  793. phy_abort_is_valid =
  794. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  795. PHYTX_ABORT_REQUEST_INFO_VALID);
  796. if (phy_abort_is_valid) {
  797. phy_abort_reason =
  798. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  799. PHYTX_ABORT_REQUEST_INFO_DETAILS_PHYTX_ABORT_REASON);
  800. abort_usr_id =
  801. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  802. PHYTX_ABORT_REQUEST_INFO_DETAILS_USER_NUMBER);
  803. TXMON_STATUS_INFO(tx_status_info,
  804. phy_abort_reason) = phy_abort_reason;
  805. TXMON_STATUS_INFO(tx_status_info,
  806. phy_abort_user_number) = abort_usr_id;
  807. }
  808. TXMON_STATUS_INFO(tx_status_info,
  809. response_type) = response_type;
  810. TXMON_STATUS_INFO(tx_status_info,
  811. r2r_to_follow) = r2r_end_status_follow;
  812. /* update phy timestamp to ppdu timestamp */
  813. TXMON_HAL_STATUS(ppdu_info,
  814. ppdu_timestamp) = ppdu_timestamp_start;
  815. SHOW_DEFINED(WIFITX_FES_STATUS_END_E);
  816. break;
  817. }
  818. /* response window open */
  819. case WIFIRX_RESPONSE_REQUIRED_INFO_E:/* UPSTREAM */
  820. {
  821. /* response PPDU window start */
  822. uint32_t ppdu_id = 0;
  823. uint8_t reception_type = 0;
  824. uint8_t response_sta_count = 0;
  825. status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
  826. ppdu_id = HAL_TX_DESC_GET_64(tx_tlv,
  827. RX_RESPONSE_REQUIRED_INFO,
  828. PHY_PPDU_ID);
  829. reception_type =
  830. HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
  831. SU_OR_UPLINK_MU_RECEPTION);
  832. response_sta_count =
  833. HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
  834. RESPONSE_STA_COUNT);
  835. /* get mac address */
  836. *(uint32_t *)&tx_status_info->addr1[0] =
  837. HAL_TX_DESC_GET_64(tx_tlv,
  838. RX_RESPONSE_REQUIRED_INFO,
  839. ADDR1_31_0);
  840. *(uint32_t *)&tx_status_info->addr1[4] =
  841. HAL_TX_DESC_GET_64(tx_tlv,
  842. RX_RESPONSE_REQUIRED_INFO,
  843. ADDR1_47_32);
  844. *(uint32_t *)&tx_status_info->addr2[0] =
  845. HAL_TX_DESC_GET_64(tx_tlv,
  846. RX_RESPONSE_REQUIRED_INFO,
  847. ADDR2_15_0);
  848. *(uint32_t *)&tx_status_info->addr2[2] =
  849. HAL_TX_DESC_GET_64(tx_tlv,
  850. RX_RESPONSE_REQUIRED_INFO,
  851. ADDR2_47_16);
  852. TXMON_HAL(ppdu_info, ppdu_id) = ppdu_id;
  853. TXMON_HAL_STATUS(ppdu_info, ppdu_id) = ppdu_id;
  854. if (response_sta_count == 0)
  855. response_sta_count = 1;
  856. TXMON_HAL(ppdu_info, num_users) = response_sta_count;
  857. if (reception_type)
  858. TXMON_STATUS_INFO(tx_status_info,
  859. transmission_type) =
  860. TXMON_SU_TRANSMISSION;
  861. else
  862. TXMON_STATUS_INFO(tx_status_info,
  863. transmission_type) =
  864. TXMON_MU_TRANSMISSION;
  865. SHOW_DEFINED(WIFIRX_RESPONSE_REQUIRED_INFO_E);
  866. break;
  867. }
  868. /* Response window close */
  869. case WIFIRESPONSE_END_STATUS_E:/* UPSTREAM */
  870. {
  871. /* response PPDU window end */
  872. uint8_t generated_response = 0;
  873. uint32_t bandwidth = 0;
  874. uint32_t ppdu_timestamp_start = 0;
  875. uint32_t ppdu_timestamp_end = 0;
  876. uint32_t mba_usr_cnt = 0;
  877. uint32_t mba_fake_bitmap_cnt = 0;
  878. status = HAL_MON_RESPONSE_END_STATUS_INFO;
  879. generated_response = HAL_TX_DESC_GET_64(tx_tlv,
  880. RESPONSE_END_STATUS,
  881. GENERATED_RESPONSE);
  882. mba_usr_cnt = HAL_TX_DESC_GET_64(tx_tlv,
  883. RESPONSE_END_STATUS,
  884. MBA_USER_COUNT);
  885. mba_fake_bitmap_cnt = HAL_TX_DESC_GET_64(tx_tlv,
  886. RESPONSE_END_STATUS,
  887. MBA_FAKE_BITMAP_COUNT);
  888. bandwidth = HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  889. COEX_BASED_TX_BW);
  890. /* 32 bits TSF */
  891. ppdu_timestamp_start =
  892. (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  893. START_OF_FRAME_TIMESTAMP_15_0) |
  894. (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  895. START_OF_FRAME_TIMESTAMP_31_16) <<
  896. 16));
  897. ppdu_timestamp_end =
  898. (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  899. END_OF_FRAME_TIMESTAMP_15_0) |
  900. (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  901. END_OF_FRAME_TIMESTAMP_31_16) <<
  902. 16));
  903. TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
  904. /* update phy timestamp to ppdu timestamp */
  905. TXMON_HAL_STATUS(ppdu_info,
  906. ppdu_timestamp) = ppdu_timestamp_start;
  907. TXMON_STATUS_INFO(tx_status_info,
  908. generated_response) = generated_response;
  909. TXMON_STATUS_INFO(tx_status_info, mba_count) = mba_usr_cnt;
  910. TXMON_STATUS_INFO(tx_status_info,
  911. mba_fake_bitmap_count) = mba_fake_bitmap_cnt;
  912. SHOW_DEFINED(WIFIRESPONSE_END_STATUS_E);
  913. break;
  914. }
  915. case WIFITX_FLUSH_E:/* DOWNSTREAM */
  916. {
  917. SHOW_DEFINED(WIFITX_FLUSH_E);
  918. break;
  919. }
  920. /* Downstream tlv */
  921. case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
  922. {
  923. hal_txmon_parse_pcu_ppdu_setup_init(tx_tlv, data_status_info,
  924. prot_status_info);
  925. status = HAL_MON_TX_PCU_PPDU_SETUP_INIT;
  926. SHOW_DEFINED(WIFIPCU_PPDU_SETUP_INIT_E);
  927. break;
  928. }
  929. case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
  930. {
  931. hal_txmon_parse_peer_entry(tx_tlv, user_id,
  932. ppdu_info, tx_status_info);
  933. SHOW_DEFINED(WIFITX_PEER_ENTRY_E);
  934. break;
  935. }
  936. case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
  937. {
  938. status = HAL_MON_TX_QUEUE_EXTENSION;
  939. hal_txmon_parse_queue_exten(tx_tlv, ppdu_info);
  940. SHOW_DEFINED(WIFITX_QUEUE_EXTENSION_E);
  941. break;
  942. }
  943. /* payload and data frame handling */
  944. case WIFITX_MPDU_START_E:/* DOWNSTREAM */
  945. {
  946. hal_txmon_parse_mpdu_start(tx_tlv, user_id, ppdu_info);
  947. status = HAL_MON_TX_MPDU_START;
  948. SHOW_DEFINED(WIFITX_MPDU_START_E);
  949. break;
  950. }
  951. case WIFITX_MSDU_START_E:/* DOWNSTREAM */
  952. {
  953. /* compacted */
  954. /* we expect frame to be 802.11 frame type */
  955. status = HAL_MON_TX_MSDU_START;
  956. SHOW_DEFINED(WIFITX_MSDU_START_E);
  957. break;
  958. }
  959. case WIFITX_DATA_E:/* DOWNSTREAM */
  960. {
  961. status = HAL_MON_TX_DATA;
  962. /*
  963. * TODO: do we need a conversion api to convert
  964. * user_id from hw to get host user_index
  965. */
  966. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  967. TXMON_STATUS_INFO(tx_status_info,
  968. buffer) = (void *)status_frag;
  969. TXMON_STATUS_INFO(tx_status_info,
  970. offset) = ((void *)tx_tlv -
  971. (void *)status_frag);
  972. TXMON_STATUS_INFO(tx_status_info,
  973. length) = tlv_len;
  974. /*
  975. * reference of the status buffer will be held in
  976. * dp_tx_update_ppdu_info_status()
  977. */
  978. status = HAL_MON_TX_DATA;
  979. SHOW_DEFINED(WIFITX_DATA_E);
  980. break;
  981. }
  982. case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
  983. {
  984. packet_info = &ppdu_info->packet_info;
  985. status = HAL_MON_TX_BUFFER_ADDR;
  986. /*
  987. * TODO: do we need a conversion api to convert
  988. * user_id from hw to get host user_index
  989. */
  990. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  991. hal_txmon_populate_packet_info_generic_be(tx_tlv, packet_info);
  992. SHOW_DEFINED(WIFIMON_BUFFER_ADDR_E);
  993. break;
  994. }
  995. case WIFITX_MPDU_END_E:/* DOWNSTREAM */
  996. {
  997. /* no tlv content */
  998. SHOW_DEFINED(WIFITX_MPDU_END_E);
  999. break;
  1000. }
  1001. case WIFITX_MSDU_END_E:/* DOWNSTREAM */
  1002. {
  1003. /* no tlv content */
  1004. SHOW_DEFINED(WIFITX_MSDU_END_E);
  1005. break;
  1006. }
  1007. case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
  1008. {
  1009. /* no tlv content */
  1010. SHOW_DEFINED(WIFITX_LAST_MPDU_FETCHED_E);
  1011. break;
  1012. }
  1013. case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
  1014. {
  1015. /* no tlv content */
  1016. SHOW_DEFINED(WIFITX_LAST_MPDU_END_E);
  1017. break;
  1018. }
  1019. case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
  1020. {
  1021. /*
  1022. * transmitting power
  1023. * minimum transmitting power
  1024. * desired nss
  1025. * tx chain mask
  1026. * desired bw
  1027. * duration of transmit and response
  1028. *
  1029. * since most of the field we are deriving from other tlv
  1030. * we don't need to enable this in our tlv.
  1031. */
  1032. SHOW_DEFINED(WIFICOEX_TX_REQ_E);
  1033. break;
  1034. }
  1035. case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
  1036. {
  1037. /* user tlv */
  1038. /*
  1039. * All Tx monitor will have 802.11 hdr
  1040. * we don't need to enable this TLV
  1041. */
  1042. SHOW_DEFINED(WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E);
  1043. break;
  1044. }
  1045. case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
  1046. {
  1047. /*
  1048. * no tlv content
  1049. *
  1050. * TLV that indicates to TXPCU that preamble phase for the NDP
  1051. * frame transmission is now over
  1052. */
  1053. SHOW_DEFINED(WIFINDP_PREAMBLE_DONE_E);
  1054. break;
  1055. }
  1056. case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
  1057. {
  1058. /*
  1059. * no tlv content
  1060. *
  1061. * TLV indicates to the SCH that all timing critical TLV
  1062. * has been passed on to the transmit path
  1063. */
  1064. SHOW_DEFINED(WIFISCH_CRITICAL_TLV_REFERENCE_E);
  1065. break;
  1066. }
  1067. case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
  1068. {
  1069. /*
  1070. * Loopback specific setup info - not needed for Tx monitor
  1071. */
  1072. SHOW_DEFINED(WIFITX_LOOPBACK_SETUP_E);
  1073. break;
  1074. }
  1075. case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
  1076. {
  1077. /*
  1078. * no tlv content
  1079. *
  1080. * TLV indicates that other modules besides the scheduler can
  1081. * now also start generating TLV's
  1082. * prevent colliding or generating TLV's out of order
  1083. */
  1084. SHOW_DEFINED(WIFITX_FES_SETUP_COMPLETE_E);
  1085. break;
  1086. }
  1087. case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
  1088. {
  1089. /*
  1090. * no tlv content
  1091. *
  1092. * TLV indicates to SCH that a burst of MPDU info will
  1093. * start to come in over the TLV
  1094. */
  1095. SHOW_DEFINED(WIFITQM_MPDU_GLOBAL_START_E);
  1096. break;
  1097. }
  1098. case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
  1099. {
  1100. SHOW_DEFINED(WIFITX_WUR_DATA_E);
  1101. break;
  1102. }
  1103. case WIFISCHEDULER_END_E:/* DOWNSTREAM */
  1104. {
  1105. /*
  1106. * no tlv content
  1107. *
  1108. * TLV indicates END of all TLV's within the scheduler TLV
  1109. */
  1110. SHOW_DEFINED(WIFISCHEDULER_END_E);
  1111. break;
  1112. }
  1113. /* Upstream tlv */
  1114. case WIFIPDG_TX_REQ_E:
  1115. {
  1116. SHOW_DEFINED(WIFIPDG_TX_REQ_E);
  1117. break;
  1118. }
  1119. case WIFITX_FES_STATUS_START_E:
  1120. {
  1121. /*
  1122. * TLV indicating that first transmission on the medium
  1123. */
  1124. uint8_t medium_prot_type = 0;
  1125. status = HAL_MON_TX_FES_STATUS_START;
  1126. medium_prot_type = HAL_TX_DESC_GET_64(tx_tlv,
  1127. TX_FES_STATUS_START,
  1128. MEDIUM_PROT_TYPE);
  1129. ppdu_info = (struct hal_tx_ppdu_info *)prot_ppdu_info;
  1130. /* update what type of medium protection frame */
  1131. TXMON_STATUS_INFO(tx_status_info,
  1132. medium_prot_type) = medium_prot_type;
  1133. SHOW_DEFINED(WIFITX_FES_STATUS_START_E);
  1134. break;
  1135. }
  1136. case WIFITX_FES_STATUS_PROT_E:
  1137. {
  1138. uint32_t start_timestamp = 0;
  1139. uint32_t end_timestamp = 0;
  1140. /*
  1141. * generated by TXPCU to indicate the result of having
  1142. * received of the expected protection frame
  1143. */
  1144. status = HAL_MON_TX_FES_STATUS_PROT;
  1145. start_timestamp =
  1146. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
  1147. START_OF_FRAME_TIMESTAMP_15_0);
  1148. start_timestamp |=
  1149. (HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
  1150. START_OF_FRAME_TIMESTAMP_31_16) <<
  1151. 15);
  1152. end_timestamp = HAL_TX_DESC_GET_64(tx_tlv,
  1153. TX_FES_STATUS_PROT,
  1154. END_OF_FRAME_TIMESTAMP_15_0);
  1155. end_timestamp |=
  1156. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
  1157. END_OF_FRAME_TIMESTAMP_31_16) << 15;
  1158. /* ppdu timestamp as phy timestamp */
  1159. TXMON_HAL_STATUS(ppdu_info,
  1160. ppdu_timestamp) = start_timestamp;
  1161. SHOW_DEFINED(WIFITX_FES_STATUS_PROT_E);
  1162. break;
  1163. }
  1164. case WIFITX_FES_STATUS_START_PROT_E:
  1165. {
  1166. uint64_t tsft_64;
  1167. uint32_t response_type;
  1168. status = HAL_MON_TX_FES_STATUS_START_PROT;
  1169. TXMON_HAL(ppdu_info, prot_tlv_status) = tlv_tag;
  1170. /* timestamp */
  1171. tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
  1172. TX_FES_STATUS_START_PROT,
  1173. PROT_TIMESTAMP_LOWER_32);
  1174. tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
  1175. TX_FES_STATUS_START_PROT,
  1176. PROT_TIMESTAMP_UPPER_32) << 32);
  1177. response_type = HAL_TX_DESC_GET_64(tx_tlv,
  1178. TX_FES_STATUS_START_PROT,
  1179. RESPONSE_TYPE);
  1180. TXMON_STATUS_INFO(tx_status_info,
  1181. response_type) = response_type;
  1182. TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
  1183. SHOW_DEFINED(WIFITX_FES_STATUS_START_PROT_E);
  1184. break;
  1185. }
  1186. case WIFIPROT_TX_END_E:
  1187. {
  1188. /*
  1189. * no tlv content
  1190. *
  1191. * generated by TXPCU the moment that protection frame
  1192. * transmission has finished on the medium
  1193. */
  1194. SHOW_DEFINED(WIFIPROT_TX_END_E);
  1195. break;
  1196. }
  1197. case WIFITX_FES_STATUS_START_PPDU_E:
  1198. {
  1199. uint64_t tsft_64;
  1200. uint8_t ndp_frame;
  1201. status = HAL_MON_TX_FES_STATUS_START_PPDU;
  1202. tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
  1203. TX_FES_STATUS_START_PPDU,
  1204. PPDU_TIMESTAMP_LOWER_32);
  1205. tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
  1206. TX_FES_STATUS_START_PPDU,
  1207. PPDU_TIMESTAMP_UPPER_32) << 32);
  1208. ndp_frame = HAL_TX_DESC_GET_64(tx_tlv,
  1209. TX_FES_STATUS_START_PPDU,
  1210. NDP_FRAME);
  1211. TXMON_STATUS_INFO(tx_status_info, ndp_frame) = ndp_frame;
  1212. TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
  1213. SHOW_DEFINED(WIFITX_FES_STATUS_START_PPDU_E);
  1214. break;
  1215. }
  1216. case WIFITX_FES_STATUS_USER_PPDU_E:
  1217. {
  1218. /* user tlv */
  1219. uint16_t duration;
  1220. uint8_t transmitted_tid;
  1221. duration = HAL_TX_DESC_GET_64(tx_tlv,
  1222. TX_FES_STATUS_USER_PPDU,
  1223. DURATION);
  1224. transmitted_tid = HAL_TX_DESC_GET_64(tx_tlv,
  1225. TX_FES_STATUS_USER_PPDU,
  1226. TRANSMITTED_TID);
  1227. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1228. TXMON_HAL_USER(ppdu_info, user_id, tid) = transmitted_tid;
  1229. TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
  1230. status = HAL_MON_TX_FES_STATUS_USER_PPDU;
  1231. SHOW_DEFINED(WIFITX_FES_STATUS_USER_PPDU_E);
  1232. break;
  1233. }
  1234. case WIFIPPDU_TX_END_E:
  1235. {
  1236. /*
  1237. * no tlv content
  1238. *
  1239. * generated by TXPCU the moment that PPDU transmission has
  1240. * finished on the medium
  1241. */
  1242. SHOW_DEFINED(WIFIPPDU_TX_END_E);
  1243. break;
  1244. }
  1245. case WIFITX_FES_STATUS_USER_RESPONSE_E:
  1246. {
  1247. /*
  1248. * TLV contains the FES transmit result of the each
  1249. * of the MAC users. TLV are forwarded to HWSCH
  1250. */
  1251. SHOW_DEFINED(WIFITX_FES_STATUS_USER_RESPONSE_E);
  1252. break;
  1253. }
  1254. case WIFITX_FES_STATUS_ACK_OR_BA_E:
  1255. {
  1256. /* user tlv */
  1257. /*
  1258. * TLV generated by RXPCU and provide information related to
  1259. * the received BA or ACK frame
  1260. */
  1261. SHOW_DEFINED(WIFITX_FES_STATUS_ACK_OR_BA_E);
  1262. break;
  1263. }
  1264. case WIFITX_FES_STATUS_1K_BA_E:
  1265. {
  1266. /* user tlv */
  1267. /*
  1268. * TLV generated by RXPCU and providing information related
  1269. * to the received BA frame in case of 512/1024 bitmaps
  1270. */
  1271. SHOW_DEFINED(WIFITX_FES_STATUS_1K_BA_E);
  1272. break;
  1273. }
  1274. case WIFIRECEIVED_RESPONSE_USER_7_0_E:
  1275. {
  1276. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_7_0_E);
  1277. break;
  1278. }
  1279. case WIFIRECEIVED_RESPONSE_USER_15_8_E:
  1280. {
  1281. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_15_8_E);
  1282. break;
  1283. }
  1284. case WIFIRECEIVED_RESPONSE_USER_23_16_E:
  1285. {
  1286. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_23_16_E);
  1287. break;
  1288. }
  1289. case WIFIRECEIVED_RESPONSE_USER_31_24_E:
  1290. {
  1291. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_31_24_E);
  1292. break;
  1293. }
  1294. case WIFIRECEIVED_RESPONSE_USER_36_32_E:
  1295. {
  1296. /*
  1297. * RXPCU generates this TLV when it receives a response frame
  1298. * that TXPCU pre-announced it was waiting for and in
  1299. * RXPCU_SETUP TLV, TLV generated before the
  1300. * RECEIVED_RESPONSE_INFO TLV.
  1301. *
  1302. * received info user fields are there which is not needed
  1303. * for TX monitor
  1304. */
  1305. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_36_32_E);
  1306. break;
  1307. }
  1308. case WIFITXPCU_BUFFER_STATUS_E:
  1309. {
  1310. SHOW_DEFINED(WIFITXPCU_BUFFER_STATUS_E);
  1311. break;
  1312. }
  1313. case WIFITXPCU_USER_BUFFER_STATUS_E:
  1314. {
  1315. /*
  1316. * WIFITXPCU_USER_BUFFER_STATUS_E - user tlv
  1317. * for TX monitor we aren't interested in this tlv
  1318. */
  1319. SHOW_DEFINED(WIFITXPCU_USER_BUFFER_STATUS_E);
  1320. break;
  1321. }
  1322. case WIFITXDMA_STOP_REQUEST_E:
  1323. {
  1324. /*
  1325. * no tlv content
  1326. *
  1327. * TLV is destined to TXDMA and informs TXDMA to stop
  1328. * pushing data into the transmit path.
  1329. */
  1330. SHOW_DEFINED(WIFITXDMA_STOP_REQUEST_E);
  1331. break;
  1332. }
  1333. case WIFITX_CBF_INFO_E:
  1334. {
  1335. /*
  1336. * After NDPA + NDP is received, RXPCU sends the TX_CBF_INFO to
  1337. * TXPCU to respond the CBF frame
  1338. *
  1339. * compressed beamforming pkt doesn't has mac header
  1340. * Tx monitor not interested in this pkt.
  1341. */
  1342. SHOW_DEFINED(WIFITX_CBF_INFO_E);
  1343. break;
  1344. }
  1345. case WIFITX_MPDU_COUNT_TRANSFER_END_E:
  1346. {
  1347. /*
  1348. * no tlv content
  1349. *
  1350. * TLV indicates that TXPCU has finished generating the
  1351. * TQM_UPDATE_TX_MPDU_COUNT TLV for all users
  1352. */
  1353. SHOW_DEFINED(WIFITX_MPDU_COUNT_TRANSFER_END_E);
  1354. break;
  1355. }
  1356. case WIFIPDG_RESPONSE_E:
  1357. {
  1358. /*
  1359. * most of the feilds are already covered in
  1360. * other TLV
  1361. * This is generated by TX_PCU to PDG to calculate
  1362. * all the PHY header info.
  1363. *
  1364. * some useful fields like min transmit power,
  1365. * rate used for transmitting packet is present.
  1366. */
  1367. SHOW_DEFINED(WIFIPDG_RESPONSE_E);
  1368. break;
  1369. }
  1370. case WIFIPDG_TRIG_RESPONSE_E:
  1371. {
  1372. /* no tlv content */
  1373. SHOW_DEFINED(WIFIPDG_TRIG_RESPONSE_E);
  1374. break;
  1375. }
  1376. case WIFIRECEIVED_TRIGGER_INFO_E:
  1377. {
  1378. /*
  1379. * TLV generated by RXPCU to inform the scheduler that
  1380. * a trigger frame has been received
  1381. */
  1382. SHOW_DEFINED(WIFIRECEIVED_TRIGGER_INFO_E);
  1383. break;
  1384. }
  1385. case WIFIOFDMA_TRIGGER_DETAILS_E:
  1386. {
  1387. SHOW_DEFINED(WIFIOFDMA_TRIGGER_DETAILS_E);
  1388. break;
  1389. }
  1390. case WIFIRX_FRAME_BITMAP_ACK_E:
  1391. {
  1392. /* user tlv */
  1393. status = HAL_MON_RX_FRAME_BITMAP_ACK;
  1394. SHOW_DEFINED(WIFIRX_FRAME_BITMAP_ACK_E);
  1395. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1396. TXMON_STATUS_INFO(tx_status_info, no_bitmap_avail) =
  1397. HAL_TX_DESC_GET_64(tx_tlv,
  1398. RX_FRAME_BITMAP_ACK,
  1399. NO_BITMAP_AVAILABLE);
  1400. TXMON_STATUS_INFO(tx_status_info, explicit_ack) =
  1401. HAL_TX_DESC_GET_64(tx_tlv,
  1402. RX_FRAME_BITMAP_ACK,
  1403. EXPLICIT_ACK);
  1404. /*
  1405. * get mac address, since address is received frame
  1406. * change the order and store it
  1407. */
  1408. *(uint32_t *)&tx_status_info->addr2[0] =
  1409. HAL_TX_DESC_GET_64(tx_tlv,
  1410. RX_FRAME_BITMAP_ACK,
  1411. ADDR1_31_0);
  1412. *(uint32_t *)&tx_status_info->addr2[4] =
  1413. HAL_TX_DESC_GET_64(tx_tlv,
  1414. RX_FRAME_BITMAP_ACK,
  1415. ADDR1_47_32);
  1416. *(uint32_t *)&tx_status_info->addr1[0] =
  1417. HAL_TX_DESC_GET_64(tx_tlv,
  1418. RX_FRAME_BITMAP_ACK,
  1419. ADDR2_15_0);
  1420. *(uint32_t *)&tx_status_info->addr1[2] =
  1421. HAL_TX_DESC_GET_64(tx_tlv,
  1422. RX_FRAME_BITMAP_ACK,
  1423. ADDR2_47_16);
  1424. TXMON_STATUS_INFO(tx_status_info, explicit_ack_type) =
  1425. HAL_TX_DESC_GET_64(tx_tlv, RX_FRAME_BITMAP_ACK,
  1426. EXPLICT_ACK_TYPE);
  1427. TXMON_HAL_USER(ppdu_info, user_id, tid) =
  1428. HAL_TX_DESC_GET_64(tx_tlv,
  1429. RX_FRAME_BITMAP_ACK,
  1430. BA_TID);
  1431. TXMON_HAL_USER(ppdu_info, user_id, aid) =
  1432. HAL_TX_DESC_GET_64(tx_tlv,
  1433. RX_FRAME_BITMAP_ACK,
  1434. STA_FULL_AID);
  1435. TXMON_HAL_USER(ppdu_info, user_id, start_seq) =
  1436. HAL_TX_DESC_GET_64(tx_tlv,
  1437. RX_FRAME_BITMAP_ACK,
  1438. BA_TS_SEQ);
  1439. TXMON_HAL_USER(ppdu_info, user_id, ba_control) =
  1440. HAL_TX_DESC_GET_64(tx_tlv,
  1441. RX_FRAME_BITMAP_ACK,
  1442. BA_TS_CTRL);
  1443. TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap_sz) =
  1444. HAL_TX_DESC_GET_64(tx_tlv,
  1445. RX_FRAME_BITMAP_ACK,
  1446. BA_BITMAP_SIZE);
  1447. /* ba bitmap */
  1448. qdf_mem_copy(TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap),
  1449. &HAL_SET_FLD_OFFSET_64(tx_tlv,
  1450. RX_FRAME_BITMAP_ACK,
  1451. BA_TS_BITMAP_31_0, 0), 32);
  1452. break;
  1453. }
  1454. case WIFIRX_FRAME_1K_BITMAP_ACK_E:
  1455. {
  1456. /* user tlv */
  1457. status = HAL_MON_RX_FRAME_BITMAP_BLOCK_ACK_1K;
  1458. SHOW_DEFINED(WIFIRX_FRAME_1K_BITMAP_ACK_E);
  1459. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1460. TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap_sz) =
  1461. (4 + HAL_TX_DESC_GET_64(tx_tlv, RX_FRAME_1K_BITMAP_ACK,
  1462. BA_BITMAP_SIZE));
  1463. TXMON_HAL_USER(ppdu_info, user_id, tid) =
  1464. HAL_TX_DESC_GET_64(tx_tlv,
  1465. RX_FRAME_1K_BITMAP_ACK,
  1466. BA_TID);
  1467. TXMON_HAL_USER(ppdu_info, user_id, aid) =
  1468. HAL_TX_DESC_GET_64(tx_tlv,
  1469. RX_FRAME_1K_BITMAP_ACK,
  1470. STA_FULL_AID);
  1471. /* get mac address */
  1472. *(uint32_t *)&tx_status_info->addr1[0] =
  1473. HAL_TX_DESC_GET_64(tx_tlv,
  1474. RX_FRAME_1K_BITMAP_ACK,
  1475. ADDR1_31_0);
  1476. *(uint32_t *)&tx_status_info->addr1[4] =
  1477. HAL_TX_DESC_GET_64(tx_tlv,
  1478. RX_FRAME_1K_BITMAP_ACK,
  1479. ADDR1_47_32);
  1480. *(uint32_t *)&tx_status_info->addr2[0] =
  1481. HAL_TX_DESC_GET_64(tx_tlv,
  1482. RX_FRAME_1K_BITMAP_ACK,
  1483. ADDR2_15_0);
  1484. *(uint32_t *)&tx_status_info->addr2[2] =
  1485. HAL_TX_DESC_GET_64(tx_tlv,
  1486. RX_FRAME_1K_BITMAP_ACK,
  1487. ADDR2_47_16);
  1488. TXMON_HAL_USER(ppdu_info, user_id, start_seq) =
  1489. HAL_TX_DESC_GET_64(tx_tlv,
  1490. RX_FRAME_1K_BITMAP_ACK,
  1491. BA_TS_SEQ);
  1492. TXMON_HAL_USER(ppdu_info, user_id, ba_control) =
  1493. HAL_TX_DESC_GET_64(tx_tlv,
  1494. RX_FRAME_1K_BITMAP_ACK,
  1495. BA_TS_CTRL);
  1496. /* memcpy ba bitmap */
  1497. qdf_mem_copy(TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap),
  1498. &HAL_SET_FLD_OFFSET_64(tx_tlv,
  1499. RX_FRAME_1K_BITMAP_ACK,
  1500. BA_TS_BITMAP_31_0, 0),
  1501. 4 << TXMON_HAL_USER(ppdu_info,
  1502. user_id, ba_bitmap_sz));
  1503. break;
  1504. }
  1505. case WIFIRESPONSE_START_STATUS_E:
  1506. {
  1507. /*
  1508. * TLV indicates which HW response the TXPCU
  1509. * started generating
  1510. *
  1511. * HW generated frames like
  1512. * ACK frame - handled
  1513. * CTS frame - handled
  1514. * BA frame - handled
  1515. * MBA frame - handled
  1516. * CBF frame - no frame header
  1517. * Trigger response - TODO
  1518. * NDP LMR - no frame header
  1519. */
  1520. SHOW_DEFINED(WIFIRESPONSE_START_STATUS_E);
  1521. break;
  1522. }
  1523. case WIFIRX_START_PARAM_E:
  1524. {
  1525. /*
  1526. * RXPCU send this TLV after PHY RX detected a frame
  1527. * in the medium
  1528. *
  1529. * TX monitor not interested in this TLV
  1530. */
  1531. SHOW_DEFINED(WIFIRX_START_PARAM_E);
  1532. break;
  1533. }
  1534. case WIFIRXPCU_EARLY_RX_INDICATION_E:
  1535. {
  1536. /*
  1537. * early indication of pkt type and mcs rate
  1538. * already captured in other tlv
  1539. */
  1540. SHOW_DEFINED(WIFIRXPCU_EARLY_RX_INDICATION_E);
  1541. break;
  1542. }
  1543. case WIFIRX_PM_INFO_E:
  1544. {
  1545. SHOW_DEFINED(WIFIRX_PM_INFO_E);
  1546. break;
  1547. }
  1548. /* Active window */
  1549. case WIFITX_FLUSH_REQ_E:
  1550. {
  1551. SHOW_DEFINED(WIFITX_FLUSH_REQ_E);
  1552. break;
  1553. }
  1554. case WIFICOEX_TX_STATUS_E:
  1555. {
  1556. /* duration are retrieved from coex tx status */
  1557. uint16_t duration;
  1558. uint8_t status_reason;
  1559. status = HAL_MON_COEX_TX_STATUS;
  1560. duration = HAL_TX_DESC_GET_64(tx_tlv,
  1561. COEX_TX_STATUS,
  1562. CURRENT_TX_DURATION);
  1563. status_reason = HAL_TX_DESC_GET_64(tx_tlv,
  1564. COEX_TX_STATUS,
  1565. TX_STATUS_REASON);
  1566. /* update duration */
  1567. if (status_reason == COEX_FES_TX_START ||
  1568. status_reason == COEX_RESPONSE_TX_START)
  1569. TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
  1570. SHOW_DEFINED(WIFICOEX_TX_STATUS_E);
  1571. break;
  1572. }
  1573. case WIFIR2R_STATUS_END_E:
  1574. {
  1575. SHOW_DEFINED(WIFIR2R_STATUS_END_E);
  1576. break;
  1577. }
  1578. case WIFIRX_PREAMBLE_E:
  1579. {
  1580. SHOW_DEFINED(WIFIRX_PREAMBLE_E);
  1581. break;
  1582. }
  1583. case WIFIMACTX_SERVICE_E:
  1584. {
  1585. SHOW_DEFINED(WIFIMACTX_SERVICE_E);
  1586. break;
  1587. }
  1588. case WIFIMACTX_U_SIG_EHT_SU_MU_E:
  1589. {
  1590. SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_SU_MU_E);
  1591. break;
  1592. }
  1593. case WIFIMACTX_U_SIG_EHT_TB_E:
  1594. {
  1595. /* TODO: no radiotap info available */
  1596. SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_TB_E);
  1597. break;
  1598. }
  1599. case WIFIMACTX_EHT_SIG_USR_OFDMA_E:
  1600. {
  1601. SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_OFDMA_E);
  1602. break;
  1603. }
  1604. case WIFIMACTX_EHT_SIG_USR_MU_MIMO_E:
  1605. {
  1606. SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_MU_MIMO_E);
  1607. break;
  1608. }
  1609. case WIFIMACTX_EHT_SIG_USR_SU_E:
  1610. {
  1611. SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_SU_E);
  1612. /* TODO: no radiotap info available */
  1613. break;
  1614. }
  1615. case WIFIMACTX_HE_SIG_A_SU_E:
  1616. {
  1617. uint16_t he_mu_flag_1 = 0;
  1618. uint16_t he_mu_flag_2 = 0;
  1619. uint16_t num_users = 0;
  1620. uint8_t mcs_of_sig_b = 0;
  1621. uint8_t dcm_of_sig_b = 0;
  1622. uint8_t sig_a_bw = 0;
  1623. uint8_t i = 0;
  1624. uint8_t bss_color_id;
  1625. uint8_t coding;
  1626. uint8_t stbc;
  1627. uint8_t a_factor;
  1628. uint8_t pe_disambiguity;
  1629. uint8_t txbf;
  1630. uint8_t txbw;
  1631. uint8_t txop;
  1632. status = HAL_MON_MACTX_HE_SIG_A_SU;
  1633. num_users = TXMON_HAL(ppdu_info, num_users);
  1634. mcs_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1635. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1636. TRANSMIT_MCS);
  1637. dcm_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1638. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1639. DCM);
  1640. sig_a_bw = HAL_TX_DESC_GET_64(tx_tlv,
  1641. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1642. TRANSMIT_BW);
  1643. bss_color_id = HAL_TX_DESC_GET_64(tx_tlv,
  1644. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1645. BSS_COLOR_ID);
  1646. coding = HAL_TX_DESC_GET_64(tx_tlv,
  1647. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1648. CODING);
  1649. stbc = HAL_TX_DESC_GET_64(tx_tlv,
  1650. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1651. STBC);
  1652. a_factor = HAL_TX_DESC_GET_64(tx_tlv,
  1653. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1654. PACKET_EXTENSION_A_FACTOR);
  1655. pe_disambiguity = HAL_TX_DESC_GET_64(tx_tlv,
  1656. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1657. PACKET_EXTENSION_PE_DISAMBIGUITY);
  1658. txbf = HAL_TX_DESC_GET_64(tx_tlv,
  1659. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1660. TXBF);
  1661. txbw = HAL_TX_DESC_GET_64(tx_tlv,
  1662. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1663. TRANSMIT_BW);
  1664. txop = HAL_TX_DESC_GET_64(tx_tlv,
  1665. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1666. TXOP_DURATION);
  1667. he_mu_flag_1 |= QDF_MON_STATUS_SIG_B_MCS_KNOWN |
  1668. QDF_MON_STATUS_SIG_B_DCM_KNOWN |
  1669. QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN |
  1670. QDF_MON_STATUS_CHANNEL_1_RU_KNOWN |
  1671. QDF_MON_STATUS_CHANNEL_2_RU_KNOWN |
  1672. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN;
  1673. /* MCS */
  1674. he_mu_flag_1 |= mcs_of_sig_b <<
  1675. QDF_MON_STATUS_SIG_B_MCS_SHIFT;
  1676. /* DCM */
  1677. he_mu_flag_1 |= dcm_of_sig_b <<
  1678. QDF_MON_STATUS_SIG_B_DCM_SHIFT;
  1679. /* bandwidth */
  1680. he_mu_flag_2 |= QDF_MON_STATUS_SIG_A_BANDWIDTH_KNOWN;
  1681. he_mu_flag_2 |= sig_a_bw <<
  1682. QDF_MON_STATUS_SIG_A_BANDWIDTH_SHIFT;
  1683. TXMON_HAL_STATUS(ppdu_info,
  1684. he_mu_flags) = IS_MULTI_USERS(num_users);
  1685. for (i = 0; i < num_users; i++) {
  1686. TXMON_HAL_USER(ppdu_info, i, he_flags1) |= he_mu_flag_1;
  1687. TXMON_HAL_USER(ppdu_info, i, he_flags2) |= he_mu_flag_2;
  1688. }
  1689. /* HE data 1 */
  1690. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  1691. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  1692. QDF_MON_STATUS_HE_CODING_KNOWN;
  1693. /* HE data 2 */
  1694. TXMON_HAL_USER(ppdu_info, user_id, he_data2) |=
  1695. QDF_MON_STATUS_TXBF_KNOWN |
  1696. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  1697. QDF_MON_STATUS_TXOP_KNOWN |
  1698. QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN |
  1699. QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN;
  1700. /* HE data 3 */
  1701. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1702. bss_color_id |
  1703. (!!txbf << QDF_MON_STATUS_BEAM_CHANGE_SHIFT) |
  1704. (coding << QDF_MON_STATUS_CODING_SHIFT) |
  1705. (stbc << QDF_MON_STATUS_STBC_SHIFT);
  1706. /* HE data 6 */
  1707. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |=
  1708. (txop << QDF_MON_STATUS_TXOP_SHIFT);
  1709. SHOW_DEFINED(WIFIMACTX_HE_SIG_A_SU_E);
  1710. break;
  1711. }
  1712. case WIFIMACTX_HE_SIG_A_MU_DL_E:
  1713. {
  1714. uint16_t he_mu_flag_1 = 0;
  1715. uint16_t he_mu_flag_2 = 0;
  1716. uint16_t num_users = 0;
  1717. uint8_t bss_color_id;
  1718. uint8_t txop;
  1719. uint8_t mcs_of_sig_b = 0;
  1720. uint8_t dcm_of_sig_b = 0;
  1721. uint8_t sig_a_bw = 0;
  1722. uint8_t num_sig_b_symb = 0;
  1723. uint8_t comp_mode_sig_b = 0;
  1724. uint8_t punc_bw = 0;
  1725. uint8_t i = 0;
  1726. status = HAL_MON_MACTX_HE_SIG_A_MU_DL;
  1727. num_users = TXMON_HAL(ppdu_info, num_users);
  1728. mcs_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1729. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1730. MCS_OF_SIG_B);
  1731. dcm_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1732. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1733. DCM_OF_SIG_B);
  1734. sig_a_bw = HAL_TX_DESC_GET_64(tx_tlv,
  1735. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1736. TRANSMIT_BW);
  1737. num_sig_b_symb = HAL_TX_DESC_GET_64(tx_tlv,
  1738. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1739. NUM_SIG_B_SYMBOLS);
  1740. comp_mode_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1741. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1742. COMP_MODE_SIG_B);
  1743. bss_color_id = HAL_TX_DESC_GET_64(tx_tlv,
  1744. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1745. BSS_COLOR_ID);
  1746. txop = HAL_TX_DESC_GET_64(tx_tlv,
  1747. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1748. TXOP_DURATION);
  1749. he_mu_flag_1 |= QDF_MON_STATUS_SIG_B_MCS_KNOWN |
  1750. QDF_MON_STATUS_SIG_B_DCM_KNOWN |
  1751. QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN |
  1752. QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN |
  1753. QDF_MON_STATUS_CHANNEL_1_RU_KNOWN |
  1754. QDF_MON_STATUS_CHANNEL_2_RU_KNOWN |
  1755. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN |
  1756. QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN |
  1757. QDF_MON_STATUS_SIG_B_SYMBOL_USER_KNOWN;
  1758. /* MCS */
  1759. he_mu_flag_1 |= mcs_of_sig_b <<
  1760. QDF_MON_STATUS_SIG_B_MCS_SHIFT;
  1761. /* DCM */
  1762. he_mu_flag_1 |= dcm_of_sig_b <<
  1763. QDF_MON_STATUS_SIG_B_DCM_SHIFT;
  1764. /* Compression */
  1765. he_mu_flag_2 |= comp_mode_sig_b <<
  1766. QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT;
  1767. /* bandwidth */
  1768. he_mu_flag_2 |= QDF_MON_STATUS_SIG_A_BANDWIDTH_KNOWN;
  1769. he_mu_flag_2 |= sig_a_bw <<
  1770. QDF_MON_STATUS_SIG_A_BANDWIDTH_SHIFT;
  1771. he_mu_flag_2 |= comp_mode_sig_b <<
  1772. QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT;
  1773. /* number of symbol */
  1774. he_mu_flag_2 |= num_sig_b_symb <<
  1775. QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT;
  1776. /* puncture bw */
  1777. he_mu_flag_2 |= QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_KNOWN;
  1778. punc_bw = sig_a_bw;
  1779. he_mu_flag_2 |=
  1780. punc_bw << QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_SHIFT;
  1781. /* copy per user info to all user */
  1782. TXMON_HAL_STATUS(ppdu_info,
  1783. he_mu_flags) = IS_MULTI_USERS(num_users);
  1784. for (i = 0; i < num_users; i++) {
  1785. TXMON_HAL_USER(ppdu_info, i, he_flags1) |= he_mu_flag_1;
  1786. TXMON_HAL_USER(ppdu_info, i, he_flags2) |= he_mu_flag_2;
  1787. }
  1788. /* HE data 1 */
  1789. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  1790. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN;
  1791. /* HE data 2 */
  1792. TXMON_HAL_USER(ppdu_info, user_id, he_data2) |=
  1793. QDF_MON_STATUS_TXOP_KNOWN;
  1794. /* HE data 3 */
  1795. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |= bss_color_id;
  1796. /* HE data 6 */
  1797. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |=
  1798. (txop << QDF_MON_STATUS_TXOP_SHIFT);
  1799. SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_DL_E);
  1800. break;
  1801. }
  1802. case WIFIMACTX_HE_SIG_A_MU_UL_E:
  1803. {
  1804. SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_UL_E);
  1805. break;
  1806. }
  1807. case WIFIMACTX_HE_SIG_B1_MU_E:
  1808. {
  1809. status = HAL_MON_MACTX_HE_SIG_B1_MU;
  1810. SHOW_DEFINED(WIFIMACTX_HE_SIG_B1_MU_E);
  1811. break;
  1812. }
  1813. case WIFIMACTX_HE_SIG_B2_MU_E:
  1814. {
  1815. /* user tlv */
  1816. uint16_t sta_id = 0;
  1817. uint16_t sta_spatial_config = 0;
  1818. uint8_t sta_mcs = 0;
  1819. uint8_t coding = 0;
  1820. uint8_t nss = 0;
  1821. uint8_t user_order = 0;
  1822. status = HAL_MON_MACTX_HE_SIG_B2_MU;
  1823. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1824. sta_id = HAL_TX_DESC_GET_64(tx_tlv,
  1825. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1826. STA_ID);
  1827. sta_spatial_config = HAL_TX_DESC_GET_64(tx_tlv,
  1828. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1829. STA_SPATIAL_CONFIG);
  1830. sta_mcs = HAL_TX_DESC_GET_64(tx_tlv,
  1831. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1832. STA_MCS);
  1833. coding = HAL_TX_DESC_GET_64(tx_tlv,
  1834. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1835. STA_CODING);
  1836. nss = HAL_TX_DESC_GET_64(tx_tlv,
  1837. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1838. NSTS) + 1;
  1839. user_order = HAL_TX_DESC_GET_64(tx_tlv,
  1840. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1841. USER_ORDER);
  1842. /* HE data 1 */
  1843. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  1844. QDF_MON_STATUS_HE_MCS_KNOWN |
  1845. QDF_MON_STATUS_HE_CODING_KNOWN;
  1846. /* HE data 2 */
  1847. /* HE data 3 */
  1848. TXMON_HAL_USER(ppdu_info, user_id, mcs) = sta_mcs;
  1849. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1850. sta_mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  1851. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1852. coding << QDF_MON_STATUS_CODING_SHIFT;
  1853. /* HE data 4 */
  1854. TXMON_HAL_USER(ppdu_info, user_id, he_data4) |=
  1855. sta_id << QDF_MON_STATUS_STA_ID_SHIFT;
  1856. /* HE data 5 */
  1857. /* HE data 6 */
  1858. TXMON_HAL_USER(ppdu_info, user_id, nss) = nss;
  1859. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |= nss;
  1860. SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_MU_E);
  1861. break;
  1862. }
  1863. case WIFIMACTX_HE_SIG_B2_OFDMA_E:
  1864. {
  1865. /* user tlv */
  1866. uint8_t *he_sig_b2_ofdma_info = NULL;
  1867. uint16_t sta_id = 0;
  1868. uint8_t nss = 0;
  1869. uint8_t txbf = 0;
  1870. uint8_t sta_mcs = 0;
  1871. uint8_t sta_dcm = 0;
  1872. uint8_t coding = 0;
  1873. uint8_t user_order = 0;
  1874. status = HAL_MON_MACTX_HE_SIG_B2_OFDMA;
  1875. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1876. he_sig_b2_ofdma_info = (uint8_t *)tx_tlv +
  1877. HAL_OFFSET(MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1878. STA_ID);
  1879. sta_id = HAL_TX_DESC_GET_64(tx_tlv,
  1880. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1881. STA_ID);
  1882. nss = HAL_TX_DESC_GET_64(tx_tlv,
  1883. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1884. NSTS);
  1885. txbf = HAL_TX_DESC_GET_64(tx_tlv,
  1886. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1887. TXBF);
  1888. sta_mcs = HAL_TX_DESC_GET_64(tx_tlv,
  1889. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1890. STA_MCS);
  1891. sta_dcm = HAL_TX_DESC_GET_64(tx_tlv,
  1892. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1893. STA_DCM);
  1894. coding = HAL_TX_DESC_GET_64(tx_tlv,
  1895. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1896. STA_CODING);
  1897. user_order = HAL_TX_DESC_GET_64(tx_tlv,
  1898. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1899. USER_ORDER);
  1900. /* HE data 1 */
  1901. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  1902. QDF_MON_STATUS_HE_MCS_KNOWN |
  1903. QDF_MON_STATUS_HE_CODING_KNOWN |
  1904. QDF_MON_STATUS_HE_DCM_KNOWN;
  1905. /* HE data 2 */
  1906. TXMON_HAL_USER(ppdu_info, user_id, he_data2) |=
  1907. QDF_MON_STATUS_TXBF_KNOWN;
  1908. /* HE data 3 */
  1909. TXMON_HAL_USER(ppdu_info, user_id, mcs) = sta_mcs;
  1910. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1911. sta_mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  1912. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1913. sta_dcm << QDF_MON_STATUS_DCM_SHIFT;
  1914. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1915. coding << QDF_MON_STATUS_CODING_SHIFT;
  1916. /* HE data 4 */
  1917. TXMON_HAL_USER(ppdu_info, user_id, he_data4) |=
  1918. sta_id << QDF_MON_STATUS_STA_ID_SHIFT;
  1919. /* HE data 5 */
  1920. TXMON_HAL_USER(ppdu_info, user_id, he_data5) |=
  1921. txbf << QDF_MON_STATUS_TXBF_SHIFT;
  1922. /* HE data 6 */
  1923. TXMON_HAL_USER(ppdu_info, user_id, nss) = nss;
  1924. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |= nss;
  1925. SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_OFDMA_E);
  1926. break;
  1927. }
  1928. case WIFIMACTX_L_SIG_A_E:
  1929. {
  1930. uint8_t *l_sig_a_info = NULL;
  1931. uint8_t rate = 0;
  1932. status = HAL_MON_MACTX_L_SIG_A;
  1933. l_sig_a_info = (uint8_t *)tx_tlv +
  1934. HAL_OFFSET(MACTX_L_SIG_A_MACTX_L_SIG_A_INFO_DETAILS,
  1935. RATE);
  1936. rate = HAL_TX_DESC_GET_64(tx_tlv,
  1937. MACTX_L_SIG_A_MACTX_L_SIG_A_INFO_DETAILS,
  1938. RATE);
  1939. switch (rate) {
  1940. case 8:
  1941. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_0MCS;
  1942. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS0;
  1943. break;
  1944. case 9:
  1945. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_1MCS;
  1946. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS1;
  1947. break;
  1948. case 10:
  1949. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_2MCS;
  1950. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS2;
  1951. break;
  1952. case 11:
  1953. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_3MCS;
  1954. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS3;
  1955. break;
  1956. case 12:
  1957. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_4MCS;
  1958. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS4;
  1959. break;
  1960. case 13:
  1961. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_5MCS;
  1962. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS5;
  1963. break;
  1964. case 14:
  1965. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_6MCS;
  1966. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS6;
  1967. break;
  1968. case 15:
  1969. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_7MCS;
  1970. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS7;
  1971. break;
  1972. default:
  1973. break;
  1974. }
  1975. TXMON_HAL_STATUS(ppdu_info, ofdm_flag) = 1;
  1976. TXMON_HAL_STATUS(ppdu_info, reception_type) = HAL_RX_TYPE_SU;
  1977. TXMON_HAL_STATUS(ppdu_info, l_sig_a_info) = *l_sig_a_info;
  1978. SHOW_DEFINED(WIFIMACTX_L_SIG_A_E);
  1979. break;
  1980. }
  1981. case WIFIMACTX_L_SIG_B_E:
  1982. {
  1983. uint8_t *l_sig_b_info = NULL;
  1984. uint8_t rate = 0;
  1985. status = HAL_MON_MACTX_L_SIG_B;
  1986. l_sig_b_info = (uint8_t *)tx_tlv +
  1987. HAL_OFFSET(MACTX_L_SIG_B_MACTX_L_SIG_B_INFO_DETAILS,
  1988. RATE);
  1989. rate = HAL_TX_DESC_GET_64(tx_tlv,
  1990. MACTX_L_SIG_B_MACTX_L_SIG_B_INFO_DETAILS,
  1991. RATE);
  1992. switch (rate) {
  1993. case 1:
  1994. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_3MCS;
  1995. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS3;
  1996. break;
  1997. case 2:
  1998. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_2MCS;
  1999. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS2;
  2000. break;
  2001. case 3:
  2002. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_1MCS;
  2003. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS1;
  2004. break;
  2005. case 4:
  2006. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_0MCS;
  2007. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS0;
  2008. break;
  2009. case 5:
  2010. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_6MCS;
  2011. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS6;
  2012. break;
  2013. case 6:
  2014. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_5MCS;
  2015. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS5;
  2016. break;
  2017. case 7:
  2018. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_4MCS;
  2019. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS4;
  2020. break;
  2021. default:
  2022. break;
  2023. }
  2024. TXMON_HAL_STATUS(ppdu_info, cck_flag) = 1;
  2025. TXMON_HAL_STATUS(ppdu_info, reception_type) = HAL_RX_TYPE_SU;
  2026. TXMON_HAL_STATUS(ppdu_info, l_sig_b_info) = *l_sig_b_info;
  2027. SHOW_DEFINED(WIFIMACTX_L_SIG_B_E);
  2028. break;
  2029. }
  2030. case WIFIMACTX_HT_SIG_E:
  2031. {
  2032. uint8_t mcs = 0;
  2033. uint8_t bw = 0;
  2034. uint8_t is_stbc = 0;
  2035. uint8_t coding = 0;
  2036. uint8_t gi = 0;
  2037. status = HAL_MON_MACTX_HT_SIG;
  2038. mcs = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, MCS);
  2039. bw = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, CBW);
  2040. is_stbc = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, STBC);
  2041. coding = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, FEC_CODING);
  2042. gi = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, SHORT_GI);
  2043. TXMON_HAL_STATUS(ppdu_info, ldpc) =
  2044. (coding == HAL_SU_MU_CODING_LDPC) ? 1 : 0;
  2045. TXMON_HAL_STATUS(ppdu_info, ht_mcs) = mcs;
  2046. TXMON_HAL_STATUS(ppdu_info, bw) = bw;
  2047. TXMON_HAL_STATUS(ppdu_info, sgi) = gi;
  2048. TXMON_HAL_STATUS(ppdu_info, is_stbc) = is_stbc;
  2049. TXMON_HAL_STATUS(ppdu_info, reception_type) = HAL_RX_TYPE_SU;
  2050. SHOW_DEFINED(WIFIMACTX_HT_SIG_E);
  2051. break;
  2052. }
  2053. case WIFIMACTX_VHT_SIG_A_E:
  2054. {
  2055. uint8_t bandwidth = 0;
  2056. uint8_t is_stbc = 0;
  2057. uint8_t group_id = 0;
  2058. uint32_t nss_comb = 0;
  2059. uint8_t nss_su = 0;
  2060. uint8_t nss_mu[4] = {0};
  2061. uint8_t sgi = 0;
  2062. uint8_t coding = 0;
  2063. uint8_t mcs = 0;
  2064. uint8_t beamformed = 0;
  2065. uint8_t partial_aid = 0;
  2066. status = HAL_MON_MACTX_VHT_SIG_A;
  2067. bandwidth = HAL_TX_DESC_GET_64(tx_tlv,
  2068. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2069. BANDWIDTH);
  2070. is_stbc = HAL_TX_DESC_GET_64(tx_tlv,
  2071. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2072. STBC);
  2073. group_id = HAL_TX_DESC_GET_64(tx_tlv,
  2074. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2075. GROUP_ID);
  2076. /* nss_comb is su nss, MU nss and partial AID */
  2077. nss_comb = HAL_TX_DESC_GET_64(tx_tlv,
  2078. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2079. N_STS);
  2080. /* if it is SU */
  2081. nss_su = (nss_comb & 0x7) + 1;
  2082. /* partial aid - applicable only for SU */
  2083. partial_aid = (nss_comb >> 3) & 0x1F;
  2084. /* if it is MU */
  2085. nss_mu[0] = (nss_comb & 0x7) + 1;
  2086. nss_mu[1] = ((nss_comb >> 3) & 0x7) + 1;
  2087. nss_mu[2] = ((nss_comb >> 6) & 0x7) + 1;
  2088. nss_mu[3] = ((nss_comb >> 9) & 0x7) + 1;
  2089. sgi = HAL_TX_DESC_GET_64(tx_tlv,
  2090. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2091. GI_SETTING);
  2092. coding = HAL_TX_DESC_GET_64(tx_tlv,
  2093. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2094. SU_MU_CODING);
  2095. mcs = HAL_TX_DESC_GET_64(tx_tlv,
  2096. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2097. MCS);
  2098. beamformed = HAL_TX_DESC_GET_64(tx_tlv,
  2099. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2100. BEAMFORMED);
  2101. TXMON_HAL_STATUS(ppdu_info, ldpc) =
  2102. (coding == HAL_SU_MU_CODING_LDPC) ? 1 : 0;
  2103. TXMON_STATUS_INFO(tx_status_info, sw_frame_group_id) = group_id;
  2104. TXMON_HAL_STATUS(ppdu_info, sgi) = sgi;
  2105. TXMON_HAL_STATUS(ppdu_info, is_stbc) = is_stbc;
  2106. TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
  2107. TXMON_HAL_STATUS(ppdu_info, beamformed) = beamformed;
  2108. if (group_id == 0 || group_id == 63) {
  2109. TXMON_HAL_STATUS(ppdu_info, reception_type) =
  2110. HAL_RX_TYPE_SU;
  2111. TXMON_HAL_STATUS(ppdu_info, mcs) = mcs;
  2112. TXMON_HAL_STATUS(ppdu_info, nss) =
  2113. nss_su & VHT_SIG_SU_NSS_MASK;
  2114. TXMON_HAL_USER(ppdu_info, user_id,
  2115. vht_flag_values3[0]) = ((mcs << 4) |
  2116. nss_su);
  2117. } else {
  2118. TXMON_HAL_STATUS(ppdu_info, reception_type) =
  2119. HAL_RX_TYPE_MU_MIMO;
  2120. TXMON_HAL_USER(ppdu_info, user_id, mcs) = mcs;
  2121. TXMON_HAL_USER(ppdu_info, user_id, nss) =
  2122. nss_su & VHT_SIG_SU_NSS_MASK;
  2123. TXMON_HAL_USER(ppdu_info, user_id,
  2124. vht_flag_values3[0]) = ((mcs << 4) |
  2125. nss_su);
  2126. TXMON_HAL_USER(ppdu_info, user_id,
  2127. vht_flag_values3[1]) = ((mcs << 4) |
  2128. nss_mu[1]);
  2129. TXMON_HAL_USER(ppdu_info, user_id,
  2130. vht_flag_values3[2]) = ((mcs << 4) |
  2131. nss_mu[2]);
  2132. TXMON_HAL_USER(ppdu_info, user_id,
  2133. vht_flag_values3[3]) = ((mcs << 4) |
  2134. nss_mu[3]);
  2135. }
  2136. /* TODO: loop over multiple user */
  2137. TXMON_HAL_USER(ppdu_info, user_id,
  2138. vht_flag_values2) = bandwidth;
  2139. TXMON_HAL_USER(ppdu_info, user_id,
  2140. vht_flag_values4) = coding;
  2141. TXMON_HAL_USER(ppdu_info, user_id,
  2142. vht_flag_values5) = group_id;
  2143. TXMON_HAL_USER(ppdu_info, user_id,
  2144. vht_flag_values6) = partial_aid;
  2145. SHOW_DEFINED(WIFIMACTX_VHT_SIG_A_E);
  2146. break;
  2147. }
  2148. case WIFIMACTX_VHT_SIG_B_MU160_E:
  2149. {
  2150. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU160_E);
  2151. break;
  2152. }
  2153. case WIFIMACTX_VHT_SIG_B_MU80_E:
  2154. {
  2155. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU80_E);
  2156. break;
  2157. }
  2158. case WIFIMACTX_VHT_SIG_B_MU40_E:
  2159. {
  2160. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU40_E);
  2161. break;
  2162. }
  2163. case WIFIMACTX_VHT_SIG_B_MU20_E:
  2164. {
  2165. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU20_E);
  2166. break;
  2167. }
  2168. case WIFIMACTX_VHT_SIG_B_SU160_E:
  2169. {
  2170. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU160_E);
  2171. break;
  2172. }
  2173. case WIFIMACTX_VHT_SIG_B_SU80_E:
  2174. {
  2175. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU80_E);
  2176. break;
  2177. }
  2178. case WIFIMACTX_VHT_SIG_B_SU40_E:
  2179. {
  2180. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU40_E);
  2181. break;
  2182. }
  2183. case WIFIMACTX_VHT_SIG_B_SU20_E:
  2184. {
  2185. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU20_E);
  2186. break;
  2187. }
  2188. case WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E:
  2189. {
  2190. SHOW_DEFINED(WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E);
  2191. break;
  2192. }
  2193. case WIFIMACTX_USER_DESC_PER_USER_E:
  2194. {
  2195. /* user tlv */
  2196. uint32_t bf = 0;
  2197. uint32_t psdu_length = 0;
  2198. uint8_t ru_start_index = 0;
  2199. uint8_t ru_size = 0;
  2200. uint8_t nss = 0;
  2201. uint8_t mcs = 0;
  2202. uint8_t dcm = 0;
  2203. uint8_t fec_type = 0;
  2204. uint8_t is_ldpc_extra_symb = 0;
  2205. uint32_t he_data1 = TXMON_HAL_USER(ppdu_info, user_id,
  2206. he_data1);
  2207. uint32_t he_data2 = TXMON_HAL_USER(ppdu_info, user_id,
  2208. he_data2);
  2209. uint32_t he_data3 = TXMON_HAL_USER(ppdu_info, user_id,
  2210. he_data3);
  2211. uint32_t he_data5 = TXMON_HAL_USER(ppdu_info, user_id,
  2212. he_data5);
  2213. uint32_t he_data6 = TXMON_HAL_USER(ppdu_info, user_id,
  2214. he_data6);
  2215. status = HAL_MON_MACTX_USER_DESC_PER_USER;
  2216. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  2217. psdu_length = HAL_TX_DESC_GET_64(tx_tlv,
  2218. MACTX_USER_DESC_PER_USER,
  2219. PSDU_LENGTH);
  2220. ru_start_index = HAL_TX_DESC_GET_64(tx_tlv,
  2221. MACTX_USER_DESC_PER_USER,
  2222. RU_START_INDEX);
  2223. ru_size = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
  2224. RU_SIZE);
  2225. bf = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
  2226. USER_BF_TYPE);
  2227. nss = HAL_TX_DESC_GET_64(tx_tlv,
  2228. MACTX_USER_DESC_PER_USER, NSS) + 1;
  2229. mcs = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER, MCS);
  2230. dcm = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER, DCM);
  2231. fec_type = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
  2232. FEC_TYPE);
  2233. is_ldpc_extra_symb =
  2234. HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
  2235. LDPC_EXTRA_SYMBOL);
  2236. if (!TXMON_HAL_STATUS(ppdu_info, he_flags))
  2237. break;
  2238. /* update */
  2239. /* BEAM CHANGE */
  2240. he_data1 |= QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN;
  2241. he_data1 |= QDF_MON_STATUS_TXBF_KNOWN;
  2242. he_data5 |= (!!bf << QDF_MON_STATUS_TXBF_SHIFT);
  2243. he_data3 |= (!!bf << QDF_MON_STATUS_BEAM_CHANGE_SHIFT);
  2244. /* UL/DL known */
  2245. he_data1 |= QDF_MON_STATUS_HE_DL_UL_KNOWN;
  2246. he_data3 |= (1 << QDF_MON_STATUS_DL_UL_SHIFT);
  2247. /* MCS */
  2248. he_data1 |= QDF_MON_STATUS_HE_MCS_KNOWN;
  2249. he_data3 |= (mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT);
  2250. /* DCM */
  2251. he_data1 |= QDF_MON_STATUS_HE_DCM_KNOWN;
  2252. he_data3 |= (dcm << QDF_MON_STATUS_DCM_SHIFT);
  2253. /* LDPC EXTRA SYMB */
  2254. he_data1 |= QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN;
  2255. he_data3 |= (is_ldpc_extra_symb <<
  2256. QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT);
  2257. /* RU offset and RU */
  2258. he_data2 |= QDF_MON_STATUS_RU_ALLOCATION_OFFSET_KNOWN;
  2259. he_data2 |= (get_ru_offset_from_start_index(ru_size,
  2260. ru_start_index) <<
  2261. QDF_MON_STATUS_RU_ALLOCATION_SHIFT);
  2262. /* Data BW and RU allocation */
  2263. if (ru_size < HAL_MAX_RU_INDEX) {
  2264. /* update bandwidth if it is full bandwidth */
  2265. he_data1 |= QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN;
  2266. he_data5 = (he_data5 & 0xFFF0) | (4 + ru_size);
  2267. }
  2268. he_data6 |= (nss & 0xF);
  2269. TXMON_HAL_USER(ppdu_info, user_id, mcs) = mcs;
  2270. /* update stack variable to ppdu_info */
  2271. TXMON_HAL_USER(ppdu_info, user_id, he_data1) = he_data1;
  2272. TXMON_HAL_USER(ppdu_info, user_id, he_data2) = he_data2;
  2273. TXMON_HAL_USER(ppdu_info, user_id, he_data3) = he_data3;
  2274. TXMON_HAL_USER(ppdu_info, user_id, he_data5) = he_data5;
  2275. TXMON_HAL_USER(ppdu_info, user_id, he_data6) = he_data6;
  2276. SHOW_DEFINED(WIFIMACTX_USER_DESC_PER_USER_E);
  2277. break;
  2278. }
  2279. case WIFIMACTX_USER_DESC_COMMON_E:
  2280. {
  2281. uint16_t he_mu_flag_1 = 0;
  2282. uint16_t he_mu_flag_2 = 0;
  2283. uint16_t ru_channel_1[4] = {0};
  2284. uint16_t ru_channel_2[4] = {0};
  2285. uint16_t num_users = 0;
  2286. uint8_t doppler;
  2287. uint8_t ltf_size;
  2288. uint8_t num_ltf_symbols;
  2289. uint8_t pkt_extn_pe;
  2290. uint8_t a_factor;
  2291. uint8_t center_ru_0;
  2292. uint8_t center_ru_1;
  2293. uint8_t i = 0;
  2294. num_users = TXMON_HAL(ppdu_info, num_users);
  2295. doppler = HAL_TX_DESC_GET_64(tx_tlv,
  2296. MACTX_USER_DESC_COMMON,
  2297. DOPPLER_INDICATION);
  2298. ltf_size = HAL_TX_DESC_GET_64(tx_tlv,
  2299. MACTX_USER_DESC_COMMON,
  2300. LTF_SIZE);
  2301. num_ltf_symbols = HAL_TX_DESC_GET_64(tx_tlv,
  2302. MACTX_USER_DESC_COMMON,
  2303. NUM_DATA_SYMBOLS);
  2304. pkt_extn_pe = HAL_TX_DESC_GET_64(tx_tlv,
  2305. MACTX_USER_DESC_COMMON,
  2306. PACKET_EXTENSION_PE_DISAMBIGUITY);
  2307. a_factor = HAL_TX_DESC_GET_64(tx_tlv,
  2308. MACTX_USER_DESC_COMMON,
  2309. PACKET_EXTENSION_A_FACTOR);
  2310. center_ru_0 = HAL_TX_DESC_GET_64(tx_tlv,
  2311. MACTX_USER_DESC_COMMON,
  2312. CENTER_RU_0);
  2313. center_ru_1 = HAL_TX_DESC_GET_64(tx_tlv,
  2314. MACTX_USER_DESC_COMMON,
  2315. CENTER_RU_1);
  2316. ru_channel_1[0] = HAL_TX_DESC_GET_64(tx_tlv,
  2317. MACTX_USER_DESC_COMMON,
  2318. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND0_0);
  2319. ru_channel_1[1] = HAL_TX_DESC_GET_64(tx_tlv,
  2320. MACTX_USER_DESC_COMMON,
  2321. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND0_1);
  2322. ru_channel_1[2] = HAL_TX_DESC_GET_64(tx_tlv,
  2323. MACTX_USER_DESC_COMMON,
  2324. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND0_2);
  2325. ru_channel_1[3] = HAL_TX_DESC_GET_64(tx_tlv,
  2326. MACTX_USER_DESC_COMMON,
  2327. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND0_3);
  2328. ru_channel_2[0] = HAL_TX_DESC_GET_64(tx_tlv,
  2329. MACTX_USER_DESC_COMMON,
  2330. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND1_0);
  2331. ru_channel_2[1] = HAL_TX_DESC_GET_64(tx_tlv,
  2332. MACTX_USER_DESC_COMMON,
  2333. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND1_1);
  2334. ru_channel_2[2] = HAL_TX_DESC_GET_64(tx_tlv,
  2335. MACTX_USER_DESC_COMMON,
  2336. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND1_2);
  2337. ru_channel_2[3] = HAL_TX_DESC_GET_64(tx_tlv,
  2338. MACTX_USER_DESC_COMMON,
  2339. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND1_3);
  2340. /* HE data 1 */
  2341. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  2342. QDF_MON_STATUS_HE_DOPPLER_KNOWN;
  2343. /* HE data 2 */
  2344. TXMON_HAL_USER(ppdu_info, user_id, he_data2) |=
  2345. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  2346. QDF_MON_STATUS_LTF_SYMBOLS_KNOWN;
  2347. /* HE data 5 */
  2348. TXMON_HAL_USER(ppdu_info, user_id, he_data5) |=
  2349. (pkt_extn_pe <<
  2350. QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT) |
  2351. (a_factor << QDF_MON_STATUS_PRE_FEC_PAD_SHIFT) |
  2352. ((1 + ltf_size) <<
  2353. QDF_MON_STATUS_HE_LTF_SIZE_SHIFT) |
  2354. (num_ltf_symbols <<
  2355. QDF_MON_STATUS_HE_LTF_SYM_SHIFT);
  2356. /* HE data 6 */
  2357. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |=
  2358. (doppler << QDF_MON_STATUS_DOPPLER_SHIFT);
  2359. /* number of symbol */
  2360. he_mu_flag_1 |=
  2361. (QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN |
  2362. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN |
  2363. ((center_ru_0 <<
  2364. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_SHIFT) &
  2365. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_VALUE));
  2366. he_mu_flag_2 |= ((center_ru_1 <<
  2367. QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_SHIFT) &
  2368. QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_VALUE);
  2369. TXMON_HAL_STATUS(ppdu_info,
  2370. he_mu_flags) = IS_MULTI_USERS(num_users);
  2371. for (i = 0; i < num_users; i++) {
  2372. TXMON_HAL_USER(ppdu_info, i, he_flags1) |= he_mu_flag_1;
  2373. TXMON_HAL_USER(ppdu_info, i, he_flags2) |= he_mu_flag_2;
  2374. /* channel 1 */
  2375. TXMON_HAL_USER(ppdu_info, i,
  2376. he_RU[0]) = ru_channel_1[0];
  2377. TXMON_HAL_USER(ppdu_info, i,
  2378. he_RU[1]) = ru_channel_1[1];
  2379. TXMON_HAL_USER(ppdu_info, i,
  2380. he_RU[2]) = ru_channel_1[2];
  2381. TXMON_HAL_USER(ppdu_info, i,
  2382. he_RU[3]) = ru_channel_1[3];
  2383. /* channel 2 */
  2384. TXMON_HAL_USER(ppdu_info, i,
  2385. he_RU[4]) = ru_channel_2[0];
  2386. TXMON_HAL_USER(ppdu_info, i,
  2387. he_RU[5]) = ru_channel_2[1];
  2388. TXMON_HAL_USER(ppdu_info, i,
  2389. he_RU[6]) = ru_channel_2[2];
  2390. TXMON_HAL_USER(ppdu_info, i,
  2391. he_RU[7]) = ru_channel_2[3];
  2392. }
  2393. /* channel 1 */
  2394. TXMON_HAL_STATUS(ppdu_info, he_RU[0]) = ru_channel_1[0];
  2395. TXMON_HAL_STATUS(ppdu_info, he_RU[1]) = ru_channel_1[1];
  2396. TXMON_HAL_STATUS(ppdu_info, he_RU[2]) = ru_channel_1[2];
  2397. TXMON_HAL_STATUS(ppdu_info, he_RU[3]) = ru_channel_1[3];
  2398. /* channel 2 */
  2399. TXMON_HAL_STATUS(ppdu_info, he_RU[4]) = ru_channel_2[0];
  2400. TXMON_HAL_STATUS(ppdu_info, he_RU[5]) = ru_channel_2[1];
  2401. TXMON_HAL_STATUS(ppdu_info, he_RU[6]) = ru_channel_2[2];
  2402. TXMON_HAL_STATUS(ppdu_info, he_RU[7]) = ru_channel_2[3];
  2403. /* copy per user info to all user */
  2404. SHOW_DEFINED(WIFIMACTX_USER_DESC_COMMON_E);
  2405. break;
  2406. }
  2407. case WIFIMACTX_PHY_DESC_E:
  2408. {
  2409. /* pkt_type - preamble type */
  2410. uint32_t pkt_type = 0;
  2411. uint8_t bandwidth = 0;
  2412. uint8_t is_stbc = 0;
  2413. uint8_t is_triggered = 0;
  2414. uint8_t gi = 0;
  2415. uint8_t he_ppdu_subtype = 0;
  2416. uint32_t ltf_size = 0;
  2417. uint32_t he_data1 = 0;
  2418. uint32_t he_data2 = 0;
  2419. uint32_t he_data3 = 0;
  2420. uint32_t he_data5 = 0;
  2421. uint16_t he_mu_flag_1 = 0;
  2422. uint16_t he_mu_flag_2 = 0;
  2423. uint16_t num_users = 0;
  2424. uint8_t i = 0;
  2425. status = HAL_MON_MACTX_PHY_DESC;
  2426. num_users = TXMON_HAL(ppdu_info, num_users);
  2427. pkt_type = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, PKT_TYPE);
  2428. is_stbc = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, STBC);
  2429. is_triggered = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2430. TRIGGERED);
  2431. if (!is_triggered) {
  2432. bandwidth = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2433. BANDWIDTH);
  2434. } else {
  2435. /*
  2436. * is_triggered, bw is minimum of AP pkt bw
  2437. * or STA bw
  2438. */
  2439. bandwidth = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2440. AP_PKT_BW);
  2441. }
  2442. gi = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2443. CP_SETTING);
  2444. ltf_size = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, LTF_SIZE);
  2445. he_ppdu_subtype = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2446. HE_PPDU_SUBTYPE);
  2447. TXMON_HAL_STATUS(ppdu_info, preamble_type) = pkt_type;
  2448. TXMON_HAL_STATUS(ppdu_info, ltf_size) = ltf_size;
  2449. TXMON_HAL_STATUS(ppdu_info, is_stbc) = is_stbc;
  2450. TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
  2451. switch (ppdu_info->rx_status.preamble_type) {
  2452. case TXMON_PKT_TYPE_11N_MM:
  2453. TXMON_HAL_STATUS(ppdu_info, ht_flags) = 1;
  2454. TXMON_HAL_STATUS(ppdu_info,
  2455. rtap_flags) |= HT_SGI_PRESENT;
  2456. break;
  2457. case TXMON_PKT_TYPE_11AC:
  2458. TXMON_HAL_STATUS(ppdu_info, vht_flags) = 1;
  2459. break;
  2460. case TXMON_PKT_TYPE_11AX:
  2461. TXMON_HAL_STATUS(ppdu_info, he_flags) = 1;
  2462. break;
  2463. default:
  2464. break;
  2465. }
  2466. if (!TXMON_HAL_STATUS(ppdu_info, he_flags))
  2467. break;
  2468. /* update he flags */
  2469. /* PPDU FORMAT */
  2470. switch (he_ppdu_subtype) {
  2471. case TXMON_HE_SUBTYPE_SU:
  2472. TXMON_HAL_STATUS(ppdu_info, he_data1) |=
  2473. QDF_MON_STATUS_HE_SU_FORMAT_TYPE;
  2474. break;
  2475. case TXMON_HE_SUBTYPE_TRIG:
  2476. TXMON_HAL_STATUS(ppdu_info, he_data1) |=
  2477. QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
  2478. break;
  2479. case TXMON_HE_SUBTYPE_MU:
  2480. TXMON_HAL_STATUS(ppdu_info, he_data1) |=
  2481. QDF_MON_STATUS_HE_MU_FORMAT_TYPE;
  2482. break;
  2483. case TXMON_HE_SUBTYPE_EXT_SU:
  2484. TXMON_HAL_STATUS(ppdu_info, he_data1) |=
  2485. QDF_MON_STATUS_HE_EXT_SU_FORMAT_TYPE;
  2486. break;
  2487. };
  2488. /* STBC */
  2489. he_data1 |= QDF_MON_STATUS_HE_STBC_KNOWN;
  2490. he_data3 |= (is_stbc << QDF_MON_STATUS_STBC_SHIFT);
  2491. /* GI */
  2492. he_data2 |= QDF_MON_STATUS_HE_GI_KNOWN;
  2493. he_data5 |= (gi << QDF_MON_STATUS_GI_SHIFT);
  2494. /* Data BW and RU allocation */
  2495. he_data1 |= QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN;
  2496. he_data5 = (he_data5 & 0xFFF0) | bandwidth;
  2497. he_data2 |= QDF_MON_STATUS_LTF_SYMBOLS_KNOWN;
  2498. he_data5 |= ((1 + ltf_size) <<
  2499. QDF_MON_STATUS_HE_LTF_SIZE_SHIFT);
  2500. TXMON_HAL_STATUS(ppdu_info,
  2501. he_mu_flags) = IS_MULTI_USERS(num_users);
  2502. /* MAC TX PHY DESC is not a user tlv */
  2503. for (i = 0; i < num_users; i++) {
  2504. TXMON_HAL_USER(ppdu_info, i, he_data1) = he_data1;
  2505. TXMON_HAL_USER(ppdu_info, i, he_data2) = he_data2;
  2506. TXMON_HAL_USER(ppdu_info, i, he_data3) = he_data3;
  2507. TXMON_HAL_USER(ppdu_info, i, he_data5) = he_data5;
  2508. /* HE MU flags */
  2509. TXMON_HAL_USER(ppdu_info, i, he_flags1) |= he_mu_flag_1;
  2510. TXMON_HAL_USER(ppdu_info, i, he_flags2) |= he_mu_flag_2;
  2511. }
  2512. SHOW_DEFINED(WIFIMACTX_PHY_DESC_E);
  2513. break;
  2514. }
  2515. case WIFICOEX_RX_STATUS_E:
  2516. {
  2517. SHOW_DEFINED(WIFICOEX_RX_STATUS_E);
  2518. break;
  2519. }
  2520. case WIFIRX_PPDU_ACK_REPORT_E:
  2521. {
  2522. SHOW_DEFINED(WIFIRX_PPDU_ACK_REPORT_E);
  2523. break;
  2524. }
  2525. case WIFIRX_PPDU_NO_ACK_REPORT_E:
  2526. {
  2527. SHOW_DEFINED(WIFIRX_PPDU_NO_ACK_REPORT_E);
  2528. break;
  2529. }
  2530. case WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E:
  2531. {
  2532. SHOW_DEFINED(WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E);
  2533. break;
  2534. }
  2535. case WIFITXPCU_PHYTX_DEBUG32_E:
  2536. {
  2537. SHOW_DEFINED(WIFITXPCU_PHYTX_DEBUG32_E);
  2538. break;
  2539. }
  2540. case WIFITXPCU_PREAMBLE_DONE_E:
  2541. {
  2542. SHOW_DEFINED(WIFITXPCU_PREAMBLE_DONE_E);
  2543. break;
  2544. }
  2545. case WIFIRX_PHY_SLEEP_E:
  2546. {
  2547. SHOW_DEFINED(WIFIRX_PHY_SLEEP_E);
  2548. break;
  2549. }
  2550. case WIFIRX_FRAME_BITMAP_REQ_E:
  2551. {
  2552. SHOW_DEFINED(WIFIRX_FRAME_BITMAP_REQ_E);
  2553. break;
  2554. }
  2555. case WIFIRXPCU_TX_SETUP_CLEAR_E:
  2556. {
  2557. SHOW_DEFINED(WIFIRXPCU_TX_SETUP_CLEAR_E);
  2558. break;
  2559. }
  2560. case WIFIRX_TRIG_INFO_E:
  2561. {
  2562. SHOW_DEFINED(WIFIRX_TRIG_INFO_E);
  2563. break;
  2564. }
  2565. case WIFIEXPECTED_RESPONSE_E:
  2566. {
  2567. SHOW_DEFINED(WIFIEXPECTED_RESPONSE_E);
  2568. break;
  2569. }
  2570. case WIFITRIGGER_RESPONSE_TX_DONE_E:
  2571. {
  2572. SHOW_DEFINED(WIFITRIGGER_RESPONSE_TX_DONE_E);
  2573. break;
  2574. }
  2575. case WIFIFW2SW_MON_E:
  2576. {
  2577. SHOW_DEFINED(WIFIFW2SW_MON_E);
  2578. break;
  2579. }
  2580. }
  2581. return status;
  2582. }
  2583. #endif /* QCA_MONITOR_2_0_SUPPORT */
  2584. #ifdef REO_SHARED_QREF_TABLE_EN
  2585. static void hal_reo_shared_qaddr_cache_clear_be(hal_soc_handle_t hal_soc_hdl)
  2586. {
  2587. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2588. uint32_t reg_val = 0;
  2589. /* Set Qdesc clear bit to erase REO internal storage for Qdesc pointers
  2590. * of 37 peer/tids
  2591. */
  2592. reg_val = HAL_REG_READ(hal, HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE));
  2593. reg_val |= HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1);
  2594. HAL_REG_WRITE(hal,
  2595. HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
  2596. reg_val);
  2597. /* Clear Qdesc clear bit to erase REO internal storage for Qdesc pointers
  2598. * of 37 peer/tids
  2599. */
  2600. reg_val &= ~(HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1));
  2601. HAL_REG_WRITE(hal,
  2602. HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
  2603. reg_val);
  2604. hal_verbose_debug("hal_soc: %pK :Setting CLEAR_DESC_ARRAY field of"
  2605. "WCSS_UMAC_REO_R0_QDESC_ADDR_READ and resetting back"
  2606. "to erase stale entries in reo storage: regval:%x", hal, reg_val);
  2607. }
  2608. /* hal_reo_shared_qaddr_write(): Write REO tid queue addr
  2609. * LUT shared by SW and HW at the index given by peer id
  2610. * and tid.
  2611. *
  2612. * @hal_soc: hal soc pointer
  2613. * @reo_qref_addr: pointer to index pointed to be peer_id
  2614. * and tid
  2615. * @tid: tid queue number
  2616. * @hw_qdesc_paddr: reo queue addr
  2617. */
  2618. static void hal_reo_shared_qaddr_write_be(hal_soc_handle_t hal_soc_hdl,
  2619. uint16_t peer_id,
  2620. int tid,
  2621. qdf_dma_addr_t hw_qdesc_paddr)
  2622. {
  2623. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2624. struct rx_reo_queue_reference *reo_qref;
  2625. uint32_t peer_tid_idx;
  2626. /* Plug hw_desc_addr in Host reo queue reference table */
  2627. if (HAL_PEER_ID_IS_MLO(peer_id)) {
  2628. peer_tid_idx = ((peer_id - HAL_ML_PEER_ID_START) *
  2629. DP_MAX_TIDS) + tid;
  2630. reo_qref = (struct rx_reo_queue_reference *)
  2631. &hal->reo_qref.mlo_reo_qref_table_vaddr[peer_tid_idx];
  2632. } else {
  2633. peer_tid_idx = (peer_id * DP_MAX_TIDS) + tid;
  2634. reo_qref = (struct rx_reo_queue_reference *)
  2635. &hal->reo_qref.non_mlo_reo_qref_table_vaddr[peer_tid_idx];
  2636. }
  2637. reo_qref->rx_reo_queue_desc_addr_31_0 =
  2638. hw_qdesc_paddr & 0xffffffff;
  2639. reo_qref->rx_reo_queue_desc_addr_39_32 =
  2640. (hw_qdesc_paddr & 0xff00000000) >> 32;
  2641. if (hw_qdesc_paddr != 0)
  2642. reo_qref->receive_queue_number = tid;
  2643. else
  2644. reo_qref->receive_queue_number = 0;
  2645. hal_reo_shared_qaddr_cache_clear_be(hal_soc_hdl);
  2646. hal_verbose_debug("hw_qdesc_paddr: %pK, tid: %d, reo_qref:%pK,"
  2647. "rx_reo_queue_desc_addr_31_0: %x,"
  2648. "rx_reo_queue_desc_addr_39_32: %x",
  2649. (void *)hw_qdesc_paddr, tid, reo_qref,
  2650. reo_qref->rx_reo_queue_desc_addr_31_0,
  2651. reo_qref->rx_reo_queue_desc_addr_39_32);
  2652. }
  2653. /**
  2654. * hal_reo_shared_qaddr_setup() - Allocate MLO and Non MLO reo queue
  2655. * reference table shared between SW and HW and initialize in Qdesc Base0
  2656. * base1 registers provided by HW.
  2657. *
  2658. * @hal_soc: HAL Soc handle
  2659. *
  2660. * Return: None
  2661. */
  2662. static void hal_reo_shared_qaddr_setup_be(hal_soc_handle_t hal_soc_hdl)
  2663. {
  2664. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2665. hal->reo_qref.reo_qref_table_en = 1;
  2666. hal->reo_qref.mlo_reo_qref_table_vaddr =
  2667. (uint64_t *)qdf_mem_alloc_consistent(
  2668. hal->qdf_dev, hal->qdf_dev->dev,
  2669. REO_QUEUE_REF_ML_TABLE_SIZE,
  2670. &hal->reo_qref.mlo_reo_qref_table_paddr);
  2671. hal->reo_qref.non_mlo_reo_qref_table_vaddr =
  2672. (uint64_t *)qdf_mem_alloc_consistent(
  2673. hal->qdf_dev, hal->qdf_dev->dev,
  2674. REO_QUEUE_REF_NON_ML_TABLE_SIZE,
  2675. &hal->reo_qref.non_mlo_reo_qref_table_paddr);
  2676. hal_verbose_debug("MLO table start paddr:%pK,"
  2677. "Non-MLO table start paddr:%pK,"
  2678. "MLO table start vaddr: %pK,"
  2679. "Non MLO table start vaddr: %pK",
  2680. (void *)hal->reo_qref.mlo_reo_qref_table_paddr,
  2681. (void *)hal->reo_qref.non_mlo_reo_qref_table_paddr,
  2682. hal->reo_qref.mlo_reo_qref_table_vaddr,
  2683. hal->reo_qref.non_mlo_reo_qref_table_vaddr);
  2684. }
  2685. /**
  2686. * hal_reo_shared_qaddr_init() - Zero out REO qref LUT and
  2687. * write start addr of MLO and Non MLO table in HW
  2688. *
  2689. * @hal_soc: HAL Soc handle
  2690. * @qref_reset: reset qref LUT
  2691. *
  2692. * Return: None
  2693. */
  2694. static void hal_reo_shared_qaddr_init_be(hal_soc_handle_t hal_soc_hdl,
  2695. int qref_reset)
  2696. {
  2697. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2698. if (qref_reset) {
  2699. qdf_mem_zero(hal->reo_qref.mlo_reo_qref_table_vaddr,
  2700. REO_QUEUE_REF_ML_TABLE_SIZE);
  2701. qdf_mem_zero(hal->reo_qref.non_mlo_reo_qref_table_vaddr,
  2702. REO_QUEUE_REF_NON_ML_TABLE_SIZE);
  2703. }
  2704. /* LUT_BASE0 and BASE1 registers expect upper 32bits of LUT base address
  2705. * and lower 8 bits to be 0. Shift the physical address by 8 to plug
  2706. * upper 32bits only
  2707. */
  2708. HAL_REG_WRITE(hal,
  2709. HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
  2710. hal->reo_qref.non_mlo_reo_qref_table_paddr >> 8);
  2711. HAL_REG_WRITE(hal,
  2712. HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
  2713. hal->reo_qref.mlo_reo_qref_table_paddr >> 8);
  2714. HAL_REG_WRITE(hal,
  2715. HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
  2716. HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, LUT_FEATURE_ENABLE,
  2717. 1));
  2718. HAL_REG_WRITE(hal,
  2719. HWIO_REO_R0_QDESC_MAX_SW_PEER_ID_ADDR(REO_REG_REG_BASE),
  2720. HAL_MS(HWIO_REO_R0_QDESC, MAX_SW_PEER_ID_MAX_SUPPORTED,
  2721. 0x1fff));
  2722. }
  2723. /**
  2724. * hal_reo_shared_qaddr_detach() - Free MLO and Non MLO reo queue
  2725. * reference table shared between SW and HW
  2726. *
  2727. * @hal_soc: HAL Soc handle
  2728. *
  2729. * Return: None
  2730. */
  2731. static void hal_reo_shared_qaddr_detach_be(hal_soc_handle_t hal_soc_hdl)
  2732. {
  2733. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2734. HAL_REG_WRITE(hal,
  2735. HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
  2736. 0);
  2737. HAL_REG_WRITE(hal,
  2738. HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
  2739. 0);
  2740. qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
  2741. REO_QUEUE_REF_ML_TABLE_SIZE,
  2742. hal->reo_qref.mlo_reo_qref_table_vaddr,
  2743. hal->reo_qref.mlo_reo_qref_table_paddr, 0);
  2744. qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
  2745. REO_QUEUE_REF_NON_ML_TABLE_SIZE,
  2746. hal->reo_qref.non_mlo_reo_qref_table_vaddr,
  2747. hal->reo_qref.non_mlo_reo_qref_table_paddr, 0);
  2748. }
  2749. #endif
  2750. /**
  2751. * hal_tx_vdev_mismatch_routing_set - set vdev mismatch exception routing
  2752. * @hal_soc: HAL SoC context
  2753. * @config: HAL_TX_VDEV_MISMATCH_TQM_NOTIFY - route via TQM
  2754. * HAL_TX_VDEV_MISMATCH_FW_NOTIFY - route via FW
  2755. *
  2756. * Return: void
  2757. */
  2758. #ifdef HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_BMSK
  2759. static inline void
  2760. hal_tx_vdev_mismatch_routing_set_generic_be(hal_soc_handle_t hal_soc_hdl,
  2761. enum hal_tx_vdev_mismatch_notify
  2762. config)
  2763. {
  2764. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2765. uint32_t reg_addr, reg_val = 0;
  2766. uint32_t val = 0;
  2767. reg_addr = HWIO_TCL_R0_CMN_CONFIG_ADDR(MAC_TCL_REG_REG_BASE);
  2768. val = HAL_REG_READ(hal_soc, reg_addr);
  2769. /* reset the corresponding bits in register */
  2770. val &= (~(HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_BMSK));
  2771. /* set config value */
  2772. reg_val = val | (config <<
  2773. HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_SHFT);
  2774. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  2775. }
  2776. #else
  2777. static inline void
  2778. hal_tx_vdev_mismatch_routing_set_generic_be(hal_soc_handle_t hal_soc_hdl,
  2779. enum hal_tx_vdev_mismatch_notify
  2780. config)
  2781. {
  2782. }
  2783. #endif
  2784. /**
  2785. * hal_tx_mcast_mlo_reinject_routing_set - set MLO multicast reinject routing
  2786. * @hal_soc: HAL SoC context
  2787. * @config: HAL_TX_MCAST_MLO_REINJECT_FW_NOTIFY - route via FW
  2788. * HAL_TX_MCAST_MLO_REINJECT_TQM_NOTIFY - route via TQM
  2789. *
  2790. * Return: void
  2791. */
  2792. #if defined(HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_BMSK) && \
  2793. defined(WLAN_MCAST_MLO)
  2794. static inline void
  2795. hal_tx_mcast_mlo_reinject_routing_set_generic_be(
  2796. hal_soc_handle_t hal_soc_hdl,
  2797. enum hal_tx_mcast_mlo_reinject_notify config)
  2798. {
  2799. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2800. uint32_t reg_addr, reg_val = 0;
  2801. uint32_t val = 0;
  2802. reg_addr = HWIO_TCL_R0_CMN_CONFIG_ADDR(MAC_TCL_REG_REG_BASE);
  2803. val = HAL_REG_READ(hal_soc, reg_addr);
  2804. /* reset the corresponding bits in register */
  2805. val &= (~(HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_BMSK));
  2806. /* set config value */
  2807. reg_val = val | (config << HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_SHFT);
  2808. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  2809. }
  2810. #else
  2811. static inline void
  2812. hal_tx_mcast_mlo_reinject_routing_set_generic_be(
  2813. hal_soc_handle_t hal_soc_hdl,
  2814. enum hal_tx_mcast_mlo_reinject_notify config)
  2815. {
  2816. }
  2817. #endif
  2818. /**
  2819. * hal_get_ba_aging_timeout_be - Get BA Aging timeout
  2820. *
  2821. * @hal_soc: Opaque HAL SOC handle
  2822. * @ac: Access category
  2823. * @value: window size to get
  2824. */
  2825. static inline
  2826. void hal_get_ba_aging_timeout_be_generic(hal_soc_handle_t hal_soc_hdl,
  2827. uint8_t ac, uint32_t *value)
  2828. {
  2829. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  2830. switch (ac) {
  2831. case WME_AC_BE:
  2832. *value = HAL_REG_READ(soc,
  2833. HWIO_REO_R0_AGING_THRESHOLD_IX_0_ADDR(
  2834. REO_REG_REG_BASE)) / 1000;
  2835. break;
  2836. case WME_AC_BK:
  2837. *value = HAL_REG_READ(soc,
  2838. HWIO_REO_R0_AGING_THRESHOLD_IX_1_ADDR(
  2839. REO_REG_REG_BASE)) / 1000;
  2840. break;
  2841. case WME_AC_VI:
  2842. *value = HAL_REG_READ(soc,
  2843. HWIO_REO_R0_AGING_THRESHOLD_IX_2_ADDR(
  2844. REO_REG_REG_BASE)) / 1000;
  2845. break;
  2846. case WME_AC_VO:
  2847. *value = HAL_REG_READ(soc,
  2848. HWIO_REO_R0_AGING_THRESHOLD_IX_3_ADDR(
  2849. REO_REG_REG_BASE)) / 1000;
  2850. break;
  2851. default:
  2852. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  2853. "Invalid AC: %d\n", ac);
  2854. }
  2855. }
  2856. /**
  2857. * hal_setup_link_idle_list_generic_be - Setup scattered idle list using the
  2858. * buffer list provided
  2859. *
  2860. * @hal_soc: Opaque HAL SOC handle
  2861. * @scatter_bufs_base_paddr: Array of physical base addresses
  2862. * @scatter_bufs_base_vaddr: Array of virtual base addresses
  2863. * @num_scatter_bufs: Number of scatter buffers in the above lists
  2864. * @scatter_buf_size: Size of each scatter buffer
  2865. * @last_buf_end_offset: Offset to the last entry
  2866. * @num_entries: Total entries of all scatter bufs
  2867. *
  2868. * Return: None
  2869. */
  2870. static inline void
  2871. hal_setup_link_idle_list_generic_be(struct hal_soc *soc,
  2872. qdf_dma_addr_t scatter_bufs_base_paddr[],
  2873. void *scatter_bufs_base_vaddr[],
  2874. uint32_t num_scatter_bufs,
  2875. uint32_t scatter_buf_size,
  2876. uint32_t last_buf_end_offset,
  2877. uint32_t num_entries)
  2878. {
  2879. int i;
  2880. uint32_t *prev_buf_link_ptr = NULL;
  2881. uint32_t reg_scatter_buf_size, reg_tot_scatter_buf_size;
  2882. uint32_t val;
  2883. /* Link the scatter buffers */
  2884. for (i = 0; i < num_scatter_bufs; i++) {
  2885. if (i > 0) {
  2886. prev_buf_link_ptr[0] =
  2887. scatter_bufs_base_paddr[i] & 0xffffffff;
  2888. prev_buf_link_ptr[1] = HAL_SM(
  2889. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
  2890. BASE_ADDRESS_39_32,
  2891. ((uint64_t)(scatter_bufs_base_paddr[i])
  2892. >> 32)) | HAL_SM(
  2893. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
  2894. ADDRESS_MATCH_TAG,
  2895. ADDRESS_MATCH_TAG_VAL);
  2896. }
  2897. prev_buf_link_ptr = (uint32_t *)(scatter_bufs_base_vaddr[i] +
  2898. scatter_buf_size - WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE);
  2899. }
  2900. /* TBD: Register programming partly based on MLD & the rest based on
  2901. * inputs from HW team. Not complete yet.
  2902. */
  2903. reg_scatter_buf_size = (scatter_buf_size -
  2904. WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE) / 64;
  2905. reg_tot_scatter_buf_size = ((scatter_buf_size -
  2906. WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE) * num_scatter_bufs) / 64;
  2907. HAL_REG_WRITE(soc,
  2908. HWIO_WBM_R0_IDLE_LIST_CONTROL_ADDR(
  2909. WBM_REG_REG_BASE),
  2910. HAL_SM(HWIO_WBM_R0_IDLE_LIST_CONTROL, SCATTER_BUFFER_SIZE,
  2911. reg_scatter_buf_size) |
  2912. HAL_SM(HWIO_WBM_R0_IDLE_LIST_CONTROL, LINK_DESC_IDLE_LIST_MODE,
  2913. 0x1));
  2914. HAL_REG_WRITE(soc,
  2915. HWIO_WBM_R0_IDLE_LIST_SIZE_ADDR(
  2916. WBM_REG_REG_BASE),
  2917. HAL_SM(HWIO_WBM_R0_IDLE_LIST_SIZE,
  2918. SCATTER_RING_SIZE_OF_IDLE_LINK_DESC_LIST,
  2919. reg_tot_scatter_buf_size));
  2920. HAL_REG_WRITE(soc,
  2921. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_LSB_ADDR(
  2922. WBM_REG_REG_BASE),
  2923. scatter_bufs_base_paddr[0] & 0xffffffff);
  2924. HAL_REG_WRITE(soc,
  2925. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB_ADDR(
  2926. WBM_REG_REG_BASE),
  2927. ((uint64_t)(scatter_bufs_base_paddr[0]) >> 32) &
  2928. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB_BASE_ADDRESS_39_32_BMSK);
  2929. HAL_REG_WRITE(soc,
  2930. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB_ADDR(
  2931. WBM_REG_REG_BASE),
  2932. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
  2933. BASE_ADDRESS_39_32, ((uint64_t)(scatter_bufs_base_paddr[0])
  2934. >> 32)) |
  2935. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
  2936. ADDRESS_MATCH_TAG, ADDRESS_MATCH_TAG_VAL));
  2937. /* ADDRESS_MATCH_TAG field in the above register is expected to match
  2938. * with the upper bits of link pointer. The above write sets this field
  2939. * to zero and we are also setting the upper bits of link pointers to
  2940. * zero while setting up the link list of scatter buffers above
  2941. */
  2942. /* Setup head and tail pointers for the idle list */
  2943. HAL_REG_WRITE(soc,
  2944. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX0_ADDR(
  2945. WBM_REG_REG_BASE),
  2946. scatter_bufs_base_paddr[num_scatter_bufs - 1] & 0xffffffff);
  2947. HAL_REG_WRITE(soc,
  2948. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX1_ADDR(
  2949. WBM_REG_REG_BASE),
  2950. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX1,
  2951. BUFFER_ADDRESS_39_32,
  2952. ((uint64_t)(scatter_bufs_base_paddr[num_scatter_bufs - 1])
  2953. >> 32)) |
  2954. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX1,
  2955. HEAD_POINTER_OFFSET, last_buf_end_offset >> 2));
  2956. HAL_REG_WRITE(soc,
  2957. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX0_ADDR(
  2958. WBM_REG_REG_BASE),
  2959. scatter_bufs_base_paddr[0] & 0xffffffff);
  2960. HAL_REG_WRITE(soc,
  2961. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX0_ADDR(
  2962. WBM_REG_REG_BASE),
  2963. scatter_bufs_base_paddr[0] & 0xffffffff);
  2964. HAL_REG_WRITE(soc,
  2965. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX1_ADDR(
  2966. WBM_REG_REG_BASE),
  2967. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX1,
  2968. BUFFER_ADDRESS_39_32,
  2969. ((uint64_t)(scatter_bufs_base_paddr[0]) >>
  2970. 32)) | HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX1,
  2971. TAIL_POINTER_OFFSET, 0));
  2972. HAL_REG_WRITE(soc,
  2973. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HP_ADDR(
  2974. WBM_REG_REG_BASE),
  2975. 2 * num_entries);
  2976. /* Set RING_ID_DISABLE */
  2977. val = HAL_SM(HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC, RING_ID_DISABLE, 1);
  2978. /*
  2979. * SRNG_ENABLE bit is not available in HWK v1 (QCA8074v1). Hence
  2980. * check the presence of the bit before toggling it.
  2981. */
  2982. #ifdef HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC_SRNG_ENABLE_BMSK
  2983. val |= HAL_SM(HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC, SRNG_ENABLE, 1);
  2984. #endif
  2985. HAL_REG_WRITE(soc,
  2986. HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC_ADDR(WBM_REG_REG_BASE),
  2987. val);
  2988. }
  2989. #ifdef DP_HW_COOKIE_CONVERT_EXCEPTION
  2990. #define HAL_WBM_MISC_CONTROL_SPARE_CONTROL_FIELD_BIT15 0x8000
  2991. #endif
  2992. /**
  2993. * hal_cookie_conversion_reg_cfg_generic_be() - set cookie conversion relevant register
  2994. * for REO/WBM
  2995. * @soc: HAL soc handle
  2996. * @cc_cfg: structure pointer for HW cookie conversion configuration
  2997. *
  2998. * Return: None
  2999. */
  3000. static inline
  3001. void hal_cookie_conversion_reg_cfg_generic_be(hal_soc_handle_t hal_soc_hdl,
  3002. struct hal_hw_cc_config *cc_cfg)
  3003. {
  3004. uint32_t reg_addr, reg_val = 0;
  3005. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  3006. /* REO CFG */
  3007. reg_addr = HWIO_REO_R0_SW_COOKIE_CFG0_ADDR(REO_REG_REG_BASE);
  3008. reg_val = cc_cfg->lut_base_addr_31_0;
  3009. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3010. reg_addr = HWIO_REO_R0_SW_COOKIE_CFG1_ADDR(REO_REG_REG_BASE);
  3011. reg_val = 0;
  3012. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3013. SW_COOKIE_CONVERT_GLOBAL_ENABLE,
  3014. cc_cfg->cc_global_en);
  3015. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3016. SW_COOKIE_CONVERT_ENABLE,
  3017. cc_cfg->cc_global_en);
  3018. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3019. PAGE_ALIGNMENT,
  3020. cc_cfg->page_4k_align);
  3021. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3022. COOKIE_OFFSET_MSB,
  3023. cc_cfg->cookie_offset_msb);
  3024. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3025. COOKIE_PAGE_MSB,
  3026. cc_cfg->cookie_page_msb);
  3027. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3028. CMEM_LUT_BASE_ADDR_39_32,
  3029. cc_cfg->lut_base_addr_39_32);
  3030. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3031. /* WBM CFG */
  3032. reg_addr = HWIO_WBM_R0_SW_COOKIE_CFG0_ADDR(WBM_REG_REG_BASE);
  3033. reg_val = cc_cfg->lut_base_addr_31_0;
  3034. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3035. reg_addr = HWIO_WBM_R0_SW_COOKIE_CFG1_ADDR(WBM_REG_REG_BASE);
  3036. reg_val = 0;
  3037. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
  3038. PAGE_ALIGNMENT,
  3039. cc_cfg->page_4k_align);
  3040. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
  3041. COOKIE_OFFSET_MSB,
  3042. cc_cfg->cookie_offset_msb);
  3043. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
  3044. COOKIE_PAGE_MSB,
  3045. cc_cfg->cookie_page_msb);
  3046. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
  3047. CMEM_LUT_BASE_ADDR_39_32,
  3048. cc_cfg->lut_base_addr_39_32);
  3049. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3050. /*
  3051. * WCSS_UMAC_WBM_R0_SW_COOKIE_CONVERT_CFG default value is 0x1FE,
  3052. */
  3053. reg_addr = HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG_ADDR(WBM_REG_REG_BASE);
  3054. reg_val = 0;
  3055. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3056. WBM_COOKIE_CONV_GLOBAL_ENABLE,
  3057. cc_cfg->cc_global_en);
  3058. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3059. WBM2SW6_COOKIE_CONVERSION_EN,
  3060. cc_cfg->wbm2sw6_cc_en);
  3061. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3062. WBM2SW5_COOKIE_CONVERSION_EN,
  3063. cc_cfg->wbm2sw5_cc_en);
  3064. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3065. WBM2SW4_COOKIE_CONVERSION_EN,
  3066. cc_cfg->wbm2sw4_cc_en);
  3067. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3068. WBM2SW3_COOKIE_CONVERSION_EN,
  3069. cc_cfg->wbm2sw3_cc_en);
  3070. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3071. WBM2SW2_COOKIE_CONVERSION_EN,
  3072. cc_cfg->wbm2sw2_cc_en);
  3073. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3074. WBM2SW1_COOKIE_CONVERSION_EN,
  3075. cc_cfg->wbm2sw1_cc_en);
  3076. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3077. WBM2SW0_COOKIE_CONVERSION_EN,
  3078. cc_cfg->wbm2sw0_cc_en);
  3079. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3080. WBM2FW_COOKIE_CONVERSION_EN,
  3081. cc_cfg->wbm2fw_cc_en);
  3082. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3083. #ifdef HWIO_WBM_R0_WBM_CFG_2_COOKIE_DEBUG_SEL_BMSK
  3084. reg_addr = HWIO_WBM_R0_WBM_CFG_2_ADDR(WBM_REG_REG_BASE);
  3085. reg_val = 0;
  3086. reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
  3087. COOKIE_DEBUG_SEL,
  3088. cc_cfg->cc_global_en);
  3089. reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
  3090. COOKIE_CONV_INDICATION_EN,
  3091. cc_cfg->cc_global_en);
  3092. reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
  3093. ERROR_PATH_COOKIE_CONV_EN,
  3094. cc_cfg->error_path_cookie_conv_en);
  3095. reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
  3096. RELEASE_PATH_COOKIE_CONV_EN,
  3097. cc_cfg->release_path_cookie_conv_en);
  3098. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3099. #endif
  3100. #ifdef DP_HW_COOKIE_CONVERT_EXCEPTION
  3101. /*
  3102. * To enable indication for HW cookie conversion done or not for
  3103. * WBM, WCSS_UMAC_WBM_R0_MISC_CONTROL spare_control field 15th
  3104. * bit spare_control[15] should be set.
  3105. */
  3106. reg_addr = HWIO_WBM_R0_MISC_CONTROL_ADDR(WBM_REG_REG_BASE);
  3107. reg_val = HAL_REG_READ(soc, reg_addr);
  3108. reg_val |= HAL_SM(HWIO_WCSS_UMAC_WBM_R0_MISC_CONTROL,
  3109. SPARE_CONTROL,
  3110. HAL_WBM_MISC_CONTROL_SPARE_CONTROL_FIELD_BIT15);
  3111. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3112. #endif
  3113. }
  3114. /**
  3115. * hal_set_ba_aging_timeout_be - Set BA Aging timeout
  3116. *
  3117. * @hal_soc: Opaque HAL SOC handle
  3118. * @ac: Access category
  3119. * ac: 0 - Background, 1 - Best Effort, 2 - Video, 3 - Voice
  3120. * @value: Input value to set
  3121. */
  3122. static inline
  3123. void hal_set_ba_aging_timeout_be_generic(hal_soc_handle_t hal_soc_hdl,
  3124. uint8_t ac, uint32_t value)
  3125. {
  3126. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  3127. switch (ac) {
  3128. case WME_AC_BE:
  3129. HAL_REG_WRITE(soc,
  3130. HWIO_REO_R0_AGING_THRESHOLD_IX_0_ADDR(
  3131. REO_REG_REG_BASE),
  3132. value * 1000);
  3133. break;
  3134. case WME_AC_BK:
  3135. HAL_REG_WRITE(soc,
  3136. HWIO_REO_R0_AGING_THRESHOLD_IX_1_ADDR(
  3137. REO_REG_REG_BASE),
  3138. value * 1000);
  3139. break;
  3140. case WME_AC_VI:
  3141. HAL_REG_WRITE(soc,
  3142. HWIO_REO_R0_AGING_THRESHOLD_IX_2_ADDR(
  3143. REO_REG_REG_BASE),
  3144. value * 1000);
  3145. break;
  3146. case WME_AC_VO:
  3147. HAL_REG_WRITE(soc,
  3148. HWIO_REO_R0_AGING_THRESHOLD_IX_3_ADDR(
  3149. REO_REG_REG_BASE),
  3150. value * 1000);
  3151. break;
  3152. default:
  3153. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  3154. "Invalid AC: %d\n", ac);
  3155. }
  3156. }
  3157. /**
  3158. * hal_tx_populate_bank_register() - populate the bank register with
  3159. * the software configs.
  3160. * @soc: HAL soc handle
  3161. * @config: bank config
  3162. * @bank_id: bank id to be configured
  3163. *
  3164. * Returns: None
  3165. */
  3166. #ifdef HWIO_TCL_R0_SW_CONFIG_BANK_n_MCAST_PACKET_CTRL_SHFT
  3167. static inline void
  3168. hal_tx_populate_bank_register_be(hal_soc_handle_t hal_soc_hdl,
  3169. union hal_tx_bank_config *config,
  3170. uint8_t bank_id)
  3171. {
  3172. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  3173. uint32_t reg_addr, reg_val = 0;
  3174. reg_addr = HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDR(MAC_TCL_REG_REG_BASE,
  3175. bank_id);
  3176. reg_val |= (config->epd << HWIO_TCL_R0_SW_CONFIG_BANK_n_EPD_SHFT);
  3177. reg_val |= (config->encap_type <<
  3178. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCAP_TYPE_SHFT);
  3179. reg_val |= (config->encrypt_type <<
  3180. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCRYPT_TYPE_SHFT);
  3181. reg_val |= (config->src_buffer_swap <<
  3182. HWIO_TCL_R0_SW_CONFIG_BANK_n_SRC_BUFFER_SWAP_SHFT);
  3183. reg_val |= (config->link_meta_swap <<
  3184. HWIO_TCL_R0_SW_CONFIG_BANK_n_LINK_META_SWAP_SHFT);
  3185. reg_val |= (config->index_lookup_enable <<
  3186. HWIO_TCL_R0_SW_CONFIG_BANK_n_INDEX_LOOKUP_ENABLE_SHFT);
  3187. reg_val |= (config->addrx_en <<
  3188. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRX_EN_SHFT);
  3189. reg_val |= (config->addry_en <<
  3190. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRY_EN_SHFT);
  3191. reg_val |= (config->mesh_enable <<
  3192. HWIO_TCL_R0_SW_CONFIG_BANK_n_MESH_ENABLE_SHFT);
  3193. reg_val |= (config->vdev_id_check_en <<
  3194. HWIO_TCL_R0_SW_CONFIG_BANK_n_VDEV_ID_CHECK_EN_SHFT);
  3195. reg_val |= (config->pmac_id <<
  3196. HWIO_TCL_R0_SW_CONFIG_BANK_n_PMAC_ID_SHFT);
  3197. reg_val |= (config->mcast_pkt_ctrl <<
  3198. HWIO_TCL_R0_SW_CONFIG_BANK_n_MCAST_PACKET_CTRL_SHFT);
  3199. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  3200. }
  3201. #else
  3202. static inline void
  3203. hal_tx_populate_bank_register_be(hal_soc_handle_t hal_soc_hdl,
  3204. union hal_tx_bank_config *config,
  3205. uint8_t bank_id)
  3206. {
  3207. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  3208. uint32_t reg_addr, reg_val = 0;
  3209. reg_addr = HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDR(MAC_TCL_REG_REG_BASE,
  3210. bank_id);
  3211. reg_val |= (config->epd << HWIO_TCL_R0_SW_CONFIG_BANK_n_EPD_SHFT);
  3212. reg_val |= (config->encap_type <<
  3213. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCAP_TYPE_SHFT);
  3214. reg_val |= (config->encrypt_type <<
  3215. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCRYPT_TYPE_SHFT);
  3216. reg_val |= (config->src_buffer_swap <<
  3217. HWIO_TCL_R0_SW_CONFIG_BANK_n_SRC_BUFFER_SWAP_SHFT);
  3218. reg_val |= (config->link_meta_swap <<
  3219. HWIO_TCL_R0_SW_CONFIG_BANK_n_LINK_META_SWAP_SHFT);
  3220. reg_val |= (config->index_lookup_enable <<
  3221. HWIO_TCL_R0_SW_CONFIG_BANK_n_INDEX_LOOKUP_ENABLE_SHFT);
  3222. reg_val |= (config->addrx_en <<
  3223. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRX_EN_SHFT);
  3224. reg_val |= (config->addry_en <<
  3225. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRY_EN_SHFT);
  3226. reg_val |= (config->mesh_enable <<
  3227. HWIO_TCL_R0_SW_CONFIG_BANK_n_MESH_ENABLE_SHFT);
  3228. reg_val |= (config->vdev_id_check_en <<
  3229. HWIO_TCL_R0_SW_CONFIG_BANK_n_VDEV_ID_CHECK_EN_SHFT);
  3230. reg_val |= (config->pmac_id <<
  3231. HWIO_TCL_R0_SW_CONFIG_BANK_n_PMAC_ID_SHFT);
  3232. reg_val |= (config->dscp_tid_map_id <<
  3233. HWIO_TCL_R0_SW_CONFIG_BANK_n_DSCP_TID_TABLE_NUM_SHFT);
  3234. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  3235. }
  3236. #endif
  3237. #ifdef HWIO_TCL_R0_VDEV_MCAST_PACKET_CTRL_MAP_n_VAL_SHFT
  3238. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_REG_ID(vdev_id) (vdev_id >> 0x4)
  3239. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_INDEX_IN_REG(vdev_id) (vdev_id & 0xF)
  3240. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK 0x3
  3241. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT 0x2
  3242. /**
  3243. * hal_tx_vdev_mcast_ctrl_set - set mcast_ctrl value
  3244. * @hal_soc: HAL SoC context
  3245. * @mcast_ctrl_val: mcast ctrl value for this VAP
  3246. *
  3247. * Return: void
  3248. */
  3249. static inline void
  3250. hal_tx_vdev_mcast_ctrl_set_be(hal_soc_handle_t hal_soc_hdl,
  3251. uint8_t vdev_id, uint8_t mcast_ctrl_val)
  3252. {
  3253. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  3254. uint32_t reg_addr, reg_val = 0;
  3255. uint32_t val;
  3256. uint8_t reg_idx = HAL_TCL_VDEV_MCAST_PACKET_CTRL_REG_ID(vdev_id);
  3257. uint8_t index_in_reg =
  3258. HAL_TCL_VDEV_MCAST_PACKET_CTRL_INDEX_IN_REG(vdev_id);
  3259. reg_addr =
  3260. HWIO_TCL_R0_VDEV_MCAST_PACKET_CTRL_MAP_n_ADDR(MAC_TCL_REG_REG_BASE,
  3261. reg_idx);
  3262. val = HAL_REG_READ(hal_soc, reg_addr);
  3263. /* mask out other stored value */
  3264. val &= (~(HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK <<
  3265. (HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT * index_in_reg)));
  3266. reg_val = val |
  3267. ((HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK & mcast_ctrl_val) <<
  3268. (HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT * index_in_reg));
  3269. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  3270. }
  3271. #else
  3272. static inline void
  3273. hal_tx_vdev_mcast_ctrl_set_be(hal_soc_handle_t hal_soc_hdl,
  3274. uint8_t vdev_id, uint8_t mcast_ctrl_val)
  3275. {
  3276. }
  3277. #endif
  3278. #endif /* _HAL_BE_GENERIC_API_H_ */