hal_be_api_mon.h 100 KB

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