hal_be_api_mon.h 121 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900
  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. if (!ppdu_info->msdu_info.first_msdu_payload)
  3252. ppdu_info->msdu_info.first_msdu_payload = rx_tlv;
  3253. ppdu_info->msdu_info.payload_len = tlv_len;
  3254. ppdu_info->user_id = user_id;
  3255. ppdu_info->hdr_len = tlv_len;
  3256. ppdu_info->data = rx_tlv;
  3257. ppdu_info->data += 4;
  3258. /* for every RX_HEADER TLV increment mpdu_cnt */
  3259. com_info->mpdu_cnt++;
  3260. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3261. return HAL_TLV_STATUS_HEADER;
  3262. }
  3263. case WIFIRX_MPDU_START_E:
  3264. {
  3265. hal_rx_mon_mpdu_start_t *rx_mpdu_start = rx_tlv;
  3266. uint32_t ppdu_id = rx_mpdu_start->rx_mpdu_info_details.phy_ppdu_id;
  3267. uint8_t filter_category = 0;
  3268. ppdu_info->nac_info.fc_valid =
  3269. rx_mpdu_start->rx_mpdu_info_details.mpdu_frame_control_valid;
  3270. ppdu_info->nac_info.to_ds_flag =
  3271. rx_mpdu_start->rx_mpdu_info_details.to_ds;
  3272. ppdu_info->nac_info.frame_control =
  3273. rx_mpdu_start->rx_mpdu_info_details.mpdu_frame_control_field;
  3274. ppdu_info->sw_frame_group_id =
  3275. rx_mpdu_start->rx_mpdu_info_details.sw_frame_group_id;
  3276. ppdu_info->rx_user_status[user_id].sw_peer_id =
  3277. rx_mpdu_start->rx_mpdu_info_details.sw_peer_id;
  3278. hal_update_rx_ctrl_frame_stats(ppdu_info, user_id);
  3279. if (ppdu_info->sw_frame_group_id ==
  3280. HAL_MPDU_SW_FRAME_GROUP_NULL_DATA) {
  3281. ppdu_info->rx_status.frame_control_info_valid =
  3282. ppdu_info->nac_info.fc_valid;
  3283. ppdu_info->rx_status.frame_control =
  3284. ppdu_info->nac_info.frame_control;
  3285. }
  3286. hal_get_mac_addr1(rx_mpdu_start,
  3287. ppdu_info);
  3288. ppdu_info->nac_info.mac_addr2_valid =
  3289. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad2_valid;
  3290. *(uint16_t *)&ppdu_info->nac_info.mac_addr2[0] =
  3291. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad2_15_0;
  3292. *(uint32_t *)&ppdu_info->nac_info.mac_addr2[2] =
  3293. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad2_47_16;
  3294. if (ppdu_info->rx_status.prev_ppdu_id != ppdu_id) {
  3295. ppdu_info->rx_status.prev_ppdu_id = ppdu_id;
  3296. ppdu_info->rx_status.ppdu_len =
  3297. rx_mpdu_start->rx_mpdu_info_details.mpdu_length;
  3298. } else {
  3299. ppdu_info->rx_status.ppdu_len +=
  3300. rx_mpdu_start->rx_mpdu_info_details.mpdu_length;
  3301. }
  3302. filter_category =
  3303. rx_mpdu_start->rx_mpdu_info_details.rxpcu_mpdu_filter_in_category;
  3304. if (filter_category == 0)
  3305. ppdu_info->rx_status.rxpcu_filter_pass = 1;
  3306. else if (filter_category == 1)
  3307. ppdu_info->rx_status.monitor_direct_used = 1;
  3308. ppdu_info->rx_user_status[user_id].filter_category = filter_category;
  3309. ppdu_info->nac_info.mcast_bcast =
  3310. rx_mpdu_start->rx_mpdu_info_details.mcast_bcast;
  3311. ppdu_info->mpdu_info[user_id].decap_type =
  3312. rx_mpdu_start->rx_mpdu_info_details.decap_type;
  3313. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3314. return HAL_TLV_STATUS_MPDU_START;
  3315. }
  3316. case WIFIRX_MPDU_END_E:
  3317. ppdu_info->user_id = user_id;
  3318. ppdu_info->fcs_err =
  3319. HAL_RX_GET_64(rx_tlv, RX_MPDU_END,
  3320. FCS_ERR);
  3321. ppdu_info->mpdu_info[user_id].fcs_err = ppdu_info->fcs_err;
  3322. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3323. return HAL_TLV_STATUS_MPDU_END;
  3324. case WIFIRX_MSDU_END_E: {
  3325. hal_rx_mon_msdu_end_t *rx_msdu_end = rx_tlv;
  3326. if (user_id < HAL_MAX_UL_MU_USERS) {
  3327. ppdu_info->rx_msdu_info[user_id].cce_metadata =
  3328. rx_msdu_end->cce_metadata;
  3329. ppdu_info->rx_msdu_info[user_id].fse_metadata =
  3330. rx_msdu_end->fse_metadata;
  3331. ppdu_info->rx_msdu_info[user_id].is_flow_idx_timeout =
  3332. rx_msdu_end->flow_idx_timeout;
  3333. ppdu_info->rx_msdu_info[user_id].is_flow_idx_invalid =
  3334. rx_msdu_end->flow_idx_invalid;
  3335. ppdu_info->rx_msdu_info[user_id].flow_idx =
  3336. rx_msdu_end->flow_idx;
  3337. ppdu_info->msdu[user_id].first_msdu =
  3338. rx_msdu_end->first_msdu;
  3339. ppdu_info->msdu[user_id].last_msdu =
  3340. rx_msdu_end->last_msdu;
  3341. ppdu_info->msdu[user_id].msdu_len =
  3342. rx_msdu_end->msdu_length;
  3343. ppdu_info->msdu[user_id].user_rssi =
  3344. rx_msdu_end->user_rssi;
  3345. ppdu_info->msdu[user_id].reception_type =
  3346. rx_msdu_end->reception_type;
  3347. }
  3348. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3349. return HAL_TLV_STATUS_MSDU_END;
  3350. }
  3351. case WIFIMON_BUFFER_ADDR_E:
  3352. hal_rx_status_get_mon_buf_addr(rx_tlv, ppdu_info);
  3353. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3354. return HAL_TLV_STATUS_MON_BUF_ADDR;
  3355. case WIFIMON_DROP_E:
  3356. hal_rx_update_ppdu_drop_cnt(rx_tlv, ppdu_info);
  3357. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3358. return HAL_TLV_STATUS_MON_DROP;
  3359. case 0:
  3360. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3361. return HAL_TLV_STATUS_PPDU_DONE;
  3362. case WIFIRX_STATUS_BUFFER_DONE_E:
  3363. case WIFIPHYRX_DATA_DONE_E:
  3364. case WIFIPHYRX_PKT_END_PART1_E:
  3365. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3366. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  3367. default:
  3368. hal_debug("unhandled tlv tag %d", tlv_tag);
  3369. }
  3370. hal_rx_record_tlv_info(ppdu_info, tlv_tag);
  3371. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  3372. }
  3373. static uint32_t
  3374. hal_rx_status_process_aggr_tlv(struct hal_soc *hal_soc,
  3375. struct hal_rx_ppdu_info *ppdu_info)
  3376. {
  3377. uint32_t aggr_tlv_tag = ppdu_info->tlv_aggr.tlv_tag;
  3378. switch (aggr_tlv_tag) {
  3379. case WIFIPHYRX_GENERIC_EHT_SIG_E:
  3380. hal_rx_parse_eht_sig_hdr(hal_soc, ppdu_info->tlv_aggr.buf,
  3381. ppdu_info);
  3382. break;
  3383. default:
  3384. /* Aggregated TLV cannot be handled */
  3385. qdf_assert(0);
  3386. break;
  3387. }
  3388. ppdu_info->tlv_aggr.in_progress = 0;
  3389. ppdu_info->tlv_aggr.cur_len = 0;
  3390. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  3391. }
  3392. static inline bool
  3393. hal_rx_status_tlv_should_aggregate(struct hal_soc *hal_soc, uint32_t tlv_tag)
  3394. {
  3395. switch (tlv_tag) {
  3396. case WIFIPHYRX_GENERIC_EHT_SIG_E:
  3397. return true;
  3398. }
  3399. return false;
  3400. }
  3401. static inline uint32_t
  3402. hal_rx_status_aggr_tlv(struct hal_soc *hal_soc, void *rx_tlv_hdr,
  3403. struct hal_rx_ppdu_info *ppdu_info,
  3404. qdf_nbuf_t nbuf)
  3405. {
  3406. uint32_t tlv_tag, user_id, tlv_len;
  3407. void *rx_tlv;
  3408. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv_hdr);
  3409. user_id = HAL_RX_GET_USER_TLV32_USERID(rx_tlv_hdr);
  3410. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv_hdr);
  3411. rx_tlv = (uint8_t *)rx_tlv_hdr + HAL_RX_TLV_HDR_SIZE;
  3412. if (tlv_len <= HAL_RX_MON_MAX_AGGR_SIZE - ppdu_info->tlv_aggr.cur_len) {
  3413. qdf_mem_copy(ppdu_info->tlv_aggr.buf +
  3414. ppdu_info->tlv_aggr.cur_len,
  3415. rx_tlv, tlv_len);
  3416. ppdu_info->tlv_aggr.cur_len += tlv_len;
  3417. } else {
  3418. dp_err("Length of TLV exceeds max aggregation length");
  3419. qdf_assert(0);
  3420. }
  3421. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  3422. }
  3423. static inline uint32_t
  3424. hal_rx_status_start_new_aggr_tlv(struct hal_soc *hal_soc, void *rx_tlv_hdr,
  3425. struct hal_rx_ppdu_info *ppdu_info,
  3426. qdf_nbuf_t nbuf)
  3427. {
  3428. uint32_t tlv_tag, user_id, tlv_len;
  3429. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv_hdr);
  3430. user_id = HAL_RX_GET_USER_TLV32_USERID(rx_tlv_hdr);
  3431. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv_hdr);
  3432. ppdu_info->tlv_aggr.in_progress = 1;
  3433. ppdu_info->tlv_aggr.tlv_tag = tlv_tag;
  3434. ppdu_info->tlv_aggr.cur_len = 0;
  3435. ppdu_info->tlv_aggr.rd_idx = 0;
  3436. return hal_rx_status_aggr_tlv(hal_soc, rx_tlv_hdr, ppdu_info, nbuf);
  3437. }
  3438. static inline uint32_t
  3439. hal_rx_status_get_tlv_info_wrapper_be(void *rx_tlv_hdr, void *ppduinfo,
  3440. hal_soc_handle_t hal_soc_hdl,
  3441. qdf_nbuf_t nbuf)
  3442. {
  3443. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  3444. uint32_t tlv_tag, user_id, tlv_len;
  3445. struct hal_rx_ppdu_info *ppdu_info =
  3446. (struct hal_rx_ppdu_info *)ppduinfo;
  3447. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(rx_tlv_hdr);
  3448. user_id = HAL_RX_GET_USER_TLV32_USERID(rx_tlv_hdr);
  3449. tlv_len = HAL_RX_GET_USER_TLV32_LEN(rx_tlv_hdr);
  3450. /*
  3451. * Handle the case where aggregation is in progress
  3452. * or the current TLV is one of the TLVs which should be
  3453. * aggregated
  3454. */
  3455. if (ppdu_info->tlv_aggr.in_progress) {
  3456. if (ppdu_info->tlv_aggr.tlv_tag == tlv_tag) {
  3457. return hal_rx_status_aggr_tlv(hal, rx_tlv_hdr,
  3458. ppdu_info, nbuf);
  3459. } else {
  3460. /* Finish aggregation of current TLV */
  3461. hal_rx_status_process_aggr_tlv(hal, ppdu_info);
  3462. }
  3463. }
  3464. if (hal_rx_status_tlv_should_aggregate(hal, tlv_tag)) {
  3465. return hal_rx_status_start_new_aggr_tlv(hal, rx_tlv_hdr,
  3466. ppduinfo, nbuf);
  3467. }
  3468. return hal_rx_status_get_tlv_info_generic_be(rx_tlv_hdr, ppduinfo,
  3469. hal_soc_hdl, nbuf);
  3470. }
  3471. #endif /* _HAL_BE_API_MON_H_ */