hal_be_api_mon.h 100 KB

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