hal_be_api_mon.h 99 KB

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