hal_be_api_mon.h 98 KB

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