hal_be_api_mon.h 97 KB

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