hal_be_generic_api.h 103 KB

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