hal_be_api_mon.h 98 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169
  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. #define HAL_MAX_DL_MU_USERS 37
  656. #define HAL_MAX_RU_INDEX 7
  657. enum hal_tx_tlv_status {
  658. HAL_MON_TX_FES_SETUP,
  659. HAL_MON_TX_FES_STATUS_END,
  660. HAL_MON_RX_RESPONSE_REQUIRED_INFO,
  661. HAL_MON_RESPONSE_END_STATUS_INFO,
  662. HAL_MON_TX_PCU_PPDU_SETUP_INIT,
  663. HAL_MON_TX_MPDU_START,
  664. HAL_MON_TX_MSDU_START,
  665. HAL_MON_TX_BUFFER_ADDR,
  666. HAL_MON_TX_DATA,
  667. HAL_MON_TX_FES_STATUS_START,
  668. HAL_MON_TX_FES_STATUS_PROT,
  669. HAL_MON_TX_FES_STATUS_START_PROT,
  670. HAL_MON_TX_FES_STATUS_START_PPDU,
  671. HAL_MON_TX_FES_STATUS_USER_PPDU,
  672. HAL_MON_TX_QUEUE_EXTENSION,
  673. HAL_MON_RX_FRAME_BITMAP_ACK,
  674. HAL_MON_RX_FRAME_BITMAP_BLOCK_ACK_256,
  675. HAL_MON_RX_FRAME_BITMAP_BLOCK_ACK_1K,
  676. HAL_MON_COEX_TX_STATUS,
  677. HAL_MON_MACTX_HE_SIG_A_SU,
  678. HAL_MON_MACTX_HE_SIG_A_MU_DL,
  679. HAL_MON_MACTX_HE_SIG_B1_MU,
  680. HAL_MON_MACTX_HE_SIG_B2_MU,
  681. HAL_MON_MACTX_HE_SIG_B2_OFDMA,
  682. HAL_MON_MACTX_L_SIG_A,
  683. HAL_MON_MACTX_L_SIG_B,
  684. HAL_MON_MACTX_HT_SIG,
  685. HAL_MON_MACTX_VHT_SIG_A,
  686. HAL_MON_MACTX_USER_DESC_PER_USER,
  687. HAL_MON_MACTX_USER_DESC_COMMON,
  688. HAL_MON_MACTX_PHY_DESC,
  689. HAL_MON_TX_STATUS_PPDU_NOT_DONE,
  690. };
  691. enum txmon_coex_tx_status_reason {
  692. COEX_FES_TX_START,
  693. COEX_FES_TX_END,
  694. COEX_FES_END,
  695. COEX_RESPONSE_TX_START,
  696. COEX_RESPONSE_TX_END,
  697. COEX_NO_TX_ONGOING,
  698. };
  699. enum txmon_transmission_type {
  700. TXMON_SU_TRANSMISSION = 0,
  701. TXMON_MU_TRANSMISSION,
  702. TXMON_MU_SU_TRANSMISSION,
  703. TXMON_MU_MIMO_TRANSMISSION = 1,
  704. TXMON_MU_OFDMA_TRANMISSION
  705. };
  706. enum txmon_he_ppdu_subtype {
  707. TXMON_HE_SUBTYPE_SU = 0,
  708. TXMON_HE_SUBTYPE_TRIG,
  709. TXMON_HE_SUBTYPE_MU,
  710. TXMON_HE_SUBTYPE_EXT_SU
  711. };
  712. enum txmon_pkt_type {
  713. TXMON_PKT_TYPE_11A = 0,
  714. TXMON_PKT_TYPE_11B,
  715. TXMON_PKT_TYPE_11N_MM,
  716. TXMON_PKT_TYPE_11AC,
  717. TXMON_PKT_TYPE_11AX,
  718. TXMON_PKT_TYPE_11BA,
  719. TXMON_PKT_TYPE_11BE,
  720. TXMON_PKT_TYPE_11AZ
  721. };
  722. enum txmon_generated_response {
  723. TXMON_GEN_RESP_SELFGEN_ACK = 0,
  724. TXMON_GEN_RESP_SELFGEN_CTS,
  725. TXMON_GEN_RESP_SELFGEN_BA,
  726. TXMON_GEN_RESP_SELFGEN_MBA,
  727. TXMON_GEN_RESP_SELFGEN_CBF,
  728. TXMON_GEN_RESP_SELFGEN_TRIG,
  729. TXMON_GEN_RESP_SELFGEN_NDP_LMR
  730. };
  731. #define IS_MULTI_USERS(num_users) (!!(0xFFFE & num_users))
  732. #define TXMON_HAL(hal_tx_ppdu_info, field) \
  733. hal_tx_ppdu_info->field
  734. #define TXMON_HAL_STATUS(hal_tx_ppdu_info, field) \
  735. hal_tx_ppdu_info->rx_status.field
  736. #define TXMON_HAL_USER(hal_tx_ppdu_info, user_id, field) \
  737. hal_tx_ppdu_info->rx_user_status[user_id].field
  738. #define TXMON_STATUS_INFO(hal_tx_status_info, field) \
  739. hal_tx_status_info->field
  740. /**
  741. * struct hal_tx_status_info - status info that wasn't populated in rx_status
  742. * @reception_type: su or uplink mu reception type
  743. * @transmission_type: su or mu transmission type
  744. * @medium_prot_type: medium protection type
  745. * @generated_response: Generated frame in response window
  746. * @no_bitmap_avail: Bitmap available flag
  747. * @explicit_ack: Explicit Acknowledge flag
  748. * @explicit_ack_type: Explicit Acknowledge type
  749. * @r2r_end_status_follow: Response to Response status flag
  750. * @response_type: Response type in response window
  751. * @ndp_frame: NDP frame
  752. * @num_users: number of users
  753. * @sw_frame_group_id: software frame group ID
  754. * @r2r_to_follow: Response to Response follow flag
  755. * @buffer: Packet buffer pointer address
  756. * @offset: Packet buffer offset
  757. * @length: Packet buffer length
  758. * @protection_addr: Protection Address flag
  759. * @addr1: MAC address 1
  760. * @addr2: MAC address 2
  761. * @addr3: MAC address 3
  762. * @addr4: MAC address 4
  763. */
  764. struct hal_tx_status_info {
  765. uint8_t reception_type;
  766. uint8_t transmission_type;
  767. uint8_t medium_prot_type;
  768. uint8_t generated_response;
  769. uint32_t no_bitmap_avail :1,
  770. explicit_ack :1,
  771. explicit_ack_type :4,
  772. r2r_end_status_follow :1,
  773. response_type :5,
  774. ndp_frame :2,
  775. num_users :8,
  776. reserved :10;
  777. uint8_t mba_count;
  778. uint8_t mba_fake_bitmap_count;
  779. uint8_t sw_frame_group_id;
  780. uint32_t r2r_to_follow;
  781. uint16_t phy_abort_reason;
  782. uint8_t phy_abort_user_number;
  783. void *buffer;
  784. uint32_t offset;
  785. uint32_t length;
  786. uint8_t protection_addr;
  787. uint8_t addr1[QDF_MAC_ADDR_SIZE];
  788. uint8_t addr2[QDF_MAC_ADDR_SIZE];
  789. uint8_t addr3[QDF_MAC_ADDR_SIZE];
  790. uint8_t addr4[QDF_MAC_ADDR_SIZE];
  791. };
  792. /**
  793. * struct hal_tx_ppdu_info - tx monitor ppdu information
  794. * @ppdu_id: Id of the PLCP protocol data unit
  795. * @num_users: number of users
  796. * @is_used: boolean flag to identify valid ppdu info
  797. * @is_data: boolean flag to identify data frame
  798. * @cur_usr_idx: Current user index of the PPDU
  799. * @reserved: for future purpose
  800. * @prot_tlv_status: protection tlv status
  801. * @packet_info: packet information
  802. * @rx_status: monitor mode rx status information
  803. * @rx_user_status: monitor mode rx user status information
  804. */
  805. struct hal_tx_ppdu_info {
  806. uint32_t ppdu_id;
  807. uint32_t num_users :8,
  808. is_used :1,
  809. is_data :1,
  810. cur_usr_idx :8,
  811. reserved :15;
  812. uint32_t prot_tlv_status;
  813. /* placeholder to hold packet buffer info */
  814. struct hal_mon_packet_info packet_info;
  815. struct mon_rx_status rx_status;
  816. struct mon_rx_user_status rx_user_status[];
  817. };
  818. /**
  819. * hal_tx_status_get_next_tlv() - get next tx status TLV
  820. * @tx_tlv: pointer to TLV header
  821. *
  822. * Return: pointer to next tlv info
  823. */
  824. static inline uint8_t*
  825. hal_tx_status_get_next_tlv(uint8_t *tx_tlv) {
  826. uint32_t tlv_len, tlv_tag;
  827. tlv_len = HAL_RX_GET_USER_TLV32_LEN(tx_tlv);
  828. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(tx_tlv);
  829. return (uint8_t *)(((unsigned long)(tx_tlv + tlv_len +
  830. HAL_RX_TLV32_HDR_SIZE + 7)) & (~7));
  831. }
  832. /**
  833. * hal_txmon_status_parse_tlv() - process transmit info TLV
  834. * @hal_soc: HAL soc handle
  835. * @data_ppdu_info: pointer to hal data ppdu info
  836. * @prot_ppdu_info: pointer to hal prot ppdu info
  837. * @data_status_info: pointer to data status info
  838. * @prot_status_info: pointer to prot status info
  839. * @tx_tlv_hdr: pointer to TLV header
  840. * @status_frag: pointer to status frag
  841. *
  842. * Return: HAL_TLV_STATUS_PPDU_NOT_DONE
  843. */
  844. static inline uint32_t
  845. hal_txmon_status_parse_tlv(hal_soc_handle_t hal_soc_hdl,
  846. void *data_ppdu_info,
  847. void *prot_ppdu_info,
  848. void *data_status_info,
  849. void *prot_status_info,
  850. void *tx_tlv_hdr,
  851. qdf_frag_t status_frag)
  852. {
  853. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  854. return hal_soc->ops->hal_txmon_status_parse_tlv(data_ppdu_info,
  855. prot_ppdu_info,
  856. data_status_info,
  857. prot_status_info,
  858. tx_tlv_hdr,
  859. status_frag);
  860. }
  861. /**
  862. * hal_txmon_status_get_num_users() - api to get num users from start of fes
  863. * window
  864. * @hal_soc: HAL soc handle
  865. * @tx_tlv_hdr: pointer to TLV header
  866. * @num_users: reference to number of user
  867. *
  868. * Return: status
  869. */
  870. static inline uint32_t
  871. hal_txmon_status_get_num_users(hal_soc_handle_t hal_soc_hdl,
  872. void *tx_tlv_hdr, uint8_t *num_users)
  873. {
  874. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  875. return hal_soc->ops->hal_txmon_status_get_num_users(tx_tlv_hdr,
  876. num_users);
  877. }
  878. /**
  879. * hal_tx_status_get_tlv_tag() - api to get tlv tag
  880. * @tx_tlv_hdr: pointer to TLV header
  881. *
  882. * Return tlv_tag
  883. */
  884. static inline uint32_t
  885. hal_tx_status_get_tlv_tag(void *tx_tlv_hdr)
  886. {
  887. uint32_t tlv_tag = 0;
  888. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(tx_tlv_hdr);
  889. return tlv_tag;
  890. }
  891. #endif
  892. /**
  893. * hal_txmon_is_mon_buf_addr_tlv() - api to find packet buffer addr tlv
  894. * @hal_soc: HAL soc handle
  895. * @tx_tlv_hdr: pointer to TLV header
  896. *
  897. * Return: bool
  898. */
  899. static inline bool
  900. hal_txmon_is_mon_buf_addr_tlv(hal_soc_handle_t hal_soc_hdl, void *tx_tlv_hdr)
  901. {
  902. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  903. if (qdf_unlikely(!hal_soc->ops->hal_txmon_is_mon_buf_addr_tlv))
  904. return false;
  905. return hal_soc->ops->hal_txmon_is_mon_buf_addr_tlv(tx_tlv_hdr);
  906. }
  907. /**
  908. * hal_txmon_populate_packet_info() - api to populate packet info
  909. * @hal_soc: HAL soc handle
  910. * @tx_tlv_hdr: pointer to TLV header
  911. * @packet_info: pointer to placeholder for packet info
  912. *
  913. * Return void
  914. */
  915. static inline void
  916. hal_txmon_populate_packet_info(hal_soc_handle_t hal_soc_hdl,
  917. void *tx_tlv_hdr,
  918. void *packet_info)
  919. {
  920. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  921. if (qdf_unlikely(!hal_soc->ops->hal_txmon_populate_packet_info))
  922. return;
  923. hal_soc->ops->hal_txmon_populate_packet_info(tx_tlv_hdr, packet_info);
  924. }
  925. static inline uint32_t
  926. hal_rx_parse_u_sig_cmn(struct hal_soc *hal_soc, void *rx_tlv,
  927. struct hal_rx_ppdu_info *ppdu_info)
  928. {
  929. struct hal_mon_usig_hdr *usig = (struct hal_mon_usig_hdr *)rx_tlv;
  930. struct hal_mon_usig_cmn *usig_1 = &usig->usig_1;
  931. uint8_t bad_usig_crc;
  932. bad_usig_crc = HAL_RX_MON_USIG_GET_RX_INTEGRITY_CHECK_PASSED(rx_tlv) ?
  933. 0 : 1;
  934. ppdu_info->rx_status.usig_common |=
  935. QDF_MON_STATUS_USIG_PHY_VERSION_KNOWN |
  936. QDF_MON_STATUS_USIG_BW_KNOWN |
  937. QDF_MON_STATUS_USIG_UL_DL_KNOWN |
  938. QDF_MON_STATUS_USIG_BSS_COLOR_KNOWN |
  939. QDF_MON_STATUS_USIG_TXOP_KNOWN;
  940. ppdu_info->rx_status.usig_common |= (usig_1->phy_version <<
  941. QDF_MON_STATUS_USIG_PHY_VERSION_SHIFT);
  942. ppdu_info->rx_status.usig_common |= (usig_1->bw <<
  943. QDF_MON_STATUS_USIG_BW_SHIFT);
  944. ppdu_info->rx_status.usig_common |= (usig_1->ul_dl <<
  945. QDF_MON_STATUS_USIG_UL_DL_SHIFT);
  946. ppdu_info->rx_status.usig_common |= (usig_1->bss_color <<
  947. QDF_MON_STATUS_USIG_BSS_COLOR_SHIFT);
  948. ppdu_info->rx_status.usig_common |= (usig_1->txop <<
  949. QDF_MON_STATUS_USIG_TXOP_SHIFT);
  950. ppdu_info->rx_status.usig_common |= bad_usig_crc;
  951. ppdu_info->u_sig_info.ul_dl = usig_1->ul_dl;
  952. ppdu_info->u_sig_info.bw = usig_1->bw;
  953. ppdu_info->rx_status.bw = usig_1->bw;
  954. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  955. }
  956. static inline uint32_t
  957. hal_rx_parse_u_sig_tb(struct hal_soc *hal_soc, void *rx_tlv,
  958. struct hal_rx_ppdu_info *ppdu_info)
  959. {
  960. struct hal_mon_usig_hdr *usig = (struct hal_mon_usig_hdr *)rx_tlv;
  961. struct hal_mon_usig_tb *usig_tb = &usig->usig_2.tb;
  962. ppdu_info->rx_status.usig_mask |=
  963. QDF_MON_STATUS_USIG_DISREGARD_KNOWN |
  964. QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_KNOWN |
  965. QDF_MON_STATUS_USIG_VALIDATE_KNOWN |
  966. QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_1_KNOWN |
  967. QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_2_KNOWN |
  968. QDF_MON_STATUS_USIG_TB_DISREGARD1_KNOWN |
  969. QDF_MON_STATUS_USIG_CRC_KNOWN |
  970. QDF_MON_STATUS_USIG_TAIL_KNOWN;
  971. ppdu_info->rx_status.usig_value |= (0x3F <<
  972. QDF_MON_STATUS_USIG_DISREGARD_SHIFT);
  973. ppdu_info->rx_status.usig_value |= (usig_tb->ppdu_type_comp_mode <<
  974. QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_SHIFT);
  975. ppdu_info->rx_status.usig_value |= (0x1 <<
  976. QDF_MON_STATUS_USIG_VALIDATE_SHIFT);
  977. ppdu_info->rx_status.usig_value |= (usig_tb->spatial_reuse_1 <<
  978. QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_1_SHIFT);
  979. ppdu_info->rx_status.usig_value |= (usig_tb->spatial_reuse_2 <<
  980. QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_2_SHIFT);
  981. ppdu_info->rx_status.usig_value |= (0x1F <<
  982. QDF_MON_STATUS_USIG_TB_DISREGARD1_SHIFT);
  983. ppdu_info->rx_status.usig_value |= (usig_tb->crc <<
  984. QDF_MON_STATUS_USIG_CRC_SHIFT);
  985. ppdu_info->rx_status.usig_value |= (usig_tb->tail <<
  986. QDF_MON_STATUS_USIG_TAIL_SHIFT);
  987. ppdu_info->u_sig_info.ppdu_type_comp_mode =
  988. usig_tb->ppdu_type_comp_mode;
  989. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  990. }
  991. static inline uint32_t
  992. hal_rx_parse_u_sig_mu(struct hal_soc *hal_soc, void *rx_tlv,
  993. struct hal_rx_ppdu_info *ppdu_info)
  994. {
  995. struct hal_mon_usig_hdr *usig = (struct hal_mon_usig_hdr *)rx_tlv;
  996. struct hal_mon_usig_mu *usig_mu = &usig->usig_2.mu;
  997. ppdu_info->rx_status.usig_mask |=
  998. QDF_MON_STATUS_USIG_DISREGARD_KNOWN |
  999. QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_KNOWN |
  1000. QDF_MON_STATUS_USIG_VALIDATE_KNOWN |
  1001. QDF_MON_STATUS_USIG_MU_VALIDATE1_KNOWN |
  1002. QDF_MON_STATUS_USIG_MU_PUNCTURE_CH_INFO_KNOWN |
  1003. QDF_MON_STATUS_USIG_MU_VALIDATE2_KNOWN |
  1004. QDF_MON_STATUS_USIG_MU_EHT_SIG_MCS_KNOWN |
  1005. QDF_MON_STATUS_USIG_MU_NUM_EHT_SIG_SYM_KNOWN |
  1006. QDF_MON_STATUS_USIG_CRC_KNOWN |
  1007. QDF_MON_STATUS_USIG_TAIL_KNOWN;
  1008. ppdu_info->rx_status.usig_value |= (0x1F <<
  1009. QDF_MON_STATUS_USIG_DISREGARD_SHIFT);
  1010. ppdu_info->rx_status.usig_value |= (0x1 <<
  1011. QDF_MON_STATUS_USIG_MU_VALIDATE1_SHIFT);
  1012. ppdu_info->rx_status.usig_value |= (usig_mu->ppdu_type_comp_mode <<
  1013. QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_SHIFT);
  1014. ppdu_info->rx_status.usig_value |= (0x1 <<
  1015. QDF_MON_STATUS_USIG_VALIDATE_SHIFT);
  1016. ppdu_info->rx_status.usig_value |= (usig_mu->punc_ch_info <<
  1017. QDF_MON_STATUS_USIG_MU_PUNCTURE_CH_INFO_SHIFT);
  1018. ppdu_info->rx_status.usig_value |= (0x1 <<
  1019. QDF_MON_STATUS_USIG_MU_VALIDATE2_SHIFT);
  1020. ppdu_info->rx_status.usig_value |= (usig_mu->eht_sig_mcs <<
  1021. QDF_MON_STATUS_USIG_MU_EHT_SIG_MCS_SHIFT);
  1022. ppdu_info->rx_status.usig_value |= (usig_mu->num_eht_sig_sym <<
  1023. QDF_MON_STATUS_USIG_MU_NUM_EHT_SIG_SYM_SHIFT);
  1024. ppdu_info->rx_status.usig_value |= (usig_mu->crc <<
  1025. QDF_MON_STATUS_USIG_CRC_SHIFT);
  1026. ppdu_info->rx_status.usig_value |= (usig_mu->tail <<
  1027. QDF_MON_STATUS_USIG_TAIL_SHIFT);
  1028. ppdu_info->u_sig_info.ppdu_type_comp_mode =
  1029. usig_mu->ppdu_type_comp_mode;
  1030. ppdu_info->u_sig_info.eht_sig_mcs = usig_mu->eht_sig_mcs;
  1031. ppdu_info->u_sig_info.num_eht_sig_sym = usig_mu->num_eht_sig_sym;
  1032. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1033. }
  1034. static inline uint32_t
  1035. hal_rx_parse_u_sig_hdr(struct hal_soc *hal_soc, void *rx_tlv,
  1036. struct hal_rx_ppdu_info *ppdu_info)
  1037. {
  1038. struct hal_mon_usig_hdr *usig = (struct hal_mon_usig_hdr *)rx_tlv;
  1039. struct hal_mon_usig_cmn *usig_1 = &usig->usig_1;
  1040. ppdu_info->rx_status.usig_flags = 1;
  1041. hal_rx_parse_u_sig_cmn(hal_soc, rx_tlv, ppdu_info);
  1042. if (HAL_RX_MON_USIG_GET_PPDU_TYPE_N_COMP_MODE(rx_tlv) == 0 &&
  1043. usig_1->ul_dl == 1)
  1044. return hal_rx_parse_u_sig_tb(hal_soc, rx_tlv, ppdu_info);
  1045. else
  1046. return hal_rx_parse_u_sig_mu(hal_soc, rx_tlv, ppdu_info);
  1047. }
  1048. static inline uint32_t
  1049. hal_rx_parse_usig_overflow(struct hal_soc *hal_soc, void *tlv,
  1050. struct hal_rx_ppdu_info *ppdu_info)
  1051. {
  1052. struct hal_eht_sig_cc_usig_overflow *usig_ovflow =
  1053. (struct hal_eht_sig_cc_usig_overflow *)tlv;
  1054. ppdu_info->rx_status.eht_known |=
  1055. QDF_MON_STATUS_EHT_SPATIAL_REUSE_KNOWN |
  1056. QDF_MON_STATUS_EHT_EHT_LTF_KNOWN |
  1057. QDF_MON_STATUS_EHT_LDPC_EXTRA_SYMBOL_SEG_KNOWN |
  1058. QDF_MON_STATUS_EHT_PRE_FEC_PADDING_FACTOR_KNOWN |
  1059. QDF_MON_STATUS_EHT_PE_DISAMBIGUITY_KNOWN |
  1060. QDF_MON_STATUS_EHT_DISREARD_KNOWN;
  1061. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->spatial_reuse <<
  1062. QDF_MON_STATUS_EHT_SPATIAL_REUSE_SHIFT);
  1063. /*
  1064. * GI and LTF size are separately indicated in radiotap header
  1065. * and hence will be parsed from other TLV
  1066. **/
  1067. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->num_ltf_sym <<
  1068. QDF_MON_STATUS_EHT_EHT_LTF_SHIFT);
  1069. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->ldpc_extra_sym <<
  1070. QDF_MON_STATUS_EHT_LDPC_EXTRA_SYMBOL_SEG_SHIFT);
  1071. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->pre_fec_pad_factor <<
  1072. QDF_MON_STATUS_EHT_PRE_FEC_PADDING_FACTOR_SHIFT);
  1073. ppdu_info->rx_status.eht_data[0] |= (usig_ovflow->pe_disambiguity <<
  1074. QDF_MON_STATUS_EHT_PE_DISAMBIGUITY_SHIFT);
  1075. ppdu_info->rx_status.eht_data[0] |= (0xF <<
  1076. QDF_MON_STATUS_EHT_DISREGARD_SHIFT);
  1077. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1078. }
  1079. static inline uint32_t
  1080. hal_rx_parse_non_ofdma_users(struct hal_soc *hal_soc, void *tlv,
  1081. struct hal_rx_ppdu_info *ppdu_info)
  1082. {
  1083. struct hal_eht_sig_non_ofdma_cmn_eb *non_ofdma_cmn_eb =
  1084. (struct hal_eht_sig_non_ofdma_cmn_eb *)tlv;
  1085. ppdu_info->rx_status.eht_known |=
  1086. QDF_MON_STATUS_EHT_NUM_NON_OFDMA_USERS_KNOWN;
  1087. ppdu_info->rx_status.eht_data[4] |= (non_ofdma_cmn_eb->num_users <<
  1088. QDF_MON_STATUS_EHT_NUM_NON_OFDMA_USERS_SHIFT);
  1089. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1090. }
  1091. static inline uint32_t
  1092. hal_rx_parse_ru_allocation(struct hal_soc *hal_soc, void *tlv,
  1093. struct hal_rx_ppdu_info *ppdu_info)
  1094. {
  1095. uint64_t *ehtsig_tlv = (uint64_t *)tlv;
  1096. struct hal_eht_sig_ofdma_cmn_eb1 *ofdma_cmn_eb1;
  1097. struct hal_eht_sig_ofdma_cmn_eb2 *ofdma_cmn_eb2;
  1098. uint8_t num_ru_allocation_known = 0;
  1099. ofdma_cmn_eb1 = (struct hal_eht_sig_ofdma_cmn_eb1 *)ehtsig_tlv;
  1100. ofdma_cmn_eb2 = (struct hal_eht_sig_ofdma_cmn_eb2 *)(ehtsig_tlv + 1);
  1101. switch (ppdu_info->u_sig_info.bw) {
  1102. case HAL_EHT_BW_320_2:
  1103. case HAL_EHT_BW_320_1:
  1104. num_ru_allocation_known += 4;
  1105. ppdu_info->rx_status.eht_data[3] |=
  1106. (ofdma_cmn_eb2->ru_allocation2_6 <<
  1107. QDF_MON_STATUS_EHT_RU_ALLOCATION2_6_SHIFT);
  1108. ppdu_info->rx_status.eht_data[3] |=
  1109. (ofdma_cmn_eb2->ru_allocation2_5 <<
  1110. QDF_MON_STATUS_EHT_RU_ALLOCATION2_5_SHIFT);
  1111. ppdu_info->rx_status.eht_data[3] |=
  1112. (ofdma_cmn_eb2->ru_allocation2_4 <<
  1113. QDF_MON_STATUS_EHT_RU_ALLOCATION2_4_SHIFT);
  1114. ppdu_info->rx_status.eht_data[2] |=
  1115. (ofdma_cmn_eb2->ru_allocation2_3 <<
  1116. QDF_MON_STATUS_EHT_RU_ALLOCATION2_3_SHIFT);
  1117. fallthrough;
  1118. case HAL_EHT_BW_160:
  1119. num_ru_allocation_known += 2;
  1120. ppdu_info->rx_status.eht_data[2] |=
  1121. (ofdma_cmn_eb2->ru_allocation2_2 <<
  1122. QDF_MON_STATUS_EHT_RU_ALLOCATION2_2_SHIFT);
  1123. ppdu_info->rx_status.eht_data[2] |=
  1124. (ofdma_cmn_eb2->ru_allocation2_1 <<
  1125. QDF_MON_STATUS_EHT_RU_ALLOCATION2_1_SHIFT);
  1126. fallthrough;
  1127. case HAL_EHT_BW_80:
  1128. num_ru_allocation_known += 1;
  1129. ppdu_info->rx_status.eht_data[1] |=
  1130. (ofdma_cmn_eb1->ru_allocation1_2 <<
  1131. QDF_MON_STATUS_EHT_RU_ALLOCATION1_2_SHIFT);
  1132. fallthrough;
  1133. case HAL_EHT_BW_40:
  1134. case HAL_EHT_BW_20:
  1135. num_ru_allocation_known += 1;
  1136. ppdu_info->rx_status.eht_data[1] |=
  1137. (ofdma_cmn_eb1->ru_allocation1_1 <<
  1138. QDF_MON_STATUS_EHT_RU_ALLOCATION1_1_SHIFT);
  1139. break;
  1140. default:
  1141. break;
  1142. }
  1143. ppdu_info->rx_status.eht_known |= (num_ru_allocation_known <<
  1144. QDF_MON_STATUS_EHT_NUM_KNOWN_RU_ALLOCATIONS_SHIFT);
  1145. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1146. }
  1147. static inline uint32_t
  1148. hal_rx_parse_eht_sig_mumimo_user_info(struct hal_soc *hal_soc, void *tlv,
  1149. struct hal_rx_ppdu_info *ppdu_info)
  1150. {
  1151. struct hal_eht_sig_mu_mimo_user_info *user_info;
  1152. uint32_t user_idx = ppdu_info->rx_status.num_eht_user_info_valid;
  1153. user_info = (struct hal_eht_sig_mu_mimo_user_info *)tlv;
  1154. ppdu_info->rx_status.eht_user_info[user_idx] |=
  1155. QDF_MON_STATUS_EHT_USER_STA_ID_KNOWN |
  1156. QDF_MON_STATUS_EHT_USER_MCS_KNOWN |
  1157. QDF_MON_STATUS_EHT_USER_CODING_KNOWN |
  1158. QDF_MON_STATUS_EHT_USER_SPATIAL_CONFIG_KNOWN;
  1159. ppdu_info->rx_status.eht_user_info[user_idx] |= (user_info->sta_id <<
  1160. QDF_MON_STATUS_EHT_USER_STA_ID_SHIFT);
  1161. ppdu_info->rx_status.eht_user_info[user_idx] |= (user_info->mcs <<
  1162. QDF_MON_STATUS_EHT_USER_MCS_SHIFT);
  1163. ppdu_info->rx_status.mcs = user_info->mcs;
  1164. ppdu_info->rx_status.eht_user_info[user_idx] |= (user_info->coding <<
  1165. QDF_MON_STATUS_EHT_USER_CODING_SHIFT);
  1166. ppdu_info->rx_status.eht_user_info[user_idx] |=
  1167. (user_info->spatial_coding <<
  1168. QDF_MON_STATUS_EHT_USER_SPATIAL_CONFIG_SHIFT);
  1169. /* CRC for matched user block */
  1170. ppdu_info->rx_status.eht_known |=
  1171. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_KNOWN |
  1172. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_TAIL_KNOWN;
  1173. ppdu_info->rx_status.eht_data[4] |= (user_info->crc <<
  1174. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_SHIFT);
  1175. ppdu_info->rx_status.num_eht_user_info_valid++;
  1176. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1177. }
  1178. static inline uint32_t
  1179. hal_rx_parse_eht_sig_non_mumimo_user_info(struct hal_soc *hal_soc, void *tlv,
  1180. struct hal_rx_ppdu_info *ppdu_info)
  1181. {
  1182. struct hal_eht_sig_non_mu_mimo_user_info *user_info;
  1183. uint32_t user_idx = ppdu_info->rx_status.num_eht_user_info_valid;
  1184. user_info = (struct hal_eht_sig_non_mu_mimo_user_info *)tlv;
  1185. ppdu_info->rx_status.eht_user_info[user_idx] |=
  1186. QDF_MON_STATUS_EHT_USER_STA_ID_KNOWN |
  1187. QDF_MON_STATUS_EHT_USER_MCS_KNOWN |
  1188. QDF_MON_STATUS_EHT_USER_CODING_KNOWN |
  1189. QDF_MON_STATUS_EHT_USER_NSS_KNOWN |
  1190. QDF_MON_STATUS_EHT_USER_BEAMFORMING_KNOWN;
  1191. ppdu_info->rx_status.eht_user_info[user_idx] |= (user_info->sta_id <<
  1192. QDF_MON_STATUS_EHT_USER_STA_ID_SHIFT);
  1193. ppdu_info->rx_status.eht_user_info[user_idx] |= (user_info->mcs <<
  1194. QDF_MON_STATUS_EHT_USER_MCS_SHIFT);
  1195. ppdu_info->rx_status.mcs = user_info->mcs;
  1196. ppdu_info->rx_status.eht_user_info[user_idx] |= (user_info->nss <<
  1197. QDF_MON_STATUS_EHT_USER_NSS_SHIFT);
  1198. ppdu_info->rx_status.nss = user_info->nss + 1;
  1199. ppdu_info->rx_status.eht_user_info[user_idx] |=
  1200. (user_info->beamformed <<
  1201. QDF_MON_STATUS_EHT_USER_BEAMFORMING_SHIFT);
  1202. ppdu_info->rx_status.eht_user_info[user_idx] |= (user_info->coding <<
  1203. QDF_MON_STATUS_EHT_USER_CODING_SHIFT);
  1204. /* CRC for matched user block */
  1205. ppdu_info->rx_status.eht_known |=
  1206. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_KNOWN |
  1207. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_TAIL_KNOWN;
  1208. ppdu_info->rx_status.eht_data[4] |= (user_info->crc <<
  1209. QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_SHIFT);
  1210. ppdu_info->rx_status.num_eht_user_info_valid++;
  1211. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1212. }
  1213. static inline bool hal_rx_is_ofdma(struct hal_soc *hal_soc,
  1214. struct hal_rx_ppdu_info *ppdu_info)
  1215. {
  1216. if (ppdu_info->u_sig_info.ppdu_type_comp_mode == 0 &&
  1217. ppdu_info->u_sig_info.ul_dl == 0)
  1218. return true;
  1219. return false;
  1220. }
  1221. static inline bool hal_rx_is_non_ofdma(struct hal_soc *hal_soc,
  1222. struct hal_rx_ppdu_info *ppdu_info)
  1223. {
  1224. uint32_t ppdu_type_comp_mode =
  1225. ppdu_info->u_sig_info.ppdu_type_comp_mode;
  1226. uint32_t ul_dl = ppdu_info->u_sig_info.ul_dl;
  1227. if ((ppdu_type_comp_mode == 1 && ul_dl == 0) ||
  1228. (ppdu_type_comp_mode == 2 && ul_dl == 0) ||
  1229. (ppdu_type_comp_mode == 1 && ul_dl == 1))
  1230. return true;
  1231. return false;
  1232. }
  1233. static inline bool hal_rx_is_mu_mimo_user(struct hal_soc *hal_soc,
  1234. struct hal_rx_ppdu_info *ppdu_info)
  1235. {
  1236. if (ppdu_info->u_sig_info.ppdu_type_comp_mode == 0 &&
  1237. ppdu_info->u_sig_info.ul_dl == 2)
  1238. return true;
  1239. return false;
  1240. }
  1241. static inline bool
  1242. hal_rx_is_frame_type_ndp(struct hal_soc *hal_soc,
  1243. struct hal_rx_ppdu_info *ppdu_info)
  1244. {
  1245. if (ppdu_info->u_sig_info.ppdu_type_comp_mode == 1 &&
  1246. ppdu_info->u_sig_info.eht_sig_mcs == 0 &&
  1247. ppdu_info->u_sig_info.num_eht_sig_sym == 0)
  1248. return true;
  1249. return false;
  1250. }
  1251. static inline uint32_t
  1252. hal_rx_parse_eht_sig_ndp(struct hal_soc *hal_soc, void *tlv,
  1253. struct hal_rx_ppdu_info *ppdu_info)
  1254. {
  1255. struct hal_eht_sig_ndp_cmn_eb *eht_sig_ndp =
  1256. (struct hal_eht_sig_ndp_cmn_eb *)tlv;
  1257. ppdu_info->rx_status.eht_known |=
  1258. QDF_MON_STATUS_EHT_SPATIAL_REUSE_KNOWN |
  1259. QDF_MON_STATUS_EHT_EHT_LTF_KNOWN |
  1260. QDF_MON_STATUS_EHT_NDP_NSS_KNOWN |
  1261. QDF_MON_STATUS_EHT_NDP_BEAMFORMED_KNOWN |
  1262. QDF_MON_STATUS_EHT_NDP_DISREGARD_KNOWN |
  1263. QDF_MON_STATUS_EHT_CRC1_KNOWN |
  1264. QDF_MON_STATUS_EHT_TAIL1_KNOWN;
  1265. ppdu_info->rx_status.eht_data[0] |= (eht_sig_ndp->spatial_reuse <<
  1266. QDF_MON_STATUS_EHT_SPATIAL_REUSE_SHIFT);
  1267. /*
  1268. * GI and LTF size are separately indicated in radiotap header
  1269. * and hence will be parsed from other TLV
  1270. **/
  1271. ppdu_info->rx_status.eht_data[0] |= (eht_sig_ndp->num_ltf_sym <<
  1272. QDF_MON_STATUS_EHT_EHT_LTF_SHIFT);
  1273. ppdu_info->rx_status.eht_data[0] |= (0xF <<
  1274. QDF_MON_STATUS_EHT_NDP_DISREGARD_SHIFT);
  1275. ppdu_info->rx_status.eht_data[4] |= (eht_sig_ndp->nss <<
  1276. QDF_MON_STATUS_EHT_NDP_NSS_SHIFT);
  1277. ppdu_info->rx_status.eht_data[4] |= (eht_sig_ndp->beamformed <<
  1278. QDF_MON_STATUS_EHT_NDP_BEAMFORMED_SHIFT);
  1279. ppdu_info->rx_status.eht_data[0] |= (eht_sig_ndp->crc <<
  1280. QDF_MON_STATUS_EHT_CRC1_SHIFT);
  1281. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1282. }
  1283. static inline uint32_t
  1284. hal_rx_parse_eht_sig_non_ofdma(struct hal_soc *hal_soc, void *tlv,
  1285. struct hal_rx_ppdu_info *ppdu_info)
  1286. {
  1287. void *user_info = (void *)((uint8_t *)tlv + 4);
  1288. hal_rx_parse_usig_overflow(hal_soc, tlv, ppdu_info);
  1289. hal_rx_parse_non_ofdma_users(hal_soc, tlv, ppdu_info);
  1290. if (hal_rx_is_mu_mimo_user(hal_soc, ppdu_info))
  1291. hal_rx_parse_eht_sig_mumimo_user_info(hal_soc, user_info,
  1292. ppdu_info);
  1293. else
  1294. hal_rx_parse_eht_sig_non_mumimo_user_info(hal_soc, user_info,
  1295. ppdu_info);
  1296. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1297. }
  1298. static inline uint32_t
  1299. hal_rx_parse_eht_sig_ofdma(struct hal_soc *hal_soc, void *tlv,
  1300. struct hal_rx_ppdu_info *ppdu_info)
  1301. {
  1302. uint64_t *eht_sig_tlv = (uint64_t *)tlv;
  1303. void *user_info = (void *)(eht_sig_tlv + 2);
  1304. hal_rx_parse_usig_overflow(hal_soc, tlv, ppdu_info);
  1305. hal_rx_parse_ru_allocation(hal_soc, tlv, ppdu_info);
  1306. hal_rx_parse_eht_sig_non_mumimo_user_info(hal_soc, user_info,
  1307. ppdu_info);
  1308. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1309. }
  1310. static inline uint32_t
  1311. hal_rx_parse_eht_sig_hdr(struct hal_soc *hal_soc, uint8_t *tlv,
  1312. struct hal_rx_ppdu_info *ppdu_info)
  1313. {
  1314. ppdu_info->rx_status.eht_flags = 1;
  1315. if (hal_rx_is_frame_type_ndp(hal_soc, ppdu_info))
  1316. hal_rx_parse_eht_sig_ndp(hal_soc, tlv, ppdu_info);
  1317. else if (hal_rx_is_non_ofdma(hal_soc, ppdu_info))
  1318. hal_rx_parse_eht_sig_non_ofdma(hal_soc, tlv, ppdu_info);
  1319. else if (hal_rx_is_ofdma(hal_soc, ppdu_info))
  1320. hal_rx_parse_eht_sig_ofdma(hal_soc, tlv, ppdu_info);
  1321. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1322. }
  1323. #ifdef WLAN_FEATURE_11BE
  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. ppdu_info->rx_status.punctured_pattern = cmn_usr_info->puncture_bitmap;
  1329. }
  1330. #else
  1331. static inline void
  1332. hal_rx_parse_punctured_pattern(struct phyrx_common_user_info *cmn_usr_info,
  1333. struct hal_rx_ppdu_info *ppdu_info)
  1334. {
  1335. }
  1336. #endif
  1337. static inline uint32_t
  1338. hal_rx_parse_cmn_usr_info(struct hal_soc *hal_soc, uint8_t *tlv,
  1339. struct hal_rx_ppdu_info *ppdu_info)
  1340. {
  1341. struct phyrx_common_user_info *cmn_usr_info =
  1342. (struct phyrx_common_user_info *)tlv;
  1343. ppdu_info->rx_status.eht_known |=
  1344. QDF_MON_STATUS_EHT_GUARD_INTERVAL_KNOWN |
  1345. QDF_MON_STATUS_EHT_LTF_KNOWN;
  1346. ppdu_info->rx_status.eht_data[0] |= (cmn_usr_info->cp_setting <<
  1347. QDF_MON_STATUS_EHT_GI_SHIFT);
  1348. if (!ppdu_info->rx_status.sgi)
  1349. ppdu_info->rx_status.sgi = cmn_usr_info->cp_setting;
  1350. ppdu_info->rx_status.eht_data[0] |= (cmn_usr_info->ltf_size <<
  1351. QDF_MON_STATUS_EHT_LTF_SHIFT);
  1352. if (!ppdu_info->rx_status.ltf_size)
  1353. ppdu_info->rx_status.ltf_size = cmn_usr_info->ltf_size;
  1354. hal_rx_parse_punctured_pattern(cmn_usr_info, ppdu_info);
  1355. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1356. }
  1357. #ifdef WLAN_FEATURE_11BE
  1358. static inline void
  1359. hal_rx_ul_ofdma_ru_size_to_width(uint32_t ru_size,
  1360. uint32_t *ru_width)
  1361. {
  1362. uint32_t width;
  1363. width = 0;
  1364. switch (ru_size) {
  1365. case IEEE80211_EHT_RU_26:
  1366. width = RU_26;
  1367. break;
  1368. case IEEE80211_EHT_RU_52:
  1369. width = RU_52;
  1370. break;
  1371. case IEEE80211_EHT_RU_52_26:
  1372. width = RU_52_26;
  1373. break;
  1374. case IEEE80211_EHT_RU_106:
  1375. width = RU_106;
  1376. break;
  1377. case IEEE80211_EHT_RU_106_26:
  1378. width = RU_106_26;
  1379. break;
  1380. case IEEE80211_EHT_RU_242:
  1381. width = RU_242;
  1382. break;
  1383. case IEEE80211_EHT_RU_484:
  1384. width = RU_484;
  1385. break;
  1386. case IEEE80211_EHT_RU_484_242:
  1387. width = RU_484_242;
  1388. break;
  1389. case IEEE80211_EHT_RU_996:
  1390. width = RU_996;
  1391. break;
  1392. case IEEE80211_EHT_RU_996_484:
  1393. width = RU_996_484;
  1394. break;
  1395. case IEEE80211_EHT_RU_996_484_242:
  1396. width = RU_996_484_242;
  1397. break;
  1398. case IEEE80211_EHT_RU_996x2:
  1399. width = RU_2X996;
  1400. break;
  1401. case IEEE80211_EHT_RU_996x2_484:
  1402. width = RU_2X996_484;
  1403. break;
  1404. case IEEE80211_EHT_RU_996x3:
  1405. width = RU_3X996;
  1406. break;
  1407. case IEEE80211_EHT_RU_996x3_484:
  1408. width = RU_3X996_484;
  1409. break;
  1410. case IEEE80211_EHT_RU_996x4:
  1411. width = RU_4X996;
  1412. break;
  1413. default:
  1414. hal_err_rl("RU size(%d) to width convert err", ru_size);
  1415. break;
  1416. }
  1417. *ru_width = width;
  1418. }
  1419. #else
  1420. static inline void
  1421. hal_rx_ul_ofdma_ru_size_to_width(uint32_t ru_size,
  1422. uint32_t *ru_width)
  1423. {
  1424. *ru_width = 0;
  1425. }
  1426. #endif
  1427. static inline enum ieee80211_eht_ru_size
  1428. hal_rx_mon_hal_ru_size_to_ieee80211_ru_size(struct hal_soc *hal_soc,
  1429. uint32_t hal_ru_size)
  1430. {
  1431. switch (hal_ru_size) {
  1432. case HAL_EHT_RU_26:
  1433. return IEEE80211_EHT_RU_26;
  1434. case HAL_EHT_RU_52:
  1435. return IEEE80211_EHT_RU_52;
  1436. case HAL_EHT_RU_78:
  1437. return IEEE80211_EHT_RU_52_26;
  1438. case HAL_EHT_RU_106:
  1439. return IEEE80211_EHT_RU_106;
  1440. case HAL_EHT_RU_132:
  1441. return IEEE80211_EHT_RU_106_26;
  1442. case HAL_EHT_RU_242:
  1443. return IEEE80211_EHT_RU_242;
  1444. case HAL_EHT_RU_484:
  1445. return IEEE80211_EHT_RU_484;
  1446. case HAL_EHT_RU_726:
  1447. return IEEE80211_EHT_RU_484_242;
  1448. case HAL_EHT_RU_996:
  1449. return IEEE80211_EHT_RU_996;
  1450. case HAL_EHT_RU_996x2:
  1451. return IEEE80211_EHT_RU_996x2;
  1452. case HAL_EHT_RU_996x3:
  1453. return IEEE80211_EHT_RU_996x3;
  1454. case HAL_EHT_RU_996x4:
  1455. return IEEE80211_EHT_RU_996x4;
  1456. case HAL_EHT_RU_NONE:
  1457. return IEEE80211_EHT_RU_INVALID;
  1458. case HAL_EHT_RU_996_484:
  1459. return IEEE80211_EHT_RU_996_484;
  1460. case HAL_EHT_RU_996x2_484:
  1461. return IEEE80211_EHT_RU_996x2_484;
  1462. case HAL_EHT_RU_996x3_484:
  1463. return IEEE80211_EHT_RU_996x3_484;
  1464. case HAL_EHT_RU_996_484_242:
  1465. return IEEE80211_EHT_RU_996_484_242;
  1466. default:
  1467. return IEEE80211_EHT_RU_INVALID;
  1468. }
  1469. }
  1470. #define HAL_SET_RU_PER80(ru_320mhz, ru_per80, ru_idx_per80mhz, num_80mhz) \
  1471. ((ru_320mhz) |= ((uint64_t)(ru_per80) << \
  1472. (((num_80mhz) * NUM_RU_BITS_PER80) + \
  1473. ((ru_idx_per80mhz) * NUM_RU_BITS_PER20))))
  1474. static inline uint32_t
  1475. hal_rx_parse_receive_user_info(struct hal_soc *hal_soc, uint8_t *tlv,
  1476. struct hal_rx_ppdu_info *ppdu_info,
  1477. uint32_t user_id)
  1478. {
  1479. struct receive_user_info *rx_usr_info = (struct receive_user_info *)tlv;
  1480. struct mon_rx_user_status *mon_rx_user_status = NULL;
  1481. uint64_t ru_index_320mhz = 0;
  1482. uint16_t ru_index_per80mhz;
  1483. uint32_t ru_size = 0, num_80mhz_with_ru = 0;
  1484. uint32_t ru_index = HAL_EHT_RU_INVALID;
  1485. uint32_t rtap_ru_size = IEEE80211_EHT_RU_INVALID;
  1486. uint32_t ru_width;
  1487. ppdu_info->rx_status.eht_known |=
  1488. QDF_MON_STATUS_EHT_CONTENT_CH_INDEX_KNOWN;
  1489. ppdu_info->rx_status.eht_data[0] |=
  1490. (rx_usr_info->dl_ofdma_content_channel <<
  1491. QDF_MON_STATUS_EHT_CONTENT_CH_INDEX_SHIFT);
  1492. switch (rx_usr_info->reception_type) {
  1493. case HAL_RECEPTION_TYPE_SU:
  1494. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  1495. break;
  1496. case HAL_RECEPTION_TYPE_DL_MU_MIMO:
  1497. case HAL_RECEPTION_TYPE_UL_MU_MIMO:
  1498. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  1499. break;
  1500. case HAL_RECEPTION_TYPE_DL_MU_OFMA:
  1501. case HAL_RECEPTION_TYPE_UL_MU_OFDMA:
  1502. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_OFDMA;
  1503. break;
  1504. case HAL_RECEPTION_TYPE_DL_MU_OFDMA_MIMO:
  1505. case HAL_RECEPTION_TYPE_UL_MU_OFDMA_MIMO:
  1506. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_OFDMA_MIMO;
  1507. }
  1508. ppdu_info->rx_status.is_stbc = rx_usr_info->stbc;
  1509. ppdu_info->rx_status.ldpc = rx_usr_info->ldpc;
  1510. ppdu_info->rx_status.dcm = rx_usr_info->sta_dcm;
  1511. ppdu_info->rx_status.mcs = rx_usr_info->rate_mcs;
  1512. ppdu_info->rx_status.nss = rx_usr_info->nss + 1;
  1513. if (user_id < HAL_MAX_UL_MU_USERS) {
  1514. mon_rx_user_status =
  1515. &ppdu_info->rx_user_status[user_id];
  1516. mon_rx_user_status->mcs = ppdu_info->rx_status.mcs;
  1517. mon_rx_user_status->nss = ppdu_info->rx_status.nss;
  1518. }
  1519. if (!(ppdu_info->rx_status.reception_type == HAL_RX_TYPE_MU_MIMO ||
  1520. ppdu_info->rx_status.reception_type == HAL_RX_TYPE_MU_OFDMA ||
  1521. ppdu_info->rx_status.reception_type == HAL_RX_TYPE_MU_OFDMA_MIMO))
  1522. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1523. /* RU allocation present only for OFDMA reception */
  1524. if (rx_usr_info->ru_type_80_0 != HAL_EHT_RU_NONE) {
  1525. ru_size += rx_usr_info->ru_type_80_0;
  1526. ru_index = ru_index_per80mhz = rx_usr_info->ru_start_index_80_0;
  1527. HAL_SET_RU_PER80(ru_index_320mhz, rx_usr_info->ru_type_80_0,
  1528. ru_index_per80mhz, 0);
  1529. num_80mhz_with_ru++;
  1530. }
  1531. if (rx_usr_info->ru_type_80_1 != HAL_EHT_RU_NONE) {
  1532. ru_size += rx_usr_info->ru_type_80_1;
  1533. ru_index = ru_index_per80mhz = rx_usr_info->ru_start_index_80_1;
  1534. HAL_SET_RU_PER80(ru_index_320mhz, rx_usr_info->ru_type_80_1,
  1535. ru_index_per80mhz, 1);
  1536. num_80mhz_with_ru++;
  1537. }
  1538. if (rx_usr_info->ru_type_80_2 != HAL_EHT_RU_NONE) {
  1539. ru_size += rx_usr_info->ru_type_80_2;
  1540. ru_index = ru_index_per80mhz = rx_usr_info->ru_start_index_80_2;
  1541. HAL_SET_RU_PER80(ru_index_320mhz, rx_usr_info->ru_type_80_2,
  1542. ru_index_per80mhz, 2);
  1543. num_80mhz_with_ru++;
  1544. }
  1545. if (rx_usr_info->ru_type_80_3 != HAL_EHT_RU_NONE) {
  1546. ru_size += rx_usr_info->ru_type_80_3;
  1547. ru_index = ru_index_per80mhz = rx_usr_info->ru_start_index_80_3;
  1548. HAL_SET_RU_PER80(ru_index_320mhz, rx_usr_info->ru_type_80_3,
  1549. ru_index_per80mhz, 3);
  1550. num_80mhz_with_ru++;
  1551. }
  1552. if (num_80mhz_with_ru > 1) {
  1553. /* Calculate the MRU index */
  1554. switch (ru_index_320mhz) {
  1555. case HAL_EHT_RU_996_484_0:
  1556. case HAL_EHT_RU_996x2_484_0:
  1557. case HAL_EHT_RU_996x3_484_0:
  1558. ru_index = 0;
  1559. break;
  1560. case HAL_EHT_RU_996_484_1:
  1561. case HAL_EHT_RU_996x2_484_1:
  1562. case HAL_EHT_RU_996x3_484_1:
  1563. ru_index = 1;
  1564. break;
  1565. case HAL_EHT_RU_996_484_2:
  1566. case HAL_EHT_RU_996x2_484_2:
  1567. case HAL_EHT_RU_996x3_484_2:
  1568. ru_index = 2;
  1569. break;
  1570. case HAL_EHT_RU_996_484_3:
  1571. case HAL_EHT_RU_996x2_484_3:
  1572. case HAL_EHT_RU_996x3_484_3:
  1573. ru_index = 3;
  1574. break;
  1575. case HAL_EHT_RU_996_484_4:
  1576. case HAL_EHT_RU_996x2_484_4:
  1577. case HAL_EHT_RU_996x3_484_4:
  1578. ru_index = 4;
  1579. break;
  1580. case HAL_EHT_RU_996_484_5:
  1581. case HAL_EHT_RU_996x2_484_5:
  1582. case HAL_EHT_RU_996x3_484_5:
  1583. ru_index = 5;
  1584. break;
  1585. case HAL_EHT_RU_996_484_6:
  1586. case HAL_EHT_RU_996x2_484_6:
  1587. case HAL_EHT_RU_996x3_484_6:
  1588. ru_index = 6;
  1589. break;
  1590. case HAL_EHT_RU_996_484_7:
  1591. case HAL_EHT_RU_996x2_484_7:
  1592. case HAL_EHT_RU_996x3_484_7:
  1593. ru_index = 7;
  1594. break;
  1595. case HAL_EHT_RU_996x2_484_8:
  1596. ru_index = 8;
  1597. break;
  1598. case HAL_EHT_RU_996x2_484_9:
  1599. ru_index = 9;
  1600. break;
  1601. case HAL_EHT_RU_996x2_484_10:
  1602. ru_index = 10;
  1603. break;
  1604. case HAL_EHT_RU_996x2_484_11:
  1605. ru_index = 11;
  1606. break;
  1607. default:
  1608. ru_index = HAL_EHT_RU_INVALID;
  1609. dp_debug("Invalid RU index");
  1610. qdf_assert(0);
  1611. break;
  1612. }
  1613. ru_size += 4;
  1614. }
  1615. rtap_ru_size = hal_rx_mon_hal_ru_size_to_ieee80211_ru_size(hal_soc,
  1616. ru_size);
  1617. if (rtap_ru_size != IEEE80211_EHT_RU_INVALID) {
  1618. ppdu_info->rx_status.eht_known |=
  1619. QDF_MON_STATUS_EHT_RU_MRU_SIZE_KNOWN;
  1620. ppdu_info->rx_status.eht_data[1] |= (rtap_ru_size <<
  1621. QDF_MON_STATUS_EHT_RU_MRU_SIZE_SHIFT);
  1622. }
  1623. if (ru_index != HAL_EHT_RU_INVALID) {
  1624. ppdu_info->rx_status.eht_known |=
  1625. QDF_MON_STATUS_EHT_RU_MRU_INDEX_KNOWN;
  1626. ppdu_info->rx_status.eht_data[1] |= (ru_index <<
  1627. QDF_MON_STATUS_EHT_RU_MRU_INDEX_SHIFT);
  1628. }
  1629. if (mon_rx_user_status && ru_index != HAL_EHT_RU_INVALID &&
  1630. rtap_ru_size != IEEE80211_EHT_RU_INVALID) {
  1631. mon_rx_user_status->ofdma_ru_start_index = ru_index;
  1632. mon_rx_user_status->ofdma_ru_size = rtap_ru_size;
  1633. hal_rx_ul_ofdma_ru_size_to_width(rtap_ru_size, &ru_width);
  1634. mon_rx_user_status->ofdma_ru_width = ru_width;
  1635. mon_rx_user_status->mu_ul_info_valid = 1;
  1636. }
  1637. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  1638. }
  1639. #ifdef QCA_MONITOR_2_0_SUPPORT
  1640. static inline void
  1641. hal_rx_status_get_mpdu_retry_cnt(struct hal_rx_ppdu_info *ppdu_info,
  1642. void *rx_tlv)
  1643. {
  1644. ppdu_info->rx_status.mpdu_retry_cnt =
  1645. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1646. RETRIED_MPDU_COUNT);
  1647. }
  1648. static inline void
  1649. hal_rx_status_get_mon_buf_addr(uint8_t *rx_tlv,
  1650. struct hal_rx_ppdu_info *ppdu_info)
  1651. {
  1652. struct mon_buffer_addr *addr = (struct mon_buffer_addr *)rx_tlv;
  1653. ppdu_info->packet_info.sw_cookie = (((uint64_t)addr->buffer_virt_addr_63_32 << 32) |
  1654. (addr->buffer_virt_addr_31_0));
  1655. /* HW DMA length is '-1' of actual DMA length*/
  1656. ppdu_info->packet_info.dma_length = addr->dma_length + 1;
  1657. ppdu_info->packet_info.msdu_continuation = addr->msdu_continuation;
  1658. ppdu_info->packet_info.truncated = addr->truncated;
  1659. }
  1660. #else
  1661. static inline void
  1662. hal_rx_status_get_mpdu_retry_cnt(struct hal_rx_ppdu_info *ppdu_info,
  1663. void *rx_tlv)
  1664. {
  1665. ppdu_info->rx_status.mpdu_retry_cnt = 0;
  1666. }
  1667. static inline void
  1668. hal_rx_status_get_mon_buf_addr(uint8_t *rx_tlv,
  1669. struct hal_rx_ppdu_info *ppdu_info)
  1670. {
  1671. }
  1672. #endif
  1673. #ifdef WLAN_SUPPORT_CTRL_FRAME_STATS
  1674. static inline void
  1675. hal_update_rx_ctrl_frame_stats(struct hal_rx_ppdu_info *ppdu_info,
  1676. uint32_t user_id)
  1677. {
  1678. uint16_t fc = ppdu_info->nac_info.frame_control;
  1679. if (HAL_RX_GET_FRAME_CTRL_TYPE(fc) == HAL_RX_FRAME_CTRL_TYPE_CTRL) {
  1680. if ((fc & QDF_IEEE80211_FC0_SUBTYPE_MASK) ==
  1681. QDF_IEEE80211_FC0_SUBTYPE_VHT_NDP_AN)
  1682. ppdu_info->ctrl_frm_info[user_id].ndpa = 1;
  1683. if ((fc & QDF_IEEE80211_FC0_SUBTYPE_MASK) ==
  1684. QDF_IEEE80211_FC0_SUBTYPE_BAR)
  1685. ppdu_info->ctrl_frm_info[user_id].bar = 1;
  1686. }
  1687. }
  1688. #else
  1689. static inline void
  1690. hal_update_rx_ctrl_frame_stats(struct hal_rx_ppdu_info *ppdu_info,
  1691. uint32_t user_id)
  1692. {
  1693. }
  1694. #endif /* WLAN_SUPPORT_CTRL_FRAME_STATS */
  1695. /**
  1696. * hal_rx_status_get_tlv_info() - process receive info TLV
  1697. * @rx_tlv_hdr: pointer to TLV header
  1698. * @ppdu_info: pointer to ppdu_info
  1699. *
  1700. * Return: HAL_TLV_STATUS_PPDU_NOT_DONE or HAL_TLV_STATUS_PPDU_DONE from tlv
  1701. */
  1702. static inline uint32_t
  1703. hal_rx_status_get_tlv_info_generic_be(void *rx_tlv_hdr, void *ppduinfo,
  1704. hal_soc_handle_t hal_soc_hdl,
  1705. qdf_nbuf_t nbuf)
  1706. {
  1707. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  1708. uint32_t tlv_tag, user_id, tlv_len, value;
  1709. uint8_t group_id = 0;
  1710. uint8_t he_dcm = 0;
  1711. uint8_t he_stbc = 0;
  1712. uint16_t he_gi = 0;
  1713. uint16_t he_ltf = 0;
  1714. void *rx_tlv;
  1715. struct mon_rx_user_status *mon_rx_user_status;
  1716. struct hal_rx_ppdu_info *ppdu_info =
  1717. (struct hal_rx_ppdu_info *)ppduinfo;
  1718. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(rx_tlv_hdr);
  1719. user_id = HAL_RX_GET_USER_TLV64_USERID(rx_tlv_hdr);
  1720. tlv_len = HAL_RX_GET_USER_TLV64_LEN(rx_tlv_hdr);
  1721. rx_tlv = (uint8_t *)rx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
  1722. qdf_trace_hex_dump(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  1723. rx_tlv, tlv_len);
  1724. ppdu_info->user_id = user_id;
  1725. switch (tlv_tag) {
  1726. case WIFIRX_PPDU_START_E:
  1727. {
  1728. if (qdf_unlikely(ppdu_info->com_info.last_ppdu_id ==
  1729. HAL_RX_GET_64(rx_tlv, RX_PPDU_START, PHY_PPDU_ID)))
  1730. hal_err("Matching ppdu_id(%u) detected",
  1731. ppdu_info->com_info.last_ppdu_id);
  1732. /* Reset ppdu_info before processing the ppdu */
  1733. qdf_mem_zero(ppdu_info,
  1734. sizeof(struct hal_rx_ppdu_info));
  1735. ppdu_info->com_info.last_ppdu_id =
  1736. ppdu_info->com_info.ppdu_id =
  1737. HAL_RX_GET_64(rx_tlv, RX_PPDU_START,
  1738. PHY_PPDU_ID);
  1739. /* channel number is set in PHY meta data */
  1740. ppdu_info->rx_status.chan_num =
  1741. (HAL_RX_GET_64(rx_tlv, RX_PPDU_START,
  1742. SW_PHY_META_DATA) & 0x0000FFFF);
  1743. ppdu_info->rx_status.chan_freq =
  1744. (HAL_RX_GET_64(rx_tlv, RX_PPDU_START,
  1745. SW_PHY_META_DATA) & 0xFFFF0000) >> 16;
  1746. if (ppdu_info->rx_status.chan_num &&
  1747. ppdu_info->rx_status.chan_freq) {
  1748. ppdu_info->rx_status.chan_freq =
  1749. hal_rx_radiotap_num_to_freq(
  1750. ppdu_info->rx_status.chan_num,
  1751. ppdu_info->rx_status.chan_freq);
  1752. }
  1753. ppdu_info->com_info.ppdu_timestamp =
  1754. HAL_RX_GET_64(rx_tlv, RX_PPDU_START,
  1755. PPDU_START_TIMESTAMP_31_0);
  1756. ppdu_info->rx_status.ppdu_timestamp =
  1757. ppdu_info->com_info.ppdu_timestamp;
  1758. ppdu_info->rx_state = HAL_RX_MON_PPDU_START;
  1759. break;
  1760. }
  1761. case WIFIRX_PPDU_START_USER_INFO_E:
  1762. hal_rx_parse_receive_user_info(hal, rx_tlv, ppdu_info, user_id);
  1763. break;
  1764. case WIFIRX_PPDU_END_E:
  1765. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  1766. "[%s][%d] ppdu_end_e len=%d",
  1767. __func__, __LINE__, tlv_len);
  1768. /* This is followed by sub-TLVs of PPDU_END */
  1769. ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
  1770. break;
  1771. case WIFIPHYRX_LOCATION_E:
  1772. hal_rx_get_rtt_info(hal_soc_hdl, rx_tlv, ppdu_info);
  1773. break;
  1774. case WIFIRXPCU_PPDU_END_INFO_E:
  1775. ppdu_info->rx_status.rx_antenna =
  1776. HAL_RX_GET_64(rx_tlv, RXPCU_PPDU_END_INFO, RX_ANTENNA);
  1777. ppdu_info->rx_status.tsft =
  1778. HAL_RX_GET_64(rx_tlv, RXPCU_PPDU_END_INFO,
  1779. WB_TIMESTAMP_UPPER_32);
  1780. ppdu_info->rx_status.tsft = (ppdu_info->rx_status.tsft << 32) |
  1781. HAL_RX_GET_64(rx_tlv, RXPCU_PPDU_END_INFO,
  1782. WB_TIMESTAMP_LOWER_32);
  1783. ppdu_info->rx_status.duration =
  1784. HAL_RX_GET_64(rx_tlv, UNIFIED_RXPCU_PPDU_END_INFO_8,
  1785. RX_PPDU_DURATION);
  1786. hal_rx_get_bb_info(hal_soc_hdl, rx_tlv, ppdu_info);
  1787. break;
  1788. /*
  1789. * WIFIRX_PPDU_END_USER_STATS_E comes for each user received.
  1790. * for MU, based on num users we see this tlv that many times.
  1791. */
  1792. case WIFIRX_PPDU_END_USER_STATS_E:
  1793. {
  1794. unsigned long tid = 0;
  1795. uint16_t seq = 0;
  1796. ppdu_info->rx_status.ast_index =
  1797. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1798. AST_INDEX);
  1799. tid = HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1800. RECEIVED_QOS_DATA_TID_BITMAP);
  1801. ppdu_info->rx_status.tid = qdf_find_first_bit(&tid,
  1802. sizeof(tid) * 8);
  1803. if (ppdu_info->rx_status.tid == (sizeof(tid) * 8))
  1804. ppdu_info->rx_status.tid = HAL_TID_INVALID;
  1805. ppdu_info->rx_status.tcp_msdu_count =
  1806. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1807. TCP_MSDU_COUNT) +
  1808. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1809. TCP_ACK_MSDU_COUNT);
  1810. ppdu_info->rx_status.udp_msdu_count =
  1811. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1812. UDP_MSDU_COUNT);
  1813. ppdu_info->rx_status.other_msdu_count =
  1814. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1815. OTHER_MSDU_COUNT);
  1816. hal_rx_status_get_mpdu_retry_cnt(ppdu_info, rx_tlv);
  1817. if (ppdu_info->sw_frame_group_id
  1818. != HAL_MPDU_SW_FRAME_GROUP_NULL_DATA) {
  1819. ppdu_info->rx_status.frame_control_info_valid =
  1820. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1821. FRAME_CONTROL_INFO_VALID);
  1822. if (ppdu_info->rx_status.frame_control_info_valid)
  1823. ppdu_info->rx_status.frame_control =
  1824. HAL_RX_GET_64(rx_tlv,
  1825. RX_PPDU_END_USER_STATS,
  1826. FRAME_CONTROL_FIELD);
  1827. hal_get_qos_control(rx_tlv, ppdu_info);
  1828. }
  1829. ppdu_info->rx_status.data_sequence_control_info_valid =
  1830. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1831. DATA_SEQUENCE_CONTROL_INFO_VALID);
  1832. seq = HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1833. FIRST_DATA_SEQ_CTRL);
  1834. if (ppdu_info->rx_status.data_sequence_control_info_valid)
  1835. ppdu_info->rx_status.first_data_seq_ctrl = seq;
  1836. ppdu_info->rx_status.preamble_type =
  1837. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1838. HT_CONTROL_FIELD_PKT_TYPE);
  1839. switch (ppdu_info->rx_status.preamble_type) {
  1840. case HAL_RX_PKT_TYPE_11N:
  1841. ppdu_info->rx_status.ht_flags = 1;
  1842. ppdu_info->rx_status.rtap_flags |= HT_SGI_PRESENT;
  1843. break;
  1844. case HAL_RX_PKT_TYPE_11AC:
  1845. ppdu_info->rx_status.vht_flags = 1;
  1846. break;
  1847. case HAL_RX_PKT_TYPE_11AX:
  1848. ppdu_info->rx_status.he_flags = 1;
  1849. break;
  1850. default:
  1851. break;
  1852. }
  1853. ppdu_info->com_info.mpdu_cnt_fcs_ok =
  1854. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1855. MPDU_CNT_FCS_OK);
  1856. ppdu_info->com_info.mpdu_cnt_fcs_err =
  1857. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1858. MPDU_CNT_FCS_ERR);
  1859. if ((ppdu_info->com_info.mpdu_cnt_fcs_ok |
  1860. ppdu_info->com_info.mpdu_cnt_fcs_err) > 1)
  1861. ppdu_info->rx_status.rs_flags |= IEEE80211_AMPDU_FLAG;
  1862. else
  1863. ppdu_info->rx_status.rs_flags &=
  1864. (~IEEE80211_AMPDU_FLAG);
  1865. ppdu_info->com_info.mpdu_fcs_ok_bitmap[0] =
  1866. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1867. FCS_OK_BITMAP_31_0);
  1868. ppdu_info->com_info.mpdu_fcs_ok_bitmap[1] =
  1869. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS,
  1870. FCS_OK_BITMAP_63_32);
  1871. if (user_id < HAL_MAX_UL_MU_USERS) {
  1872. mon_rx_user_status =
  1873. &ppdu_info->rx_user_status[user_id];
  1874. hal_rx_handle_mu_ul_info(rx_tlv, mon_rx_user_status);
  1875. ppdu_info->com_info.num_users++;
  1876. hal_rx_populate_mu_user_info(rx_tlv, ppdu_info,
  1877. user_id,
  1878. mon_rx_user_status);
  1879. }
  1880. break;
  1881. }
  1882. case WIFIRX_PPDU_END_USER_STATS_EXT_E:
  1883. ppdu_info->com_info.mpdu_fcs_ok_bitmap[2] =
  1884. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  1885. FCS_OK_BITMAP_95_64);
  1886. ppdu_info->com_info.mpdu_fcs_ok_bitmap[3] =
  1887. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  1888. FCS_OK_BITMAP_127_96);
  1889. ppdu_info->com_info.mpdu_fcs_ok_bitmap[4] =
  1890. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  1891. FCS_OK_BITMAP_159_128);
  1892. ppdu_info->com_info.mpdu_fcs_ok_bitmap[5] =
  1893. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  1894. FCS_OK_BITMAP_191_160);
  1895. ppdu_info->com_info.mpdu_fcs_ok_bitmap[6] =
  1896. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  1897. FCS_OK_BITMAP_223_192);
  1898. ppdu_info->com_info.mpdu_fcs_ok_bitmap[7] =
  1899. HAL_RX_GET_64(rx_tlv, RX_PPDU_END_USER_STATS_EXT,
  1900. FCS_OK_BITMAP_255_224);
  1901. break;
  1902. case WIFIRX_PPDU_END_STATUS_DONE_E:
  1903. return HAL_TLV_STATUS_PPDU_DONE;
  1904. case WIFIPHYRX_PKT_END_E:
  1905. break;
  1906. case WIFIDUMMY_E:
  1907. return HAL_TLV_STATUS_BUF_DONE;
  1908. case WIFIPHYRX_HT_SIG_E:
  1909. {
  1910. uint8_t *ht_sig_info = (uint8_t *)rx_tlv +
  1911. HAL_RX_OFFSET(UNIFIED_PHYRX_HT_SIG_0,
  1912. HT_SIG_INFO_PHYRX_HT_SIG_INFO_DETAILS);
  1913. value = HAL_RX_GET(ht_sig_info, HT_SIG_INFO, FEC_CODING);
  1914. ppdu_info->rx_status.ldpc = (value == HAL_SU_MU_CODING_LDPC) ?
  1915. 1 : 0;
  1916. ppdu_info->rx_status.mcs = HAL_RX_GET(ht_sig_info,
  1917. HT_SIG_INFO, MCS);
  1918. ppdu_info->rx_status.ht_mcs = ppdu_info->rx_status.mcs;
  1919. ppdu_info->rx_status.bw = HAL_RX_GET(ht_sig_info,
  1920. HT_SIG_INFO, CBW);
  1921. ppdu_info->rx_status.sgi = HAL_RX_GET(ht_sig_info,
  1922. HT_SIG_INFO, SHORT_GI);
  1923. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  1924. ppdu_info->rx_status.nss = ((ppdu_info->rx_status.mcs) >>
  1925. HT_SIG_SU_NSS_SHIFT) + 1;
  1926. ppdu_info->rx_status.mcs &= ((1 << HT_SIG_SU_NSS_SHIFT) - 1);
  1927. break;
  1928. }
  1929. case WIFIPHYRX_L_SIG_B_E:
  1930. {
  1931. uint8_t *l_sig_b_info = (uint8_t *)rx_tlv +
  1932. HAL_RX_OFFSET(UNIFIED_PHYRX_L_SIG_B_0,
  1933. L_SIG_B_INFO_PHYRX_L_SIG_B_INFO_DETAILS);
  1934. value = HAL_RX_GET(l_sig_b_info, L_SIG_B_INFO, RATE);
  1935. ppdu_info->rx_status.l_sig_b_info = *((uint32_t *)l_sig_b_info);
  1936. switch (value) {
  1937. case 1:
  1938. ppdu_info->rx_status.rate = HAL_11B_RATE_3MCS;
  1939. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS3;
  1940. break;
  1941. case 2:
  1942. ppdu_info->rx_status.rate = HAL_11B_RATE_2MCS;
  1943. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS2;
  1944. break;
  1945. case 3:
  1946. ppdu_info->rx_status.rate = HAL_11B_RATE_1MCS;
  1947. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS1;
  1948. break;
  1949. case 4:
  1950. ppdu_info->rx_status.rate = HAL_11B_RATE_0MCS;
  1951. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS0;
  1952. break;
  1953. case 5:
  1954. ppdu_info->rx_status.rate = HAL_11B_RATE_6MCS;
  1955. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS6;
  1956. break;
  1957. case 6:
  1958. ppdu_info->rx_status.rate = HAL_11B_RATE_5MCS;
  1959. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS5;
  1960. break;
  1961. case 7:
  1962. ppdu_info->rx_status.rate = HAL_11B_RATE_4MCS;
  1963. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS4;
  1964. break;
  1965. default:
  1966. break;
  1967. }
  1968. ppdu_info->rx_status.cck_flag = 1;
  1969. break;
  1970. }
  1971. case WIFIPHYRX_L_SIG_A_E:
  1972. {
  1973. uint8_t *l_sig_a_info = (uint8_t *)rx_tlv +
  1974. HAL_RX_OFFSET(UNIFIED_PHYRX_L_SIG_A_0,
  1975. L_SIG_A_INFO_PHYRX_L_SIG_A_INFO_DETAILS);
  1976. value = HAL_RX_GET(l_sig_a_info, L_SIG_A_INFO, RATE);
  1977. ppdu_info->rx_status.l_sig_a_info = *((uint32_t *)l_sig_a_info);
  1978. switch (value) {
  1979. case 8:
  1980. ppdu_info->rx_status.rate = HAL_11A_RATE_0MCS;
  1981. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS0;
  1982. break;
  1983. case 9:
  1984. ppdu_info->rx_status.rate = HAL_11A_RATE_1MCS;
  1985. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS1;
  1986. break;
  1987. case 10:
  1988. ppdu_info->rx_status.rate = HAL_11A_RATE_2MCS;
  1989. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS2;
  1990. break;
  1991. case 11:
  1992. ppdu_info->rx_status.rate = HAL_11A_RATE_3MCS;
  1993. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS3;
  1994. break;
  1995. case 12:
  1996. ppdu_info->rx_status.rate = HAL_11A_RATE_4MCS;
  1997. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS4;
  1998. break;
  1999. case 13:
  2000. ppdu_info->rx_status.rate = HAL_11A_RATE_5MCS;
  2001. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS5;
  2002. break;
  2003. case 14:
  2004. ppdu_info->rx_status.rate = HAL_11A_RATE_6MCS;
  2005. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS6;
  2006. break;
  2007. case 15:
  2008. ppdu_info->rx_status.rate = HAL_11A_RATE_7MCS;
  2009. ppdu_info->rx_status.mcs = HAL_LEGACY_MCS7;
  2010. break;
  2011. default:
  2012. break;
  2013. }
  2014. ppdu_info->rx_status.ofdm_flag = 1;
  2015. break;
  2016. }
  2017. case WIFIPHYRX_VHT_SIG_A_E:
  2018. {
  2019. uint8_t *vht_sig_a_info = (uint8_t *)rx_tlv +
  2020. HAL_RX_OFFSET(UNIFIED_PHYRX_VHT_SIG_A_0,
  2021. VHT_SIG_A_INFO_PHYRX_VHT_SIG_A_INFO_DETAILS);
  2022. value = HAL_RX_GET(vht_sig_a_info, VHT_SIG_A_INFO,
  2023. SU_MU_CODING);
  2024. ppdu_info->rx_status.ldpc = (value == HAL_SU_MU_CODING_LDPC) ?
  2025. 1 : 0;
  2026. group_id = HAL_RX_GET(vht_sig_a_info, VHT_SIG_A_INFO, GROUP_ID);
  2027. ppdu_info->rx_status.vht_flag_values5 = group_id;
  2028. ppdu_info->rx_status.mcs = HAL_RX_GET(vht_sig_a_info,
  2029. VHT_SIG_A_INFO, MCS);
  2030. ppdu_info->rx_status.sgi = HAL_RX_GET(vht_sig_a_info,
  2031. VHT_SIG_A_INFO,
  2032. GI_SETTING);
  2033. switch (hal->target_type) {
  2034. case TARGET_TYPE_QCA8074:
  2035. case TARGET_TYPE_QCA8074V2:
  2036. case TARGET_TYPE_QCA6018:
  2037. case TARGET_TYPE_QCA5018:
  2038. case TARGET_TYPE_QCN9000:
  2039. case TARGET_TYPE_QCN6122:
  2040. #ifdef QCA_WIFI_QCA6390
  2041. case TARGET_TYPE_QCA6390:
  2042. #endif
  2043. ppdu_info->rx_status.is_stbc =
  2044. HAL_RX_GET(vht_sig_a_info,
  2045. VHT_SIG_A_INFO, STBC);
  2046. value = HAL_RX_GET(vht_sig_a_info,
  2047. VHT_SIG_A_INFO, N_STS);
  2048. value = value & VHT_SIG_SU_NSS_MASK;
  2049. if (ppdu_info->rx_status.is_stbc && (value > 0))
  2050. value = ((value + 1) >> 1) - 1;
  2051. ppdu_info->rx_status.nss =
  2052. ((value & VHT_SIG_SU_NSS_MASK) + 1);
  2053. break;
  2054. case TARGET_TYPE_QCA6290:
  2055. #if !defined(QCA_WIFI_QCA6290_11AX)
  2056. ppdu_info->rx_status.is_stbc =
  2057. HAL_RX_GET(vht_sig_a_info,
  2058. VHT_SIG_A_INFO, STBC);
  2059. value = HAL_RX_GET(vht_sig_a_info,
  2060. VHT_SIG_A_INFO, N_STS);
  2061. value = value & VHT_SIG_SU_NSS_MASK;
  2062. if (ppdu_info->rx_status.is_stbc && (value > 0))
  2063. value = ((value + 1) >> 1) - 1;
  2064. ppdu_info->rx_status.nss =
  2065. ((value & VHT_SIG_SU_NSS_MASK) + 1);
  2066. #else
  2067. ppdu_info->rx_status.nss = 0;
  2068. #endif
  2069. break;
  2070. case TARGET_TYPE_QCA6490:
  2071. case TARGET_TYPE_QCA6750:
  2072. case TARGET_TYPE_KIWI:
  2073. case TARGET_TYPE_MANGO:
  2074. ppdu_info->rx_status.nss = 0;
  2075. break;
  2076. default:
  2077. break;
  2078. }
  2079. ppdu_info->rx_status.vht_flag_values3[0] =
  2080. (((ppdu_info->rx_status.mcs) << 4)
  2081. | ppdu_info->rx_status.nss);
  2082. ppdu_info->rx_status.bw = HAL_RX_GET(vht_sig_a_info,
  2083. VHT_SIG_A_INFO, BANDWIDTH);
  2084. ppdu_info->rx_status.vht_flag_values2 =
  2085. ppdu_info->rx_status.bw;
  2086. ppdu_info->rx_status.vht_flag_values4 =
  2087. HAL_RX_GET(vht_sig_a_info,
  2088. VHT_SIG_A_INFO, SU_MU_CODING);
  2089. ppdu_info->rx_status.beamformed = HAL_RX_GET(vht_sig_a_info,
  2090. VHT_SIG_A_INFO,
  2091. BEAMFORMED);
  2092. if (group_id == 0 || group_id == 63)
  2093. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  2094. else
  2095. ppdu_info->rx_status.reception_type =
  2096. HAL_RX_TYPE_MU_MIMO;
  2097. break;
  2098. }
  2099. case WIFIPHYRX_HE_SIG_A_SU_E:
  2100. {
  2101. uint8_t *he_sig_a_su_info = (uint8_t *)rx_tlv +
  2102. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_A_SU_0,
  2103. HE_SIG_A_SU_INFO_PHYRX_HE_SIG_A_SU_INFO_DETAILS);
  2104. ppdu_info->rx_status.he_flags = 1;
  2105. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2106. FORMAT_INDICATION);
  2107. if (value == 0) {
  2108. ppdu_info->rx_status.he_data1 =
  2109. QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
  2110. } else {
  2111. ppdu_info->rx_status.he_data1 =
  2112. QDF_MON_STATUS_HE_SU_FORMAT_TYPE;
  2113. }
  2114. /* data1 */
  2115. ppdu_info->rx_status.he_data1 |=
  2116. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  2117. QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN |
  2118. QDF_MON_STATUS_HE_DL_UL_KNOWN |
  2119. QDF_MON_STATUS_HE_MCS_KNOWN |
  2120. QDF_MON_STATUS_HE_DCM_KNOWN |
  2121. QDF_MON_STATUS_HE_CODING_KNOWN |
  2122. QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN |
  2123. QDF_MON_STATUS_HE_STBC_KNOWN |
  2124. QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN |
  2125. QDF_MON_STATUS_HE_DOPPLER_KNOWN;
  2126. /* data2 */
  2127. ppdu_info->rx_status.he_data2 =
  2128. QDF_MON_STATUS_HE_GI_KNOWN;
  2129. ppdu_info->rx_status.he_data2 |=
  2130. QDF_MON_STATUS_TXBF_KNOWN |
  2131. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  2132. QDF_MON_STATUS_TXOP_KNOWN |
  2133. QDF_MON_STATUS_LTF_SYMBOLS_KNOWN |
  2134. QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN |
  2135. QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN;
  2136. /* data3 */
  2137. value = HAL_RX_GET(he_sig_a_su_info,
  2138. HE_SIG_A_SU_INFO, BSS_COLOR_ID);
  2139. ppdu_info->rx_status.he_data3 = value;
  2140. value = HAL_RX_GET(he_sig_a_su_info,
  2141. HE_SIG_A_SU_INFO, BEAM_CHANGE);
  2142. value = value << QDF_MON_STATUS_BEAM_CHANGE_SHIFT;
  2143. ppdu_info->rx_status.he_data3 |= value;
  2144. value = HAL_RX_GET(he_sig_a_su_info,
  2145. HE_SIG_A_SU_INFO, DL_UL_FLAG);
  2146. value = value << QDF_MON_STATUS_DL_UL_SHIFT;
  2147. ppdu_info->rx_status.he_data3 |= value;
  2148. value = HAL_RX_GET(he_sig_a_su_info,
  2149. HE_SIG_A_SU_INFO, TRANSMIT_MCS);
  2150. ppdu_info->rx_status.mcs = value;
  2151. value = value << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  2152. ppdu_info->rx_status.he_data3 |= value;
  2153. value = HAL_RX_GET(he_sig_a_su_info,
  2154. HE_SIG_A_SU_INFO, DCM);
  2155. he_dcm = value;
  2156. value = value << QDF_MON_STATUS_DCM_SHIFT;
  2157. ppdu_info->rx_status.he_data3 |= value;
  2158. value = HAL_RX_GET(he_sig_a_su_info,
  2159. HE_SIG_A_SU_INFO, CODING);
  2160. ppdu_info->rx_status.ldpc = (value == HAL_SU_MU_CODING_LDPC) ?
  2161. 1 : 0;
  2162. value = value << QDF_MON_STATUS_CODING_SHIFT;
  2163. ppdu_info->rx_status.he_data3 |= value;
  2164. value = HAL_RX_GET(he_sig_a_su_info,
  2165. HE_SIG_A_SU_INFO,
  2166. LDPC_EXTRA_SYMBOL);
  2167. value = value << QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT;
  2168. ppdu_info->rx_status.he_data3 |= value;
  2169. value = HAL_RX_GET(he_sig_a_su_info,
  2170. HE_SIG_A_SU_INFO, STBC);
  2171. he_stbc = value;
  2172. value = value << QDF_MON_STATUS_STBC_SHIFT;
  2173. ppdu_info->rx_status.he_data3 |= value;
  2174. /* data4 */
  2175. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2176. SPATIAL_REUSE);
  2177. ppdu_info->rx_status.he_data4 = value;
  2178. /* data5 */
  2179. value = HAL_RX_GET(he_sig_a_su_info,
  2180. HE_SIG_A_SU_INFO, TRANSMIT_BW);
  2181. ppdu_info->rx_status.he_data5 = value;
  2182. ppdu_info->rx_status.bw = value;
  2183. value = HAL_RX_GET(he_sig_a_su_info,
  2184. HE_SIG_A_SU_INFO, CP_LTF_SIZE);
  2185. switch (value) {
  2186. case 0:
  2187. he_gi = HE_GI_0_8;
  2188. he_ltf = HE_LTF_1_X;
  2189. break;
  2190. case 1:
  2191. he_gi = HE_GI_0_8;
  2192. he_ltf = HE_LTF_2_X;
  2193. break;
  2194. case 2:
  2195. he_gi = HE_GI_1_6;
  2196. he_ltf = HE_LTF_2_X;
  2197. break;
  2198. case 3:
  2199. if (he_dcm && he_stbc) {
  2200. he_gi = HE_GI_0_8;
  2201. he_ltf = HE_LTF_4_X;
  2202. } else {
  2203. he_gi = HE_GI_3_2;
  2204. he_ltf = HE_LTF_4_X;
  2205. }
  2206. break;
  2207. }
  2208. ppdu_info->rx_status.sgi = he_gi;
  2209. ppdu_info->rx_status.ltf_size = he_ltf;
  2210. hal_get_radiotap_he_gi_ltf(&he_gi, &he_ltf);
  2211. value = he_gi << QDF_MON_STATUS_GI_SHIFT;
  2212. ppdu_info->rx_status.he_data5 |= value;
  2213. value = he_ltf << QDF_MON_STATUS_HE_LTF_SIZE_SHIFT;
  2214. ppdu_info->rx_status.he_data5 |= value;
  2215. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO, NSTS);
  2216. value = (value << QDF_MON_STATUS_HE_LTF_SYM_SHIFT);
  2217. ppdu_info->rx_status.he_data5 |= value;
  2218. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2219. PACKET_EXTENSION_A_FACTOR);
  2220. value = value << QDF_MON_STATUS_PRE_FEC_PAD_SHIFT;
  2221. ppdu_info->rx_status.he_data5 |= value;
  2222. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO, TXBF);
  2223. value = value << QDF_MON_STATUS_TXBF_SHIFT;
  2224. ppdu_info->rx_status.he_data5 |= value;
  2225. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2226. PACKET_EXTENSION_PE_DISAMBIGUITY);
  2227. value = value << QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT;
  2228. ppdu_info->rx_status.he_data5 |= value;
  2229. /* data6 */
  2230. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO, NSTS);
  2231. value++;
  2232. ppdu_info->rx_status.nss = value;
  2233. ppdu_info->rx_status.he_data6 = value;
  2234. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2235. DOPPLER_INDICATION);
  2236. value = value << QDF_MON_STATUS_DOPPLER_SHIFT;
  2237. ppdu_info->rx_status.he_data6 |= value;
  2238. value = HAL_RX_GET(he_sig_a_su_info, HE_SIG_A_SU_INFO,
  2239. TXOP_DURATION);
  2240. value = value << QDF_MON_STATUS_TXOP_SHIFT;
  2241. ppdu_info->rx_status.he_data6 |= value;
  2242. ppdu_info->rx_status.beamformed = HAL_RX_GET(he_sig_a_su_info,
  2243. HE_SIG_A_SU_INFO,
  2244. TXBF);
  2245. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_SU;
  2246. break;
  2247. }
  2248. case WIFIPHYRX_HE_SIG_A_MU_DL_E:
  2249. {
  2250. uint8_t *he_sig_a_mu_dl_info = (uint8_t *)rx_tlv +
  2251. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_A_MU_DL_0,
  2252. HE_SIG_A_MU_DL_INFO_PHYRX_HE_SIG_A_MU_DL_INFO_DETAILS);
  2253. ppdu_info->rx_status.he_mu_flags = 1;
  2254. /* HE Flags */
  2255. /*data1*/
  2256. ppdu_info->rx_status.he_data1 =
  2257. QDF_MON_STATUS_HE_MU_FORMAT_TYPE;
  2258. ppdu_info->rx_status.he_data1 |=
  2259. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  2260. QDF_MON_STATUS_HE_DL_UL_KNOWN |
  2261. QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN |
  2262. QDF_MON_STATUS_HE_STBC_KNOWN |
  2263. QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN |
  2264. QDF_MON_STATUS_HE_DOPPLER_KNOWN;
  2265. /* data2 */
  2266. ppdu_info->rx_status.he_data2 =
  2267. QDF_MON_STATUS_HE_GI_KNOWN;
  2268. ppdu_info->rx_status.he_data2 |=
  2269. QDF_MON_STATUS_LTF_SYMBOLS_KNOWN |
  2270. QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN |
  2271. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  2272. QDF_MON_STATUS_TXOP_KNOWN |
  2273. QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN;
  2274. /*data3*/
  2275. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2276. HE_SIG_A_MU_DL_INFO, BSS_COLOR_ID);
  2277. ppdu_info->rx_status.he_data3 = value;
  2278. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2279. HE_SIG_A_MU_DL_INFO, DL_UL_FLAG);
  2280. value = value << QDF_MON_STATUS_DL_UL_SHIFT;
  2281. ppdu_info->rx_status.he_data3 |= value;
  2282. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2283. HE_SIG_A_MU_DL_INFO,
  2284. LDPC_EXTRA_SYMBOL);
  2285. value = value << QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT;
  2286. ppdu_info->rx_status.he_data3 |= value;
  2287. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2288. HE_SIG_A_MU_DL_INFO, STBC);
  2289. he_stbc = value;
  2290. value = value << QDF_MON_STATUS_STBC_SHIFT;
  2291. ppdu_info->rx_status.he_data3 |= value;
  2292. /*data4*/
  2293. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  2294. SPATIAL_REUSE);
  2295. ppdu_info->rx_status.he_data4 = value;
  2296. /*data5*/
  2297. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2298. HE_SIG_A_MU_DL_INFO, TRANSMIT_BW);
  2299. ppdu_info->rx_status.he_data5 = value;
  2300. ppdu_info->rx_status.bw = value;
  2301. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2302. HE_SIG_A_MU_DL_INFO, CP_LTF_SIZE);
  2303. switch (value) {
  2304. case 0:
  2305. he_gi = HE_GI_0_8;
  2306. he_ltf = HE_LTF_4_X;
  2307. break;
  2308. case 1:
  2309. he_gi = HE_GI_0_8;
  2310. he_ltf = HE_LTF_2_X;
  2311. break;
  2312. case 2:
  2313. he_gi = HE_GI_1_6;
  2314. he_ltf = HE_LTF_2_X;
  2315. break;
  2316. case 3:
  2317. he_gi = HE_GI_3_2;
  2318. he_ltf = HE_LTF_4_X;
  2319. break;
  2320. }
  2321. ppdu_info->rx_status.sgi = he_gi;
  2322. ppdu_info->rx_status.ltf_size = he_ltf;
  2323. hal_get_radiotap_he_gi_ltf(&he_gi, &he_ltf);
  2324. value = he_gi << QDF_MON_STATUS_GI_SHIFT;
  2325. ppdu_info->rx_status.he_data5 |= value;
  2326. value = he_ltf << QDF_MON_STATUS_HE_LTF_SIZE_SHIFT;
  2327. ppdu_info->rx_status.he_data5 |= value;
  2328. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2329. HE_SIG_A_MU_DL_INFO, NUM_LTF_SYMBOLS);
  2330. value = (value << QDF_MON_STATUS_HE_LTF_SYM_SHIFT);
  2331. ppdu_info->rx_status.he_data5 |= value;
  2332. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  2333. PACKET_EXTENSION_A_FACTOR);
  2334. value = value << QDF_MON_STATUS_PRE_FEC_PAD_SHIFT;
  2335. ppdu_info->rx_status.he_data5 |= value;
  2336. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  2337. PACKET_EXTENSION_PE_DISAMBIGUITY);
  2338. value = value << QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT;
  2339. ppdu_info->rx_status.he_data5 |= value;
  2340. /*data6*/
  2341. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  2342. DOPPLER_INDICATION);
  2343. value = value << QDF_MON_STATUS_DOPPLER_SHIFT;
  2344. ppdu_info->rx_status.he_data6 |= value;
  2345. value = HAL_RX_GET(he_sig_a_mu_dl_info, HE_SIG_A_MU_DL_INFO,
  2346. TXOP_DURATION);
  2347. value = value << QDF_MON_STATUS_TXOP_SHIFT;
  2348. ppdu_info->rx_status.he_data6 |= value;
  2349. /* HE-MU Flags */
  2350. /* HE-MU-flags1 */
  2351. ppdu_info->rx_status.he_flags1 =
  2352. QDF_MON_STATUS_SIG_B_MCS_KNOWN |
  2353. QDF_MON_STATUS_SIG_B_DCM_KNOWN |
  2354. QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN |
  2355. QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN |
  2356. QDF_MON_STATUS_RU_0_KNOWN;
  2357. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2358. HE_SIG_A_MU_DL_INFO, MCS_OF_SIG_B);
  2359. ppdu_info->rx_status.he_flags1 |= value;
  2360. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2361. HE_SIG_A_MU_DL_INFO, DCM_OF_SIG_B);
  2362. value = value << QDF_MON_STATUS_DCM_FLAG_1_SHIFT;
  2363. ppdu_info->rx_status.he_flags1 |= value;
  2364. /* HE-MU-flags2 */
  2365. ppdu_info->rx_status.he_flags2 =
  2366. QDF_MON_STATUS_BW_KNOWN;
  2367. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2368. HE_SIG_A_MU_DL_INFO, TRANSMIT_BW);
  2369. ppdu_info->rx_status.he_flags2 |= value;
  2370. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2371. HE_SIG_A_MU_DL_INFO, COMP_MODE_SIG_B);
  2372. value = value << QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT;
  2373. ppdu_info->rx_status.he_flags2 |= value;
  2374. value = HAL_RX_GET(he_sig_a_mu_dl_info,
  2375. HE_SIG_A_MU_DL_INFO, NUM_SIG_B_SYMBOLS);
  2376. value = value - 1;
  2377. value = value << QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT;
  2378. ppdu_info->rx_status.he_flags2 |= value;
  2379. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  2380. break;
  2381. }
  2382. case WIFIPHYRX_HE_SIG_B1_MU_E:
  2383. {
  2384. uint8_t *he_sig_b1_mu_info = (uint8_t *)rx_tlv +
  2385. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_B1_MU_0,
  2386. HE_SIG_B1_MU_INFO_PHYRX_HE_SIG_B1_MU_INFO_DETAILS);
  2387. ppdu_info->rx_status.he_sig_b_common_known |=
  2388. QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU0;
  2389. /* TODO: Check on the availability of other fields in
  2390. * sig_b_common
  2391. */
  2392. value = HAL_RX_GET(he_sig_b1_mu_info,
  2393. HE_SIG_B1_MU_INFO, RU_ALLOCATION);
  2394. ppdu_info->rx_status.he_RU[0] = value;
  2395. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_MIMO;
  2396. break;
  2397. }
  2398. case WIFIPHYRX_HE_SIG_B2_MU_E:
  2399. {
  2400. uint8_t *he_sig_b2_mu_info = (uint8_t *)rx_tlv +
  2401. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_B2_MU_0,
  2402. HE_SIG_B2_MU_INFO_PHYRX_HE_SIG_B2_MU_INFO_DETAILS);
  2403. /*
  2404. * Not all "HE" fields can be updated from
  2405. * WIFIPHYRX_HE_SIG_A_MU_DL_E TLV. Use WIFIPHYRX_HE_SIG_B2_MU_E
  2406. * to populate rest of the "HE" fields for MU scenarios.
  2407. */
  2408. /* HE-data1 */
  2409. ppdu_info->rx_status.he_data1 |=
  2410. QDF_MON_STATUS_HE_MCS_KNOWN |
  2411. QDF_MON_STATUS_HE_CODING_KNOWN;
  2412. /* HE-data2 */
  2413. /* HE-data3 */
  2414. value = HAL_RX_GET(he_sig_b2_mu_info,
  2415. HE_SIG_B2_MU_INFO, STA_MCS);
  2416. ppdu_info->rx_status.mcs = value;
  2417. value = value << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  2418. ppdu_info->rx_status.he_data3 |= value;
  2419. value = HAL_RX_GET(he_sig_b2_mu_info,
  2420. HE_SIG_B2_MU_INFO, STA_CODING);
  2421. value = value << QDF_MON_STATUS_CODING_SHIFT;
  2422. ppdu_info->rx_status.he_data3 |= value;
  2423. /* HE-data4 */
  2424. value = HAL_RX_GET(he_sig_b2_mu_info,
  2425. HE_SIG_B2_MU_INFO, STA_ID);
  2426. value = value << QDF_MON_STATUS_STA_ID_SHIFT;
  2427. ppdu_info->rx_status.he_data4 |= value;
  2428. /* HE-data5 */
  2429. /* HE-data6 */
  2430. value = HAL_RX_GET(he_sig_b2_mu_info,
  2431. HE_SIG_B2_MU_INFO, NSTS);
  2432. /* value n indicates n+1 spatial streams */
  2433. value++;
  2434. ppdu_info->rx_status.nss = value;
  2435. ppdu_info->rx_status.he_data6 |= value;
  2436. break;
  2437. }
  2438. case WIFIPHYRX_HE_SIG_B2_OFDMA_E:
  2439. {
  2440. uint8_t *he_sig_b2_ofdma_info =
  2441. (uint8_t *)rx_tlv +
  2442. HAL_RX_OFFSET(UNIFIED_PHYRX_HE_SIG_B2_OFDMA_0,
  2443. HE_SIG_B2_OFDMA_INFO_PHYRX_HE_SIG_B2_OFDMA_INFO_DETAILS);
  2444. /*
  2445. * Not all "HE" fields can be updated from
  2446. * WIFIPHYRX_HE_SIG_A_MU_DL_E TLV. Use WIFIPHYRX_HE_SIG_B2_MU_E
  2447. * to populate rest of "HE" fields for MU OFDMA scenarios.
  2448. */
  2449. /* HE-data1 */
  2450. ppdu_info->rx_status.he_data1 |=
  2451. QDF_MON_STATUS_HE_MCS_KNOWN |
  2452. QDF_MON_STATUS_HE_DCM_KNOWN |
  2453. QDF_MON_STATUS_HE_CODING_KNOWN;
  2454. /* HE-data2 */
  2455. ppdu_info->rx_status.he_data2 |=
  2456. QDF_MON_STATUS_TXBF_KNOWN;
  2457. /* HE-data3 */
  2458. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  2459. HE_SIG_B2_OFDMA_INFO, STA_MCS);
  2460. ppdu_info->rx_status.mcs = value;
  2461. value = value << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  2462. ppdu_info->rx_status.he_data3 |= value;
  2463. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  2464. HE_SIG_B2_OFDMA_INFO, STA_DCM);
  2465. he_dcm = value;
  2466. value = value << QDF_MON_STATUS_DCM_SHIFT;
  2467. ppdu_info->rx_status.he_data3 |= value;
  2468. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  2469. HE_SIG_B2_OFDMA_INFO, STA_CODING);
  2470. value = value << QDF_MON_STATUS_CODING_SHIFT;
  2471. ppdu_info->rx_status.he_data3 |= value;
  2472. /* HE-data4 */
  2473. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  2474. HE_SIG_B2_OFDMA_INFO, STA_ID);
  2475. value = value << QDF_MON_STATUS_STA_ID_SHIFT;
  2476. ppdu_info->rx_status.he_data4 |= value;
  2477. /* HE-data5 */
  2478. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  2479. HE_SIG_B2_OFDMA_INFO, TXBF);
  2480. value = value << QDF_MON_STATUS_TXBF_SHIFT;
  2481. ppdu_info->rx_status.he_data5 |= value;
  2482. /* HE-data6 */
  2483. value = HAL_RX_GET(he_sig_b2_ofdma_info,
  2484. HE_SIG_B2_OFDMA_INFO, NSTS);
  2485. /* value n indicates n+1 spatial streams */
  2486. value++;
  2487. ppdu_info->rx_status.nss = value;
  2488. ppdu_info->rx_status.he_data6 |= value;
  2489. ppdu_info->rx_status.reception_type = HAL_RX_TYPE_MU_OFDMA;
  2490. break;
  2491. }
  2492. case WIFIPHYRX_RSSI_LEGACY_E:
  2493. {
  2494. uint8_t reception_type;
  2495. int8_t rssi_value;
  2496. uint8_t *rssi_info_tlv = (uint8_t *)rx_tlv +
  2497. HAL_RX_OFFSET(UNIFIED_PHYRX_RSSI_LEGACY_19,
  2498. RECEIVE_RSSI_INFO_PREAMBLE_RSSI_INFO_DETAILS);
  2499. ppdu_info->rx_status.rssi_comb =
  2500. HAL_RX_GET_64(rx_tlv,
  2501. PHYRX_RSSI_LEGACY, RSSI_COMB);
  2502. ppdu_info->rx_status.bw = hal->ops->hal_rx_get_tlv(rx_tlv);
  2503. ppdu_info->rx_status.he_re = 0;
  2504. reception_type = HAL_RX_GET_64(rx_tlv,
  2505. PHYRX_RSSI_LEGACY,
  2506. RECEPTION_TYPE);
  2507. switch (reception_type) {
  2508. case QDF_RECEPTION_TYPE_ULOFMDA:
  2509. ppdu_info->rx_status.ulofdma_flag = 1;
  2510. ppdu_info->rx_status.he_data1 =
  2511. QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
  2512. break;
  2513. case QDF_RECEPTION_TYPE_ULMIMO:
  2514. ppdu_info->rx_status.he_data1 =
  2515. QDF_MON_STATUS_HE_MU_FORMAT_TYPE;
  2516. break;
  2517. default:
  2518. break;
  2519. }
  2520. hal_rx_update_rssi_chain(ppdu_info, rssi_info_tlv);
  2521. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  2522. RECEIVE_RSSI_INFO,
  2523. RSSI_PRI20_CHAIN0);
  2524. ppdu_info->rx_status.rssi[0] = rssi_value;
  2525. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2526. "RSSI_PRI20_CHAIN0: %d\n", rssi_value);
  2527. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  2528. RECEIVE_RSSI_INFO,
  2529. RSSI_PRI20_CHAIN1);
  2530. ppdu_info->rx_status.rssi[1] = rssi_value;
  2531. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2532. "RSSI_PRI20_CHAIN1: %d\n", rssi_value);
  2533. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  2534. RECEIVE_RSSI_INFO,
  2535. RSSI_PRI20_CHAIN2);
  2536. ppdu_info->rx_status.rssi[2] = rssi_value;
  2537. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2538. "RSSI_PRI20_CHAIN2: %d\n", rssi_value);
  2539. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  2540. RECEIVE_RSSI_INFO,
  2541. RSSI_PRI20_CHAIN3);
  2542. ppdu_info->rx_status.rssi[3] = rssi_value;
  2543. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2544. "RSSI_PRI20_CHAIN3: %d\n", rssi_value);
  2545. #ifdef DP_BE_NOTYET_WAR
  2546. // TODO - this is not preset for kiwi
  2547. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  2548. RECEIVE_RSSI_INFO,
  2549. RSSI_PRI20_CHAIN4);
  2550. ppdu_info->rx_status.rssi[4] = rssi_value;
  2551. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2552. "RSSI_PRI20_CHAIN4: %d\n", rssi_value);
  2553. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  2554. RECEIVE_RSSI_INFO,
  2555. RSSI_PRI20_CHAIN5);
  2556. ppdu_info->rx_status.rssi[5] = rssi_value;
  2557. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2558. "RSSI_PRI20_CHAIN5: %d\n", rssi_value);
  2559. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  2560. RECEIVE_RSSI_INFO,
  2561. RSSI_PRI20_CHAIN6);
  2562. ppdu_info->rx_status.rssi[6] = rssi_value;
  2563. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2564. "RSSI_PRI20_CHAIN6: %d\n", rssi_value);
  2565. rssi_value = HAL_RX_GET_64(rssi_info_tlv,
  2566. RECEIVE_RSSI_INFO,
  2567. RSSI_PRI20_CHAIN7);
  2568. ppdu_info->rx_status.rssi[7] = rssi_value;
  2569. #endif
  2570. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2571. "RSSI_PRI20_CHAIN7: %d\n", rssi_value);
  2572. break;
  2573. }
  2574. case WIFIPHYRX_OTHER_RECEIVE_INFO_E:
  2575. hal_rx_proc_phyrx_other_receive_info_tlv(hal, rx_tlv_hdr,
  2576. ppdu_info);
  2577. break;
  2578. case WIFIPHYRX_GENERIC_U_SIG_E:
  2579. hal_rx_parse_u_sig_hdr(hal, rx_tlv, ppdu_info);
  2580. break;
  2581. case WIFIPHYRX_COMMON_USER_INFO_E:
  2582. hal_rx_parse_cmn_usr_info(hal, rx_tlv, ppdu_info);
  2583. break;
  2584. case WIFIRX_HEADER_E:
  2585. {
  2586. struct hal_rx_ppdu_common_info *com_info = &ppdu_info->com_info;
  2587. if (ppdu_info->fcs_ok_cnt >=
  2588. HAL_RX_MAX_MPDU_H_PER_STATUS_BUFFER) {
  2589. hal_err("Number of MPDUs(%d) per status buff exceeded",
  2590. ppdu_info->fcs_ok_cnt);
  2591. break;
  2592. }
  2593. /* Update first_msdu_payload for every mpdu and increment
  2594. * com_info->mpdu_cnt for every WIFIRX_HEADER_E TLV
  2595. */
  2596. ppdu_info->ppdu_msdu_info[ppdu_info->fcs_ok_cnt].first_msdu_payload =
  2597. rx_tlv;
  2598. ppdu_info->ppdu_msdu_info[ppdu_info->fcs_ok_cnt].payload_len = tlv_len;
  2599. ppdu_info->msdu_info.first_msdu_payload = rx_tlv;
  2600. ppdu_info->msdu_info.payload_len = tlv_len;
  2601. ppdu_info->user_id = user_id;
  2602. ppdu_info->hdr_len = tlv_len;
  2603. ppdu_info->data = rx_tlv;
  2604. ppdu_info->data += 4;
  2605. /* for every RX_HEADER TLV increment mpdu_cnt */
  2606. com_info->mpdu_cnt++;
  2607. return HAL_TLV_STATUS_HEADER;
  2608. }
  2609. case WIFIRX_MPDU_START_E:
  2610. {
  2611. hal_rx_mon_mpdu_start_t *rx_mpdu_start = rx_tlv;
  2612. uint32_t ppdu_id = rx_mpdu_start->rx_mpdu_info_details.phy_ppdu_id;
  2613. uint8_t filter_category = 0;
  2614. ppdu_info->nac_info.fc_valid =
  2615. rx_mpdu_start->rx_mpdu_info_details.mpdu_frame_control_valid;
  2616. ppdu_info->nac_info.to_ds_flag =
  2617. rx_mpdu_start->rx_mpdu_info_details.to_ds;
  2618. ppdu_info->nac_info.frame_control =
  2619. rx_mpdu_start->rx_mpdu_info_details.mpdu_frame_control_field;
  2620. ppdu_info->sw_frame_group_id =
  2621. rx_mpdu_start->rx_mpdu_info_details.sw_frame_group_id;
  2622. ppdu_info->rx_user_status[user_id].sw_peer_id =
  2623. rx_mpdu_start->rx_mpdu_info_details.sw_peer_id;
  2624. hal_update_rx_ctrl_frame_stats(ppdu_info, user_id);
  2625. if (ppdu_info->sw_frame_group_id ==
  2626. HAL_MPDU_SW_FRAME_GROUP_NULL_DATA) {
  2627. ppdu_info->rx_status.frame_control_info_valid =
  2628. ppdu_info->nac_info.fc_valid;
  2629. ppdu_info->rx_status.frame_control =
  2630. ppdu_info->nac_info.frame_control;
  2631. }
  2632. hal_get_mac_addr1(rx_mpdu_start,
  2633. ppdu_info);
  2634. ppdu_info->nac_info.mac_addr2_valid =
  2635. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad2_valid;
  2636. *(uint16_t *)&ppdu_info->nac_info.mac_addr2[0] =
  2637. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad2_15_0;
  2638. *(uint32_t *)&ppdu_info->nac_info.mac_addr2[2] =
  2639. rx_mpdu_start->rx_mpdu_info_details.mac_addr_ad2_47_16;
  2640. if (ppdu_info->rx_status.prev_ppdu_id != ppdu_id) {
  2641. ppdu_info->rx_status.prev_ppdu_id = ppdu_id;
  2642. ppdu_info->rx_status.ppdu_len =
  2643. rx_mpdu_start->rx_mpdu_info_details.mpdu_length;
  2644. } else {
  2645. ppdu_info->rx_status.ppdu_len +=
  2646. rx_mpdu_start->rx_mpdu_info_details.mpdu_length;
  2647. }
  2648. filter_category =
  2649. rx_mpdu_start->rx_mpdu_info_details.rxpcu_mpdu_filter_in_category;
  2650. if (filter_category == 0)
  2651. ppdu_info->rx_status.rxpcu_filter_pass = 1;
  2652. else if (filter_category == 1)
  2653. ppdu_info->rx_status.monitor_direct_used = 1;
  2654. ppdu_info->rx_user_status[user_id].filter_category = filter_category;
  2655. ppdu_info->nac_info.mcast_bcast =
  2656. rx_mpdu_start->rx_mpdu_info_details.mcast_bcast;
  2657. ppdu_info->mpdu_info[user_id].decap_type =
  2658. rx_mpdu_start->rx_mpdu_info_details.decap_type;
  2659. return HAL_TLV_STATUS_MPDU_START;
  2660. }
  2661. case WIFIRX_MPDU_END_E:
  2662. ppdu_info->user_id = user_id;
  2663. ppdu_info->fcs_err =
  2664. HAL_RX_GET_64(rx_tlv, RX_MPDU_END,
  2665. FCS_ERR);
  2666. return HAL_TLV_STATUS_MPDU_END;
  2667. case WIFIRX_MSDU_END_E: {
  2668. hal_rx_mon_msdu_end_t *rx_msdu_end = rx_tlv;
  2669. if (user_id < HAL_MAX_UL_MU_USERS) {
  2670. ppdu_info->rx_msdu_info[user_id].cce_metadata =
  2671. rx_msdu_end->cce_metadata;
  2672. ppdu_info->rx_msdu_info[user_id].fse_metadata =
  2673. rx_msdu_end->fse_metadata;
  2674. ppdu_info->rx_msdu_info[user_id].is_flow_idx_timeout =
  2675. rx_msdu_end->flow_idx_timeout;
  2676. ppdu_info->rx_msdu_info[user_id].is_flow_idx_invalid =
  2677. rx_msdu_end->flow_idx_invalid;
  2678. ppdu_info->rx_msdu_info[user_id].flow_idx =
  2679. rx_msdu_end->flow_idx;
  2680. ppdu_info->msdu[user_id].first_msdu =
  2681. rx_msdu_end->first_msdu;
  2682. ppdu_info->msdu[user_id].last_msdu =
  2683. rx_msdu_end->last_msdu;
  2684. ppdu_info->msdu[user_id].msdu_len =
  2685. rx_msdu_end->msdu_length;
  2686. ppdu_info->msdu[user_id].user_rssi =
  2687. rx_msdu_end->user_rssi;
  2688. ppdu_info->msdu[user_id].reception_type =
  2689. rx_msdu_end->reception_type;
  2690. }
  2691. return HAL_TLV_STATUS_MSDU_END;
  2692. }
  2693. case WIFIMON_BUFFER_ADDR_E:
  2694. hal_rx_status_get_mon_buf_addr(rx_tlv, ppdu_info);
  2695. return HAL_TLV_STATUS_MON_BUF_ADDR;
  2696. case 0:
  2697. return HAL_TLV_STATUS_PPDU_DONE;
  2698. case WIFIRX_STATUS_BUFFER_DONE_E:
  2699. case WIFIPHYRX_DATA_DONE_E:
  2700. case WIFIPHYRX_PKT_END_PART1_E:
  2701. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  2702. default:
  2703. hal_debug("unhandled tlv tag %d", tlv_tag);
  2704. }
  2705. qdf_trace_hex_dump(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2706. rx_tlv, tlv_len);
  2707. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  2708. }
  2709. static uint32_t
  2710. hal_rx_status_process_aggr_tlv(struct hal_soc *hal_soc,
  2711. struct hal_rx_ppdu_info *ppdu_info)
  2712. {
  2713. uint32_t aggr_tlv_tag = ppdu_info->tlv_aggr.tlv_tag;
  2714. switch (aggr_tlv_tag) {
  2715. case WIFIPHYRX_GENERIC_EHT_SIG_E:
  2716. hal_rx_parse_eht_sig_hdr(hal_soc, ppdu_info->tlv_aggr.buf,
  2717. ppdu_info);
  2718. break;
  2719. default:
  2720. /* Aggregated TLV cannot be handled */
  2721. qdf_assert(0);
  2722. break;
  2723. }
  2724. ppdu_info->tlv_aggr.in_progress = 0;
  2725. ppdu_info->tlv_aggr.cur_len = 0;
  2726. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  2727. }
  2728. static inline bool
  2729. hal_rx_status_tlv_should_aggregate(struct hal_soc *hal_soc, uint32_t tlv_tag)
  2730. {
  2731. switch (tlv_tag) {
  2732. case WIFIPHYRX_GENERIC_EHT_SIG_E:
  2733. return true;
  2734. }
  2735. return false;
  2736. }
  2737. static inline uint32_t
  2738. hal_rx_status_aggr_tlv(struct hal_soc *hal_soc, void *rx_tlv_hdr,
  2739. struct hal_rx_ppdu_info *ppdu_info,
  2740. qdf_nbuf_t nbuf)
  2741. {
  2742. uint32_t tlv_tag, user_id, tlv_len;
  2743. void *rx_tlv;
  2744. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(rx_tlv_hdr);
  2745. user_id = HAL_RX_GET_USER_TLV64_USERID(rx_tlv_hdr);
  2746. tlv_len = HAL_RX_GET_USER_TLV64_LEN(rx_tlv_hdr);
  2747. rx_tlv = (uint8_t *)rx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
  2748. if (tlv_len <= HAL_RX_MON_MAX_AGGR_SIZE - ppdu_info->tlv_aggr.cur_len) {
  2749. qdf_mem_copy(ppdu_info->tlv_aggr.buf +
  2750. ppdu_info->tlv_aggr.cur_len,
  2751. rx_tlv, tlv_len);
  2752. ppdu_info->tlv_aggr.cur_len += tlv_len;
  2753. } else {
  2754. dp_err("Length of TLV exceeds max aggregation length");
  2755. qdf_assert(0);
  2756. }
  2757. return HAL_TLV_STATUS_PPDU_NOT_DONE;
  2758. }
  2759. static inline uint32_t
  2760. hal_rx_status_start_new_aggr_tlv(struct hal_soc *hal_soc, void *rx_tlv_hdr,
  2761. struct hal_rx_ppdu_info *ppdu_info,
  2762. qdf_nbuf_t nbuf)
  2763. {
  2764. uint32_t tlv_tag, user_id, tlv_len;
  2765. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(rx_tlv_hdr);
  2766. user_id = HAL_RX_GET_USER_TLV64_USERID(rx_tlv_hdr);
  2767. tlv_len = HAL_RX_GET_USER_TLV64_LEN(rx_tlv_hdr);
  2768. ppdu_info->tlv_aggr.in_progress = 1;
  2769. ppdu_info->tlv_aggr.tlv_tag = tlv_tag;
  2770. ppdu_info->tlv_aggr.cur_len = 0;
  2771. return hal_rx_status_aggr_tlv(hal_soc, rx_tlv_hdr, ppdu_info, nbuf);
  2772. }
  2773. static inline uint32_t
  2774. hal_rx_status_get_tlv_info_wrapper_be(void *rx_tlv_hdr, void *ppduinfo,
  2775. hal_soc_handle_t hal_soc_hdl,
  2776. qdf_nbuf_t nbuf)
  2777. {
  2778. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2779. uint32_t tlv_tag, user_id, tlv_len;
  2780. struct hal_rx_ppdu_info *ppdu_info =
  2781. (struct hal_rx_ppdu_info *)ppduinfo;
  2782. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(rx_tlv_hdr);
  2783. user_id = HAL_RX_GET_USER_TLV64_USERID(rx_tlv_hdr);
  2784. tlv_len = HAL_RX_GET_USER_TLV64_LEN(rx_tlv_hdr);
  2785. /*
  2786. * Handle the case where aggregation is in progress
  2787. * or the current TLV is one of the TLVs which should be
  2788. * aggregated
  2789. */
  2790. if (ppdu_info->tlv_aggr.in_progress) {
  2791. if (ppdu_info->tlv_aggr.tlv_tag == tlv_tag) {
  2792. return hal_rx_status_aggr_tlv(hal, rx_tlv_hdr,
  2793. ppdu_info, nbuf);
  2794. } else {
  2795. /* Finish aggregation of current TLV */
  2796. hal_rx_status_process_aggr_tlv(hal, ppdu_info);
  2797. }
  2798. }
  2799. if (hal_rx_status_tlv_should_aggregate(hal, tlv_tag)) {
  2800. return hal_rx_status_start_new_aggr_tlv(hal, rx_tlv_hdr,
  2801. ppduinfo, nbuf);
  2802. }
  2803. return hal_rx_status_get_tlv_info_generic_be(rx_tlv_hdr, ppduinfo,
  2804. hal_soc_hdl, nbuf);
  2805. }
  2806. #endif /* _HAL_BE_API_MON_H_ */