hal_be_api_mon.h 101 KB

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