hal_be_generic_api.h 117 KB

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