hal_be_generic_api.h 117 KB

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