hal_be_api_mon.h 121 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899
  1. /*
  2. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #ifndef _HAL_BE_API_MON_H_
  18. #define _HAL_BE_API_MON_H_
  19. #include "hal_be_hw_headers.h"
  20. #if defined(WLAN_PKT_CAPTURE_TX_2_0) || \
  21. defined(WLAN_PKT_CAPTURE_RX_2_0)
  22. #include <mon_ingress_ring.h>
  23. #include <mon_destination_ring.h>
  24. #include <mon_drop.h>
  25. #endif
  26. #include <hal_be_hw_headers.h>
  27. #include "hal_api_mon.h"
  28. #include <hal_generic_api.h>
  29. #include <hal_generic_api.h>
  30. #include <hal_api_mon.h>
  31. #if defined(WLAN_PKT_CAPTURE_TX_2_0) || \
  32. defined(WLAN_PKT_CAPTURE_RX_2_0) || \
  33. defined(QCA_SINGLE_WIFI_3_0)
  34. #define HAL_MON_BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_OFFSET 0x00000000
  35. #define HAL_MON_BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_LSB 0
  36. #define HAL_MON_BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_MASK 0xffffffff
  37. #define HAL_MON_BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_OFFSET 0x00000004
  38. #define HAL_MON_BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_LSB 0
  39. #define HAL_MON_BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_MASK 0x000000ff
  40. #define HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_31_0_OFFSET 0x00000008
  41. #define HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_31_0_LSB 0
  42. #define HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_31_0_MSB 31
  43. #define HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_31_0_MASK 0xffffffff
  44. #define HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_63_32_OFFSET 0x0000000c
  45. #define HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_63_32_LSB 0
  46. #define HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_63_32_MSB 31
  47. #define HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_63_32_MASK 0xffffffff
  48. #define HAL_MON_PADDR_LO_SET(buff_addr_info, paddr_lo) \
  49. ((*(((unsigned int *) buff_addr_info) + \
  50. (HAL_MON_BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_OFFSET >> 2))) = \
  51. ((paddr_lo) << HAL_MON_BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_LSB) & \
  52. HAL_MON_BUFFER_ADDR_INFO_0_BUFFER_ADDR_31_0_MASK)
  53. #define HAL_MON_PADDR_HI_SET(buff_addr_info, paddr_hi) \
  54. ((*(((unsigned int *) buff_addr_info) + \
  55. (HAL_MON_BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_OFFSET >> 2))) = \
  56. ((paddr_hi) << HAL_MON_BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_LSB) & \
  57. HAL_MON_BUFFER_ADDR_INFO_1_BUFFER_ADDR_39_32_MASK)
  58. #define HAL_MON_VADDR_LO_SET(buff_addr_info, vaddr_lo) \
  59. ((*(((unsigned int *) buff_addr_info) + \
  60. (HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_31_0_OFFSET >> 2))) = \
  61. ((vaddr_lo) << HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_31_0_LSB) & \
  62. HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_31_0_MASK)
  63. #define HAL_MON_VADDR_HI_SET(buff_addr_info, vaddr_hi) \
  64. ((*(((unsigned int *) buff_addr_info) + \
  65. (HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_63_32_OFFSET >> 2))) = \
  66. ((vaddr_hi) << HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_63_32_LSB) & \
  67. HAL_MON_MON_INGRESS_RING_BUFFER_VIRT_ADDR_63_32_MASK)
  68. #endif
  69. #define UNIFIED_RXPCU_PPDU_END_INFO_8_RX_PPDU_DURATION_OFFSET \
  70. RXPCU_PPDU_END_INFO_RX_PPDU_DURATION_OFFSET
  71. #define UNIFIED_RXPCU_PPDU_END_INFO_8_RX_PPDU_DURATION_MASK \
  72. RXPCU_PPDU_END_INFO_RX_PPDU_DURATION_MASK
  73. #define UNIFIED_RXPCU_PPDU_END_INFO_8_RX_PPDU_DURATION_LSB \
  74. RXPCU_PPDU_END_INFO_RX_PPDU_DURATION_LSB
  75. #define UNIFIED_PHYRX_HT_SIG_0_HT_SIG_INFO_PHYRX_HT_SIG_INFO_DETAILS_OFFSET \
  76. PHYRX_HT_SIG_PHYRX_HT_SIG_INFO_DETAILS_MCS_OFFSET
  77. #define UNIFIED_PHYRX_L_SIG_B_0_L_SIG_B_INFO_PHYRX_L_SIG_B_INFO_DETAILS_OFFSET \
  78. PHYRX_L_SIG_B_PHYRX_L_SIG_B_INFO_DETAILS_RATE_OFFSET
  79. #define UNIFIED_PHYRX_L_SIG_A_0_L_SIG_A_INFO_PHYRX_L_SIG_A_INFO_DETAILS_OFFSET \
  80. PHYRX_L_SIG_A_PHYRX_L_SIG_A_INFO_DETAILS_RATE_OFFSET
  81. #define UNIFIED_PHYRX_VHT_SIG_A_0_VHT_SIG_A_INFO_PHYRX_VHT_SIG_A_INFO_DETAILS_OFFSET \
  82. PHYRX_VHT_SIG_A_PHYRX_VHT_SIG_A_INFO_DETAILS_BANDWIDTH_OFFSET
  83. #define UNIFIED_PHYRX_HE_SIG_A_SU_0_HE_SIG_A_SU_INFO_PHYRX_HE_SIG_A_SU_INFO_DETAILS_OFFSET \
  84. PHYRX_HE_SIG_A_SU_PHYRX_HE_SIG_A_SU_INFO_DETAILS_FORMAT_INDICATION_OFFSET
  85. #define UNIFIED_PHYRX_HE_SIG_A_MU_DL_0_HE_SIG_A_MU_DL_INFO_PHYRX_HE_SIG_A_MU_DL_INFO_DETAILS_OFFSET \
  86. PHYRX_HE_SIG_A_MU_DL_PHYRX_HE_SIG_A_MU_DL_INFO_DETAILS_DL_UL_FLAG_OFFSET
  87. #define UNIFIED_PHYRX_HE_SIG_B1_MU_0_HE_SIG_B1_MU_INFO_PHYRX_HE_SIG_B1_MU_INFO_DETAILS_OFFSET \
  88. PHYRX_HE_SIG_B1_MU_PHYRX_HE_SIG_B1_MU_INFO_DETAILS_RU_ALLOCATION_OFFSET
  89. #define UNIFIED_PHYRX_HE_SIG_B2_MU_0_HE_SIG_B2_MU_INFO_PHYRX_HE_SIG_B2_MU_INFO_DETAILS_OFFSET \
  90. PHYRX_HE_SIG_B2_MU_PHYRX_HE_SIG_B2_MU_INFO_DETAILS_STA_ID_OFFSET
  91. #define UNIFIED_PHYRX_HE_SIG_B2_OFDMA_0_HE_SIG_B2_OFDMA_INFO_PHYRX_HE_SIG_B2_OFDMA_INFO_DETAILS_OFFSET \
  92. PHYRX_HE_SIG_B2_OFDMA_PHYRX_HE_SIG_B2_OFDMA_INFO_DETAILS_STA_ID_OFFSET
  93. #define UNIFIED_PHYRX_RSSI_LEGACY_3_RECEIVE_RSSI_INFO_PRE_RSSI_INFO_DETAILS_OFFSET \
  94. PHYRX_RSSI_LEGACY_PRE_RSSI_INFO_DETAILS_RSSI_PRI20_CHAIN0_OFFSET
  95. #define UNIFIED_PHYRX_RSSI_LEGACY_19_RECEIVE_RSSI_INFO_PREAMBLE_RSSI_INFO_DETAILS_OFFSET \
  96. PHYRX_RSSI_LEGACY_PREAMBLE_RSSI_INFO_DETAILS_RSSI_PRI20_CHAIN0_OFFSET
  97. #define RX_MON_MPDU_START_WMASK 0x07F0
  98. #define RX_MON_MPDU_END_WMASK 0x7
  99. #define RX_MON_MPDU_START_WMASK_V2 0x007F0
  100. #define RX_MON_MPDU_END_WMASK_V2 0xFF
  101. #define RX_MON_MSDU_END_WMASK 0x0AE1
  102. #define RX_MON_PPDU_END_USR_STATS_WMASK 0xB7E
  103. #define MAX_USR_INFO_STR_CNT 4
  104. #ifdef CONFIG_MON_WORD_BASED_TLV
  105. #ifndef BIG_ENDIAN_HOST
  106. struct rx_mpdu_start_mon_data {
  107. uint32_t peer_meta_data : 32;
  108. uint32_t rxpcu_mpdu_filter_in_category : 2,
  109. sw_frame_group_id : 7,
  110. ndp_frame : 1,
  111. phy_err : 1,
  112. phy_err_during_mpdu_header : 1,
  113. protocol_version_err : 1,
  114. ast_based_lookup_valid : 1,
  115. reserved_0a : 2,
  116. phy_ppdu_id : 16;
  117. uint32_t ast_index : 16,
  118. sw_peer_id : 16;
  119. uint32_t mpdu_frame_control_valid : 1,
  120. mpdu_duration_valid : 1,
  121. mac_addr_ad1_valid : 1,
  122. mac_addr_ad2_valid : 1,
  123. mac_addr_ad3_valid : 1,
  124. mac_addr_ad4_valid : 1,
  125. mpdu_sequence_control_valid : 1,
  126. mpdu_qos_control_valid : 1,
  127. mpdu_ht_control_valid : 1,
  128. frame_encryption_info_valid : 1,
  129. mpdu_fragment_number : 4,
  130. more_fragment_flag : 1,
  131. reserved_11a : 1,
  132. fr_ds : 1,
  133. to_ds : 1,
  134. encrypted : 1,
  135. mpdu_retry : 1,
  136. mpdu_sequence_number : 12;
  137. uint32_t key_id_octet : 8,
  138. new_peer_entry : 1,
  139. decrypt_needed : 1,
  140. decap_type : 2,
  141. rx_insert_vlan_c_tag_padding : 1,
  142. rx_insert_vlan_s_tag_padding : 1,
  143. strip_vlan_c_tag_decap : 1,
  144. strip_vlan_s_tag_decap : 1,
  145. pre_delim_count : 12,
  146. ampdu_flag : 1,
  147. bar_frame : 1,
  148. raw_mpdu : 1,
  149. reserved_12 : 1;
  150. uint32_t mpdu_length : 14,
  151. first_mpdu : 1,
  152. mcast_bcast : 1,
  153. ast_index_not_found : 1,
  154. ast_index_timeout : 1,
  155. power_mgmt : 1,
  156. non_qos : 1,
  157. null_data : 1,
  158. mgmt_type : 1,
  159. ctrl_type : 1,
  160. more_data : 1,
  161. eosp : 1,
  162. fragment_flag : 1,
  163. order : 1,
  164. u_apsd_trigger : 1,
  165. encrypt_required : 1,
  166. directed : 1,
  167. amsdu_present : 1,
  168. reserved_13 : 1;
  169. uint32_t mpdu_frame_control_field : 16,
  170. mpdu_duration_field : 16;
  171. uint32_t mac_addr_ad1_31_0 : 32;
  172. uint32_t mac_addr_ad1_47_32 : 16,
  173. mac_addr_ad2_15_0 : 16;
  174. uint32_t mac_addr_ad2_47_16 : 32;
  175. uint32_t mac_addr_ad3_31_0 : 32;
  176. uint32_t mac_addr_ad3_47_32 : 16,
  177. mpdu_sequence_control_field : 16;
  178. uint32_t mac_addr_ad4_31_0 : 32;
  179. uint32_t mac_addr_ad4_47_32 : 16,
  180. mpdu_qos_control_field : 16;
  181. };
  182. struct rx_msdu_end_mon_data {
  183. uint32_t rxpcu_mpdu_filter_in_category : 2,
  184. sw_frame_group_id : 7,
  185. reserved_0 : 7,
  186. phy_ppdu_id : 16;
  187. uint32_t ip_hdr_chksum : 16,
  188. reported_mpdu_length : 14,
  189. reserved_1a : 2;
  190. uint32_t sa_sw_peer_id : 16,
  191. sa_idx_timeout : 1,
  192. da_idx_timeout : 1,
  193. to_ds : 1,
  194. tid : 4,
  195. sa_is_valid : 1,
  196. da_is_valid : 1,
  197. da_is_mcbc : 1,
  198. l3_header_padding : 2,
  199. first_msdu : 1,
  200. last_msdu : 1,
  201. fr_ds : 1,
  202. ip_chksum_fail_copy : 1;
  203. uint32_t sa_idx : 16,
  204. da_idx_or_sw_peer_id : 16;
  205. uint32_t msdu_drop : 1,
  206. reo_destination_indication : 5,
  207. flow_idx : 20,
  208. use_ppe : 1,
  209. mesh_sta : 2,
  210. vlan_ctag_stripped : 1,
  211. vlan_stag_stripped : 1,
  212. fragment_flag : 1;
  213. uint32_t fse_metadata : 32;
  214. uint32_t cce_metadata : 16,
  215. tcp_udp_chksum : 16;
  216. uint32_t aggregation_count : 8,
  217. flow_aggregation_continuation : 1,
  218. fisa_timeout : 1,
  219. tcp_udp_chksum_fail_copy : 1,
  220. msdu_limit_error : 1,
  221. flow_idx_timeout : 1,
  222. flow_idx_invalid : 1,
  223. cce_match : 1,
  224. amsdu_parser_error : 1,
  225. cumulative_ip_length : 16;
  226. uint32_t msdu_length : 14,
  227. stbc : 1,
  228. ipsec_esp : 1,
  229. l3_offset : 7,
  230. ipsec_ah : 1,
  231. l4_offset : 8;
  232. uint32_t msdu_number : 8,
  233. decap_format : 2,
  234. ipv4_proto : 1,
  235. ipv6_proto : 1,
  236. tcp_proto : 1,
  237. udp_proto : 1,
  238. ip_frag : 1,
  239. tcp_only_ack : 1,
  240. da_is_bcast_mcast : 1,
  241. toeplitz_hash_sel : 2,
  242. ip_fixed_header_valid : 1,
  243. ip_extn_header_valid : 1,
  244. tcp_udp_header_valid : 1,
  245. mesh_control_present : 1,
  246. ldpc : 1,
  247. ip4_protocol_ip6_next_header : 8;
  248. uint32_t user_rssi : 8,
  249. pkt_type : 4,
  250. sgi : 2,
  251. rate_mcs : 4,
  252. receive_bandwidth : 3,
  253. reception_type : 3,
  254. mimo_ss_bitmap : 7,
  255. msdu_done_copy : 1;
  256. uint32_t flow_id_toeplitz : 32;
  257. };
  258. struct rx_ppdu_end_user_mon_data {
  259. uint32_t sw_peer_id : 16,
  260. mpdu_cnt_fcs_err : 11,
  261. sw2rxdma0_buf_source_used : 1,
  262. fw2rxdma_pmac0_buf_source_used : 1,
  263. sw2rxdma1_buf_source_used : 1,
  264. sw2rxdma_exception_buf_source_used: 1,
  265. fw2rxdma_pmac1_buf_source_used : 1;
  266. uint32_t mpdu_cnt_fcs_ok : 11,
  267. frame_control_info_valid : 1,
  268. qos_control_info_valid : 1,
  269. ht_control_info_valid : 1,
  270. data_sequence_control_info_valid : 1,
  271. ht_control_info_null_valid : 1,
  272. rxdma2fw_pmac1_ring_used : 1,
  273. rxdma2reo_ring_used : 1,
  274. rxdma2fw_pmac0_ring_used : 1,
  275. rxdma2sw_ring_used : 1,
  276. rxdma_release_ring_used : 1,
  277. ht_control_field_pkt_type : 4,
  278. rxdma2reo_remote0_ring_used : 1,
  279. rxdma2reo_remote1_ring_used : 1,
  280. reserved_3b : 5;
  281. uint32_t ast_index : 16,
  282. frame_control_field : 16;
  283. uint32_t first_data_seq_ctrl : 16,
  284. qos_control_field : 16;
  285. uint32_t ht_control_field : 32;
  286. uint32_t fcs_ok_bitmap_31_0 : 32;
  287. uint32_t fcs_ok_bitmap_63_32 : 32;
  288. uint32_t udp_msdu_count : 16,
  289. tcp_msdu_count : 16;
  290. uint32_t other_msdu_count : 16,
  291. tcp_ack_msdu_count : 16;
  292. uint32_t sw_response_reference_ptr : 32;
  293. uint32_t received_qos_data_tid_bitmap : 16,
  294. received_qos_data_tid_eosp_bitmap : 16;
  295. uint32_t qosctrl_15_8_tid0 : 8,
  296. qosctrl_15_8_tid1 : 8,
  297. qosctrl_15_8_tid2 : 8,
  298. qosctrl_15_8_tid3 : 8;
  299. uint32_t qosctrl_15_8_tid12 : 8,
  300. qosctrl_15_8_tid13 : 8,
  301. qosctrl_15_8_tid14 : 8,
  302. qosctrl_15_8_tid15 : 8;
  303. uint32_t mpdu_ok_byte_count : 25,
  304. ampdu_delim_ok_count_6_0 : 7;
  305. uint32_t ampdu_delim_err_count : 25,
  306. ampdu_delim_ok_count_13_7 : 7;
  307. uint32_t mpdu_err_byte_count : 25,
  308. ampdu_delim_ok_count_20_14 : 7;
  309. uint32_t sw_response_reference_ptr_ext : 32;
  310. uint32_t corrupted_due_to_fifo_delay : 1,
  311. frame_control_info_null_valid : 1,
  312. frame_control_field_null : 16,
  313. retried_mpdu_count : 11,
  314. reserved_23a : 3;
  315. };
  316. #else
  317. struct rx_mpdu_start_mon_data {
  318. uint32_t peer_meta_data : 32;
  319. uint32_t phy_ppdu_id : 16,
  320. reserved_0a : 2,
  321. ast_based_lookup_valid : 1,
  322. protocol_version_err : 1,
  323. phy_err_during_mpdu_header : 1,
  324. phy_err : 1,
  325. ndp_frame : 1,
  326. sw_frame_group_id : 7,
  327. rxpcu_mpdu_filter_in_category : 2;
  328. uint32_t sw_peer_id : 16,
  329. ast_index : 16;
  330. uint32_t mpdu_sequence_number : 12,
  331. mpdu_retry : 1,
  332. encrypted : 1,
  333. to_ds : 1,
  334. fr_ds : 1,
  335. reserved_11a : 1,
  336. more_fragment_flag : 1,
  337. mpdu_fragment_number : 4,
  338. frame_encryption_info_valid : 1,
  339. mpdu_ht_control_valid : 1,
  340. mpdu_qos_control_valid : 1,
  341. mpdu_sequence_control_valid : 1,
  342. mac_addr_ad4_valid : 1,
  343. mac_addr_ad3_valid : 1,
  344. mac_addr_ad2_valid : 1,
  345. mac_addr_ad1_valid : 1,
  346. mpdu_duration_valid : 1,
  347. mpdu_frame_control_valid : 1;
  348. uint32_t reserved_12 : 1,
  349. raw_mpdu : 1,
  350. bar_frame : 1,
  351. ampdu_flag : 1,
  352. pre_delim_count : 12,
  353. strip_vlan_s_tag_decap : 1,
  354. strip_vlan_c_tag_decap : 1,
  355. rx_insert_vlan_s_tag_padding : 1,
  356. rx_insert_vlan_c_tag_padding : 1,
  357. decap_type : 2,
  358. decrypt_needed : 1,
  359. new_peer_entry : 1,
  360. key_id_octet : 8;
  361. uint32_t reserved_13 : 1,
  362. amsdu_present : 1,
  363. directed : 1,
  364. encrypt_required : 1,
  365. u_apsd_trigger : 1,
  366. order : 1,
  367. fragment_flag : 1,
  368. eosp : 1,
  369. more_data : 1,
  370. ctrl_type : 1,
  371. mgmt_type : 1,
  372. null_data : 1,
  373. non_qos : 1,
  374. power_mgmt : 1,
  375. ast_index_timeout : 1,
  376. ast_index_not_found : 1,
  377. mcast_bcast : 1,
  378. first_mpdu : 1,
  379. mpdu_length : 14;
  380. uint32_t mpdu_duration_field : 16,
  381. mpdu_frame_control_field : 16;
  382. uint32_t mac_addr_ad1_31_0 : 32;
  383. uint32_t mac_addr_ad2_15_0 : 16,
  384. mac_addr_ad1_47_32 : 16;
  385. uint32_t mac_addr_ad2_47_16 : 32;
  386. uint32_t mac_addr_ad3_31_0 : 32;
  387. uint32_t mpdu_sequence_control_field : 16,
  388. mac_addr_ad3_47_32 : 16;
  389. uint32_t mac_addr_ad4_31_0 : 32;
  390. uint32_t mpdu_qos_control_field : 16,
  391. mac_addr_ad4_47_32 : 16;
  392. };
  393. struct rx_msdu_end_mon_data {
  394. uint32_t phy_ppdu_id : 16,
  395. reserved_0 : 7,
  396. sw_frame_group_id : 7,
  397. rxpcu_mpdu_filter_in_category : 2;
  398. uint32_t reserved_1a : 2,
  399. reported_mpdu_length : 14,
  400. ip_hdr_chksum : 16;
  401. uint32_t ip_chksum_fail_copy : 1,
  402. fr_ds : 1,
  403. last_msdu : 1,
  404. first_msdu : 1,
  405. l3_header_padding : 2,
  406. da_is_mcbc : 1,
  407. da_is_valid : 1,
  408. sa_is_valid : 1,
  409. tid : 4,
  410. to_ds : 1,
  411. da_idx_timeout : 1,
  412. sa_idx_timeout : 1,
  413. sa_sw_peer_id : 16;
  414. uint32_t da_idx_or_sw_peer_id : 16,
  415. sa_idx : 16;
  416. uint32_t fragment_flag : 1,
  417. vlan_stag_stripped : 1,
  418. vlan_ctag_stripped : 1,
  419. mesh_sta : 2,
  420. use_ppe : 1,
  421. flow_idx : 20,
  422. reo_destination_indication : 5,
  423. msdu_drop : 1;
  424. uint32_t fse_metadata : 32;
  425. uint32_t cce_metadata : 16,
  426. tcp_udp_chksum : 16;
  427. uint32_t cumulative_ip_length : 16,
  428. amsdu_parser_error : 1,
  429. cce_match : 1,
  430. flow_idx_invalid : 1,
  431. flow_idx_timeout : 1,
  432. msdu_limit_error : 1,
  433. tcp_udp_chksum_fail_copy : 1,
  434. fisa_timeout : 1,
  435. flow_aggregation_continuation : 1,
  436. aggregation_count : 8;
  437. uint32_t l4_offset : 8,
  438. ipsec_ah : 1,
  439. l3_offset : 7,
  440. ipsec_esp : 1,
  441. stbc : 1,
  442. msdu_length : 14;
  443. uint32_t ip4_protocol_ip6_next_header : 8,
  444. ldpc : 1,
  445. mesh_control_present : 1,
  446. tcp_udp_header_valid : 1,
  447. ip_extn_header_valid : 1,
  448. ip_fixed_header_valid : 1,
  449. toeplitz_hash_sel : 2,
  450. da_is_bcast_mcast : 1,
  451. tcp_only_ack : 1,
  452. ip_frag : 1,
  453. udp_proto : 1,
  454. tcp_proto : 1,
  455. ipv6_proto : 1,
  456. ipv4_proto : 1,
  457. decap_format : 2,
  458. msdu_number : 8;
  459. uint32_t msdu_done_copy : 1,
  460. mimo_ss_bitmap : 7,
  461. reception_type : 3,
  462. receive_bandwidth : 3,
  463. rate_mcs : 4,
  464. sgi : 2,
  465. pkt_type : 4,
  466. user_rssi : 8;
  467. uint32_t flow_id_toeplitz : 32;
  468. };
  469. struct rx_ppdu_end_user_mon_data {
  470. uint32_t fw2rxdma_pmac1_buf_source_used : 1,
  471. sw2rxdma_exception_buf_source_used: 1,
  472. sw2rxdma1_buf_source_used : 1,
  473. fw2rxdma_pmac0_buf_source_used : 1,
  474. sw2rxdma0_buf_source_used : 1,
  475. mpdu_cnt_fcs_err : 11,
  476. sw_peer_id : 16;
  477. uint32_t reserved_3b : 5,
  478. rxdma2reo_remote1_ring_used : 1,
  479. rxdma2reo_remote0_ring_used : 1,
  480. ht_control_field_pkt_type : 4,
  481. rxdma_release_ring_used : 1,
  482. rxdma2sw_ring_used : 1,
  483. rxdma2fw_pmac0_ring_used : 1,
  484. rxdma2reo_ring_used : 1,
  485. rxdma2fw_pmac1_ring_used : 1,
  486. ht_control_info_null_valid : 1,
  487. data_sequence_control_info_valid : 1,
  488. ht_control_info_valid : 1,
  489. qos_control_info_valid : 1,
  490. frame_control_info_valid : 1,
  491. mpdu_cnt_fcs_ok : 11;
  492. uint32_t frame_control_field : 16,
  493. ast_index : 16;
  494. uint32_t qos_control_field : 16,
  495. first_data_seq_ctrl : 16;
  496. uint32_t ht_control_field : 32;
  497. uint32_t fcs_ok_bitmap_31_0 : 32;
  498. uint32_t fcs_ok_bitmap_63_32 : 32;
  499. uint32_t tcp_msdu_count : 16,
  500. udp_msdu_count : 16;
  501. uint32_t tcp_ack_msdu_count : 16,
  502. other_msdu_count : 16;
  503. uint32_t sw_response_reference_ptr : 32;
  504. uint32_t received_qos_data_tid_eosp_bitmap : 16,
  505. received_qos_data_tid_bitmap : 16;
  506. uint32_t qosctrl_15_8_tid3 : 8,
  507. qosctrl_15_8_tid2 : 8,
  508. qosctrl_15_8_tid1 : 8,
  509. qosctrl_15_8_tid0 : 8;
  510. uint32_t qosctrl_15_8_tid15 : 8,
  511. qosctrl_15_8_tid14 : 8,
  512. qosctrl_15_8_tid13 : 8,
  513. qosctrl_15_8_tid12 : 8;
  514. uint32_t ampdu_delim_ok_count_6_0 : 7,
  515. mpdu_ok_byte_count : 25;
  516. uint32_t ampdu_delim_ok_count_13_7 : 7,
  517. ampdu_delim_err_count : 25;
  518. uint32_t ampdu_delim_ok_count_20_14 : 7,
  519. mpdu_err_byte_count : 25;
  520. uint32_t sw_response_reference_ptr_ext : 32;
  521. uint32_t reserved_23a : 3,
  522. retried_mpdu_count : 11,
  523. frame_control_field_null : 16,
  524. frame_control_info_null_valid : 1,
  525. corrupted_due_to_fifo_delay : 1;
  526. };
  527. #endif
  528. struct rx_mpdu_start_mon_data_t {
  529. struct rx_mpdu_start_mon_data rx_mpdu_info_details;
  530. };
  531. struct rx_msdu_end_mon_data_t {
  532. struct rx_msdu_end_mon_data rx_mpdu_info_details;
  533. };
  534. /* TLV struct for word based Tlv */
  535. typedef struct rx_mpdu_start_mon_data_t hal_rx_mon_mpdu_start_t;
  536. typedef struct rx_msdu_end_mon_data hal_rx_mon_msdu_end_t;
  537. typedef struct rx_ppdu_end_user_mon_data hal_rx_mon_ppdu_end_user_t;
  538. #else
  539. typedef struct rx_mpdu_start hal_rx_mon_mpdu_start_t;
  540. typedef struct rx_msdu_end hal_rx_mon_msdu_end_t;
  541. typedef struct rx_ppdu_end_user_stats hal_rx_mon_ppdu_end_user_t;
  542. #endif
  543. /*
  544. * struct mon_destination_drop - monitor drop descriptor
  545. *
  546. * @ppdu_drop_cnt: PPDU drop count
  547. * @mpdu_drop_cnt: MPDU drop count
  548. * @tlv_drop_cnt: TLV drop count
  549. * @end_of_ppdu_seen: end of ppdu seen
  550. * @reserved_0a: rsvd
  551. * @reserved_1a: rsvd
  552. * @ppdu_id: PPDU ID
  553. * @reserved_3a: rsvd
  554. * @initiator: initiator ppdu
  555. * @empty_descriptor: empty descriptor
  556. * @ring_id: ring id
  557. * @looping_count: looping count
  558. */
  559. struct mon_destination_drop {
  560. uint32_t ppdu_drop_cnt : 10,
  561. mpdu_drop_cnt : 10,
  562. tlv_drop_cnt : 10,
  563. end_of_ppdu_seen : 1,
  564. reserved_0a : 1;
  565. uint32_t reserved_1a : 32;
  566. uint32_t ppdu_id : 32;
  567. uint32_t reserved_3a : 18,
  568. initiator : 1,
  569. empty_descriptor : 1,
  570. ring_id : 8,
  571. looping_count : 4;
  572. };
  573. #define HAL_MON_BUFFER_ADDR_31_0_GET(buff_addr_info) \
  574. (_HAL_MS((*_OFFSET_TO_WORD_PTR(buff_addr_info, \
  575. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_OFFSET)), \
  576. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_MASK, \
  577. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_31_0_LSB))
  578. #define HAL_MON_BUFFER_ADDR_39_32_GET(buff_addr_info) \
  579. (_HAL_MS((*_OFFSET_TO_WORD_PTR(buff_addr_info, \
  580. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_OFFSET)), \
  581. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_MASK, \
  582. HAL_BUFFER_ADDR_INFO_BUFFER_ADDR_39_32_LSB))
  583. /**
  584. * struct hal_rx_status_buffer_done - status buffer done tlv
  585. * placeholder structure
  586. *
  587. * @ppdu_start_offset: ppdu start
  588. * @first_ppdu_start_user_info_offset:
  589. * @mult_ppdu_start_user_info:
  590. * @end_offset:
  591. * @ppdu_end_detected:
  592. * @flush_detected:
  593. * @rsvd:
  594. */
  595. struct hal_rx_status_buffer_done {
  596. uint32_t ppdu_start_offset : 3,
  597. first_ppdu_start_user_info_offset : 6,
  598. mult_ppdu_start_user_info : 1,
  599. end_offset : 13,
  600. ppdu_end_detected : 1,
  601. flush_detected : 1,
  602. rsvd : 7;
  603. };
  604. /**
  605. * enum hal_mon_status_end_reason - ppdu status buffer end reason
  606. *
  607. * @HAL_MON_STATUS_BUFFER_FULL: status buffer full
  608. * @HAL_MON_FLUSH_DETECTED: flush detected
  609. * @HAL_MON_END_OF_PPDU: end of ppdu detected
  610. * @HAL_MON_PPDU_TRUNCATED: truncated ppdu status
  611. */
  612. enum hal_mon_status_end_reason {
  613. HAL_MON_STATUS_BUFFER_FULL,
  614. HAL_MON_FLUSH_DETECTED,
  615. HAL_MON_END_OF_PPDU,
  616. HAL_MON_PPDU_TRUNCATED,
  617. };
  618. /**
  619. * struct hal_mon_desc - HAL Monitor descriptor
  620. *
  621. * @buf_addr: virtual buffer address
  622. * @ppdu_id: ppdu id
  623. * - TxMon fills scheduler id
  624. * - RxMON fills phy_ppdu_id
  625. * @end_offset: offset (units in 4 bytes) where status buffer ended
  626. * i.e offset of TLV + last TLV size
  627. * @reserved_3a: reserved bits
  628. * @end_reason: ppdu end reason
  629. * 0 - status buffer is full
  630. * 1 - flush detected
  631. * 2 - TX_FES_STATUS_END or RX_PPDU_END
  632. * 3 - PPDU truncated due to system error
  633. * @initiator: 1 - descriptor belongs to TX FES
  634. * 0 - descriptor belongs to TX RESPONSE
  635. * @empty_descriptor: 0 - this descriptor is written on a flush
  636. * or end of ppdu or end of status buffer
  637. * 1 - descriptor provided to indicate drop
  638. * @ring_id: ring id for debugging
  639. * @looping_count: count to indicate number of times producer
  640. * of entries has looped around the ring
  641. * @flush_detected: if flush detected
  642. * @end_of_ppdu_dropped: if end_of_ppdu is dropped
  643. * @ppdu_drop_count: PPDU drop count
  644. * @mpdu_drop_count: MPDU drop count
  645. * @tlv_drop_count: TLV drop count
  646. */
  647. struct hal_mon_desc {
  648. uint64_t buf_addr;
  649. uint32_t ppdu_id;
  650. uint32_t end_offset:12,
  651. reserved_3a:4,
  652. end_reason:2,
  653. initiator:1,
  654. empty_descriptor:1,
  655. ring_id:8,
  656. looping_count:4;
  657. uint16_t flush_detected:1,
  658. end_of_ppdu_dropped:1;
  659. uint32_t ppdu_drop_count;
  660. uint32_t mpdu_drop_count;
  661. uint32_t tlv_drop_count;
  662. };
  663. typedef struct hal_mon_desc *hal_mon_desc_t;
  664. /**
  665. * struct hal_mon_buf_addr_status - HAL buffer address tlv get status
  666. *
  667. * @buffer_virt_addr_31_0: Lower 32 bits of virtual address of status buffer
  668. * @buffer_virt_addr_63_32: Upper 32 bits of virtual address of status buffer
  669. * @dma_length: DMA length
  670. * @reserved_2a: reserved bits
  671. * @msdu_continuation: is msdu size more than fragment size
  672. * @truncated: is msdu got truncated
  673. * @reserved_2b: reserved bits
  674. * @tlv64_padding: tlv paddding
  675. */
  676. struct hal_mon_buf_addr_status {
  677. uint32_t buffer_virt_addr_31_0;
  678. uint32_t buffer_virt_addr_63_32;
  679. uint32_t dma_length:12,
  680. reserved_2a:4,
  681. msdu_continuation:1,
  682. truncated:1,
  683. reserved_2b:14;
  684. uint32_t tlv64_padding;
  685. };
  686. #if defined(WLAN_PKT_CAPTURE_TX_2_0) || \
  687. defined(WLAN_PKT_CAPTURE_RX_2_0)
  688. /**
  689. * hal_be_get_mon_dest_status() - Get monitor descriptor status
  690. * @hal_soc: HAL Soc handle
  691. * @hw_desc: HAL monitor descriptor
  692. * @status: pointer to write descriptor status
  693. *
  694. * Return: none
  695. */
  696. static inline void
  697. hal_be_get_mon_dest_status(hal_soc_handle_t hal_soc,
  698. void *hw_desc,
  699. struct hal_mon_desc *status)
  700. {
  701. struct mon_destination_ring *desc = hw_desc;
  702. status->empty_descriptor = desc->empty_descriptor;
  703. if (status->empty_descriptor) {
  704. struct mon_destination_drop *drop_desc = hw_desc;
  705. status->buf_addr = 0;
  706. status->ppdu_drop_count = drop_desc->ppdu_drop_cnt;
  707. status->mpdu_drop_count = drop_desc->mpdu_drop_cnt;
  708. status->tlv_drop_count = drop_desc->tlv_drop_cnt;
  709. status->end_of_ppdu_dropped = drop_desc->end_of_ppdu_seen;
  710. } else {
  711. status->buf_addr = HAL_RX_GET(desc, MON_DESTINATION_RING_STAT,BUF_VIRT_ADDR_31_0) |
  712. (((uint64_t)HAL_RX_GET(desc,
  713. MON_DESTINATION_RING_STAT,
  714. BUF_VIRT_ADDR_63_32)) << 32);
  715. status->end_reason = desc->end_reason;
  716. status->end_offset = desc->end_offset;
  717. }
  718. status->ppdu_id = desc->ppdu_id;
  719. status->initiator = desc->initiator;
  720. status->looping_count = desc->looping_count;
  721. }
  722. #endif
  723. #if defined(RX_PPDU_END_USER_STATS_OFDMA_INFO_VALID_OFFSET) && \
  724. defined(RX_PPDU_END_USER_STATS_SW_RESPONSE_REFERENCE_PTR_EXT_OFFSET)
  725. static inline void
  726. hal_rx_handle_mu_ul_info(hal_rx_mon_ppdu_end_user_t *rx_ppdu_end_user,
  727. struct mon_rx_user_status *mon_rx_user_status)
  728. {
  729. mon_rx_user_status->mu_ul_user_v0_word0 =
  730. rx_ppdu_end_user->sw_response_reference_ptr;
  731. mon_rx_user_status->mu_ul_user_v0_word1 =
  732. rx_ppdu_end_user->sw_response_reference_ptr_ext;
  733. }
  734. #else
  735. static inline void
  736. hal_rx_handle_mu_ul_info(hal_rx_mon_ppdu_end_user_t *rx_ppdu_end_user,
  737. struct mon_rx_user_status *mon_rx_user_status)
  738. {
  739. }
  740. #endif
  741. static inline void
  742. hal_rx_populate_byte_count(hal_rx_mon_ppdu_end_user_t *rx_ppdu_end_user,
  743. void *ppduinfo,
  744. struct mon_rx_user_status *mon_rx_user_status)
  745. {
  746. mon_rx_user_status->mpdu_ok_byte_count =
  747. rx_ppdu_end_user->mpdu_ok_byte_count;
  748. mon_rx_user_status->mpdu_err_byte_count =
  749. rx_ppdu_end_user->mpdu_err_byte_count;
  750. }
  751. static inline void
  752. hal_rx_populate_mu_user_info(hal_rx_mon_ppdu_end_user_t *rx_ppdu_end_user,
  753. void *ppduinfo, uint32_t user_id,
  754. struct mon_rx_user_status *mon_rx_user_status)
  755. {
  756. struct mon_rx_info *mon_rx_info;
  757. struct mon_rx_user_info *mon_rx_user_info;
  758. struct hal_rx_ppdu_info *ppdu_info =
  759. (struct hal_rx_ppdu_info *)ppduinfo;
  760. mon_rx_info = &ppdu_info->rx_info;
  761. mon_rx_user_info = &ppdu_info->rx_user_info[user_id];
  762. mon_rx_user_info->qos_control_info_valid =
  763. mon_rx_info->qos_control_info_valid;
  764. mon_rx_user_info->qos_control = mon_rx_info->qos_control;
  765. mon_rx_user_status->ast_index = ppdu_info->rx_status.ast_index;
  766. mon_rx_user_status->tid = ppdu_info->rx_status.tid;
  767. mon_rx_user_status->tcp_msdu_count =
  768. ppdu_info->rx_status.tcp_msdu_count;
  769. mon_rx_user_status->udp_msdu_count =
  770. ppdu_info->rx_status.udp_msdu_count;
  771. mon_rx_user_status->other_msdu_count =
  772. ppdu_info->rx_status.other_msdu_count;
  773. mon_rx_user_status->frame_control = ppdu_info->rx_status.frame_control;
  774. mon_rx_user_status->frame_control_info_valid =
  775. ppdu_info->rx_status.frame_control_info_valid;
  776. mon_rx_user_status->data_sequence_control_info_valid =
  777. ppdu_info->rx_status.data_sequence_control_info_valid;
  778. mon_rx_user_status->first_data_seq_ctrl =
  779. ppdu_info->rx_status.first_data_seq_ctrl;
  780. mon_rx_user_status->preamble_type = ppdu_info->rx_status.preamble_type;
  781. mon_rx_user_status->ht_flags = ppdu_info->rx_status.ht_flags;
  782. mon_rx_user_status->rtap_flags = ppdu_info->rx_status.rtap_flags;
  783. mon_rx_user_status->vht_flags = ppdu_info->rx_status.vht_flags;
  784. if (mon_rx_user_status->vht_flags) {
  785. mon_rx_user_status->vht_flag_values2 =
  786. ppdu_info->rx_status.vht_flag_values2;
  787. qdf_mem_copy(mon_rx_user_status->vht_flag_values3,
  788. ppdu_info->rx_status.vht_flag_values3,
  789. sizeof(mon_rx_user_status->vht_flag_values3));
  790. mon_rx_user_status->vht_flag_values4 =
  791. ppdu_info->rx_status.vht_flag_values4;
  792. mon_rx_user_status->vht_flag_values5 =
  793. ppdu_info->rx_status.vht_flag_values5;
  794. mon_rx_user_status->vht_flag_values6 =
  795. ppdu_info->rx_status.vht_flag_values6;
  796. }
  797. mon_rx_user_status->he_flags = ppdu_info->rx_status.he_flags;
  798. mon_rx_user_status->rs_flags = ppdu_info->rx_status.rs_flags;
  799. mon_rx_user_status->mpdu_cnt_fcs_ok =
  800. ppdu_info->com_info.mpdu_cnt_fcs_ok;
  801. mon_rx_user_status->mpdu_cnt_fcs_err =
  802. ppdu_info->com_info.mpdu_cnt_fcs_err;
  803. qdf_mem_copy(&mon_rx_user_status->mpdu_fcs_ok_bitmap,
  804. &ppdu_info->com_info.mpdu_fcs_ok_bitmap,
  805. HAL_RX_NUM_WORDS_PER_PPDU_BITMAP *
  806. sizeof(ppdu_info->com_info.mpdu_fcs_ok_bitmap[0]));
  807. mon_rx_user_status->retry_mpdu =
  808. ppdu_info->rx_status.mpdu_retry_cnt;
  809. hal_rx_populate_byte_count(rx_ppdu_end_user, ppdu_info,
  810. mon_rx_user_status);
  811. }
  812. #define HAL_RX_UPDATE_RSSI_PER_CHAIN_BW(chain, \
  813. ppdu_info, rssi_info_tlv) \
  814. { \
  815. ppdu_info->rx_status.rssi_chain[chain][0] = \
  816. HAL_RX_GET(rssi_info_tlv, RECEIVE_RSSI_INFO,\
  817. RSSI_PRI20_CHAIN##chain); \
  818. ppdu_info->rx_status.rssi_chain[chain][1] = \
  819. HAL_RX_GET(rssi_info_tlv, RECEIVE_RSSI_INFO,\
  820. RSSI_EXT20_CHAIN##chain); \
  821. ppdu_info->rx_status.rssi_chain[chain][2] = \
  822. HAL_RX_GET(rssi_info_tlv, RECEIVE_RSSI_INFO,\
  823. RSSI_EXT40_LOW20_CHAIN##chain); \
  824. ppdu_info->rx_status.rssi_chain[chain][3] = \
  825. HAL_RX_GET(rssi_info_tlv, RECEIVE_RSSI_INFO,\
  826. RSSI_EXT40_HIGH20_CHAIN##chain); \
  827. } \
  828. #define HAL_RX_PPDU_UPDATE_RSSI(ppdu_info, rssi_info_tlv) \
  829. {HAL_RX_UPDATE_RSSI_PER_CHAIN_BW(0, ppdu_info, rssi_info_tlv) \
  830. HAL_RX_UPDATE_RSSI_PER_CHAIN_BW(1, ppdu_info, rssi_info_tlv) \
  831. HAL_RX_UPDATE_RSSI_PER_CHAIN_BW(2, ppdu_info, rssi_info_tlv) \
  832. HAL_RX_UPDATE_RSSI_PER_CHAIN_BW(3, ppdu_info, rssi_info_tlv) \
  833. } \
  834. static inline uint32_t
  835. hal_rx_update_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
  836. uint8_t *rssi_info_tlv)
  837. {
  838. HAL_RX_PPDU_UPDATE_RSSI(ppdu_info, rssi_info_tlv)
  839. return 0;
  840. }
  841. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  842. static inline void
  843. hal_get_qos_control(hal_rx_mon_ppdu_end_user_t *rx_ppdu_end_user,
  844. struct hal_rx_ppdu_info *ppdu_info)
  845. {
  846. ppdu_info->rx_info.qos_control_info_valid =
  847. rx_ppdu_end_user->qos_control_info_valid;
  848. if (ppdu_info->rx_info.qos_control_info_valid)
  849. ppdu_info->rx_info.qos_control =
  850. rx_ppdu_end_user->qos_control_field;
  851. }
  852. static inline void
  853. hal_get_mac_addr1(hal_rx_mon_mpdu_start_t *rx_mpdu_start,
  854. struct hal_rx_ppdu_info *ppdu_info)
  855. {
  856. if ((ppdu_info->sw_frame_group_id
  857. == HAL_MPDU_SW_FRAME_GROUP_MGMT_PROBE_REQ) ||
  858. (ppdu_info->sw_frame_group_id ==
  859. HAL_MPDU_SW_FRAME_GROUP_CTRL_RTS)) {
  860. ppdu_info->rx_info.mac_addr1_valid =
  861. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad1_valid;
  862. *(uint32_t *)&ppdu_info->rx_info.mac_addr1[0] =
  863. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad1_31_0;
  864. if (ppdu_info->sw_frame_group_id ==
  865. HAL_MPDU_SW_FRAME_GROUP_CTRL_RTS) {
  866. *(uint16_t *)&ppdu_info->rx_info.mac_addr1[4] =
  867. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad1_47_32;
  868. }
  869. }
  870. }
  871. #else
  872. static inline void
  873. hal_get_qos_control(hal_rx_mon_ppdu_end_user_t *rx_ppdu_end_user,
  874. struct hal_rx_ppdu_info *ppdu_info)
  875. {
  876. }
  877. static inline void
  878. hal_get_mac_addr1(hal_rx_mon_mpdu_start_t *rx_mpdu_start,
  879. struct hal_rx_ppdu_info *ppdu_info)
  880. {
  881. }
  882. #endif
  883. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  884. static inline void
  885. hal_update_frame_type_cnt(hal_rx_mon_mpdu_start_t *rx_mpdu_start,
  886. struct hal_rx_ppdu_info *ppdu_info)
  887. {
  888. uint16_t frame_ctrl;
  889. uint8_t fc_type;
  890. if (rx_mpdu_start->rx_mpdu_info_details.mpdu_frame_control_valid) {
  891. frame_ctrl = rx_mpdu_start->rx_mpdu_info_details.mpdu_frame_control_field;
  892. fc_type = HAL_RX_GET_FRAME_CTRL_TYPE(frame_ctrl);
  893. if (fc_type == HAL_RX_FRAME_CTRL_TYPE_MGMT)
  894. ppdu_info->frm_type_info.rx_mgmt_cnt++;
  895. else if (fc_type == HAL_RX_FRAME_CTRL_TYPE_CTRL)
  896. ppdu_info->frm_type_info.rx_ctrl_cnt++;
  897. else if (fc_type == HAL_RX_FRAME_CTRL_TYPE_DATA)
  898. ppdu_info->frm_type_info.rx_data_cnt++;
  899. }
  900. }
  901. #else
  902. static inline void
  903. hal_update_frame_type_cnt(hal_rx_mon_mpdu_start_t *rx_mpdu_start,
  904. struct hal_rx_ppdu_info *ppdu_info)
  905. {
  906. }
  907. #endif
  908. #if defined(WLAN_PKT_CAPTURE_TX_2_0) || \
  909. defined(WLAN_PKT_CAPTURE_RX_2_0)
  910. /**
  911. * hal_mon_buff_addr_info_set() - set desc address in cookie
  912. * @hal_soc_hdl: HAL Soc handle
  913. * @mon_entry: monitor srng
  914. * @mon_desc_addr: HAL monitor descriptor virtual address
  915. * @phy_addr: HAL monitor descriptor physical address
  916. *
  917. * Return: none
  918. */
  919. static inline
  920. void hal_mon_buff_addr_info_set(hal_soc_handle_t hal_soc_hdl,
  921. void *mon_entry,
  922. unsigned long long mon_desc_addr,
  923. qdf_dma_addr_t phy_addr)
  924. {
  925. uint32_t paddr_lo = ((uintptr_t)phy_addr & 0x00000000ffffffff);
  926. uint32_t paddr_hi = ((uintptr_t)phy_addr & 0xffffffff00000000) >> 32;
  927. uint32_t vaddr_lo = ((unsigned long long)mon_desc_addr & 0x00000000ffffffff);
  928. uint32_t vaddr_hi = ((unsigned long long)mon_desc_addr & 0xffffffff00000000) >> 32;
  929. HAL_MON_PADDR_LO_SET(mon_entry, paddr_lo);
  930. HAL_MON_PADDR_HI_SET(mon_entry, paddr_hi);
  931. HAL_MON_VADDR_LO_SET(mon_entry, vaddr_lo);
  932. HAL_MON_VADDR_HI_SET(mon_entry, vaddr_hi);
  933. }
  934. #endif
  935. #ifdef WLAN_PKT_CAPTURE_TX_2_0
  936. /* TX monitor */
  937. #define TX_MON_STATUS_BUF_SIZE 2048
  938. #define HAL_INVALID_PPDU_ID 0xFFFFFFFF
  939. #define HAL_MAX_DL_MU_USERS 37
  940. #define HAL_MAX_RU_INDEX 7
  941. enum hal_tx_tlv_status {
  942. HAL_MON_TX_FES_SETUP,
  943. HAL_MON_TX_FES_STATUS_END,
  944. HAL_MON_RX_RESPONSE_REQUIRED_INFO,
  945. HAL_MON_RESPONSE_END_STATUS_INFO,
  946. HAL_MON_TX_PCU_PPDU_SETUP_INIT,
  947. HAL_MON_TX_MPDU_START,
  948. HAL_MON_TX_MSDU_START,
  949. HAL_MON_TX_BUFFER_ADDR,
  950. HAL_MON_TX_DATA,
  951. HAL_MON_TX_FES_STATUS_START,
  952. HAL_MON_TX_FES_STATUS_PROT,
  953. HAL_MON_TX_FES_STATUS_START_PROT,
  954. HAL_MON_TX_FES_STATUS_START_PPDU,
  955. HAL_MON_TX_FES_STATUS_USER_PPDU,
  956. HAL_MON_TX_QUEUE_EXTENSION,
  957. HAL_MON_RX_FRAME_BITMAP_ACK,
  958. HAL_MON_RX_FRAME_BITMAP_BLOCK_ACK_256,
  959. HAL_MON_RX_FRAME_BITMAP_BLOCK_ACK_1K,
  960. HAL_MON_COEX_TX_STATUS,
  961. HAL_MON_MACTX_HE_SIG_A_SU,
  962. HAL_MON_MACTX_HE_SIG_A_MU_DL,
  963. HAL_MON_MACTX_HE_SIG_B1_MU,
  964. HAL_MON_MACTX_HE_SIG_B2_MU,
  965. HAL_MON_MACTX_HE_SIG_B2_OFDMA,
  966. HAL_MON_MACTX_L_SIG_A,
  967. HAL_MON_MACTX_L_SIG_B,
  968. HAL_MON_MACTX_HT_SIG,
  969. HAL_MON_MACTX_VHT_SIG_A,
  970. HAL_MON_MACTX_USER_DESC_PER_USER,
  971. HAL_MON_MACTX_USER_DESC_COMMON,
  972. HAL_MON_MACTX_PHY_DESC,
  973. HAL_MON_TX_FW2SW,
  974. HAL_MON_TX_STATUS_PPDU_NOT_DONE,
  975. };
  976. enum txmon_coex_tx_status_reason {
  977. COEX_FES_TX_START,
  978. COEX_FES_TX_END,
  979. COEX_FES_END,
  980. COEX_RESPONSE_TX_START,
  981. COEX_RESPONSE_TX_END,
  982. COEX_NO_TX_ONGOING,
  983. };
  984. enum txmon_transmission_type {
  985. TXMON_SU_TRANSMISSION = 0,
  986. TXMON_MU_TRANSMISSION,
  987. TXMON_MU_SU_TRANSMISSION,
  988. TXMON_MU_MIMO_TRANSMISSION = 1,
  989. TXMON_MU_OFDMA_TRANMISSION
  990. };
  991. enum txmon_he_ppdu_subtype {
  992. TXMON_HE_SUBTYPE_SU = 0,
  993. TXMON_HE_SUBTYPE_TRIG,
  994. TXMON_HE_SUBTYPE_MU,
  995. TXMON_HE_SUBTYPE_EXT_SU
  996. };
  997. enum txmon_pkt_type {
  998. TXMON_PKT_TYPE_11A = 0,
  999. TXMON_PKT_TYPE_11B,
  1000. TXMON_PKT_TYPE_11N_MM,
  1001. TXMON_PKT_TYPE_11AC,
  1002. TXMON_PKT_TYPE_11AX,
  1003. TXMON_PKT_TYPE_11BA,
  1004. TXMON_PKT_TYPE_11BE,
  1005. TXMON_PKT_TYPE_11AZ
  1006. };
  1007. enum txmon_generated_response {
  1008. TXMON_GEN_RESP_SELFGEN_ACK = 0,
  1009. TXMON_GEN_RESP_SELFGEN_CTS,
  1010. TXMON_GEN_RESP_SELFGEN_BA,
  1011. TXMON_GEN_RESP_SELFGEN_MBA,
  1012. TXMON_GEN_RESP_SELFGEN_CBF,
  1013. TXMON_GEN_RESP_SELFGEN_TRIG,
  1014. TXMON_GEN_RESP_SELFGEN_NDP_LMR
  1015. };
  1016. #ifdef MONITOR_TLV_RECORDING_ENABLE
  1017. /*
  1018. * Please make sure that the maximum total size of fields in each TLV
  1019. * is 22 bits.
  1020. * 10 bits are reserved for tlv_tag
  1021. */
  1022. struct hal_ppdu_start_tlv_record {
  1023. uint32_t ppdu_id:10;
  1024. };
  1025. struct hal_ppdu_start_user_info_tlv_record {
  1026. uint32_t user_id:6,
  1027. rate_mcs:4,
  1028. nss:3,
  1029. reception_type:3,
  1030. sgi:2;
  1031. };
  1032. struct hal_mpdu_start_tlv_record {
  1033. uint32_t user_id:6,
  1034. wrap_flag:1;
  1035. };
  1036. struct hal_mpdu_end_tlv_record {
  1037. uint32_t user_id:6,
  1038. fcs_err:1,
  1039. wrap_flag:1;
  1040. };
  1041. struct hal_header_tlv_record {
  1042. uint32_t wrap_flag:1;
  1043. };
  1044. struct hal_msdu_end_tlv_record {
  1045. uint32_t user_id:6,
  1046. msdu_num:8,
  1047. tid:4,
  1048. tcp_proto:1,
  1049. udp_proto:1,
  1050. wrap_flag:1;
  1051. };
  1052. struct hal_mon_buffer_addr_tlv_record {
  1053. uint32_t dma_length:12,
  1054. truncation:1,
  1055. continuation:1,
  1056. wrap_flag:1;
  1057. };
  1058. struct hal_phy_location_tlv_record {
  1059. uint32_t rtt_cfr_status:8,
  1060. rtt_num_streams:8,
  1061. rx_location_info_valid:1;
  1062. };
  1063. struct hal_ppdu_end_user_stats_tlv_record {
  1064. uint32_t ast_index:16,
  1065. pkt_type:4;
  1066. };
  1067. struct hal_pcu_ppdu_end_info_tlv_record {
  1068. uint32_t dialog_topken:8,
  1069. bb_captured_reason:3,
  1070. bb_captured_channel:1,
  1071. bb_captured_timeout:1,
  1072. mpdu_delimiter_error_seen:1;
  1073. };
  1074. struct hal_phy_rx_ht_sig_tlv_record {
  1075. uint32_t crc:8,
  1076. mcs:7,
  1077. stbc:2,
  1078. aggregation:1,
  1079. short_gi:1,
  1080. fes_coding:1,
  1081. cbw:1;
  1082. };
  1083. /* Tx TLVs - structs of Tx TLV with fields to be added here*/
  1084. /*
  1085. * enum hal_ppdu_tlv_category - Categories of TLV
  1086. * @PPDU_START: PPDU start level TLV
  1087. * @MPDU: MPDU level TLV
  1088. * @PPDU_END: PPDU end level TLV
  1089. *
  1090. */
  1091. enum hal_ppdu_tlv_category {
  1092. CATEGORY_PPDU_START = 1,
  1093. CATEGORY_MPDU,
  1094. CATEGORY_PPDU_END
  1095. };
  1096. #endif
  1097. /**
  1098. * struct hal_txmon_user_desc_per_user - user desc per user information
  1099. * @psdu_length: PSDU length of the user in octet
  1100. * @ru_start_index: RU number to which user is assigned
  1101. * @ru_size: Size of the RU for that user
  1102. * @ofdma_mu_mimo_enabled: mu mimo transmission within the RU
  1103. * @nss: Number of spatial stream occupied by the user
  1104. * @stream_offset: Stream Offset from which the User occupies the Streams
  1105. * @mcs: Modulation Coding Scheme for the User
  1106. * @dcm: Indicates whether dual sub-carrier modulation is applied
  1107. * @fec_type: Indicates whether it is BCC or LDPC
  1108. * @user_bf_type: user beamforming type
  1109. * @drop_user_cbf: frame dropped because of CBF FCS failure
  1110. * @ldpc_extra_symbol: LDPC encoding process
  1111. * @force_extra_symbol: force an extra OFDM symbol
  1112. * @reserved: reserved
  1113. * @sw_peer_id: user sw peer id
  1114. * @per_user_subband_mask: Per user sub band mask
  1115. */
  1116. struct hal_txmon_user_desc_per_user {
  1117. uint32_t psdu_length;
  1118. uint32_t ru_start_index :8,
  1119. ru_size :4,
  1120. ofdma_mu_mimo_enabled :1,
  1121. nss :3,
  1122. stream_offset :3,
  1123. mcs :4,
  1124. dcm :1,
  1125. fec_type :1,
  1126. user_bf_type :2,
  1127. drop_user_cbf :1,
  1128. ldpc_extra_symbol :1,
  1129. force_extra_symbol :1,
  1130. reserved :2;
  1131. uint32_t sw_peer_id :16,
  1132. per_user_subband_mask :16;
  1133. };
  1134. /**
  1135. * struct hal_txmon_usr_desc_common - user desc common information
  1136. * @num_users: Number of users
  1137. * @ltf_size: LTF size
  1138. * @pkt_extn_pe: packet extension duration of the trigger-based PPDU
  1139. * @a_factor: packet extension duration of the trigger-based PPDU
  1140. * @center_ru_0: Center RU is occupied in the lower 80 MHz band
  1141. * @center_ru_1: Center RU is occupied in the upper 80 MHz band
  1142. * @num_ltf_symbols: number of LTF symbols
  1143. * @doppler_indication: doppler indication
  1144. * @reserved: reserved
  1145. * @spatial_reuse: spatial reuse
  1146. * @ru_channel_0: RU arrangement for band 0
  1147. * @ru_channel_1: RU arrangement for band 1
  1148. */
  1149. struct hal_txmon_usr_desc_common {
  1150. uint32_t num_users :6,
  1151. ltf_size :2,
  1152. pkt_extn_pe :1,
  1153. a_factor :2,
  1154. center_ru_0 :1,
  1155. center_ru_1 :1,
  1156. num_ltf_symbols :16,
  1157. doppler_indication :1,
  1158. reserved :2;
  1159. uint16_t spatial_reuse;
  1160. uint16_t ru_channel_0[8];
  1161. uint16_t ru_channel_1[8];
  1162. };
  1163. #define IS_MULTI_USERS(num_users) (!!(0xFFFE & num_users))
  1164. #define TXMON_HAL(hal_tx_ppdu_info, field) \
  1165. hal_tx_ppdu_info->field
  1166. #define TXMON_HAL_STATUS(hal_tx_ppdu_info, field) \
  1167. hal_tx_ppdu_info->rx_status.field
  1168. #define TXMON_HAL_USER(hal_tx_ppdu_info, user_id, field) \
  1169. hal_tx_ppdu_info->rx_user_status[user_id].field
  1170. #define TXMON_STATUS_INFO(hal_tx_status_info, field) \
  1171. hal_tx_status_info->field
  1172. #ifdef MONITOR_TLV_RECORDING_ENABLE
  1173. struct hal_tx_tlv_info {
  1174. uint32_t tlv_tag;
  1175. uint8_t tlv_category;
  1176. uint8_t is_data_ppdu_info;
  1177. };
  1178. #endif
  1179. /**
  1180. * struct hal_tx_status_info - status info that wasn't populated in rx_status
  1181. * @reception_type: su or uplink mu reception type
  1182. * @transmission_type: su or mu transmission type
  1183. * @medium_prot_type: medium protection type
  1184. * @generated_response: Generated frame in response window
  1185. * @band_center_freq1:
  1186. * @band_center_freq2:
  1187. * @freq:
  1188. * @phy_mode:
  1189. * @schedule_id:
  1190. * @no_bitmap_avail: Bitmap available flag
  1191. * @explicit_ack: Explicit Acknowledge flag
  1192. * @explicit_ack_type: Explicit Acknowledge type
  1193. * @r2r_end_status_follow: Response to Response status flag
  1194. * @response_type: Response type in response window
  1195. * @ndp_frame: NDP frame
  1196. * @num_users: number of users
  1197. * @reserved: reserved bits
  1198. * @mba_count: MBA count
  1199. * @mba_fake_bitmap_count: MBA fake bitmap count
  1200. * @sw_frame_group_id: software frame group ID
  1201. * @r2r_to_follow: Response to Response follow flag
  1202. * @phy_abort_reason: Reason for PHY abort
  1203. * @phy_abort_user_number: User number for PHY abort
  1204. * @buffer: Packet buffer pointer address
  1205. * @offset: Packet buffer offset
  1206. * @length: Packet buffer length
  1207. * @protection_addr: Protection Address flag
  1208. * @addr1: MAC address 1
  1209. * @addr2: MAC address 2
  1210. * @addr3: MAC address 3
  1211. * @addr4: MAC address 4
  1212. */
  1213. struct hal_tx_status_info {
  1214. uint8_t reception_type;
  1215. uint8_t transmission_type;
  1216. uint8_t medium_prot_type;
  1217. uint8_t generated_response;
  1218. uint16_t band_center_freq1;
  1219. uint16_t band_center_freq2;
  1220. uint16_t freq;
  1221. uint16_t phy_mode;
  1222. uint32_t schedule_id;
  1223. uint32_t no_bitmap_avail :1,
  1224. explicit_ack :1,
  1225. explicit_ack_type :4,
  1226. r2r_end_status_follow :1,
  1227. response_type :5,
  1228. ndp_frame :2,
  1229. num_users :8,
  1230. reserved :10;
  1231. uint8_t mba_count;
  1232. uint8_t mba_fake_bitmap_count;
  1233. uint8_t sw_frame_group_id;
  1234. uint32_t r2r_to_follow;
  1235. uint16_t phy_abort_reason;
  1236. uint8_t phy_abort_user_number;
  1237. void *buffer;
  1238. uint32_t offset;
  1239. uint32_t length;
  1240. uint8_t protection_addr;
  1241. uint8_t addr1[QDF_MAC_ADDR_SIZE];
  1242. uint8_t addr2[QDF_MAC_ADDR_SIZE];
  1243. uint8_t addr3[QDF_MAC_ADDR_SIZE];
  1244. uint8_t addr4[QDF_MAC_ADDR_SIZE];
  1245. };
  1246. /**
  1247. * struct hal_tx_ppdu_info - tx monitor ppdu information
  1248. * @ppdu_id: Id of the PLCP protocol data unit
  1249. * @num_users: number of users
  1250. * @is_used: boolean flag to identify valid ppdu info
  1251. * @is_data: boolean flag to identify data frame
  1252. * @cur_usr_idx: Current user index of the PPDU
  1253. * @reserved: for future purpose
  1254. * @prot_tlv_status: protection tlv status
  1255. * @tx_tlv_info: store tx tlv info for recording
  1256. * @packet_info: packet information
  1257. * @rx_status: monitor mode rx status information
  1258. * @rx_user_status: monitor mode rx user status information
  1259. */
  1260. struct hal_tx_ppdu_info {
  1261. uint32_t ppdu_id;
  1262. uint32_t num_users :8,
  1263. is_used :1,
  1264. is_data :1,
  1265. cur_usr_idx :8,
  1266. reserved :15;
  1267. uint32_t prot_tlv_status;
  1268. #ifdef MONITOR_TLV_RECORDING_ENABLE
  1269. struct hal_tx_tlv_info tx_tlv_info;
  1270. #endif
  1271. /* placeholder to hold packet buffer info */
  1272. struct hal_mon_packet_info packet_info;
  1273. struct mon_rx_status rx_status;
  1274. struct mon_rx_user_status rx_user_status[];
  1275. };
  1276. /**
  1277. * hal_tx_status_get_next_tlv() - get next tx status TLV
  1278. * @tx_tlv: pointer to TLV header
  1279. * @is_tlv_hdr_64_bit: Flag to indicate tlv hdr 64 bit
  1280. *
  1281. * Return: pointer to next tlv info
  1282. */
  1283. static inline uint8_t*
  1284. hal_tx_status_get_next_tlv(uint8_t *tx_tlv, bool is_tlv_hdr_64_bit) {
  1285. uint32_t tlv_len, tlv_hdr_size;
  1286. tlv_len = HAL_RX_GET_USER_TLV32_LEN(tx_tlv);
  1287. tlv_hdr_size = is_tlv_hdr_64_bit ? HAL_RX_TLV64_HDR_SIZE :
  1288. HAL_RX_TLV32_HDR_SIZE;
  1289. return (uint8_t *)(uintptr_t)qdf_align((uint64_t)((uintptr_t)tx_tlv +
  1290. tlv_len +
  1291. tlv_hdr_size),
  1292. tlv_hdr_size);
  1293. }
  1294. /**
  1295. * hal_txmon_status_parse_tlv() - process transmit info TLV
  1296. * @hal_soc_hdl: HAL soc handle
  1297. * @data_ppdu_info: pointer to hal data ppdu info
  1298. * @prot_ppdu_info: pointer to hal prot ppdu info
  1299. * @data_status_info: pointer to data status info
  1300. * @prot_status_info: pointer to prot status info
  1301. * @tx_tlv_hdr: pointer to TLV header
  1302. * @status_frag: pointer to status frag
  1303. *
  1304. * Return: HAL_TLV_STATUS_PPDU_NOT_DONE
  1305. */
  1306. static inline uint32_t
  1307. hal_txmon_status_parse_tlv(hal_soc_handle_t hal_soc_hdl,
  1308. void *data_ppdu_info,
  1309. void *prot_ppdu_info,
  1310. void *data_status_info,
  1311. void *prot_status_info,
  1312. void *tx_tlv_hdr,
  1313. qdf_frag_t status_frag)
  1314. {
  1315. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1316. return hal_soc->ops->hal_txmon_status_parse_tlv(data_ppdu_info,
  1317. prot_ppdu_info,
  1318. data_status_info,
  1319. prot_status_info,
  1320. tx_tlv_hdr,
  1321. status_frag);
  1322. }
  1323. /**
  1324. * hal_txmon_status_get_num_users() - api to get num users from start of fes
  1325. * window
  1326. * @hal_soc_hdl: HAL soc handle
  1327. * @tx_tlv_hdr: pointer to TLV header
  1328. * @num_users: reference to number of user
  1329. *
  1330. * Return: status
  1331. */
  1332. static inline uint32_t
  1333. hal_txmon_status_get_num_users(hal_soc_handle_t hal_soc_hdl,
  1334. void *tx_tlv_hdr, uint8_t *num_users)
  1335. {
  1336. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1337. return hal_soc->ops->hal_txmon_status_get_num_users(tx_tlv_hdr,
  1338. num_users);
  1339. }
  1340. /**
  1341. * hal_tx_status_get_tlv_tag() - api to get tlv tag
  1342. * @tx_tlv_hdr: pointer to TLV header
  1343. *
  1344. * Return tlv_tag
  1345. */
  1346. static inline uint32_t
  1347. hal_tx_status_get_tlv_tag(void *tx_tlv_hdr)
  1348. {
  1349. uint32_t tlv_tag = 0;
  1350. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(tx_tlv_hdr);
  1351. return tlv_tag;
  1352. }
  1353. /**
  1354. * hal_txmon_get_word_mask() - api to get word mask for tx monitor
  1355. * @hal_soc_hdl: HAL soc handle
  1356. * @wmask: pointer to hal_txmon_word_mask_config_t
  1357. *
  1358. * Return: bool
  1359. */
  1360. static inline bool
  1361. hal_txmon_get_word_mask(hal_soc_handle_t hal_soc_hdl,
  1362. hal_txmon_word_mask_config_t *wmask)
  1363. {
  1364. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1365. if (hal_soc->ops->hal_txmon_get_word_mask) {
  1366. hal_soc->ops->hal_txmon_get_word_mask(wmask);
  1367. return true;
  1368. }
  1369. return false;
  1370. }
  1371. /**
  1372. * hal_txmon_is_mon_buf_addr_tlv() - api to find packet buffer addr tlv
  1373. * @hal_soc_hdl: HAL soc handle
  1374. * @tx_tlv_hdr: pointer to TLV header
  1375. *
  1376. * Return: bool
  1377. */
  1378. static inline bool
  1379. hal_txmon_is_mon_buf_addr_tlv(hal_soc_handle_t hal_soc_hdl, void *tx_tlv_hdr)
  1380. {
  1381. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1382. if (qdf_unlikely(!hal_soc->ops->hal_txmon_is_mon_buf_addr_tlv))
  1383. return false;
  1384. return hal_soc->ops->hal_txmon_is_mon_buf_addr_tlv(tx_tlv_hdr);
  1385. }
  1386. /**
  1387. * hal_txmon_populate_packet_info() - api to populate packet info
  1388. * @hal_soc_hdl: HAL soc handle
  1389. * @tx_tlv_hdr: pointer to TLV header
  1390. * @packet_info: pointer to placeholder for packet info
  1391. *
  1392. * Return void
  1393. */
  1394. static inline void
  1395. hal_txmon_populate_packet_info(hal_soc_handle_t hal_soc_hdl,
  1396. void *tx_tlv_hdr,
  1397. void *packet_info)
  1398. {
  1399. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  1400. if (qdf_unlikely(!hal_soc->ops->hal_txmon_populate_packet_info))
  1401. return;
  1402. hal_soc->ops->hal_txmon_populate_packet_info(tx_tlv_hdr, packet_info);
  1403. }
  1404. #endif
  1405. static inline uint32_t
  1406. hal_rx_parse_u_sig_cmn(struct hal_soc *hal_soc, void *rx_tlv,
  1407. struct hal_rx_ppdu_info *ppdu_info)
  1408. {
  1409. struct hal_mon_usig_hdr *usig = (struct hal_mon_usig_hdr *)rx_tlv;
  1410. struct hal_mon_usig_cmn *usig_1 = &usig->usig_1;
  1411. uint8_t bad_usig_crc;
  1412. bad_usig_crc = HAL_RX_MON_USIG_GET_RX_INTEGRITY_CHECK_PASSED(rx_tlv) ?
  1413. 0 : 1;
  1414. ppdu_info->rx_status.usig_common |=
  1415. QDF_MON_STATUS_USIG_PHY_VERSION_KNOWN |
  1416. QDF_MON_STATUS_USIG_BW_KNOWN |
  1417. QDF_MON_STATUS_USIG_UL_DL_KNOWN |
  1418. QDF_MON_STATUS_USIG_BSS_COLOR_KNOWN |
  1419. QDF_MON_STATUS_USIG_TXOP_KNOWN;
  1420. ppdu_info->rx_status.usig_common |= (usig_1->phy_version <<
  1421. QDF_MON_STATUS_USIG_PHY_VERSION_SHIFT);
  1422. ppdu_info->rx_status.usig_common |= (usig_1->bw <<
  1423. QDF_MON_STATUS_USIG_BW_SHIFT);
  1424. ppdu_info->rx_status.usig_common |= (usig_1->ul_dl <<
  1425. QDF_MON_STATUS_USIG_UL_DL_SHIFT);
  1426. ppdu_info->rx_status.usig_common |= (usig_1->bss_color <<
  1427. QDF_MON_STATUS_USIG_BSS_COLOR_SHIFT);
  1428. ppdu_info->rx_status.usig_common |= (usig_1->txop <<
  1429. QDF_MON_STATUS_USIG_TXOP_SHIFT);
  1430. ppdu_info->rx_status.usig_common |= bad_usig_crc;
  1431. ppdu_info->u_sig_info.ul_dl = usig_1->ul_dl;
  1432. ppdu_info->u_sig_info.bw = usig_1->bw;
  1433. ppdu_info->rx_status.bw = usig_1->bw;
  1434. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1435. }
  1436. static inline uint32_t
  1437. hal_rx_parse_u_sig_tb(struct hal_soc *hal_soc, void *rx_tlv,
  1438. struct hal_rx_ppdu_info *ppdu_info)
  1439. {
  1440. struct hal_mon_usig_hdr *usig = (struct hal_mon_usig_hdr *)rx_tlv;
  1441. struct hal_mon_usig_tb *usig_tb = &usig->usig_2.tb;
  1442. ppdu_info->rx_status.usig_mask |=
  1443. QDF_MON_STATUS_USIG_DISREGARD_KNOWN |
  1444. QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_KNOWN |
  1445. QDF_MON_STATUS_USIG_VALIDATE_KNOWN |
  1446. QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_1_KNOWN |
  1447. QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_2_KNOWN |
  1448. QDF_MON_STATUS_USIG_TB_DISREGARD1_KNOWN |
  1449. QDF_MON_STATUS_USIG_CRC_KNOWN |
  1450. QDF_MON_STATUS_USIG_TAIL_KNOWN;
  1451. ppdu_info->rx_status.usig_value |= (0x3F <<
  1452. QDF_MON_STATUS_USIG_DISREGARD_SHIFT);
  1453. ppdu_info->rx_status.usig_value |= (usig_tb->ppdu_type_comp_mode <<
  1454. QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_SHIFT);
  1455. ppdu_info->rx_status.usig_value |= (0x1 <<
  1456. QDF_MON_STATUS_USIG_VALIDATE_SHIFT);
  1457. ppdu_info->rx_status.usig_value |= (usig_tb->spatial_reuse_1 <<
  1458. QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_1_SHIFT);
  1459. ppdu_info->rx_status.usig_value |= (usig_tb->spatial_reuse_2 <<
  1460. QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_2_SHIFT);
  1461. ppdu_info->rx_status.usig_value |= (0x1F <<
  1462. QDF_MON_STATUS_USIG_TB_DISREGARD1_SHIFT);
  1463. ppdu_info->rx_status.usig_value |= (usig_tb->crc <<
  1464. QDF_MON_STATUS_USIG_CRC_SHIFT);
  1465. ppdu_info->rx_status.usig_value |= (usig_tb->tail <<
  1466. QDF_MON_STATUS_USIG_TAIL_SHIFT);
  1467. ppdu_info->u_sig_info.ppdu_type_comp_mode =
  1468. usig_tb->ppdu_type_comp_mode;
  1469. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1470. }
  1471. static inline uint32_t
  1472. hal_rx_parse_u_sig_mu(struct hal_soc *hal_soc, void *rx_tlv,
  1473. struct hal_rx_ppdu_info *ppdu_info)
  1474. {
  1475. struct hal_mon_usig_hdr *usig = (struct hal_mon_usig_hdr *)rx_tlv;
  1476. struct hal_mon_usig_mu *usig_mu = &usig->usig_2.mu;
  1477. ppdu_info->rx_status.usig_mask |=
  1478. QDF_MON_STATUS_USIG_DISREGARD_KNOWN |
  1479. QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_KNOWN |
  1480. QDF_MON_STATUS_USIG_VALIDATE_KNOWN |
  1481. QDF_MON_STATUS_USIG_MU_VALIDATE1_KNOWN |
  1482. QDF_MON_STATUS_USIG_MU_PUNCTURE_CH_INFO_KNOWN |
  1483. QDF_MON_STATUS_USIG_MU_VALIDATE2_KNOWN |
  1484. QDF_MON_STATUS_USIG_MU_EHT_SIG_MCS_KNOWN |
  1485. QDF_MON_STATUS_USIG_MU_NUM_EHT_SIG_SYM_KNOWN |
  1486. QDF_MON_STATUS_USIG_CRC_KNOWN |
  1487. QDF_MON_STATUS_USIG_TAIL_KNOWN;
  1488. ppdu_info->rx_status.usig_value |= (0x1F <<
  1489. QDF_MON_STATUS_USIG_DISREGARD_SHIFT);
  1490. ppdu_info->rx_status.usig_value |= (0x1 <<
  1491. QDF_MON_STATUS_USIG_MU_VALIDATE1_SHIFT);
  1492. ppdu_info->rx_status.usig_value |= (usig_mu->ppdu_type_comp_mode <<
  1493. QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_SHIFT);
  1494. ppdu_info->rx_status.usig_value |= (0x1 <<
  1495. QDF_MON_STATUS_USIG_VALIDATE_SHIFT);
  1496. ppdu_info->rx_status.usig_value |= (usig_mu->punc_ch_info <<
  1497. QDF_MON_STATUS_USIG_MU_PUNCTURE_CH_INFO_SHIFT);
  1498. ppdu_info->rx_status.usig_value |= (0x1 <<
  1499. QDF_MON_STATUS_USIG_MU_VALIDATE2_SHIFT);
  1500. ppdu_info->rx_status.usig_value |= (usig_mu->eht_sig_mcs <<
  1501. QDF_MON_STATUS_USIG_MU_EHT_SIG_MCS_SHIFT);
  1502. ppdu_info->rx_status.usig_value |= (usig_mu->num_eht_sig_sym <<
  1503. QDF_MON_STATUS_USIG_MU_NUM_EHT_SIG_SYM_SHIFT);
  1504. ppdu_info->rx_status.usig_value |= (usig_mu->crc <<
  1505. QDF_MON_STATUS_USIG_CRC_SHIFT);
  1506. ppdu_info->rx_status.usig_value |= (usig_mu->tail <<
  1507. QDF_MON_STATUS_USIG_TAIL_SHIFT);
  1508. ppdu_info->u_sig_info.ppdu_type_comp_mode =
  1509. usig_mu->ppdu_type_comp_mode;
  1510. ppdu_info->u_sig_info.eht_sig_mcs = usig_mu->eht_sig_mcs;
  1511. ppdu_info->u_sig_info.num_eht_sig_sym = usig_mu->num_eht_sig_sym;
  1512. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1513. }
  1514. static inline uint32_t
  1515. hal_rx_parse_u_sig_hdr(struct hal_soc *hal_soc, void *rx_tlv,
  1516. struct hal_rx_ppdu_info *ppdu_info)
  1517. {
  1518. struct hal_mon_usig_hdr *usig = (struct hal_mon_usig_hdr *)rx_tlv;
  1519. struct hal_mon_usig_cmn *usig_1 = &usig->usig_1;
  1520. ppdu_info->rx_status.usig_flags = 1;
  1521. ppdu_info->rx_status.user_info_skip = 1;
  1522. hal_rx_parse_u_sig_cmn(hal_soc, rx_tlv, ppdu_info);
  1523. if (HAL_RX_MON_USIG_GET_PPDU_TYPE_N_COMP_MODE(rx_tlv) == 0 &&
  1524. usig_1->ul_dl == 1)
  1525. return hal_rx_parse_u_sig_tb(hal_soc, rx_tlv, ppdu_info);
  1526. else
  1527. return hal_rx_parse_u_sig_mu(hal_soc, rx_tlv, ppdu_info);
  1528. }
  1529. static inline uint32_t
  1530. hal_rx_parse_usig_overflow(struct hal_soc *hal_soc, void *tlv,
  1531. struct hal_rx_ppdu_info *ppdu_info)
  1532. {
  1533. struct hal_eht_sig_cc_usig_overflow *usig_ovflow =
  1534. (struct hal_eht_sig_cc_usig_overflow *)tlv;
  1535. ppdu_info->rx_status.eht_known |=
  1536. QDF_MON_STATUS_EHT_SPATIAL_REUSE_KNOWN |
  1537. QDF_MON_STATUS_EHT_EHT_LTF_KNOWN |
  1538. QDF_MON_STATUS_EHT_LDPC_EXTRA_SYMBOL_SEG_KNOWN |
  1539. QDF_MON_STATUS_EHT_PRE_FEC_PADDING_FACTOR_KNOWN |
  1540. QDF_MON_STATUS_EHT_PE_DISAMBIGUITY_KNOWN |
  1541. QDF_MON_STATUS_EHT_DISREARD_KNOWN;
  1542. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->spatial_reuse <<
  1543. QDF_MON_STATUS_EHT_SPATIAL_REUSE_SHIFT);
  1544. /*
  1545. * GI and LTF size are separately indicated in radiotap header
  1546. * and hence will be parsed from other TLV
  1547. **/
  1548. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->num_ltf_sym <<
  1549. QDF_MON_STATUS_EHT_EHT_LTF_SHIFT);
  1550. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->ldpc_extra_sym <<
  1551. QDF_MON_STATUS_EHT_LDPC_EXTRA_SYMBOL_SEG_SHIFT);
  1552. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->pre_fec_pad_factor <<
  1553. QDF_MON_STATUS_EHT_PRE_FEC_PADDING_FACTOR_SHIFT);
  1554. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->pe_disambiguity <<
  1555. QDF_MON_STATUS_EHT_PE_DISAMBIGUITY_SHIFT);
  1556. ppdu_info->rx_status.eht_data[0] |= (0xF <<
  1557. QDF_MON_STATUS_EHT_DISREGARD_SHIFT);
  1558. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1559. }
  1560. static inline uint32_t
  1561. hal_rx_parse_non_ofdma_users(struct hal_soc *hal_soc, void *tlv,
  1562. struct hal_rx_ppdu_info *ppdu_info)
  1563. {
  1564. struct hal_eht_sig_non_ofdma_cmn_eb *non_ofdma_cmn_eb =
  1565. (struct hal_eht_sig_non_ofdma_cmn_eb *)tlv;
  1566. ppdu_info->rx_status.eht_known |=
  1567. QDF_MON_STATUS_EHT_NUM_NON_OFDMA_USERS_KNOWN;
  1568. ppdu_info->rx_status.eht_data[7] |= (non_ofdma_cmn_eb->num_users <<
  1569. QDF_MON_STATUS_EHT_NUM_NON_OFDMA_USERS_SHIFT);
  1570. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1571. }
  1572. static inline void
  1573. hal_rx_parse_eht_mumimo_user_info(uint32_t *eht_user_info,
  1574. struct hal_eht_sig_mu_mimo_user_info
  1575. *user_info)
  1576. {
  1577. *eht_user_info |= QDF_MON_STATUS_EHT_USER_STA_ID_KNOWN |
  1578. QDF_MON_STATUS_EHT_USER_MCS_KNOWN |
  1579. QDF_MON_STATUS_EHT_USER_CODING_KNOWN |
  1580. QDF_MON_STATUS_EHT_USER_SPATIAL_CONFIG_KNOWN;
  1581. *eht_user_info |= (user_info->sta_id <<
  1582. QDF_MON_STATUS_EHT_USER_STA_ID_SHIFT);
  1583. *eht_user_info |= (user_info->mcs <<
  1584. QDF_MON_STATUS_EHT_USER_MCS_SHIFT);
  1585. *eht_user_info |= (user_info->coding <<
  1586. QDF_MON_STATUS_EHT_USER_CODING_SHIFT);
  1587. *eht_user_info |= (user_info->spatial_coding <<
  1588. QDF_MON_STATUS_EHT_USER_SPATIAL_CONFIG_SHIFT);
  1589. }
  1590. static inline uint32_t
  1591. hal_rx_parse_eht_sig_mumimo_user_info(struct hal_soc *hal_soc, void *tlv,
  1592. struct hal_rx_ppdu_info *ppdu_info)
  1593. {
  1594. struct hal_eht_sig_mu_mimo_user_info *user_info;
  1595. struct mon_rx_status *rx_status;
  1596. struct mon_rx_user_status *rx_user_status;
  1597. uint32_t *eht_user_info;
  1598. uint32_t user_idx, i;
  1599. uint32_t *user_field;
  1600. i = 0;
  1601. rx_status = &ppdu_info->rx_status;
  1602. user_field = (uint32_t *)((uint8_t *)tlv + ppdu_info->tlv_aggr.rd_idx);
  1603. while ((i++ < MAX_USR_INFO_STR_CNT) &&
  1604. (ppdu_info->tlv_aggr.rd_idx < ppdu_info->tlv_aggr.cur_len)) {
  1605. user_idx = rx_status->num_eht_user_info_valid;
  1606. rx_user_status = &ppdu_info->rx_user_status[user_idx];
  1607. user_info = (struct hal_eht_sig_mu_mimo_user_info *)user_field;
  1608. eht_user_info = &rx_user_status->eht_user_info;
  1609. hal_rx_parse_eht_mumimo_user_info(eht_user_info, user_info);
  1610. rx_status->mcs = user_info->mcs;
  1611. /* CRC for matched user block */
  1612. rx_user_status->eht_known |=
  1613. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_KNOWN |
  1614. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_TAIL_KNOWN;
  1615. rx_user_status->eht_data[7] |=
  1616. (user_info->crc <<
  1617. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_SHIFT);
  1618. ppdu_info->tlv_aggr.rd_idx += 4;
  1619. user_field++;
  1620. rx_status->num_eht_user_info_valid++;
  1621. }
  1622. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1623. }
  1624. static inline void
  1625. hal_rx_parse_eht_sig_mumimo_all_user_info(struct hal_soc *hal_soc, void *tlv,
  1626. struct hal_rx_ppdu_info *ppdu_info)
  1627. {
  1628. struct hal_eht_sig_mu_mimo_user_info *user_info;
  1629. uint32_t *eht_user_info;
  1630. uint32_t user_idx = ppdu_info->rx_status.num_eht_all_user_info_valid;
  1631. user_info = (struct hal_eht_sig_mu_mimo_user_info *)tlv;
  1632. eht_user_info = &ppdu_info->rx_status.eht_user_info[user_idx];
  1633. hal_rx_parse_eht_mumimo_user_info(eht_user_info, user_info);
  1634. ppdu_info->rx_status.num_eht_all_user_info_valid++;
  1635. }
  1636. static inline void
  1637. hal_rx_parse_eht_non_mumimo_user_info(uint32_t *eht_user_info,
  1638. struct hal_eht_sig_non_mu_mimo_user_info
  1639. *user_info)
  1640. {
  1641. *eht_user_info |= QDF_MON_STATUS_EHT_USER_STA_ID_KNOWN |
  1642. QDF_MON_STATUS_EHT_USER_MCS_KNOWN |
  1643. QDF_MON_STATUS_EHT_USER_CODING_KNOWN |
  1644. QDF_MON_STATUS_EHT_USER_NSS_KNOWN |
  1645. QDF_MON_STATUS_EHT_USER_BEAMFORMING_KNOWN;
  1646. *eht_user_info |= (user_info->sta_id <<
  1647. QDF_MON_STATUS_EHT_USER_STA_ID_SHIFT);
  1648. *eht_user_info |= (user_info->mcs <<
  1649. QDF_MON_STATUS_EHT_USER_MCS_SHIFT);
  1650. *eht_user_info |= (user_info->nss <<
  1651. QDF_MON_STATUS_EHT_USER_NSS_SHIFT);
  1652. *eht_user_info |= (user_info->beamformed <<
  1653. QDF_MON_STATUS_EHT_USER_BEAMFORMING_SHIFT);
  1654. *eht_user_info |= (user_info->coding <<
  1655. QDF_MON_STATUS_EHT_USER_CODING_SHIFT);
  1656. }
  1657. static inline void
  1658. hal_rx_parse_eht_sig_non_mumimo_user_info(struct hal_soc *hal_soc, void *tlv,
  1659. struct hal_rx_ppdu_info *ppdu_info)
  1660. {
  1661. struct hal_eht_sig_non_mu_mimo_user_info *user_info;
  1662. struct mon_rx_status *rx_status;
  1663. struct mon_rx_user_status *rx_user_status;
  1664. uint32_t *eht_user_info;
  1665. uint32_t user_idx, i;
  1666. uint32_t *user_field;
  1667. i = 0;
  1668. rx_status = &ppdu_info->rx_status;
  1669. user_field = (uint32_t *)((uint8_t *)tlv + ppdu_info->tlv_aggr.rd_idx);
  1670. while ((i++ < MAX_USR_INFO_STR_CNT) &&
  1671. (ppdu_info->tlv_aggr.rd_idx < ppdu_info->tlv_aggr.cur_len)) {
  1672. user_idx = rx_status->num_eht_user_info_valid;
  1673. rx_user_status = &ppdu_info->rx_user_status[user_idx];
  1674. user_info =
  1675. (struct hal_eht_sig_non_mu_mimo_user_info *)user_field;
  1676. eht_user_info = &rx_user_status->eht_user_info;
  1677. hal_rx_parse_eht_non_mumimo_user_info(eht_user_info, user_info);
  1678. ppdu_info->rx_status.mcs = user_info->mcs;
  1679. /* CRC for matched user block */
  1680. rx_user_status->eht_known |=
  1681. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_KNOWN |
  1682. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_TAIL_KNOWN;
  1683. rx_user_status->eht_data[7] |=
  1684. (user_info->crc <<
  1685. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_SHIFT);
  1686. ppdu_info->tlv_aggr.rd_idx += 4;
  1687. user_field++;
  1688. rx_status->num_eht_user_info_valid++;
  1689. }
  1690. }
  1691. static inline void
  1692. hal_rx_parse_eht_sig_non_mumimo_all_user_info(struct hal_soc *hal_soc,
  1693. void *tlv, struct hal_rx_ppdu_info
  1694. *ppdu_info)
  1695. {
  1696. struct hal_eht_sig_non_mu_mimo_user_info *user_info;
  1697. uint32_t *eht_user_info;
  1698. uint32_t user_idx = ppdu_info->rx_status.num_eht_all_user_info_valid;
  1699. user_info = (struct hal_eht_sig_non_mu_mimo_user_info *)tlv;
  1700. eht_user_info = &ppdu_info->rx_status.eht_user_info[user_idx];
  1701. hal_rx_parse_eht_non_mumimo_user_info(eht_user_info, user_info);
  1702. ppdu_info->rx_status.num_eht_all_user_info_valid++;
  1703. }
  1704. static inline bool hal_rx_is_ofdma(struct hal_soc *hal_soc,
  1705. struct hal_rx_ppdu_info *ppdu_info)
  1706. {
  1707. if (ppdu_info->u_sig_info.ppdu_type_comp_mode == 0 &&
  1708. ppdu_info->u_sig_info.ul_dl == 0)
  1709. return true;
  1710. return false;
  1711. }
  1712. static inline bool hal_rx_is_non_ofdma(struct hal_soc *hal_soc,
  1713. struct hal_rx_ppdu_info *ppdu_info)
  1714. {
  1715. uint32_t ppdu_type_comp_mode =
  1716. ppdu_info->u_sig_info.ppdu_type_comp_mode;
  1717. uint32_t ul_dl = ppdu_info->u_sig_info.ul_dl;
  1718. if ((ppdu_type_comp_mode == 1 && ul_dl == 0) ||
  1719. (ppdu_type_comp_mode == 2 && ul_dl == 0) ||
  1720. (ppdu_type_comp_mode == 1 && ul_dl == 1))
  1721. return true;
  1722. return false;
  1723. }
  1724. static inline bool hal_rx_is_mu_mimo_user(struct hal_soc *hal_soc,
  1725. struct hal_rx_ppdu_info *ppdu_info)
  1726. {
  1727. if (ppdu_info->u_sig_info.ppdu_type_comp_mode == 2 &&
  1728. ppdu_info->u_sig_info.ul_dl == 0)
  1729. return true;
  1730. return false;
  1731. }
  1732. static inline bool
  1733. hal_rx_is_frame_type_ndp(struct hal_soc *hal_soc,
  1734. struct hal_rx_ppdu_info *ppdu_info)
  1735. {
  1736. if (ppdu_info->u_sig_info.ppdu_type_comp_mode == 1 &&
  1737. ppdu_info->u_sig_info.eht_sig_mcs == 0 &&
  1738. ppdu_info->u_sig_info.num_eht_sig_sym == 0)
  1739. return true;
  1740. return false;
  1741. }
  1742. static inline uint32_t
  1743. hal_rx_parse_eht_sig_ndp(struct hal_soc *hal_soc, void *tlv,
  1744. struct hal_rx_ppdu_info *ppdu_info)
  1745. {
  1746. struct hal_eht_sig_ndp_cmn_eb *eht_sig_ndp =
  1747. (struct hal_eht_sig_ndp_cmn_eb *)tlv;
  1748. ppdu_info->rx_status.eht_known |=
  1749. QDF_MON_STATUS_EHT_SPATIAL_REUSE_KNOWN |
  1750. QDF_MON_STATUS_EHT_EHT_LTF_KNOWN |
  1751. QDF_MON_STATUS_EHT_NDP_NSS_KNOWN |
  1752. QDF_MON_STATUS_EHT_NDP_BEAMFORMED_KNOWN |
  1753. QDF_MON_STATUS_EHT_NDP_DISREGARD_KNOWN |
  1754. QDF_MON_STATUS_EHT_CRC1_KNOWN |
  1755. QDF_MON_STATUS_EHT_TAIL1_KNOWN;
  1756. ppdu_info->rx_status.eht_data[0] |= (eht_sig_ndp->spatial_reuse <<
  1757. QDF_MON_STATUS_EHT_SPATIAL_REUSE_SHIFT);
  1758. /*
  1759. * GI and LTF size are separately indicated in radiotap header
  1760. * and hence will be parsed from other TLV
  1761. **/
  1762. ppdu_info->rx_status.eht_data[0] |= (eht_sig_ndp->num_ltf_sym <<
  1763. QDF_MON_STATUS_EHT_EHT_LTF_SHIFT);
  1764. ppdu_info->rx_status.eht_data[0] |= (0xF <<
  1765. QDF_MON_STATUS_EHT_NDP_DISREGARD_SHIFT);
  1766. ppdu_info->rx_status.eht_data[7] |= (eht_sig_ndp->nss <<
  1767. QDF_MON_STATUS_EHT_NDP_NSS_SHIFT);
  1768. ppdu_info->rx_status.eht_data[7] |= (eht_sig_ndp->beamformed <<
  1769. QDF_MON_STATUS_EHT_NDP_BEAMFORMED_SHIFT);
  1770. ppdu_info->rx_status.eht_data[0] |= (eht_sig_ndp->crc <<
  1771. QDF_MON_STATUS_EHT_CRC1_SHIFT);
  1772. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1773. }
  1774. #ifdef WLAN_FEATURE_11BE
  1775. static inline void
  1776. hal_rx_parse_punctured_pattern(struct phyrx_common_user_info *cmn_usr_info,
  1777. struct hal_rx_ppdu_info *ppdu_info)
  1778. {
  1779. ppdu_info->rx_status.punctured_pattern = cmn_usr_info->puncture_bitmap;
  1780. }
  1781. #else
  1782. static inline void
  1783. hal_rx_parse_punctured_pattern(struct phyrx_common_user_info *cmn_usr_info,
  1784. struct hal_rx_ppdu_info *ppdu_info)
  1785. {
  1786. }
  1787. #endif
  1788. static inline uint32_t
  1789. hal_rx_parse_cmn_usr_info(struct hal_soc *hal_soc, uint8_t *tlv,
  1790. struct hal_rx_ppdu_info *ppdu_info)
  1791. {
  1792. struct phyrx_common_user_info *cmn_usr_info =
  1793. (struct phyrx_common_user_info *)tlv;
  1794. ppdu_info->rx_status.eht_known |=
  1795. QDF_MON_STATUS_EHT_GUARD_INTERVAL_KNOWN |
  1796. QDF_MON_STATUS_EHT_LTF_KNOWN;
  1797. ppdu_info->rx_status.eht_data[0] |= (cmn_usr_info->cp_setting <<
  1798. QDF_MON_STATUS_EHT_GI_SHIFT);
  1799. if (!ppdu_info->rx_status.sgi)
  1800. ppdu_info->rx_status.sgi = cmn_usr_info->cp_setting;
  1801. ppdu_info->rx_status.eht_data[0] |= (cmn_usr_info->ltf_size <<
  1802. QDF_MON_STATUS_EHT_LTF_SHIFT);
  1803. if (!ppdu_info->rx_status.ltf_size)
  1804. ppdu_info->rx_status.ltf_size = cmn_usr_info->ltf_size;
  1805. hal_rx_parse_punctured_pattern(cmn_usr_info, ppdu_info);
  1806. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1807. }
  1808. #ifdef WLAN_FEATURE_11BE
  1809. static inline void
  1810. hal_rx_ul_ofdma_ru_size_to_width(uint32_t ru_size,
  1811. uint32_t *ru_width)
  1812. {
  1813. uint32_t width;
  1814. width = 0;
  1815. switch (ru_size) {
  1816. case IEEE80211_EHT_RU_26:
  1817. width = RU_26;
  1818. break;
  1819. case IEEE80211_EHT_RU_52:
  1820. width = RU_52;
  1821. break;
  1822. case IEEE80211_EHT_RU_52_26:
  1823. width = RU_52_26;
  1824. break;
  1825. case IEEE80211_EHT_RU_106:
  1826. width = RU_106;
  1827. break;
  1828. case IEEE80211_EHT_RU_106_26:
  1829. width = RU_106_26;
  1830. break;
  1831. case IEEE80211_EHT_RU_242:
  1832. width = RU_242;
  1833. break;
  1834. case IEEE80211_EHT_RU_484:
  1835. width = RU_484;
  1836. break;
  1837. case IEEE80211_EHT_RU_484_242:
  1838. width = RU_484_242;
  1839. break;
  1840. case IEEE80211_EHT_RU_996:
  1841. width = RU_996;
  1842. break;
  1843. case IEEE80211_EHT_RU_996_484:
  1844. width = RU_996_484;
  1845. break;
  1846. case IEEE80211_EHT_RU_996_484_242:
  1847. width = RU_996_484_242;
  1848. break;
  1849. case IEEE80211_EHT_RU_996x2:
  1850. width = RU_2X996;
  1851. break;
  1852. case IEEE80211_EHT_RU_996x2_484:
  1853. width = RU_2X996_484;
  1854. break;
  1855. case IEEE80211_EHT_RU_996x3:
  1856. width = RU_3X996;
  1857. break;
  1858. case IEEE80211_EHT_RU_996x3_484:
  1859. width = RU_3X996_484;
  1860. break;
  1861. case IEEE80211_EHT_RU_996x4:
  1862. width = RU_4X996;
  1863. break;
  1864. default:
  1865. hal_err_rl("RU size(%d) to width convert err", ru_size);
  1866. break;
  1867. }
  1868. *ru_width = width;
  1869. }
  1870. #else
  1871. static inline void
  1872. hal_rx_ul_ofdma_ru_size_to_width(uint32_t ru_size,
  1873. uint32_t *ru_width)
  1874. {
  1875. *ru_width = 0;
  1876. }
  1877. #endif
  1878. static inline enum ieee80211_eht_ru_size
  1879. hal_rx_mon_hal_ru_size_to_ieee80211_ru_size(struct hal_soc *hal_soc,
  1880. uint32_t hal_ru_size)
  1881. {
  1882. switch (hal_ru_size) {
  1883. case HAL_EHT_RU_26:
  1884. return IEEE80211_EHT_RU_26;
  1885. case HAL_EHT_RU_52:
  1886. return IEEE80211_EHT_RU_52;
  1887. case HAL_EHT_RU_78:
  1888. return IEEE80211_EHT_RU_52_26;
  1889. case HAL_EHT_RU_106:
  1890. return IEEE80211_EHT_RU_106;
  1891. case HAL_EHT_RU_132:
  1892. return IEEE80211_EHT_RU_106_26;
  1893. case HAL_EHT_RU_242:
  1894. return IEEE80211_EHT_RU_242;
  1895. case HAL_EHT_RU_484:
  1896. return IEEE80211_EHT_RU_484;
  1897. case HAL_EHT_RU_726:
  1898. return IEEE80211_EHT_RU_484_242;
  1899. case HAL_EHT_RU_996:
  1900. return IEEE80211_EHT_RU_996;
  1901. case HAL_EHT_RU_996x2:
  1902. return IEEE80211_EHT_RU_996x2;
  1903. case HAL_EHT_RU_996x3:
  1904. return IEEE80211_EHT_RU_996x3;
  1905. case HAL_EHT_RU_996x4:
  1906. return IEEE80211_EHT_RU_996x4;
  1907. case HAL_EHT_RU_NONE:
  1908. return IEEE80211_EHT_RU_INVALID;
  1909. case HAL_EHT_RU_996_484:
  1910. return IEEE80211_EHT_RU_996_484;
  1911. case HAL_EHT_RU_996x2_484:
  1912. return IEEE80211_EHT_RU_996x2_484;
  1913. case HAL_EHT_RU_996x3_484:
  1914. return IEEE80211_EHT_RU_996x3_484;
  1915. case HAL_EHT_RU_996_484_242:
  1916. return IEEE80211_EHT_RU_996_484_242;
  1917. default:
  1918. return IEEE80211_EHT_RU_INVALID;
  1919. }
  1920. }
  1921. #define HAL_SET_RU_PER80(ru_320mhz, ru_per80, ru_idx_per80mhz, num_80mhz) \
  1922. ((ru_320mhz) |= ((uint64_t)(ru_per80) << \
  1923. (((num_80mhz) * NUM_RU_BITS_PER80) + \
  1924. ((ru_idx_per80mhz) * NUM_RU_BITS_PER20))))
  1925. static inline uint32_t
  1926. hal_rx_parse_receive_user_info(struct hal_soc *hal_soc, uint8_t *tlv,
  1927. struct hal_rx_ppdu_info *ppdu_info,
  1928. uint32_t user_id)
  1929. {
  1930. struct receive_user_info *rx_usr_info = (struct receive_user_info *)tlv;
  1931. struct mon_rx_user_status *mon_rx_user_status = NULL;
  1932. uint64_t ru_index_320mhz = 0;
  1933. uint16_t ru_index_per80mhz;
  1934. uint32_t ru_size = 0, num_80mhz_with_ru = 0;
  1935. uint32_t ru_index = HAL_EHT_RU_INVALID;
  1936. uint32_t rtap_ru_size = IEEE80211_EHT_RU_INVALID;
  1937. uint32_t ru_width;
  1938. if (ppdu_info->rx_status.user_info_skip)
  1939. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1940. switch (rx_usr_info->reception_type) {
  1941. case HAL_RECEPTION_TYPE_SU:
  1942. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  1943. break;
  1944. case HAL_RECEPTION_TYPE_DL_MU_MIMO:
  1945. ppdu_info->rx_status.mu_dl_ul = HAL_RX_TYPE_DL;
  1946. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  1947. break;
  1948. case HAL_RECEPTION_TYPE_UL_MU_MIMO:
  1949. ppdu_info->rx_status.mu_dl_ul = HAL_RX_TYPE_UL;
  1950. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  1951. break;
  1952. case HAL_RECEPTION_TYPE_DL_MU_OFMA:
  1953. ppdu_info->rx_status.mu_dl_ul = HAL_RX_TYPE_DL;
  1954. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_OFDMA;
  1955. break;
  1956. case HAL_RECEPTION_TYPE_UL_MU_OFDMA:
  1957. ppdu_info->rx_status.mu_dl_ul = HAL_RX_TYPE_UL;
  1958. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_OFDMA;
  1959. break;
  1960. case HAL_RECEPTION_TYPE_DL_MU_OFDMA_MIMO:
  1961. ppdu_info->rx_status.mu_dl_ul = HAL_RX_TYPE_DL;
  1962. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_OFDMA_MIMO;
  1963. break;
  1964. case HAL_RECEPTION_TYPE_UL_MU_OFDMA_MIMO:
  1965. ppdu_info->rx_status.mu_dl_ul = HAL_RX_TYPE_UL;
  1966. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_OFDMA_MIMO;
  1967. break;
  1968. }
  1969. ppdu_info->start_user_info_cnt++;
  1970. ppdu_info->rx_status.is_stbc = rx_usr_info->stbc;
  1971. ppdu_info->rx_status.ldpc = rx_usr_info->ldpc;
  1972. ppdu_info->rx_status.dcm = rx_usr_info->sta_dcm;
  1973. ppdu_info->rx_status.mcs = rx_usr_info->rate_mcs;
  1974. ppdu_info->rx_status.nss = rx_usr_info->nss + 1;
  1975. if (user_id < HAL_MAX_UL_MU_USERS) {
  1976. mon_rx_user_status =
  1977. &ppdu_info->rx_user_status[user_id];
  1978. mon_rx_user_status->eht_known |=
  1979. QDF_MON_STATUS_EHT_CONTENT_CH_INDEX_KNOWN;
  1980. mon_rx_user_status->eht_data[0] |=
  1981. (rx_usr_info->dl_ofdma_content_channel <<
  1982. QDF_MON_STATUS_EHT_CONTENT_CH_INDEX_SHIFT);
  1983. mon_rx_user_status->is_stbc =
  1984. ppdu_info->rx_status.is_stbc;
  1985. mon_rx_user_status->ldpc =
  1986. ppdu_info->rx_status.ldpc;
  1987. mon_rx_user_status->dcm =
  1988. ppdu_info->rx_status.dcm;
  1989. mon_rx_user_status->mcs = ppdu_info->rx_status.mcs;
  1990. mon_rx_user_status->nss = ppdu_info->rx_status.nss;
  1991. }
  1992. if (!(ppdu_info->rx_status.reception_type == HAL_RX_TYPE_MU_MIMO ||
  1993. ppdu_info->rx_status.reception_type == HAL_RX_TYPE_MU_OFDMA ||
  1994. ppdu_info->rx_status.reception_type == HAL_RX_TYPE_MU_OFDMA_MIMO))
  1995. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1996. /* RU allocation present only for OFDMA reception */
  1997. if (rx_usr_info->ru_type_80_0 != HAL_EHT_RU_NONE) {
  1998. ru_size += rx_usr_info->ru_type_80_0;
  1999. ru_index = ru_index_per80mhz = rx_usr_info->ru_start_index_80_0;
  2000. HAL_SET_RU_PER80(ru_index_320mhz, rx_usr_info->ru_type_80_0,
  2001. ru_index_per80mhz, 0);
  2002. num_80mhz_with_ru++;
  2003. }
  2004. if (rx_usr_info->ru_type_80_1 != HAL_EHT_RU_NONE) {
  2005. ru_size += rx_usr_info->ru_type_80_1;
  2006. ru_index = ru_index_per80mhz = rx_usr_info->ru_start_index_80_1;
  2007. HAL_SET_RU_PER80(ru_index_320mhz, rx_usr_info->ru_type_80_1,
  2008. ru_index_per80mhz, 1);
  2009. num_80mhz_with_ru++;
  2010. }
  2011. if (rx_usr_info->ru_type_80_2 != HAL_EHT_RU_NONE) {
  2012. ru_size += rx_usr_info->ru_type_80_2;
  2013. ru_index = ru_index_per80mhz = rx_usr_info->ru_start_index_80_2;
  2014. HAL_SET_RU_PER80(ru_index_320mhz, rx_usr_info->ru_type_80_2,
  2015. ru_index_per80mhz, 2);
  2016. num_80mhz_with_ru++;
  2017. }
  2018. if (rx_usr_info->ru_type_80_3 != HAL_EHT_RU_NONE) {
  2019. ru_size += rx_usr_info->ru_type_80_3;
  2020. ru_index = ru_index_per80mhz = rx_usr_info->ru_start_index_80_3;
  2021. HAL_SET_RU_PER80(ru_index_320mhz, rx_usr_info->ru_type_80_3,
  2022. ru_index_per80mhz, 3);
  2023. num_80mhz_with_ru++;
  2024. }
  2025. if (num_80mhz_with_ru > 1) {
  2026. /* Calculate the MRU index */
  2027. switch (ru_index_320mhz) {
  2028. case HAL_EHT_RU_996_484_0:
  2029. case HAL_EHT_RU_996x2_484_0:
  2030. case HAL_EHT_RU_996x3_484_0:
  2031. ru_index = 0;
  2032. break;
  2033. case HAL_EHT_RU_996_484_1:
  2034. case HAL_EHT_RU_996x2_484_1:
  2035. case HAL_EHT_RU_996x3_484_1:
  2036. ru_index = 1;
  2037. break;
  2038. case HAL_EHT_RU_996_484_2:
  2039. case HAL_EHT_RU_996x2_484_2:
  2040. case HAL_EHT_RU_996x3_484_2:
  2041. ru_index = 2;
  2042. break;
  2043. case HAL_EHT_RU_996_484_3:
  2044. case HAL_EHT_RU_996x2_484_3:
  2045. case HAL_EHT_RU_996x3_484_3:
  2046. ru_index = 3;
  2047. break;
  2048. case HAL_EHT_RU_996_484_4:
  2049. case HAL_EHT_RU_996x2_484_4:
  2050. case HAL_EHT_RU_996x3_484_4:
  2051. ru_index = 4;
  2052. break;
  2053. case HAL_EHT_RU_996_484_5:
  2054. case HAL_EHT_RU_996x2_484_5:
  2055. case HAL_EHT_RU_996x3_484_5:
  2056. ru_index = 5;
  2057. break;
  2058. case HAL_EHT_RU_996_484_6:
  2059. case HAL_EHT_RU_996x2_484_6:
  2060. case HAL_EHT_RU_996x3_484_6:
  2061. ru_index = 6;
  2062. break;
  2063. case HAL_EHT_RU_996_484_7:
  2064. case HAL_EHT_RU_996x2_484_7:
  2065. case HAL_EHT_RU_996x3_484_7:
  2066. ru_index = 7;
  2067. break;
  2068. case HAL_EHT_RU_996x2_484_8:
  2069. ru_index = 8;
  2070. break;
  2071. case HAL_EHT_RU_996x2_484_9:
  2072. ru_index = 9;
  2073. break;
  2074. case HAL_EHT_RU_996x2_484_10:
  2075. ru_index = 10;
  2076. break;
  2077. case HAL_EHT_RU_996x2_484_11:
  2078. ru_index = 11;
  2079. break;
  2080. default:
  2081. ru_index = HAL_EHT_RU_INVALID;
  2082. dp_debug("Invalid RU index");
  2083. qdf_assert(0);
  2084. break;
  2085. }
  2086. ru_size += 4;
  2087. }
  2088. rtap_ru_size = hal_rx_mon_hal_ru_size_to_ieee80211_ru_size(hal_soc,
  2089. ru_size);
  2090. if (rx_usr_info->pkt_type == HAL_RX_PKT_TYPE_11AX &&
  2091. mon_rx_user_status) {
  2092. if (ru_index != HAL_EHT_RU_INVALID) {
  2093. mon_rx_user_status->he_data2 |=
  2094. QDF_MON_STATUS_RU_ALLOCATION_OFFSET_KNOWN;
  2095. mon_rx_user_status->he_data2 |=
  2096. ru_index << QDF_MON_STATUS_RU_ALLOCATION_SHIFT;
  2097. }
  2098. }
  2099. if (rx_usr_info->pkt_type == HAL_RX_PKT_TYPE_11BE &&
  2100. mon_rx_user_status) {
  2101. if (rtap_ru_size != IEEE80211_EHT_RU_INVALID) {
  2102. mon_rx_user_status->eht_known |=
  2103. QDF_MON_STATUS_EHT_RU_MRU_SIZE_KNOWN;
  2104. mon_rx_user_status->eht_data[1] |= (rtap_ru_size <<
  2105. QDF_MON_STATUS_EHT_RU_MRU_SIZE_SHIFT);
  2106. }
  2107. if (ru_index != HAL_EHT_RU_INVALID) {
  2108. mon_rx_user_status->eht_known |=
  2109. QDF_MON_STATUS_EHT_RU_MRU_INDEX_KNOWN;
  2110. mon_rx_user_status->eht_data[1] |= (ru_index <<
  2111. QDF_MON_STATUS_EHT_RU_MRU_INDEX_SHIFT);
  2112. }
  2113. }
  2114. if (rx_usr_info->pkt_type == HAL_RX_PKT_TYPE_11AX &&
  2115. mon_rx_user_status) {
  2116. if (ppdu_info->rx_status.reception_type ==
  2117. HAL_RX_TYPE_MU_MIMO) {
  2118. ppdu_info->rx_status.he_mu_flags = 1;
  2119. /* HE-data1 */
  2120. mon_rx_user_status->he_data1 |=
  2121. QDF_MON_STATUS_HE_MCS_KNOWN |
  2122. QDF_MON_STATUS_HE_CODING_KNOWN;
  2123. /* HE-data2 */
  2124. /* HE-data3 */
  2125. mon_rx_user_status->he_data3 |=
  2126. mon_rx_user_status->mcs <<
  2127. QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  2128. mon_rx_user_status->he_data3 |=
  2129. ppdu_info->rx_status.ldpc <<
  2130. QDF_MON_STATUS_CODING_SHIFT;
  2131. /* HE-data4 */
  2132. mon_rx_user_status->he_data4 |=
  2133. mon_rx_user_status->sta_id <<
  2134. QDF_MON_STATUS_STA_ID_SHIFT;
  2135. /* HE-data5 */
  2136. /* HE-data6 */
  2137. mon_rx_user_status->he_data6 |=
  2138. mon_rx_user_status->nss <<
  2139. QDF_MON_STATUS_HE_DATA_6_NSS_SHIFT;
  2140. }
  2141. if (ppdu_info->rx_status.reception_type ==
  2142. HAL_RX_TYPE_MU_OFDMA) {
  2143. ppdu_info->rx_status.he_mu_flags = 1;
  2144. /* HE-data1 */
  2145. mon_rx_user_status->he_data1 |=
  2146. QDF_MON_STATUS_HE_MCS_KNOWN |
  2147. QDF_MON_STATUS_HE_DCM_KNOWN |
  2148. QDF_MON_STATUS_HE_CODING_KNOWN;
  2149. /* HE-data2 */
  2150. /* HE-data3 */
  2151. mon_rx_user_status->he_data3 |=
  2152. mon_rx_user_status->mcs <<
  2153. QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  2154. mon_rx_user_status->he_data3 |=
  2155. mon_rx_user_status->dcm <<
  2156. QDF_MON_STATUS_DCM_SHIFT;
  2157. mon_rx_user_status->he_data3 |=
  2158. mon_rx_user_status->ldpc <<
  2159. QDF_MON_STATUS_CODING_SHIFT;
  2160. /* HE-data4 */
  2161. mon_rx_user_status->he_data4 |=
  2162. mon_rx_user_status->sta_id <<
  2163. QDF_MON_STATUS_STA_ID_SHIFT;
  2164. /* HE-data5 */
  2165. //txbf not exist
  2166. mon_rx_user_status->he_data5 |=
  2167. mon_rx_user_status->beamformed <<
  2168. QDF_MON_STATUS_TXBF_SHIFT;
  2169. /* HE-data6 */
  2170. mon_rx_user_status->he_data6 |=
  2171. mon_rx_user_status->nss <<
  2172. QDF_MON_STATUS_HE_DATA_6_NSS_SHIFT;
  2173. mon_rx_user_status->he_flags1 =
  2174. ppdu_info->rx_status.he_flags1;
  2175. mon_rx_user_status->he_flags2 =
  2176. ppdu_info->rx_status.he_flags2;
  2177. }
  2178. }
  2179. if (mon_rx_user_status && ru_index != HAL_EHT_RU_INVALID &&
  2180. rtap_ru_size != IEEE80211_EHT_RU_INVALID) {
  2181. mon_rx_user_status->ofdma_ru_start_index = ru_index;
  2182. mon_rx_user_status->ofdma_ru_size = rtap_ru_size;
  2183. hal_rx_ul_ofdma_ru_size_to_width(rtap_ru_size, &ru_width);
  2184. mon_rx_user_status->ofdma_ru_width = ru_width;
  2185. mon_rx_user_status->mu_ul_info_valid = 1;
  2186. }
  2187. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  2188. }
  2189. #ifdef WLAN_PKT_CAPTURE_RX_2_0
  2190. static inline void
  2191. hal_rx_status_get_mpdu_retry_cnt(struct hal_rx_ppdu_info *ppdu_info,
  2192. hal_rx_mon_ppdu_end_user_t *rx_ppdu_end_user)
  2193. {
  2194. ppdu_info->rx_status.mpdu_retry_cnt =
  2195. rx_ppdu_end_user->retried_mpdu_count;
  2196. }
  2197. static inline void
  2198. hal_rx_status_get_mon_buf_addr(uint8_t *rx_tlv,
  2199. struct hal_rx_ppdu_info *ppdu_info)
  2200. {
  2201. struct mon_buffer_addr *addr = (struct mon_buffer_addr *)rx_tlv;
  2202. ppdu_info->packet_info.sw_cookie =
  2203. (((uint64_t)addr->buffer_virt_addr_63_32 << 32) |
  2204. (addr->buffer_virt_addr_31_0));
  2205. /* HW DMA length is '-1' of actual DMA length*/
  2206. ppdu_info->packet_info.dma_length = addr->dma_length + 1;
  2207. ppdu_info->packet_info.msdu_continuation = addr->msdu_continuation;
  2208. ppdu_info->packet_info.truncated = addr->truncated;
  2209. }
  2210. static inline void
  2211. hal_rx_update_ppdu_drop_cnt(uint8_t *rx_tlv,
  2212. struct hal_rx_ppdu_info *ppdu_info)
  2213. {
  2214. struct mon_drop *drop_cnt = (struct mon_drop *)rx_tlv;
  2215. ppdu_info->drop_cnt.ppdu_drop_cnt = drop_cnt->ppdu_drop_cnt;
  2216. ppdu_info->drop_cnt.mpdu_drop_cnt = drop_cnt->mpdu_drop_cnt;
  2217. ppdu_info->drop_cnt.end_of_ppdu_drop_cnt = drop_cnt->end_of_ppdu_seen;
  2218. ppdu_info->drop_cnt.tlv_drop_cnt = drop_cnt->tlv_drop_cnt;
  2219. }
  2220. #else
  2221. static inline void
  2222. hal_rx_status_get_mpdu_retry_cnt(struct hal_rx_ppdu_info *ppdu_info,
  2223. hal_rx_mon_ppdu_end_user_t *rx_ppdu_end_user)
  2224. {
  2225. ppdu_info->rx_status.mpdu_retry_cnt = 0;
  2226. }
  2227. static inline void
  2228. hal_rx_status_get_mon_buf_addr(uint8_t *rx_tlv,
  2229. struct hal_rx_ppdu_info *ppdu_info)
  2230. {
  2231. }
  2232. static inline void
  2233. hal_rx_update_ppdu_drop_cnt(uint8_t *rx_tlv,
  2234. struct hal_rx_ppdu_info *ppdu_info)
  2235. {
  2236. }
  2237. #endif
  2238. #ifdef WLAN_SUPPORT_CTRL_FRAME_STATS
  2239. static inline void
  2240. hal_update_rx_ctrl_frame_stats(struct hal_rx_ppdu_info *ppdu_info,
  2241. uint32_t user_id)
  2242. {
  2243. uint16_t fc = ppdu_info->nac_info.frame_control;
  2244. if (HAL_RX_GET_FRAME_CTRL_TYPE(fc) == HAL_RX_FRAME_CTRL_TYPE_CTRL) {
  2245. if ((fc & QDF_IEEE80211_FC0_SUBTYPE_MASK) ==
  2246. QDF_IEEE80211_FC0_SUBTYPE_VHT_NDP_AN)
  2247. ppdu_info->ctrl_frm_info[user_id].ndpa = 1;
  2248. if ((fc & QDF_IEEE80211_FC0_SUBTYPE_MASK) ==
  2249. QDF_IEEE80211_FC0_SUBTYPE_BAR)
  2250. ppdu_info->ctrl_frm_info[user_id].bar = 1;
  2251. }
  2252. }
  2253. #else
  2254. static inline void
  2255. hal_update_rx_ctrl_frame_stats(struct hal_rx_ppdu_info *ppdu_info,
  2256. uint32_t user_id)
  2257. {
  2258. }
  2259. #endif /* WLAN_SUPPORT_CTRL_FRAME_STATS */
  2260. #ifdef MONITOR_TLV_RECORDING_ENABLE
  2261. /**
  2262. * hal_rx_record_tlv_info() - Record received TLV info
  2263. * @ppdu_info: pointer to ppdu_info
  2264. * @tlv_tag: TLV tag of the TLV to record
  2265. *
  2266. * Return
  2267. */
  2268. static inline void
  2269. hal_rx_record_tlv_info(struct hal_rx_ppdu_info *ppdu_info, uint32_t tlv_tag) {
  2270. ppdu_info->rx_tlv_info.tlv_tag = tlv_tag;
  2271. switch (tlv_tag) {
  2272. case WIFIRX_PPDU_START_E:
  2273. case WIFIRX_PPDU_START_USER_INFO_E:
  2274. ppdu_info->rx_tlv_info.tlv_category = CATEGORY_PPDU_START;
  2275. break;
  2276. case WIFIRX_HEADER_E:
  2277. case WIFIRX_MPDU_START_E:
  2278. case WIFIMON_BUFFER_ADDR_E:
  2279. case WIFIRX_MSDU_END_E:
  2280. case WIFIRX_MPDU_END_E:
  2281. ppdu_info->rx_tlv_info.tlv_category = CATEGORY_MPDU;
  2282. break;
  2283. case WIFIRX_USER_PPDU_END_E:
  2284. case WIFIRX_PPDU_END_E:
  2285. case WIFIPHYRX_RSSI_LEGACY_E:
  2286. case WIFIPHYRX_L_SIG_B_E:
  2287. case WIFIPHYRX_COMMON_USER_INFO_E:
  2288. case WIFIPHYRX_DATA_DONE_E:
  2289. case WIFIPHYRX_PKT_END_PART1_E:
  2290. case WIFIPHYRX_PKT_END_E:
  2291. case WIFIRXPCU_PPDU_END_INFO_E:
  2292. case WIFIRX_PPDU_END_USER_STATS_E:
  2293. case WIFIRX_PPDU_END_STATUS_DONE_E:
  2294. ppdu_info->rx_tlv_info.tlv_category = CATEGORY_PPDU_END;
  2295. break;
  2296. }
  2297. }
  2298. #else
  2299. static inline void
  2300. hal_rx_record_tlv_info(struct hal_rx_ppdu_info *ppdu_info, uint32_t tlv_tag) {
  2301. }
  2302. #endif
  2303. #ifdef HE_SIG_A_MU_UL_INFO_FORMAT_INDICATION_OFFSET
  2304. /**
  2305. * hal_rx_he_sig_a_mu_ul_e_handle() - handle TLV info for he_sig_a_mu_ul_info
  2306. * @ppdu_info: pointer to ppdu_info
  2307. * @rx_tlv: pointer to tlv
  2308. *
  2309. * Return
  2310. */
  2311. static inline void
  2312. hal_rx_he_sig_a_mu_ul_e_handle(struct hal_rx_ppdu_info *ppdu_info,
  2313. uint8_t *rx_tlv) {
  2314. uint32_t value;
  2315. uint8_t *he_sig_a_mu_ul_info = (uint8_t *)rx_tlv;
  2316. ppdu_info->rx_status.he_flags = 1;
  2317. ppdu_info->rx_status.user_info_skip = 1;
  2318. value = HAL_RX_GET(he_sig_a_mu_ul_info, HE_SIG_A_MU_UL_INFO,
  2319. FORMAT_INDICATION);
  2320. if (value == 0) {
  2321. ppdu_info->rx_status.he_data1 =
  2322. QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
  2323. } else {
  2324. ppdu_info->rx_status.he_data1 =
  2325. QDF_MON_STATUS_HE_SU_FORMAT_TYPE;
  2326. }
  2327. /* data1 */
  2328. ppdu_info->rx_status.he_data1 |=
  2329. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  2330. QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN;
  2331. /* data2 */
  2332. ppdu_info->rx_status.he_data2 |=
  2333. QDF_MON_STATUS_TXOP_KNOWN;
  2334. /* data3 */
  2335. value = HAL_RX_GET(he_sig_a_mu_ul_info,
  2336. HE_SIG_A_MU_UL_INFO, BSS_COLOR_ID);
  2337. ppdu_info->rx_status.he_data3 = value;
  2338. /* data4 */
  2339. /* data5 */
  2340. value = HAL_RX_GET(he_sig_a_mu_ul_info,
  2341. HE_SIG_A_MU_UL_INFO, TRANSMIT_BW);
  2342. ppdu_info->rx_status.he_data5 = value;
  2343. ppdu_info->rx_status.bw = value;
  2344. /* data6 */
  2345. value = HAL_RX_GET(he_sig_a_mu_ul_info, HE_SIG_A_MU_UL_INFO,
  2346. TXOP_DURATION);
  2347. value = value << QDF_MON_STATUS_TXOP_SHIFT;
  2348. ppdu_info->rx_status.he_data6 |= value;
  2349. ppdu_info->rx_status.mu_dl_ul = HAL_RX_TYPE_UL;
  2350. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  2351. }
  2352. #else
  2353. static inline void
  2354. hal_rx_he_sig_a_mu_ul_e_handle(struct hal_rx_ppdu_info *ppdu_info,
  2355. uint8_t *rx_tlv) {
  2356. }
  2357. #endif
  2358. /**
  2359. * hal_rx_status_get_tlv_info_generic_be() - process receive info TLV
  2360. * @rx_tlv_hdr: pointer to TLV header
  2361. * @ppduinfo: pointer to ppdu_info
  2362. * @hal_soc_hdl: HAL version of the SOC pointer
  2363. * @nbuf: Network buffer
  2364. *
  2365. * Return: HAL_TLV_STATUS_PPDU_NOT_DONE or HAL_TLV_STATUS_PPDU_DONE from tlv
  2366. */
  2367. static inline uint32_t
  2368. hal_rx_status_get_tlv_info_generic_be(void *rx_tlv_hdr, void *ppduinfo,
  2369. hal_soc_handle_t hal_soc_hdl,
  2370. qdf_nbuf_t nbuf)
  2371. {
  2372. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2373. uint32_t tlv_tag, user_id, tlv_len, value;
  2374. uint8_t group_id = 0;
  2375. uint8_t he_dcm = 0;
  2376. uint8_t he_stbc = 0;
  2377. uint16_t he_gi = 0;
  2378. uint16_t he_ltf = 0;
  2379. void *rx_tlv;
  2380. struct mon_rx_user_status *mon_rx_user_status;
  2381. struct hal_rx_ppdu_info *ppdu_info =
  2382. (struct hal_rx_ppdu_info *)ppduinfo;
  2383. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv_hdr);
  2384. user_id = HAL_RX_GET_USER_TLV32_USERID(rx_tlv_hdr);
  2385. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv_hdr);
  2386. rx_tlv = (uint8_t *)rx_tlv_hdr + HAL_RX_TLV_HDR_SIZE;
  2387. ppdu_info->user_id = user_id;
  2388. switch (tlv_tag) {
  2389. case WIFIRX_PPDU_START_E:
  2390. {
  2391. if (qdf_unlikely(ppdu_info->com_info.last_ppdu_id ==
  2392. HAL_RX_GET_64(rx_tlv, RX_PPDU_START, PHY_PPDU_ID)))
  2393. hal_err("Matching ppdu_id(%u) detected",
  2394. ppdu_info->com_info.last_ppdu_id);
  2395. ppdu_info->com_info.last_ppdu_id =
  2396. ppdu_info->com_info.ppdu_id =
  2397. HAL_RX_GET_64(rx_tlv, RX_PPDU_START,
  2398. PHY_PPDU_ID);
  2399. /* channel number is set in PHY meta data */
  2400. ppdu_info->rx_status.chan_num =
  2401. (HAL_RX_GET_64(rx_tlv, RX_PPDU_START,
  2402. SW_PHY_META_DATA) & 0x0000FFFF);
  2403. ppdu_info->rx_status.chan_freq =
  2404. (HAL_RX_GET_64(rx_tlv, RX_PPDU_START,
  2405. SW_PHY_META_DATA) & 0xFFFF0000) >> 16;
  2406. if (ppdu_info->rx_status.chan_num &&
  2407. ppdu_info->rx_status.chan_freq) {
  2408. ppdu_info->rx_status.chan_freq =
  2409. hal_rx_radiotap_num_to_freq(
  2410. ppdu_info->rx_status.chan_num,
  2411. ppdu_info->rx_status.chan_freq);
  2412. }
  2413. ppdu_info->com_info.ppdu_timestamp =
  2414. HAL_RX_GET_64(rx_tlv, RX_PPDU_START,
  2415. PPDU_START_TIMESTAMP_31_0);
  2416. ppdu_info->rx_status.ppdu_timestamp =
  2417. ppdu_info->com_info.ppdu_timestamp;
  2418. ppdu_info->rx_state = HAL_RX_MON_PPDU_START;
  2419. break;
  2420. }
  2421. case WIFIRX_PPDU_START_USER_INFO_E:
  2422. hal_rx_parse_receive_user_info(hal, rx_tlv, ppdu_info, user_id);
  2423. break;
  2424. case WIFIRX_PPDU_END_E:
  2425. /* This is followed by sub-TLVs of PPDU_END */
  2426. ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
  2427. break;
  2428. case WIFIPHYRX_LOCATION_E:
  2429. hal_rx_get_rtt_info(hal_soc_hdl, rx_tlv, ppdu_info);
  2430. break;
  2431. case WIFIRXPCU_PPDU_END_INFO_E:
  2432. ppdu_info->rx_status.rx_antenna =
  2433. HAL_RX_GET_64(rx_tlv, RXPCU_PPDU_END_INFO, RX_ANTENNA);
  2434. ppdu_info->rx_status.tsft =
  2435. HAL_RX_GET_64(rx_tlv, RXPCU_PPDU_END_INFO,
  2436. WB_TIMESTAMP_UPPER_32);
  2437. ppdu_info->rx_status.tsft = (ppdu_info->rx_status.tsft << 32) |
  2438. HAL_RX_GET_64(rx_tlv, RXPCU_PPDU_END_INFO,
  2439. WB_TIMESTAMP_LOWER_32);
  2440. ppdu_info->rx_status.duration =
  2441. HAL_RX_GET_64(rx_tlv, UNIFIED_RXPCU_PPDU_END_INFO_8,
  2442. RX_PPDU_DURATION);
  2443. hal_rx_get_bb_info(hal_soc_hdl, rx_tlv, ppdu_info);
  2444. break;
  2445. /*
  2446. * WIFIRX_PPDU_END_USER_STATS_E comes for each user received.
  2447. * for MU, based on num users we see this tlv that many times.
  2448. */
  2449. case WIFIRX_PPDU_END_USER_STATS_E:
  2450. {
  2451. hal_rx_mon_ppdu_end_user_t *rx_ppdu_end_user = rx_tlv;
  2452. unsigned long tid = 0;
  2453. uint16_t seq = 0;
  2454. ppdu_info->rx_status.ast_index =
  2455. rx_ppdu_end_user->ast_index;
  2456. tid = rx_ppdu_end_user->received_qos_data_tid_bitmap;
  2457. ppdu_info->rx_status.tid = qdf_find_first_bit(&tid,
  2458. sizeof(tid) * 8);
  2459. if (ppdu_info->rx_status.tid == (sizeof(tid) * 8))
  2460. ppdu_info->rx_status.tid = HAL_TID_INVALID;
  2461. ppdu_info->rx_status.tcp_msdu_count =
  2462. rx_ppdu_end_user->tcp_msdu_count +
  2463. rx_ppdu_end_user->tcp_ack_msdu_count;
  2464. ppdu_info->rx_status.udp_msdu_count =
  2465. rx_ppdu_end_user->udp_msdu_count;
  2466. ppdu_info->rx_status.other_msdu_count =
  2467. rx_ppdu_end_user->other_msdu_count;
  2468. hal_rx_status_get_mpdu_retry_cnt(ppdu_info, rx_ppdu_end_user);
  2469. if (ppdu_info->sw_frame_group_id
  2470. != HAL_MPDU_SW_FRAME_GROUP_NULL_DATA) {
  2471. ppdu_info->rx_status.frame_control_info_valid =
  2472. rx_ppdu_end_user->frame_control_info_valid;
  2473. if (ppdu_info->rx_status.frame_control_info_valid)
  2474. ppdu_info->rx_status.frame_control =
  2475. rx_ppdu_end_user->frame_control_field;
  2476. hal_get_qos_control(rx_ppdu_end_user, ppdu_info);
  2477. }
  2478. ppdu_info->rx_status.data_sequence_control_info_valid =
  2479. rx_ppdu_end_user->data_sequence_control_info_valid;
  2480. seq = rx_ppdu_end_user->first_data_seq_ctrl;
  2481. if (ppdu_info->rx_status.data_sequence_control_info_valid)
  2482. ppdu_info->rx_status.first_data_seq_ctrl = seq;
  2483. ppdu_info->rx_status.preamble_type =
  2484. rx_ppdu_end_user->ht_control_field_pkt_type;
  2485. ppdu_info->end_user_stats_cnt++;
  2486. switch (ppdu_info->rx_status.preamble_type) {
  2487. case HAL_RX_PKT_TYPE_11N:
  2488. ppdu_info->rx_status.ht_flags = 1;
  2489. ppdu_info->rx_status.rtap_flags |= HT_SGI_PRESENT;
  2490. break;
  2491. case HAL_RX_PKT_TYPE_11AC:
  2492. ppdu_info->rx_status.vht_flags = 1;
  2493. break;
  2494. case HAL_RX_PKT_TYPE_11AX:
  2495. ppdu_info->rx_status.he_flags = 1;
  2496. break;
  2497. case HAL_RX_PKT_TYPE_11BE:
  2498. ppdu_info->rx_status.eht_flags = 1;
  2499. break;
  2500. default:
  2501. break;
  2502. }
  2503. ppdu_info->com_info.mpdu_cnt_fcs_ok =
  2504. rx_ppdu_end_user->mpdu_cnt_fcs_ok;
  2505. ppdu_info->com_info.mpdu_cnt_fcs_err =
  2506. rx_ppdu_end_user->mpdu_cnt_fcs_err;
  2507. if ((ppdu_info->com_info.mpdu_cnt_fcs_ok |
  2508. ppdu_info->com_info.mpdu_cnt_fcs_err) > 1)
  2509. ppdu_info->rx_status.rs_flags |= IEEE80211_AMPDU_FLAG;
  2510. else
  2511. ppdu_info->rx_status.rs_flags &=
  2512. (~IEEE80211_AMPDU_FLAG);
  2513. ppdu_info->com_info.mpdu_fcs_ok_bitmap[0] =
  2514. rx_ppdu_end_user->fcs_ok_bitmap_31_0;
  2515. ppdu_info->com_info.mpdu_fcs_ok_bitmap[1] =
  2516. rx_ppdu_end_user->fcs_ok_bitmap_63_32;
  2517. if (user_id < HAL_MAX_UL_MU_USERS) {
  2518. mon_rx_user_status =
  2519. &ppdu_info->rx_user_status[user_id];
  2520. hal_rx_handle_mu_ul_info(rx_ppdu_end_user,
  2521. mon_rx_user_status);
  2522. ppdu_info->com_info.num_users++;
  2523. hal_rx_populate_mu_user_info(rx_ppdu_end_user, ppdu_info,
  2524. user_id,
  2525. mon_rx_user_status);
  2526. }
  2527. break;
  2528. }
  2529. case WIFIRX_PPDU_END_USER_STATS_EXT_E:
  2530. ppdu_info->com_info.mpdu_fcs_ok_bitmap[2] =
  2531. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  2532. FCS_OK_BITMAP_95_64);
  2533. ppdu_info->com_info.mpdu_fcs_ok_bitmap[3] =
  2534. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  2535. FCS_OK_BITMAP_127_96);
  2536. ppdu_info->com_info.mpdu_fcs_ok_bitmap[4] =
  2537. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  2538. FCS_OK_BITMAP_159_128);
  2539. ppdu_info->com_info.mpdu_fcs_ok_bitmap[5] =
  2540. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  2541. FCS_OK_BITMAP_191_160);
  2542. ppdu_info->com_info.mpdu_fcs_ok_bitmap[6] =
  2543. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  2544. FCS_OK_BITMAP_223_192);
  2545. ppdu_info->com_info.mpdu_fcs_ok_bitmap[7] =
  2546. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  2547. FCS_OK_BITMAP_255_224);
  2548. break;
  2549. case WIFIRX_PPDU_END_STATUS_DONE_E:
  2550. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  2551. return HAL_TLV_STATUS_PPDU_DONE;
  2552. case WIFIPHYRX_PKT_END_E:
  2553. break;
  2554. case WIFIDUMMY_E:
  2555. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  2556. return HAL_TLV_STATUS_BUF_DONE;
  2557. case WIFIPHYRX_HT_SIG_E:
  2558. {
  2559. uint8_t *ht_sig_info = (uint8_t *)rx_tlv +
  2560. HAL_RX_OFFSET(UNIFIED_PHYRX_HT_SIG_0,
  2561. HT_SIG_INFO_PHYRX_HT_SIG_INFO_DETAILS);
  2562. value = HAL_RX_GET(ht_sig_info, HT_SIG_INFO, FEC_CODING);
  2563. ppdu_info->rx_status.ldpc = (value == HAL_SU_MU_CODING_LDPC) ?
  2564. 1 : 0;
  2565. ppdu_info->rx_status.mcs = HAL_RX_GET(ht_sig_info,
  2566. HT_SIG_INFO, MCS);
  2567. ppdu_info->rx_status.ht_mcs = ppdu_info->rx_status.mcs;
  2568. ppdu_info->rx_status.bw = HAL_RX_GET(ht_sig_info,
  2569. HT_SIG_INFO, CBW);
  2570. ppdu_info->rx_status.sgi = HAL_RX_GET(ht_sig_info,
  2571. HT_SIG_INFO, SHORT_GI);
  2572. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  2573. ppdu_info->rx_status.nss = ((ppdu_info->rx_status.mcs) >>
  2574. HT_SIG_SU_NSS_SHIFT) + 1;
  2575. ppdu_info->rx_status.mcs &= ((1 << HT_SIG_SU_NSS_SHIFT) - 1);
  2576. break;
  2577. }
  2578. case WIFIPHYRX_L_SIG_B_E:
  2579. {
  2580. uint8_t *l_sig_b_info = (uint8_t *)rx_tlv +
  2581. HAL_RX_OFFSET(UNIFIED_PHYRX_L_SIG_B_0,
  2582. L_SIG_B_INFO_PHYRX_L_SIG_B_INFO_DETAILS);
  2583. value = HAL_RX_GET(l_sig_b_info, L_SIG_B_INFO, RATE);
  2584. ppdu_info->rx_status.l_sig_b_info = *((uint32_t *)l_sig_b_info);
  2585. switch (value) {
  2586. case 1:
  2587. ppdu_info->rx_status.rate = HAL_11B_RATE_3MCS;
  2588. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS3;
  2589. break;
  2590. case 2:
  2591. ppdu_info->rx_status.rate = HAL_11B_RATE_2MCS;
  2592. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS2;
  2593. break;
  2594. case 3:
  2595. ppdu_info->rx_status.rate = HAL_11B_RATE_1MCS;
  2596. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS1;
  2597. break;
  2598. case 4:
  2599. ppdu_info->rx_status.rate = HAL_11B_RATE_0MCS;
  2600. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS0;
  2601. break;
  2602. case 5:
  2603. ppdu_info->rx_status.rate = HAL_11B_RATE_6MCS;
  2604. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS6;
  2605. break;
  2606. case 6:
  2607. ppdu_info->rx_status.rate = HAL_11B_RATE_5MCS;
  2608. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS5;
  2609. break;
  2610. case 7:
  2611. ppdu_info->rx_status.rate = HAL_11B_RATE_4MCS;
  2612. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS4;
  2613. break;
  2614. default:
  2615. break;
  2616. }
  2617. ppdu_info->rx_status.cck_flag = 1;
  2618. break;
  2619. }
  2620. case WIFIPHYRX_L_SIG_A_E:
  2621. {
  2622. uint8_t *l_sig_a_info = (uint8_t *)rx_tlv +
  2623. HAL_RX_OFFSET(UNIFIED_PHYRX_L_SIG_A_0,
  2624. L_SIG_A_INFO_PHYRX_L_SIG_A_INFO_DETAILS);
  2625. value = HAL_RX_GET(l_sig_a_info, L_SIG_A_INFO, RATE);
  2626. ppdu_info->rx_status.l_sig_a_info = *((uint32_t *)l_sig_a_info);
  2627. switch (value) {
  2628. case 8:
  2629. ppdu_info->rx_status.rate = HAL_11A_RATE_0MCS;
  2630. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS0;
  2631. break;
  2632. case 9:
  2633. ppdu_info->rx_status.rate = HAL_11A_RATE_1MCS;
  2634. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS1;
  2635. break;
  2636. case 10:
  2637. ppdu_info->rx_status.rate = HAL_11A_RATE_2MCS;
  2638. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS2;
  2639. break;
  2640. case 11:
  2641. ppdu_info->rx_status.rate = HAL_11A_RATE_3MCS;
  2642. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS3;
  2643. break;
  2644. case 12:
  2645. ppdu_info->rx_status.rate = HAL_11A_RATE_4MCS;
  2646. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS4;
  2647. break;
  2648. case 13:
  2649. ppdu_info->rx_status.rate = HAL_11A_RATE_5MCS;
  2650. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS5;
  2651. break;
  2652. case 14:
  2653. ppdu_info->rx_status.rate = HAL_11A_RATE_6MCS;
  2654. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS6;
  2655. break;
  2656. case 15:
  2657. ppdu_info->rx_status.rate = HAL_11A_RATE_7MCS;
  2658. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS7;
  2659. break;
  2660. default:
  2661. break;
  2662. }
  2663. ppdu_info->rx_status.ofdm_flag = 1;
  2664. break;
  2665. }
  2666. case WIFIPHYRX_VHT_SIG_A_E:
  2667. {
  2668. uint8_t *vht_sig_a_info = (uint8_t *)rx_tlv +
  2669. HAL_RX_OFFSET(UNIFIED_PHYRX_VHT_SIG_A_0,
  2670. VHT_SIG_A_INFO_PHYRX_VHT_SIG_A_INFO_DETAILS);
  2671. value = HAL_RX_GET(vht_sig_a_info, VHT_SIG_A_INFO,
  2672. SU_MU_CODING);
  2673. ppdu_info->rx_status.ldpc = (value == HAL_SU_MU_CODING_LDPC) ?
  2674. 1 : 0;
  2675. group_id = HAL_RX_GET(vht_sig_a_info, VHT_SIG_A_INFO, GROUP_ID);
  2676. ppdu_info->rx_status.vht_flag_values5 = group_id;
  2677. ppdu_info->rx_status.mcs = HAL_RX_GET(vht_sig_a_info,
  2678. VHT_SIG_A_INFO, MCS);
  2679. ppdu_info->rx_status.sgi = HAL_RX_GET(vht_sig_a_info,
  2680. VHT_SIG_A_INFO,
  2681. GI_SETTING);
  2682. switch (hal->target_type) {
  2683. case TARGET_TYPE_QCA8074:
  2684. case TARGET_TYPE_QCA8074V2:
  2685. case TARGET_TYPE_QCA6018:
  2686. case TARGET_TYPE_QCA5018:
  2687. case TARGET_TYPE_QCN9000:
  2688. case TARGET_TYPE_QCN6122:
  2689. case TARGET_TYPE_QCN6432:
  2690. #ifdef QCA_WIFI_QCA6390
  2691. case TARGET_TYPE_QCA6390:
  2692. #endif
  2693. ppdu_info->rx_status.is_stbc =
  2694. HAL_RX_GET(vht_sig_a_info,
  2695. VHT_SIG_A_INFO, STBC);
  2696. value = HAL_RX_GET(vht_sig_a_info,
  2697. VHT_SIG_A_INFO, N_STS);
  2698. value = value & VHT_SIG_SU_NSS_MASK;
  2699. if (ppdu_info->rx_status.is_stbc && (value > 0))
  2700. value = ((value + 1) >> 1) - 1;
  2701. ppdu_info->rx_status.nss =
  2702. ((value & VHT_SIG_SU_NSS_MASK) + 1);
  2703. break;
  2704. case TARGET_TYPE_QCA6290:
  2705. #if !defined(QCA_WIFI_QCA6290_11AX)
  2706. ppdu_info->rx_status.is_stbc =
  2707. HAL_RX_GET(vht_sig_a_info,
  2708. VHT_SIG_A_INFO, STBC);
  2709. value = HAL_RX_GET(vht_sig_a_info,
  2710. VHT_SIG_A_INFO, N_STS);
  2711. value = value & VHT_SIG_SU_NSS_MASK;
  2712. if (ppdu_info->rx_status.is_stbc && (value > 0))
  2713. value = ((value + 1) >> 1) - 1;
  2714. ppdu_info->rx_status.nss =
  2715. ((value & VHT_SIG_SU_NSS_MASK) + 1);
  2716. #else
  2717. ppdu_info->rx_status.nss = 0;
  2718. #endif
  2719. break;
  2720. case TARGET_TYPE_KIWI:
  2721. case TARGET_TYPE_MANGO:
  2722. case TARGET_TYPE_PEACH:
  2723. ppdu_info->rx_status.is_stbc =
  2724. HAL_RX_GET(vht_sig_a_info,
  2725. VHT_SIG_A_INFO, STBC);
  2726. value = HAL_RX_GET(vht_sig_a_info,
  2727. VHT_SIG_A_INFO, N_STS);
  2728. value = value & VHT_SIG_SU_NSS_MASK;
  2729. if (ppdu_info->rx_status.is_stbc && (value > 0))
  2730. value = ((value + 1) >> 1) - 1;
  2731. ppdu_info->rx_status.nss =
  2732. ((value & VHT_SIG_SU_NSS_MASK) + 1);
  2733. break;
  2734. case TARGET_TYPE_QCA6490:
  2735. case TARGET_TYPE_QCA6750:
  2736. ppdu_info->rx_status.nss = 0;
  2737. break;
  2738. default:
  2739. break;
  2740. }
  2741. ppdu_info->rx_status.vht_flag_values3[0] =
  2742. (((ppdu_info->rx_status.mcs) << 4)
  2743. | ppdu_info->rx_status.nss);
  2744. ppdu_info->rx_status.bw = HAL_RX_GET(vht_sig_a_info,
  2745. VHT_SIG_A_INFO, BANDWIDTH);
  2746. ppdu_info->rx_status.vht_flag_values2 =
  2747. ppdu_info->rx_status.bw;
  2748. ppdu_info->rx_status.vht_flag_values4 =
  2749. HAL_RX_GET(vht_sig_a_info,
  2750. VHT_SIG_A_INFO, SU_MU_CODING);
  2751. ppdu_info->rx_status.beamformed = HAL_RX_GET(vht_sig_a_info,
  2752. VHT_SIG_A_INFO,
  2753. BEAMFORMED);
  2754. if (group_id == 0 || group_id == 63)
  2755. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  2756. else
  2757. ppdu_info->rx_status.reception_type =
  2758. HAL_RX_TYPE_MU_MIMO;
  2759. break;
  2760. }
  2761. case WIFIPHYRX_HE_SIG_A_SU_E:
  2762. {
  2763. uint8_t *he_sig_a_su_info = (uint8_t *)rx_tlv +
  2764. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_A_SU_0,
  2765. HE_SIG_A_SU_INFO_PHYRX_HE_SIG_A_SU_INFO_DETAILS);
  2766. ppdu_info->rx_status.he_flags = 1;
  2767. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2768. FORMAT_INDICATION);
  2769. if (value == 0) {
  2770. ppdu_info->rx_status.he_data1 =
  2771. QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
  2772. } else {
  2773. ppdu_info->rx_status.he_data1 =
  2774. QDF_MON_STATUS_HE_SU_FORMAT_TYPE;
  2775. }
  2776. /* data1 */
  2777. ppdu_info->rx_status.he_data1 |=
  2778. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  2779. QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN |
  2780. QDF_MON_STATUS_HE_DL_UL_KNOWN |
  2781. QDF_MON_STATUS_HE_MCS_KNOWN |
  2782. QDF_MON_STATUS_HE_DCM_KNOWN |
  2783. QDF_MON_STATUS_HE_CODING_KNOWN |
  2784. QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN |
  2785. QDF_MON_STATUS_HE_STBC_KNOWN |
  2786. QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN |
  2787. QDF_MON_STATUS_HE_DOPPLER_KNOWN;
  2788. /* data2 */
  2789. ppdu_info->rx_status.he_data2 =
  2790. QDF_MON_STATUS_HE_GI_KNOWN;
  2791. ppdu_info->rx_status.he_data2 |=
  2792. QDF_MON_STATUS_TXBF_KNOWN |
  2793. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  2794. QDF_MON_STATUS_TXOP_KNOWN |
  2795. QDF_MON_STATUS_LTF_SYMBOLS_KNOWN |
  2796. QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN |
  2797. QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN;
  2798. /* data3 */
  2799. value = HAL_RX_GET(he_sig_a_su_info,
  2800. HE_SIG_A_SU_INFO, BSS_COLOR_ID);
  2801. ppdu_info->rx_status.he_data3 = value;
  2802. value = HAL_RX_GET(he_sig_a_su_info,
  2803. HE_SIG_A_SU_INFO, BEAM_CHANGE);
  2804. value = value << QDF_MON_STATUS_BEAM_CHANGE_SHIFT;
  2805. ppdu_info->rx_status.he_data3 |= value;
  2806. value = HAL_RX_GET(he_sig_a_su_info,
  2807. HE_SIG_A_SU_INFO, DL_UL_FLAG);
  2808. ppdu_info->rx_status.mu_dl_ul = HAL_RX_TYPE_DL;
  2809. value = value << QDF_MON_STATUS_DL_UL_SHIFT;
  2810. ppdu_info->rx_status.he_data3 |= value;
  2811. value = HAL_RX_GET(he_sig_a_su_info,
  2812. HE_SIG_A_SU_INFO, TRANSMIT_MCS);
  2813. ppdu_info->rx_status.mcs = value;
  2814. value = value << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  2815. ppdu_info->rx_status.he_data3 |= value;
  2816. value = HAL_RX_GET(he_sig_a_su_info,
  2817. HE_SIG_A_SU_INFO, DCM);
  2818. he_dcm = value;
  2819. value = value << QDF_MON_STATUS_DCM_SHIFT;
  2820. ppdu_info->rx_status.he_data3 |= value;
  2821. value = HAL_RX_GET(he_sig_a_su_info,
  2822. HE_SIG_A_SU_INFO, CODING);
  2823. ppdu_info->rx_status.ldpc = (value == HAL_SU_MU_CODING_LDPC) ?
  2824. 1 : 0;
  2825. value = value << QDF_MON_STATUS_CODING_SHIFT;
  2826. ppdu_info->rx_status.he_data3 |= value;
  2827. value = HAL_RX_GET(he_sig_a_su_info,
  2828. HE_SIG_A_SU_INFO,
  2829. LDPC_EXTRA_SYMBOL);
  2830. value = value << QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT;
  2831. ppdu_info->rx_status.he_data3 |= value;
  2832. value = HAL_RX_GET(he_sig_a_su_info,
  2833. HE_SIG_A_SU_INFO, STBC);
  2834. he_stbc = value;
  2835. value = value << QDF_MON_STATUS_STBC_SHIFT;
  2836. ppdu_info->rx_status.he_data3 |= value;
  2837. /* data4 */
  2838. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2839. SPATIAL_REUSE);
  2840. ppdu_info->rx_status.he_data4 = value;
  2841. /* data5 */
  2842. value = HAL_RX_GET(he_sig_a_su_info,
  2843. HE_SIG_A_SU_INFO, TRANSMIT_BW);
  2844. ppdu_info->rx_status.he_data5 = value;
  2845. ppdu_info->rx_status.bw = value;
  2846. value = HAL_RX_GET(he_sig_a_su_info,
  2847. HE_SIG_A_SU_INFO, CP_LTF_SIZE);
  2848. switch (value) {
  2849. case 0:
  2850. he_gi = HE_GI_0_8;
  2851. he_ltf = HE_LTF_1_X;
  2852. break;
  2853. case 1:
  2854. he_gi = HE_GI_0_8;
  2855. he_ltf = HE_LTF_2_X;
  2856. break;
  2857. case 2:
  2858. he_gi = HE_GI_1_6;
  2859. he_ltf = HE_LTF_2_X;
  2860. break;
  2861. case 3:
  2862. if (he_dcm && he_stbc) {
  2863. he_gi = HE_GI_0_8;
  2864. he_ltf = HE_LTF_4_X;
  2865. } else {
  2866. he_gi = HE_GI_3_2;
  2867. he_ltf = HE_LTF_4_X;
  2868. }
  2869. break;
  2870. }
  2871. ppdu_info->rx_status.sgi = he_gi;
  2872. ppdu_info->rx_status.ltf_size = he_ltf;
  2873. hal_get_radiotap_he_gi_ltf(&he_gi, &he_ltf);
  2874. value = he_gi << QDF_MON_STATUS_GI_SHIFT;
  2875. ppdu_info->rx_status.he_data5 |= value;
  2876. value = he_ltf << QDF_MON_STATUS_HE_LTF_SIZE_SHIFT;
  2877. ppdu_info->rx_status.he_data5 |= value;
  2878. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO, NSTS);
  2879. value = (value << QDF_MON_STATUS_HE_LTF_SYM_SHIFT);
  2880. ppdu_info->rx_status.he_data5 |= value;
  2881. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2882. PACKET_EXTENSION_A_FACTOR);
  2883. value = value << QDF_MON_STATUS_PRE_FEC_PAD_SHIFT;
  2884. ppdu_info->rx_status.he_data5 |= value;
  2885. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO, TXBF);
  2886. value = value << QDF_MON_STATUS_TXBF_SHIFT;
  2887. ppdu_info->rx_status.he_data5 |= value;
  2888. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2889. PACKET_EXTENSION_PE_DISAMBIGUITY);
  2890. value = value << QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT;
  2891. ppdu_info->rx_status.he_data5 |= value;
  2892. /* data6 */
  2893. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO, NSTS);
  2894. value++;
  2895. ppdu_info->rx_status.nss = value;
  2896. ppdu_info->rx_status.he_data6 = value;
  2897. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2898. DOPPLER_INDICATION);
  2899. value = value << QDF_MON_STATUS_DOPPLER_SHIFT;
  2900. ppdu_info->rx_status.he_data6 |= value;
  2901. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2902. TXOP_DURATION);
  2903. value = value << QDF_MON_STATUS_TXOP_SHIFT;
  2904. ppdu_info->rx_status.he_data6 |= value;
  2905. ppdu_info->rx_status.beamformed = HAL_RX_GET(he_sig_a_su_info,
  2906. HE_SIG_A_SU_INFO,
  2907. TXBF);
  2908. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  2909. break;
  2910. }
  2911. case WIFIPHYRX_HE_SIG_A_MU_DL_E:
  2912. {
  2913. uint8_t *he_sig_a_mu_dl_info = (uint8_t *)rx_tlv +
  2914. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_A_MU_DL_0,
  2915. HE_SIG_A_MU_DL_INFO_PHYRX_HE_SIG_A_MU_DL_INFO_DETAILS);
  2916. ppdu_info->rx_status.he_mu_flags = 1;
  2917. /* HE Flags */
  2918. /*data1*/
  2919. ppdu_info->rx_status.he_data1 =
  2920. QDF_MON_STATUS_HE_MU_FORMAT_TYPE;
  2921. ppdu_info->rx_status.he_data1 |=
  2922. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  2923. QDF_MON_STATUS_HE_DL_UL_KNOWN |
  2924. QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN |
  2925. QDF_MON_STATUS_HE_STBC_KNOWN |
  2926. QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN |
  2927. QDF_MON_STATUS_HE_DOPPLER_KNOWN;
  2928. /* data2 */
  2929. ppdu_info->rx_status.he_data2 =
  2930. QDF_MON_STATUS_HE_GI_KNOWN;
  2931. ppdu_info->rx_status.he_data2 |=
  2932. QDF_MON_STATUS_LTF_SYMBOLS_KNOWN |
  2933. QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN |
  2934. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  2935. QDF_MON_STATUS_TXOP_KNOWN |
  2936. QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN;
  2937. /*data3*/
  2938. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2939. HE_SIG_A_MU_DL_INFO, BSS_COLOR_ID);
  2940. ppdu_info->rx_status.he_data3 = value;
  2941. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2942. HE_SIG_A_MU_DL_INFO, DL_UL_FLAG);
  2943. value = value << QDF_MON_STATUS_DL_UL_SHIFT;
  2944. ppdu_info->rx_status.he_data3 |= value;
  2945. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2946. HE_SIG_A_MU_DL_INFO,
  2947. LDPC_EXTRA_SYMBOL);
  2948. value = value << QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT;
  2949. ppdu_info->rx_status.he_data3 |= value;
  2950. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2951. HE_SIG_A_MU_DL_INFO, STBC);
  2952. he_stbc = value;
  2953. value = value << QDF_MON_STATUS_STBC_SHIFT;
  2954. ppdu_info->rx_status.he_data3 |= value;
  2955. /*data4*/
  2956. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  2957. SPATIAL_REUSE);
  2958. ppdu_info->rx_status.he_data4 = value;
  2959. /*data5*/
  2960. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2961. HE_SIG_A_MU_DL_INFO, TRANSMIT_BW);
  2962. ppdu_info->rx_status.he_data5 = value;
  2963. ppdu_info->rx_status.bw = value;
  2964. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2965. HE_SIG_A_MU_DL_INFO, CP_LTF_SIZE);
  2966. switch (value) {
  2967. case 0:
  2968. he_gi = HE_GI_0_8;
  2969. he_ltf = HE_LTF_4_X;
  2970. break;
  2971. case 1:
  2972. he_gi = HE_GI_0_8;
  2973. he_ltf = HE_LTF_2_X;
  2974. break;
  2975. case 2:
  2976. he_gi = HE_GI_1_6;
  2977. he_ltf = HE_LTF_2_X;
  2978. break;
  2979. case 3:
  2980. he_gi = HE_GI_3_2;
  2981. he_ltf = HE_LTF_4_X;
  2982. break;
  2983. }
  2984. ppdu_info->rx_status.sgi = he_gi;
  2985. ppdu_info->rx_status.ltf_size = he_ltf;
  2986. hal_get_radiotap_he_gi_ltf(&he_gi, &he_ltf);
  2987. value = he_gi << QDF_MON_STATUS_GI_SHIFT;
  2988. ppdu_info->rx_status.he_data5 |= value;
  2989. value = he_ltf << QDF_MON_STATUS_HE_LTF_SIZE_SHIFT;
  2990. ppdu_info->rx_status.he_data5 |= value;
  2991. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2992. HE_SIG_A_MU_DL_INFO, NUM_LTF_SYMBOLS);
  2993. value = (value << QDF_MON_STATUS_HE_LTF_SYM_SHIFT);
  2994. ppdu_info->rx_status.he_data5 |= value;
  2995. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  2996. PACKET_EXTENSION_A_FACTOR);
  2997. value = value << QDF_MON_STATUS_PRE_FEC_PAD_SHIFT;
  2998. ppdu_info->rx_status.he_data5 |= value;
  2999. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  3000. PACKET_EXTENSION_PE_DISAMBIGUITY);
  3001. value = value << QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT;
  3002. ppdu_info->rx_status.he_data5 |= value;
  3003. /*data6*/
  3004. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  3005. DOPPLER_INDICATION);
  3006. value = value << QDF_MON_STATUS_DOPPLER_SHIFT;
  3007. ppdu_info->rx_status.he_data6 |= value;
  3008. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  3009. TXOP_DURATION);
  3010. value = value << QDF_MON_STATUS_TXOP_SHIFT;
  3011. ppdu_info->rx_status.he_data6 |= value;
  3012. /* HE-MU Flags */
  3013. /* HE-MU-flags1 */
  3014. ppdu_info->rx_status.he_flags1 =
  3015. QDF_MON_STATUS_SIG_B_MCS_KNOWN |
  3016. QDF_MON_STATUS_SIG_B_DCM_KNOWN |
  3017. QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN |
  3018. QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN |
  3019. QDF_MON_STATUS_RU_0_KNOWN;
  3020. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  3021. HE_SIG_A_MU_DL_INFO, MCS_OF_SIG_B);
  3022. ppdu_info->rx_status.he_flags1 |= value;
  3023. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  3024. HE_SIG_A_MU_DL_INFO, DCM_OF_SIG_B);
  3025. value = value << QDF_MON_STATUS_DCM_FLAG_1_SHIFT;
  3026. ppdu_info->rx_status.he_flags1 |= value;
  3027. /* HE-MU-flags2 */
  3028. ppdu_info->rx_status.he_flags2 =
  3029. QDF_MON_STATUS_BW_KNOWN;
  3030. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  3031. HE_SIG_A_MU_DL_INFO, TRANSMIT_BW);
  3032. ppdu_info->rx_status.he_flags2 |= value;
  3033. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  3034. HE_SIG_A_MU_DL_INFO, COMP_MODE_SIG_B);
  3035. value = value << QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT;
  3036. ppdu_info->rx_status.he_flags2 |= value;
  3037. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  3038. HE_SIG_A_MU_DL_INFO, NUM_SIG_B_SYMBOLS);
  3039. value = value - 1;
  3040. value = value << QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT;
  3041. ppdu_info->rx_status.he_flags2 |= value;
  3042. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  3043. break;
  3044. }
  3045. case WIFIPHYRX_HE_SIG_A_MU_UL_E:
  3046. {
  3047. hal_rx_he_sig_a_mu_ul_e_handle(ppdu_info, rx_tlv);
  3048. break;
  3049. }
  3050. case WIFIPHYRX_HE_SIG_B1_MU_E:
  3051. {
  3052. uint8_t *he_sig_b1_mu_info = (uint8_t *)rx_tlv +
  3053. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_B1_MU_0,
  3054. HE_SIG_B1_MU_INFO_PHYRX_HE_SIG_B1_MU_INFO_DETAILS);
  3055. ppdu_info->rx_status.he_sig_b_common_known |=
  3056. QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU0;
  3057. /* TODO: Check on the availability of other fields in
  3058. * sig_b_common
  3059. */
  3060. value = HAL_RX_GET(he_sig_b1_mu_info,
  3061. HE_SIG_B1_MU_INFO, RU_ALLOCATION);
  3062. ppdu_info->rx_status.he_RU[0] = value;
  3063. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  3064. break;
  3065. }
  3066. case WIFIPHYRX_HE_SIG_B2_MU_E:
  3067. {
  3068. uint8_t *he_sig_b2_mu_info = (uint8_t *)rx_tlv +
  3069. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_B2_MU_0,
  3070. HE_SIG_B2_MU_INFO_PHYRX_HE_SIG_B2_MU_INFO_DETAILS);
  3071. /*
  3072. * Not all "HE" fields can be updated from
  3073. * WIFIPHYRX_HE_SIG_A_MU_DL_E TLV. Use WIFIPHYRX_HE_SIG_B2_MU_E
  3074. * to populate rest of the "HE" fields for MU scenarios.
  3075. */
  3076. /* HE-data1 */
  3077. ppdu_info->rx_status.he_data1 |=
  3078. QDF_MON_STATUS_HE_MCS_KNOWN |
  3079. QDF_MON_STATUS_HE_CODING_KNOWN;
  3080. /* HE-data2 */
  3081. /* HE-data3 */
  3082. value = HAL_RX_GET(he_sig_b2_mu_info,
  3083. HE_SIG_B2_MU_INFO, STA_MCS);
  3084. ppdu_info->rx_status.mcs = value;
  3085. value = value << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  3086. ppdu_info->rx_status.he_data3 |= value;
  3087. value = HAL_RX_GET(he_sig_b2_mu_info,
  3088. HE_SIG_B2_MU_INFO, STA_CODING);
  3089. value = value << QDF_MON_STATUS_CODING_SHIFT;
  3090. ppdu_info->rx_status.he_data3 |= value;
  3091. /* HE-data4 */
  3092. value = HAL_RX_GET(he_sig_b2_mu_info,
  3093. HE_SIG_B2_MU_INFO, STA_ID);
  3094. value = value << QDF_MON_STATUS_STA_ID_SHIFT;
  3095. ppdu_info->rx_status.he_data4 |= value;
  3096. /* HE-data5 */
  3097. /* HE-data6 */
  3098. value = HAL_RX_GET(he_sig_b2_mu_info,
  3099. HE_SIG_B2_MU_INFO, NSTS);
  3100. /* value n indicates n+1 spatial streams */
  3101. value++;
  3102. ppdu_info->rx_status.nss = value;
  3103. ppdu_info->rx_status.he_data6 |= value;
  3104. break;
  3105. }
  3106. case WIFIPHYRX_HE_SIG_B2_OFDMA_E:
  3107. {
  3108. uint8_t *he_sig_b2_ofdma_info =
  3109. (uint8_t *)rx_tlv +
  3110. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_B2_OFDMA_0,
  3111. HE_SIG_B2_OFDMA_INFO_PHYRX_HE_SIG_B2_OFDMA_INFO_DETAILS);
  3112. /*
  3113. * Not all "HE" fields can be updated from
  3114. * WIFIPHYRX_HE_SIG_A_MU_DL_E TLV. Use WIFIPHYRX_HE_SIG_B2_MU_E
  3115. * to populate rest of "HE" fields for MU OFDMA scenarios.
  3116. */
  3117. /* HE-data1 */
  3118. ppdu_info->rx_status.he_data1 |=
  3119. QDF_MON_STATUS_HE_MCS_KNOWN |
  3120. QDF_MON_STATUS_HE_DCM_KNOWN |
  3121. QDF_MON_STATUS_HE_CODING_KNOWN;
  3122. /* HE-data2 */
  3123. ppdu_info->rx_status.he_data2 |=
  3124. QDF_MON_STATUS_TXBF_KNOWN;
  3125. /* HE-data3 */
  3126. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  3127. HE_SIG_B2_OFDMA_INFO, STA_MCS);
  3128. ppdu_info->rx_status.mcs = value;
  3129. value = value << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  3130. ppdu_info->rx_status.he_data3 |= value;
  3131. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  3132. HE_SIG_B2_OFDMA_INFO, STA_DCM);
  3133. he_dcm = value;
  3134. value = value << QDF_MON_STATUS_DCM_SHIFT;
  3135. ppdu_info->rx_status.he_data3 |= value;
  3136. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  3137. HE_SIG_B2_OFDMA_INFO, STA_CODING);
  3138. value = value << QDF_MON_STATUS_CODING_SHIFT;
  3139. ppdu_info->rx_status.he_data3 |= value;
  3140. /* HE-data4 */
  3141. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  3142. HE_SIG_B2_OFDMA_INFO, STA_ID);
  3143. value = value << QDF_MON_STATUS_STA_ID_SHIFT;
  3144. ppdu_info->rx_status.he_data4 |= value;
  3145. /* HE-data5 */
  3146. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  3147. HE_SIG_B2_OFDMA_INFO, TXBF);
  3148. value = value << QDF_MON_STATUS_TXBF_SHIFT;
  3149. ppdu_info->rx_status.he_data5 |= value;
  3150. /* HE-data6 */
  3151. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  3152. HE_SIG_B2_OFDMA_INFO, NSTS);
  3153. /* value n indicates n+1 spatial streams */
  3154. value++;
  3155. ppdu_info->rx_status.nss = value;
  3156. ppdu_info->rx_status.he_data6 |= value;
  3157. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_OFDMA;
  3158. break;
  3159. }
  3160. case WIFIPHYRX_RSSI_LEGACY_E:
  3161. {
  3162. uint8_t reception_type;
  3163. int8_t rssi_value;
  3164. uint8_t *rssi_info_tlv = (uint8_t *)rx_tlv +
  3165. HAL_RX_OFFSET(UNIFIED_PHYRX_RSSI_LEGACY_19,
  3166. RECEIVE_RSSI_INFO_PREAMBLE_RSSI_INFO_DETAILS);
  3167. ppdu_info->rx_status.rssi_comb =
  3168. hal_rx_phy_legacy_get_rssi(hal_soc_hdl, rx_tlv);
  3169. ppdu_info->rx_status.bw = hal->ops->hal_rx_get_tlv(rx_tlv);
  3170. ppdu_info->rx_status.he_re = 0;
  3171. reception_type = HAL_RX_GET_64(rx_tlv,
  3172. PHYRX_RSSI_LEGACY,
  3173. RECEPTION_TYPE);
  3174. switch (reception_type) {
  3175. case QDF_RECEPTION_TYPE_ULOFMDA:
  3176. ppdu_info->rx_status.ulofdma_flag = 1;
  3177. ppdu_info->rx_status.he_data1 =
  3178. QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
  3179. break;
  3180. case QDF_RECEPTION_TYPE_ULMIMO:
  3181. ppdu_info->rx_status.he_data1 =
  3182. QDF_MON_STATUS_HE_MU_FORMAT_TYPE;
  3183. break;
  3184. default:
  3185. break;
  3186. }
  3187. ppdu_info->rx_status.ul_mu_type = reception_type;
  3188. hal_rx_update_rssi_chain(ppdu_info, rssi_info_tlv);
  3189. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  3190. RECEIVE_RSSI_INFO,
  3191. RSSI_PRI20_CHAIN0);
  3192. ppdu_info->rx_status.rssi[0] = rssi_value;
  3193. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  3194. RECEIVE_RSSI_INFO,
  3195. RSSI_PRI20_CHAIN1);
  3196. ppdu_info->rx_status.rssi[1] = rssi_value;
  3197. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  3198. RECEIVE_RSSI_INFO,
  3199. RSSI_PRI20_CHAIN2);
  3200. ppdu_info->rx_status.rssi[2] = rssi_value;
  3201. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  3202. RECEIVE_RSSI_INFO,
  3203. RSSI_PRI20_CHAIN3);
  3204. ppdu_info->rx_status.rssi[3] = rssi_value;
  3205. #ifdef DP_BE_NOTYET_WAR
  3206. // TODO - this is not preset for kiwi
  3207. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  3208. RECEIVE_RSSI_INFO,
  3209. RSSI_PRI20_CHAIN4);
  3210. ppdu_info->rx_status.rssi[4] = rssi_value;
  3211. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  3212. RECEIVE_RSSI_INFO,
  3213. RSSI_PRI20_CHAIN5);
  3214. ppdu_info->rx_status.rssi[5] = rssi_value;
  3215. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  3216. RECEIVE_RSSI_INFO,
  3217. RSSI_PRI20_CHAIN6);
  3218. ppdu_info->rx_status.rssi[6] = rssi_value;
  3219. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  3220. RECEIVE_RSSI_INFO,
  3221. RSSI_PRI20_CHAIN7);
  3222. ppdu_info->rx_status.rssi[7] = rssi_value;
  3223. #endif
  3224. break;
  3225. }
  3226. case WIFIPHYRX_OTHER_RECEIVE_INFO_E:
  3227. hal_rx_proc_phyrx_other_receive_info_tlv(hal, rx_tlv_hdr,
  3228. ppdu_info);
  3229. break;
  3230. case WIFIPHYRX_GENERIC_U_SIG_E:
  3231. hal_rx_parse_u_sig_hdr(hal, rx_tlv, ppdu_info);
  3232. break;
  3233. case WIFIPHYRX_COMMON_USER_INFO_E:
  3234. hal_rx_parse_cmn_usr_info(hal, rx_tlv, ppdu_info);
  3235. break;
  3236. case WIFIRX_HEADER_E:
  3237. {
  3238. struct hal_rx_ppdu_common_info *com_info = &ppdu_info->com_info;
  3239. if (ppdu_info->fcs_ok_cnt >=
  3240. HAL_RX_MAX_MPDU_H_PER_STATUS_BUFFER) {
  3241. hal_err("Number of MPDUs(%d) per status buff exceeded",
  3242. ppdu_info->fcs_ok_cnt);
  3243. break;
  3244. }
  3245. /* Update first_msdu_payload for every mpdu and increment
  3246. * com_info->mpdu_cnt for every WIFIRX_HEADER_E TLV
  3247. */
  3248. ppdu_info->ppdu_msdu_info[ppdu_info->fcs_ok_cnt].first_msdu_payload =
  3249. rx_tlv;
  3250. ppdu_info->ppdu_msdu_info[ppdu_info->fcs_ok_cnt].payload_len = tlv_len;
  3251. ppdu_info->msdu_info.first_msdu_payload = rx_tlv;
  3252. ppdu_info->msdu_info.payload_len = tlv_len;
  3253. ppdu_info->user_id = user_id;
  3254. ppdu_info->hdr_len = tlv_len;
  3255. ppdu_info->data = rx_tlv;
  3256. ppdu_info->data += 4;
  3257. /* for every RX_HEADER TLV increment mpdu_cnt */
  3258. com_info->mpdu_cnt++;
  3259. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3260. return HAL_TLV_STATUS_HEADER;
  3261. }
  3262. case WIFIRX_MPDU_START_E:
  3263. {
  3264. hal_rx_mon_mpdu_start_t *rx_mpdu_start = rx_tlv;
  3265. uint32_t ppdu_id = rx_mpdu_start->rx_mpdu_info_details.phy_ppdu_id;
  3266. uint8_t filter_category = 0;
  3267. ppdu_info->nac_info.fc_valid =
  3268. rx_mpdu_start->rx_mpdu_info_details.mpdu_frame_control_valid;
  3269. ppdu_info->nac_info.to_ds_flag =
  3270. rx_mpdu_start->rx_mpdu_info_details.to_ds;
  3271. ppdu_info->nac_info.frame_control =
  3272. rx_mpdu_start->rx_mpdu_info_details.mpdu_frame_control_field;
  3273. ppdu_info->sw_frame_group_id =
  3274. rx_mpdu_start->rx_mpdu_info_details.sw_frame_group_id;
  3275. ppdu_info->rx_user_status[user_id].sw_peer_id =
  3276. rx_mpdu_start->rx_mpdu_info_details.sw_peer_id;
  3277. hal_update_rx_ctrl_frame_stats(ppdu_info, user_id);
  3278. if (ppdu_info->sw_frame_group_id ==
  3279. HAL_MPDU_SW_FRAME_GROUP_NULL_DATA) {
  3280. ppdu_info->rx_status.frame_control_info_valid =
  3281. ppdu_info->nac_info.fc_valid;
  3282. ppdu_info->rx_status.frame_control =
  3283. ppdu_info->nac_info.frame_control;
  3284. }
  3285. hal_get_mac_addr1(rx_mpdu_start,
  3286. ppdu_info);
  3287. ppdu_info->nac_info.mac_addr2_valid =
  3288. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad2_valid;
  3289. *(uint16_t *)&ppdu_info->nac_info.mac_addr2[0] =
  3290. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad2_15_0;
  3291. *(uint32_t *)&ppdu_info->nac_info.mac_addr2[2] =
  3292. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad2_47_16;
  3293. if (ppdu_info->rx_status.prev_ppdu_id != ppdu_id) {
  3294. ppdu_info->rx_status.prev_ppdu_id = ppdu_id;
  3295. ppdu_info->rx_status.ppdu_len =
  3296. rx_mpdu_start->rx_mpdu_info_details.mpdu_length;
  3297. } else {
  3298. ppdu_info->rx_status.ppdu_len +=
  3299. rx_mpdu_start->rx_mpdu_info_details.mpdu_length;
  3300. }
  3301. filter_category =
  3302. rx_mpdu_start->rx_mpdu_info_details.rxpcu_mpdu_filter_in_category;
  3303. if (filter_category == 0)
  3304. ppdu_info->rx_status.rxpcu_filter_pass = 1;
  3305. else if (filter_category == 1)
  3306. ppdu_info->rx_status.monitor_direct_used = 1;
  3307. ppdu_info->rx_user_status[user_id].filter_category = filter_category;
  3308. ppdu_info->nac_info.mcast_bcast =
  3309. rx_mpdu_start->rx_mpdu_info_details.mcast_bcast;
  3310. ppdu_info->mpdu_info[user_id].decap_type =
  3311. rx_mpdu_start->rx_mpdu_info_details.decap_type;
  3312. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3313. return HAL_TLV_STATUS_MPDU_START;
  3314. }
  3315. case WIFIRX_MPDU_END_E:
  3316. ppdu_info->user_id = user_id;
  3317. ppdu_info->fcs_err =
  3318. HAL_RX_GET_64(rx_tlv, RX_MPDU_END,
  3319. FCS_ERR);
  3320. ppdu_info->mpdu_info[user_id].fcs_err = ppdu_info->fcs_err;
  3321. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3322. return HAL_TLV_STATUS_MPDU_END;
  3323. case WIFIRX_MSDU_END_E: {
  3324. hal_rx_mon_msdu_end_t *rx_msdu_end = rx_tlv;
  3325. if (user_id < HAL_MAX_UL_MU_USERS) {
  3326. ppdu_info->rx_msdu_info[user_id].cce_metadata =
  3327. rx_msdu_end->cce_metadata;
  3328. ppdu_info->rx_msdu_info[user_id].fse_metadata =
  3329. rx_msdu_end->fse_metadata;
  3330. ppdu_info->rx_msdu_info[user_id].is_flow_idx_timeout =
  3331. rx_msdu_end->flow_idx_timeout;
  3332. ppdu_info->rx_msdu_info[user_id].is_flow_idx_invalid =
  3333. rx_msdu_end->flow_idx_invalid;
  3334. ppdu_info->rx_msdu_info[user_id].flow_idx =
  3335. rx_msdu_end->flow_idx;
  3336. ppdu_info->msdu[user_id].first_msdu =
  3337. rx_msdu_end->first_msdu;
  3338. ppdu_info->msdu[user_id].last_msdu =
  3339. rx_msdu_end->last_msdu;
  3340. ppdu_info->msdu[user_id].msdu_len =
  3341. rx_msdu_end->msdu_length;
  3342. ppdu_info->msdu[user_id].user_rssi =
  3343. rx_msdu_end->user_rssi;
  3344. ppdu_info->msdu[user_id].reception_type =
  3345. rx_msdu_end->reception_type;
  3346. }
  3347. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3348. return HAL_TLV_STATUS_MSDU_END;
  3349. }
  3350. case WIFIMON_BUFFER_ADDR_E:
  3351. hal_rx_status_get_mon_buf_addr(rx_tlv, ppdu_info);
  3352. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3353. return HAL_TLV_STATUS_MON_BUF_ADDR;
  3354. case WIFIMON_DROP_E:
  3355. hal_rx_update_ppdu_drop_cnt(rx_tlv, ppdu_info);
  3356. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3357. return HAL_TLV_STATUS_MON_DROP;
  3358. case 0:
  3359. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3360. return HAL_TLV_STATUS_PPDU_DONE;
  3361. case WIFIRX_STATUS_BUFFER_DONE_E:
  3362. case WIFIPHYRX_DATA_DONE_E:
  3363. case WIFIPHYRX_PKT_END_PART1_E:
  3364. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3365. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  3366. default:
  3367. hal_debug("unhandled tlv tag %d", tlv_tag);
  3368. }
  3369. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3370. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  3371. }
  3372. static uint32_t
  3373. hal_rx_status_process_aggr_tlv(struct hal_soc *hal_soc,
  3374. struct hal_rx_ppdu_info *ppdu_info)
  3375. {
  3376. uint32_t aggr_tlv_tag = ppdu_info->tlv_aggr.tlv_tag;
  3377. switch (aggr_tlv_tag) {
  3378. case WIFIPHYRX_GENERIC_EHT_SIG_E:
  3379. hal_rx_parse_eht_sig_hdr(hal_soc, ppdu_info->tlv_aggr.buf,
  3380. ppdu_info);
  3381. break;
  3382. default:
  3383. /* Aggregated TLV cannot be handled */
  3384. qdf_assert(0);
  3385. break;
  3386. }
  3387. ppdu_info->tlv_aggr.in_progress = 0;
  3388. ppdu_info->tlv_aggr.cur_len = 0;
  3389. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  3390. }
  3391. static inline bool
  3392. hal_rx_status_tlv_should_aggregate(struct hal_soc *hal_soc, uint32_t tlv_tag)
  3393. {
  3394. switch (tlv_tag) {
  3395. case WIFIPHYRX_GENERIC_EHT_SIG_E:
  3396. return true;
  3397. }
  3398. return false;
  3399. }
  3400. static inline uint32_t
  3401. hal_rx_status_aggr_tlv(struct hal_soc *hal_soc, void *rx_tlv_hdr,
  3402. struct hal_rx_ppdu_info *ppdu_info,
  3403. qdf_nbuf_t nbuf)
  3404. {
  3405. uint32_t tlv_tag, user_id, tlv_len;
  3406. void *rx_tlv;
  3407. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv_hdr);
  3408. user_id = HAL_RX_GET_USER_TLV32_USERID(rx_tlv_hdr);
  3409. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv_hdr);
  3410. rx_tlv = (uint8_t *)rx_tlv_hdr + HAL_RX_TLV_HDR_SIZE;
  3411. if (tlv_len <= HAL_RX_MON_MAX_AGGR_SIZE - ppdu_info->tlv_aggr.cur_len) {
  3412. qdf_mem_copy(ppdu_info->tlv_aggr.buf +
  3413. ppdu_info->tlv_aggr.cur_len,
  3414. rx_tlv, tlv_len);
  3415. ppdu_info->tlv_aggr.cur_len += tlv_len;
  3416. } else {
  3417. dp_err("Length of TLV exceeds max aggregation length");
  3418. qdf_assert(0);
  3419. }
  3420. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  3421. }
  3422. static inline uint32_t
  3423. hal_rx_status_start_new_aggr_tlv(struct hal_soc *hal_soc, void *rx_tlv_hdr,
  3424. struct hal_rx_ppdu_info *ppdu_info,
  3425. qdf_nbuf_t nbuf)
  3426. {
  3427. uint32_t tlv_tag, user_id, tlv_len;
  3428. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv_hdr);
  3429. user_id = HAL_RX_GET_USER_TLV32_USERID(rx_tlv_hdr);
  3430. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv_hdr);
  3431. ppdu_info->tlv_aggr.in_progress = 1;
  3432. ppdu_info->tlv_aggr.tlv_tag = tlv_tag;
  3433. ppdu_info->tlv_aggr.cur_len = 0;
  3434. ppdu_info->tlv_aggr.rd_idx = 0;
  3435. return hal_rx_status_aggr_tlv(hal_soc, rx_tlv_hdr, ppdu_info, nbuf);
  3436. }
  3437. static inline uint32_t
  3438. hal_rx_status_get_tlv_info_wrapper_be(void *rx_tlv_hdr, void *ppduinfo,
  3439. hal_soc_handle_t hal_soc_hdl,
  3440. qdf_nbuf_t nbuf)
  3441. {
  3442. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  3443. uint32_t tlv_tag, user_id, tlv_len;
  3444. struct hal_rx_ppdu_info *ppdu_info =
  3445. (struct hal_rx_ppdu_info *)ppduinfo;
  3446. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv_hdr);
  3447. user_id = HAL_RX_GET_USER_TLV32_USERID(rx_tlv_hdr);
  3448. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv_hdr);
  3449. /*
  3450. * Handle the case where aggregation is in progress
  3451. * or the current TLV is one of the TLVs which should be
  3452. * aggregated
  3453. */
  3454. if (ppdu_info->tlv_aggr.in_progress) {
  3455. if (ppdu_info->tlv_aggr.tlv_tag == tlv_tag) {
  3456. return hal_rx_status_aggr_tlv(hal, rx_tlv_hdr,
  3457. ppdu_info, nbuf);
  3458. } else {
  3459. /* Finish aggregation of current TLV */
  3460. hal_rx_status_process_aggr_tlv(hal, ppdu_info);
  3461. }
  3462. }
  3463. if (hal_rx_status_tlv_should_aggregate(hal, tlv_tag)) {
  3464. return hal_rx_status_start_new_aggr_tlv(hal, rx_tlv_hdr,
  3465. ppduinfo, nbuf);
  3466. }
  3467. return hal_rx_status_get_tlv_info_generic_be(rx_tlv_hdr, ppduinfo,
  3468. hal_soc_hdl, nbuf);
  3469. }
  3470. #endif /* _HAL_BE_API_MON_H_ */