hal_be_generic_api.h 102 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606
  1. /*
  2. * Copyright (c) 2016-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
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef _HAL_BE_GENERIC_API_H_
  20. #define _HAL_BE_GENERIC_API_H_
  21. #include <hal_be_hw_headers.h>
  22. #include "hal_be_tx.h"
  23. #include "hal_be_reo.h"
  24. #include <hal_api_mon.h>
  25. #include <hal_generic_api.h>
  26. /**
  27. * Debug macro to print the TLV header tag
  28. */
  29. #define SHOW_DEFINED(x) do {} while (0)
  30. #if defined(WLAN_FEATURE_TSF_UPLINK_DELAY) || defined(WLAN_CONFIG_TX_DELAY)
  31. static inline void
  32. hal_tx_comp_get_buffer_timestamp_be(void *desc,
  33. struct hal_tx_completion_status *ts)
  34. {
  35. ts->buffer_timestamp = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  36. BUFFER_TIMESTAMP);
  37. }
  38. #else /* !WLAN_FEATURE_TSF_UPLINK_DELAY || WLAN_CONFIG_TX_DELAY */
  39. static inline void
  40. hal_tx_comp_get_buffer_timestamp_be(void *desc,
  41. struct hal_tx_completion_status *ts)
  42. {
  43. }
  44. #endif /* WLAN_FEATURE_TSF_UPLINK_DELAY || CONFIG_SAWF */
  45. /**
  46. * hal_tx_comp_get_status() - TQM Release reason
  47. * @hal_desc: completion ring Tx status
  48. *
  49. * This function will parse the WBM completion descriptor and populate in
  50. * HAL structure
  51. *
  52. * Return: none
  53. */
  54. static inline void
  55. hal_tx_comp_get_status_generic_be(void *desc, void *ts1,
  56. struct hal_soc *hal)
  57. {
  58. uint8_t rate_stats_valid = 0;
  59. uint32_t rate_stats = 0;
  60. struct hal_tx_completion_status *ts =
  61. (struct hal_tx_completion_status *)ts1;
  62. ts->ppdu_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  63. TQM_STATUS_NUMBER);
  64. ts->ack_frame_rssi = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  65. ACK_FRAME_RSSI);
  66. ts->first_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  67. FIRST_MSDU);
  68. ts->last_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  69. LAST_MSDU);
  70. #if 0
  71. // TODO - This has to be calculated form first and last msdu
  72. ts->msdu_part_of_amsdu = HAL_TX_DESC_GET(desc,
  73. WBM2SW_COMPLETION_RING_TX,
  74. MSDU_PART_OF_AMSDU);
  75. #endif
  76. ts->peer_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  77. SW_PEER_ID);
  78. ts->tid = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX, TID);
  79. ts->transmit_cnt = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
  80. TRANSMIT_COUNT);
  81. rate_stats = HAL_TX_DESC_GET(desc, HAL_TX_COMP, TX_RATE_STATS);
  82. rate_stats_valid = HAL_TX_MS(TX_RATE_STATS_INFO,
  83. TX_RATE_STATS_INFO_VALID, rate_stats);
  84. ts->valid = rate_stats_valid;
  85. if (rate_stats_valid) {
  86. ts->bw = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_BW,
  87. rate_stats);
  88. ts->pkt_type = HAL_TX_MS(TX_RATE_STATS_INFO,
  89. TRANSMIT_PKT_TYPE, rate_stats);
  90. ts->stbc = HAL_TX_MS(TX_RATE_STATS_INFO,
  91. TRANSMIT_STBC, rate_stats);
  92. ts->ldpc = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_LDPC,
  93. rate_stats);
  94. ts->sgi = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_SGI,
  95. rate_stats);
  96. ts->mcs = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_MCS,
  97. rate_stats);
  98. ts->ofdma = HAL_TX_MS(TX_RATE_STATS_INFO, OFDMA_TRANSMISSION,
  99. rate_stats);
  100. ts->tones_in_ru = HAL_TX_MS(TX_RATE_STATS_INFO, TONES_IN_RU,
  101. rate_stats);
  102. }
  103. ts->release_src = hal_tx_comp_get_buffer_source_generic_be(desc);
  104. ts->status = hal_tx_comp_get_release_reason(
  105. desc,
  106. hal_soc_to_hal_soc_handle(hal));
  107. ts->tsf = HAL_TX_DESC_GET(desc, UNIFIED_WBM_RELEASE_RING_6,
  108. TX_RATE_STATS_INFO_TX_RATE_STATS);
  109. hal_tx_comp_get_buffer_timestamp_be(desc, ts);
  110. }
  111. /**
  112. * hal_tx_set_pcp_tid_map_generic_be() - Configure default PCP to TID map table
  113. * @soc: HAL SoC context
  114. * @map: PCP-TID mapping table
  115. *
  116. * PCP are mapped to 8 TID values using TID values programmed
  117. * in one set of mapping registers PCP_TID_MAP_<0 to 6>
  118. * The mapping register has TID mapping for 8 PCP values
  119. *
  120. * Return: none
  121. */
  122. static void hal_tx_set_pcp_tid_map_generic_be(struct hal_soc *soc, uint8_t *map)
  123. {
  124. uint32_t addr, value;
  125. addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
  126. MAC_TCL_REG_REG_BASE);
  127. value = (map[0] |
  128. (map[1] << HWIO_TCL_R0_PCP_TID_MAP_PCP_1_SHFT) |
  129. (map[2] << HWIO_TCL_R0_PCP_TID_MAP_PCP_2_SHFT) |
  130. (map[3] << HWIO_TCL_R0_PCP_TID_MAP_PCP_3_SHFT) |
  131. (map[4] << HWIO_TCL_R0_PCP_TID_MAP_PCP_4_SHFT) |
  132. (map[5] << HWIO_TCL_R0_PCP_TID_MAP_PCP_5_SHFT) |
  133. (map[6] << HWIO_TCL_R0_PCP_TID_MAP_PCP_6_SHFT) |
  134. (map[7] << HWIO_TCL_R0_PCP_TID_MAP_PCP_7_SHFT));
  135. HAL_REG_WRITE(soc, addr, (value & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
  136. }
  137. /**
  138. * hal_tx_update_pcp_tid_generic_be() - Update the pcp tid map table with
  139. * value received from user-space
  140. * @soc: HAL SoC context
  141. * @pcp: pcp value
  142. * @tid : tid value
  143. *
  144. * Return: void
  145. */
  146. static void
  147. hal_tx_update_pcp_tid_generic_be(struct hal_soc *soc,
  148. uint8_t pcp, uint8_t tid)
  149. {
  150. uint32_t addr, value, regval;
  151. addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
  152. MAC_TCL_REG_REG_BASE);
  153. value = (uint32_t)tid << (HAL_TX_BITS_PER_TID * pcp);
  154. /* Read back previous PCP TID config and update
  155. * with new config.
  156. */
  157. regval = HAL_REG_READ(soc, addr);
  158. regval &= ~(HAL_TX_TID_BITS_MASK << (HAL_TX_BITS_PER_TID * pcp));
  159. regval |= value;
  160. HAL_REG_WRITE(soc, addr,
  161. (regval & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
  162. }
  163. /**
  164. * hal_tx_update_tidmap_prty_generic_be() - Update the tid map priority
  165. * @soc: HAL SoC context
  166. * @val: priority value
  167. *
  168. * Return: void
  169. */
  170. static
  171. void hal_tx_update_tidmap_prty_generic_be(struct hal_soc *soc, uint8_t value)
  172. {
  173. uint32_t addr;
  174. addr = HWIO_TCL_R0_TID_MAP_PRTY_ADDR(
  175. MAC_TCL_REG_REG_BASE);
  176. HAL_REG_WRITE(soc, addr,
  177. (value & HWIO_TCL_R0_TID_MAP_PRTY_RMSK));
  178. }
  179. /**
  180. * hal_rx_get_tlv_size_generic_be() - Get rx packet tlv size
  181. * @rx_pkt_tlv_size: TLV size for regular RX packets
  182. * @rx_mon_pkt_tlv_size: TLV size for monitor mode packets
  183. *
  184. * Return: size of rx pkt tlv before the actual data
  185. */
  186. static void hal_rx_get_tlv_size_generic_be(uint16_t *rx_pkt_tlv_size,
  187. uint16_t *rx_mon_pkt_tlv_size)
  188. {
  189. *rx_pkt_tlv_size = RX_PKT_TLVS_LEN;
  190. /* For now mon pkt tlv is same as rx pkt tlv */
  191. *rx_mon_pkt_tlv_size = MON_RX_PKT_TLVS_LEN;
  192. }
  193. /**
  194. * hal_rx_flow_get_tuple_info_be() - Setup a flow search entry in HW FST
  195. * @fst: Pointer to the Rx Flow Search Table
  196. * @hal_hash: HAL 5 tuple hash
  197. * @tuple_info: 5-tuple info of the flow returned to the caller
  198. *
  199. * Return: Success/Failure
  200. */
  201. static void *
  202. hal_rx_flow_get_tuple_info_be(uint8_t *rx_fst, uint32_t hal_hash,
  203. uint8_t *flow_tuple_info)
  204. {
  205. struct hal_rx_fst *fst = (struct hal_rx_fst *)rx_fst;
  206. void *hal_fse = NULL;
  207. struct hal_flow_tuple_info *tuple_info
  208. = (struct hal_flow_tuple_info *)flow_tuple_info;
  209. hal_fse = (uint8_t *)fst->base_vaddr +
  210. (hal_hash * HAL_RX_FST_ENTRY_SIZE);
  211. if (!hal_fse || !tuple_info)
  212. return NULL;
  213. if (!HAL_GET_FLD(hal_fse, RX_FLOW_SEARCH_ENTRY, VALID))
  214. return NULL;
  215. tuple_info->src_ip_127_96 =
  216. qdf_ntohl(HAL_GET_FLD(hal_fse,
  217. RX_FLOW_SEARCH_ENTRY,
  218. SRC_IP_127_96));
  219. tuple_info->src_ip_95_64 =
  220. qdf_ntohl(HAL_GET_FLD(hal_fse,
  221. RX_FLOW_SEARCH_ENTRY,
  222. SRC_IP_95_64));
  223. tuple_info->src_ip_63_32 =
  224. qdf_ntohl(HAL_GET_FLD(hal_fse,
  225. RX_FLOW_SEARCH_ENTRY,
  226. SRC_IP_63_32));
  227. tuple_info->src_ip_31_0 =
  228. qdf_ntohl(HAL_GET_FLD(hal_fse,
  229. RX_FLOW_SEARCH_ENTRY,
  230. SRC_IP_31_0));
  231. tuple_info->dest_ip_127_96 =
  232. qdf_ntohl(HAL_GET_FLD(hal_fse,
  233. RX_FLOW_SEARCH_ENTRY,
  234. DEST_IP_127_96));
  235. tuple_info->dest_ip_95_64 =
  236. qdf_ntohl(HAL_GET_FLD(hal_fse,
  237. RX_FLOW_SEARCH_ENTRY,
  238. DEST_IP_95_64));
  239. tuple_info->dest_ip_63_32 =
  240. qdf_ntohl(HAL_GET_FLD(hal_fse,
  241. RX_FLOW_SEARCH_ENTRY,
  242. DEST_IP_63_32));
  243. tuple_info->dest_ip_31_0 =
  244. qdf_ntohl(HAL_GET_FLD(hal_fse,
  245. RX_FLOW_SEARCH_ENTRY,
  246. DEST_IP_31_0));
  247. tuple_info->dest_port = HAL_GET_FLD(hal_fse,
  248. RX_FLOW_SEARCH_ENTRY,
  249. DEST_PORT);
  250. tuple_info->src_port = HAL_GET_FLD(hal_fse,
  251. RX_FLOW_SEARCH_ENTRY,
  252. SRC_PORT);
  253. tuple_info->l4_protocol = HAL_GET_FLD(hal_fse,
  254. RX_FLOW_SEARCH_ENTRY,
  255. L4_PROTOCOL);
  256. return hal_fse;
  257. }
  258. /**
  259. * hal_rx_flow_delete_entry_be() - Setup a flow search entry in HW FST
  260. * @fst: Pointer to the Rx Flow Search Table
  261. * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
  262. *
  263. * Return: Success/Failure
  264. */
  265. static QDF_STATUS
  266. hal_rx_flow_delete_entry_be(uint8_t *rx_fst, void *hal_rx_fse)
  267. {
  268. uint8_t *fse = (uint8_t *)hal_rx_fse;
  269. if (!HAL_GET_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID))
  270. return QDF_STATUS_E_NOENT;
  271. HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID);
  272. return QDF_STATUS_SUCCESS;
  273. }
  274. /**
  275. * hal_rx_fst_get_fse_size_be() - Retrieve the size of each entry in Rx FST
  276. *
  277. * Return: size of each entry/flow in Rx FST
  278. */
  279. static inline uint32_t
  280. hal_rx_fst_get_fse_size_be(void)
  281. {
  282. return HAL_RX_FST_ENTRY_SIZE;
  283. }
  284. /*
  285. * TX MONITOR
  286. */
  287. #ifdef QCA_MONITOR_2_0_SUPPORT
  288. /**
  289. * hal_txmon_is_mon_buf_addr_tlv_generic_be() - api to find mon buffer tlv
  290. * @tx_tlv: pointer to TLV header
  291. *
  292. * Return: bool based on tlv tag matches monitor buffer address tlv
  293. */
  294. static inline bool
  295. hal_txmon_is_mon_buf_addr_tlv_generic_be(void *tx_tlv_hdr)
  296. {
  297. uint32_t tlv_tag;
  298. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv_hdr);
  299. if (WIFIMON_BUFFER_ADDR_E == tlv_tag)
  300. return true;
  301. return false;
  302. }
  303. /**
  304. * hal_txmon_populate_packet_info_generic_be() - api to populate packet info
  305. * @tx_tlv: pointer to TLV header
  306. * @packet_info: place holder for packet info
  307. *
  308. * Return: Address to void
  309. */
  310. static inline void
  311. hal_txmon_populate_packet_info_generic_be(void *tx_tlv, void *packet_info)
  312. {
  313. struct hal_mon_packet_info *pkt_info;
  314. struct mon_buffer_addr *addr = (struct mon_buffer_addr *)tx_tlv;
  315. pkt_info = (struct hal_mon_packet_info *)packet_info;
  316. pkt_info->sw_cookie = (((uint64_t)addr->buffer_virt_addr_63_32 << 32) |
  317. (addr->buffer_virt_addr_31_0));
  318. pkt_info->dma_length = addr->dma_length + 1;
  319. pkt_info->msdu_continuation = addr->msdu_continuation;
  320. pkt_info->truncated = addr->truncated;
  321. }
  322. #if defined(TX_MONITOR_WORD_MASK)
  323. /**
  324. * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
  325. *
  326. * @tx_tlv: pointer to tx_fes_setup tlv header
  327. *
  328. * Return: number of users
  329. */
  330. static inline uint8_t
  331. hal_txmon_get_num_users(void *tx_tlv)
  332. {
  333. hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
  334. return tx_fes_setup->number_of_users;
  335. }
  336. /**
  337. * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
  338. *
  339. * @tx_tlv: pointer to tx_fes_setup tlv header
  340. * @ppdu_info: pointer to hal_tx_ppdu_info
  341. *
  342. * Return: void
  343. */
  344. static inline void
  345. hal_txmon_parse_tx_fes_setup(void *tx_tlv,
  346. struct hal_tx_ppdu_info *tx_ppdu_info)
  347. {
  348. hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
  349. tx_ppdu_info->num_users = tx_fes_setup->number_of_users;
  350. if (tx_ppdu_info->num_users == 0)
  351. tx_ppdu_info->num_users = 1;
  352. TXMON_HAL(tx_ppdu_info, ppdu_id) = tx_fes_setup->schedule_id;
  353. TXMON_HAL_STATUS(tx_ppdu_info, ppdu_id) = tx_fes_setup->schedule_id;
  354. }
  355. /**
  356. * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
  357. *
  358. * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
  359. * @data_status_info: pointer to data hal_tx_status_info
  360. * @prot_status_info: pointer to protection hal_tx_status_info
  361. *
  362. * Return: void
  363. */
  364. static inline void
  365. hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
  366. struct hal_tx_status_info *data_status_info,
  367. struct hal_tx_status_info *prot_status_info)
  368. {
  369. }
  370. /**
  371. * hal_txmon_parse_peer_entry() - parse peer entry tlv
  372. *
  373. * @tx_tlv: pointer to peer_entry tlv header
  374. * @user_id: user_id
  375. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  376. * @tx_status_info: pointer to hal_tx_status_info
  377. *
  378. * Return: void
  379. */
  380. static inline void
  381. hal_txmon_parse_peer_entry(void *tx_tlv,
  382. uint8_t user_id,
  383. struct hal_tx_ppdu_info *tx_ppdu_info,
  384. struct hal_tx_status_info *tx_status_info)
  385. {
  386. }
  387. /**
  388. * hal_txmon_parse_queue_exten() - parse queue exten tlv
  389. *
  390. * @tx_tlv: pointer to queue exten tlv header
  391. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  392. *
  393. * Return: void
  394. */
  395. static inline void
  396. hal_txmon_parse_queue_exten(void *tx_tlv,
  397. struct hal_tx_ppdu_info *tx_ppdu_info)
  398. {
  399. }
  400. /**
  401. * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
  402. *
  403. * @tx_tlv: pointer to mpdu start tlv header
  404. * @user_id: user id
  405. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  406. *
  407. * Return: void
  408. */
  409. static inline void
  410. hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
  411. struct hal_tx_ppdu_info *tx_ppdu_info)
  412. {
  413. }
  414. #else
  415. /**
  416. * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
  417. *
  418. * @tx_tlv: pointer to tx_fes_setup tlv header
  419. *
  420. * Return: number of users
  421. */
  422. static inline uint8_t
  423. hal_txmon_get_num_users(void *tx_tlv)
  424. {
  425. uint8_t num_users = HAL_TX_DESC_GET_64(tx_tlv,
  426. TX_FES_SETUP, NUMBER_OF_USERS);
  427. return num_users;
  428. }
  429. /**
  430. * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
  431. *
  432. * @tx_tlv: pointer to tx_fes_setup tlv header
  433. * @ppdu_info: pointer to hal_tx_ppdu_info
  434. *
  435. * Return: void
  436. */
  437. static inline void
  438. hal_txmon_parse_tx_fes_setup(void *tx_tlv,
  439. struct hal_tx_ppdu_info *tx_ppdu_info)
  440. {
  441. uint32_t num_users = 0;
  442. uint32_t ppdu_id = 0;
  443. num_users = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, NUMBER_OF_USERS);
  444. ppdu_id = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, SCHEDULE_ID);
  445. if (num_users == 0)
  446. num_users = 1;
  447. tx_ppdu_info->num_users = num_users;
  448. TXMON_HAL(tx_ppdu_info, ppdu_id) = ppdu_id;
  449. TXMON_HAL_STATUS(tx_ppdu_info, ppdu_id) = ppdu_id;
  450. }
  451. /**
  452. * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
  453. *
  454. * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
  455. * @data_status_info: pointer to data hal_tx_status_info
  456. * @prot_status_info: pointer to protection hal_tx_status_info
  457. *
  458. * Return: void
  459. */
  460. static inline void
  461. hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
  462. struct hal_tx_status_info *data_status_info,
  463. struct hal_tx_status_info *prot_status_info)
  464. {
  465. prot_status_info->protection_addr =
  466. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  467. USE_ADDRESS_FIELDS_FOR_PROTECTION);
  468. /* protection frame address 1 */
  469. *(uint32_t *)&prot_status_info->addr1[0] =
  470. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  471. PROTECTION_FRAME_AD1_31_0);
  472. *(uint32_t *)&prot_status_info->addr1[4] =
  473. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  474. PROTECTION_FRAME_AD1_47_32);
  475. /* protection frame address 2 */
  476. *(uint32_t *)&prot_status_info->addr2[0] =
  477. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  478. PROTECTION_FRAME_AD2_15_0);
  479. *(uint32_t *)&prot_status_info->addr2[2] =
  480. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  481. PROTECTION_FRAME_AD2_47_16);
  482. /* protection frame address 3 */
  483. *(uint32_t *)&prot_status_info->addr3[0] =
  484. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  485. PROTECTION_FRAME_AD3_31_0);
  486. *(uint32_t *)&prot_status_info->addr3[4] =
  487. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  488. PROTECTION_FRAME_AD3_47_32);
  489. /* protection frame address 4 */
  490. *(uint32_t *)&prot_status_info->addr4[0] =
  491. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  492. PROTECTION_FRAME_AD4_15_0);
  493. *(uint32_t *)&prot_status_info->addr4[2] =
  494. HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
  495. PROTECTION_FRAME_AD4_47_16);
  496. }
  497. /**
  498. * hal_txmon_parse_peer_entry() - parse peer entry tlv
  499. *
  500. * @tx_tlv: pointer to peer_entry tlv header
  501. * @user_id: user_id
  502. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  503. * @tx_status_info: pointer to hal_tx_status_info
  504. *
  505. * Return: void
  506. */
  507. static inline void
  508. hal_txmon_parse_peer_entry(void *tx_tlv,
  509. uint8_t user_id,
  510. struct hal_tx_ppdu_info *tx_ppdu_info,
  511. struct hal_tx_status_info *tx_status_info)
  512. {
  513. *(uint32_t *)&tx_status_info->addr1[0] =
  514. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_31_0);
  515. *(uint32_t *)&tx_status_info->addr1[4] =
  516. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_47_32);
  517. *(uint32_t *)&tx_status_info->addr2[0] =
  518. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_15_0);
  519. *(uint32_t *)&tx_status_info->addr2[2] =
  520. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_47_16);
  521. TXMON_HAL_USER(tx_ppdu_info, user_id, sw_peer_id) =
  522. HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, SW_PEER_ID);
  523. }
  524. /**
  525. * hal_txmon_parse_queue_exten() - parse queue exten tlv
  526. *
  527. * @tx_tlv: pointer to queue exten tlv header
  528. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  529. *
  530. * Return: void
  531. */
  532. static inline void
  533. hal_txmon_parse_queue_exten(void *tx_tlv,
  534. struct hal_tx_ppdu_info *tx_ppdu_info)
  535. {
  536. TXMON_HAL_STATUS(tx_ppdu_info, frame_control) =
  537. HAL_TX_DESC_GET_64(tx_tlv, TX_QUEUE_EXTENSION,
  538. FRAME_CTL);
  539. TXMON_HAL_STATUS(tx_ppdu_info, frame_control_info_valid) = true;
  540. }
  541. /**
  542. * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
  543. *
  544. * @tx_tlv: pointer to mpdu start tlv header
  545. * @user_id: user id
  546. * @tx_ppdu_info: pointer to hal_tx_ppdu_info
  547. *
  548. * Return: void
  549. */
  550. static inline void
  551. hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
  552. struct hal_tx_ppdu_info *tx_ppdu_info)
  553. {
  554. TXMON_HAL_USER(tx_ppdu_info, user_id,
  555. start_seq) = HAL_TX_DESC_GET_64(tx_tlv, TX_MPDU_START,
  556. MPDU_SEQUENCE_NUMBER);
  557. TXMON_HAL(tx_ppdu_info, cur_usr_idx) = user_id;
  558. }
  559. #endif
  560. /**
  561. * get_ru_offset_from_start_index() - api to get ru offset from ru index
  562. *
  563. * @ru_size: RU size
  564. * @start_idx: Start index
  565. *
  566. * Return: uint8_t ru allocation offset
  567. */
  568. static inline
  569. uint8_t get_ru_offset_from_start_index(uint8_t ru_size, uint8_t start_idx)
  570. {
  571. uint8_t ru_alloc_offset[HAL_MAX_DL_MU_USERS][HAL_MAX_RU_INDEX] = {
  572. {0, 0, 0, 0, 0, 0, 0},
  573. {1, 0, 0, 0, 0, 0, 0},
  574. {2, 1, 0, 0, 0, 0, 0},
  575. {3, 1, 0, 0, 0, 0, 0},
  576. {4, 0, 0, 0, 0, 0, 0},
  577. {5, 2, 1, 0, 0, 0, 0},
  578. {6, 2, 1, 0, 0, 0, 0},
  579. {7, 3, 1, 0, 0, 0, 0},
  580. {8, 3, 1, 0, 0, 0, 0},
  581. {9, 4, 2, 1, 0, 0, 0},
  582. {10, 4, 2, 1, 0, 0, 0},
  583. {11, 5, 2, 1, 0, 0, 0},
  584. {12, 5, 2, 1, 0, 0, 0},
  585. {13, 0, 0, 1, 0, 0, 0},
  586. {14, 6, 3, 1, 0, 0, 0},
  587. {15, 6, 3, 1, 0, 0, 0},
  588. {16, 7, 3, 1, 0, 0, 0},
  589. {17, 7, 3, 1, 0, 0, 0},
  590. {18, 0, 0, 0, 0, 0, 0},
  591. {19, 8, 4, 2, 1, 0, 0},
  592. {20, 8, 4, 2, 1, 0, 0},
  593. {21, 9, 4, 2, 1, 0, 0},
  594. {22, 9, 4, 2, 1, 0, 0},
  595. {23, 0, 0, 2, 1, 0, 0},
  596. {24, 10, 5, 2, 1, 0, 0},
  597. {25, 10, 5, 2, 1, 0, 0},
  598. {26, 11, 5, 2, 1, 0, 0},
  599. {27, 11, 5, 2, 1, 0, 0},
  600. {28, 12, 6, 3, 1, 0, 0},
  601. {29, 12, 6, 3, 1, 0, 0},
  602. {30, 13, 6, 3, 1, 0, 0},
  603. {31, 13, 6, 3, 1, 0, 0},
  604. {32, 0, 0, 3, 1, 0, 0},
  605. {33, 14, 7, 3, 1, 0, 0},
  606. {34, 14, 7, 3, 1, 0, 0},
  607. {35, 15, 7, 3, 1, 0, 0},
  608. {36, 15, 7, 3, 1, 0, 0},
  609. };
  610. if (start_idx >= HAL_MAX_UL_MU_USERS || ru_size >= HAL_MAX_RU_INDEX)
  611. return 0;
  612. return ru_alloc_offset[start_idx][ru_size];
  613. }
  614. /**
  615. * hal_txmon_status_get_num_users_generic_be() - api to get num users
  616. * from start of fes window
  617. *
  618. * @tx_tlv_hdr: pointer to TLV header
  619. * @num_users: reference to number of user
  620. *
  621. * Return: status
  622. */
  623. static inline uint32_t
  624. hal_txmon_status_get_num_users_generic_be(void *tx_tlv_hdr, uint8_t *num_users)
  625. {
  626. uint32_t tlv_tag, user_id, tlv_len;
  627. uint32_t tlv_status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
  628. void *tx_tlv;
  629. tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(tx_tlv_hdr);
  630. user_id = HAL_RX_GET_USER_TLV32_USERID(tx_tlv_hdr);
  631. tlv_len = HAL_RX_GET_USER_TLV32_LEN(tx_tlv_hdr);
  632. tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
  633. /* window starts with either initiator or response */
  634. switch (tlv_tag) {
  635. case WIFITX_FES_SETUP_E:
  636. {
  637. *num_users = hal_txmon_get_num_users(tx_tlv);
  638. if (*num_users == 0)
  639. *num_users = 1;
  640. tlv_status = HAL_MON_TX_FES_SETUP;
  641. break;
  642. }
  643. case WIFIRX_RESPONSE_REQUIRED_INFO_E:
  644. {
  645. *num_users = HAL_TX_DESC_GET_64(tx_tlv,
  646. RX_RESPONSE_REQUIRED_INFO,
  647. RESPONSE_STA_COUNT);
  648. if (*num_users == 0)
  649. *num_users = 1;
  650. tlv_status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
  651. break;
  652. }
  653. };
  654. return tlv_status;
  655. }
  656. /**
  657. * hal_tx_get_ppdu_info() - api to get tx ppdu info
  658. * @pdev_handle: DP_PDEV handle
  659. * @prot_ppdu_info: populate dp_ppdu_info protection
  660. * @tx_data_ppdu_info: populate dp_ppdu_info data
  661. * @tlv_tag: Tag
  662. *
  663. * Return: dp_tx_ppdu_info pointer
  664. */
  665. static inline void *
  666. hal_tx_get_ppdu_info(void *data_info, void *prot_info, uint32_t tlv_tag)
  667. {
  668. struct hal_tx_ppdu_info *prot_ppdu_info = prot_info;
  669. switch (tlv_tag) {
  670. case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
  671. case WIFITX_FLUSH_E:/* DOWNSTREAM */
  672. case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
  673. case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
  674. case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
  675. case WIFITX_MPDU_START_E:/* DOWNSTREAM */
  676. case WIFITX_MSDU_START_E:/* DOWNSTREAM */
  677. case WIFITX_DATA_E:/* DOWNSTREAM */
  678. case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
  679. case WIFITX_MPDU_END_E:/* DOWNSTREAM */
  680. case WIFITX_MSDU_END_E:/* DOWNSTREAM */
  681. case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
  682. case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
  683. case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
  684. case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
  685. case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
  686. case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
  687. case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
  688. case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
  689. case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
  690. case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
  691. case WIFISCHEDULER_END_E:/* DOWNSTREAM */
  692. case WIFITX_FES_STATUS_START_PPDU_E:/* UPSTREAM */
  693. {
  694. return data_info;
  695. }
  696. }
  697. /*
  698. * check current prot_tlv_status is start protection
  699. * check current tlv_tag is either start protection or end protection
  700. */
  701. if (TXMON_HAL(prot_ppdu_info,
  702. prot_tlv_status) == WIFITX_FES_STATUS_START_PROT_E) {
  703. return prot_info;
  704. } else if (tlv_tag == WIFITX_FES_STATUS_PROT_E ||
  705. tlv_tag == WIFITX_FES_STATUS_START_PROT_E) {
  706. TXMON_HAL(prot_ppdu_info, prot_tlv_status) = tlv_tag;
  707. return prot_info;
  708. }
  709. return data_info;
  710. }
  711. /**
  712. * hal_txmon_status_parse_tlv_generic_be() - api to parse status tlv.
  713. * @data_ppdu_info: hal_txmon data ppdu info
  714. * @prot_ppdu_info: hal_txmon prot ppdu info
  715. * @data_status_info: pointer to data status info
  716. * @prot_status_info: pointer to prot status info
  717. * @tx_tlv_hdr: fragment of tx_tlv_hdr
  718. * @status_frag: qdf_frag_t buffer
  719. *
  720. * Return: status
  721. */
  722. static inline uint32_t
  723. hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
  724. void *prot_ppdu_info,
  725. void *data_status_info,
  726. void *prot_status_info,
  727. void *tx_tlv_hdr,
  728. qdf_frag_t status_frag)
  729. {
  730. struct hal_tx_ppdu_info *ppdu_info;
  731. struct hal_tx_status_info *tx_status_info;
  732. struct hal_mon_packet_info *packet_info = NULL;
  733. uint32_t tlv_tag, user_id, tlv_len;
  734. uint32_t status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
  735. void *tx_tlv;
  736. tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv_hdr);
  737. /* user_id start with 1, decrement by 1 to start from 0 */
  738. user_id = HAL_RX_GET_USER_TLV64_USERID(tx_tlv_hdr);
  739. tlv_len = HAL_RX_GET_USER_TLV64_LEN(tx_tlv_hdr);
  740. tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
  741. /* parse tlv and populate tx_ppdu_info */
  742. ppdu_info = hal_tx_get_ppdu_info(data_ppdu_info,
  743. prot_ppdu_info, tlv_tag);
  744. tx_status_info = (ppdu_info->is_data ? data_status_info :
  745. prot_status_info);
  746. user_id = user_id > ppdu_info->num_users ? 0 : user_id;
  747. switch (tlv_tag) {
  748. /* start of initiator FES window */
  749. case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
  750. {
  751. /* initiator PPDU window start */
  752. hal_txmon_parse_tx_fes_setup(tx_tlv, ppdu_info);
  753. status = HAL_MON_TX_FES_SETUP;
  754. SHOW_DEFINED(WIFITX_FES_SETUP_E);
  755. break;
  756. }
  757. /* end of initiator FES window */
  758. case WIFITX_FES_STATUS_END_E:/* UPSTREAM */
  759. {
  760. /* initiator PPDU window end */
  761. uint32_t ppdu_timestamp_start = 0;
  762. uint32_t ppdu_timestamp_end = 0;
  763. uint16_t phy_abort_reason = 0;
  764. uint8_t phy_abort_is_valid = 0;
  765. uint8_t abort_usr_id = 0;
  766. uint8_t response_type = 0;
  767. uint8_t r2r_end_status_follow = 0;
  768. status = HAL_MON_TX_FES_STATUS_END;
  769. ppdu_timestamp_start =
  770. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  771. START_OF_FRAME_TIMESTAMP_15_0) |
  772. (HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  773. START_OF_FRAME_TIMESTAMP_31_16) <<
  774. HAL_TX_LSB(TX_FES_STATUS_END,
  775. START_OF_FRAME_TIMESTAMP_31_16));
  776. ppdu_timestamp_end =
  777. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  778. END_OF_FRAME_TIMESTAMP_15_0) |
  779. (HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  780. END_OF_FRAME_TIMESTAMP_31_16) <<
  781. HAL_TX_LSB(TX_FES_STATUS_END,
  782. END_OF_FRAME_TIMESTAMP_31_16));
  783. response_type = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  784. RESPONSE_TYPE);
  785. /*
  786. * r2r end status follow to inform whether to look for
  787. * rx_response_required_info
  788. */
  789. r2r_end_status_follow =
  790. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  791. R2R_END_STATUS_TO_FOLLOW);
  792. phy_abort_is_valid =
  793. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  794. PHYTX_ABORT_REQUEST_INFO_VALID);
  795. if (phy_abort_is_valid) {
  796. phy_abort_reason =
  797. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  798. PHYTX_ABORT_REQUEST_INFO_DETAILS_PHYTX_ABORT_REASON);
  799. abort_usr_id =
  800. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
  801. PHYTX_ABORT_REQUEST_INFO_DETAILS_USER_NUMBER);
  802. TXMON_STATUS_INFO(tx_status_info,
  803. phy_abort_reason) = phy_abort_reason;
  804. TXMON_STATUS_INFO(tx_status_info,
  805. phy_abort_user_number) = abort_usr_id;
  806. }
  807. TXMON_STATUS_INFO(tx_status_info,
  808. response_type) = response_type;
  809. TXMON_STATUS_INFO(tx_status_info,
  810. r2r_to_follow) = r2r_end_status_follow;
  811. /* update phy timestamp to ppdu timestamp */
  812. TXMON_HAL_STATUS(ppdu_info,
  813. ppdu_timestamp) = ppdu_timestamp_start;
  814. SHOW_DEFINED(WIFITX_FES_STATUS_END_E);
  815. break;
  816. }
  817. /* response window open */
  818. case WIFIRX_RESPONSE_REQUIRED_INFO_E:/* UPSTREAM */
  819. {
  820. /* response PPDU window start */
  821. uint32_t ppdu_id = 0;
  822. uint8_t reception_type = 0;
  823. uint8_t response_sta_count = 0;
  824. status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
  825. ppdu_id = HAL_TX_DESC_GET_64(tx_tlv,
  826. RX_RESPONSE_REQUIRED_INFO,
  827. PHY_PPDU_ID);
  828. reception_type =
  829. HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
  830. SU_OR_UPLINK_MU_RECEPTION);
  831. response_sta_count =
  832. HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
  833. RESPONSE_STA_COUNT);
  834. /* get mac address */
  835. *(uint32_t *)&tx_status_info->addr1[0] =
  836. HAL_TX_DESC_GET_64(tx_tlv,
  837. RX_RESPONSE_REQUIRED_INFO,
  838. ADDR1_31_0);
  839. *(uint32_t *)&tx_status_info->addr1[4] =
  840. HAL_TX_DESC_GET_64(tx_tlv,
  841. RX_RESPONSE_REQUIRED_INFO,
  842. ADDR1_47_32);
  843. *(uint32_t *)&tx_status_info->addr2[0] =
  844. HAL_TX_DESC_GET_64(tx_tlv,
  845. RX_RESPONSE_REQUIRED_INFO,
  846. ADDR2_15_0);
  847. *(uint32_t *)&tx_status_info->addr2[2] =
  848. HAL_TX_DESC_GET_64(tx_tlv,
  849. RX_RESPONSE_REQUIRED_INFO,
  850. ADDR2_47_16);
  851. TXMON_HAL(ppdu_info, ppdu_id) = ppdu_id;
  852. TXMON_HAL_STATUS(ppdu_info, ppdu_id) = ppdu_id;
  853. if (response_sta_count == 0)
  854. response_sta_count = 1;
  855. TXMON_HAL(ppdu_info, num_users) = response_sta_count;
  856. if (reception_type)
  857. TXMON_STATUS_INFO(tx_status_info,
  858. transmission_type) =
  859. TXMON_SU_TRANSMISSION;
  860. else
  861. TXMON_STATUS_INFO(tx_status_info,
  862. transmission_type) =
  863. TXMON_MU_TRANSMISSION;
  864. SHOW_DEFINED(WIFIRX_RESPONSE_REQUIRED_INFO_E);
  865. break;
  866. }
  867. /* Response window close */
  868. case WIFIRESPONSE_END_STATUS_E:/* UPSTREAM */
  869. {
  870. /* response PPDU window end */
  871. uint8_t generated_response = 0;
  872. uint32_t bandwidth = 0;
  873. uint32_t ppdu_timestamp_start = 0;
  874. uint32_t ppdu_timestamp_end = 0;
  875. uint32_t mba_usr_cnt = 0;
  876. uint32_t mba_fake_bitmap_cnt = 0;
  877. status = HAL_MON_RESPONSE_END_STATUS_INFO;
  878. generated_response = HAL_TX_DESC_GET_64(tx_tlv,
  879. RESPONSE_END_STATUS,
  880. GENERATED_RESPONSE);
  881. mba_usr_cnt = HAL_TX_DESC_GET_64(tx_tlv,
  882. RESPONSE_END_STATUS,
  883. MBA_USER_COUNT);
  884. mba_fake_bitmap_cnt = HAL_TX_DESC_GET_64(tx_tlv,
  885. RESPONSE_END_STATUS,
  886. MBA_FAKE_BITMAP_COUNT);
  887. bandwidth = HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  888. COEX_BASED_TX_BW);
  889. /* 32 bits TSF */
  890. ppdu_timestamp_start =
  891. (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  892. START_OF_FRAME_TIMESTAMP_15_0) |
  893. (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  894. START_OF_FRAME_TIMESTAMP_31_16) <<
  895. 16));
  896. ppdu_timestamp_end =
  897. (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  898. END_OF_FRAME_TIMESTAMP_15_0) |
  899. (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
  900. END_OF_FRAME_TIMESTAMP_31_16) <<
  901. 16));
  902. TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
  903. /* update phy timestamp to ppdu timestamp */
  904. TXMON_HAL_STATUS(ppdu_info,
  905. ppdu_timestamp) = ppdu_timestamp_start;
  906. TXMON_STATUS_INFO(tx_status_info,
  907. generated_response) = generated_response;
  908. TXMON_STATUS_INFO(tx_status_info, mba_count) = mba_usr_cnt;
  909. TXMON_STATUS_INFO(tx_status_info,
  910. mba_fake_bitmap_count) = mba_fake_bitmap_cnt;
  911. SHOW_DEFINED(WIFIRESPONSE_END_STATUS_E);
  912. break;
  913. }
  914. case WIFITX_FLUSH_E:/* DOWNSTREAM */
  915. {
  916. SHOW_DEFINED(WIFITX_FLUSH_E);
  917. break;
  918. }
  919. /* Downstream tlv */
  920. case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
  921. {
  922. hal_txmon_parse_pcu_ppdu_setup_init(tx_tlv, data_status_info,
  923. prot_status_info);
  924. status = HAL_MON_TX_PCU_PPDU_SETUP_INIT;
  925. SHOW_DEFINED(WIFIPCU_PPDU_SETUP_INIT_E);
  926. break;
  927. }
  928. case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
  929. {
  930. hal_txmon_parse_peer_entry(tx_tlv, user_id,
  931. ppdu_info, tx_status_info);
  932. SHOW_DEFINED(WIFITX_PEER_ENTRY_E);
  933. break;
  934. }
  935. case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
  936. {
  937. status = HAL_MON_TX_QUEUE_EXTENSION;
  938. hal_txmon_parse_queue_exten(tx_tlv, ppdu_info);
  939. SHOW_DEFINED(WIFITX_QUEUE_EXTENSION_E);
  940. break;
  941. }
  942. /* payload and data frame handling */
  943. case WIFITX_MPDU_START_E:/* DOWNSTREAM */
  944. {
  945. hal_txmon_parse_mpdu_start(tx_tlv, user_id, ppdu_info);
  946. status = HAL_MON_TX_MPDU_START;
  947. SHOW_DEFINED(WIFITX_MPDU_START_E);
  948. break;
  949. }
  950. case WIFITX_MSDU_START_E:/* DOWNSTREAM */
  951. {
  952. /* compacted */
  953. /* we expect frame to be 802.11 frame type */
  954. status = HAL_MON_TX_MSDU_START;
  955. SHOW_DEFINED(WIFITX_MSDU_START_E);
  956. break;
  957. }
  958. case WIFITX_DATA_E:/* DOWNSTREAM */
  959. {
  960. status = HAL_MON_TX_DATA;
  961. /*
  962. * TODO: do we need a conversion api to convert
  963. * user_id from hw to get host user_index
  964. */
  965. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  966. TXMON_STATUS_INFO(tx_status_info,
  967. buffer) = (void *)status_frag;
  968. TXMON_STATUS_INFO(tx_status_info,
  969. offset) = ((void *)tx_tlv -
  970. (void *)status_frag);
  971. TXMON_STATUS_INFO(tx_status_info,
  972. length) = tlv_len;
  973. /*
  974. * reference of the status buffer will be held in
  975. * dp_tx_update_ppdu_info_status()
  976. */
  977. status = HAL_MON_TX_DATA;
  978. SHOW_DEFINED(WIFITX_DATA_E);
  979. break;
  980. }
  981. case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
  982. {
  983. packet_info = &ppdu_info->packet_info;
  984. status = HAL_MON_TX_BUFFER_ADDR;
  985. /*
  986. * TODO: do we need a conversion api to convert
  987. * user_id from hw to get host user_index
  988. */
  989. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  990. hal_txmon_populate_packet_info_generic_be(tx_tlv, packet_info);
  991. SHOW_DEFINED(WIFIMON_BUFFER_ADDR_E);
  992. break;
  993. }
  994. case WIFITX_MPDU_END_E:/* DOWNSTREAM */
  995. {
  996. /* no tlv content */
  997. SHOW_DEFINED(WIFITX_MPDU_END_E);
  998. break;
  999. }
  1000. case WIFITX_MSDU_END_E:/* DOWNSTREAM */
  1001. {
  1002. /* no tlv content */
  1003. SHOW_DEFINED(WIFITX_MSDU_END_E);
  1004. break;
  1005. }
  1006. case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
  1007. {
  1008. /* no tlv content */
  1009. SHOW_DEFINED(WIFITX_LAST_MPDU_FETCHED_E);
  1010. break;
  1011. }
  1012. case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
  1013. {
  1014. /* no tlv content */
  1015. SHOW_DEFINED(WIFITX_LAST_MPDU_END_E);
  1016. break;
  1017. }
  1018. case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
  1019. {
  1020. /*
  1021. * transmitting power
  1022. * minimum transmitting power
  1023. * desired nss
  1024. * tx chain mask
  1025. * desired bw
  1026. * duration of transmit and response
  1027. *
  1028. * since most of the field we are deriving from other tlv
  1029. * we don't need to enable this in our tlv.
  1030. */
  1031. SHOW_DEFINED(WIFICOEX_TX_REQ_E);
  1032. break;
  1033. }
  1034. case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
  1035. {
  1036. /* user tlv */
  1037. /*
  1038. * All Tx monitor will have 802.11 hdr
  1039. * we don't need to enable this TLV
  1040. */
  1041. SHOW_DEFINED(WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E);
  1042. break;
  1043. }
  1044. case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
  1045. {
  1046. /*
  1047. * no tlv content
  1048. *
  1049. * TLV that indicates to TXPCU that preamble phase for the NDP
  1050. * frame transmission is now over
  1051. */
  1052. SHOW_DEFINED(WIFINDP_PREAMBLE_DONE_E);
  1053. break;
  1054. }
  1055. case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
  1056. {
  1057. /*
  1058. * no tlv content
  1059. *
  1060. * TLV indicates to the SCH that all timing critical TLV
  1061. * has been passed on to the transmit path
  1062. */
  1063. SHOW_DEFINED(WIFISCH_CRITICAL_TLV_REFERENCE_E);
  1064. break;
  1065. }
  1066. case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
  1067. {
  1068. /*
  1069. * Loopback specific setup info - not needed for Tx monitor
  1070. */
  1071. SHOW_DEFINED(WIFITX_LOOPBACK_SETUP_E);
  1072. break;
  1073. }
  1074. case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
  1075. {
  1076. /*
  1077. * no tlv content
  1078. *
  1079. * TLV indicates that other modules besides the scheduler can
  1080. * now also start generating TLV's
  1081. * prevent colliding or generating TLV's out of order
  1082. */
  1083. SHOW_DEFINED(WIFITX_FES_SETUP_COMPLETE_E);
  1084. break;
  1085. }
  1086. case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
  1087. {
  1088. /*
  1089. * no tlv content
  1090. *
  1091. * TLV indicates to SCH that a burst of MPDU info will
  1092. * start to come in over the TLV
  1093. */
  1094. SHOW_DEFINED(WIFITQM_MPDU_GLOBAL_START_E);
  1095. break;
  1096. }
  1097. case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
  1098. {
  1099. SHOW_DEFINED(WIFITX_WUR_DATA_E);
  1100. break;
  1101. }
  1102. case WIFISCHEDULER_END_E:/* DOWNSTREAM */
  1103. {
  1104. /*
  1105. * no tlv content
  1106. *
  1107. * TLV indicates END of all TLV's within the scheduler TLV
  1108. */
  1109. SHOW_DEFINED(WIFISCHEDULER_END_E);
  1110. break;
  1111. }
  1112. /* Upstream tlv */
  1113. case WIFIPDG_TX_REQ_E:
  1114. {
  1115. SHOW_DEFINED(WIFIPDG_TX_REQ_E);
  1116. break;
  1117. }
  1118. case WIFITX_FES_STATUS_START_E:
  1119. {
  1120. /*
  1121. * TLV indicating that first transmission on the medium
  1122. */
  1123. uint8_t medium_prot_type = 0;
  1124. status = HAL_MON_TX_FES_STATUS_START;
  1125. medium_prot_type = HAL_TX_DESC_GET_64(tx_tlv,
  1126. TX_FES_STATUS_START,
  1127. MEDIUM_PROT_TYPE);
  1128. ppdu_info = (struct hal_tx_ppdu_info *)prot_ppdu_info;
  1129. /* update what type of medium protection frame */
  1130. TXMON_STATUS_INFO(tx_status_info,
  1131. medium_prot_type) = medium_prot_type;
  1132. SHOW_DEFINED(WIFITX_FES_STATUS_START_E);
  1133. break;
  1134. }
  1135. case WIFITX_FES_STATUS_PROT_E:
  1136. {
  1137. uint32_t start_timestamp = 0;
  1138. uint32_t end_timestamp = 0;
  1139. /*
  1140. * generated by TXPCU to indicate the result of having
  1141. * received of the expected protection frame
  1142. */
  1143. status = HAL_MON_TX_FES_STATUS_PROT;
  1144. start_timestamp =
  1145. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
  1146. START_OF_FRAME_TIMESTAMP_15_0);
  1147. start_timestamp |=
  1148. (HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
  1149. START_OF_FRAME_TIMESTAMP_31_16) <<
  1150. 15);
  1151. end_timestamp = HAL_TX_DESC_GET_64(tx_tlv,
  1152. TX_FES_STATUS_PROT,
  1153. END_OF_FRAME_TIMESTAMP_15_0);
  1154. end_timestamp |=
  1155. HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
  1156. END_OF_FRAME_TIMESTAMP_31_16) << 15;
  1157. /* ppdu timestamp as phy timestamp */
  1158. TXMON_HAL_STATUS(ppdu_info,
  1159. ppdu_timestamp) = start_timestamp;
  1160. SHOW_DEFINED(WIFITX_FES_STATUS_PROT_E);
  1161. break;
  1162. }
  1163. case WIFITX_FES_STATUS_START_PROT_E:
  1164. {
  1165. uint64_t tsft_64;
  1166. uint32_t response_type;
  1167. status = HAL_MON_TX_FES_STATUS_START_PROT;
  1168. TXMON_HAL(ppdu_info, prot_tlv_status) = tlv_tag;
  1169. /* timestamp */
  1170. tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
  1171. TX_FES_STATUS_START_PROT,
  1172. PROT_TIMESTAMP_LOWER_32);
  1173. tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
  1174. TX_FES_STATUS_START_PROT,
  1175. PROT_TIMESTAMP_UPPER_32) << 32);
  1176. response_type = HAL_TX_DESC_GET_64(tx_tlv,
  1177. TX_FES_STATUS_START_PROT,
  1178. RESPONSE_TYPE);
  1179. TXMON_STATUS_INFO(tx_status_info,
  1180. response_type) = response_type;
  1181. TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
  1182. SHOW_DEFINED(WIFITX_FES_STATUS_START_PROT_E);
  1183. break;
  1184. }
  1185. case WIFIPROT_TX_END_E:
  1186. {
  1187. /*
  1188. * no tlv content
  1189. *
  1190. * generated by TXPCU the moment that protection frame
  1191. * transmission has finished on the medium
  1192. */
  1193. SHOW_DEFINED(WIFIPROT_TX_END_E);
  1194. break;
  1195. }
  1196. case WIFITX_FES_STATUS_START_PPDU_E:
  1197. {
  1198. uint64_t tsft_64;
  1199. uint8_t ndp_frame;
  1200. status = HAL_MON_TX_FES_STATUS_START_PPDU;
  1201. tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
  1202. TX_FES_STATUS_START_PPDU,
  1203. PPDU_TIMESTAMP_LOWER_32);
  1204. tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
  1205. TX_FES_STATUS_START_PPDU,
  1206. PPDU_TIMESTAMP_UPPER_32) << 32);
  1207. ndp_frame = HAL_TX_DESC_GET_64(tx_tlv,
  1208. TX_FES_STATUS_START_PPDU,
  1209. NDP_FRAME);
  1210. TXMON_STATUS_INFO(tx_status_info, ndp_frame) = ndp_frame;
  1211. TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
  1212. SHOW_DEFINED(WIFITX_FES_STATUS_START_PPDU_E);
  1213. break;
  1214. }
  1215. case WIFITX_FES_STATUS_USER_PPDU_E:
  1216. {
  1217. /* user tlv */
  1218. uint16_t duration;
  1219. uint8_t transmitted_tid;
  1220. duration = HAL_TX_DESC_GET_64(tx_tlv,
  1221. TX_FES_STATUS_USER_PPDU,
  1222. DURATION);
  1223. transmitted_tid = HAL_TX_DESC_GET_64(tx_tlv,
  1224. TX_FES_STATUS_USER_PPDU,
  1225. TRANSMITTED_TID);
  1226. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1227. TXMON_HAL_USER(ppdu_info, user_id, tid) = transmitted_tid;
  1228. TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
  1229. status = HAL_MON_TX_FES_STATUS_USER_PPDU;
  1230. SHOW_DEFINED(WIFITX_FES_STATUS_USER_PPDU_E);
  1231. break;
  1232. }
  1233. case WIFIPPDU_TX_END_E:
  1234. {
  1235. /*
  1236. * no tlv content
  1237. *
  1238. * generated by TXPCU the moment that PPDU transmission has
  1239. * finished on the medium
  1240. */
  1241. SHOW_DEFINED(WIFIPPDU_TX_END_E);
  1242. break;
  1243. }
  1244. case WIFITX_FES_STATUS_USER_RESPONSE_E:
  1245. {
  1246. /*
  1247. * TLV contains the FES transmit result of the each
  1248. * of the MAC users. TLV are forwarded to HWSCH
  1249. */
  1250. SHOW_DEFINED(WIFITX_FES_STATUS_USER_RESPONSE_E);
  1251. break;
  1252. }
  1253. case WIFITX_FES_STATUS_ACK_OR_BA_E:
  1254. {
  1255. /* user tlv */
  1256. /*
  1257. * TLV generated by RXPCU and provide information related to
  1258. * the received BA or ACK frame
  1259. */
  1260. SHOW_DEFINED(WIFITX_FES_STATUS_ACK_OR_BA_E);
  1261. break;
  1262. }
  1263. case WIFITX_FES_STATUS_1K_BA_E:
  1264. {
  1265. /* user tlv */
  1266. /*
  1267. * TLV generated by RXPCU and providing information related
  1268. * to the received BA frame in case of 512/1024 bitmaps
  1269. */
  1270. SHOW_DEFINED(WIFITX_FES_STATUS_1K_BA_E);
  1271. break;
  1272. }
  1273. case WIFIRECEIVED_RESPONSE_USER_7_0_E:
  1274. {
  1275. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_7_0_E);
  1276. break;
  1277. }
  1278. case WIFIRECEIVED_RESPONSE_USER_15_8_E:
  1279. {
  1280. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_15_8_E);
  1281. break;
  1282. }
  1283. case WIFIRECEIVED_RESPONSE_USER_23_16_E:
  1284. {
  1285. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_23_16_E);
  1286. break;
  1287. }
  1288. case WIFIRECEIVED_RESPONSE_USER_31_24_E:
  1289. {
  1290. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_31_24_E);
  1291. break;
  1292. }
  1293. case WIFIRECEIVED_RESPONSE_USER_36_32_E:
  1294. {
  1295. /*
  1296. * RXPCU generates this TLV when it receives a response frame
  1297. * that TXPCU pre-announced it was waiting for and in
  1298. * RXPCU_SETUP TLV, TLV generated before the
  1299. * RECEIVED_RESPONSE_INFO TLV.
  1300. *
  1301. * received info user fields are there which is not needed
  1302. * for TX monitor
  1303. */
  1304. SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_36_32_E);
  1305. break;
  1306. }
  1307. case WIFITXPCU_BUFFER_STATUS_E:
  1308. {
  1309. SHOW_DEFINED(WIFITXPCU_BUFFER_STATUS_E);
  1310. break;
  1311. }
  1312. case WIFITXPCU_USER_BUFFER_STATUS_E:
  1313. {
  1314. /*
  1315. * WIFITXPCU_USER_BUFFER_STATUS_E - user tlv
  1316. * for TX monitor we aren't interested in this tlv
  1317. */
  1318. SHOW_DEFINED(WIFITXPCU_USER_BUFFER_STATUS_E);
  1319. break;
  1320. }
  1321. case WIFITXDMA_STOP_REQUEST_E:
  1322. {
  1323. /*
  1324. * no tlv content
  1325. *
  1326. * TLV is destined to TXDMA and informs TXDMA to stop
  1327. * pushing data into the transmit path.
  1328. */
  1329. SHOW_DEFINED(WIFITXDMA_STOP_REQUEST_E);
  1330. break;
  1331. }
  1332. case WIFITX_CBF_INFO_E:
  1333. {
  1334. /*
  1335. * After NDPA + NDP is received, RXPCU sends the TX_CBF_INFO to
  1336. * TXPCU to respond the CBF frame
  1337. *
  1338. * compressed beamforming pkt doesn't has mac header
  1339. * Tx monitor not interested in this pkt.
  1340. */
  1341. SHOW_DEFINED(WIFITX_CBF_INFO_E);
  1342. break;
  1343. }
  1344. case WIFITX_MPDU_COUNT_TRANSFER_END_E:
  1345. {
  1346. /*
  1347. * no tlv content
  1348. *
  1349. * TLV indicates that TXPCU has finished generating the
  1350. * TQM_UPDATE_TX_MPDU_COUNT TLV for all users
  1351. */
  1352. SHOW_DEFINED(WIFITX_MPDU_COUNT_TRANSFER_END_E);
  1353. break;
  1354. }
  1355. case WIFIPDG_RESPONSE_E:
  1356. {
  1357. /*
  1358. * most of the feilds are already covered in
  1359. * other TLV
  1360. * This is generated by TX_PCU to PDG to calculate
  1361. * all the PHY header info.
  1362. *
  1363. * some useful fields like min transmit power,
  1364. * rate used for transmitting packet is present.
  1365. */
  1366. SHOW_DEFINED(WIFIPDG_RESPONSE_E);
  1367. break;
  1368. }
  1369. case WIFIPDG_TRIG_RESPONSE_E:
  1370. {
  1371. /* no tlv content */
  1372. SHOW_DEFINED(WIFIPDG_TRIG_RESPONSE_E);
  1373. break;
  1374. }
  1375. case WIFIRECEIVED_TRIGGER_INFO_E:
  1376. {
  1377. /*
  1378. * TLV generated by RXPCU to inform the scheduler that
  1379. * a trigger frame has been received
  1380. */
  1381. SHOW_DEFINED(WIFIRECEIVED_TRIGGER_INFO_E);
  1382. break;
  1383. }
  1384. case WIFIOFDMA_TRIGGER_DETAILS_E:
  1385. {
  1386. SHOW_DEFINED(WIFIOFDMA_TRIGGER_DETAILS_E);
  1387. break;
  1388. }
  1389. case WIFIRX_FRAME_BITMAP_ACK_E:
  1390. {
  1391. /* user tlv */
  1392. status = HAL_MON_RX_FRAME_BITMAP_ACK;
  1393. SHOW_DEFINED(WIFIRX_FRAME_BITMAP_ACK_E);
  1394. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1395. TXMON_STATUS_INFO(tx_status_info, no_bitmap_avail) =
  1396. HAL_TX_DESC_GET_64(tx_tlv,
  1397. RX_FRAME_BITMAP_ACK,
  1398. NO_BITMAP_AVAILABLE);
  1399. TXMON_STATUS_INFO(tx_status_info, explicit_ack) =
  1400. HAL_TX_DESC_GET_64(tx_tlv,
  1401. RX_FRAME_BITMAP_ACK,
  1402. EXPLICIT_ACK);
  1403. /*
  1404. * get mac address, since address is received frame
  1405. * change the order and store it
  1406. */
  1407. *(uint32_t *)&tx_status_info->addr2[0] =
  1408. HAL_TX_DESC_GET_64(tx_tlv,
  1409. RX_FRAME_BITMAP_ACK,
  1410. ADDR1_31_0);
  1411. *(uint32_t *)&tx_status_info->addr2[4] =
  1412. HAL_TX_DESC_GET_64(tx_tlv,
  1413. RX_FRAME_BITMAP_ACK,
  1414. ADDR1_47_32);
  1415. *(uint32_t *)&tx_status_info->addr1[0] =
  1416. HAL_TX_DESC_GET_64(tx_tlv,
  1417. RX_FRAME_BITMAP_ACK,
  1418. ADDR2_15_0);
  1419. *(uint32_t *)&tx_status_info->addr1[2] =
  1420. HAL_TX_DESC_GET_64(tx_tlv,
  1421. RX_FRAME_BITMAP_ACK,
  1422. ADDR2_47_16);
  1423. TXMON_STATUS_INFO(tx_status_info, explicit_ack_type) =
  1424. HAL_TX_DESC_GET_64(tx_tlv, RX_FRAME_BITMAP_ACK,
  1425. EXPLICT_ACK_TYPE);
  1426. TXMON_HAL_USER(ppdu_info, user_id, tid) =
  1427. HAL_TX_DESC_GET_64(tx_tlv,
  1428. RX_FRAME_BITMAP_ACK,
  1429. BA_TID);
  1430. TXMON_HAL_USER(ppdu_info, user_id, aid) =
  1431. HAL_TX_DESC_GET_64(tx_tlv,
  1432. RX_FRAME_BITMAP_ACK,
  1433. STA_FULL_AID);
  1434. TXMON_HAL_USER(ppdu_info, user_id, start_seq) =
  1435. HAL_TX_DESC_GET_64(tx_tlv,
  1436. RX_FRAME_BITMAP_ACK,
  1437. BA_TS_SEQ);
  1438. TXMON_HAL_USER(ppdu_info, user_id, ba_control) =
  1439. HAL_TX_DESC_GET_64(tx_tlv,
  1440. RX_FRAME_BITMAP_ACK,
  1441. BA_TS_CTRL);
  1442. TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap_sz) =
  1443. HAL_TX_DESC_GET_64(tx_tlv,
  1444. RX_FRAME_BITMAP_ACK,
  1445. BA_BITMAP_SIZE);
  1446. /* ba bitmap */
  1447. qdf_mem_copy(TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap),
  1448. &HAL_SET_FLD_OFFSET_64(tx_tlv,
  1449. RX_FRAME_BITMAP_ACK,
  1450. BA_TS_BITMAP_31_0, 0), 32);
  1451. break;
  1452. }
  1453. case WIFIRX_FRAME_1K_BITMAP_ACK_E:
  1454. {
  1455. /* user tlv */
  1456. status = HAL_MON_RX_FRAME_BITMAP_BLOCK_ACK_1K;
  1457. SHOW_DEFINED(WIFIRX_FRAME_1K_BITMAP_ACK_E);
  1458. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1459. TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap_sz) =
  1460. (4 + HAL_TX_DESC_GET_64(tx_tlv, RX_FRAME_1K_BITMAP_ACK,
  1461. BA_BITMAP_SIZE));
  1462. TXMON_HAL_USER(ppdu_info, user_id, tid) =
  1463. HAL_TX_DESC_GET_64(tx_tlv,
  1464. RX_FRAME_1K_BITMAP_ACK,
  1465. BA_TID);
  1466. TXMON_HAL_USER(ppdu_info, user_id, aid) =
  1467. HAL_TX_DESC_GET_64(tx_tlv,
  1468. RX_FRAME_1K_BITMAP_ACK,
  1469. STA_FULL_AID);
  1470. /* get mac address */
  1471. *(uint32_t *)&tx_status_info->addr1[0] =
  1472. HAL_TX_DESC_GET_64(tx_tlv,
  1473. RX_FRAME_1K_BITMAP_ACK,
  1474. ADDR1_31_0);
  1475. *(uint32_t *)&tx_status_info->addr1[4] =
  1476. HAL_TX_DESC_GET_64(tx_tlv,
  1477. RX_FRAME_1K_BITMAP_ACK,
  1478. ADDR1_47_32);
  1479. *(uint32_t *)&tx_status_info->addr2[0] =
  1480. HAL_TX_DESC_GET_64(tx_tlv,
  1481. RX_FRAME_1K_BITMAP_ACK,
  1482. ADDR2_15_0);
  1483. *(uint32_t *)&tx_status_info->addr2[2] =
  1484. HAL_TX_DESC_GET_64(tx_tlv,
  1485. RX_FRAME_1K_BITMAP_ACK,
  1486. ADDR2_47_16);
  1487. TXMON_HAL_USER(ppdu_info, user_id, start_seq) =
  1488. HAL_TX_DESC_GET_64(tx_tlv,
  1489. RX_FRAME_1K_BITMAP_ACK,
  1490. BA_TS_SEQ);
  1491. TXMON_HAL_USER(ppdu_info, user_id, ba_control) =
  1492. HAL_TX_DESC_GET_64(tx_tlv,
  1493. RX_FRAME_1K_BITMAP_ACK,
  1494. BA_TS_CTRL);
  1495. /* memcpy ba bitmap */
  1496. qdf_mem_copy(TXMON_HAL_USER(ppdu_info, user_id, ba_bitmap),
  1497. &HAL_SET_FLD_OFFSET_64(tx_tlv,
  1498. RX_FRAME_1K_BITMAP_ACK,
  1499. BA_TS_BITMAP_31_0, 0),
  1500. 4 << TXMON_HAL_USER(ppdu_info,
  1501. user_id, ba_bitmap_sz));
  1502. break;
  1503. }
  1504. case WIFIRESPONSE_START_STATUS_E:
  1505. {
  1506. /*
  1507. * TLV indicates which HW response the TXPCU
  1508. * started generating
  1509. *
  1510. * HW generated frames like
  1511. * ACK frame - handled
  1512. * CTS frame - handled
  1513. * BA frame - handled
  1514. * MBA frame - handled
  1515. * CBF frame - no frame header
  1516. * Trigger response - TODO
  1517. * NDP LMR - no frame header
  1518. */
  1519. SHOW_DEFINED(WIFIRESPONSE_START_STATUS_E);
  1520. break;
  1521. }
  1522. case WIFIRX_START_PARAM_E:
  1523. {
  1524. /*
  1525. * RXPCU send this TLV after PHY RX detected a frame
  1526. * in the medium
  1527. *
  1528. * TX monitor not interested in this TLV
  1529. */
  1530. SHOW_DEFINED(WIFIRX_START_PARAM_E);
  1531. break;
  1532. }
  1533. case WIFIRXPCU_EARLY_RX_INDICATION_E:
  1534. {
  1535. /*
  1536. * early indication of pkt type and mcs rate
  1537. * already captured in other tlv
  1538. */
  1539. SHOW_DEFINED(WIFIRXPCU_EARLY_RX_INDICATION_E);
  1540. break;
  1541. }
  1542. case WIFIRX_PM_INFO_E:
  1543. {
  1544. SHOW_DEFINED(WIFIRX_PM_INFO_E);
  1545. break;
  1546. }
  1547. /* Active window */
  1548. case WIFITX_FLUSH_REQ_E:
  1549. {
  1550. SHOW_DEFINED(WIFITX_FLUSH_REQ_E);
  1551. break;
  1552. }
  1553. case WIFICOEX_TX_STATUS_E:
  1554. {
  1555. /* duration are retrieved from coex tx status */
  1556. uint16_t duration;
  1557. uint8_t status_reason;
  1558. status = HAL_MON_COEX_TX_STATUS;
  1559. duration = HAL_TX_DESC_GET_64(tx_tlv,
  1560. COEX_TX_STATUS,
  1561. CURRENT_TX_DURATION);
  1562. status_reason = HAL_TX_DESC_GET_64(tx_tlv,
  1563. COEX_TX_STATUS,
  1564. TX_STATUS_REASON);
  1565. /* update duration */
  1566. if (status_reason == COEX_FES_TX_START ||
  1567. status_reason == COEX_RESPONSE_TX_START)
  1568. TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
  1569. SHOW_DEFINED(WIFICOEX_TX_STATUS_E);
  1570. break;
  1571. }
  1572. case WIFIR2R_STATUS_END_E:
  1573. {
  1574. SHOW_DEFINED(WIFIR2R_STATUS_END_E);
  1575. break;
  1576. }
  1577. case WIFIRX_PREAMBLE_E:
  1578. {
  1579. SHOW_DEFINED(WIFIRX_PREAMBLE_E);
  1580. break;
  1581. }
  1582. case WIFIMACTX_SERVICE_E:
  1583. {
  1584. SHOW_DEFINED(WIFIMACTX_SERVICE_E);
  1585. break;
  1586. }
  1587. case WIFIMACTX_U_SIG_EHT_SU_MU_E:
  1588. {
  1589. SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_SU_MU_E);
  1590. break;
  1591. }
  1592. case WIFIMACTX_U_SIG_EHT_TB_E:
  1593. {
  1594. /* TODO: no radiotap info available */
  1595. SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_TB_E);
  1596. break;
  1597. }
  1598. case WIFIMACTX_EHT_SIG_USR_OFDMA_E:
  1599. {
  1600. SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_OFDMA_E);
  1601. break;
  1602. }
  1603. case WIFIMACTX_EHT_SIG_USR_MU_MIMO_E:
  1604. {
  1605. SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_MU_MIMO_E);
  1606. break;
  1607. }
  1608. case WIFIMACTX_EHT_SIG_USR_SU_E:
  1609. {
  1610. SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_SU_E);
  1611. /* TODO: no radiotap info available */
  1612. break;
  1613. }
  1614. case WIFIMACTX_HE_SIG_A_SU_E:
  1615. {
  1616. uint16_t he_mu_flag_1 = 0;
  1617. uint16_t he_mu_flag_2 = 0;
  1618. uint16_t num_users = 0;
  1619. uint8_t mcs_of_sig_b = 0;
  1620. uint8_t dcm_of_sig_b = 0;
  1621. uint8_t sig_a_bw = 0;
  1622. uint8_t i = 0;
  1623. uint8_t bss_color_id;
  1624. uint8_t coding;
  1625. uint8_t stbc;
  1626. uint8_t a_factor;
  1627. uint8_t pe_disambiguity;
  1628. uint8_t txbf;
  1629. uint8_t txbw;
  1630. uint8_t txop;
  1631. status = HAL_MON_MACTX_HE_SIG_A_SU;
  1632. num_users = TXMON_HAL(ppdu_info, num_users);
  1633. mcs_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1634. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1635. TRANSMIT_MCS);
  1636. dcm_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1637. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1638. DCM);
  1639. sig_a_bw = HAL_TX_DESC_GET_64(tx_tlv,
  1640. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1641. TRANSMIT_BW);
  1642. bss_color_id = HAL_TX_DESC_GET_64(tx_tlv,
  1643. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1644. BSS_COLOR_ID);
  1645. coding = HAL_TX_DESC_GET_64(tx_tlv,
  1646. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1647. CODING);
  1648. stbc = HAL_TX_DESC_GET_64(tx_tlv,
  1649. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1650. STBC);
  1651. a_factor = HAL_TX_DESC_GET_64(tx_tlv,
  1652. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1653. PACKET_EXTENSION_A_FACTOR);
  1654. pe_disambiguity = HAL_TX_DESC_GET_64(tx_tlv,
  1655. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1656. PACKET_EXTENSION_PE_DISAMBIGUITY);
  1657. txbf = HAL_TX_DESC_GET_64(tx_tlv,
  1658. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1659. TXBF);
  1660. txbw = HAL_TX_DESC_GET_64(tx_tlv,
  1661. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1662. TRANSMIT_BW);
  1663. txop = HAL_TX_DESC_GET_64(tx_tlv,
  1664. MACTX_HE_SIG_A_SU_MACTX_HE_SIG_A_SU_INFO_DETAILS,
  1665. TXOP_DURATION);
  1666. he_mu_flag_1 |= QDF_MON_STATUS_SIG_B_MCS_KNOWN |
  1667. QDF_MON_STATUS_SIG_B_DCM_KNOWN |
  1668. QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN |
  1669. QDF_MON_STATUS_CHANNEL_1_RU_KNOWN |
  1670. QDF_MON_STATUS_CHANNEL_2_RU_KNOWN |
  1671. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN;
  1672. /* MCS */
  1673. he_mu_flag_1 |= mcs_of_sig_b <<
  1674. QDF_MON_STATUS_SIG_B_MCS_SHIFT;
  1675. /* DCM */
  1676. he_mu_flag_1 |= dcm_of_sig_b <<
  1677. QDF_MON_STATUS_SIG_B_DCM_SHIFT;
  1678. /* bandwidth */
  1679. he_mu_flag_2 |= QDF_MON_STATUS_SIG_A_BANDWIDTH_KNOWN;
  1680. he_mu_flag_2 |= sig_a_bw <<
  1681. QDF_MON_STATUS_SIG_A_BANDWIDTH_SHIFT;
  1682. TXMON_HAL_STATUS(ppdu_info,
  1683. he_mu_flags) = IS_MULTI_USERS(num_users);
  1684. for (i = 0; i < num_users; i++) {
  1685. TXMON_HAL_USER(ppdu_info, i, he_flags1) |= he_mu_flag_1;
  1686. TXMON_HAL_USER(ppdu_info, i, he_flags2) |= he_mu_flag_2;
  1687. }
  1688. /* HE data 1 */
  1689. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  1690. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN |
  1691. QDF_MON_STATUS_HE_CODING_KNOWN;
  1692. /* HE data 2 */
  1693. TXMON_HAL_USER(ppdu_info, user_id, he_data2) |=
  1694. QDF_MON_STATUS_TXBF_KNOWN |
  1695. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  1696. QDF_MON_STATUS_TXOP_KNOWN |
  1697. QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN |
  1698. QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN;
  1699. /* HE data 3 */
  1700. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1701. bss_color_id |
  1702. (!!txbf << QDF_MON_STATUS_BEAM_CHANGE_SHIFT) |
  1703. (coding << QDF_MON_STATUS_CODING_SHIFT) |
  1704. (stbc << QDF_MON_STATUS_STBC_SHIFT);
  1705. /* HE data 6 */
  1706. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |=
  1707. (txop << QDF_MON_STATUS_TXOP_SHIFT);
  1708. SHOW_DEFINED(WIFIMACTX_HE_SIG_A_SU_E);
  1709. break;
  1710. }
  1711. case WIFIMACTX_HE_SIG_A_MU_DL_E:
  1712. {
  1713. uint16_t he_mu_flag_1 = 0;
  1714. uint16_t he_mu_flag_2 = 0;
  1715. uint16_t num_users = 0;
  1716. uint8_t bss_color_id;
  1717. uint8_t txop;
  1718. uint8_t mcs_of_sig_b = 0;
  1719. uint8_t dcm_of_sig_b = 0;
  1720. uint8_t sig_a_bw = 0;
  1721. uint8_t num_sig_b_symb = 0;
  1722. uint8_t comp_mode_sig_b = 0;
  1723. uint8_t punc_bw = 0;
  1724. uint8_t i = 0;
  1725. status = HAL_MON_MACTX_HE_SIG_A_MU_DL;
  1726. num_users = TXMON_HAL(ppdu_info, num_users);
  1727. mcs_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1728. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1729. MCS_OF_SIG_B);
  1730. dcm_of_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1731. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1732. DCM_OF_SIG_B);
  1733. sig_a_bw = HAL_TX_DESC_GET_64(tx_tlv,
  1734. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1735. TRANSMIT_BW);
  1736. num_sig_b_symb = HAL_TX_DESC_GET_64(tx_tlv,
  1737. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1738. NUM_SIG_B_SYMBOLS);
  1739. comp_mode_sig_b = HAL_TX_DESC_GET_64(tx_tlv,
  1740. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1741. COMP_MODE_SIG_B);
  1742. bss_color_id = HAL_TX_DESC_GET_64(tx_tlv,
  1743. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1744. BSS_COLOR_ID);
  1745. txop = HAL_TX_DESC_GET_64(tx_tlv,
  1746. MACTX_HE_SIG_A_MU_DL_MACTX_HE_SIG_A_MU_DL_INFO_DETAILS,
  1747. TXOP_DURATION);
  1748. he_mu_flag_1 |= QDF_MON_STATUS_SIG_B_MCS_KNOWN |
  1749. QDF_MON_STATUS_SIG_B_DCM_KNOWN |
  1750. QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN |
  1751. QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN |
  1752. QDF_MON_STATUS_CHANNEL_1_RU_KNOWN |
  1753. QDF_MON_STATUS_CHANNEL_2_RU_KNOWN |
  1754. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN |
  1755. QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN |
  1756. QDF_MON_STATUS_SIG_B_SYMBOL_USER_KNOWN;
  1757. /* MCS */
  1758. he_mu_flag_1 |= mcs_of_sig_b <<
  1759. QDF_MON_STATUS_SIG_B_MCS_SHIFT;
  1760. /* DCM */
  1761. he_mu_flag_1 |= dcm_of_sig_b <<
  1762. QDF_MON_STATUS_SIG_B_DCM_SHIFT;
  1763. /* Compression */
  1764. he_mu_flag_2 |= comp_mode_sig_b <<
  1765. QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT;
  1766. /* bandwidth */
  1767. he_mu_flag_2 |= QDF_MON_STATUS_SIG_A_BANDWIDTH_KNOWN;
  1768. he_mu_flag_2 |= sig_a_bw <<
  1769. QDF_MON_STATUS_SIG_A_BANDWIDTH_SHIFT;
  1770. he_mu_flag_2 |= comp_mode_sig_b <<
  1771. QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT;
  1772. /* number of symbol */
  1773. he_mu_flag_2 |= num_sig_b_symb <<
  1774. QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT;
  1775. /* puncture bw */
  1776. he_mu_flag_2 |= QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_KNOWN;
  1777. punc_bw = sig_a_bw;
  1778. he_mu_flag_2 |=
  1779. punc_bw << QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_SHIFT;
  1780. /* copy per user info to all user */
  1781. TXMON_HAL_STATUS(ppdu_info,
  1782. he_mu_flags) = IS_MULTI_USERS(num_users);
  1783. for (i = 0; i < num_users; i++) {
  1784. TXMON_HAL_USER(ppdu_info, i, he_flags1) |= he_mu_flag_1;
  1785. TXMON_HAL_USER(ppdu_info, i, he_flags2) |= he_mu_flag_2;
  1786. }
  1787. /* HE data 1 */
  1788. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  1789. QDF_MON_STATUS_HE_BSS_COLOR_KNOWN;
  1790. /* HE data 2 */
  1791. TXMON_HAL_USER(ppdu_info, user_id, he_data2) |=
  1792. QDF_MON_STATUS_TXOP_KNOWN;
  1793. /* HE data 3 */
  1794. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |= bss_color_id;
  1795. /* HE data 6 */
  1796. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |=
  1797. (txop << QDF_MON_STATUS_TXOP_SHIFT);
  1798. SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_DL_E);
  1799. break;
  1800. }
  1801. case WIFIMACTX_HE_SIG_A_MU_UL_E:
  1802. {
  1803. SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_UL_E);
  1804. break;
  1805. }
  1806. case WIFIMACTX_HE_SIG_B1_MU_E:
  1807. {
  1808. status = HAL_MON_MACTX_HE_SIG_B1_MU;
  1809. SHOW_DEFINED(WIFIMACTX_HE_SIG_B1_MU_E);
  1810. break;
  1811. }
  1812. case WIFIMACTX_HE_SIG_B2_MU_E:
  1813. {
  1814. /* user tlv */
  1815. uint16_t sta_id = 0;
  1816. uint16_t sta_spatial_config = 0;
  1817. uint8_t sta_mcs = 0;
  1818. uint8_t coding = 0;
  1819. uint8_t nss = 0;
  1820. uint8_t user_order = 0;
  1821. status = HAL_MON_MACTX_HE_SIG_B2_MU;
  1822. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1823. sta_id = HAL_TX_DESC_GET_64(tx_tlv,
  1824. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1825. STA_ID);
  1826. sta_spatial_config = HAL_TX_DESC_GET_64(tx_tlv,
  1827. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1828. STA_SPATIAL_CONFIG);
  1829. sta_mcs = HAL_TX_DESC_GET_64(tx_tlv,
  1830. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1831. STA_MCS);
  1832. coding = HAL_TX_DESC_GET_64(tx_tlv,
  1833. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1834. STA_CODING);
  1835. nss = HAL_TX_DESC_GET_64(tx_tlv,
  1836. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1837. NSTS) + 1;
  1838. user_order = HAL_TX_DESC_GET_64(tx_tlv,
  1839. MACTX_HE_SIG_B2_MU_MACTX_HE_SIG_B2_MU_INFO_DETAILS,
  1840. USER_ORDER);
  1841. /* HE data 1 */
  1842. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  1843. QDF_MON_STATUS_HE_MCS_KNOWN |
  1844. QDF_MON_STATUS_HE_CODING_KNOWN;
  1845. /* HE data 2 */
  1846. /* HE data 3 */
  1847. TXMON_HAL_USER(ppdu_info, user_id, mcs) = sta_mcs;
  1848. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1849. sta_mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  1850. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1851. coding << QDF_MON_STATUS_CODING_SHIFT;
  1852. /* HE data 4 */
  1853. TXMON_HAL_USER(ppdu_info, user_id, he_data4) |=
  1854. sta_id << QDF_MON_STATUS_STA_ID_SHIFT;
  1855. /* HE data 5 */
  1856. /* HE data 6 */
  1857. TXMON_HAL_USER(ppdu_info, user_id, nss) = nss;
  1858. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |= nss;
  1859. SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_MU_E);
  1860. break;
  1861. }
  1862. case WIFIMACTX_HE_SIG_B2_OFDMA_E:
  1863. {
  1864. /* user tlv */
  1865. uint8_t *he_sig_b2_ofdma_info = NULL;
  1866. uint16_t sta_id = 0;
  1867. uint8_t nss = 0;
  1868. uint8_t txbf = 0;
  1869. uint8_t sta_mcs = 0;
  1870. uint8_t sta_dcm = 0;
  1871. uint8_t coding = 0;
  1872. uint8_t user_order = 0;
  1873. status = HAL_MON_MACTX_HE_SIG_B2_OFDMA;
  1874. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  1875. he_sig_b2_ofdma_info = (uint8_t *)tx_tlv +
  1876. HAL_OFFSET(MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1877. STA_ID);
  1878. sta_id = HAL_TX_DESC_GET_64(tx_tlv,
  1879. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1880. STA_ID);
  1881. nss = HAL_TX_DESC_GET_64(tx_tlv,
  1882. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1883. NSTS);
  1884. txbf = HAL_TX_DESC_GET_64(tx_tlv,
  1885. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1886. TXBF);
  1887. sta_mcs = HAL_TX_DESC_GET_64(tx_tlv,
  1888. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1889. STA_MCS);
  1890. sta_dcm = HAL_TX_DESC_GET_64(tx_tlv,
  1891. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1892. STA_DCM);
  1893. coding = HAL_TX_DESC_GET_64(tx_tlv,
  1894. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1895. STA_CODING);
  1896. user_order = HAL_TX_DESC_GET_64(tx_tlv,
  1897. MACTX_HE_SIG_B2_OFDMA_MACTX_HE_SIG_B2_OFDMA_INFO_DETAILS,
  1898. USER_ORDER);
  1899. /* HE data 1 */
  1900. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  1901. QDF_MON_STATUS_HE_MCS_KNOWN |
  1902. QDF_MON_STATUS_HE_CODING_KNOWN |
  1903. QDF_MON_STATUS_HE_DCM_KNOWN;
  1904. /* HE data 2 */
  1905. TXMON_HAL_USER(ppdu_info, user_id, he_data2) |=
  1906. QDF_MON_STATUS_TXBF_KNOWN;
  1907. /* HE data 3 */
  1908. TXMON_HAL_USER(ppdu_info, user_id, mcs) = sta_mcs;
  1909. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1910. sta_mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT;
  1911. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1912. sta_dcm << QDF_MON_STATUS_DCM_SHIFT;
  1913. TXMON_HAL_USER(ppdu_info, user_id, he_data3) |=
  1914. coding << QDF_MON_STATUS_CODING_SHIFT;
  1915. /* HE data 4 */
  1916. TXMON_HAL_USER(ppdu_info, user_id, he_data4) |=
  1917. sta_id << QDF_MON_STATUS_STA_ID_SHIFT;
  1918. /* HE data 5 */
  1919. TXMON_HAL_USER(ppdu_info, user_id, he_data5) |=
  1920. txbf << QDF_MON_STATUS_TXBF_SHIFT;
  1921. /* HE data 6 */
  1922. TXMON_HAL_USER(ppdu_info, user_id, nss) = nss;
  1923. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |= nss;
  1924. SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_OFDMA_E);
  1925. break;
  1926. }
  1927. case WIFIMACTX_L_SIG_A_E:
  1928. {
  1929. uint8_t *l_sig_a_info = NULL;
  1930. uint8_t rate = 0;
  1931. status = HAL_MON_MACTX_L_SIG_A;
  1932. l_sig_a_info = (uint8_t *)tx_tlv +
  1933. HAL_OFFSET(MACTX_L_SIG_A_MACTX_L_SIG_A_INFO_DETAILS,
  1934. RATE);
  1935. rate = HAL_TX_DESC_GET_64(tx_tlv,
  1936. MACTX_L_SIG_A_MACTX_L_SIG_A_INFO_DETAILS,
  1937. RATE);
  1938. switch (rate) {
  1939. case 8:
  1940. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_0MCS;
  1941. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS0;
  1942. break;
  1943. case 9:
  1944. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_1MCS;
  1945. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS1;
  1946. break;
  1947. case 10:
  1948. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_2MCS;
  1949. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS2;
  1950. break;
  1951. case 11:
  1952. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_3MCS;
  1953. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS3;
  1954. break;
  1955. case 12:
  1956. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_4MCS;
  1957. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS4;
  1958. break;
  1959. case 13:
  1960. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_5MCS;
  1961. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS5;
  1962. break;
  1963. case 14:
  1964. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_6MCS;
  1965. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS6;
  1966. break;
  1967. case 15:
  1968. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11A_RATE_7MCS;
  1969. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS7;
  1970. break;
  1971. default:
  1972. break;
  1973. }
  1974. TXMON_HAL_STATUS(ppdu_info, ofdm_flag) = 1;
  1975. TXMON_HAL_STATUS(ppdu_info, reception_type) = HAL_RX_TYPE_SU;
  1976. TXMON_HAL_STATUS(ppdu_info, l_sig_a_info) = *l_sig_a_info;
  1977. SHOW_DEFINED(WIFIMACTX_L_SIG_A_E);
  1978. break;
  1979. }
  1980. case WIFIMACTX_L_SIG_B_E:
  1981. {
  1982. uint8_t *l_sig_b_info = NULL;
  1983. uint8_t rate = 0;
  1984. status = HAL_MON_MACTX_L_SIG_B;
  1985. l_sig_b_info = (uint8_t *)tx_tlv +
  1986. HAL_OFFSET(MACTX_L_SIG_B_MACTX_L_SIG_B_INFO_DETAILS,
  1987. RATE);
  1988. rate = HAL_TX_DESC_GET_64(tx_tlv,
  1989. MACTX_L_SIG_B_MACTX_L_SIG_B_INFO_DETAILS,
  1990. RATE);
  1991. switch (rate) {
  1992. case 1:
  1993. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_3MCS;
  1994. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS3;
  1995. break;
  1996. case 2:
  1997. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_2MCS;
  1998. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS2;
  1999. break;
  2000. case 3:
  2001. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_1MCS;
  2002. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS1;
  2003. break;
  2004. case 4:
  2005. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_0MCS;
  2006. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS0;
  2007. break;
  2008. case 5:
  2009. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_6MCS;
  2010. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS6;
  2011. break;
  2012. case 6:
  2013. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_5MCS;
  2014. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS5;
  2015. break;
  2016. case 7:
  2017. TXMON_HAL_STATUS(ppdu_info, rate) = HAL_11B_RATE_4MCS;
  2018. TXMON_HAL_STATUS(ppdu_info, mcs) = HAL_LEGACY_MCS4;
  2019. break;
  2020. default:
  2021. break;
  2022. }
  2023. TXMON_HAL_STATUS(ppdu_info, cck_flag) = 1;
  2024. TXMON_HAL_STATUS(ppdu_info, reception_type) = HAL_RX_TYPE_SU;
  2025. TXMON_HAL_STATUS(ppdu_info, l_sig_b_info) = *l_sig_b_info;
  2026. SHOW_DEFINED(WIFIMACTX_L_SIG_B_E);
  2027. break;
  2028. }
  2029. case WIFIMACTX_HT_SIG_E:
  2030. {
  2031. uint8_t mcs = 0;
  2032. uint8_t bw = 0;
  2033. uint8_t is_stbc = 0;
  2034. uint8_t coding = 0;
  2035. uint8_t gi = 0;
  2036. status = HAL_MON_MACTX_HT_SIG;
  2037. mcs = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, MCS);
  2038. bw = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, CBW);
  2039. is_stbc = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, STBC);
  2040. coding = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, FEC_CODING);
  2041. gi = HAL_TX_DESC_GET_64(tx_tlv, HT_SIG_INFO, SHORT_GI);
  2042. TXMON_HAL_STATUS(ppdu_info, ldpc) =
  2043. (coding == HAL_SU_MU_CODING_LDPC) ? 1 : 0;
  2044. TXMON_HAL_STATUS(ppdu_info, ht_mcs) = mcs;
  2045. TXMON_HAL_STATUS(ppdu_info, bw) = bw;
  2046. TXMON_HAL_STATUS(ppdu_info, sgi) = gi;
  2047. TXMON_HAL_STATUS(ppdu_info, is_stbc) = is_stbc;
  2048. TXMON_HAL_STATUS(ppdu_info, reception_type) = HAL_RX_TYPE_SU;
  2049. SHOW_DEFINED(WIFIMACTX_HT_SIG_E);
  2050. break;
  2051. }
  2052. case WIFIMACTX_VHT_SIG_A_E:
  2053. {
  2054. uint8_t bandwidth = 0;
  2055. uint8_t is_stbc = 0;
  2056. uint8_t group_id = 0;
  2057. uint32_t nss_comb = 0;
  2058. uint8_t nss_su = 0;
  2059. uint8_t nss_mu[4] = {0};
  2060. uint8_t sgi = 0;
  2061. uint8_t coding = 0;
  2062. uint8_t mcs = 0;
  2063. uint8_t beamformed = 0;
  2064. uint8_t partial_aid = 0;
  2065. status = HAL_MON_MACTX_VHT_SIG_A;
  2066. bandwidth = HAL_TX_DESC_GET_64(tx_tlv,
  2067. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2068. BANDWIDTH);
  2069. is_stbc = HAL_TX_DESC_GET_64(tx_tlv,
  2070. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2071. STBC);
  2072. group_id = HAL_TX_DESC_GET_64(tx_tlv,
  2073. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2074. GROUP_ID);
  2075. /* nss_comb is su nss, MU nss and partial AID */
  2076. nss_comb = HAL_TX_DESC_GET_64(tx_tlv,
  2077. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2078. N_STS);
  2079. /* if it is SU */
  2080. nss_su = (nss_comb & 0x7) + 1;
  2081. /* partial aid - applicable only for SU */
  2082. partial_aid = (nss_comb >> 3) & 0x1F;
  2083. /* if it is MU */
  2084. nss_mu[0] = (nss_comb & 0x7) + 1;
  2085. nss_mu[1] = ((nss_comb >> 3) & 0x7) + 1;
  2086. nss_mu[2] = ((nss_comb >> 6) & 0x7) + 1;
  2087. nss_mu[3] = ((nss_comb >> 9) & 0x7) + 1;
  2088. sgi = HAL_TX_DESC_GET_64(tx_tlv,
  2089. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2090. GI_SETTING);
  2091. coding = HAL_TX_DESC_GET_64(tx_tlv,
  2092. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2093. SU_MU_CODING);
  2094. mcs = HAL_TX_DESC_GET_64(tx_tlv,
  2095. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2096. MCS);
  2097. beamformed = HAL_TX_DESC_GET_64(tx_tlv,
  2098. MACTX_VHT_SIG_A_MACTX_VHT_SIG_A_INFO_DETAILS,
  2099. BEAMFORMED);
  2100. TXMON_HAL_STATUS(ppdu_info, ldpc) =
  2101. (coding == HAL_SU_MU_CODING_LDPC) ? 1 : 0;
  2102. TXMON_STATUS_INFO(tx_status_info, sw_frame_group_id) = group_id;
  2103. TXMON_HAL_STATUS(ppdu_info, sgi) = sgi;
  2104. TXMON_HAL_STATUS(ppdu_info, is_stbc) = is_stbc;
  2105. TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
  2106. TXMON_HAL_STATUS(ppdu_info, beamformed) = beamformed;
  2107. if (group_id == 0 || group_id == 63) {
  2108. TXMON_HAL_STATUS(ppdu_info, reception_type) =
  2109. HAL_RX_TYPE_SU;
  2110. TXMON_HAL_STATUS(ppdu_info, mcs) = mcs;
  2111. TXMON_HAL_STATUS(ppdu_info, nss) =
  2112. nss_su & VHT_SIG_SU_NSS_MASK;
  2113. TXMON_HAL_USER(ppdu_info, user_id,
  2114. vht_flag_values3[0]) = ((mcs << 4) |
  2115. nss_su);
  2116. } else {
  2117. TXMON_HAL_STATUS(ppdu_info, reception_type) =
  2118. HAL_RX_TYPE_MU_MIMO;
  2119. TXMON_HAL_USER(ppdu_info, user_id, mcs) = mcs;
  2120. TXMON_HAL_USER(ppdu_info, user_id, nss) =
  2121. nss_su & VHT_SIG_SU_NSS_MASK;
  2122. TXMON_HAL_USER(ppdu_info, user_id,
  2123. vht_flag_values3[0]) = ((mcs << 4) |
  2124. nss_su);
  2125. TXMON_HAL_USER(ppdu_info, user_id,
  2126. vht_flag_values3[1]) = ((mcs << 4) |
  2127. nss_mu[1]);
  2128. TXMON_HAL_USER(ppdu_info, user_id,
  2129. vht_flag_values3[2]) = ((mcs << 4) |
  2130. nss_mu[2]);
  2131. TXMON_HAL_USER(ppdu_info, user_id,
  2132. vht_flag_values3[3]) = ((mcs << 4) |
  2133. nss_mu[3]);
  2134. }
  2135. /* TODO: loop over multiple user */
  2136. TXMON_HAL_USER(ppdu_info, user_id,
  2137. vht_flag_values2) = bandwidth;
  2138. TXMON_HAL_USER(ppdu_info, user_id,
  2139. vht_flag_values4) = coding;
  2140. TXMON_HAL_USER(ppdu_info, user_id,
  2141. vht_flag_values5) = group_id;
  2142. TXMON_HAL_USER(ppdu_info, user_id,
  2143. vht_flag_values6) = partial_aid;
  2144. SHOW_DEFINED(WIFIMACTX_VHT_SIG_A_E);
  2145. break;
  2146. }
  2147. case WIFIMACTX_VHT_SIG_B_MU160_E:
  2148. {
  2149. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU160_E);
  2150. break;
  2151. }
  2152. case WIFIMACTX_VHT_SIG_B_MU80_E:
  2153. {
  2154. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU80_E);
  2155. break;
  2156. }
  2157. case WIFIMACTX_VHT_SIG_B_MU40_E:
  2158. {
  2159. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU40_E);
  2160. break;
  2161. }
  2162. case WIFIMACTX_VHT_SIG_B_MU20_E:
  2163. {
  2164. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU20_E);
  2165. break;
  2166. }
  2167. case WIFIMACTX_VHT_SIG_B_SU160_E:
  2168. {
  2169. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU160_E);
  2170. break;
  2171. }
  2172. case WIFIMACTX_VHT_SIG_B_SU80_E:
  2173. {
  2174. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU80_E);
  2175. break;
  2176. }
  2177. case WIFIMACTX_VHT_SIG_B_SU40_E:
  2178. {
  2179. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU40_E);
  2180. break;
  2181. }
  2182. case WIFIMACTX_VHT_SIG_B_SU20_E:
  2183. {
  2184. SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU20_E);
  2185. break;
  2186. }
  2187. case WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E:
  2188. {
  2189. SHOW_DEFINED(WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E);
  2190. break;
  2191. }
  2192. case WIFIMACTX_USER_DESC_PER_USER_E:
  2193. {
  2194. /* user tlv */
  2195. uint32_t bf = 0;
  2196. uint32_t psdu_length = 0;
  2197. uint8_t ru_start_index = 0;
  2198. uint8_t ru_size = 0;
  2199. uint8_t nss = 0;
  2200. uint8_t mcs = 0;
  2201. uint8_t dcm = 0;
  2202. uint8_t fec_type = 0;
  2203. uint8_t is_ldpc_extra_symb = 0;
  2204. uint32_t he_data1 = TXMON_HAL_USER(ppdu_info, user_id,
  2205. he_data1);
  2206. uint32_t he_data2 = TXMON_HAL_USER(ppdu_info, user_id,
  2207. he_data2);
  2208. uint32_t he_data3 = TXMON_HAL_USER(ppdu_info, user_id,
  2209. he_data3);
  2210. uint32_t he_data5 = TXMON_HAL_USER(ppdu_info, user_id,
  2211. he_data5);
  2212. uint32_t he_data6 = TXMON_HAL_USER(ppdu_info, user_id,
  2213. he_data6);
  2214. status = HAL_MON_MACTX_USER_DESC_PER_USER;
  2215. TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
  2216. psdu_length = HAL_TX_DESC_GET_64(tx_tlv,
  2217. MACTX_USER_DESC_PER_USER,
  2218. PSDU_LENGTH);
  2219. ru_start_index = HAL_TX_DESC_GET_64(tx_tlv,
  2220. MACTX_USER_DESC_PER_USER,
  2221. RU_START_INDEX);
  2222. ru_size = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
  2223. RU_SIZE);
  2224. bf = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
  2225. USER_BF_TYPE);
  2226. nss = HAL_TX_DESC_GET_64(tx_tlv,
  2227. MACTX_USER_DESC_PER_USER, NSS) + 1;
  2228. mcs = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER, MCS);
  2229. dcm = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER, DCM);
  2230. fec_type = HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
  2231. FEC_TYPE);
  2232. is_ldpc_extra_symb =
  2233. HAL_TX_DESC_GET_64(tx_tlv, MACTX_USER_DESC_PER_USER,
  2234. LDPC_EXTRA_SYMBOL);
  2235. if (!TXMON_HAL_STATUS(ppdu_info, he_flags))
  2236. break;
  2237. /* update */
  2238. /* BEAM CHANGE */
  2239. he_data1 |= QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN;
  2240. he_data1 |= QDF_MON_STATUS_TXBF_KNOWN;
  2241. he_data5 |= (!!bf << QDF_MON_STATUS_TXBF_SHIFT);
  2242. he_data3 |= (!!bf << QDF_MON_STATUS_BEAM_CHANGE_SHIFT);
  2243. /* UL/DL known */
  2244. he_data1 |= QDF_MON_STATUS_HE_DL_UL_KNOWN;
  2245. he_data3 |= (1 << QDF_MON_STATUS_DL_UL_SHIFT);
  2246. /* MCS */
  2247. he_data1 |= QDF_MON_STATUS_HE_MCS_KNOWN;
  2248. he_data3 |= (mcs << QDF_MON_STATUS_TRANSMIT_MCS_SHIFT);
  2249. /* DCM */
  2250. he_data1 |= QDF_MON_STATUS_HE_DCM_KNOWN;
  2251. he_data3 |= (dcm << QDF_MON_STATUS_DCM_SHIFT);
  2252. /* LDPC EXTRA SYMB */
  2253. he_data1 |= QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN;
  2254. he_data3 |= (is_ldpc_extra_symb <<
  2255. QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT);
  2256. /* RU offset and RU */
  2257. he_data2 |= QDF_MON_STATUS_RU_ALLOCATION_OFFSET_KNOWN;
  2258. he_data2 |= (get_ru_offset_from_start_index(ru_size,
  2259. ru_start_index) <<
  2260. QDF_MON_STATUS_RU_ALLOCATION_SHIFT);
  2261. /* Data BW and RU allocation */
  2262. if (ru_size < HAL_MAX_RU_INDEX) {
  2263. /* update bandwidth if it is full bandwidth */
  2264. he_data1 |= QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN;
  2265. he_data5 = (he_data5 & 0xFFF0) | (4 + ru_size);
  2266. }
  2267. he_data6 |= (nss & 0xF);
  2268. TXMON_HAL_USER(ppdu_info, user_id, mcs) = mcs;
  2269. /* update stack variable to ppdu_info */
  2270. TXMON_HAL_USER(ppdu_info, user_id, he_data1) = he_data1;
  2271. TXMON_HAL_USER(ppdu_info, user_id, he_data2) = he_data2;
  2272. TXMON_HAL_USER(ppdu_info, user_id, he_data3) = he_data3;
  2273. TXMON_HAL_USER(ppdu_info, user_id, he_data5) = he_data5;
  2274. TXMON_HAL_USER(ppdu_info, user_id, he_data6) = he_data6;
  2275. SHOW_DEFINED(WIFIMACTX_USER_DESC_PER_USER_E);
  2276. break;
  2277. }
  2278. case WIFIMACTX_USER_DESC_COMMON_E:
  2279. {
  2280. uint16_t he_mu_flag_1 = 0;
  2281. uint16_t he_mu_flag_2 = 0;
  2282. uint16_t ru_channel_1[4] = {0};
  2283. uint16_t ru_channel_2[4] = {0};
  2284. uint16_t num_users = 0;
  2285. uint8_t doppler;
  2286. uint8_t ltf_size;
  2287. uint8_t num_ltf_symbols;
  2288. uint8_t pkt_extn_pe;
  2289. uint8_t a_factor;
  2290. uint8_t center_ru_0;
  2291. uint8_t center_ru_1;
  2292. uint8_t i = 0;
  2293. num_users = TXMON_HAL(ppdu_info, num_users);
  2294. doppler = HAL_TX_DESC_GET_64(tx_tlv,
  2295. MACTX_USER_DESC_COMMON,
  2296. DOPPLER_INDICATION);
  2297. ltf_size = HAL_TX_DESC_GET_64(tx_tlv,
  2298. MACTX_USER_DESC_COMMON,
  2299. LTF_SIZE);
  2300. num_ltf_symbols = HAL_TX_DESC_GET_64(tx_tlv,
  2301. MACTX_USER_DESC_COMMON,
  2302. NUM_DATA_SYMBOLS);
  2303. pkt_extn_pe = HAL_TX_DESC_GET_64(tx_tlv,
  2304. MACTX_USER_DESC_COMMON,
  2305. PACKET_EXTENSION_PE_DISAMBIGUITY);
  2306. a_factor = HAL_TX_DESC_GET_64(tx_tlv,
  2307. MACTX_USER_DESC_COMMON,
  2308. PACKET_EXTENSION_A_FACTOR);
  2309. center_ru_0 = HAL_TX_DESC_GET_64(tx_tlv,
  2310. MACTX_USER_DESC_COMMON,
  2311. CENTER_RU_0);
  2312. center_ru_1 = HAL_TX_DESC_GET_64(tx_tlv,
  2313. MACTX_USER_DESC_COMMON,
  2314. CENTER_RU_1);
  2315. ru_channel_1[0] = HAL_TX_DESC_GET_64(tx_tlv,
  2316. MACTX_USER_DESC_COMMON,
  2317. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND0_0);
  2318. ru_channel_1[1] = HAL_TX_DESC_GET_64(tx_tlv,
  2319. MACTX_USER_DESC_COMMON,
  2320. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND0_1);
  2321. ru_channel_1[2] = HAL_TX_DESC_GET_64(tx_tlv,
  2322. MACTX_USER_DESC_COMMON,
  2323. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND0_2);
  2324. ru_channel_1[3] = HAL_TX_DESC_GET_64(tx_tlv,
  2325. MACTX_USER_DESC_COMMON,
  2326. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND0_3);
  2327. ru_channel_2[0] = HAL_TX_DESC_GET_64(tx_tlv,
  2328. MACTX_USER_DESC_COMMON,
  2329. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND1_0);
  2330. ru_channel_2[1] = HAL_TX_DESC_GET_64(tx_tlv,
  2331. MACTX_USER_DESC_COMMON,
  2332. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND1_1);
  2333. ru_channel_2[2] = HAL_TX_DESC_GET_64(tx_tlv,
  2334. MACTX_USER_DESC_COMMON,
  2335. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND1_2);
  2336. ru_channel_2[3] = HAL_TX_DESC_GET_64(tx_tlv,
  2337. MACTX_USER_DESC_COMMON,
  2338. RU_ALLOCATION_0123_DETAILS_RU_ALLOCATION_BAND1_3);
  2339. /* HE data 1 */
  2340. TXMON_HAL_USER(ppdu_info, user_id, he_data1) |=
  2341. QDF_MON_STATUS_HE_DOPPLER_KNOWN;
  2342. /* HE data 2 */
  2343. TXMON_HAL_USER(ppdu_info, user_id, he_data2) |=
  2344. QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN |
  2345. QDF_MON_STATUS_LTF_SYMBOLS_KNOWN;
  2346. /* HE data 5 */
  2347. TXMON_HAL_USER(ppdu_info, user_id, he_data5) |=
  2348. (pkt_extn_pe <<
  2349. QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT) |
  2350. (a_factor << QDF_MON_STATUS_PRE_FEC_PAD_SHIFT) |
  2351. ((1 + ltf_size) <<
  2352. QDF_MON_STATUS_HE_LTF_SIZE_SHIFT) |
  2353. (num_ltf_symbols <<
  2354. QDF_MON_STATUS_HE_LTF_SYM_SHIFT);
  2355. /* HE data 6 */
  2356. TXMON_HAL_USER(ppdu_info, user_id, he_data6) |=
  2357. (doppler << QDF_MON_STATUS_DOPPLER_SHIFT);
  2358. /* number of symbol */
  2359. he_mu_flag_1 |=
  2360. (QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN |
  2361. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN |
  2362. ((center_ru_0 <<
  2363. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_SHIFT) &
  2364. QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_VALUE));
  2365. he_mu_flag_2 |= ((center_ru_1 <<
  2366. QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_SHIFT) &
  2367. QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_VALUE);
  2368. TXMON_HAL_STATUS(ppdu_info,
  2369. he_mu_flags) = IS_MULTI_USERS(num_users);
  2370. for (i = 0; i < num_users; i++) {
  2371. TXMON_HAL_USER(ppdu_info, i, he_flags1) |= he_mu_flag_1;
  2372. TXMON_HAL_USER(ppdu_info, i, he_flags2) |= he_mu_flag_2;
  2373. /* channel 1 */
  2374. TXMON_HAL_USER(ppdu_info, i,
  2375. he_RU[0]) = ru_channel_1[0];
  2376. TXMON_HAL_USER(ppdu_info, i,
  2377. he_RU[1]) = ru_channel_1[1];
  2378. TXMON_HAL_USER(ppdu_info, i,
  2379. he_RU[2]) = ru_channel_1[2];
  2380. TXMON_HAL_USER(ppdu_info, i,
  2381. he_RU[3]) = ru_channel_1[3];
  2382. /* channel 2 */
  2383. TXMON_HAL_USER(ppdu_info, i,
  2384. he_RU[4]) = ru_channel_2[0];
  2385. TXMON_HAL_USER(ppdu_info, i,
  2386. he_RU[5]) = ru_channel_2[1];
  2387. TXMON_HAL_USER(ppdu_info, i,
  2388. he_RU[6]) = ru_channel_2[2];
  2389. TXMON_HAL_USER(ppdu_info, i,
  2390. he_RU[7]) = ru_channel_2[3];
  2391. }
  2392. /* channel 1 */
  2393. TXMON_HAL_STATUS(ppdu_info, he_RU[0]) = ru_channel_1[0];
  2394. TXMON_HAL_STATUS(ppdu_info, he_RU[1]) = ru_channel_1[1];
  2395. TXMON_HAL_STATUS(ppdu_info, he_RU[2]) = ru_channel_1[2];
  2396. TXMON_HAL_STATUS(ppdu_info, he_RU[3]) = ru_channel_1[3];
  2397. /* channel 2 */
  2398. TXMON_HAL_STATUS(ppdu_info, he_RU[4]) = ru_channel_2[0];
  2399. TXMON_HAL_STATUS(ppdu_info, he_RU[5]) = ru_channel_2[1];
  2400. TXMON_HAL_STATUS(ppdu_info, he_RU[6]) = ru_channel_2[2];
  2401. TXMON_HAL_STATUS(ppdu_info, he_RU[7]) = ru_channel_2[3];
  2402. /* copy per user info to all user */
  2403. SHOW_DEFINED(WIFIMACTX_USER_DESC_COMMON_E);
  2404. break;
  2405. }
  2406. case WIFIMACTX_PHY_DESC_E:
  2407. {
  2408. /* pkt_type - preamble type */
  2409. uint32_t pkt_type = 0;
  2410. uint8_t bandwidth = 0;
  2411. uint8_t is_stbc = 0;
  2412. uint8_t is_triggered = 0;
  2413. uint8_t gi = 0;
  2414. uint8_t he_ppdu_subtype = 0;
  2415. uint32_t ltf_size = 0;
  2416. uint32_t he_data1 = 0;
  2417. uint32_t he_data2 = 0;
  2418. uint32_t he_data3 = 0;
  2419. uint32_t he_data5 = 0;
  2420. uint16_t he_mu_flag_1 = 0;
  2421. uint16_t he_mu_flag_2 = 0;
  2422. uint16_t num_users = 0;
  2423. uint8_t i = 0;
  2424. status = HAL_MON_MACTX_PHY_DESC;
  2425. num_users = TXMON_HAL(ppdu_info, num_users);
  2426. pkt_type = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, PKT_TYPE);
  2427. is_stbc = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, STBC);
  2428. is_triggered = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2429. TRIGGERED);
  2430. if (!is_triggered) {
  2431. bandwidth = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2432. BANDWIDTH);
  2433. } else {
  2434. /*
  2435. * is_triggered, bw is minimum of AP pkt bw
  2436. * or STA bw
  2437. */
  2438. bandwidth = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2439. AP_PKT_BW);
  2440. }
  2441. gi = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2442. CP_SETTING);
  2443. ltf_size = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC, LTF_SIZE);
  2444. he_ppdu_subtype = HAL_TX_DESC_GET_64(tx_tlv, MACTX_PHY_DESC,
  2445. HE_PPDU_SUBTYPE);
  2446. TXMON_HAL_STATUS(ppdu_info, preamble_type) = pkt_type;
  2447. TXMON_HAL_STATUS(ppdu_info, ltf_size) = ltf_size;
  2448. TXMON_HAL_STATUS(ppdu_info, is_stbc) = is_stbc;
  2449. TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
  2450. switch (ppdu_info->rx_status.preamble_type) {
  2451. case TXMON_PKT_TYPE_11N_MM:
  2452. TXMON_HAL_STATUS(ppdu_info, ht_flags) = 1;
  2453. TXMON_HAL_STATUS(ppdu_info,
  2454. rtap_flags) |= HT_SGI_PRESENT;
  2455. break;
  2456. case TXMON_PKT_TYPE_11AC:
  2457. TXMON_HAL_STATUS(ppdu_info, vht_flags) = 1;
  2458. break;
  2459. case TXMON_PKT_TYPE_11AX:
  2460. TXMON_HAL_STATUS(ppdu_info, he_flags) = 1;
  2461. break;
  2462. default:
  2463. break;
  2464. }
  2465. if (!TXMON_HAL_STATUS(ppdu_info, he_flags))
  2466. break;
  2467. /* update he flags */
  2468. /* PPDU FORMAT */
  2469. switch (he_ppdu_subtype) {
  2470. case TXMON_HE_SUBTYPE_SU:
  2471. TXMON_HAL_STATUS(ppdu_info, he_data1) |=
  2472. QDF_MON_STATUS_HE_SU_FORMAT_TYPE;
  2473. break;
  2474. case TXMON_HE_SUBTYPE_TRIG:
  2475. TXMON_HAL_STATUS(ppdu_info, he_data1) |=
  2476. QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE;
  2477. break;
  2478. case TXMON_HE_SUBTYPE_MU:
  2479. TXMON_HAL_STATUS(ppdu_info, he_data1) |=
  2480. QDF_MON_STATUS_HE_MU_FORMAT_TYPE;
  2481. break;
  2482. case TXMON_HE_SUBTYPE_EXT_SU:
  2483. TXMON_HAL_STATUS(ppdu_info, he_data1) |=
  2484. QDF_MON_STATUS_HE_EXT_SU_FORMAT_TYPE;
  2485. break;
  2486. };
  2487. /* STBC */
  2488. he_data1 |= QDF_MON_STATUS_HE_STBC_KNOWN;
  2489. he_data3 |= (is_stbc << QDF_MON_STATUS_STBC_SHIFT);
  2490. /* GI */
  2491. he_data2 |= QDF_MON_STATUS_HE_GI_KNOWN;
  2492. he_data5 |= (gi << QDF_MON_STATUS_GI_SHIFT);
  2493. /* Data BW and RU allocation */
  2494. he_data1 |= QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN;
  2495. he_data5 = (he_data5 & 0xFFF0) | bandwidth;
  2496. he_data2 |= QDF_MON_STATUS_LTF_SYMBOLS_KNOWN;
  2497. he_data5 |= ((1 + ltf_size) <<
  2498. QDF_MON_STATUS_HE_LTF_SIZE_SHIFT);
  2499. TXMON_HAL_STATUS(ppdu_info,
  2500. he_mu_flags) = IS_MULTI_USERS(num_users);
  2501. /* MAC TX PHY DESC is not a user tlv */
  2502. for (i = 0; i < num_users; i++) {
  2503. TXMON_HAL_USER(ppdu_info, i, he_data1) = he_data1;
  2504. TXMON_HAL_USER(ppdu_info, i, he_data2) = he_data2;
  2505. TXMON_HAL_USER(ppdu_info, i, he_data3) = he_data3;
  2506. TXMON_HAL_USER(ppdu_info, i, he_data5) = he_data5;
  2507. /* HE MU flags */
  2508. TXMON_HAL_USER(ppdu_info, i, he_flags1) |= he_mu_flag_1;
  2509. TXMON_HAL_USER(ppdu_info, i, he_flags2) |= he_mu_flag_2;
  2510. }
  2511. SHOW_DEFINED(WIFIMACTX_PHY_DESC_E);
  2512. break;
  2513. }
  2514. case WIFICOEX_RX_STATUS_E:
  2515. {
  2516. SHOW_DEFINED(WIFICOEX_RX_STATUS_E);
  2517. break;
  2518. }
  2519. case WIFIRX_PPDU_ACK_REPORT_E:
  2520. {
  2521. SHOW_DEFINED(WIFIRX_PPDU_ACK_REPORT_E);
  2522. break;
  2523. }
  2524. case WIFIRX_PPDU_NO_ACK_REPORT_E:
  2525. {
  2526. SHOW_DEFINED(WIFIRX_PPDU_NO_ACK_REPORT_E);
  2527. break;
  2528. }
  2529. case WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E:
  2530. {
  2531. SHOW_DEFINED(WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E);
  2532. break;
  2533. }
  2534. case WIFITXPCU_PHYTX_DEBUG32_E:
  2535. {
  2536. SHOW_DEFINED(WIFITXPCU_PHYTX_DEBUG32_E);
  2537. break;
  2538. }
  2539. case WIFITXPCU_PREAMBLE_DONE_E:
  2540. {
  2541. SHOW_DEFINED(WIFITXPCU_PREAMBLE_DONE_E);
  2542. break;
  2543. }
  2544. case WIFIRX_PHY_SLEEP_E:
  2545. {
  2546. SHOW_DEFINED(WIFIRX_PHY_SLEEP_E);
  2547. break;
  2548. }
  2549. case WIFIRX_FRAME_BITMAP_REQ_E:
  2550. {
  2551. SHOW_DEFINED(WIFIRX_FRAME_BITMAP_REQ_E);
  2552. break;
  2553. }
  2554. case WIFIRXPCU_TX_SETUP_CLEAR_E:
  2555. {
  2556. SHOW_DEFINED(WIFIRXPCU_TX_SETUP_CLEAR_E);
  2557. break;
  2558. }
  2559. case WIFIRX_TRIG_INFO_E:
  2560. {
  2561. SHOW_DEFINED(WIFIRX_TRIG_INFO_E);
  2562. break;
  2563. }
  2564. case WIFIEXPECTED_RESPONSE_E:
  2565. {
  2566. SHOW_DEFINED(WIFIEXPECTED_RESPONSE_E);
  2567. break;
  2568. }
  2569. case WIFITRIGGER_RESPONSE_TX_DONE_E:
  2570. {
  2571. SHOW_DEFINED(WIFITRIGGER_RESPONSE_TX_DONE_E);
  2572. break;
  2573. }
  2574. case WIFIFW2SW_MON_E:
  2575. {
  2576. SHOW_DEFINED(WIFIFW2SW_MON_E);
  2577. break;
  2578. }
  2579. }
  2580. return status;
  2581. }
  2582. #endif /* QCA_MONITOR_2_0_SUPPORT */
  2583. #ifdef REO_SHARED_QREF_TABLE_EN
  2584. static void hal_reo_shared_qaddr_cache_clear_be(hal_soc_handle_t hal_soc_hdl)
  2585. {
  2586. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2587. uint32_t reg_val = 0;
  2588. /* Set Qdesc clear bit to erase REO internal storage for Qdesc pointers
  2589. * of 37 peer/tids
  2590. */
  2591. reg_val = HAL_REG_READ(hal, HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE));
  2592. reg_val |= HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1);
  2593. HAL_REG_WRITE(hal,
  2594. HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
  2595. reg_val);
  2596. /* Clear Qdesc clear bit to erase REO internal storage for Qdesc pointers
  2597. * of 37 peer/tids
  2598. */
  2599. reg_val &= ~(HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1));
  2600. HAL_REG_WRITE(hal,
  2601. HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
  2602. reg_val);
  2603. hal_verbose_debug("hal_soc: %pK :Setting CLEAR_DESC_ARRAY field of"
  2604. "WCSS_UMAC_REO_R0_QDESC_ADDR_READ and resetting back"
  2605. "to erase stale entries in reo storage: regval:%x", hal, reg_val);
  2606. }
  2607. /* hal_reo_shared_qaddr_write(): Write REO tid queue addr
  2608. * LUT shared by SW and HW at the index given by peer id
  2609. * and tid.
  2610. *
  2611. * @hal_soc: hal soc pointer
  2612. * @reo_qref_addr: pointer to index pointed to be peer_id
  2613. * and tid
  2614. * @tid: tid queue number
  2615. * @hw_qdesc_paddr: reo queue addr
  2616. */
  2617. static void hal_reo_shared_qaddr_write_be(hal_soc_handle_t hal_soc_hdl,
  2618. uint16_t peer_id,
  2619. int tid,
  2620. qdf_dma_addr_t hw_qdesc_paddr)
  2621. {
  2622. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2623. struct rx_reo_queue_reference *reo_qref;
  2624. uint32_t peer_tid_idx;
  2625. /* Plug hw_desc_addr in Host reo queue reference table */
  2626. if (HAL_PEER_ID_IS_MLO(peer_id)) {
  2627. peer_tid_idx = ((peer_id - HAL_ML_PEER_ID_START) *
  2628. DP_MAX_TIDS) + tid;
  2629. reo_qref = (struct rx_reo_queue_reference *)
  2630. &hal->reo_qref.mlo_reo_qref_table_vaddr[peer_tid_idx];
  2631. } else {
  2632. peer_tid_idx = (peer_id * DP_MAX_TIDS) + tid;
  2633. reo_qref = (struct rx_reo_queue_reference *)
  2634. &hal->reo_qref.non_mlo_reo_qref_table_vaddr[peer_tid_idx];
  2635. }
  2636. reo_qref->rx_reo_queue_desc_addr_31_0 =
  2637. hw_qdesc_paddr & 0xffffffff;
  2638. reo_qref->rx_reo_queue_desc_addr_39_32 =
  2639. (hw_qdesc_paddr & 0xff00000000) >> 32;
  2640. if (hw_qdesc_paddr != 0)
  2641. reo_qref->receive_queue_number = tid;
  2642. else
  2643. reo_qref->receive_queue_number = 0;
  2644. hal_reo_shared_qaddr_cache_clear_be(hal_soc_hdl);
  2645. hal_verbose_debug("hw_qdesc_paddr: %pK, tid: %d, reo_qref:%pK,"
  2646. "rx_reo_queue_desc_addr_31_0: %x,"
  2647. "rx_reo_queue_desc_addr_39_32: %x",
  2648. (void *)hw_qdesc_paddr, tid, reo_qref,
  2649. reo_qref->rx_reo_queue_desc_addr_31_0,
  2650. reo_qref->rx_reo_queue_desc_addr_39_32);
  2651. }
  2652. /**
  2653. * hal_reo_shared_qaddr_setup() - Allocate MLO and Non MLO reo queue
  2654. * reference table shared between SW and HW and initialize in Qdesc Base0
  2655. * base1 registers provided by HW.
  2656. *
  2657. * @hal_soc: HAL Soc handle
  2658. *
  2659. * Return: None
  2660. */
  2661. static void hal_reo_shared_qaddr_setup_be(hal_soc_handle_t hal_soc_hdl)
  2662. {
  2663. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2664. hal->reo_qref.reo_qref_table_en = 1;
  2665. hal->reo_qref.mlo_reo_qref_table_vaddr =
  2666. (uint64_t *)qdf_mem_alloc_consistent(
  2667. hal->qdf_dev, hal->qdf_dev->dev,
  2668. REO_QUEUE_REF_ML_TABLE_SIZE,
  2669. &hal->reo_qref.mlo_reo_qref_table_paddr);
  2670. hal->reo_qref.non_mlo_reo_qref_table_vaddr =
  2671. (uint64_t *)qdf_mem_alloc_consistent(
  2672. hal->qdf_dev, hal->qdf_dev->dev,
  2673. REO_QUEUE_REF_NON_ML_TABLE_SIZE,
  2674. &hal->reo_qref.non_mlo_reo_qref_table_paddr);
  2675. hal_verbose_debug("MLO table start paddr:%pK,"
  2676. "Non-MLO table start paddr:%pK,"
  2677. "MLO table start vaddr: %pK,"
  2678. "Non MLO table start vaddr: %pK",
  2679. (void *)hal->reo_qref.mlo_reo_qref_table_paddr,
  2680. (void *)hal->reo_qref.non_mlo_reo_qref_table_paddr,
  2681. hal->reo_qref.mlo_reo_qref_table_vaddr,
  2682. hal->reo_qref.non_mlo_reo_qref_table_vaddr);
  2683. }
  2684. /**
  2685. * hal_reo_shared_qaddr_init() - Zero out REO qref LUT and
  2686. * write start addr of MLO and Non MLO table in HW
  2687. *
  2688. * @hal_soc: HAL Soc handle
  2689. * @qref_reset: reset qref LUT
  2690. *
  2691. * Return: None
  2692. */
  2693. static void hal_reo_shared_qaddr_init_be(hal_soc_handle_t hal_soc_hdl,
  2694. int qref_reset)
  2695. {
  2696. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2697. if (qref_reset) {
  2698. qdf_mem_zero(hal->reo_qref.mlo_reo_qref_table_vaddr,
  2699. REO_QUEUE_REF_ML_TABLE_SIZE);
  2700. qdf_mem_zero(hal->reo_qref.non_mlo_reo_qref_table_vaddr,
  2701. REO_QUEUE_REF_NON_ML_TABLE_SIZE);
  2702. }
  2703. /* LUT_BASE0 and BASE1 registers expect upper 32bits of LUT base address
  2704. * and lower 8 bits to be 0. Shift the physical address by 8 to plug
  2705. * upper 32bits only
  2706. */
  2707. HAL_REG_WRITE(hal,
  2708. HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
  2709. hal->reo_qref.non_mlo_reo_qref_table_paddr >> 8);
  2710. HAL_REG_WRITE(hal,
  2711. HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
  2712. hal->reo_qref.mlo_reo_qref_table_paddr >> 8);
  2713. HAL_REG_WRITE(hal,
  2714. HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
  2715. HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, LUT_FEATURE_ENABLE,
  2716. 1));
  2717. HAL_REG_WRITE(hal,
  2718. HWIO_REO_R0_QDESC_MAX_SW_PEER_ID_ADDR(REO_REG_REG_BASE),
  2719. HAL_MS(HWIO_REO_R0_QDESC, MAX_SW_PEER_ID_MAX_SUPPORTED,
  2720. 0x1fff));
  2721. }
  2722. /**
  2723. * hal_reo_shared_qaddr_detach() - Free MLO and Non MLO reo queue
  2724. * reference table shared between SW and HW
  2725. *
  2726. * @hal_soc: HAL Soc handle
  2727. *
  2728. * Return: None
  2729. */
  2730. static void hal_reo_shared_qaddr_detach_be(hal_soc_handle_t hal_soc_hdl)
  2731. {
  2732. struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
  2733. HAL_REG_WRITE(hal,
  2734. HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
  2735. 0);
  2736. HAL_REG_WRITE(hal,
  2737. HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
  2738. 0);
  2739. qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
  2740. REO_QUEUE_REF_ML_TABLE_SIZE,
  2741. hal->reo_qref.mlo_reo_qref_table_vaddr,
  2742. hal->reo_qref.mlo_reo_qref_table_paddr, 0);
  2743. qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
  2744. REO_QUEUE_REF_NON_ML_TABLE_SIZE,
  2745. hal->reo_qref.non_mlo_reo_qref_table_vaddr,
  2746. hal->reo_qref.non_mlo_reo_qref_table_paddr, 0);
  2747. }
  2748. #endif
  2749. /**
  2750. * hal_tx_vdev_mismatch_routing_set - set vdev mismatch exception routing
  2751. * @hal_soc: HAL SoC context
  2752. * @config: HAL_TX_VDEV_MISMATCH_TQM_NOTIFY - route via TQM
  2753. * HAL_TX_VDEV_MISMATCH_FW_NOTIFY - route via FW
  2754. *
  2755. * Return: void
  2756. */
  2757. #ifdef HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_BMSK
  2758. static inline void
  2759. hal_tx_vdev_mismatch_routing_set_generic_be(hal_soc_handle_t hal_soc_hdl,
  2760. enum hal_tx_vdev_mismatch_notify
  2761. config)
  2762. {
  2763. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2764. uint32_t reg_addr, reg_val = 0;
  2765. uint32_t val = 0;
  2766. reg_addr = HWIO_TCL_R0_CMN_CONFIG_ADDR(MAC_TCL_REG_REG_BASE);
  2767. val = HAL_REG_READ(hal_soc, reg_addr);
  2768. /* reset the corresponding bits in register */
  2769. val &= (~(HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_BMSK));
  2770. /* set config value */
  2771. reg_val = val | (config <<
  2772. HWIO_TCL_R0_CMN_CONFIG_VDEVID_MISMATCH_EXCEPTION_SHFT);
  2773. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  2774. }
  2775. #else
  2776. static inline void
  2777. hal_tx_vdev_mismatch_routing_set_generic_be(hal_soc_handle_t hal_soc_hdl,
  2778. enum hal_tx_vdev_mismatch_notify
  2779. config)
  2780. {
  2781. }
  2782. #endif
  2783. /**
  2784. * hal_tx_mcast_mlo_reinject_routing_set - set MLO multicast reinject routing
  2785. * @hal_soc: HAL SoC context
  2786. * @config: HAL_TX_MCAST_MLO_REINJECT_FW_NOTIFY - route via FW
  2787. * HAL_TX_MCAST_MLO_REINJECT_TQM_NOTIFY - route via TQM
  2788. *
  2789. * Return: void
  2790. */
  2791. #if defined(HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_BMSK) && \
  2792. defined(WLAN_MCAST_MLO)
  2793. static inline void
  2794. hal_tx_mcast_mlo_reinject_routing_set_generic_be(
  2795. hal_soc_handle_t hal_soc_hdl,
  2796. enum hal_tx_mcast_mlo_reinject_notify config)
  2797. {
  2798. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  2799. uint32_t reg_addr, reg_val = 0;
  2800. uint32_t val = 0;
  2801. reg_addr = HWIO_TCL_R0_CMN_CONFIG_ADDR(MAC_TCL_REG_REG_BASE);
  2802. val = HAL_REG_READ(hal_soc, reg_addr);
  2803. /* reset the corresponding bits in register */
  2804. val &= (~(HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_BMSK));
  2805. /* set config value */
  2806. reg_val = val | (config << HWIO_TCL_R0_CMN_CONFIG_MCAST_CMN_PN_SN_MLO_REINJECT_ENABLE_SHFT);
  2807. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  2808. }
  2809. #else
  2810. static inline void
  2811. hal_tx_mcast_mlo_reinject_routing_set_generic_be(
  2812. hal_soc_handle_t hal_soc_hdl,
  2813. enum hal_tx_mcast_mlo_reinject_notify config)
  2814. {
  2815. }
  2816. #endif
  2817. /**
  2818. * hal_get_ba_aging_timeout_be - Get BA Aging timeout
  2819. *
  2820. * @hal_soc: Opaque HAL SOC handle
  2821. * @ac: Access category
  2822. * @value: window size to get
  2823. */
  2824. static inline
  2825. void hal_get_ba_aging_timeout_be_generic(hal_soc_handle_t hal_soc_hdl,
  2826. uint8_t ac, uint32_t *value)
  2827. {
  2828. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  2829. switch (ac) {
  2830. case WME_AC_BE:
  2831. *value = HAL_REG_READ(soc,
  2832. HWIO_REO_R0_AGING_THRESHOLD_IX_0_ADDR(
  2833. REO_REG_REG_BASE)) / 1000;
  2834. break;
  2835. case WME_AC_BK:
  2836. *value = HAL_REG_READ(soc,
  2837. HWIO_REO_R0_AGING_THRESHOLD_IX_1_ADDR(
  2838. REO_REG_REG_BASE)) / 1000;
  2839. break;
  2840. case WME_AC_VI:
  2841. *value = HAL_REG_READ(soc,
  2842. HWIO_REO_R0_AGING_THRESHOLD_IX_2_ADDR(
  2843. REO_REG_REG_BASE)) / 1000;
  2844. break;
  2845. case WME_AC_VO:
  2846. *value = HAL_REG_READ(soc,
  2847. HWIO_REO_R0_AGING_THRESHOLD_IX_3_ADDR(
  2848. REO_REG_REG_BASE)) / 1000;
  2849. break;
  2850. default:
  2851. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  2852. "Invalid AC: %d\n", ac);
  2853. }
  2854. }
  2855. /**
  2856. * hal_setup_link_idle_list_generic_be - Setup scattered idle list using the
  2857. * buffer list provided
  2858. *
  2859. * @hal_soc: Opaque HAL SOC handle
  2860. * @scatter_bufs_base_paddr: Array of physical base addresses
  2861. * @scatter_bufs_base_vaddr: Array of virtual base addresses
  2862. * @num_scatter_bufs: Number of scatter buffers in the above lists
  2863. * @scatter_buf_size: Size of each scatter buffer
  2864. * @last_buf_end_offset: Offset to the last entry
  2865. * @num_entries: Total entries of all scatter bufs
  2866. *
  2867. * Return: None
  2868. */
  2869. static inline void
  2870. hal_setup_link_idle_list_generic_be(struct hal_soc *soc,
  2871. qdf_dma_addr_t scatter_bufs_base_paddr[],
  2872. void *scatter_bufs_base_vaddr[],
  2873. uint32_t num_scatter_bufs,
  2874. uint32_t scatter_buf_size,
  2875. uint32_t last_buf_end_offset,
  2876. uint32_t num_entries)
  2877. {
  2878. int i;
  2879. uint32_t *prev_buf_link_ptr = NULL;
  2880. uint32_t reg_scatter_buf_size, reg_tot_scatter_buf_size;
  2881. uint32_t val;
  2882. /* Link the scatter buffers */
  2883. for (i = 0; i < num_scatter_bufs; i++) {
  2884. if (i > 0) {
  2885. prev_buf_link_ptr[0] =
  2886. scatter_bufs_base_paddr[i] & 0xffffffff;
  2887. prev_buf_link_ptr[1] = HAL_SM(
  2888. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
  2889. BASE_ADDRESS_39_32,
  2890. ((uint64_t)(scatter_bufs_base_paddr[i])
  2891. >> 32)) | HAL_SM(
  2892. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
  2893. ADDRESS_MATCH_TAG,
  2894. ADDRESS_MATCH_TAG_VAL);
  2895. }
  2896. prev_buf_link_ptr = (uint32_t *)(scatter_bufs_base_vaddr[i] +
  2897. scatter_buf_size - WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE);
  2898. }
  2899. /* TBD: Register programming partly based on MLD & the rest based on
  2900. * inputs from HW team. Not complete yet.
  2901. */
  2902. reg_scatter_buf_size = (scatter_buf_size -
  2903. WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE) / 64;
  2904. reg_tot_scatter_buf_size = ((scatter_buf_size -
  2905. WBM_IDLE_SCATTER_BUF_NEXT_PTR_SIZE) * num_scatter_bufs) / 64;
  2906. HAL_REG_WRITE(soc,
  2907. HWIO_WBM_R0_IDLE_LIST_CONTROL_ADDR(
  2908. WBM_REG_REG_BASE),
  2909. HAL_SM(HWIO_WBM_R0_IDLE_LIST_CONTROL, SCATTER_BUFFER_SIZE,
  2910. reg_scatter_buf_size) |
  2911. HAL_SM(HWIO_WBM_R0_IDLE_LIST_CONTROL, LINK_DESC_IDLE_LIST_MODE,
  2912. 0x1));
  2913. HAL_REG_WRITE(soc,
  2914. HWIO_WBM_R0_IDLE_LIST_SIZE_ADDR(
  2915. WBM_REG_REG_BASE),
  2916. HAL_SM(HWIO_WBM_R0_IDLE_LIST_SIZE,
  2917. SCATTER_RING_SIZE_OF_IDLE_LINK_DESC_LIST,
  2918. reg_tot_scatter_buf_size));
  2919. HAL_REG_WRITE(soc,
  2920. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_LSB_ADDR(
  2921. WBM_REG_REG_BASE),
  2922. scatter_bufs_base_paddr[0] & 0xffffffff);
  2923. HAL_REG_WRITE(soc,
  2924. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB_ADDR(
  2925. WBM_REG_REG_BASE),
  2926. ((uint64_t)(scatter_bufs_base_paddr[0]) >> 32) &
  2927. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB_BASE_ADDRESS_39_32_BMSK);
  2928. HAL_REG_WRITE(soc,
  2929. HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB_ADDR(
  2930. WBM_REG_REG_BASE),
  2931. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
  2932. BASE_ADDRESS_39_32, ((uint64_t)(scatter_bufs_base_paddr[0])
  2933. >> 32)) |
  2934. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_LIST_BASE_MSB,
  2935. ADDRESS_MATCH_TAG, ADDRESS_MATCH_TAG_VAL));
  2936. /* ADDRESS_MATCH_TAG field in the above register is expected to match
  2937. * with the upper bits of link pointer. The above write sets this field
  2938. * to zero and we are also setting the upper bits of link pointers to
  2939. * zero while setting up the link list of scatter buffers above
  2940. */
  2941. /* Setup head and tail pointers for the idle list */
  2942. HAL_REG_WRITE(soc,
  2943. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX0_ADDR(
  2944. WBM_REG_REG_BASE),
  2945. scatter_bufs_base_paddr[num_scatter_bufs - 1] & 0xffffffff);
  2946. HAL_REG_WRITE(soc,
  2947. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX1_ADDR(
  2948. WBM_REG_REG_BASE),
  2949. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX1,
  2950. BUFFER_ADDRESS_39_32,
  2951. ((uint64_t)(scatter_bufs_base_paddr[num_scatter_bufs - 1])
  2952. >> 32)) |
  2953. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX1,
  2954. HEAD_POINTER_OFFSET, last_buf_end_offset >> 2));
  2955. HAL_REG_WRITE(soc,
  2956. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HEAD_INFO_IX0_ADDR(
  2957. WBM_REG_REG_BASE),
  2958. scatter_bufs_base_paddr[0] & 0xffffffff);
  2959. HAL_REG_WRITE(soc,
  2960. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX0_ADDR(
  2961. WBM_REG_REG_BASE),
  2962. scatter_bufs_base_paddr[0] & 0xffffffff);
  2963. HAL_REG_WRITE(soc,
  2964. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX1_ADDR(
  2965. WBM_REG_REG_BASE),
  2966. HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX1,
  2967. BUFFER_ADDRESS_39_32,
  2968. ((uint64_t)(scatter_bufs_base_paddr[0]) >>
  2969. 32)) | HAL_SM(HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_TAIL_INFO_IX1,
  2970. TAIL_POINTER_OFFSET, 0));
  2971. HAL_REG_WRITE(soc,
  2972. HWIO_WBM_R0_SCATTERED_LINK_DESC_PTR_HP_ADDR(
  2973. WBM_REG_REG_BASE),
  2974. 2 * num_entries);
  2975. /* Set RING_ID_DISABLE */
  2976. val = HAL_SM(HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC, RING_ID_DISABLE, 1);
  2977. /*
  2978. * SRNG_ENABLE bit is not available in HWK v1 (QCA8074v1). Hence
  2979. * check the presence of the bit before toggling it.
  2980. */
  2981. #ifdef HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC_SRNG_ENABLE_BMSK
  2982. val |= HAL_SM(HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC, SRNG_ENABLE, 1);
  2983. #endif
  2984. HAL_REG_WRITE(soc,
  2985. HWIO_WBM_R0_WBM_IDLE_LINK_RING_MISC_ADDR(WBM_REG_REG_BASE),
  2986. val);
  2987. }
  2988. #ifdef DP_HW_COOKIE_CONVERT_EXCEPTION
  2989. #define HAL_WBM_MISC_CONTROL_SPARE_CONTROL_FIELD_BIT15 0x8000
  2990. #endif
  2991. /**
  2992. * hal_cookie_conversion_reg_cfg_generic_be() - set cookie conversion relevant register
  2993. * for REO/WBM
  2994. * @soc: HAL soc handle
  2995. * @cc_cfg: structure pointer for HW cookie conversion configuration
  2996. *
  2997. * Return: None
  2998. */
  2999. static inline
  3000. void hal_cookie_conversion_reg_cfg_generic_be(hal_soc_handle_t hal_soc_hdl,
  3001. struct hal_hw_cc_config *cc_cfg)
  3002. {
  3003. uint32_t reg_addr, reg_val = 0;
  3004. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  3005. /* REO CFG */
  3006. reg_addr = HWIO_REO_R0_SW_COOKIE_CFG0_ADDR(REO_REG_REG_BASE);
  3007. reg_val = cc_cfg->lut_base_addr_31_0;
  3008. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3009. reg_addr = HWIO_REO_R0_SW_COOKIE_CFG1_ADDR(REO_REG_REG_BASE);
  3010. reg_val = 0;
  3011. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3012. SW_COOKIE_CONVERT_GLOBAL_ENABLE,
  3013. cc_cfg->cc_global_en);
  3014. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3015. SW_COOKIE_CONVERT_ENABLE,
  3016. cc_cfg->cc_global_en);
  3017. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3018. PAGE_ALIGNMENT,
  3019. cc_cfg->page_4k_align);
  3020. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3021. COOKIE_OFFSET_MSB,
  3022. cc_cfg->cookie_offset_msb);
  3023. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3024. COOKIE_PAGE_MSB,
  3025. cc_cfg->cookie_page_msb);
  3026. reg_val |= HAL_SM(HWIO_REO_R0_SW_COOKIE_CFG1,
  3027. CMEM_LUT_BASE_ADDR_39_32,
  3028. cc_cfg->lut_base_addr_39_32);
  3029. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3030. /* WBM CFG */
  3031. reg_addr = HWIO_WBM_R0_SW_COOKIE_CFG0_ADDR(WBM_REG_REG_BASE);
  3032. reg_val = cc_cfg->lut_base_addr_31_0;
  3033. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3034. reg_addr = HWIO_WBM_R0_SW_COOKIE_CFG1_ADDR(WBM_REG_REG_BASE);
  3035. reg_val = 0;
  3036. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
  3037. PAGE_ALIGNMENT,
  3038. cc_cfg->page_4k_align);
  3039. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
  3040. COOKIE_OFFSET_MSB,
  3041. cc_cfg->cookie_offset_msb);
  3042. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
  3043. COOKIE_PAGE_MSB,
  3044. cc_cfg->cookie_page_msb);
  3045. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CFG1,
  3046. CMEM_LUT_BASE_ADDR_39_32,
  3047. cc_cfg->lut_base_addr_39_32);
  3048. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3049. /*
  3050. * WCSS_UMAC_WBM_R0_SW_COOKIE_CONVERT_CFG default value is 0x1FE,
  3051. */
  3052. reg_addr = HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG_ADDR(WBM_REG_REG_BASE);
  3053. reg_val = 0;
  3054. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3055. WBM_COOKIE_CONV_GLOBAL_ENABLE,
  3056. cc_cfg->cc_global_en);
  3057. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3058. WBM2SW6_COOKIE_CONVERSION_EN,
  3059. cc_cfg->wbm2sw6_cc_en);
  3060. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3061. WBM2SW5_COOKIE_CONVERSION_EN,
  3062. cc_cfg->wbm2sw5_cc_en);
  3063. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3064. WBM2SW4_COOKIE_CONVERSION_EN,
  3065. cc_cfg->wbm2sw4_cc_en);
  3066. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3067. WBM2SW3_COOKIE_CONVERSION_EN,
  3068. cc_cfg->wbm2sw3_cc_en);
  3069. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3070. WBM2SW2_COOKIE_CONVERSION_EN,
  3071. cc_cfg->wbm2sw2_cc_en);
  3072. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3073. WBM2SW1_COOKIE_CONVERSION_EN,
  3074. cc_cfg->wbm2sw1_cc_en);
  3075. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3076. WBM2SW0_COOKIE_CONVERSION_EN,
  3077. cc_cfg->wbm2sw0_cc_en);
  3078. reg_val |= HAL_SM(HWIO_WBM_R0_SW_COOKIE_CONVERT_CFG,
  3079. WBM2FW_COOKIE_CONVERSION_EN,
  3080. cc_cfg->wbm2fw_cc_en);
  3081. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3082. #ifdef HWIO_WBM_R0_WBM_CFG_2_COOKIE_DEBUG_SEL_BMSK
  3083. reg_addr = HWIO_WBM_R0_WBM_CFG_2_ADDR(WBM_REG_REG_BASE);
  3084. reg_val = 0;
  3085. reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
  3086. COOKIE_DEBUG_SEL,
  3087. cc_cfg->cc_global_en);
  3088. reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
  3089. COOKIE_CONV_INDICATION_EN,
  3090. cc_cfg->cc_global_en);
  3091. reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
  3092. ERROR_PATH_COOKIE_CONV_EN,
  3093. cc_cfg->error_path_cookie_conv_en);
  3094. reg_val |= HAL_SM(HWIO_WBM_R0_WBM_CFG_2,
  3095. RELEASE_PATH_COOKIE_CONV_EN,
  3096. cc_cfg->release_path_cookie_conv_en);
  3097. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3098. #endif
  3099. #ifdef DP_HW_COOKIE_CONVERT_EXCEPTION
  3100. /*
  3101. * To enable indication for HW cookie conversion done or not for
  3102. * WBM, WCSS_UMAC_WBM_R0_MISC_CONTROL spare_control field 15th
  3103. * bit spare_control[15] should be set.
  3104. */
  3105. reg_addr = HWIO_WBM_R0_MISC_CONTROL_ADDR(WBM_REG_REG_BASE);
  3106. reg_val = HAL_REG_READ(soc, reg_addr);
  3107. reg_val |= HAL_SM(HWIO_WCSS_UMAC_WBM_R0_MISC_CONTROL,
  3108. SPARE_CONTROL,
  3109. HAL_WBM_MISC_CONTROL_SPARE_CONTROL_FIELD_BIT15);
  3110. HAL_REG_WRITE(soc, reg_addr, reg_val);
  3111. #endif
  3112. }
  3113. /**
  3114. * hal_set_ba_aging_timeout_be - Set BA Aging timeout
  3115. *
  3116. * @hal_soc: Opaque HAL SOC handle
  3117. * @ac: Access category
  3118. * ac: 0 - Background, 1 - Best Effort, 2 - Video, 3 - Voice
  3119. * @value: Input value to set
  3120. */
  3121. static inline
  3122. void hal_set_ba_aging_timeout_be_generic(hal_soc_handle_t hal_soc_hdl,
  3123. uint8_t ac, uint32_t value)
  3124. {
  3125. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  3126. switch (ac) {
  3127. case WME_AC_BE:
  3128. HAL_REG_WRITE(soc,
  3129. HWIO_REO_R0_AGING_THRESHOLD_IX_0_ADDR(
  3130. REO_REG_REG_BASE),
  3131. value * 1000);
  3132. break;
  3133. case WME_AC_BK:
  3134. HAL_REG_WRITE(soc,
  3135. HWIO_REO_R0_AGING_THRESHOLD_IX_1_ADDR(
  3136. REO_REG_REG_BASE),
  3137. value * 1000);
  3138. break;
  3139. case WME_AC_VI:
  3140. HAL_REG_WRITE(soc,
  3141. HWIO_REO_R0_AGING_THRESHOLD_IX_2_ADDR(
  3142. REO_REG_REG_BASE),
  3143. value * 1000);
  3144. break;
  3145. case WME_AC_VO:
  3146. HAL_REG_WRITE(soc,
  3147. HWIO_REO_R0_AGING_THRESHOLD_IX_3_ADDR(
  3148. REO_REG_REG_BASE),
  3149. value * 1000);
  3150. break;
  3151. default:
  3152. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  3153. "Invalid AC: %d\n", ac);
  3154. }
  3155. }
  3156. /**
  3157. * hal_tx_populate_bank_register() - populate the bank register with
  3158. * the software configs.
  3159. * @soc: HAL soc handle
  3160. * @config: bank config
  3161. * @bank_id: bank id to be configured
  3162. *
  3163. * Returns: None
  3164. */
  3165. #ifdef HWIO_TCL_R0_SW_CONFIG_BANK_n_MCAST_PACKET_CTRL_SHFT
  3166. static inline void
  3167. hal_tx_populate_bank_register_be(hal_soc_handle_t hal_soc_hdl,
  3168. union hal_tx_bank_config *config,
  3169. uint8_t bank_id)
  3170. {
  3171. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  3172. uint32_t reg_addr, reg_val = 0;
  3173. reg_addr = HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDR(MAC_TCL_REG_REG_BASE,
  3174. bank_id);
  3175. reg_val |= (config->epd << HWIO_TCL_R0_SW_CONFIG_BANK_n_EPD_SHFT);
  3176. reg_val |= (config->encap_type <<
  3177. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCAP_TYPE_SHFT);
  3178. reg_val |= (config->encrypt_type <<
  3179. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCRYPT_TYPE_SHFT);
  3180. reg_val |= (config->src_buffer_swap <<
  3181. HWIO_TCL_R0_SW_CONFIG_BANK_n_SRC_BUFFER_SWAP_SHFT);
  3182. reg_val |= (config->link_meta_swap <<
  3183. HWIO_TCL_R0_SW_CONFIG_BANK_n_LINK_META_SWAP_SHFT);
  3184. reg_val |= (config->index_lookup_enable <<
  3185. HWIO_TCL_R0_SW_CONFIG_BANK_n_INDEX_LOOKUP_ENABLE_SHFT);
  3186. reg_val |= (config->addrx_en <<
  3187. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRX_EN_SHFT);
  3188. reg_val |= (config->addry_en <<
  3189. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRY_EN_SHFT);
  3190. reg_val |= (config->mesh_enable <<
  3191. HWIO_TCL_R0_SW_CONFIG_BANK_n_MESH_ENABLE_SHFT);
  3192. reg_val |= (config->vdev_id_check_en <<
  3193. HWIO_TCL_R0_SW_CONFIG_BANK_n_VDEV_ID_CHECK_EN_SHFT);
  3194. reg_val |= (config->pmac_id <<
  3195. HWIO_TCL_R0_SW_CONFIG_BANK_n_PMAC_ID_SHFT);
  3196. reg_val |= (config->mcast_pkt_ctrl <<
  3197. HWIO_TCL_R0_SW_CONFIG_BANK_n_MCAST_PACKET_CTRL_SHFT);
  3198. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  3199. }
  3200. #else
  3201. static inline void
  3202. hal_tx_populate_bank_register_be(hal_soc_handle_t hal_soc_hdl,
  3203. union hal_tx_bank_config *config,
  3204. uint8_t bank_id)
  3205. {
  3206. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  3207. uint32_t reg_addr, reg_val = 0;
  3208. reg_addr = HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDR(MAC_TCL_REG_REG_BASE,
  3209. bank_id);
  3210. reg_val |= (config->epd << HWIO_TCL_R0_SW_CONFIG_BANK_n_EPD_SHFT);
  3211. reg_val |= (config->encap_type <<
  3212. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCAP_TYPE_SHFT);
  3213. reg_val |= (config->encrypt_type <<
  3214. HWIO_TCL_R0_SW_CONFIG_BANK_n_ENCRYPT_TYPE_SHFT);
  3215. reg_val |= (config->src_buffer_swap <<
  3216. HWIO_TCL_R0_SW_CONFIG_BANK_n_SRC_BUFFER_SWAP_SHFT);
  3217. reg_val |= (config->link_meta_swap <<
  3218. HWIO_TCL_R0_SW_CONFIG_BANK_n_LINK_META_SWAP_SHFT);
  3219. reg_val |= (config->index_lookup_enable <<
  3220. HWIO_TCL_R0_SW_CONFIG_BANK_n_INDEX_LOOKUP_ENABLE_SHFT);
  3221. reg_val |= (config->addrx_en <<
  3222. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRX_EN_SHFT);
  3223. reg_val |= (config->addry_en <<
  3224. HWIO_TCL_R0_SW_CONFIG_BANK_n_ADDRY_EN_SHFT);
  3225. reg_val |= (config->mesh_enable <<
  3226. HWIO_TCL_R0_SW_CONFIG_BANK_n_MESH_ENABLE_SHFT);
  3227. reg_val |= (config->vdev_id_check_en <<
  3228. HWIO_TCL_R0_SW_CONFIG_BANK_n_VDEV_ID_CHECK_EN_SHFT);
  3229. reg_val |= (config->pmac_id <<
  3230. HWIO_TCL_R0_SW_CONFIG_BANK_n_PMAC_ID_SHFT);
  3231. reg_val |= (config->dscp_tid_map_id <<
  3232. HWIO_TCL_R0_SW_CONFIG_BANK_n_DSCP_TID_TABLE_NUM_SHFT);
  3233. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  3234. }
  3235. #endif
  3236. #ifdef HWIO_TCL_R0_VDEV_MCAST_PACKET_CTRL_MAP_n_VAL_SHFT
  3237. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_REG_ID(vdev_id) (vdev_id >> 0x4)
  3238. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_INDEX_IN_REG(vdev_id) (vdev_id & 0xF)
  3239. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK 0x3
  3240. #define HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT 0x2
  3241. /**
  3242. * hal_tx_vdev_mcast_ctrl_set - set mcast_ctrl value
  3243. * @hal_soc: HAL SoC context
  3244. * @mcast_ctrl_val: mcast ctrl value for this VAP
  3245. *
  3246. * Return: void
  3247. */
  3248. static inline void
  3249. hal_tx_vdev_mcast_ctrl_set_be(hal_soc_handle_t hal_soc_hdl,
  3250. uint8_t vdev_id, uint8_t mcast_ctrl_val)
  3251. {
  3252. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  3253. uint32_t reg_addr, reg_val = 0;
  3254. uint32_t val;
  3255. uint8_t reg_idx = HAL_TCL_VDEV_MCAST_PACKET_CTRL_REG_ID(vdev_id);
  3256. uint8_t index_in_reg =
  3257. HAL_TCL_VDEV_MCAST_PACKET_CTRL_INDEX_IN_REG(vdev_id);
  3258. reg_addr =
  3259. HWIO_TCL_R0_VDEV_MCAST_PACKET_CTRL_MAP_n_ADDR(MAC_TCL_REG_REG_BASE,
  3260. reg_idx);
  3261. val = HAL_REG_READ(hal_soc, reg_addr);
  3262. /* mask out other stored value */
  3263. val &= (~(HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK <<
  3264. (HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT * index_in_reg)));
  3265. reg_val = val |
  3266. ((HAL_TCL_VDEV_MCAST_PACKET_CTRL_MASK & mcast_ctrl_val) <<
  3267. (HAL_TCL_VDEV_MCAST_PACKET_CTRL_SHIFT * index_in_reg));
  3268. HAL_REG_WRITE(hal_soc, reg_addr, reg_val);
  3269. }
  3270. #else
  3271. static inline void
  3272. hal_tx_vdev_mcast_ctrl_set_be(hal_soc_handle_t hal_soc_hdl,
  3273. uint8_t vdev_id, uint8_t mcast_ctrl_val)
  3274. {
  3275. }
  3276. #endif
  3277. #endif /* _HAL_BE_GENERIC_API_H_ */