dp_htt.c 146 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096
  1. /*
  2. * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #include <htt.h>
  19. #include <hal_hw_headers.h>
  20. #include <hal_api.h>
  21. #include "dp_peer.h"
  22. #include "dp_types.h"
  23. #include "dp_internal.h"
  24. #include "dp_rx_mon.h"
  25. #include "htt_stats.h"
  26. #include "htt_ppdu_stats.h"
  27. #include "dp_htt.h"
  28. #include "dp_rx.h"
  29. #include "qdf_mem.h" /* qdf_mem_malloc,free */
  30. #include "cdp_txrx_cmn_struct.h"
  31. #ifdef FEATURE_PERPKT_INFO
  32. #include "dp_ratetable.h"
  33. #endif
  34. #define HTT_TLV_HDR_LEN HTT_T2H_EXT_STATS_CONF_TLV_HDR_SIZE
  35. #define HTT_HTC_PKT_POOL_INIT_SIZE 64
  36. #define HTT_MSG_BUF_SIZE(msg_bytes) \
  37. ((msg_bytes) + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING)
  38. #define HTT_PID_BIT_MASK 0x3
  39. #define DP_EXT_MSG_LENGTH 2048
  40. #define HTT_MGMT_CTRL_TLV_HDR_RESERVERD_LEN 16
  41. #define HTT_SHIFT_UPPER_TIMESTAMP 32
  42. #define HTT_MASK_UPPER_TIMESTAMP 0xFFFFFFFF00000000
  43. /*
  44. * dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap() - Get ppdu stats tlv
  45. * bitmap for sniffer mode
  46. * @bitmap: received bitmap
  47. *
  48. * Return: expected bitmap value, returns zero if doesn't match with
  49. * either 64-bit Tx window or 256-bit window tlv bitmap
  50. */
  51. int
  52. dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap(uint32_t bitmap)
  53. {
  54. if (bitmap == (HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_64))
  55. return HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_64;
  56. else if (bitmap == (HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_256))
  57. return HTT_PPDU_SNIFFER_AMPDU_TLV_BITMAP_256;
  58. return 0;
  59. }
  60. #ifdef FEATURE_PERPKT_INFO
  61. /*
  62. * dp_peer_copy_delay_stats() - copy ppdu stats to peer delayed stats.
  63. * @peer: Datapath peer handle
  64. * @ppdu: PPDU Descriptor
  65. *
  66. * Return: None
  67. *
  68. * on Tx data frame, we may get delayed ba set
  69. * in htt_ppdu_stats_user_common_tlv. which mean we get Block Ack(BA) after we
  70. * request Block Ack Request(BAR). Successful msdu is received only after Block
  71. * Ack. To populate peer stats we need successful msdu(data frame).
  72. * So we hold the Tx data stats on delayed_ba for stats update.
  73. */
  74. static inline void
  75. dp_peer_copy_delay_stats(struct dp_peer *peer,
  76. struct cdp_tx_completion_ppdu_user *ppdu)
  77. {
  78. struct dp_pdev *pdev;
  79. struct dp_vdev *vdev;
  80. if (peer->last_delayed_ba) {
  81. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  82. "BA not yet recv for prev delayed ppdu[%d]\n",
  83. peer->last_delayed_ba_ppduid);
  84. vdev = peer->vdev;
  85. if (vdev) {
  86. pdev = vdev->pdev;
  87. pdev->stats.cdp_delayed_ba_not_recev++;
  88. }
  89. }
  90. peer->delayed_ba_ppdu_stats.ltf_size = ppdu->ltf_size;
  91. peer->delayed_ba_ppdu_stats.stbc = ppdu->stbc;
  92. peer->delayed_ba_ppdu_stats.he_re = ppdu->he_re;
  93. peer->delayed_ba_ppdu_stats.txbf = ppdu->txbf;
  94. peer->delayed_ba_ppdu_stats.bw = ppdu->bw;
  95. peer->delayed_ba_ppdu_stats.nss = ppdu->nss;
  96. peer->delayed_ba_ppdu_stats.preamble = ppdu->preamble;
  97. peer->delayed_ba_ppdu_stats.gi = ppdu->gi;
  98. peer->delayed_ba_ppdu_stats.dcm = ppdu->dcm;
  99. peer->delayed_ba_ppdu_stats.ldpc = ppdu->ldpc;
  100. peer->delayed_ba_ppdu_stats.dcm = ppdu->dcm;
  101. peer->delayed_ba_ppdu_stats.mpdu_tried_ucast = ppdu->mpdu_tried_ucast;
  102. peer->delayed_ba_ppdu_stats.mpdu_tried_mcast = ppdu->mpdu_tried_mcast;
  103. peer->delayed_ba_ppdu_stats.frame_ctrl = ppdu->frame_ctrl;
  104. peer->delayed_ba_ppdu_stats.qos_ctrl = ppdu->qos_ctrl;
  105. peer->delayed_ba_ppdu_stats.dcm = ppdu->dcm;
  106. peer->delayed_ba_ppdu_stats.ru_start = ppdu->ru_start;
  107. peer->delayed_ba_ppdu_stats.ru_tones = ppdu->ru_tones;
  108. peer->delayed_ba_ppdu_stats.is_mcast = ppdu->is_mcast;
  109. peer->delayed_ba_ppdu_stats.user_pos = ppdu->user_pos;
  110. peer->delayed_ba_ppdu_stats.mu_group_id = ppdu->mu_group_id;
  111. peer->last_delayed_ba = true;
  112. }
  113. /*
  114. * dp_peer_copy_stats_to_bar() - copy delayed stats to ppdu stats.
  115. * @peer: Datapath peer handle
  116. * @ppdu: PPDU Descriptor
  117. *
  118. * Return: None
  119. *
  120. * For Tx BAR, PPDU stats TLV include Block Ack info. PPDU info
  121. * from Tx BAR frame not required to populate peer stats.
  122. * But we need successful MPDU and MSDU to update previous
  123. * transmitted Tx data frame. Overwrite ppdu stats with the previous
  124. * stored ppdu stats.
  125. */
  126. static void
  127. dp_peer_copy_stats_to_bar(struct dp_peer *peer,
  128. struct cdp_tx_completion_ppdu_user *ppdu)
  129. {
  130. ppdu->ltf_size = peer->delayed_ba_ppdu_stats.ltf_size;
  131. ppdu->stbc = peer->delayed_ba_ppdu_stats.stbc;
  132. ppdu->he_re = peer->delayed_ba_ppdu_stats.he_re;
  133. ppdu->txbf = peer->delayed_ba_ppdu_stats.txbf;
  134. ppdu->bw = peer->delayed_ba_ppdu_stats.bw;
  135. ppdu->nss = peer->delayed_ba_ppdu_stats.nss;
  136. ppdu->preamble = peer->delayed_ba_ppdu_stats.preamble;
  137. ppdu->gi = peer->delayed_ba_ppdu_stats.gi;
  138. ppdu->dcm = peer->delayed_ba_ppdu_stats.dcm;
  139. ppdu->ldpc = peer->delayed_ba_ppdu_stats.ldpc;
  140. ppdu->dcm = peer->delayed_ba_ppdu_stats.dcm;
  141. ppdu->mpdu_tried_ucast = peer->delayed_ba_ppdu_stats.mpdu_tried_ucast;
  142. ppdu->mpdu_tried_mcast = peer->delayed_ba_ppdu_stats.mpdu_tried_mcast;
  143. ppdu->frame_ctrl = peer->delayed_ba_ppdu_stats.frame_ctrl;
  144. ppdu->qos_ctrl = peer->delayed_ba_ppdu_stats.qos_ctrl;
  145. ppdu->dcm = peer->delayed_ba_ppdu_stats.dcm;
  146. ppdu->ru_start = peer->delayed_ba_ppdu_stats.ru_start;
  147. ppdu->ru_tones = peer->delayed_ba_ppdu_stats.ru_tones;
  148. ppdu->is_mcast = peer->delayed_ba_ppdu_stats.is_mcast;
  149. ppdu->user_pos = peer->delayed_ba_ppdu_stats.user_pos;
  150. ppdu->mu_group_id = peer->delayed_ba_ppdu_stats.mu_group_id;
  151. peer->last_delayed_ba = false;
  152. }
  153. /*
  154. * dp_tx_rate_stats_update() - Update rate per-peer statistics
  155. * @peer: Datapath peer handle
  156. * @ppdu: PPDU Descriptor
  157. *
  158. * Return: None
  159. */
  160. static void
  161. dp_tx_rate_stats_update(struct dp_peer *peer,
  162. struct cdp_tx_completion_ppdu_user *ppdu)
  163. {
  164. uint32_t ratekbps = 0;
  165. uint64_t ppdu_tx_rate = 0;
  166. uint32_t rix;
  167. uint16_t ratecode = 0;
  168. if (!peer || !ppdu)
  169. return;
  170. ratekbps = dp_getrateindex(ppdu->gi,
  171. ppdu->mcs,
  172. ppdu->nss,
  173. ppdu->preamble,
  174. ppdu->bw,
  175. &rix,
  176. &ratecode);
  177. DP_STATS_UPD(peer, tx.last_tx_rate, ratekbps);
  178. if (!ratekbps)
  179. return;
  180. /* Calculate goodput in non-training period
  181. * In training period, don't do anything as
  182. * pending pkt is send as goodput.
  183. */
  184. if ((!peer->bss_peer) && (!ppdu->sa_is_training)) {
  185. ppdu->sa_goodput = ((ratekbps / CDP_NUM_KB_IN_MB) *
  186. (CDP_PERCENT_MACRO - ppdu->current_rate_per));
  187. }
  188. ppdu->rix = rix;
  189. ppdu->tx_ratekbps = ratekbps;
  190. ppdu->tx_ratecode = ratecode;
  191. peer->stats.tx.avg_tx_rate =
  192. dp_ath_rate_lpf(peer->stats.tx.avg_tx_rate, ratekbps);
  193. ppdu_tx_rate = dp_ath_rate_out(peer->stats.tx.avg_tx_rate);
  194. DP_STATS_UPD(peer, tx.rnd_avg_tx_rate, ppdu_tx_rate);
  195. if (peer->vdev) {
  196. /*
  197. * In STA mode:
  198. * We get ucast stats as BSS peer stats.
  199. *
  200. * In AP mode:
  201. * We get mcast stats as BSS peer stats.
  202. * We get ucast stats as assoc peer stats.
  203. */
  204. if (peer->vdev->opmode == wlan_op_mode_ap && peer->bss_peer) {
  205. peer->vdev->stats.tx.mcast_last_tx_rate = ratekbps;
  206. peer->vdev->stats.tx.mcast_last_tx_rate_mcs = ppdu->mcs;
  207. } else {
  208. peer->vdev->stats.tx.last_tx_rate = ratekbps;
  209. peer->vdev->stats.tx.last_tx_rate_mcs = ppdu->mcs;
  210. }
  211. }
  212. }
  213. /*
  214. * dp_tx_stats_update() - Update per-peer statistics
  215. * @pdev: Datapath pdev handle
  216. * @peer: Datapath peer handle
  217. * @ppdu: PPDU Descriptor
  218. * @ack_rssi: RSSI of last ack received
  219. *
  220. * Return: None
  221. */
  222. static void
  223. dp_tx_stats_update(struct dp_pdev *pdev, struct dp_peer *peer,
  224. struct cdp_tx_completion_ppdu_user *ppdu,
  225. uint32_t ack_rssi)
  226. {
  227. uint8_t preamble, mcs;
  228. uint16_t num_msdu;
  229. uint16_t num_mpdu;
  230. uint16_t mpdu_tried;
  231. uint16_t mpdu_failed;
  232. preamble = ppdu->preamble;
  233. mcs = ppdu->mcs;
  234. num_msdu = ppdu->num_msdu;
  235. num_mpdu = ppdu->mpdu_success;
  236. mpdu_tried = ppdu->mpdu_tried_ucast + ppdu->mpdu_tried_mcast;
  237. mpdu_failed = mpdu_tried - num_mpdu;
  238. /* If the peer statistics are already processed as part of
  239. * per-MSDU completion handler, do not process these again in per-PPDU
  240. * indications */
  241. if (pdev->soc->process_tx_status)
  242. return;
  243. if (ppdu->completion_status != HTT_PPDU_STATS_USER_STATUS_OK) {
  244. /*
  245. * All failed mpdu will be retried, so incrementing
  246. * retries mpdu based on mpdu failed. Even for
  247. * ack failure i.e for long retries we get
  248. * mpdu failed equal mpdu tried.
  249. */
  250. DP_STATS_INC(peer, tx.retries, mpdu_failed);
  251. DP_STATS_INC(peer, tx.tx_failed, ppdu->failed_msdus);
  252. return;
  253. }
  254. if (ppdu->is_ppdu_cookie_valid)
  255. DP_STATS_INC(peer, tx.num_ppdu_cookie_valid, 1);
  256. if (ppdu->mu_group_id <= MAX_MU_GROUP_ID &&
  257. ppdu->ppdu_type != HTT_PPDU_STATS_PPDU_TYPE_SU) {
  258. if (unlikely(!(ppdu->mu_group_id & (MAX_MU_GROUP_ID - 1))))
  259. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  260. "mu_group_id out of bound!!\n");
  261. else
  262. DP_STATS_UPD(peer, tx.mu_group_id[ppdu->mu_group_id],
  263. (ppdu->user_pos + 1));
  264. }
  265. if (ppdu->ppdu_type == HTT_PPDU_STATS_PPDU_TYPE_MU_OFDMA ||
  266. ppdu->ppdu_type == HTT_PPDU_STATS_PPDU_TYPE_MU_MIMO_OFDMA) {
  267. DP_STATS_UPD(peer, tx.ru_tones, ppdu->ru_tones);
  268. DP_STATS_UPD(peer, tx.ru_start, ppdu->ru_start);
  269. switch (ppdu->ru_tones) {
  270. case RU_26:
  271. DP_STATS_INC(peer, tx.ru_loc[RU_26_INDEX].num_msdu,
  272. num_msdu);
  273. DP_STATS_INC(peer, tx.ru_loc[RU_26_INDEX].num_mpdu,
  274. num_mpdu);
  275. DP_STATS_INC(peer, tx.ru_loc[RU_26_INDEX].mpdu_tried,
  276. mpdu_tried);
  277. break;
  278. case RU_52:
  279. DP_STATS_INC(peer, tx.ru_loc[RU_52_INDEX].num_msdu,
  280. num_msdu);
  281. DP_STATS_INC(peer, tx.ru_loc[RU_52_INDEX].num_mpdu,
  282. num_mpdu);
  283. DP_STATS_INC(peer, tx.ru_loc[RU_52_INDEX].mpdu_tried,
  284. mpdu_tried);
  285. break;
  286. case RU_106:
  287. DP_STATS_INC(peer, tx.ru_loc[RU_106_INDEX].num_msdu,
  288. num_msdu);
  289. DP_STATS_INC(peer, tx.ru_loc[RU_106_INDEX].num_mpdu,
  290. num_mpdu);
  291. DP_STATS_INC(peer, tx.ru_loc[RU_106_INDEX].mpdu_tried,
  292. mpdu_tried);
  293. break;
  294. case RU_242:
  295. DP_STATS_INC(peer, tx.ru_loc[RU_242_INDEX].num_msdu,
  296. num_msdu);
  297. DP_STATS_INC(peer, tx.ru_loc[RU_242_INDEX].num_mpdu,
  298. num_mpdu);
  299. DP_STATS_INC(peer, tx.ru_loc[RU_242_INDEX].mpdu_tried,
  300. mpdu_tried);
  301. break;
  302. case RU_484:
  303. DP_STATS_INC(peer, tx.ru_loc[RU_484_INDEX].num_msdu,
  304. num_msdu);
  305. DP_STATS_INC(peer, tx.ru_loc[RU_484_INDEX].num_mpdu,
  306. num_mpdu);
  307. DP_STATS_INC(peer, tx.ru_loc[RU_484_INDEX].mpdu_tried,
  308. mpdu_tried);
  309. break;
  310. case RU_996:
  311. DP_STATS_INC(peer, tx.ru_loc[RU_996_INDEX].num_msdu,
  312. num_msdu);
  313. DP_STATS_INC(peer, tx.ru_loc[RU_996_INDEX].num_mpdu,
  314. num_mpdu);
  315. DP_STATS_INC(peer, tx.ru_loc[RU_996_INDEX].mpdu_tried,
  316. mpdu_tried);
  317. break;
  318. }
  319. }
  320. /*
  321. * All failed mpdu will be retried, so incrementing
  322. * retries mpdu based on mpdu failed. Even for
  323. * ack failure i.e for long retries we get
  324. * mpdu failed equal mpdu tried.
  325. */
  326. DP_STATS_INC(peer, tx.retries, mpdu_failed);
  327. DP_STATS_INC(peer, tx.tx_failed, ppdu->failed_msdus);
  328. DP_STATS_INC(peer, tx.transmit_type[ppdu->ppdu_type].num_msdu,
  329. num_msdu);
  330. DP_STATS_INC(peer, tx.transmit_type[ppdu->ppdu_type].num_mpdu,
  331. num_mpdu);
  332. DP_STATS_INC(peer, tx.transmit_type[ppdu->ppdu_type].mpdu_tried,
  333. mpdu_tried);
  334. DP_STATS_INC_PKT(peer, tx.comp_pkt,
  335. num_msdu, (ppdu->success_bytes +
  336. ppdu->retry_bytes + ppdu->failed_bytes));
  337. DP_STATS_UPD(peer, tx.tx_rate, ppdu->tx_rate);
  338. DP_STATS_INC(peer, tx.sgi_count[ppdu->gi], num_msdu);
  339. DP_STATS_INC(peer, tx.bw[ppdu->bw], num_msdu);
  340. DP_STATS_INC(peer, tx.nss[ppdu->nss], num_msdu);
  341. if (ppdu->tid < CDP_DATA_TID_MAX)
  342. DP_STATS_INC(peer, tx.wme_ac_type[TID_TO_WME_AC(ppdu->tid)],
  343. num_msdu);
  344. DP_STATS_INCC(peer, tx.stbc, num_msdu, ppdu->stbc);
  345. DP_STATS_INCC(peer, tx.ldpc, num_msdu, ppdu->ldpc);
  346. if (!(ppdu->is_mcast) && ppdu->ack_rssi_valid)
  347. DP_STATS_UPD(peer, tx.last_ack_rssi, ack_rssi);
  348. DP_STATS_INCC(peer,
  349. tx.pkt_type[preamble].mcs_count[MAX_MCS-1], num_msdu,
  350. ((mcs >= MAX_MCS_11A) && (preamble == DOT11_A)));
  351. DP_STATS_INCC(peer,
  352. tx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  353. ((mcs < MAX_MCS_11A) && (preamble == DOT11_A)));
  354. DP_STATS_INCC(peer,
  355. tx.pkt_type[preamble].mcs_count[MAX_MCS-1], num_msdu,
  356. ((mcs >= MAX_MCS_11B) && (preamble == DOT11_B)));
  357. DP_STATS_INCC(peer,
  358. tx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  359. ((mcs < (MAX_MCS_11B)) && (preamble == DOT11_B)));
  360. DP_STATS_INCC(peer,
  361. tx.pkt_type[preamble].mcs_count[MAX_MCS-1], num_msdu,
  362. ((mcs >= MAX_MCS_11A) && (preamble == DOT11_N)));
  363. DP_STATS_INCC(peer,
  364. tx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  365. ((mcs < MAX_MCS_11A) && (preamble == DOT11_N)));
  366. DP_STATS_INCC(peer,
  367. tx.pkt_type[preamble].mcs_count[MAX_MCS-1], num_msdu,
  368. ((mcs >= MAX_MCS_11AC) && (preamble == DOT11_AC)));
  369. DP_STATS_INCC(peer,
  370. tx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  371. ((mcs < MAX_MCS_11AC) && (preamble == DOT11_AC)));
  372. DP_STATS_INCC(peer,
  373. tx.pkt_type[preamble].mcs_count[MAX_MCS-1], num_msdu,
  374. ((mcs >= (MAX_MCS - 1)) && (preamble == DOT11_AX)));
  375. DP_STATS_INCC(peer,
  376. tx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  377. ((mcs < (MAX_MCS - 1)) && (preamble == DOT11_AX)));
  378. DP_STATS_INCC(peer, tx.ampdu_cnt, num_msdu, ppdu->is_ampdu);
  379. DP_STATS_INCC(peer, tx.non_ampdu_cnt, num_msdu, !(ppdu->is_ampdu));
  380. dp_peer_stats_notify(pdev, peer);
  381. #if defined(FEATURE_PERPKT_INFO) && WDI_EVENT_ENABLE
  382. dp_wdi_event_handler(WDI_EVENT_UPDATE_DP_STATS, pdev->soc,
  383. &peer->stats, ppdu->peer_id,
  384. UPDATE_PEER_STATS, pdev->pdev_id);
  385. #endif
  386. }
  387. #endif
  388. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  389. #include "dp_tx_capture.h"
  390. #else
  391. static inline void
  392. dp_process_ppdu_stats_update_failed_bitmap(struct dp_pdev *pdev,
  393. void *data,
  394. uint32_t ppdu_id,
  395. uint32_t size)
  396. {
  397. }
  398. #endif
  399. /*
  400. * htt_htc_pkt_alloc() - Allocate HTC packet buffer
  401. * @htt_soc: HTT SOC handle
  402. *
  403. * Return: Pointer to htc packet buffer
  404. */
  405. static struct dp_htt_htc_pkt *
  406. htt_htc_pkt_alloc(struct htt_soc *soc)
  407. {
  408. struct dp_htt_htc_pkt_union *pkt = NULL;
  409. HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex);
  410. if (soc->htt_htc_pkt_freelist) {
  411. pkt = soc->htt_htc_pkt_freelist;
  412. soc->htt_htc_pkt_freelist = soc->htt_htc_pkt_freelist->u.next;
  413. }
  414. HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex);
  415. if (!pkt)
  416. pkt = qdf_mem_malloc(sizeof(*pkt));
  417. return &pkt->u.pkt; /* not actually a dereference */
  418. }
  419. /*
  420. * htt_htc_pkt_free() - Free HTC packet buffer
  421. * @htt_soc: HTT SOC handle
  422. */
  423. static void
  424. htt_htc_pkt_free(struct htt_soc *soc, struct dp_htt_htc_pkt *pkt)
  425. {
  426. struct dp_htt_htc_pkt_union *u_pkt =
  427. (struct dp_htt_htc_pkt_union *)pkt;
  428. HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex);
  429. u_pkt->u.next = soc->htt_htc_pkt_freelist;
  430. soc->htt_htc_pkt_freelist = u_pkt;
  431. HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex);
  432. }
  433. /*
  434. * htt_htc_pkt_pool_free() - Free HTC packet pool
  435. * @htt_soc: HTT SOC handle
  436. */
  437. static void
  438. htt_htc_pkt_pool_free(struct htt_soc *soc)
  439. {
  440. struct dp_htt_htc_pkt_union *pkt, *next;
  441. pkt = soc->htt_htc_pkt_freelist;
  442. while (pkt) {
  443. next = pkt->u.next;
  444. qdf_mem_free(pkt);
  445. pkt = next;
  446. }
  447. soc->htt_htc_pkt_freelist = NULL;
  448. }
  449. /*
  450. * htt_htc_misc_pkt_list_trim() - trim misc list
  451. * @htt_soc: HTT SOC handle
  452. * @level: max no. of pkts in list
  453. */
  454. static void
  455. htt_htc_misc_pkt_list_trim(struct htt_soc *soc, int level)
  456. {
  457. struct dp_htt_htc_pkt_union *pkt, *next, *prev = NULL;
  458. int i = 0;
  459. qdf_nbuf_t netbuf;
  460. HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex);
  461. pkt = soc->htt_htc_pkt_misclist;
  462. while (pkt) {
  463. next = pkt->u.next;
  464. /* trim the out grown list*/
  465. if (++i > level) {
  466. netbuf =
  467. (qdf_nbuf_t)(pkt->u.pkt.htc_pkt.pNetBufContext);
  468. qdf_nbuf_unmap(soc->osdev, netbuf, QDF_DMA_TO_DEVICE);
  469. qdf_nbuf_free(netbuf);
  470. qdf_mem_free(pkt);
  471. pkt = NULL;
  472. if (prev)
  473. prev->u.next = NULL;
  474. }
  475. prev = pkt;
  476. pkt = next;
  477. }
  478. HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex);
  479. }
  480. /*
  481. * htt_htc_misc_pkt_list_add() - Add pkt to misc list
  482. * @htt_soc: HTT SOC handle
  483. * @dp_htt_htc_pkt: pkt to be added to list
  484. */
  485. static void
  486. htt_htc_misc_pkt_list_add(struct htt_soc *soc, struct dp_htt_htc_pkt *pkt)
  487. {
  488. struct dp_htt_htc_pkt_union *u_pkt =
  489. (struct dp_htt_htc_pkt_union *)pkt;
  490. int misclist_trim_level = htc_get_tx_queue_depth(soc->htc_soc,
  491. pkt->htc_pkt.Endpoint)
  492. + DP_HTT_HTC_PKT_MISCLIST_SIZE;
  493. HTT_TX_MUTEX_ACQUIRE(&soc->htt_tx_mutex);
  494. if (soc->htt_htc_pkt_misclist) {
  495. u_pkt->u.next = soc->htt_htc_pkt_misclist;
  496. soc->htt_htc_pkt_misclist = u_pkt;
  497. } else {
  498. soc->htt_htc_pkt_misclist = u_pkt;
  499. }
  500. HTT_TX_MUTEX_RELEASE(&soc->htt_tx_mutex);
  501. /* only ce pipe size + tx_queue_depth could possibly be in use
  502. * free older packets in the misclist
  503. */
  504. htt_htc_misc_pkt_list_trim(soc, misclist_trim_level);
  505. }
  506. /**
  507. * DP_HTT_SEND_HTC_PKT() - Send htt packet from host
  508. * @soc : HTT SOC handle
  509. * @pkt: pkt to be send
  510. * @cmd : command to be recorded in dp htt logger
  511. * @buf : Pointer to buffer needs to be recored for above cmd
  512. *
  513. * Return: None
  514. */
  515. static inline QDF_STATUS DP_HTT_SEND_HTC_PKT(struct htt_soc *soc,
  516. struct dp_htt_htc_pkt *pkt,
  517. uint8_t cmd, uint8_t *buf)
  518. {
  519. QDF_STATUS status;
  520. htt_command_record(soc->htt_logger_handle, cmd, buf);
  521. status = htc_send_pkt(soc->htc_soc, &pkt->htc_pkt);
  522. if (status == QDF_STATUS_SUCCESS)
  523. htt_htc_misc_pkt_list_add(soc, pkt);
  524. return status;
  525. }
  526. /*
  527. * htt_htc_misc_pkt_pool_free() - free pkts in misc list
  528. * @htt_soc: HTT SOC handle
  529. */
  530. static void
  531. htt_htc_misc_pkt_pool_free(struct htt_soc *soc)
  532. {
  533. struct dp_htt_htc_pkt_union *pkt, *next;
  534. qdf_nbuf_t netbuf;
  535. pkt = soc->htt_htc_pkt_misclist;
  536. while (pkt) {
  537. next = pkt->u.next;
  538. netbuf = (qdf_nbuf_t) (pkt->u.pkt.htc_pkt.pNetBufContext);
  539. qdf_nbuf_unmap(soc->osdev, netbuf, QDF_DMA_TO_DEVICE);
  540. soc->stats.htc_pkt_free++;
  541. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW,
  542. "%s: Pkt free count %d",
  543. __func__, soc->stats.htc_pkt_free);
  544. qdf_nbuf_free(netbuf);
  545. qdf_mem_free(pkt);
  546. pkt = next;
  547. }
  548. soc->htt_htc_pkt_misclist = NULL;
  549. }
  550. /*
  551. * htt_t2h_mac_addr_deswizzle() - Swap MAC addr bytes if FW endianness differ
  552. * @tgt_mac_addr: Target MAC
  553. * @buffer: Output buffer
  554. */
  555. static u_int8_t *
  556. htt_t2h_mac_addr_deswizzle(u_int8_t *tgt_mac_addr, u_int8_t *buffer)
  557. {
  558. #ifdef BIG_ENDIAN_HOST
  559. /*
  560. * The host endianness is opposite of the target endianness.
  561. * To make u_int32_t elements come out correctly, the target->host
  562. * upload has swizzled the bytes in each u_int32_t element of the
  563. * message.
  564. * For byte-array message fields like the MAC address, this
  565. * upload swizzling puts the bytes in the wrong order, and needs
  566. * to be undone.
  567. */
  568. buffer[0] = tgt_mac_addr[3];
  569. buffer[1] = tgt_mac_addr[2];
  570. buffer[2] = tgt_mac_addr[1];
  571. buffer[3] = tgt_mac_addr[0];
  572. buffer[4] = tgt_mac_addr[7];
  573. buffer[5] = tgt_mac_addr[6];
  574. return buffer;
  575. #else
  576. /*
  577. * The host endianness matches the target endianness -
  578. * we can use the mac addr directly from the message buffer.
  579. */
  580. return tgt_mac_addr;
  581. #endif
  582. }
  583. /*
  584. * dp_htt_h2t_send_complete_free_netbuf() - Free completed buffer
  585. * @soc: SOC handle
  586. * @status: Completion status
  587. * @netbuf: HTT buffer
  588. */
  589. static void
  590. dp_htt_h2t_send_complete_free_netbuf(
  591. void *soc, A_STATUS status, qdf_nbuf_t netbuf)
  592. {
  593. qdf_nbuf_free(netbuf);
  594. }
  595. /*
  596. * dp_htt_h2t_send_complete() - H2T completion handler
  597. * @context: Opaque context (HTT SOC handle)
  598. * @htc_pkt: HTC packet
  599. */
  600. static void
  601. dp_htt_h2t_send_complete(void *context, HTC_PACKET *htc_pkt)
  602. {
  603. void (*send_complete_part2)(
  604. void *soc, QDF_STATUS status, qdf_nbuf_t msdu);
  605. struct htt_soc *soc = (struct htt_soc *) context;
  606. struct dp_htt_htc_pkt *htt_pkt;
  607. qdf_nbuf_t netbuf;
  608. send_complete_part2 = htc_pkt->pPktContext;
  609. htt_pkt = container_of(htc_pkt, struct dp_htt_htc_pkt, htc_pkt);
  610. /* process (free or keep) the netbuf that held the message */
  611. netbuf = (qdf_nbuf_t) htc_pkt->pNetBufContext;
  612. /*
  613. * adf sendcomplete is required for windows only
  614. */
  615. /* qdf_nbuf_set_sendcompleteflag(netbuf, TRUE); */
  616. if (send_complete_part2) {
  617. send_complete_part2(
  618. htt_pkt->soc_ctxt, htc_pkt->Status, netbuf);
  619. }
  620. /* free the htt_htc_pkt / HTC_PACKET object */
  621. htt_htc_pkt_free(soc, htt_pkt);
  622. }
  623. /*
  624. * htt_h2t_ver_req_msg() - Send HTT version request message to target
  625. * @htt_soc: HTT SOC handle
  626. *
  627. * Return: 0 on success; error code on failure
  628. */
  629. static int htt_h2t_ver_req_msg(struct htt_soc *soc)
  630. {
  631. struct dp_htt_htc_pkt *pkt;
  632. qdf_nbuf_t msg;
  633. uint32_t *msg_word;
  634. QDF_STATUS status;
  635. msg = qdf_nbuf_alloc(
  636. soc->osdev,
  637. HTT_MSG_BUF_SIZE(HTT_VER_REQ_BYTES),
  638. /* reserve room for the HTC header */
  639. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  640. if (!msg)
  641. return QDF_STATUS_E_NOMEM;
  642. /*
  643. * Set the length of the message.
  644. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  645. * separately during the below call to qdf_nbuf_push_head.
  646. * The contribution from the HTC header is added separately inside HTC.
  647. */
  648. if (qdf_nbuf_put_tail(msg, HTT_VER_REQ_BYTES) == NULL) {
  649. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  650. "%s: Failed to expand head for HTT_H2T_MSG_TYPE_VERSION_REQ msg",
  651. __func__);
  652. return QDF_STATUS_E_FAILURE;
  653. }
  654. /* fill in the message contents */
  655. msg_word = (u_int32_t *) qdf_nbuf_data(msg);
  656. /* rewind beyond alignment pad to get to the HTC header reserved area */
  657. qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
  658. *msg_word = 0;
  659. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_VERSION_REQ);
  660. pkt = htt_htc_pkt_alloc(soc);
  661. if (!pkt) {
  662. qdf_nbuf_free(msg);
  663. return QDF_STATUS_E_FAILURE;
  664. }
  665. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  666. SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
  667. dp_htt_h2t_send_complete_free_netbuf, qdf_nbuf_data(msg),
  668. qdf_nbuf_len(msg), soc->htc_endpoint,
  669. 1); /* tag - not relevant here */
  670. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
  671. status = DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_VERSION_REQ,
  672. NULL);
  673. if (status != QDF_STATUS_SUCCESS) {
  674. qdf_nbuf_free(msg);
  675. htt_htc_pkt_free(soc, pkt);
  676. }
  677. return status;
  678. }
  679. /*
  680. * htt_srng_setup() - Send SRNG setup message to target
  681. * @htt_soc: HTT SOC handle
  682. * @mac_id: MAC Id
  683. * @hal_srng: Opaque HAL SRNG pointer
  684. * @hal_ring_type: SRNG ring type
  685. *
  686. * Return: 0 on success; error code on failure
  687. */
  688. int htt_srng_setup(struct htt_soc *soc, int mac_id,
  689. hal_ring_handle_t hal_ring_hdl,
  690. int hal_ring_type)
  691. {
  692. struct dp_htt_htc_pkt *pkt;
  693. qdf_nbuf_t htt_msg;
  694. uint32_t *msg_word;
  695. struct hal_srng_params srng_params;
  696. qdf_dma_addr_t hp_addr, tp_addr;
  697. uint32_t ring_entry_size =
  698. hal_srng_get_entrysize(soc->hal_soc, hal_ring_type);
  699. int htt_ring_type, htt_ring_id;
  700. uint8_t *htt_logger_bufp;
  701. int target_pdev_id;
  702. int lmac_id = dp_get_lmac_id_for_pdev_id(soc->dp_soc, 0, mac_id);
  703. QDF_STATUS status;
  704. /* Sizes should be set in 4-byte words */
  705. ring_entry_size = ring_entry_size >> 2;
  706. htt_msg = qdf_nbuf_alloc(soc->osdev,
  707. HTT_MSG_BUF_SIZE(HTT_SRING_SETUP_SZ),
  708. /* reserve room for the HTC header */
  709. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  710. if (!htt_msg)
  711. goto fail0;
  712. hal_get_srng_params(soc->hal_soc, hal_ring_hdl, &srng_params);
  713. hp_addr = hal_srng_get_hp_addr(soc->hal_soc, hal_ring_hdl);
  714. tp_addr = hal_srng_get_tp_addr(soc->hal_soc, hal_ring_hdl);
  715. switch (hal_ring_type) {
  716. case RXDMA_BUF:
  717. #ifdef QCA_HOST2FW_RXBUF_RING
  718. if (srng_params.ring_id ==
  719. (HAL_SRNG_WMAC1_SW2RXDMA0_BUF0)) {
  720. htt_ring_id = HTT_HOST1_TO_FW_RXBUF_RING;
  721. htt_ring_type = HTT_SW_TO_SW_RING;
  722. #ifdef IPA_OFFLOAD
  723. } else if (srng_params.ring_id ==
  724. (HAL_SRNG_WMAC1_SW2RXDMA0_BUF2)) {
  725. htt_ring_id = HTT_HOST2_TO_FW_RXBUF_RING;
  726. htt_ring_type = HTT_SW_TO_SW_RING;
  727. #endif
  728. #else
  729. if (srng_params.ring_id ==
  730. (HAL_SRNG_WMAC1_SW2RXDMA0_BUF0 +
  731. (lmac_id * HAL_MAX_RINGS_PER_LMAC))) {
  732. htt_ring_id = HTT_RXDMA_HOST_BUF_RING;
  733. htt_ring_type = HTT_SW_TO_HW_RING;
  734. #endif
  735. } else if (srng_params.ring_id ==
  736. #ifdef IPA_OFFLOAD
  737. (HAL_SRNG_WMAC1_SW2RXDMA0_BUF1 +
  738. #else
  739. (HAL_SRNG_WMAC1_SW2RXDMA1_BUF +
  740. #endif
  741. (lmac_id * HAL_MAX_RINGS_PER_LMAC))) {
  742. htt_ring_id = HTT_RXDMA_HOST_BUF_RING;
  743. htt_ring_type = HTT_SW_TO_HW_RING;
  744. } else {
  745. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  746. "%s: Ring %d currently not supported",
  747. __func__, srng_params.ring_id);
  748. goto fail1;
  749. }
  750. dp_info("ring_type %d ring_id %d htt_ring_id %d hp_addr 0x%llx tp_addr 0x%llx",
  751. hal_ring_type, srng_params.ring_id, htt_ring_id,
  752. (uint64_t)hp_addr,
  753. (uint64_t)tp_addr);
  754. break;
  755. case RXDMA_MONITOR_BUF:
  756. htt_ring_id = HTT_RXDMA_MONITOR_BUF_RING;
  757. htt_ring_type = HTT_SW_TO_HW_RING;
  758. break;
  759. case RXDMA_MONITOR_STATUS:
  760. htt_ring_id = HTT_RXDMA_MONITOR_STATUS_RING;
  761. htt_ring_type = HTT_SW_TO_HW_RING;
  762. break;
  763. case RXDMA_MONITOR_DST:
  764. htt_ring_id = HTT_RXDMA_MONITOR_DEST_RING;
  765. htt_ring_type = HTT_HW_TO_SW_RING;
  766. break;
  767. case RXDMA_MONITOR_DESC:
  768. htt_ring_id = HTT_RXDMA_MONITOR_DESC_RING;
  769. htt_ring_type = HTT_SW_TO_HW_RING;
  770. break;
  771. case RXDMA_DST:
  772. htt_ring_id = HTT_RXDMA_NON_MONITOR_DEST_RING;
  773. htt_ring_type = HTT_HW_TO_SW_RING;
  774. break;
  775. default:
  776. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  777. "%s: Ring currently not supported", __func__);
  778. goto fail1;
  779. }
  780. /*
  781. * Set the length of the message.
  782. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  783. * separately during the below call to qdf_nbuf_push_head.
  784. * The contribution from the HTC header is added separately inside HTC.
  785. */
  786. if (qdf_nbuf_put_tail(htt_msg, HTT_SRING_SETUP_SZ) == NULL) {
  787. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  788. "%s: Failed to expand head for SRING_SETUP msg",
  789. __func__);
  790. return QDF_STATUS_E_FAILURE;
  791. }
  792. msg_word = (uint32_t *)qdf_nbuf_data(htt_msg);
  793. /* rewind beyond alignment pad to get to the HTC header reserved area */
  794. qdf_nbuf_push_head(htt_msg, HTC_HDR_ALIGNMENT_PADDING);
  795. /* word 0 */
  796. *msg_word = 0;
  797. htt_logger_bufp = (uint8_t *)msg_word;
  798. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_SRING_SETUP);
  799. target_pdev_id =
  800. dp_get_target_pdev_id_for_host_pdev_id(soc->dp_soc, mac_id);
  801. if ((htt_ring_type == HTT_SW_TO_HW_RING) ||
  802. (htt_ring_type == HTT_HW_TO_SW_RING))
  803. HTT_SRING_SETUP_PDEV_ID_SET(*msg_word, target_pdev_id);
  804. else
  805. HTT_SRING_SETUP_PDEV_ID_SET(*msg_word, mac_id);
  806. dp_info("%s: mac_id %d", __func__, mac_id);
  807. HTT_SRING_SETUP_RING_TYPE_SET(*msg_word, htt_ring_type);
  808. /* TODO: Discuss with FW on changing this to unique ID and using
  809. * htt_ring_type to send the type of ring
  810. */
  811. HTT_SRING_SETUP_RING_ID_SET(*msg_word, htt_ring_id);
  812. /* word 1 */
  813. msg_word++;
  814. *msg_word = 0;
  815. HTT_SRING_SETUP_RING_BASE_ADDR_LO_SET(*msg_word,
  816. srng_params.ring_base_paddr & 0xffffffff);
  817. /* word 2 */
  818. msg_word++;
  819. *msg_word = 0;
  820. HTT_SRING_SETUP_RING_BASE_ADDR_HI_SET(*msg_word,
  821. (uint64_t)srng_params.ring_base_paddr >> 32);
  822. /* word 3 */
  823. msg_word++;
  824. *msg_word = 0;
  825. HTT_SRING_SETUP_ENTRY_SIZE_SET(*msg_word, ring_entry_size);
  826. HTT_SRING_SETUP_RING_SIZE_SET(*msg_word,
  827. (ring_entry_size * srng_params.num_entries));
  828. dp_info("%s: entry_size %d", __func__, ring_entry_size);
  829. dp_info("%s: num_entries %d", __func__, srng_params.num_entries);
  830. dp_info("%s: ring_size %d", __func__,
  831. (ring_entry_size * srng_params.num_entries));
  832. if (htt_ring_type == HTT_SW_TO_HW_RING)
  833. HTT_SRING_SETUP_RING_MISC_CFG_FLAG_LOOPCOUNT_DISABLE_SET(
  834. *msg_word, 1);
  835. HTT_SRING_SETUP_RING_MISC_CFG_FLAG_MSI_SWAP_SET(*msg_word,
  836. !!(srng_params.flags & HAL_SRNG_MSI_SWAP));
  837. HTT_SRING_SETUP_RING_MISC_CFG_FLAG_TLV_SWAP_SET(*msg_word,
  838. !!(srng_params.flags & HAL_SRNG_DATA_TLV_SWAP));
  839. HTT_SRING_SETUP_RING_MISC_CFG_FLAG_HOST_FW_SWAP_SET(*msg_word,
  840. !!(srng_params.flags & HAL_SRNG_RING_PTR_SWAP));
  841. /* word 4 */
  842. msg_word++;
  843. *msg_word = 0;
  844. HTT_SRING_SETUP_HEAD_OFFSET32_REMOTE_BASE_ADDR_LO_SET(*msg_word,
  845. hp_addr & 0xffffffff);
  846. /* word 5 */
  847. msg_word++;
  848. *msg_word = 0;
  849. HTT_SRING_SETUP_HEAD_OFFSET32_REMOTE_BASE_ADDR_HI_SET(*msg_word,
  850. (uint64_t)hp_addr >> 32);
  851. /* word 6 */
  852. msg_word++;
  853. *msg_word = 0;
  854. HTT_SRING_SETUP_TAIL_OFFSET32_REMOTE_BASE_ADDR_LO_SET(*msg_word,
  855. tp_addr & 0xffffffff);
  856. /* word 7 */
  857. msg_word++;
  858. *msg_word = 0;
  859. HTT_SRING_SETUP_TAIL_OFFSET32_REMOTE_BASE_ADDR_HI_SET(*msg_word,
  860. (uint64_t)tp_addr >> 32);
  861. /* word 8 */
  862. msg_word++;
  863. *msg_word = 0;
  864. HTT_SRING_SETUP_RING_MSI_ADDR_LO_SET(*msg_word,
  865. srng_params.msi_addr & 0xffffffff);
  866. /* word 9 */
  867. msg_word++;
  868. *msg_word = 0;
  869. HTT_SRING_SETUP_RING_MSI_ADDR_HI_SET(*msg_word,
  870. (uint64_t)(srng_params.msi_addr) >> 32);
  871. /* word 10 */
  872. msg_word++;
  873. *msg_word = 0;
  874. HTT_SRING_SETUP_RING_MSI_DATA_SET(*msg_word,
  875. srng_params.msi_data);
  876. /* word 11 */
  877. msg_word++;
  878. *msg_word = 0;
  879. HTT_SRING_SETUP_INTR_BATCH_COUNTER_TH_SET(*msg_word,
  880. srng_params.intr_batch_cntr_thres_entries *
  881. ring_entry_size);
  882. HTT_SRING_SETUP_INTR_TIMER_TH_SET(*msg_word,
  883. srng_params.intr_timer_thres_us >> 3);
  884. /* word 12 */
  885. msg_word++;
  886. *msg_word = 0;
  887. if (srng_params.flags & HAL_SRNG_LOW_THRES_INTR_ENABLE) {
  888. /* TODO: Setting low threshold to 1/8th of ring size - see
  889. * if this needs to be configurable
  890. */
  891. HTT_SRING_SETUP_INTR_LOW_TH_SET(*msg_word,
  892. srng_params.low_threshold);
  893. }
  894. /* "response_required" field should be set if a HTT response message is
  895. * required after setting up the ring.
  896. */
  897. pkt = htt_htc_pkt_alloc(soc);
  898. if (!pkt)
  899. goto fail1;
  900. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  901. SET_HTC_PACKET_INFO_TX(
  902. &pkt->htc_pkt,
  903. dp_htt_h2t_send_complete_free_netbuf,
  904. qdf_nbuf_data(htt_msg),
  905. qdf_nbuf_len(htt_msg),
  906. soc->htc_endpoint,
  907. HTC_TX_PACKET_TAG_RUNTIME_PUT); /* tag for no FW response msg */
  908. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, htt_msg);
  909. status = DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_SRING_SETUP,
  910. htt_logger_bufp);
  911. if (status != QDF_STATUS_SUCCESS) {
  912. qdf_nbuf_free(htt_msg);
  913. htt_htc_pkt_free(soc, pkt);
  914. }
  915. return status;
  916. fail1:
  917. qdf_nbuf_free(htt_msg);
  918. fail0:
  919. return QDF_STATUS_E_FAILURE;
  920. }
  921. /*
  922. * htt_h2t_rx_ring_cfg() - Send SRNG packet and TLV filter
  923. * config message to target
  924. * @htt_soc: HTT SOC handle
  925. * @pdev_id: WIN- PDEV Id, MCL- mac id
  926. * @hal_srng: Opaque HAL SRNG pointer
  927. * @hal_ring_type: SRNG ring type
  928. * @ring_buf_size: SRNG buffer size
  929. * @htt_tlv_filter: Rx SRNG TLV and filter setting
  930. * Return: 0 on success; error code on failure
  931. */
  932. int htt_h2t_rx_ring_cfg(struct htt_soc *htt_soc, int pdev_id,
  933. hal_ring_handle_t hal_ring_hdl,
  934. int hal_ring_type, int ring_buf_size,
  935. struct htt_rx_ring_tlv_filter *htt_tlv_filter)
  936. {
  937. struct htt_soc *soc = (struct htt_soc *)htt_soc;
  938. struct dp_htt_htc_pkt *pkt;
  939. qdf_nbuf_t htt_msg;
  940. uint32_t *msg_word;
  941. struct hal_srng_params srng_params;
  942. uint32_t htt_ring_type, htt_ring_id;
  943. uint32_t tlv_filter;
  944. uint8_t *htt_logger_bufp;
  945. struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx = soc->dp_soc->wlan_cfg_ctx;
  946. uint32_t mon_drop_th = wlan_cfg_get_mon_drop_thresh(wlan_cfg_ctx);
  947. int target_pdev_id;
  948. QDF_STATUS status;
  949. htt_msg = qdf_nbuf_alloc(soc->osdev,
  950. HTT_MSG_BUF_SIZE(HTT_RX_RING_SELECTION_CFG_SZ),
  951. /* reserve room for the HTC header */
  952. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  953. if (!htt_msg)
  954. goto fail0;
  955. hal_get_srng_params(soc->hal_soc, hal_ring_hdl, &srng_params);
  956. switch (hal_ring_type) {
  957. case RXDMA_BUF:
  958. htt_ring_id = HTT_RXDMA_HOST_BUF_RING;
  959. htt_ring_type = HTT_SW_TO_HW_RING;
  960. break;
  961. case RXDMA_MONITOR_BUF:
  962. htt_ring_id = HTT_RXDMA_MONITOR_BUF_RING;
  963. htt_ring_type = HTT_SW_TO_HW_RING;
  964. break;
  965. case RXDMA_MONITOR_STATUS:
  966. htt_ring_id = HTT_RXDMA_MONITOR_STATUS_RING;
  967. htt_ring_type = HTT_SW_TO_HW_RING;
  968. break;
  969. case RXDMA_MONITOR_DST:
  970. htt_ring_id = HTT_RXDMA_MONITOR_DEST_RING;
  971. htt_ring_type = HTT_HW_TO_SW_RING;
  972. break;
  973. case RXDMA_MONITOR_DESC:
  974. htt_ring_id = HTT_RXDMA_MONITOR_DESC_RING;
  975. htt_ring_type = HTT_SW_TO_HW_RING;
  976. break;
  977. case RXDMA_DST:
  978. htt_ring_id = HTT_RXDMA_NON_MONITOR_DEST_RING;
  979. htt_ring_type = HTT_HW_TO_SW_RING;
  980. break;
  981. default:
  982. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  983. "%s: Ring currently not supported", __func__);
  984. goto fail1;
  985. }
  986. /*
  987. * Set the length of the message.
  988. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  989. * separately during the below call to qdf_nbuf_push_head.
  990. * The contribution from the HTC header is added separately inside HTC.
  991. */
  992. if (qdf_nbuf_put_tail(htt_msg, HTT_RX_RING_SELECTION_CFG_SZ) == NULL) {
  993. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  994. "%s: Failed to expand head for RX Ring Cfg msg",
  995. __func__);
  996. goto fail1; /* failure */
  997. }
  998. msg_word = (uint32_t *)qdf_nbuf_data(htt_msg);
  999. /* rewind beyond alignment pad to get to the HTC header reserved area */
  1000. qdf_nbuf_push_head(htt_msg, HTC_HDR_ALIGNMENT_PADDING);
  1001. /* word 0 */
  1002. htt_logger_bufp = (uint8_t *)msg_word;
  1003. *msg_word = 0;
  1004. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG);
  1005. /*
  1006. * pdev_id is indexed from 0 whereas mac_id is indexed from 1
  1007. * SW_TO_SW and SW_TO_HW rings are unaffected by this
  1008. */
  1009. target_pdev_id =
  1010. dp_get_target_pdev_id_for_host_pdev_id(soc->dp_soc, pdev_id);
  1011. if (htt_ring_type == HTT_SW_TO_SW_RING ||
  1012. htt_ring_type == HTT_SW_TO_HW_RING)
  1013. HTT_RX_RING_SELECTION_CFG_PDEV_ID_SET(*msg_word,
  1014. target_pdev_id);
  1015. /* TODO: Discuss with FW on changing this to unique ID and using
  1016. * htt_ring_type to send the type of ring
  1017. */
  1018. HTT_RX_RING_SELECTION_CFG_RING_ID_SET(*msg_word, htt_ring_id);
  1019. HTT_RX_RING_SELECTION_CFG_STATUS_TLV_SET(*msg_word,
  1020. !!(srng_params.flags & HAL_SRNG_MSI_SWAP));
  1021. HTT_RX_RING_SELECTION_CFG_PKT_TLV_SET(*msg_word,
  1022. !!(srng_params.flags & HAL_SRNG_DATA_TLV_SWAP));
  1023. HTT_RX_RING_SELECTION_CFG_RX_OFFSETS_VALID_SET(*msg_word,
  1024. htt_tlv_filter->offset_valid);
  1025. if (mon_drop_th > 0)
  1026. HTT_RX_RING_SELECTION_CFG_DROP_THRESHOLD_VALID_SET(*msg_word,
  1027. 1);
  1028. else
  1029. HTT_RX_RING_SELECTION_CFG_DROP_THRESHOLD_VALID_SET(*msg_word,
  1030. 0);
  1031. /* word 1 */
  1032. msg_word++;
  1033. *msg_word = 0;
  1034. HTT_RX_RING_SELECTION_CFG_RING_BUFFER_SIZE_SET(*msg_word,
  1035. ring_buf_size);
  1036. /* word 2 */
  1037. msg_word++;
  1038. *msg_word = 0;
  1039. if (htt_tlv_filter->enable_fp) {
  1040. /* TYPE: MGMT */
  1041. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1042. FP, MGMT, 0000,
  1043. (htt_tlv_filter->fp_mgmt_filter &
  1044. FILTER_MGMT_ASSOC_REQ) ? 1 : 0);
  1045. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1046. FP, MGMT, 0001,
  1047. (htt_tlv_filter->fp_mgmt_filter &
  1048. FILTER_MGMT_ASSOC_RES) ? 1 : 0);
  1049. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1050. FP, MGMT, 0010,
  1051. (htt_tlv_filter->fp_mgmt_filter &
  1052. FILTER_MGMT_REASSOC_REQ) ? 1 : 0);
  1053. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1054. FP, MGMT, 0011,
  1055. (htt_tlv_filter->fp_mgmt_filter &
  1056. FILTER_MGMT_REASSOC_RES) ? 1 : 0);
  1057. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1058. FP, MGMT, 0100,
  1059. (htt_tlv_filter->fp_mgmt_filter &
  1060. FILTER_MGMT_PROBE_REQ) ? 1 : 0);
  1061. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1062. FP, MGMT, 0101,
  1063. (htt_tlv_filter->fp_mgmt_filter &
  1064. FILTER_MGMT_PROBE_RES) ? 1 : 0);
  1065. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1066. FP, MGMT, 0110,
  1067. (htt_tlv_filter->fp_mgmt_filter &
  1068. FILTER_MGMT_TIM_ADVT) ? 1 : 0);
  1069. /* reserved */
  1070. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, FP,
  1071. MGMT, 0111,
  1072. (htt_tlv_filter->fp_mgmt_filter &
  1073. FILTER_MGMT_RESERVED_7) ? 1 : 0);
  1074. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1075. FP, MGMT, 1000,
  1076. (htt_tlv_filter->fp_mgmt_filter &
  1077. FILTER_MGMT_BEACON) ? 1 : 0);
  1078. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1079. FP, MGMT, 1001,
  1080. (htt_tlv_filter->fp_mgmt_filter &
  1081. FILTER_MGMT_ATIM) ? 1 : 0);
  1082. }
  1083. if (htt_tlv_filter->enable_md) {
  1084. /* TYPE: MGMT */
  1085. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1086. MD, MGMT, 0000,
  1087. (htt_tlv_filter->md_mgmt_filter &
  1088. FILTER_MGMT_ASSOC_REQ) ? 1 : 0);
  1089. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1090. MD, MGMT, 0001,
  1091. (htt_tlv_filter->md_mgmt_filter &
  1092. FILTER_MGMT_ASSOC_RES) ? 1 : 0);
  1093. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1094. MD, MGMT, 0010,
  1095. (htt_tlv_filter->md_mgmt_filter &
  1096. FILTER_MGMT_REASSOC_REQ) ? 1 : 0);
  1097. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1098. MD, MGMT, 0011,
  1099. (htt_tlv_filter->md_mgmt_filter &
  1100. FILTER_MGMT_REASSOC_RES) ? 1 : 0);
  1101. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1102. MD, MGMT, 0100,
  1103. (htt_tlv_filter->md_mgmt_filter &
  1104. FILTER_MGMT_PROBE_REQ) ? 1 : 0);
  1105. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1106. MD, MGMT, 0101,
  1107. (htt_tlv_filter->md_mgmt_filter &
  1108. FILTER_MGMT_PROBE_RES) ? 1 : 0);
  1109. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1110. MD, MGMT, 0110,
  1111. (htt_tlv_filter->md_mgmt_filter &
  1112. FILTER_MGMT_TIM_ADVT) ? 1 : 0);
  1113. /* reserved */
  1114. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MD,
  1115. MGMT, 0111,
  1116. (htt_tlv_filter->md_mgmt_filter &
  1117. FILTER_MGMT_RESERVED_7) ? 1 : 0);
  1118. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1119. MD, MGMT, 1000,
  1120. (htt_tlv_filter->md_mgmt_filter &
  1121. FILTER_MGMT_BEACON) ? 1 : 0);
  1122. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1123. MD, MGMT, 1001,
  1124. (htt_tlv_filter->md_mgmt_filter &
  1125. FILTER_MGMT_ATIM) ? 1 : 0);
  1126. }
  1127. if (htt_tlv_filter->enable_mo) {
  1128. /* TYPE: MGMT */
  1129. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1130. MO, MGMT, 0000,
  1131. (htt_tlv_filter->mo_mgmt_filter &
  1132. FILTER_MGMT_ASSOC_REQ) ? 1 : 0);
  1133. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1134. MO, MGMT, 0001,
  1135. (htt_tlv_filter->mo_mgmt_filter &
  1136. FILTER_MGMT_ASSOC_RES) ? 1 : 0);
  1137. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1138. MO, MGMT, 0010,
  1139. (htt_tlv_filter->mo_mgmt_filter &
  1140. FILTER_MGMT_REASSOC_REQ) ? 1 : 0);
  1141. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1142. MO, MGMT, 0011,
  1143. (htt_tlv_filter->mo_mgmt_filter &
  1144. FILTER_MGMT_REASSOC_RES) ? 1 : 0);
  1145. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1146. MO, MGMT, 0100,
  1147. (htt_tlv_filter->mo_mgmt_filter &
  1148. FILTER_MGMT_PROBE_REQ) ? 1 : 0);
  1149. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1150. MO, MGMT, 0101,
  1151. (htt_tlv_filter->mo_mgmt_filter &
  1152. FILTER_MGMT_PROBE_RES) ? 1 : 0);
  1153. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1154. MO, MGMT, 0110,
  1155. (htt_tlv_filter->mo_mgmt_filter &
  1156. FILTER_MGMT_TIM_ADVT) ? 1 : 0);
  1157. /* reserved */
  1158. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0, MO,
  1159. MGMT, 0111,
  1160. (htt_tlv_filter->mo_mgmt_filter &
  1161. FILTER_MGMT_RESERVED_7) ? 1 : 0);
  1162. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1163. MO, MGMT, 1000,
  1164. (htt_tlv_filter->mo_mgmt_filter &
  1165. FILTER_MGMT_BEACON) ? 1 : 0);
  1166. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
  1167. MO, MGMT, 1001,
  1168. (htt_tlv_filter->mo_mgmt_filter &
  1169. FILTER_MGMT_ATIM) ? 1 : 0);
  1170. }
  1171. /* word 3 */
  1172. msg_word++;
  1173. *msg_word = 0;
  1174. if (htt_tlv_filter->enable_fp) {
  1175. /* TYPE: MGMT */
  1176. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1177. FP, MGMT, 1010,
  1178. (htt_tlv_filter->fp_mgmt_filter &
  1179. FILTER_MGMT_DISASSOC) ? 1 : 0);
  1180. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1181. FP, MGMT, 1011,
  1182. (htt_tlv_filter->fp_mgmt_filter &
  1183. FILTER_MGMT_AUTH) ? 1 : 0);
  1184. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1185. FP, MGMT, 1100,
  1186. (htt_tlv_filter->fp_mgmt_filter &
  1187. FILTER_MGMT_DEAUTH) ? 1 : 0);
  1188. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1189. FP, MGMT, 1101,
  1190. (htt_tlv_filter->fp_mgmt_filter &
  1191. FILTER_MGMT_ACTION) ? 1 : 0);
  1192. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1193. FP, MGMT, 1110,
  1194. (htt_tlv_filter->fp_mgmt_filter &
  1195. FILTER_MGMT_ACT_NO_ACK) ? 1 : 0);
  1196. /* reserved*/
  1197. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, FP,
  1198. MGMT, 1111,
  1199. (htt_tlv_filter->fp_mgmt_filter &
  1200. FILTER_MGMT_RESERVED_15) ? 1 : 0);
  1201. }
  1202. if (htt_tlv_filter->enable_md) {
  1203. /* TYPE: MGMT */
  1204. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1205. MD, MGMT, 1010,
  1206. (htt_tlv_filter->md_mgmt_filter &
  1207. FILTER_MGMT_DISASSOC) ? 1 : 0);
  1208. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1209. MD, MGMT, 1011,
  1210. (htt_tlv_filter->md_mgmt_filter &
  1211. FILTER_MGMT_AUTH) ? 1 : 0);
  1212. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1213. MD, MGMT, 1100,
  1214. (htt_tlv_filter->md_mgmt_filter &
  1215. FILTER_MGMT_DEAUTH) ? 1 : 0);
  1216. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1217. MD, MGMT, 1101,
  1218. (htt_tlv_filter->md_mgmt_filter &
  1219. FILTER_MGMT_ACTION) ? 1 : 0);
  1220. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1221. MD, MGMT, 1110,
  1222. (htt_tlv_filter->md_mgmt_filter &
  1223. FILTER_MGMT_ACT_NO_ACK) ? 1 : 0);
  1224. }
  1225. if (htt_tlv_filter->enable_mo) {
  1226. /* TYPE: MGMT */
  1227. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1228. MO, MGMT, 1010,
  1229. (htt_tlv_filter->mo_mgmt_filter &
  1230. FILTER_MGMT_DISASSOC) ? 1 : 0);
  1231. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1232. MO, MGMT, 1011,
  1233. (htt_tlv_filter->mo_mgmt_filter &
  1234. FILTER_MGMT_AUTH) ? 1 : 0);
  1235. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1236. MO, MGMT, 1100,
  1237. (htt_tlv_filter->mo_mgmt_filter &
  1238. FILTER_MGMT_DEAUTH) ? 1 : 0);
  1239. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1240. MO, MGMT, 1101,
  1241. (htt_tlv_filter->mo_mgmt_filter &
  1242. FILTER_MGMT_ACTION) ? 1 : 0);
  1243. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
  1244. MO, MGMT, 1110,
  1245. (htt_tlv_filter->mo_mgmt_filter &
  1246. FILTER_MGMT_ACT_NO_ACK) ? 1 : 0);
  1247. /* reserved*/
  1248. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1, MO,
  1249. MGMT, 1111,
  1250. (htt_tlv_filter->mo_mgmt_filter &
  1251. FILTER_MGMT_RESERVED_15) ? 1 : 0);
  1252. }
  1253. /* word 4 */
  1254. msg_word++;
  1255. *msg_word = 0;
  1256. if (htt_tlv_filter->enable_fp) {
  1257. /* TYPE: CTRL */
  1258. /* reserved */
  1259. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1260. CTRL, 0000,
  1261. (htt_tlv_filter->fp_ctrl_filter &
  1262. FILTER_CTRL_RESERVED_1) ? 1 : 0);
  1263. /* reserved */
  1264. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1265. CTRL, 0001,
  1266. (htt_tlv_filter->fp_ctrl_filter &
  1267. FILTER_CTRL_RESERVED_2) ? 1 : 0);
  1268. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1269. CTRL, 0010,
  1270. (htt_tlv_filter->fp_ctrl_filter &
  1271. FILTER_CTRL_TRIGGER) ? 1 : 0);
  1272. /* reserved */
  1273. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1274. CTRL, 0011,
  1275. (htt_tlv_filter->fp_ctrl_filter &
  1276. FILTER_CTRL_RESERVED_4) ? 1 : 0);
  1277. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1278. CTRL, 0100,
  1279. (htt_tlv_filter->fp_ctrl_filter &
  1280. FILTER_CTRL_BF_REP_POLL) ? 1 : 0);
  1281. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1282. CTRL, 0101,
  1283. (htt_tlv_filter->fp_ctrl_filter &
  1284. FILTER_CTRL_VHT_NDP) ? 1 : 0);
  1285. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1286. CTRL, 0110,
  1287. (htt_tlv_filter->fp_ctrl_filter &
  1288. FILTER_CTRL_FRAME_EXT) ? 1 : 0);
  1289. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1290. CTRL, 0111,
  1291. (htt_tlv_filter->fp_ctrl_filter &
  1292. FILTER_CTRL_CTRLWRAP) ? 1 : 0);
  1293. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1294. CTRL, 1000,
  1295. (htt_tlv_filter->fp_ctrl_filter &
  1296. FILTER_CTRL_BA_REQ) ? 1 : 0);
  1297. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, FP,
  1298. CTRL, 1001,
  1299. (htt_tlv_filter->fp_ctrl_filter &
  1300. FILTER_CTRL_BA) ? 1 : 0);
  1301. }
  1302. if (htt_tlv_filter->enable_md) {
  1303. /* TYPE: CTRL */
  1304. /* reserved */
  1305. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1306. CTRL, 0000,
  1307. (htt_tlv_filter->md_ctrl_filter &
  1308. FILTER_CTRL_RESERVED_1) ? 1 : 0);
  1309. /* reserved */
  1310. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1311. CTRL, 0001,
  1312. (htt_tlv_filter->md_ctrl_filter &
  1313. FILTER_CTRL_RESERVED_2) ? 1 : 0);
  1314. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1315. CTRL, 0010,
  1316. (htt_tlv_filter->md_ctrl_filter &
  1317. FILTER_CTRL_TRIGGER) ? 1 : 0);
  1318. /* reserved */
  1319. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1320. CTRL, 0011,
  1321. (htt_tlv_filter->md_ctrl_filter &
  1322. FILTER_CTRL_RESERVED_4) ? 1 : 0);
  1323. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1324. CTRL, 0100,
  1325. (htt_tlv_filter->md_ctrl_filter &
  1326. FILTER_CTRL_BF_REP_POLL) ? 1 : 0);
  1327. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1328. CTRL, 0101,
  1329. (htt_tlv_filter->md_ctrl_filter &
  1330. FILTER_CTRL_VHT_NDP) ? 1 : 0);
  1331. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1332. CTRL, 0110,
  1333. (htt_tlv_filter->md_ctrl_filter &
  1334. FILTER_CTRL_FRAME_EXT) ? 1 : 0);
  1335. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1336. CTRL, 0111,
  1337. (htt_tlv_filter->md_ctrl_filter &
  1338. FILTER_CTRL_CTRLWRAP) ? 1 : 0);
  1339. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1340. CTRL, 1000,
  1341. (htt_tlv_filter->md_ctrl_filter &
  1342. FILTER_CTRL_BA_REQ) ? 1 : 0);
  1343. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MD,
  1344. CTRL, 1001,
  1345. (htt_tlv_filter->md_ctrl_filter &
  1346. FILTER_CTRL_BA) ? 1 : 0);
  1347. }
  1348. if (htt_tlv_filter->enable_mo) {
  1349. /* TYPE: CTRL */
  1350. /* reserved */
  1351. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1352. CTRL, 0000,
  1353. (htt_tlv_filter->mo_ctrl_filter &
  1354. FILTER_CTRL_RESERVED_1) ? 1 : 0);
  1355. /* reserved */
  1356. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1357. CTRL, 0001,
  1358. (htt_tlv_filter->mo_ctrl_filter &
  1359. FILTER_CTRL_RESERVED_2) ? 1 : 0);
  1360. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1361. CTRL, 0010,
  1362. (htt_tlv_filter->mo_ctrl_filter &
  1363. FILTER_CTRL_TRIGGER) ? 1 : 0);
  1364. /* reserved */
  1365. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1366. CTRL, 0011,
  1367. (htt_tlv_filter->mo_ctrl_filter &
  1368. FILTER_CTRL_RESERVED_4) ? 1 : 0);
  1369. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1370. CTRL, 0100,
  1371. (htt_tlv_filter->mo_ctrl_filter &
  1372. FILTER_CTRL_BF_REP_POLL) ? 1 : 0);
  1373. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1374. CTRL, 0101,
  1375. (htt_tlv_filter->mo_ctrl_filter &
  1376. FILTER_CTRL_VHT_NDP) ? 1 : 0);
  1377. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1378. CTRL, 0110,
  1379. (htt_tlv_filter->mo_ctrl_filter &
  1380. FILTER_CTRL_FRAME_EXT) ? 1 : 0);
  1381. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1382. CTRL, 0111,
  1383. (htt_tlv_filter->mo_ctrl_filter &
  1384. FILTER_CTRL_CTRLWRAP) ? 1 : 0);
  1385. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1386. CTRL, 1000,
  1387. (htt_tlv_filter->mo_ctrl_filter &
  1388. FILTER_CTRL_BA_REQ) ? 1 : 0);
  1389. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG2, MO,
  1390. CTRL, 1001,
  1391. (htt_tlv_filter->mo_ctrl_filter &
  1392. FILTER_CTRL_BA) ? 1 : 0);
  1393. }
  1394. /* word 5 */
  1395. msg_word++;
  1396. *msg_word = 0;
  1397. if (htt_tlv_filter->enable_fp) {
  1398. /* TYPE: CTRL */
  1399. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  1400. CTRL, 1010,
  1401. (htt_tlv_filter->fp_ctrl_filter &
  1402. FILTER_CTRL_PSPOLL) ? 1 : 0);
  1403. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  1404. CTRL, 1011,
  1405. (htt_tlv_filter->fp_ctrl_filter &
  1406. FILTER_CTRL_RTS) ? 1 : 0);
  1407. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  1408. CTRL, 1100,
  1409. (htt_tlv_filter->fp_ctrl_filter &
  1410. FILTER_CTRL_CTS) ? 1 : 0);
  1411. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  1412. CTRL, 1101,
  1413. (htt_tlv_filter->fp_ctrl_filter &
  1414. FILTER_CTRL_ACK) ? 1 : 0);
  1415. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  1416. CTRL, 1110,
  1417. (htt_tlv_filter->fp_ctrl_filter &
  1418. FILTER_CTRL_CFEND) ? 1 : 0);
  1419. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  1420. CTRL, 1111,
  1421. (htt_tlv_filter->fp_ctrl_filter &
  1422. FILTER_CTRL_CFEND_CFACK) ? 1 : 0);
  1423. /* TYPE: DATA */
  1424. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  1425. DATA, MCAST,
  1426. (htt_tlv_filter->fp_data_filter &
  1427. FILTER_DATA_MCAST) ? 1 : 0);
  1428. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  1429. DATA, UCAST,
  1430. (htt_tlv_filter->fp_data_filter &
  1431. FILTER_DATA_UCAST) ? 1 : 0);
  1432. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, FP,
  1433. DATA, NULL,
  1434. (htt_tlv_filter->fp_data_filter &
  1435. FILTER_DATA_NULL) ? 1 : 0);
  1436. }
  1437. if (htt_tlv_filter->enable_md) {
  1438. /* TYPE: CTRL */
  1439. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  1440. CTRL, 1010,
  1441. (htt_tlv_filter->md_ctrl_filter &
  1442. FILTER_CTRL_PSPOLL) ? 1 : 0);
  1443. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  1444. CTRL, 1011,
  1445. (htt_tlv_filter->md_ctrl_filter &
  1446. FILTER_CTRL_RTS) ? 1 : 0);
  1447. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  1448. CTRL, 1100,
  1449. (htt_tlv_filter->md_ctrl_filter &
  1450. FILTER_CTRL_CTS) ? 1 : 0);
  1451. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  1452. CTRL, 1101,
  1453. (htt_tlv_filter->md_ctrl_filter &
  1454. FILTER_CTRL_ACK) ? 1 : 0);
  1455. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  1456. CTRL, 1110,
  1457. (htt_tlv_filter->md_ctrl_filter &
  1458. FILTER_CTRL_CFEND) ? 1 : 0);
  1459. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  1460. CTRL, 1111,
  1461. (htt_tlv_filter->md_ctrl_filter &
  1462. FILTER_CTRL_CFEND_CFACK) ? 1 : 0);
  1463. /* TYPE: DATA */
  1464. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  1465. DATA, MCAST,
  1466. (htt_tlv_filter->md_data_filter &
  1467. FILTER_DATA_MCAST) ? 1 : 0);
  1468. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  1469. DATA, UCAST,
  1470. (htt_tlv_filter->md_data_filter &
  1471. FILTER_DATA_UCAST) ? 1 : 0);
  1472. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MD,
  1473. DATA, NULL,
  1474. (htt_tlv_filter->md_data_filter &
  1475. FILTER_DATA_NULL) ? 1 : 0);
  1476. }
  1477. if (htt_tlv_filter->enable_mo) {
  1478. /* TYPE: CTRL */
  1479. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  1480. CTRL, 1010,
  1481. (htt_tlv_filter->mo_ctrl_filter &
  1482. FILTER_CTRL_PSPOLL) ? 1 : 0);
  1483. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  1484. CTRL, 1011,
  1485. (htt_tlv_filter->mo_ctrl_filter &
  1486. FILTER_CTRL_RTS) ? 1 : 0);
  1487. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  1488. CTRL, 1100,
  1489. (htt_tlv_filter->mo_ctrl_filter &
  1490. FILTER_CTRL_CTS) ? 1 : 0);
  1491. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  1492. CTRL, 1101,
  1493. (htt_tlv_filter->mo_ctrl_filter &
  1494. FILTER_CTRL_ACK) ? 1 : 0);
  1495. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  1496. CTRL, 1110,
  1497. (htt_tlv_filter->mo_ctrl_filter &
  1498. FILTER_CTRL_CFEND) ? 1 : 0);
  1499. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  1500. CTRL, 1111,
  1501. (htt_tlv_filter->mo_ctrl_filter &
  1502. FILTER_CTRL_CFEND_CFACK) ? 1 : 0);
  1503. /* TYPE: DATA */
  1504. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  1505. DATA, MCAST,
  1506. (htt_tlv_filter->mo_data_filter &
  1507. FILTER_DATA_MCAST) ? 1 : 0);
  1508. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  1509. DATA, UCAST,
  1510. (htt_tlv_filter->mo_data_filter &
  1511. FILTER_DATA_UCAST) ? 1 : 0);
  1512. htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG3, MO,
  1513. DATA, NULL,
  1514. (htt_tlv_filter->mo_data_filter &
  1515. FILTER_DATA_NULL) ? 1 : 0);
  1516. }
  1517. /* word 6 */
  1518. msg_word++;
  1519. *msg_word = 0;
  1520. tlv_filter = 0;
  1521. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MPDU_START,
  1522. htt_tlv_filter->mpdu_start);
  1523. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MSDU_START,
  1524. htt_tlv_filter->msdu_start);
  1525. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PACKET,
  1526. htt_tlv_filter->packet);
  1527. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MSDU_END,
  1528. htt_tlv_filter->msdu_end);
  1529. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, MPDU_END,
  1530. htt_tlv_filter->mpdu_end);
  1531. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PACKET_HEADER,
  1532. htt_tlv_filter->packet_header);
  1533. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, ATTENTION,
  1534. htt_tlv_filter->attention);
  1535. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_START,
  1536. htt_tlv_filter->ppdu_start);
  1537. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_END,
  1538. htt_tlv_filter->ppdu_end);
  1539. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_END_USER_STATS,
  1540. htt_tlv_filter->ppdu_end_user_stats);
  1541. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter,
  1542. PPDU_END_USER_STATS_EXT,
  1543. htt_tlv_filter->ppdu_end_user_stats_ext);
  1544. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, PPDU_END_STATUS_DONE,
  1545. htt_tlv_filter->ppdu_end_status_done);
  1546. /* RESERVED bit maps to header_per_msdu in htt_tlv_filter*/
  1547. htt_rx_ring_tlv_filter_in_enable_set(tlv_filter, RESERVED,
  1548. htt_tlv_filter->header_per_msdu);
  1549. HTT_RX_RING_SELECTION_CFG_TLV_FILTER_IN_FLAG_SET(*msg_word, tlv_filter);
  1550. msg_word++;
  1551. *msg_word = 0;
  1552. if (htt_tlv_filter->offset_valid) {
  1553. HTT_RX_RING_SELECTION_CFG_RX_PACKET_OFFSET_SET(*msg_word,
  1554. htt_tlv_filter->rx_packet_offset);
  1555. HTT_RX_RING_SELECTION_CFG_RX_HEADER_OFFSET_SET(*msg_word,
  1556. htt_tlv_filter->rx_header_offset);
  1557. msg_word++;
  1558. *msg_word = 0;
  1559. HTT_RX_RING_SELECTION_CFG_RX_MPDU_END_OFFSET_SET(*msg_word,
  1560. htt_tlv_filter->rx_mpdu_end_offset);
  1561. HTT_RX_RING_SELECTION_CFG_RX_MPDU_START_OFFSET_SET(*msg_word,
  1562. htt_tlv_filter->rx_mpdu_start_offset);
  1563. msg_word++;
  1564. *msg_word = 0;
  1565. HTT_RX_RING_SELECTION_CFG_RX_MSDU_END_OFFSET_SET(*msg_word,
  1566. htt_tlv_filter->rx_msdu_end_offset);
  1567. HTT_RX_RING_SELECTION_CFG_RX_MSDU_START_OFFSET_SET(*msg_word,
  1568. htt_tlv_filter->rx_msdu_start_offset);
  1569. msg_word++;
  1570. *msg_word = 0;
  1571. HTT_RX_RING_SELECTION_CFG_RX_ATTENTION_OFFSET_SET(*msg_word,
  1572. htt_tlv_filter->rx_attn_offset);
  1573. msg_word++;
  1574. *msg_word = 0;
  1575. } else {
  1576. msg_word += 4;
  1577. *msg_word = 0;
  1578. }
  1579. if (mon_drop_th > 0)
  1580. HTT_RX_RING_SELECTION_CFG_RX_DROP_THRESHOLD_SET(*msg_word,
  1581. mon_drop_th);
  1582. /* "response_required" field should be set if a HTT response message is
  1583. * required after setting up the ring.
  1584. */
  1585. pkt = htt_htc_pkt_alloc(soc);
  1586. if (!pkt)
  1587. goto fail1;
  1588. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  1589. SET_HTC_PACKET_INFO_TX(
  1590. &pkt->htc_pkt,
  1591. dp_htt_h2t_send_complete_free_netbuf,
  1592. qdf_nbuf_data(htt_msg),
  1593. qdf_nbuf_len(htt_msg),
  1594. soc->htc_endpoint,
  1595. 1); /* tag - not relevant here */
  1596. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, htt_msg);
  1597. status = DP_HTT_SEND_HTC_PKT(soc, pkt,
  1598. HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG,
  1599. htt_logger_bufp);
  1600. if (status != QDF_STATUS_SUCCESS) {
  1601. qdf_nbuf_free(htt_msg);
  1602. htt_htc_pkt_free(soc, pkt);
  1603. }
  1604. return status;
  1605. fail1:
  1606. qdf_nbuf_free(htt_msg);
  1607. fail0:
  1608. return QDF_STATUS_E_FAILURE;
  1609. }
  1610. #if defined(HTT_STATS_ENABLE)
  1611. static inline QDF_STATUS dp_send_htt_stat_resp(struct htt_stats_context *htt_stats,
  1612. struct dp_soc *soc, qdf_nbuf_t htt_msg)
  1613. {
  1614. uint32_t pdev_id;
  1615. uint32_t *msg_word = NULL;
  1616. uint32_t msg_remain_len = 0;
  1617. msg_word = (uint32_t *) qdf_nbuf_data(htt_msg);
  1618. /*COOKIE MSB*/
  1619. pdev_id = *(msg_word + 2) & HTT_PID_BIT_MASK;
  1620. /* stats message length + 16 size of HTT header*/
  1621. msg_remain_len = qdf_min(htt_stats->msg_len + 16,
  1622. (uint32_t)DP_EXT_MSG_LENGTH);
  1623. dp_wdi_event_handler(WDI_EVENT_HTT_STATS, soc,
  1624. msg_word, msg_remain_len,
  1625. WDI_NO_VAL, pdev_id);
  1626. if (htt_stats->msg_len >= DP_EXT_MSG_LENGTH) {
  1627. htt_stats->msg_len -= DP_EXT_MSG_LENGTH;
  1628. }
  1629. /* Need to be freed here as WDI handler will
  1630. * make a copy of pkt to send data to application
  1631. */
  1632. qdf_nbuf_free(htt_msg);
  1633. return QDF_STATUS_SUCCESS;
  1634. }
  1635. #else
  1636. static inline QDF_STATUS
  1637. dp_send_htt_stat_resp(struct htt_stats_context *htt_stats,
  1638. struct dp_soc *soc, qdf_nbuf_t htt_msg)
  1639. {
  1640. return QDF_STATUS_E_NOSUPPORT;
  1641. }
  1642. #endif
  1643. /**
  1644. * dp_process_htt_stat_msg(): Process the list of buffers of HTT EXT stats
  1645. * @htt_stats: htt stats info
  1646. *
  1647. * The FW sends the HTT EXT STATS as a stream of T2H messages. Each T2H message
  1648. * contains sub messages which are identified by a TLV header.
  1649. * In this function we will process the stream of T2H messages and read all the
  1650. * TLV contained in the message.
  1651. *
  1652. * THe following cases have been taken care of
  1653. * Case 1: When the tlv_remain_length <= msg_remain_length of HTT MSG buffer
  1654. * In this case the buffer will contain multiple tlvs.
  1655. * Case 2: When the tlv_remain_length > msg_remain_length of HTT MSG buffer.
  1656. * Only one tlv will be contained in the HTT message and this tag
  1657. * will extend onto the next buffer.
  1658. * Case 3: When the buffer is the continuation of the previous message
  1659. * Case 4: tlv length is 0. which will indicate the end of message
  1660. *
  1661. * return: void
  1662. */
  1663. static inline void dp_process_htt_stat_msg(struct htt_stats_context *htt_stats,
  1664. struct dp_soc *soc)
  1665. {
  1666. htt_tlv_tag_t tlv_type = 0xff;
  1667. qdf_nbuf_t htt_msg = NULL;
  1668. uint32_t *msg_word;
  1669. uint8_t *tlv_buf_head = NULL;
  1670. uint8_t *tlv_buf_tail = NULL;
  1671. uint32_t msg_remain_len = 0;
  1672. uint32_t tlv_remain_len = 0;
  1673. uint32_t *tlv_start;
  1674. int cookie_val;
  1675. int cookie_msb;
  1676. int pdev_id;
  1677. bool copy_stats = false;
  1678. struct dp_pdev *pdev;
  1679. /* Process node in the HTT message queue */
  1680. while ((htt_msg = qdf_nbuf_queue_remove(&htt_stats->msg))
  1681. != NULL) {
  1682. msg_word = (uint32_t *) qdf_nbuf_data(htt_msg);
  1683. cookie_val = *(msg_word + 1);
  1684. htt_stats->msg_len = HTT_T2H_EXT_STATS_CONF_TLV_LENGTH_GET(
  1685. *(msg_word +
  1686. HTT_T2H_EXT_STATS_TLV_START_OFFSET));
  1687. if (cookie_val) {
  1688. if (dp_send_htt_stat_resp(htt_stats, soc, htt_msg)
  1689. == QDF_STATUS_SUCCESS) {
  1690. continue;
  1691. }
  1692. }
  1693. cookie_msb = *(msg_word + 2);
  1694. pdev_id = *(msg_word + 2) & HTT_PID_BIT_MASK;
  1695. pdev = soc->pdev_list[pdev_id];
  1696. if (cookie_msb >> 2) {
  1697. copy_stats = true;
  1698. }
  1699. /* read 5th word */
  1700. msg_word = msg_word + 4;
  1701. msg_remain_len = qdf_min(htt_stats->msg_len,
  1702. (uint32_t) DP_EXT_MSG_LENGTH);
  1703. /* Keep processing the node till node length is 0 */
  1704. while (msg_remain_len) {
  1705. /*
  1706. * if message is not a continuation of previous message
  1707. * read the tlv type and tlv length
  1708. */
  1709. if (!tlv_buf_head) {
  1710. tlv_type = HTT_STATS_TLV_TAG_GET(
  1711. *msg_word);
  1712. tlv_remain_len = HTT_STATS_TLV_LENGTH_GET(
  1713. *msg_word);
  1714. }
  1715. if (tlv_remain_len == 0) {
  1716. msg_remain_len = 0;
  1717. if (tlv_buf_head) {
  1718. qdf_mem_free(tlv_buf_head);
  1719. tlv_buf_head = NULL;
  1720. tlv_buf_tail = NULL;
  1721. }
  1722. goto error;
  1723. }
  1724. if (!tlv_buf_head)
  1725. tlv_remain_len += HTT_TLV_HDR_LEN;
  1726. if ((tlv_remain_len <= msg_remain_len)) {
  1727. /* Case 3 */
  1728. if (tlv_buf_head) {
  1729. qdf_mem_copy(tlv_buf_tail,
  1730. (uint8_t *)msg_word,
  1731. tlv_remain_len);
  1732. tlv_start = (uint32_t *)tlv_buf_head;
  1733. } else {
  1734. /* Case 1 */
  1735. tlv_start = msg_word;
  1736. }
  1737. if (copy_stats)
  1738. dp_htt_stats_copy_tag(pdev,
  1739. tlv_type,
  1740. tlv_start);
  1741. else
  1742. dp_htt_stats_print_tag(pdev,
  1743. tlv_type,
  1744. tlv_start);
  1745. if (tlv_type == HTT_STATS_PEER_DETAILS_TAG ||
  1746. tlv_type == HTT_STATS_PEER_STATS_CMN_TAG)
  1747. dp_peer_update_inactive_time(pdev,
  1748. tlv_type,
  1749. tlv_start);
  1750. msg_remain_len -= tlv_remain_len;
  1751. msg_word = (uint32_t *)
  1752. (((uint8_t *)msg_word) +
  1753. tlv_remain_len);
  1754. tlv_remain_len = 0;
  1755. if (tlv_buf_head) {
  1756. qdf_mem_free(tlv_buf_head);
  1757. tlv_buf_head = NULL;
  1758. tlv_buf_tail = NULL;
  1759. }
  1760. } else { /* tlv_remain_len > msg_remain_len */
  1761. /* Case 2 & 3 */
  1762. if (!tlv_buf_head) {
  1763. tlv_buf_head = qdf_mem_malloc(
  1764. tlv_remain_len);
  1765. if (!tlv_buf_head) {
  1766. QDF_TRACE(QDF_MODULE_ID_TXRX,
  1767. QDF_TRACE_LEVEL_ERROR,
  1768. "Alloc failed");
  1769. goto error;
  1770. }
  1771. tlv_buf_tail = tlv_buf_head;
  1772. }
  1773. qdf_mem_copy(tlv_buf_tail, (uint8_t *)msg_word,
  1774. msg_remain_len);
  1775. tlv_remain_len -= msg_remain_len;
  1776. tlv_buf_tail += msg_remain_len;
  1777. }
  1778. }
  1779. if (htt_stats->msg_len >= DP_EXT_MSG_LENGTH) {
  1780. htt_stats->msg_len -= DP_EXT_MSG_LENGTH;
  1781. }
  1782. qdf_nbuf_free(htt_msg);
  1783. }
  1784. return;
  1785. error:
  1786. qdf_nbuf_free(htt_msg);
  1787. while ((htt_msg = qdf_nbuf_queue_remove(&htt_stats->msg))
  1788. != NULL)
  1789. qdf_nbuf_free(htt_msg);
  1790. }
  1791. void htt_t2h_stats_handler(void *context)
  1792. {
  1793. struct dp_soc *soc = (struct dp_soc *)context;
  1794. struct htt_stats_context htt_stats;
  1795. uint32_t *msg_word;
  1796. qdf_nbuf_t htt_msg = NULL;
  1797. uint8_t done;
  1798. uint32_t rem_stats;
  1799. if (!soc || !qdf_atomic_read(&soc->cmn_init_done)) {
  1800. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  1801. "soc: 0x%pK, init_done: %d", soc,
  1802. qdf_atomic_read(&soc->cmn_init_done));
  1803. return;
  1804. }
  1805. qdf_mem_zero(&htt_stats, sizeof(htt_stats));
  1806. qdf_nbuf_queue_init(&htt_stats.msg);
  1807. /* pull one completed stats from soc->htt_stats_msg and process */
  1808. qdf_spin_lock_bh(&soc->htt_stats.lock);
  1809. if (!soc->htt_stats.num_stats) {
  1810. qdf_spin_unlock_bh(&soc->htt_stats.lock);
  1811. return;
  1812. }
  1813. while ((htt_msg = qdf_nbuf_queue_remove(&soc->htt_stats.msg)) != NULL) {
  1814. msg_word = (uint32_t *) qdf_nbuf_data(htt_msg);
  1815. msg_word = msg_word + HTT_T2H_EXT_STATS_TLV_START_OFFSET;
  1816. done = HTT_T2H_EXT_STATS_CONF_TLV_DONE_GET(*msg_word);
  1817. qdf_nbuf_queue_add(&htt_stats.msg, htt_msg);
  1818. /*
  1819. * Done bit signifies that this is the last T2H buffer in the
  1820. * stream of HTT EXT STATS message
  1821. */
  1822. if (done)
  1823. break;
  1824. }
  1825. rem_stats = --soc->htt_stats.num_stats;
  1826. qdf_spin_unlock_bh(&soc->htt_stats.lock);
  1827. /* If there are more stats to process, schedule stats work again.
  1828. * Scheduling prior to processing ht_stats to queue with early
  1829. * index
  1830. */
  1831. if (rem_stats)
  1832. qdf_sched_work(0, &soc->htt_stats.work);
  1833. dp_process_htt_stat_msg(&htt_stats, soc);
  1834. }
  1835. /*
  1836. * dp_get_ppdu_info_user_index: Find and allocate a per-user descriptor for a PPDU,
  1837. * if a new peer id arrives in a PPDU
  1838. * pdev: DP pdev handle
  1839. * @peer_id : peer unique identifier
  1840. * @ppdu_info: per ppdu tlv structure
  1841. *
  1842. * return:user index to be populated
  1843. */
  1844. #ifdef FEATURE_PERPKT_INFO
  1845. static uint8_t dp_get_ppdu_info_user_index(struct dp_pdev *pdev,
  1846. uint16_t peer_id,
  1847. struct ppdu_info *ppdu_info)
  1848. {
  1849. uint8_t user_index = 0;
  1850. struct cdp_tx_completion_ppdu *ppdu_desc;
  1851. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  1852. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  1853. while ((user_index + 1) <= ppdu_info->last_user) {
  1854. ppdu_user_desc = &ppdu_desc->user[user_index];
  1855. if (ppdu_user_desc->peer_id != peer_id) {
  1856. user_index++;
  1857. continue;
  1858. } else {
  1859. /* Max users possible is 8 so user array index should
  1860. * not exceed 7
  1861. */
  1862. qdf_assert_always(user_index <= CDP_MU_MAX_USER_INDEX);
  1863. return user_index;
  1864. }
  1865. }
  1866. ppdu_info->last_user++;
  1867. /* Max users possible is 8 so last user should not exceed 8 */
  1868. qdf_assert_always(ppdu_info->last_user <= CDP_MU_MAX_USERS);
  1869. return ppdu_info->last_user - 1;
  1870. }
  1871. /*
  1872. * dp_process_ppdu_stats_common_tlv: Process htt_ppdu_stats_common_tlv
  1873. * pdev: DP pdev handle
  1874. * @tag_buf: buffer containing the tlv htt_ppdu_stats_common_tlv
  1875. * @ppdu_info: per ppdu tlv structure
  1876. *
  1877. * return:void
  1878. */
  1879. static void dp_process_ppdu_stats_common_tlv(struct dp_pdev *pdev,
  1880. uint32_t *tag_buf, struct ppdu_info *ppdu_info)
  1881. {
  1882. uint16_t frame_type;
  1883. uint16_t frame_ctrl;
  1884. uint16_t freq;
  1885. struct dp_soc *soc = NULL;
  1886. struct cdp_tx_completion_ppdu *ppdu_desc = NULL;
  1887. uint64_t ppdu_start_timestamp;
  1888. uint32_t *start_tag_buf;
  1889. start_tag_buf = tag_buf;
  1890. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  1891. tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(RING_ID_SCH_CMD_ID);
  1892. ppdu_info->sched_cmdid =
  1893. HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_GET(*tag_buf);
  1894. ppdu_desc->num_users =
  1895. HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_GET(*tag_buf);
  1896. tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(QTYPE_FRM_TYPE);
  1897. frame_type = HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_GET(*tag_buf);
  1898. ppdu_desc->htt_frame_type = frame_type;
  1899. frame_ctrl = ppdu_desc->frame_ctrl;
  1900. switch (frame_type) {
  1901. case HTT_STATS_FTYPE_TIDQ_DATA_SU:
  1902. case HTT_STATS_FTYPE_TIDQ_DATA_MU:
  1903. case HTT_STATS_FTYPE_SGEN_QOS_NULL:
  1904. /*
  1905. * for management packet, frame type come as DATA_SU
  1906. * need to check frame_ctrl before setting frame_type
  1907. */
  1908. if (HTT_GET_FRAME_CTRL_TYPE(frame_ctrl) <= FRAME_CTRL_TYPE_CTRL)
  1909. ppdu_desc->frame_type = CDP_PPDU_FTYPE_CTRL;
  1910. else
  1911. ppdu_desc->frame_type = CDP_PPDU_FTYPE_DATA;
  1912. break;
  1913. case HTT_STATS_FTYPE_SGEN_MU_BAR:
  1914. case HTT_STATS_FTYPE_SGEN_BAR:
  1915. ppdu_desc->frame_type = CDP_PPDU_FTYPE_BAR;
  1916. ppdu_desc->bar_ppdu_id = ppdu_info->ppdu_id;
  1917. break;
  1918. default:
  1919. ppdu_desc->frame_type = CDP_PPDU_FTYPE_CTRL;
  1920. break;
  1921. }
  1922. tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(FES_DUR_US);
  1923. ppdu_desc->tx_duration = *tag_buf;
  1924. tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(START_TSTMP_L32_US);
  1925. ppdu_desc->ppdu_start_timestamp = *tag_buf;
  1926. tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(CHAN_MHZ_PHY_MODE);
  1927. freq = HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_GET(*tag_buf);
  1928. if (freq != ppdu_desc->channel) {
  1929. soc = pdev->soc;
  1930. ppdu_desc->channel = freq;
  1931. if (soc && soc->cdp_soc.ol_ops->freq_to_channel)
  1932. pdev->operating_channel =
  1933. soc->cdp_soc.ol_ops->freq_to_channel(soc->ctrl_psoc,
  1934. pdev->pdev_id, freq);
  1935. }
  1936. ppdu_desc->phy_mode = HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_GET(*tag_buf);
  1937. tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(RESV_NUM_UL_BEAM);
  1938. ppdu_desc->beam_change =
  1939. HTT_PPDU_STATS_COMMON_TLV_BEAM_CHANGE_GET(*tag_buf);
  1940. dp_tx_capture_htt_frame_counter(pdev, frame_type);
  1941. tag_buf = start_tag_buf + HTT_GET_STATS_CMN_INDEX(START_TSTMP_U32_US);
  1942. ppdu_start_timestamp = *tag_buf;
  1943. ppdu_desc->ppdu_start_timestamp |= ((ppdu_start_timestamp <<
  1944. HTT_SHIFT_UPPER_TIMESTAMP) &
  1945. HTT_MASK_UPPER_TIMESTAMP);
  1946. ppdu_desc->ppdu_end_timestamp = ppdu_desc->ppdu_start_timestamp +
  1947. ppdu_desc->tx_duration;
  1948. /* Ack time stamp is same as end time stamp*/
  1949. ppdu_desc->ack_timestamp = ppdu_desc->ppdu_end_timestamp;
  1950. ppdu_desc->ppdu_end_timestamp = ppdu_desc->ppdu_start_timestamp +
  1951. ppdu_desc->tx_duration;
  1952. ppdu_desc->bar_ppdu_start_timestamp = ppdu_desc->ppdu_start_timestamp;
  1953. ppdu_desc->bar_ppdu_end_timestamp = ppdu_desc->ppdu_end_timestamp;
  1954. ppdu_desc->bar_tx_duration = ppdu_desc->tx_duration;
  1955. /* Ack time stamp is same as end time stamp*/
  1956. ppdu_desc->ack_timestamp = ppdu_desc->ppdu_end_timestamp;
  1957. }
  1958. /*
  1959. * dp_process_ppdu_stats_user_common_tlv: Process ppdu_stats_user_common
  1960. * @tag_buf: buffer containing the tlv htt_ppdu_stats_user_common_tlv
  1961. * @ppdu_info: per ppdu tlv structure
  1962. *
  1963. * return:void
  1964. */
  1965. static void dp_process_ppdu_stats_user_common_tlv(
  1966. struct dp_pdev *pdev, uint32_t *tag_buf,
  1967. struct ppdu_info *ppdu_info)
  1968. {
  1969. uint16_t peer_id;
  1970. struct cdp_tx_completion_ppdu *ppdu_desc;
  1971. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  1972. uint8_t curr_user_index = 0;
  1973. struct dp_peer *peer;
  1974. struct dp_vdev *vdev;
  1975. ppdu_desc =
  1976. (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  1977. tag_buf++;
  1978. peer_id = HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_GET(*tag_buf);
  1979. curr_user_index =
  1980. dp_get_ppdu_info_user_index(pdev,
  1981. peer_id, ppdu_info);
  1982. ppdu_user_desc = &ppdu_desc->user[curr_user_index];
  1983. if (peer_id == DP_SCAN_PEER_ID) {
  1984. ppdu_desc->vdev_id =
  1985. HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_GET(*tag_buf);
  1986. vdev =
  1987. dp_get_vdev_from_soc_vdev_id_wifi3(pdev->soc,
  1988. ppdu_desc->vdev_id);
  1989. if (!vdev)
  1990. return;
  1991. qdf_mem_copy(ppdu_user_desc->mac_addr, vdev->mac_addr.raw,
  1992. QDF_MAC_ADDR_SIZE);
  1993. } else {
  1994. peer = dp_peer_find_by_id(pdev->soc, peer_id);
  1995. if (!peer)
  1996. return;
  1997. qdf_mem_copy(ppdu_user_desc->mac_addr,
  1998. peer->mac_addr.raw, QDF_MAC_ADDR_SIZE);
  1999. dp_peer_unref_del_find_by_id(peer);
  2000. }
  2001. ppdu_user_desc->peer_id = peer_id;
  2002. tag_buf++;
  2003. if (HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_GET(*tag_buf)) {
  2004. ppdu_user_desc->delayed_ba = 1;
  2005. ppdu_desc->delayed_ba = 1;
  2006. }
  2007. if (HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_GET(*tag_buf)) {
  2008. ppdu_user_desc->is_mcast = true;
  2009. ppdu_user_desc->mpdu_tried_mcast =
  2010. HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_GET(*tag_buf);
  2011. ppdu_user_desc->num_mpdu = ppdu_user_desc->mpdu_tried_mcast;
  2012. } else {
  2013. ppdu_user_desc->mpdu_tried_ucast =
  2014. HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_GET(*tag_buf);
  2015. }
  2016. tag_buf++;
  2017. ppdu_user_desc->qos_ctrl =
  2018. HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_GET(*tag_buf);
  2019. ppdu_user_desc->frame_ctrl =
  2020. HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_GET(*tag_buf);
  2021. ppdu_desc->frame_ctrl = ppdu_user_desc->frame_ctrl;
  2022. if (ppdu_user_desc->delayed_ba)
  2023. ppdu_user_desc->mpdu_success = 0;
  2024. tag_buf += 3;
  2025. if (HTT_PPDU_STATS_IS_OPAQUE_VALID_GET(*tag_buf)) {
  2026. ppdu_user_desc->ppdu_cookie =
  2027. HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_GET(*tag_buf);
  2028. ppdu_user_desc->is_ppdu_cookie_valid = 1;
  2029. }
  2030. }
  2031. /**
  2032. * dp_process_ppdu_stats_user_rate_tlv() - Process htt_ppdu_stats_user_rate_tlv
  2033. * @pdev: DP pdev handle
  2034. * @tag_buf: T2H message buffer carrying the user rate TLV
  2035. * @ppdu_info: per ppdu tlv structure
  2036. *
  2037. * return:void
  2038. */
  2039. static void dp_process_ppdu_stats_user_rate_tlv(struct dp_pdev *pdev,
  2040. uint32_t *tag_buf,
  2041. struct ppdu_info *ppdu_info)
  2042. {
  2043. uint16_t peer_id;
  2044. struct dp_peer *peer;
  2045. struct cdp_tx_completion_ppdu *ppdu_desc;
  2046. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  2047. uint8_t curr_user_index = 0;
  2048. struct dp_vdev *vdev;
  2049. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  2050. tag_buf++;
  2051. peer_id = HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_GET(*tag_buf);
  2052. curr_user_index =
  2053. dp_get_ppdu_info_user_index(pdev,
  2054. peer_id, ppdu_info);
  2055. ppdu_user_desc = &ppdu_desc->user[curr_user_index];
  2056. if (peer_id == DP_SCAN_PEER_ID) {
  2057. vdev =
  2058. dp_get_vdev_from_soc_vdev_id_wifi3(pdev->soc,
  2059. ppdu_desc->vdev_id);
  2060. if (!vdev)
  2061. return;
  2062. } else {
  2063. peer = dp_peer_find_by_id(pdev->soc, peer_id);
  2064. if (!peer)
  2065. return;
  2066. dp_peer_unref_del_find_by_id(peer);
  2067. }
  2068. ppdu_user_desc->peer_id = peer_id;
  2069. ppdu_user_desc->tid =
  2070. HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_GET(*tag_buf);
  2071. tag_buf += 1;
  2072. ppdu_user_desc->user_pos =
  2073. HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_GET(*tag_buf);
  2074. ppdu_user_desc->mu_group_id =
  2075. HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_GET(*tag_buf);
  2076. tag_buf += 1;
  2077. ppdu_user_desc->ru_start =
  2078. HTT_PPDU_STATS_USER_RATE_TLV_RU_START_GET(*tag_buf);
  2079. ppdu_user_desc->ru_tones =
  2080. (HTT_PPDU_STATS_USER_RATE_TLV_RU_END_GET(*tag_buf) -
  2081. HTT_PPDU_STATS_USER_RATE_TLV_RU_START_GET(*tag_buf)) + 1;
  2082. tag_buf += 2;
  2083. ppdu_user_desc->ppdu_type =
  2084. HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_GET(*tag_buf);
  2085. tag_buf++;
  2086. ppdu_user_desc->tx_rate = *tag_buf;
  2087. ppdu_user_desc->ltf_size =
  2088. HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_GET(*tag_buf);
  2089. ppdu_user_desc->stbc =
  2090. HTT_PPDU_STATS_USER_RATE_TLV_STBC_GET(*tag_buf);
  2091. ppdu_user_desc->he_re =
  2092. HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_GET(*tag_buf);
  2093. ppdu_user_desc->txbf =
  2094. HTT_PPDU_STATS_USER_RATE_TLV_TXBF_GET(*tag_buf);
  2095. ppdu_user_desc->bw =
  2096. HTT_PPDU_STATS_USER_RATE_TLV_BW_GET(*tag_buf) - 2;
  2097. ppdu_user_desc->nss = HTT_PPDU_STATS_USER_RATE_TLV_NSS_GET(*tag_buf);
  2098. ppdu_user_desc->mcs = HTT_PPDU_STATS_USER_RATE_TLV_MCS_GET(*tag_buf);
  2099. ppdu_user_desc->preamble =
  2100. HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_GET(*tag_buf);
  2101. ppdu_user_desc->gi = HTT_PPDU_STATS_USER_RATE_TLV_GI_GET(*tag_buf);
  2102. ppdu_user_desc->dcm = HTT_PPDU_STATS_USER_RATE_TLV_DCM_GET(*tag_buf);
  2103. ppdu_user_desc->ldpc = HTT_PPDU_STATS_USER_RATE_TLV_LDPC_GET(*tag_buf);
  2104. }
  2105. /*
  2106. * dp_process_ppdu_stats_enq_mpdu_bitmap_64_tlv: Process
  2107. * htt_ppdu_stats_enq_mpdu_bitmap_64_tlv
  2108. * pdev: DP PDEV handle
  2109. * @tag_buf: buffer containing the tlv htt_ppdu_stats_enq_mpdu_bitmap_64_tlv
  2110. * @ppdu_info: per ppdu tlv structure
  2111. *
  2112. * return:void
  2113. */
  2114. static void dp_process_ppdu_stats_enq_mpdu_bitmap_64_tlv(
  2115. struct dp_pdev *pdev, uint32_t *tag_buf,
  2116. struct ppdu_info *ppdu_info)
  2117. {
  2118. htt_ppdu_stats_enq_mpdu_bitmap_64_tlv *dp_stats_buf =
  2119. (htt_ppdu_stats_enq_mpdu_bitmap_64_tlv *)tag_buf;
  2120. struct cdp_tx_completion_ppdu *ppdu_desc;
  2121. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  2122. uint8_t curr_user_index = 0;
  2123. uint16_t peer_id;
  2124. uint32_t size = CDP_BA_64_BIT_MAP_SIZE_DWORDS;
  2125. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  2126. tag_buf++;
  2127. peer_id =
  2128. HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_GET(*tag_buf);
  2129. if (!dp_peer_find_by_id_valid(pdev->soc, peer_id))
  2130. return;
  2131. curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id, ppdu_info);
  2132. ppdu_user_desc = &ppdu_desc->user[curr_user_index];
  2133. ppdu_user_desc->peer_id = peer_id;
  2134. ppdu_user_desc->start_seq = dp_stats_buf->start_seq;
  2135. qdf_mem_copy(&ppdu_user_desc->enq_bitmap, &dp_stats_buf->enq_bitmap,
  2136. sizeof(uint32_t) * CDP_BA_64_BIT_MAP_SIZE_DWORDS);
  2137. dp_process_ppdu_stats_update_failed_bitmap(pdev,
  2138. (void *)ppdu_user_desc,
  2139. ppdu_info->ppdu_id,
  2140. size);
  2141. }
  2142. /*
  2143. * dp_process_ppdu_stats_enq_mpdu_bitmap_256_tlv: Process
  2144. * htt_ppdu_stats_enq_mpdu_bitmap_256_tlv
  2145. * soc: DP SOC handle
  2146. * @tag_buf: buffer containing the tlv htt_ppdu_stats_enq_mpdu_bitmap_256_tlv
  2147. * @ppdu_info: per ppdu tlv structure
  2148. *
  2149. * return:void
  2150. */
  2151. static void dp_process_ppdu_stats_enq_mpdu_bitmap_256_tlv(
  2152. struct dp_pdev *pdev, uint32_t *tag_buf,
  2153. struct ppdu_info *ppdu_info)
  2154. {
  2155. htt_ppdu_stats_enq_mpdu_bitmap_256_tlv *dp_stats_buf =
  2156. (htt_ppdu_stats_enq_mpdu_bitmap_256_tlv *)tag_buf;
  2157. struct cdp_tx_completion_ppdu *ppdu_desc;
  2158. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  2159. uint8_t curr_user_index = 0;
  2160. uint16_t peer_id;
  2161. uint32_t size = CDP_BA_256_BIT_MAP_SIZE_DWORDS;
  2162. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  2163. tag_buf++;
  2164. peer_id =
  2165. HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_GET(*tag_buf);
  2166. if (!dp_peer_find_by_id_valid(pdev->soc, peer_id))
  2167. return;
  2168. curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id, ppdu_info);
  2169. ppdu_user_desc = &ppdu_desc->user[curr_user_index];
  2170. ppdu_user_desc->peer_id = peer_id;
  2171. ppdu_user_desc->start_seq = dp_stats_buf->start_seq;
  2172. qdf_mem_copy(&ppdu_user_desc->enq_bitmap, &dp_stats_buf->enq_bitmap,
  2173. sizeof(uint32_t) * CDP_BA_256_BIT_MAP_SIZE_DWORDS);
  2174. dp_process_ppdu_stats_update_failed_bitmap(pdev,
  2175. (void *)ppdu_user_desc,
  2176. ppdu_info->ppdu_id,
  2177. size);
  2178. }
  2179. /*
  2180. * dp_process_ppdu_stats_user_cmpltn_common_tlv: Process
  2181. * htt_ppdu_stats_user_cmpltn_common_tlv
  2182. * soc: DP SOC handle
  2183. * @tag_buf: buffer containing the tlv htt_ppdu_stats_user_cmpltn_common_tlv
  2184. * @ppdu_info: per ppdu tlv structure
  2185. *
  2186. * return:void
  2187. */
  2188. static void dp_process_ppdu_stats_user_cmpltn_common_tlv(
  2189. struct dp_pdev *pdev, uint32_t *tag_buf,
  2190. struct ppdu_info *ppdu_info)
  2191. {
  2192. uint16_t peer_id;
  2193. struct cdp_tx_completion_ppdu *ppdu_desc;
  2194. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  2195. uint8_t curr_user_index = 0;
  2196. uint8_t bw_iter;
  2197. htt_ppdu_stats_user_cmpltn_common_tlv *dp_stats_buf =
  2198. (htt_ppdu_stats_user_cmpltn_common_tlv *)tag_buf;
  2199. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  2200. tag_buf++;
  2201. peer_id =
  2202. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_GET(*tag_buf);
  2203. if (!dp_peer_find_by_id_valid(pdev->soc, peer_id))
  2204. return;
  2205. curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id, ppdu_info);
  2206. ppdu_user_desc = &ppdu_desc->user[curr_user_index];
  2207. ppdu_user_desc->peer_id = peer_id;
  2208. ppdu_desc->last_usr_index = curr_user_index;
  2209. ppdu_user_desc->completion_status =
  2210. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_GET(
  2211. *tag_buf);
  2212. ppdu_user_desc->tid =
  2213. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_GET(*tag_buf);
  2214. tag_buf++;
  2215. if (qdf_likely(ppdu_user_desc->completion_status ==
  2216. HTT_PPDU_STATS_USER_STATUS_OK)) {
  2217. ppdu_desc->ack_rssi = dp_stats_buf->ack_rssi;
  2218. ppdu_user_desc->ack_rssi_valid = 1;
  2219. } else {
  2220. ppdu_user_desc->ack_rssi_valid = 0;
  2221. }
  2222. tag_buf++;
  2223. ppdu_user_desc->mpdu_success =
  2224. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_GET(*tag_buf);
  2225. ppdu_user_desc->mpdu_failed =
  2226. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_GET(*tag_buf) -
  2227. ppdu_user_desc->mpdu_success;
  2228. tag_buf++;
  2229. ppdu_user_desc->long_retries =
  2230. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_GET(*tag_buf);
  2231. ppdu_user_desc->short_retries =
  2232. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_GET(*tag_buf);
  2233. ppdu_user_desc->retry_msdus =
  2234. ppdu_user_desc->long_retries + ppdu_user_desc->short_retries;
  2235. ppdu_user_desc->is_ampdu =
  2236. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_GET(*tag_buf);
  2237. ppdu_info->is_ampdu = ppdu_user_desc->is_ampdu;
  2238. ppdu_desc->resp_type =
  2239. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_GET(*tag_buf);
  2240. ppdu_desc->mprot_type =
  2241. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPROT_TYPE_GET(*tag_buf);
  2242. ppdu_desc->rts_success =
  2243. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_SUCCESS_GET(*tag_buf);
  2244. ppdu_desc->rts_failure =
  2245. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_FAILURE_GET(*tag_buf);
  2246. /*
  2247. * increase successful mpdu counter from
  2248. * htt_ppdu_stats_user_cmpltn_common_tlv
  2249. */
  2250. ppdu_info->mpdu_compltn_common_tlv += ppdu_user_desc->mpdu_success;
  2251. /*
  2252. * MU BAR may send request to n users but we may received ack only from
  2253. * m users. To have count of number of users respond back, we have a
  2254. * separate counter bar_num_users per PPDU that get increment for every
  2255. * htt_ppdu_stats_user_cmpltn_common_tlv
  2256. */
  2257. ppdu_desc->bar_num_users++;
  2258. tag_buf++;
  2259. for (bw_iter = 0; bw_iter < CDP_RSSI_CHAIN_LEN; bw_iter++) {
  2260. ppdu_user_desc->rssi_chain[bw_iter] =
  2261. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CHAIN_RSSI_GET(*tag_buf);
  2262. tag_buf++;
  2263. }
  2264. ppdu_user_desc->sa_tx_antenna =
  2265. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TX_ANTENNA_MASK_GET(*tag_buf);
  2266. tag_buf++;
  2267. ppdu_user_desc->sa_is_training =
  2268. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_TRAINING_GET(*tag_buf);
  2269. if (ppdu_user_desc->sa_is_training) {
  2270. ppdu_user_desc->sa_goodput =
  2271. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PENDING_TRAINING_PKTS_GET(*tag_buf);
  2272. }
  2273. tag_buf++;
  2274. for (bw_iter = 0; bw_iter < CDP_NUM_SA_BW; bw_iter++) {
  2275. ppdu_user_desc->sa_max_rates[bw_iter] =
  2276. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MAX_RATES_GET(tag_buf[bw_iter]);
  2277. }
  2278. tag_buf += CDP_NUM_SA_BW;
  2279. ppdu_user_desc->current_rate_per =
  2280. HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CURRENT_RATE_PER_GET(*tag_buf);
  2281. }
  2282. /*
  2283. * dp_process_ppdu_stats_user_compltn_ba_bitmap_64_tlv: Process
  2284. * htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv
  2285. * pdev: DP PDEV handle
  2286. * @tag_buf: buffer containing the htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv
  2287. * @ppdu_info: per ppdu tlv structure
  2288. *
  2289. * return:void
  2290. */
  2291. static void dp_process_ppdu_stats_user_compltn_ba_bitmap_64_tlv(
  2292. struct dp_pdev *pdev, uint32_t *tag_buf,
  2293. struct ppdu_info *ppdu_info)
  2294. {
  2295. htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv *dp_stats_buf =
  2296. (htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv *)tag_buf;
  2297. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  2298. struct cdp_tx_completion_ppdu *ppdu_desc;
  2299. uint8_t curr_user_index = 0;
  2300. uint16_t peer_id;
  2301. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  2302. tag_buf++;
  2303. peer_id =
  2304. HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_GET(*tag_buf);
  2305. if (!dp_peer_find_by_id_valid(pdev->soc, peer_id))
  2306. return;
  2307. curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id, ppdu_info);
  2308. ppdu_user_desc = &ppdu_desc->user[curr_user_index];
  2309. ppdu_user_desc->peer_id = peer_id;
  2310. ppdu_user_desc->ba_seq_no = dp_stats_buf->ba_seq_no;
  2311. qdf_mem_copy(&ppdu_user_desc->ba_bitmap, &dp_stats_buf->ba_bitmap,
  2312. sizeof(uint32_t) * CDP_BA_64_BIT_MAP_SIZE_DWORDS);
  2313. ppdu_user_desc->ba_size = CDP_BA_64_BIT_MAP_SIZE_DWORDS * 32;
  2314. }
  2315. /*
  2316. * dp_process_ppdu_stats_user_compltn_ba_bitmap_256_tlv: Process
  2317. * htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv
  2318. * pdev: DP PDEV handle
  2319. * @tag_buf: buffer containing the htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv
  2320. * @ppdu_info: per ppdu tlv structure
  2321. *
  2322. * return:void
  2323. */
  2324. static void dp_process_ppdu_stats_user_compltn_ba_bitmap_256_tlv(
  2325. struct dp_pdev *pdev, uint32_t *tag_buf,
  2326. struct ppdu_info *ppdu_info)
  2327. {
  2328. htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv *dp_stats_buf =
  2329. (htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv *)tag_buf;
  2330. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  2331. struct cdp_tx_completion_ppdu *ppdu_desc;
  2332. uint8_t curr_user_index = 0;
  2333. uint16_t peer_id;
  2334. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  2335. tag_buf++;
  2336. peer_id =
  2337. HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_GET(*tag_buf);
  2338. if (!dp_peer_find_by_id_valid(pdev->soc, peer_id))
  2339. return;
  2340. curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id, ppdu_info);
  2341. ppdu_user_desc = &ppdu_desc->user[curr_user_index];
  2342. ppdu_user_desc->peer_id = peer_id;
  2343. ppdu_user_desc->ba_seq_no = dp_stats_buf->ba_seq_no;
  2344. qdf_mem_copy(&ppdu_user_desc->ba_bitmap, &dp_stats_buf->ba_bitmap,
  2345. sizeof(uint32_t) * CDP_BA_256_BIT_MAP_SIZE_DWORDS);
  2346. ppdu_user_desc->ba_size = CDP_BA_256_BIT_MAP_SIZE_DWORDS * 32;
  2347. }
  2348. /*
  2349. * dp_process_ppdu_stats_user_compltn_ack_ba_status_tlv: Process
  2350. * htt_ppdu_stats_user_compltn_ack_ba_status_tlv
  2351. * pdev: DP PDE handle
  2352. * @tag_buf: buffer containing the htt_ppdu_stats_user_compltn_ack_ba_status_tlv
  2353. * @ppdu_info: per ppdu tlv structure
  2354. *
  2355. * return:void
  2356. */
  2357. static void dp_process_ppdu_stats_user_compltn_ack_ba_status_tlv(
  2358. struct dp_pdev *pdev, uint32_t *tag_buf,
  2359. struct ppdu_info *ppdu_info)
  2360. {
  2361. uint16_t peer_id;
  2362. struct cdp_tx_completion_ppdu *ppdu_desc;
  2363. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  2364. uint8_t curr_user_index = 0;
  2365. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  2366. tag_buf += 2;
  2367. peer_id =
  2368. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_GET(*tag_buf);
  2369. if (!dp_peer_find_by_id_valid(pdev->soc, peer_id))
  2370. return;
  2371. curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id, ppdu_info);
  2372. ppdu_user_desc = &ppdu_desc->user[curr_user_index];
  2373. ppdu_user_desc->peer_id = peer_id;
  2374. tag_buf++;
  2375. /* not to update ppdu_desc->tid from this TLV */
  2376. ppdu_user_desc->num_mpdu =
  2377. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_GET(*tag_buf);
  2378. ppdu_user_desc->num_msdu =
  2379. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_GET(*tag_buf);
  2380. ppdu_user_desc->success_msdus = ppdu_user_desc->num_msdu;
  2381. tag_buf++;
  2382. ppdu_user_desc->start_seq =
  2383. HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_GET(
  2384. *tag_buf);
  2385. tag_buf++;
  2386. ppdu_user_desc->success_bytes = *tag_buf;
  2387. /* increase successful mpdu counter */
  2388. ppdu_info->mpdu_ack_ba_tlv += ppdu_user_desc->num_mpdu;
  2389. }
  2390. /*
  2391. * dp_process_ppdu_stats_user_common_array_tlv: Process
  2392. * htt_ppdu_stats_user_common_array_tlv
  2393. * pdev: DP PDEV handle
  2394. * @tag_buf: buffer containing the htt_ppdu_stats_user_compltn_ack_ba_status_tlv
  2395. * @ppdu_info: per ppdu tlv structure
  2396. *
  2397. * return:void
  2398. */
  2399. static void dp_process_ppdu_stats_user_common_array_tlv(
  2400. struct dp_pdev *pdev, uint32_t *tag_buf,
  2401. struct ppdu_info *ppdu_info)
  2402. {
  2403. uint32_t peer_id;
  2404. struct cdp_tx_completion_ppdu *ppdu_desc;
  2405. struct cdp_tx_completion_ppdu_user *ppdu_user_desc;
  2406. uint8_t curr_user_index = 0;
  2407. struct htt_tx_ppdu_stats_info *dp_stats_buf;
  2408. ppdu_desc = (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  2409. tag_buf++;
  2410. dp_stats_buf = (struct htt_tx_ppdu_stats_info *)tag_buf;
  2411. tag_buf += 3;
  2412. peer_id =
  2413. HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_GET(*tag_buf);
  2414. if (!dp_peer_find_by_id_valid(pdev->soc, peer_id)) {
  2415. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  2416. "Invalid peer");
  2417. return;
  2418. }
  2419. curr_user_index = dp_get_ppdu_info_user_index(pdev, peer_id, ppdu_info);
  2420. ppdu_user_desc = &ppdu_desc->user[curr_user_index];
  2421. ppdu_user_desc->retry_bytes = dp_stats_buf->tx_retry_bytes;
  2422. ppdu_user_desc->failed_bytes = dp_stats_buf->tx_failed_bytes;
  2423. tag_buf++;
  2424. ppdu_user_desc->success_msdus =
  2425. HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_GET(*tag_buf);
  2426. ppdu_user_desc->retry_bytes =
  2427. HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_GET(*tag_buf);
  2428. tag_buf++;
  2429. ppdu_user_desc->failed_msdus =
  2430. HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_GET(*tag_buf);
  2431. }
  2432. /*
  2433. * dp_process_ppdu_stats_flush_tlv: Process
  2434. * htt_ppdu_stats_flush_tlv
  2435. * @pdev: DP PDEV handle
  2436. * @tag_buf: buffer containing the htt_ppdu_stats_flush_tlv
  2437. * @ppdu_info: per ppdu tlv structure
  2438. *
  2439. * return:void
  2440. */
  2441. static void
  2442. dp_process_ppdu_stats_user_compltn_flush_tlv(struct dp_pdev *pdev,
  2443. uint32_t *tag_buf,
  2444. struct ppdu_info *ppdu_info)
  2445. {
  2446. struct cdp_tx_completion_ppdu *ppdu_desc;
  2447. uint32_t peer_id;
  2448. uint8_t tid;
  2449. struct dp_peer *peer;
  2450. ppdu_desc = (struct cdp_tx_completion_ppdu *)
  2451. qdf_nbuf_data(ppdu_info->nbuf);
  2452. ppdu_desc->is_flush = 1;
  2453. tag_buf++;
  2454. ppdu_desc->drop_reason = *tag_buf;
  2455. tag_buf++;
  2456. ppdu_desc->num_msdu = HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_GET(*tag_buf);
  2457. ppdu_desc->num_mpdu = HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_GET(*tag_buf);
  2458. ppdu_desc->flow_type = HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_GET(*tag_buf);
  2459. tag_buf++;
  2460. peer_id = HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_GET(*tag_buf);
  2461. tid = HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_GET(*tag_buf);
  2462. ppdu_desc->user[0].peer_id = peer_id;
  2463. ppdu_desc->user[0].tid = tid;
  2464. ppdu_desc->queue_type =
  2465. HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_GET(*tag_buf);
  2466. peer = dp_peer_find_by_id(pdev->soc, peer_id);
  2467. if (!peer)
  2468. return;
  2469. if (ppdu_desc->drop_reason == HTT_FLUSH_EXCESS_RETRIES) {
  2470. DP_STATS_INC(peer,
  2471. tx.excess_retries_per_ac[TID_TO_WME_AC(tid)],
  2472. ppdu_desc->num_msdu);
  2473. }
  2474. dp_peer_unref_del_find_by_id(peer);
  2475. }
  2476. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  2477. /*
  2478. * dp_deliver_mgmt_frm: Process
  2479. * @pdev: DP PDEV handle
  2480. * @nbuf: buffer containing the htt_ppdu_stats_tx_mgmtctrl_payload_tlv
  2481. *
  2482. * return: void
  2483. */
  2484. void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf)
  2485. {
  2486. if (pdev->tx_sniffer_enable || pdev->mcopy_mode) {
  2487. dp_wdi_event_handler(WDI_EVENT_TX_MGMT_CTRL, pdev->soc,
  2488. nbuf, HTT_INVALID_PEER,
  2489. WDI_NO_VAL, pdev->pdev_id);
  2490. }
  2491. }
  2492. #endif
  2493. /*
  2494. * dp_process_ppdu_stats_tx_mgmtctrl_payload_tlv: Process
  2495. * htt_ppdu_stats_tx_mgmtctrl_payload_tlv
  2496. * @pdev: DP PDEV handle
  2497. * @tag_buf: buffer containing the htt_ppdu_stats_tx_mgmtctrl_payload_tlv
  2498. * @length: tlv_length
  2499. *
  2500. * return:QDF_STATUS_SUCCESS if nbuf as to be freed in caller
  2501. */
  2502. static QDF_STATUS
  2503. dp_process_ppdu_stats_tx_mgmtctrl_payload_tlv(struct dp_pdev *pdev,
  2504. qdf_nbuf_t tag_buf,
  2505. uint32_t ppdu_id)
  2506. {
  2507. uint32_t *nbuf_ptr;
  2508. uint8_t trim_size;
  2509. size_t head_size;
  2510. struct cdp_tx_mgmt_comp_info *ptr_mgmt_comp_info;
  2511. uint32_t *msg_word;
  2512. uint32_t tsf_hdr;
  2513. if ((!pdev->tx_sniffer_enable) && (!pdev->mcopy_mode) &&
  2514. (!pdev->bpr_enable) && (!pdev->tx_capture_enabled))
  2515. return QDF_STATUS_SUCCESS;
  2516. /*
  2517. * get timestamp from htt_t2h_ppdu_stats_ind_hdr_t
  2518. */
  2519. msg_word = (uint32_t *)qdf_nbuf_data(tag_buf);
  2520. msg_word = msg_word + 2;
  2521. tsf_hdr = *msg_word;
  2522. trim_size = ((pdev->mgmtctrl_frm_info.mgmt_buf +
  2523. HTT_MGMT_CTRL_TLV_HDR_RESERVERD_LEN) -
  2524. qdf_nbuf_data(tag_buf));
  2525. if (!qdf_nbuf_pull_head(tag_buf, trim_size))
  2526. return QDF_STATUS_SUCCESS;
  2527. qdf_nbuf_trim_tail(tag_buf, qdf_nbuf_len(tag_buf) -
  2528. pdev->mgmtctrl_frm_info.mgmt_buf_len);
  2529. if (pdev->tx_capture_enabled) {
  2530. head_size = sizeof(struct cdp_tx_mgmt_comp_info);
  2531. if (qdf_unlikely(qdf_nbuf_headroom(tag_buf) < head_size)) {
  2532. qdf_err("Fail to get headroom h_sz %d h_avail %d\n",
  2533. head_size, qdf_nbuf_headroom(tag_buf));
  2534. qdf_assert_always(0);
  2535. return QDF_STATUS_E_NOMEM;
  2536. }
  2537. ptr_mgmt_comp_info = (struct cdp_tx_mgmt_comp_info *)
  2538. qdf_nbuf_push_head(tag_buf, head_size);
  2539. qdf_assert_always(ptr_mgmt_comp_info);
  2540. ptr_mgmt_comp_info->ppdu_id = ppdu_id;
  2541. ptr_mgmt_comp_info->is_sgen_pkt = true;
  2542. ptr_mgmt_comp_info->tx_tsf = tsf_hdr;
  2543. } else {
  2544. head_size = sizeof(ppdu_id);
  2545. nbuf_ptr = (uint32_t *)qdf_nbuf_push_head(tag_buf, head_size);
  2546. *nbuf_ptr = ppdu_id;
  2547. }
  2548. if (pdev->bpr_enable) {
  2549. dp_wdi_event_handler(WDI_EVENT_TX_BEACON, pdev->soc,
  2550. tag_buf, HTT_INVALID_PEER,
  2551. WDI_NO_VAL, pdev->pdev_id);
  2552. }
  2553. dp_deliver_mgmt_frm(pdev, tag_buf);
  2554. return QDF_STATUS_E_ALREADY;
  2555. }
  2556. /**
  2557. * dp_validate_fix_ppdu_tlv(): Function to validate the length of PPDU
  2558. *
  2559. * If the TLV length sent as part of PPDU TLV is less that expected size i.e
  2560. * size of corresponding data structure, pad the remaining bytes with zeros
  2561. * and continue processing the TLVs
  2562. *
  2563. * @pdev: DP pdev handle
  2564. * @tag_buf: TLV buffer
  2565. * @tlv_expected_size: Expected size of Tag
  2566. * @tlv_len: TLV length received from FW
  2567. *
  2568. * Return: Pointer to updated TLV
  2569. */
  2570. static inline uint32_t *dp_validate_fix_ppdu_tlv(struct dp_pdev *pdev,
  2571. uint32_t *tag_buf,
  2572. uint16_t tlv_expected_size,
  2573. uint16_t tlv_len)
  2574. {
  2575. uint32_t *tlv_desc = tag_buf;
  2576. qdf_assert_always(tlv_len != 0);
  2577. if (tlv_len < tlv_expected_size) {
  2578. qdf_mem_zero(pdev->ppdu_tlv_buf, tlv_expected_size);
  2579. qdf_mem_copy(pdev->ppdu_tlv_buf, tag_buf, tlv_len);
  2580. tlv_desc = pdev->ppdu_tlv_buf;
  2581. }
  2582. return tlv_desc;
  2583. }
  2584. /**
  2585. * dp_process_ppdu_tag(): Function to process the PPDU TLVs
  2586. * @pdev: DP pdev handle
  2587. * @tag_buf: TLV buffer
  2588. * @tlv_len: length of tlv
  2589. * @ppdu_info: per ppdu tlv structure
  2590. *
  2591. * return: void
  2592. */
  2593. static void dp_process_ppdu_tag(struct dp_pdev *pdev, uint32_t *tag_buf,
  2594. uint32_t tlv_len, struct ppdu_info *ppdu_info)
  2595. {
  2596. uint32_t tlv_type = HTT_STATS_TLV_TAG_GET(*tag_buf);
  2597. uint16_t tlv_expected_size;
  2598. uint32_t *tlv_desc;
  2599. switch (tlv_type) {
  2600. case HTT_PPDU_STATS_COMMON_TLV:
  2601. tlv_expected_size = sizeof(htt_ppdu_stats_common_tlv);
  2602. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2603. tlv_expected_size, tlv_len);
  2604. dp_process_ppdu_stats_common_tlv(pdev, tlv_desc, ppdu_info);
  2605. break;
  2606. case HTT_PPDU_STATS_USR_COMMON_TLV:
  2607. tlv_expected_size = sizeof(htt_ppdu_stats_user_common_tlv);
  2608. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2609. tlv_expected_size, tlv_len);
  2610. dp_process_ppdu_stats_user_common_tlv(pdev, tlv_desc,
  2611. ppdu_info);
  2612. break;
  2613. case HTT_PPDU_STATS_USR_RATE_TLV:
  2614. tlv_expected_size = sizeof(htt_ppdu_stats_user_rate_tlv);
  2615. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2616. tlv_expected_size, tlv_len);
  2617. dp_process_ppdu_stats_user_rate_tlv(pdev, tlv_desc,
  2618. ppdu_info);
  2619. break;
  2620. case HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_64_TLV:
  2621. tlv_expected_size =
  2622. sizeof(htt_ppdu_stats_enq_mpdu_bitmap_64_tlv);
  2623. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2624. tlv_expected_size, tlv_len);
  2625. dp_process_ppdu_stats_enq_mpdu_bitmap_64_tlv(
  2626. pdev, tlv_desc, ppdu_info);
  2627. break;
  2628. case HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_256_TLV:
  2629. tlv_expected_size =
  2630. sizeof(htt_ppdu_stats_enq_mpdu_bitmap_256_tlv);
  2631. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2632. tlv_expected_size, tlv_len);
  2633. dp_process_ppdu_stats_enq_mpdu_bitmap_256_tlv(
  2634. pdev, tlv_desc, ppdu_info);
  2635. break;
  2636. case HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV:
  2637. tlv_expected_size =
  2638. sizeof(htt_ppdu_stats_user_cmpltn_common_tlv);
  2639. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2640. tlv_expected_size, tlv_len);
  2641. dp_process_ppdu_stats_user_cmpltn_common_tlv(
  2642. pdev, tlv_desc, ppdu_info);
  2643. break;
  2644. case HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_64_TLV:
  2645. tlv_expected_size =
  2646. sizeof(htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv);
  2647. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2648. tlv_expected_size, tlv_len);
  2649. dp_process_ppdu_stats_user_compltn_ba_bitmap_64_tlv(
  2650. pdev, tlv_desc, ppdu_info);
  2651. break;
  2652. case HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_256_TLV:
  2653. tlv_expected_size =
  2654. sizeof(htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv);
  2655. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2656. tlv_expected_size, tlv_len);
  2657. dp_process_ppdu_stats_user_compltn_ba_bitmap_256_tlv(
  2658. pdev, tlv_desc, ppdu_info);
  2659. break;
  2660. case HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV:
  2661. tlv_expected_size =
  2662. sizeof(htt_ppdu_stats_user_compltn_ack_ba_status_tlv);
  2663. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2664. tlv_expected_size, tlv_len);
  2665. dp_process_ppdu_stats_user_compltn_ack_ba_status_tlv(
  2666. pdev, tlv_desc, ppdu_info);
  2667. break;
  2668. case HTT_PPDU_STATS_USR_COMMON_ARRAY_TLV:
  2669. tlv_expected_size =
  2670. sizeof(htt_ppdu_stats_usr_common_array_tlv_v);
  2671. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2672. tlv_expected_size, tlv_len);
  2673. dp_process_ppdu_stats_user_common_array_tlv(
  2674. pdev, tlv_desc, ppdu_info);
  2675. break;
  2676. case HTT_PPDU_STATS_USR_COMPLTN_FLUSH_TLV:
  2677. tlv_expected_size = sizeof(htt_ppdu_stats_flush_tlv);
  2678. tlv_desc = dp_validate_fix_ppdu_tlv(pdev, tag_buf,
  2679. tlv_expected_size, tlv_len);
  2680. dp_process_ppdu_stats_user_compltn_flush_tlv(pdev, tlv_desc,
  2681. ppdu_info);
  2682. break;
  2683. default:
  2684. break;
  2685. }
  2686. }
  2687. /**
  2688. * dp_ppdu_desc_user_stats_update(): Function to update TX user stats
  2689. * @pdev: DP pdev handle
  2690. * @ppdu_info: per PPDU TLV descriptor
  2691. *
  2692. * return: void
  2693. */
  2694. void
  2695. dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev,
  2696. struct ppdu_info *ppdu_info)
  2697. {
  2698. struct cdp_tx_completion_ppdu *ppdu_desc = NULL;
  2699. struct dp_peer *peer = NULL;
  2700. uint32_t tlv_bitmap_expected;
  2701. uint32_t tlv_bitmap_default;
  2702. uint16_t i;
  2703. uint32_t num_users;
  2704. ppdu_desc = (struct cdp_tx_completion_ppdu *)
  2705. qdf_nbuf_data(ppdu_info->nbuf);
  2706. ppdu_desc->num_users = ppdu_info->last_user;
  2707. ppdu_desc->ppdu_id = ppdu_info->ppdu_id;
  2708. tlv_bitmap_expected = HTT_PPDU_DEFAULT_TLV_BITMAP;
  2709. if (pdev->tx_sniffer_enable || pdev->mcopy_mode ||
  2710. pdev->tx_capture_enabled) {
  2711. if (ppdu_info->is_ampdu)
  2712. tlv_bitmap_expected =
  2713. dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap(
  2714. ppdu_info->tlv_bitmap);
  2715. }
  2716. tlv_bitmap_default = tlv_bitmap_expected;
  2717. if (ppdu_desc->frame_type == CDP_PPDU_FTYPE_BAR) {
  2718. num_users = ppdu_desc->bar_num_users;
  2719. ppdu_desc->num_users = ppdu_desc->bar_num_users;
  2720. } else {
  2721. num_users = ppdu_desc->num_users;
  2722. }
  2723. for (i = 0; i < num_users; i++) {
  2724. ppdu_desc->num_mpdu += ppdu_desc->user[i].num_mpdu;
  2725. ppdu_desc->num_msdu += ppdu_desc->user[i].num_msdu;
  2726. peer = dp_peer_find_by_id(pdev->soc,
  2727. ppdu_desc->user[i].peer_id);
  2728. /**
  2729. * This check is to make sure peer is not deleted
  2730. * after processing the TLVs.
  2731. */
  2732. if (!peer)
  2733. continue;
  2734. ppdu_desc->user[i].cookie = (void *)peer->wlanstats_ctx;
  2735. /*
  2736. * different frame like DATA, BAR or CTRL has different
  2737. * tlv bitmap expected. Apart from ACK_BA_STATUS TLV, we
  2738. * receive other tlv in-order/sequential from fw.
  2739. * Since ACK_BA_STATUS TLV come from Hardware it is
  2740. * asynchronous So we need to depend on some tlv to confirm
  2741. * all tlv is received for a ppdu.
  2742. * So we depend on both HTT_PPDU_STATS_COMMON_TLV and
  2743. * ACK_BA_STATUS_TLV. for failure packet we won't get
  2744. * ACK_BA_STATUS_TLV.
  2745. */
  2746. if (!(ppdu_info->tlv_bitmap &
  2747. (1 << HTT_PPDU_STATS_COMMON_TLV)) ||
  2748. (!(ppdu_info->tlv_bitmap &
  2749. (1 << HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV)) &&
  2750. (ppdu_desc->user[i].completion_status ==
  2751. HTT_PPDU_STATS_USER_STATUS_OK))) {
  2752. dp_peer_unref_del_find_by_id(peer);
  2753. continue;
  2754. }
  2755. /**
  2756. * Update tx stats for data frames having Qos as well as
  2757. * non-Qos data tid
  2758. */
  2759. if ((ppdu_desc->user[i].tid < CDP_DATA_TID_MAX ||
  2760. (ppdu_desc->user[i].tid == CDP_DATA_NON_QOS_TID) ||
  2761. (ppdu_desc->htt_frame_type ==
  2762. HTT_STATS_FTYPE_SGEN_QOS_NULL)) &&
  2763. (ppdu_desc->frame_type != CDP_PPDU_FTYPE_CTRL)) {
  2764. dp_tx_stats_update(pdev, peer,
  2765. &ppdu_desc->user[i],
  2766. ppdu_desc->ack_rssi);
  2767. dp_tx_rate_stats_update(peer, &ppdu_desc->user[i]);
  2768. }
  2769. dp_peer_unref_del_find_by_id(peer);
  2770. tlv_bitmap_expected = tlv_bitmap_default;
  2771. }
  2772. }
  2773. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  2774. /**
  2775. * dp_ppdu_desc_deliver(): Function to deliver Tx PPDU status descriptor
  2776. * to upper layer
  2777. * @pdev: DP pdev handle
  2778. * @ppdu_info: per PPDU TLV descriptor
  2779. *
  2780. * return: void
  2781. */
  2782. static
  2783. void dp_ppdu_desc_deliver(struct dp_pdev *pdev,
  2784. struct ppdu_info *ppdu_info)
  2785. {
  2786. struct cdp_tx_completion_ppdu *ppdu_desc = NULL;
  2787. qdf_nbuf_t nbuf;
  2788. ppdu_desc = (struct cdp_tx_completion_ppdu *)
  2789. qdf_nbuf_data(ppdu_info->nbuf);
  2790. dp_ppdu_desc_user_stats_update(pdev, ppdu_info);
  2791. /*
  2792. * Remove from the list
  2793. */
  2794. TAILQ_REMOVE(&pdev->ppdu_info_list, ppdu_info, ppdu_info_list_elem);
  2795. nbuf = ppdu_info->nbuf;
  2796. pdev->list_depth--;
  2797. qdf_mem_free(ppdu_info);
  2798. qdf_assert_always(nbuf);
  2799. ppdu_desc = (struct cdp_tx_completion_ppdu *)
  2800. qdf_nbuf_data(nbuf);
  2801. /**
  2802. * Deliver PPDU stats only for valid (acked) data frames if
  2803. * sniffer mode is not enabled.
  2804. * If sniffer mode is enabled, PPDU stats for all frames
  2805. * including mgmt/control frames should be delivered to upper layer
  2806. */
  2807. if (pdev->tx_sniffer_enable || pdev->mcopy_mode) {
  2808. dp_wdi_event_handler(WDI_EVENT_TX_PPDU_DESC, pdev->soc,
  2809. nbuf, HTT_INVALID_PEER,
  2810. WDI_NO_VAL, pdev->pdev_id);
  2811. } else {
  2812. if (ppdu_desc->num_mpdu != 0 && ppdu_desc->num_users != 0 &&
  2813. ppdu_desc->frame_ctrl & HTT_FRAMECTRL_DATATYPE) {
  2814. dp_wdi_event_handler(WDI_EVENT_TX_PPDU_DESC,
  2815. pdev->soc, nbuf, HTT_INVALID_PEER,
  2816. WDI_NO_VAL, pdev->pdev_id);
  2817. } else
  2818. qdf_nbuf_free(nbuf);
  2819. }
  2820. return;
  2821. }
  2822. #endif
  2823. /**
  2824. * dp_get_ppdu_desc(): Function to allocate new PPDU status
  2825. * desc for new ppdu id
  2826. * @pdev: DP pdev handle
  2827. * @ppdu_id: PPDU unique identifier
  2828. * @tlv_type: TLV type received
  2829. *
  2830. * return: ppdu_info per ppdu tlv structure
  2831. */
  2832. static
  2833. struct ppdu_info *dp_get_ppdu_desc(struct dp_pdev *pdev, uint32_t ppdu_id,
  2834. uint8_t tlv_type)
  2835. {
  2836. struct ppdu_info *ppdu_info = NULL;
  2837. /*
  2838. * Find ppdu_id node exists or not
  2839. */
  2840. TAILQ_FOREACH(ppdu_info, &pdev->ppdu_info_list, ppdu_info_list_elem) {
  2841. if (ppdu_info && (ppdu_info->ppdu_id == ppdu_id)) {
  2842. break;
  2843. }
  2844. }
  2845. if (ppdu_info) {
  2846. if (ppdu_info->tlv_bitmap & (1 << tlv_type)) {
  2847. /**
  2848. * if we get tlv_type that is already been processed
  2849. * for ppdu, that means we got a new ppdu with same
  2850. * ppdu id. Hence Flush the older ppdu
  2851. * for MUMIMO and OFDMA, In a PPDU we have
  2852. * multiple user with same tlv types. tlv bitmap is
  2853. * used to check whether SU or MU_MIMO/OFDMA
  2854. */
  2855. if (!(ppdu_info->tlv_bitmap &
  2856. (1 << HTT_PPDU_STATS_SCH_CMD_STATUS_TLV)))
  2857. return ppdu_info;
  2858. /**
  2859. * apart from ACK BA STATUS TLV rest all comes in order
  2860. * so if tlv type not ACK BA STATUS TLV we can deliver
  2861. * ppdu_info
  2862. */
  2863. if (tlv_type ==
  2864. HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV)
  2865. return ppdu_info;
  2866. dp_ppdu_desc_deliver(pdev, ppdu_info);
  2867. } else {
  2868. return ppdu_info;
  2869. }
  2870. }
  2871. /**
  2872. * Flush the head ppdu descriptor if ppdu desc list reaches max
  2873. * threshold
  2874. */
  2875. if (pdev->list_depth > HTT_PPDU_DESC_MAX_DEPTH) {
  2876. ppdu_info = TAILQ_FIRST(&pdev->ppdu_info_list);
  2877. dp_ppdu_desc_deliver(pdev, ppdu_info);
  2878. }
  2879. /*
  2880. * Allocate new ppdu_info node
  2881. */
  2882. ppdu_info = qdf_mem_malloc(sizeof(struct ppdu_info));
  2883. if (!ppdu_info)
  2884. return NULL;
  2885. ppdu_info->nbuf = qdf_nbuf_alloc(pdev->soc->osdev,
  2886. sizeof(struct cdp_tx_completion_ppdu), 0, 4,
  2887. TRUE);
  2888. if (!ppdu_info->nbuf) {
  2889. qdf_mem_free(ppdu_info);
  2890. return NULL;
  2891. }
  2892. ppdu_info->ppdu_desc =
  2893. (struct cdp_tx_completion_ppdu *)qdf_nbuf_data(ppdu_info->nbuf);
  2894. qdf_mem_zero(qdf_nbuf_data(ppdu_info->nbuf),
  2895. sizeof(struct cdp_tx_completion_ppdu));
  2896. if (qdf_nbuf_put_tail(ppdu_info->nbuf,
  2897. sizeof(struct cdp_tx_completion_ppdu)) == NULL) {
  2898. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  2899. "No tailroom for HTT PPDU");
  2900. qdf_nbuf_free(ppdu_info->nbuf);
  2901. ppdu_info->nbuf = NULL;
  2902. ppdu_info->last_user = 0;
  2903. qdf_mem_free(ppdu_info);
  2904. return NULL;
  2905. }
  2906. /**
  2907. * No lock is needed because all PPDU TLVs are processed in
  2908. * same context and this list is updated in same context
  2909. */
  2910. TAILQ_INSERT_TAIL(&pdev->ppdu_info_list, ppdu_info,
  2911. ppdu_info_list_elem);
  2912. pdev->list_depth++;
  2913. return ppdu_info;
  2914. }
  2915. /**
  2916. * dp_htt_process_tlv(): Function to process each PPDU TLVs
  2917. * @pdev: DP pdev handle
  2918. * @htt_t2h_msg: HTT target to host message
  2919. *
  2920. * return: ppdu_info per ppdu tlv structure
  2921. */
  2922. static struct ppdu_info *dp_htt_process_tlv(struct dp_pdev *pdev,
  2923. qdf_nbuf_t htt_t2h_msg)
  2924. {
  2925. uint32_t length;
  2926. uint32_t ppdu_id;
  2927. uint8_t tlv_type;
  2928. uint32_t tlv_length, tlv_bitmap_expected;
  2929. uint8_t *tlv_buf;
  2930. struct ppdu_info *ppdu_info = NULL;
  2931. struct cdp_tx_completion_ppdu *ppdu_desc = NULL;
  2932. struct dp_peer *peer;
  2933. uint32_t i = 0;
  2934. uint32_t *msg_word = (uint32_t *) qdf_nbuf_data(htt_t2h_msg);
  2935. length = HTT_T2H_PPDU_STATS_PAYLOAD_SIZE_GET(*msg_word);
  2936. msg_word = msg_word + 1;
  2937. ppdu_id = HTT_T2H_PPDU_STATS_PPDU_ID_GET(*msg_word);
  2938. msg_word = msg_word + 3;
  2939. while (length > 0) {
  2940. tlv_buf = (uint8_t *)msg_word;
  2941. tlv_type = HTT_STATS_TLV_TAG_GET(*msg_word);
  2942. tlv_length = HTT_STATS_TLV_LENGTH_GET(*msg_word);
  2943. if (qdf_likely(tlv_type < CDP_PPDU_STATS_MAX_TAG))
  2944. pdev->stats.ppdu_stats_counter[tlv_type]++;
  2945. if (tlv_length == 0)
  2946. break;
  2947. tlv_length += HTT_TLV_HDR_LEN;
  2948. /**
  2949. * Not allocating separate ppdu descriptor for MGMT Payload
  2950. * TLV as this is sent as separate WDI indication and it
  2951. * doesn't contain any ppdu information
  2952. */
  2953. if (tlv_type == HTT_PPDU_STATS_TX_MGMTCTRL_PAYLOAD_TLV) {
  2954. pdev->mgmtctrl_frm_info.mgmt_buf = tlv_buf;
  2955. pdev->mgmtctrl_frm_info.ppdu_id = ppdu_id;
  2956. pdev->mgmtctrl_frm_info.mgmt_buf_len =
  2957. HTT_PPDU_STATS_TX_MGMTCTRL_TLV_FRAME_LENGTH_GET
  2958. (*(msg_word + 1));
  2959. msg_word =
  2960. (uint32_t *)((uint8_t *)tlv_buf + tlv_length);
  2961. length -= (tlv_length);
  2962. continue;
  2963. }
  2964. ppdu_info = dp_get_ppdu_desc(pdev, ppdu_id, tlv_type);
  2965. if (!ppdu_info)
  2966. return NULL;
  2967. ppdu_info->ppdu_desc->bss_color =
  2968. pdev->rx_mon_recv_status.bsscolor;
  2969. ppdu_info->ppdu_id = ppdu_id;
  2970. ppdu_info->tlv_bitmap |= (1 << tlv_type);
  2971. dp_process_ppdu_tag(pdev, msg_word, tlv_length, ppdu_info);
  2972. /**
  2973. * Increment pdev level tlv count to monitor
  2974. * missing TLVs
  2975. */
  2976. pdev->tlv_count++;
  2977. ppdu_info->last_tlv_cnt = pdev->tlv_count;
  2978. msg_word = (uint32_t *)((uint8_t *)tlv_buf + tlv_length);
  2979. length -= (tlv_length);
  2980. }
  2981. if (!ppdu_info)
  2982. return NULL;
  2983. pdev->last_ppdu_id = ppdu_id;
  2984. tlv_bitmap_expected = HTT_PPDU_DEFAULT_TLV_BITMAP;
  2985. if (pdev->tx_sniffer_enable || pdev->mcopy_mode ||
  2986. pdev->tx_capture_enabled) {
  2987. if (ppdu_info->is_ampdu)
  2988. tlv_bitmap_expected =
  2989. dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap(
  2990. ppdu_info->tlv_bitmap);
  2991. }
  2992. ppdu_desc = ppdu_info->ppdu_desc;
  2993. if (!ppdu_desc)
  2994. return NULL;
  2995. if (ppdu_desc->user[ppdu_desc->last_usr_index].completion_status !=
  2996. HTT_PPDU_STATS_USER_STATUS_OK) {
  2997. tlv_bitmap_expected = tlv_bitmap_expected & 0xFF;
  2998. }
  2999. if (ppdu_desc->frame_type == CDP_PPDU_FTYPE_DATA &&
  3000. (ppdu_info->tlv_bitmap & (1 << HTT_PPDU_STATS_COMMON_TLV)) &&
  3001. ppdu_desc->delayed_ba) {
  3002. for (i = 0; i < ppdu_desc->num_users; i++) {
  3003. uint32_t ppdu_id;
  3004. ppdu_id = ppdu_desc->ppdu_id;
  3005. peer = dp_peer_find_by_id(pdev->soc,
  3006. ppdu_desc->user[i].peer_id);
  3007. /**
  3008. * This check is to make sure peer is not deleted
  3009. * after processing the TLVs.
  3010. */
  3011. if (!peer)
  3012. continue;
  3013. /**
  3014. * save delayed ba user info
  3015. */
  3016. if (ppdu_desc->user[i].delayed_ba) {
  3017. dp_peer_copy_delay_stats(peer,
  3018. &ppdu_desc->user[i]);
  3019. peer->last_delayed_ba_ppduid = ppdu_id;
  3020. }
  3021. dp_peer_unref_del_find_by_id(peer);
  3022. }
  3023. }
  3024. /*
  3025. * when frame type is BAR and STATS_COMMON_TLV is set
  3026. * copy the store peer delayed info to BAR status
  3027. */
  3028. if (ppdu_desc->frame_type == CDP_PPDU_FTYPE_BAR &&
  3029. (ppdu_info->tlv_bitmap & (1 << HTT_PPDU_STATS_COMMON_TLV))) {
  3030. for (i = 0; i < ppdu_desc->bar_num_users; i++) {
  3031. peer = dp_peer_find_by_id(pdev->soc,
  3032. ppdu_desc->user[i].peer_id);
  3033. /**
  3034. * This check is to make sure peer is not deleted
  3035. * after processing the TLVs.
  3036. */
  3037. if (!peer)
  3038. continue;
  3039. if (peer->last_delayed_ba) {
  3040. dp_peer_copy_stats_to_bar(peer,
  3041. &ppdu_desc->user[i]);
  3042. ppdu_desc->bar_ppdu_id = ppdu_desc->ppdu_id;
  3043. ppdu_desc->ppdu_id =
  3044. peer->last_delayed_ba_ppduid;
  3045. }
  3046. dp_peer_unref_del_find_by_id(peer);
  3047. }
  3048. }
  3049. /*
  3050. * for frame type DATA and BAR, we update stats based on MSDU,
  3051. * successful msdu and mpdu are populate from ACK BA STATUS TLV
  3052. * which comes out of order. successful mpdu also populated from
  3053. * COMPLTN COMMON TLV which comes in order. for every ppdu_info
  3054. * we store successful mpdu from both tlv and compare before delivering
  3055. * to make sure we received ACK BA STATUS TLV. For some self generated
  3056. * frame we won't get ack ba status tlv so no need to wait for
  3057. * ack ba status tlv.
  3058. */
  3059. if (ppdu_desc->frame_type != CDP_PPDU_FTYPE_CTRL &&
  3060. ppdu_desc->htt_frame_type != HTT_STATS_FTYPE_SGEN_QOS_NULL) {
  3061. /*
  3062. * successful mpdu count should match with both tlv
  3063. */
  3064. if (ppdu_info->mpdu_compltn_common_tlv !=
  3065. ppdu_info->mpdu_ack_ba_tlv)
  3066. return NULL;
  3067. }
  3068. /**
  3069. * Once all the TLVs for a given PPDU has been processed,
  3070. * return PPDU status to be delivered to higher layer.
  3071. * tlv_bitmap_expected can't be available for different frame type.
  3072. * But STATS COMMON TLV is the last TLV from the FW for a ppdu.
  3073. * apart from ACK BA TLV, FW sends other TLV in sequential order.
  3074. * flush tlv comes separate.
  3075. */
  3076. if ((ppdu_info->tlv_bitmap != 0 &&
  3077. (ppdu_info->tlv_bitmap & (1 << HTT_PPDU_STATS_COMMON_TLV))) ||
  3078. (ppdu_info->tlv_bitmap &
  3079. (1 << HTT_PPDU_STATS_USR_COMPLTN_FLUSH_TLV)))
  3080. return ppdu_info;
  3081. return NULL;
  3082. }
  3083. #endif /* FEATURE_PERPKT_INFO */
  3084. /**
  3085. * dp_txrx_ppdu_stats_handler() - Function to process HTT PPDU stats from FW
  3086. * @soc: DP SOC handle
  3087. * @pdev_id: pdev id
  3088. * @htt_t2h_msg: HTT message nbuf
  3089. *
  3090. * return:void
  3091. */
  3092. #if defined(WDI_EVENT_ENABLE)
  3093. #ifdef FEATURE_PERPKT_INFO
  3094. static bool dp_txrx_ppdu_stats_handler(struct dp_soc *soc,
  3095. uint8_t pdev_id, qdf_nbuf_t htt_t2h_msg)
  3096. {
  3097. struct dp_pdev *pdev = soc->pdev_list[pdev_id];
  3098. struct ppdu_info *ppdu_info = NULL;
  3099. bool free_buf = true;
  3100. if (!pdev)
  3101. return true;
  3102. if (!pdev->enhanced_stats_en && !pdev->tx_sniffer_enable &&
  3103. !pdev->mcopy_mode && !pdev->bpr_enable)
  3104. return free_buf;
  3105. ppdu_info = dp_htt_process_tlv(pdev, htt_t2h_msg);
  3106. if (pdev->mgmtctrl_frm_info.mgmt_buf) {
  3107. if (dp_process_ppdu_stats_tx_mgmtctrl_payload_tlv
  3108. (pdev, htt_t2h_msg, pdev->mgmtctrl_frm_info.ppdu_id) !=
  3109. QDF_STATUS_SUCCESS)
  3110. free_buf = false;
  3111. }
  3112. if (ppdu_info)
  3113. dp_ppdu_desc_deliver(pdev, ppdu_info);
  3114. pdev->mgmtctrl_frm_info.mgmt_buf = NULL;
  3115. pdev->mgmtctrl_frm_info.mgmt_buf_len = 0;
  3116. pdev->mgmtctrl_frm_info.ppdu_id = 0;
  3117. return free_buf;
  3118. }
  3119. #else
  3120. static bool dp_txrx_ppdu_stats_handler(struct dp_soc *soc,
  3121. uint8_t pdev_id, qdf_nbuf_t htt_t2h_msg)
  3122. {
  3123. return true;
  3124. }
  3125. #endif
  3126. #endif
  3127. /**
  3128. * dp_txrx_fw_stats_handler() - Function to process HTT EXT stats
  3129. * @soc: DP SOC handle
  3130. * @htt_t2h_msg: HTT message nbuf
  3131. *
  3132. * return:void
  3133. */
  3134. static inline void dp_txrx_fw_stats_handler(struct dp_soc *soc,
  3135. qdf_nbuf_t htt_t2h_msg)
  3136. {
  3137. uint8_t done;
  3138. qdf_nbuf_t msg_copy;
  3139. uint32_t *msg_word;
  3140. msg_word = (uint32_t *) qdf_nbuf_data(htt_t2h_msg);
  3141. msg_word = msg_word + 3;
  3142. done = HTT_T2H_EXT_STATS_CONF_TLV_DONE_GET(*msg_word);
  3143. /*
  3144. * HTT EXT stats response comes as stream of TLVs which span over
  3145. * multiple T2H messages.
  3146. * The first message will carry length of the response.
  3147. * For rest of the messages length will be zero.
  3148. *
  3149. * Clone the T2H message buffer and store it in a list to process
  3150. * it later.
  3151. *
  3152. * The original T2H message buffers gets freed in the T2H HTT event
  3153. * handler
  3154. */
  3155. msg_copy = qdf_nbuf_clone(htt_t2h_msg);
  3156. if (!msg_copy) {
  3157. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO,
  3158. "T2H messge clone failed for HTT EXT STATS");
  3159. goto error;
  3160. }
  3161. qdf_spin_lock_bh(&soc->htt_stats.lock);
  3162. qdf_nbuf_queue_add(&soc->htt_stats.msg, msg_copy);
  3163. /*
  3164. * Done bit signifies that this is the last T2H buffer in the stream of
  3165. * HTT EXT STATS message
  3166. */
  3167. if (done) {
  3168. soc->htt_stats.num_stats++;
  3169. qdf_sched_work(0, &soc->htt_stats.work);
  3170. }
  3171. qdf_spin_unlock_bh(&soc->htt_stats.lock);
  3172. return;
  3173. error:
  3174. qdf_spin_lock_bh(&soc->htt_stats.lock);
  3175. while ((msg_copy = qdf_nbuf_queue_remove(&soc->htt_stats.msg))
  3176. != NULL) {
  3177. qdf_nbuf_free(msg_copy);
  3178. }
  3179. soc->htt_stats.num_stats = 0;
  3180. qdf_spin_unlock_bh(&soc->htt_stats.lock);
  3181. return;
  3182. }
  3183. /*
  3184. * htt_soc_attach_target() - SOC level HTT setup
  3185. * @htt_soc: HTT SOC handle
  3186. *
  3187. * Return: 0 on success; error code on failure
  3188. */
  3189. int htt_soc_attach_target(struct htt_soc *htt_soc)
  3190. {
  3191. struct htt_soc *soc = (struct htt_soc *)htt_soc;
  3192. return htt_h2t_ver_req_msg(soc);
  3193. }
  3194. void htt_set_htc_handle(struct htt_soc *htt_soc, HTC_HANDLE htc_soc)
  3195. {
  3196. htt_soc->htc_soc = htc_soc;
  3197. }
  3198. HTC_HANDLE htt_get_htc_handle(struct htt_soc *htt_soc)
  3199. {
  3200. return htt_soc->htc_soc;
  3201. }
  3202. struct htt_soc *htt_soc_attach(struct dp_soc *soc, HTC_HANDLE htc_handle)
  3203. {
  3204. int i;
  3205. int j;
  3206. int alloc_size = HTT_SW_UMAC_RING_IDX_MAX * sizeof(unsigned long);
  3207. struct htt_soc *htt_soc = NULL;
  3208. htt_soc = qdf_mem_malloc(sizeof(*htt_soc));
  3209. if (!htt_soc) {
  3210. dp_err("HTT attach failed");
  3211. return NULL;
  3212. }
  3213. for (i = 0; i < MAX_PDEV_CNT; i++) {
  3214. htt_soc->pdevid_tt[i].umac_ttt = qdf_mem_malloc(alloc_size);
  3215. if (!htt_soc->pdevid_tt[i].umac_ttt)
  3216. break;
  3217. qdf_mem_set(htt_soc->pdevid_tt[i].umac_ttt, alloc_size, -1);
  3218. htt_soc->pdevid_tt[i].lmac_ttt = qdf_mem_malloc(alloc_size);
  3219. if (!htt_soc->pdevid_tt[i].lmac_ttt) {
  3220. qdf_mem_free(htt_soc->pdevid_tt[i].umac_ttt);
  3221. break;
  3222. }
  3223. qdf_mem_set(htt_soc->pdevid_tt[i].lmac_ttt, alloc_size, -1);
  3224. }
  3225. if (i != MAX_PDEV_CNT) {
  3226. for (j = 0; j < i; j++) {
  3227. qdf_mem_free(htt_soc->pdevid_tt[i].umac_ttt);
  3228. qdf_mem_free(htt_soc->pdevid_tt[i].lmac_ttt);
  3229. }
  3230. return NULL;
  3231. }
  3232. htt_soc->dp_soc = soc;
  3233. htt_soc->htc_soc = htc_handle;
  3234. HTT_TX_MUTEX_INIT(&htt_soc->htt_tx_mutex);
  3235. return htt_soc;
  3236. }
  3237. #if defined(WDI_EVENT_ENABLE) && !defined(REMOVE_PKT_LOG)
  3238. /*
  3239. * dp_ppdu_stats_ind_handler() - PPDU stats msg handler
  3240. * @htt_soc: HTT SOC handle
  3241. * @msg_word: Pointer to payload
  3242. * @htt_t2h_msg: HTT msg nbuf
  3243. *
  3244. * Return: True if buffer should be freed by caller.
  3245. */
  3246. static bool
  3247. dp_ppdu_stats_ind_handler(struct htt_soc *soc,
  3248. uint32_t *msg_word,
  3249. qdf_nbuf_t htt_t2h_msg)
  3250. {
  3251. u_int8_t pdev_id;
  3252. u_int8_t target_pdev_id;
  3253. bool free_buf;
  3254. qdf_nbuf_set_pktlen(htt_t2h_msg, HTT_T2H_MAX_MSG_SIZE);
  3255. target_pdev_id = HTT_T2H_PPDU_STATS_PDEV_ID_GET(*msg_word);
  3256. pdev_id = dp_get_host_pdev_id_for_target_pdev_id(soc->dp_soc,
  3257. target_pdev_id);
  3258. free_buf = dp_txrx_ppdu_stats_handler(soc->dp_soc, pdev_id,
  3259. htt_t2h_msg);
  3260. dp_wdi_event_handler(WDI_EVENT_LITE_T2H, soc->dp_soc,
  3261. htt_t2h_msg, HTT_INVALID_PEER, WDI_NO_VAL,
  3262. pdev_id);
  3263. return free_buf;
  3264. }
  3265. #else
  3266. static bool
  3267. dp_ppdu_stats_ind_handler(struct htt_soc *soc,
  3268. uint32_t *msg_word,
  3269. qdf_nbuf_t htt_t2h_msg)
  3270. {
  3271. return true;
  3272. }
  3273. #endif
  3274. #if defined(WDI_EVENT_ENABLE) && \
  3275. !defined(REMOVE_PKT_LOG)
  3276. /*
  3277. * dp_pktlog_msg_handler() - Pktlog msg handler
  3278. * @htt_soc: HTT SOC handle
  3279. * @msg_word: Pointer to payload
  3280. *
  3281. * Return: None
  3282. */
  3283. static void
  3284. dp_pktlog_msg_handler(struct htt_soc *soc,
  3285. uint32_t *msg_word)
  3286. {
  3287. uint8_t pdev_id;
  3288. uint8_t target_pdev_id;
  3289. uint32_t *pl_hdr;
  3290. target_pdev_id = HTT_T2H_PKTLOG_PDEV_ID_GET(*msg_word);
  3291. pdev_id = dp_get_host_pdev_id_for_target_pdev_id(soc->dp_soc,
  3292. target_pdev_id);
  3293. pl_hdr = (msg_word + 1);
  3294. dp_wdi_event_handler(WDI_EVENT_OFFLOAD_ALL, soc->dp_soc,
  3295. pl_hdr, HTT_INVALID_PEER, WDI_NO_VAL,
  3296. pdev_id);
  3297. }
  3298. #else
  3299. static void
  3300. dp_pktlog_msg_handler(struct htt_soc *soc,
  3301. uint32_t *msg_word)
  3302. {
  3303. }
  3304. #endif
  3305. /*
  3306. * time_allow_print() - time allow print
  3307. * @htt_ring_tt: ringi_id array of timestamps
  3308. * @ring_id: ring_id (index)
  3309. *
  3310. * Return: 1 for successfully saving timestamp in array
  3311. * and 0 for timestamp falling within 2 seconds after last one
  3312. */
  3313. static bool time_allow_print(unsigned long *htt_ring_tt, u_int8_t ring_id)
  3314. {
  3315. unsigned long tstamp;
  3316. unsigned long delta;
  3317. tstamp = qdf_get_system_timestamp();
  3318. if (!htt_ring_tt)
  3319. return 0; //unable to print backpressure messages
  3320. if (htt_ring_tt[ring_id] == -1) {
  3321. htt_ring_tt[ring_id] = tstamp;
  3322. return 1;
  3323. }
  3324. delta = tstamp - htt_ring_tt[ring_id];
  3325. if (delta >= 2000) {
  3326. htt_ring_tt[ring_id] = tstamp;
  3327. return 1;
  3328. }
  3329. return 0;
  3330. }
  3331. static void dp_htt_alert_print(enum htt_t2h_msg_type msg_type,
  3332. u_int8_t pdev_id, u_int8_t ring_id,
  3333. u_int16_t hp_idx, u_int16_t tp_idx,
  3334. u_int32_t bkp_time, char *ring_stype)
  3335. {
  3336. dp_alert("msg_type: %d pdev_id: %d ring_type: %s ",
  3337. msg_type, pdev_id, ring_stype);
  3338. dp_alert("ring_id: %d hp_idx: %d tp_idx: %d bkpressure_time_ms: %d ",
  3339. ring_id, hp_idx, tp_idx, bkp_time);
  3340. }
  3341. /*
  3342. * dp_htt_bkp_event_alert() - htt backpressure event alert
  3343. * @msg_word: htt packet context
  3344. * @htt_soc: HTT SOC handle
  3345. *
  3346. * Return: after attempting to print stats
  3347. */
  3348. static void dp_htt_bkp_event_alert(u_int32_t *msg_word, struct htt_soc *soc)
  3349. {
  3350. u_int8_t ring_type;
  3351. u_int8_t pdev_id;
  3352. uint8_t target_pdev_id;
  3353. u_int8_t ring_id;
  3354. u_int16_t hp_idx;
  3355. u_int16_t tp_idx;
  3356. u_int32_t bkp_time;
  3357. enum htt_t2h_msg_type msg_type;
  3358. struct dp_soc *dpsoc;
  3359. struct dp_pdev *pdev;
  3360. struct dp_htt_timestamp *radio_tt;
  3361. if (!soc)
  3362. return;
  3363. dpsoc = (struct dp_soc *)soc->dp_soc;
  3364. msg_type = HTT_T2H_MSG_TYPE_GET(*msg_word);
  3365. ring_type = HTT_T2H_RX_BKPRESSURE_RING_TYPE_GET(*msg_word);
  3366. target_pdev_id = HTT_T2H_RX_BKPRESSURE_PDEV_ID_GET(*msg_word);
  3367. pdev_id = dp_get_host_pdev_id_for_target_pdev_id(soc->dp_soc,
  3368. target_pdev_id);
  3369. pdev = (struct dp_pdev *)dpsoc->pdev_list[pdev_id];
  3370. ring_id = HTT_T2H_RX_BKPRESSURE_RINGID_GET(*msg_word);
  3371. hp_idx = HTT_T2H_RX_BKPRESSURE_HEAD_IDX_GET(*(msg_word + 1));
  3372. tp_idx = HTT_T2H_RX_BKPRESSURE_TAIL_IDX_GET(*(msg_word + 1));
  3373. bkp_time = HTT_T2H_RX_BKPRESSURE_TIME_MS_GET(*(msg_word + 2));
  3374. radio_tt = &soc->pdevid_tt[pdev_id];
  3375. switch (ring_type) {
  3376. case HTT_SW_RING_TYPE_UMAC:
  3377. if (!time_allow_print(radio_tt->umac_ttt, ring_id))
  3378. return;
  3379. dp_htt_alert_print(msg_type, pdev_id, ring_id, hp_idx, tp_idx,
  3380. bkp_time, "HTT_SW_RING_TYPE_UMAC");
  3381. break;
  3382. case HTT_SW_RING_TYPE_LMAC:
  3383. if (!time_allow_print(radio_tt->lmac_ttt, ring_id))
  3384. return;
  3385. dp_htt_alert_print(msg_type, pdev_id, ring_id, hp_idx, tp_idx,
  3386. bkp_time, "HTT_SW_RING_TYPE_LMAC");
  3387. break;
  3388. default:
  3389. dp_htt_alert_print(msg_type, pdev_id, ring_id, hp_idx, tp_idx,
  3390. bkp_time, "UNKNOWN");
  3391. break;
  3392. }
  3393. dp_print_ring_stats(pdev);
  3394. dp_print_napi_stats(pdev->soc);
  3395. }
  3396. /*
  3397. * dp_htt_t2h_msg_handler() - Generic Target to host Msg/event handler
  3398. * @context: Opaque context (HTT SOC handle)
  3399. * @pkt: HTC packet
  3400. */
  3401. static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt)
  3402. {
  3403. struct htt_soc *soc = (struct htt_soc *) context;
  3404. qdf_nbuf_t htt_t2h_msg = (qdf_nbuf_t) pkt->pPktContext;
  3405. u_int32_t *msg_word;
  3406. enum htt_t2h_msg_type msg_type;
  3407. bool free_buf = true;
  3408. /* check for successful message reception */
  3409. if (pkt->Status != QDF_STATUS_SUCCESS) {
  3410. if (pkt->Status != QDF_STATUS_E_CANCELED)
  3411. soc->stats.htc_err_cnt++;
  3412. qdf_nbuf_free(htt_t2h_msg);
  3413. return;
  3414. }
  3415. /* TODO: Check if we should pop the HTC/HTT header alignment padding */
  3416. msg_word = (u_int32_t *) qdf_nbuf_data(htt_t2h_msg);
  3417. msg_type = HTT_T2H_MSG_TYPE_GET(*msg_word);
  3418. htt_event_record(soc->htt_logger_handle,
  3419. msg_type, (uint8_t *)msg_word);
  3420. switch (msg_type) {
  3421. case HTT_T2H_MSG_TYPE_BKPRESSURE_EVENT_IND:
  3422. {
  3423. dp_htt_bkp_event_alert(msg_word, soc);
  3424. break;
  3425. }
  3426. case HTT_T2H_MSG_TYPE_PEER_MAP:
  3427. {
  3428. u_int8_t mac_addr_deswizzle_buf[QDF_MAC_ADDR_SIZE];
  3429. u_int8_t *peer_mac_addr;
  3430. u_int16_t peer_id;
  3431. u_int16_t hw_peer_id;
  3432. u_int8_t vdev_id;
  3433. u_int8_t is_wds;
  3434. struct dp_soc *dpsoc = (struct dp_soc *)soc->dp_soc;
  3435. peer_id = HTT_RX_PEER_MAP_PEER_ID_GET(*msg_word);
  3436. hw_peer_id =
  3437. HTT_RX_PEER_MAP_HW_PEER_ID_GET(*(msg_word+2));
  3438. vdev_id = HTT_RX_PEER_MAP_VDEV_ID_GET(*msg_word);
  3439. peer_mac_addr = htt_t2h_mac_addr_deswizzle(
  3440. (u_int8_t *) (msg_word+1),
  3441. &mac_addr_deswizzle_buf[0]);
  3442. QDF_TRACE(QDF_MODULE_ID_TXRX,
  3443. QDF_TRACE_LEVEL_INFO,
  3444. "HTT_T2H_MSG_TYPE_PEER_MAP msg for peer id %d vdev id %d n",
  3445. peer_id, vdev_id);
  3446. /*
  3447. * check if peer already exists for this peer_id, if so
  3448. * this peer map event is in response for a wds peer add
  3449. * wmi command sent during wds source port learning.
  3450. * in this case just add the ast entry to the existing
  3451. * peer ast_list.
  3452. */
  3453. is_wds = !!(dpsoc->peer_id_to_obj_map[peer_id]);
  3454. dp_rx_peer_map_handler(soc->dp_soc, peer_id, hw_peer_id,
  3455. vdev_id, peer_mac_addr, 0,
  3456. is_wds);
  3457. break;
  3458. }
  3459. case HTT_T2H_MSG_TYPE_PEER_UNMAP:
  3460. {
  3461. u_int16_t peer_id;
  3462. u_int8_t vdev_id;
  3463. u_int8_t mac_addr[QDF_MAC_ADDR_SIZE] = {0};
  3464. peer_id = HTT_RX_PEER_UNMAP_PEER_ID_GET(*msg_word);
  3465. vdev_id = HTT_RX_PEER_UNMAP_VDEV_ID_GET(*msg_word);
  3466. dp_rx_peer_unmap_handler(soc->dp_soc, peer_id,
  3467. vdev_id, mac_addr, 0);
  3468. break;
  3469. }
  3470. case HTT_T2H_MSG_TYPE_SEC_IND:
  3471. {
  3472. u_int16_t peer_id;
  3473. enum cdp_sec_type sec_type;
  3474. int is_unicast;
  3475. peer_id = HTT_SEC_IND_PEER_ID_GET(*msg_word);
  3476. sec_type = HTT_SEC_IND_SEC_TYPE_GET(*msg_word);
  3477. is_unicast = HTT_SEC_IND_UNICAST_GET(*msg_word);
  3478. /* point to the first part of the Michael key */
  3479. msg_word++;
  3480. dp_rx_sec_ind_handler(
  3481. soc->dp_soc, peer_id, sec_type, is_unicast,
  3482. msg_word, msg_word + 2);
  3483. break;
  3484. }
  3485. case HTT_T2H_MSG_TYPE_PPDU_STATS_IND:
  3486. {
  3487. free_buf = dp_ppdu_stats_ind_handler(soc, msg_word,
  3488. htt_t2h_msg);
  3489. break;
  3490. }
  3491. case HTT_T2H_MSG_TYPE_PKTLOG:
  3492. {
  3493. dp_pktlog_msg_handler(soc, msg_word);
  3494. break;
  3495. }
  3496. case HTT_T2H_MSG_TYPE_VERSION_CONF:
  3497. {
  3498. htc_pm_runtime_put(soc->htc_soc);
  3499. soc->tgt_ver.major = HTT_VER_CONF_MAJOR_GET(*msg_word);
  3500. soc->tgt_ver.minor = HTT_VER_CONF_MINOR_GET(*msg_word);
  3501. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO_HIGH,
  3502. "target uses HTT version %d.%d; host uses %d.%d",
  3503. soc->tgt_ver.major, soc->tgt_ver.minor,
  3504. HTT_CURRENT_VERSION_MAJOR,
  3505. HTT_CURRENT_VERSION_MINOR);
  3506. if (soc->tgt_ver.major != HTT_CURRENT_VERSION_MAJOR) {
  3507. QDF_TRACE(QDF_MODULE_ID_TXRX,
  3508. QDF_TRACE_LEVEL_ERROR,
  3509. "*** Incompatible host/target HTT versions!");
  3510. }
  3511. /* abort if the target is incompatible with the host */
  3512. qdf_assert(soc->tgt_ver.major ==
  3513. HTT_CURRENT_VERSION_MAJOR);
  3514. if (soc->tgt_ver.minor != HTT_CURRENT_VERSION_MINOR) {
  3515. QDF_TRACE(QDF_MODULE_ID_TXRX,
  3516. QDF_TRACE_LEVEL_WARN,
  3517. "*** Warning: host/target HTT versions"
  3518. " are different, though compatible!");
  3519. }
  3520. break;
  3521. }
  3522. case HTT_T2H_MSG_TYPE_RX_ADDBA:
  3523. {
  3524. uint16_t peer_id;
  3525. uint8_t tid;
  3526. uint8_t win_sz;
  3527. uint16_t status;
  3528. struct dp_peer *peer;
  3529. /*
  3530. * Update REO Queue Desc with new values
  3531. */
  3532. peer_id = HTT_RX_ADDBA_PEER_ID_GET(*msg_word);
  3533. tid = HTT_RX_ADDBA_TID_GET(*msg_word);
  3534. win_sz = HTT_RX_ADDBA_WIN_SIZE_GET(*msg_word);
  3535. peer = dp_peer_find_by_id(soc->dp_soc, peer_id);
  3536. /*
  3537. * Window size needs to be incremented by 1
  3538. * since fw needs to represent a value of 256
  3539. * using just 8 bits
  3540. */
  3541. if (peer) {
  3542. status = dp_addba_requestprocess_wifi3(
  3543. (struct cdp_soc_t *)soc->dp_soc,
  3544. peer->mac_addr.raw, peer->vdev->vdev_id,
  3545. 0, tid, 0, win_sz + 1, 0xffff);
  3546. /*
  3547. * If PEER_LOCK_REF_PROTECT enbled dec ref
  3548. * which is inc by dp_peer_find_by_id
  3549. */
  3550. dp_peer_unref_del_find_by_id(peer);
  3551. QDF_TRACE(QDF_MODULE_ID_TXRX,
  3552. QDF_TRACE_LEVEL_INFO,
  3553. FL("PeerID %d BAW %d TID %d stat %d"),
  3554. peer_id, win_sz, tid, status);
  3555. } else {
  3556. QDF_TRACE(QDF_MODULE_ID_TXRX,
  3557. QDF_TRACE_LEVEL_ERROR,
  3558. FL("Peer not found peer id %d"),
  3559. peer_id);
  3560. }
  3561. break;
  3562. }
  3563. case HTT_T2H_MSG_TYPE_EXT_STATS_CONF:
  3564. {
  3565. dp_txrx_fw_stats_handler(soc->dp_soc, htt_t2h_msg);
  3566. break;
  3567. }
  3568. case HTT_T2H_MSG_TYPE_PEER_MAP_V2:
  3569. {
  3570. u_int8_t mac_addr_deswizzle_buf[QDF_MAC_ADDR_SIZE];
  3571. u_int8_t *peer_mac_addr;
  3572. u_int16_t peer_id;
  3573. u_int16_t hw_peer_id;
  3574. u_int8_t vdev_id;
  3575. bool is_wds;
  3576. u_int16_t ast_hash;
  3577. struct dp_ast_flow_override_info ast_flow_info;
  3578. qdf_mem_set(&ast_flow_info, 0,
  3579. sizeof(struct dp_ast_flow_override_info));
  3580. peer_id = HTT_RX_PEER_MAP_V2_SW_PEER_ID_GET(*msg_word);
  3581. hw_peer_id =
  3582. HTT_RX_PEER_MAP_V2_HW_PEER_ID_GET(*(msg_word + 2));
  3583. vdev_id = HTT_RX_PEER_MAP_V2_VDEV_ID_GET(*msg_word);
  3584. peer_mac_addr =
  3585. htt_t2h_mac_addr_deswizzle((u_int8_t *)(msg_word + 1),
  3586. &mac_addr_deswizzle_buf[0]);
  3587. is_wds =
  3588. HTT_RX_PEER_MAP_V2_NEXT_HOP_GET(*(msg_word + 3));
  3589. ast_hash =
  3590. HTT_RX_PEER_MAP_V2_AST_HASH_VALUE_GET(*(msg_word + 3));
  3591. /*
  3592. * Update 4 ast_index per peer, ast valid mask
  3593. * and TID flow valid mask.
  3594. * AST valid mask is 3 bit field corresponds to
  3595. * ast_index[3:1]. ast_index 0 is always valid.
  3596. */
  3597. ast_flow_info.ast_valid_mask =
  3598. HTT_RX_PEER_MAP_V2_AST_VALID_MASK_GET(*(msg_word + 3));
  3599. ast_flow_info.ast_idx[0] = hw_peer_id;
  3600. ast_flow_info.ast_flow_mask[0] =
  3601. HTT_RX_PEER_MAP_V2_AST_0_FLOW_MASK_GET(*(msg_word + 4));
  3602. ast_flow_info.ast_idx[1] =
  3603. HTT_RX_PEER_MAP_V2_AST_INDEX_1_GET(*(msg_word + 4));
  3604. ast_flow_info.ast_flow_mask[1] =
  3605. HTT_RX_PEER_MAP_V2_AST_1_FLOW_MASK_GET(*(msg_word + 4));
  3606. ast_flow_info.ast_idx[2] =
  3607. HTT_RX_PEER_MAP_V2_AST_INDEX_2_GET(*(msg_word + 5));
  3608. ast_flow_info.ast_flow_mask[2] =
  3609. HTT_RX_PEER_MAP_V2_AST_2_FLOW_MASK_GET(*(msg_word + 4));
  3610. ast_flow_info.ast_idx[3] =
  3611. HTT_RX_PEER_MAP_V2_AST_INDEX_3_GET(*(msg_word + 6));
  3612. ast_flow_info.ast_flow_mask[3] =
  3613. HTT_RX_PEER_MAP_V2_AST_3_FLOW_MASK_GET(*(msg_word + 4));
  3614. /*
  3615. * TID valid mask is applicable only
  3616. * for HI and LOW priority flows.
  3617. * tid_valid_mas is 8 bit field corresponds
  3618. * to TID[7:0]
  3619. */
  3620. ast_flow_info.tid_valid_low_pri_mask =
  3621. HTT_RX_PEER_MAP_V2_TID_VALID_LOW_PRI_GET(*(msg_word + 5));
  3622. ast_flow_info.tid_valid_hi_pri_mask =
  3623. HTT_RX_PEER_MAP_V2_TID_VALID_HI_PRI_GET(*(msg_word + 5));
  3624. QDF_TRACE(QDF_MODULE_ID_TXRX,
  3625. QDF_TRACE_LEVEL_INFO,
  3626. "HTT_T2H_MSG_TYPE_PEER_MAP msg for peer id %d vdev id %d n",
  3627. peer_id, vdev_id);
  3628. dp_rx_peer_map_handler(soc->dp_soc, peer_id,
  3629. hw_peer_id, vdev_id,
  3630. peer_mac_addr, ast_hash,
  3631. is_wds);
  3632. /*
  3633. * Update ast indexes for flow override support
  3634. * Applicable only for non wds peers
  3635. */
  3636. dp_peer_ast_index_flow_queue_map_create(
  3637. soc->dp_soc, is_wds,
  3638. peer_id, peer_mac_addr,
  3639. &ast_flow_info);
  3640. break;
  3641. }
  3642. case HTT_T2H_MSG_TYPE_PEER_UNMAP_V2:
  3643. {
  3644. u_int8_t mac_addr_deswizzle_buf[QDF_MAC_ADDR_SIZE];
  3645. u_int8_t *mac_addr;
  3646. u_int16_t peer_id;
  3647. u_int8_t vdev_id;
  3648. u_int8_t is_wds;
  3649. peer_id =
  3650. HTT_RX_PEER_UNMAP_V2_SW_PEER_ID_GET(*msg_word);
  3651. vdev_id = HTT_RX_PEER_UNMAP_V2_VDEV_ID_GET(*msg_word);
  3652. mac_addr =
  3653. htt_t2h_mac_addr_deswizzle((u_int8_t *)(msg_word + 1),
  3654. &mac_addr_deswizzle_buf[0]);
  3655. is_wds =
  3656. HTT_RX_PEER_UNMAP_V2_NEXT_HOP_GET(*(msg_word + 2));
  3657. QDF_TRACE(QDF_MODULE_ID_TXRX,
  3658. QDF_TRACE_LEVEL_INFO,
  3659. "HTT_T2H_MSG_TYPE_PEER_UNMAP msg for peer id %d vdev id %d n",
  3660. peer_id, vdev_id);
  3661. dp_rx_peer_unmap_handler(soc->dp_soc, peer_id,
  3662. vdev_id, mac_addr,
  3663. is_wds);
  3664. break;
  3665. }
  3666. default:
  3667. break;
  3668. };
  3669. /* Free the indication buffer */
  3670. if (free_buf)
  3671. qdf_nbuf_free(htt_t2h_msg);
  3672. }
  3673. /*
  3674. * dp_htt_h2t_full() - Send full handler (called from HTC)
  3675. * @context: Opaque context (HTT SOC handle)
  3676. * @pkt: HTC packet
  3677. *
  3678. * Return: enum htc_send_full_action
  3679. */
  3680. static enum htc_send_full_action
  3681. dp_htt_h2t_full(void *context, HTC_PACKET *pkt)
  3682. {
  3683. return HTC_SEND_FULL_KEEP;
  3684. }
  3685. /*
  3686. * dp_htt_hif_t2h_hp_callback() - HIF callback for high priority T2H messages
  3687. * @context: Opaque context (HTT SOC handle)
  3688. * @nbuf: nbuf containing T2H message
  3689. * @pipe_id: HIF pipe ID
  3690. *
  3691. * Return: QDF_STATUS
  3692. *
  3693. * TODO: Temporary change to bypass HTC connection for this new HIF pipe, which
  3694. * will be used for packet log and other high-priority HTT messages. Proper
  3695. * HTC connection to be added later once required FW changes are available
  3696. */
  3697. static QDF_STATUS
  3698. dp_htt_hif_t2h_hp_callback (void *context, qdf_nbuf_t nbuf, uint8_t pipe_id)
  3699. {
  3700. QDF_STATUS rc = QDF_STATUS_SUCCESS;
  3701. HTC_PACKET htc_pkt;
  3702. qdf_assert_always(pipe_id == DP_HTT_T2H_HP_PIPE);
  3703. qdf_mem_zero(&htc_pkt, sizeof(htc_pkt));
  3704. htc_pkt.Status = QDF_STATUS_SUCCESS;
  3705. htc_pkt.pPktContext = (void *)nbuf;
  3706. dp_htt_t2h_msg_handler(context, &htc_pkt);
  3707. return rc;
  3708. }
  3709. /*
  3710. * htt_htc_soc_attach() - Register SOC level HTT instance with HTC
  3711. * @htt_soc: HTT SOC handle
  3712. *
  3713. * Return: QDF_STATUS
  3714. */
  3715. static QDF_STATUS
  3716. htt_htc_soc_attach(struct htt_soc *soc)
  3717. {
  3718. struct htc_service_connect_req connect;
  3719. struct htc_service_connect_resp response;
  3720. QDF_STATUS status;
  3721. struct dp_soc *dpsoc = soc->dp_soc;
  3722. qdf_mem_zero(&connect, sizeof(connect));
  3723. qdf_mem_zero(&response, sizeof(response));
  3724. connect.pMetaData = NULL;
  3725. connect.MetaDataLength = 0;
  3726. connect.EpCallbacks.pContext = soc;
  3727. connect.EpCallbacks.EpTxComplete = dp_htt_h2t_send_complete;
  3728. connect.EpCallbacks.EpTxCompleteMultiple = NULL;
  3729. connect.EpCallbacks.EpRecv = dp_htt_t2h_msg_handler;
  3730. /* rx buffers currently are provided by HIF, not by EpRecvRefill */
  3731. connect.EpCallbacks.EpRecvRefill = NULL;
  3732. /* N/A, fill is done by HIF */
  3733. connect.EpCallbacks.RecvRefillWaterMark = 1;
  3734. connect.EpCallbacks.EpSendFull = dp_htt_h2t_full;
  3735. /*
  3736. * Specify how deep to let a queue get before htc_send_pkt will
  3737. * call the EpSendFull function due to excessive send queue depth.
  3738. */
  3739. connect.MaxSendQueueDepth = DP_HTT_MAX_SEND_QUEUE_DEPTH;
  3740. /* disable flow control for HTT data message service */
  3741. connect.ConnectionFlags |= HTC_CONNECT_FLAGS_DISABLE_CREDIT_FLOW_CTRL;
  3742. /* connect to control service */
  3743. connect.service_id = HTT_DATA_MSG_SVC;
  3744. status = htc_connect_service(soc->htc_soc, &connect, &response);
  3745. if (status != QDF_STATUS_SUCCESS)
  3746. return status;
  3747. soc->htc_endpoint = response.Endpoint;
  3748. hif_save_htc_htt_config_endpoint(dpsoc->hif_handle, soc->htc_endpoint);
  3749. htt_interface_logging_init(&soc->htt_logger_handle);
  3750. dp_hif_update_pipe_callback(soc->dp_soc, (void *)soc,
  3751. dp_htt_hif_t2h_hp_callback, DP_HTT_T2H_HP_PIPE);
  3752. return QDF_STATUS_SUCCESS; /* success */
  3753. }
  3754. /*
  3755. * htt_soc_initialize() - SOC level HTT initialization
  3756. * @htt_soc: Opaque htt SOC handle
  3757. * @ctrl_psoc: Opaque ctrl SOC handle
  3758. * @htc_soc: SOC level HTC handle
  3759. * @hal_soc: Opaque HAL SOC handle
  3760. * @osdev: QDF device
  3761. *
  3762. * Return: HTT handle on success; NULL on failure
  3763. */
  3764. void *
  3765. htt_soc_initialize(struct htt_soc *htt_soc,
  3766. struct cdp_ctrl_objmgr_psoc *ctrl_psoc,
  3767. HTC_HANDLE htc_soc,
  3768. hal_soc_handle_t hal_soc_hdl, qdf_device_t osdev)
  3769. {
  3770. struct htt_soc *soc = (struct htt_soc *)htt_soc;
  3771. soc->osdev = osdev;
  3772. soc->ctrl_psoc = ctrl_psoc;
  3773. soc->htc_soc = htc_soc;
  3774. soc->hal_soc = hal_soc_hdl;
  3775. if (htt_htc_soc_attach(soc))
  3776. goto fail2;
  3777. return soc;
  3778. fail2:
  3779. return NULL;
  3780. }
  3781. void htt_soc_htc_dealloc(struct htt_soc *htt_handle)
  3782. {
  3783. htt_interface_logging_deinit(htt_handle->htt_logger_handle);
  3784. htt_htc_misc_pkt_pool_free(htt_handle);
  3785. htt_htc_pkt_pool_free(htt_handle);
  3786. }
  3787. /*
  3788. * htt_soc_htc_prealloc() - HTC memory prealloc
  3789. * @htt_soc: SOC level HTT handle
  3790. *
  3791. * Return: QDF_STATUS_SUCCESS on Success or
  3792. * QDF_STATUS_E_NOMEM on allocation failure
  3793. */
  3794. QDF_STATUS htt_soc_htc_prealloc(struct htt_soc *soc)
  3795. {
  3796. int i;
  3797. soc->htt_htc_pkt_freelist = NULL;
  3798. /* pre-allocate some HTC_PACKET objects */
  3799. for (i = 0; i < HTT_HTC_PKT_POOL_INIT_SIZE; i++) {
  3800. struct dp_htt_htc_pkt_union *pkt;
  3801. pkt = qdf_mem_malloc(sizeof(*pkt));
  3802. if (!pkt)
  3803. return QDF_STATUS_E_NOMEM;
  3804. htt_htc_pkt_free(soc, &pkt->u.pkt);
  3805. }
  3806. return QDF_STATUS_SUCCESS;
  3807. }
  3808. /*
  3809. * htt_soc_detach() - Free SOC level HTT handle
  3810. * @htt_hdl: HTT SOC handle
  3811. */
  3812. void htt_soc_detach(struct htt_soc *htt_hdl)
  3813. {
  3814. int i;
  3815. struct htt_soc *htt_handle = (struct htt_soc *)htt_hdl;
  3816. for (i = 0; i < MAX_PDEV_CNT; i++) {
  3817. qdf_mem_free(htt_handle->pdevid_tt[i].umac_ttt);
  3818. qdf_mem_free(htt_handle->pdevid_tt[i].lmac_ttt);
  3819. }
  3820. HTT_TX_MUTEX_DESTROY(&htt_handle->htt_tx_mutex);
  3821. qdf_mem_free(htt_handle);
  3822. }
  3823. /**
  3824. * dp_h2t_ext_stats_msg_send(): function to contruct HTT message to pass to FW
  3825. * @pdev: DP PDEV handle
  3826. * @stats_type_upload_mask: stats type requested by user
  3827. * @config_param_0: extra configuration parameters
  3828. * @config_param_1: extra configuration parameters
  3829. * @config_param_2: extra configuration parameters
  3830. * @config_param_3: extra configuration parameters
  3831. * @mac_id: mac number
  3832. *
  3833. * return: QDF STATUS
  3834. */
  3835. QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
  3836. uint32_t stats_type_upload_mask, uint32_t config_param_0,
  3837. uint32_t config_param_1, uint32_t config_param_2,
  3838. uint32_t config_param_3, int cookie_val, int cookie_msb,
  3839. uint8_t mac_id)
  3840. {
  3841. struct htt_soc *soc = pdev->soc->htt_handle;
  3842. struct dp_htt_htc_pkt *pkt;
  3843. qdf_nbuf_t msg;
  3844. uint32_t *msg_word;
  3845. uint8_t pdev_mask = 0;
  3846. uint8_t *htt_logger_bufp;
  3847. int mac_for_pdev;
  3848. int target_pdev_id;
  3849. QDF_STATUS status;
  3850. msg = qdf_nbuf_alloc(
  3851. soc->osdev,
  3852. HTT_MSG_BUF_SIZE(HTT_H2T_EXT_STATS_REQ_MSG_SZ),
  3853. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  3854. if (!msg)
  3855. return QDF_STATUS_E_NOMEM;
  3856. /*TODO:Add support for SOC stats
  3857. * Bit 0: SOC Stats
  3858. * Bit 1: Pdev stats for pdev id 0
  3859. * Bit 2: Pdev stats for pdev id 1
  3860. * Bit 3: Pdev stats for pdev id 2
  3861. */
  3862. mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev->pdev_id);
  3863. target_pdev_id =
  3864. dp_get_target_pdev_id_for_host_pdev_id(pdev->soc, mac_for_pdev);
  3865. pdev_mask = 1 << target_pdev_id;
  3866. /*
  3867. * Set the length of the message.
  3868. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  3869. * separately during the below call to qdf_nbuf_push_head.
  3870. * The contribution from the HTC header is added separately inside HTC.
  3871. */
  3872. if (qdf_nbuf_put_tail(msg, HTT_H2T_EXT_STATS_REQ_MSG_SZ) == NULL) {
  3873. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  3874. "Failed to expand head for HTT_EXT_STATS");
  3875. qdf_nbuf_free(msg);
  3876. return QDF_STATUS_E_FAILURE;
  3877. }
  3878. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
  3879. "-----%s:%d----\n cookie <-> %d\n config_param_0 %u\n"
  3880. "config_param_1 %u\n config_param_2 %u\n"
  3881. "config_param_4 %u\n -------------",
  3882. __func__, __LINE__, cookie_val, config_param_0,
  3883. config_param_1, config_param_2, config_param_3);
  3884. msg_word = (uint32_t *) qdf_nbuf_data(msg);
  3885. qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
  3886. htt_logger_bufp = (uint8_t *)msg_word;
  3887. *msg_word = 0;
  3888. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_EXT_STATS_REQ);
  3889. HTT_H2T_EXT_STATS_REQ_PDEV_MASK_SET(*msg_word, pdev_mask);
  3890. HTT_H2T_EXT_STATS_REQ_STATS_TYPE_SET(*msg_word, stats_type_upload_mask);
  3891. /* word 1 */
  3892. msg_word++;
  3893. *msg_word = 0;
  3894. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_0);
  3895. /* word 2 */
  3896. msg_word++;
  3897. *msg_word = 0;
  3898. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_1);
  3899. /* word 3 */
  3900. msg_word++;
  3901. *msg_word = 0;
  3902. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_2);
  3903. /* word 4 */
  3904. msg_word++;
  3905. *msg_word = 0;
  3906. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_3);
  3907. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, 0);
  3908. /* word 5 */
  3909. msg_word++;
  3910. /* word 6 */
  3911. msg_word++;
  3912. *msg_word = 0;
  3913. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, cookie_val);
  3914. /* word 7 */
  3915. msg_word++;
  3916. *msg_word = 0;
  3917. /*Using last 2 bits for pdev_id */
  3918. cookie_msb = ((cookie_msb << 2) | pdev->pdev_id);
  3919. HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, cookie_msb);
  3920. pkt = htt_htc_pkt_alloc(soc);
  3921. if (!pkt) {
  3922. qdf_nbuf_free(msg);
  3923. return QDF_STATUS_E_NOMEM;
  3924. }
  3925. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  3926. SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
  3927. dp_htt_h2t_send_complete_free_netbuf,
  3928. qdf_nbuf_data(msg), qdf_nbuf_len(msg),
  3929. soc->htc_endpoint,
  3930. /* tag for FW response msg not guaranteed */
  3931. HTC_TX_PACKET_TAG_RUNTIME_PUT);
  3932. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
  3933. status = DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_EXT_STATS_REQ,
  3934. htt_logger_bufp);
  3935. if (status != QDF_STATUS_SUCCESS) {
  3936. qdf_nbuf_free(msg);
  3937. htt_htc_pkt_free(soc, pkt);
  3938. }
  3939. return status;
  3940. }
  3941. /**
  3942. * dp_h2t_3tuple_config_send(): function to contruct 3 tuple configuration
  3943. * HTT message to pass to FW
  3944. * @pdev: DP PDEV handle
  3945. * @tuple_mask: tuple configuration to report 3 tuple hash value in either
  3946. * toeplitz_2_or_4 or flow_id_toeplitz in MSDU START TLV.
  3947. *
  3948. * tuple_mask[1:0]:
  3949. * 00 - Do not report 3 tuple hash value
  3950. * 10 - Report 3 tuple hash value in toeplitz_2_or_4
  3951. * 01 - Report 3 tuple hash value in flow_id_toeplitz
  3952. * 11 - Report 3 tuple hash value in both toeplitz_2_or_4 & flow_id_toeplitz
  3953. *
  3954. * return: QDF STATUS
  3955. */
  3956. QDF_STATUS dp_h2t_3tuple_config_send(struct dp_pdev *pdev,
  3957. uint32_t tuple_mask, uint8_t mac_id)
  3958. {
  3959. struct htt_soc *soc = pdev->soc->htt_handle;
  3960. struct dp_htt_htc_pkt *pkt;
  3961. qdf_nbuf_t msg;
  3962. uint32_t *msg_word;
  3963. uint8_t *htt_logger_bufp;
  3964. int mac_for_pdev;
  3965. int target_pdev_id;
  3966. msg = qdf_nbuf_alloc(
  3967. soc->osdev,
  3968. HTT_MSG_BUF_SIZE(HTT_3_TUPLE_HASH_CFG_REQ_BYTES),
  3969. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  3970. if (!msg)
  3971. return QDF_STATUS_E_NOMEM;
  3972. mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, pdev->pdev_id);
  3973. target_pdev_id =
  3974. dp_get_target_pdev_id_for_host_pdev_id(pdev->soc, mac_for_pdev);
  3975. /*
  3976. * Set the length of the message.
  3977. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  3978. * separately during the below call to qdf_nbuf_push_head.
  3979. * The contribution from the HTC header is added separately inside HTC.
  3980. */
  3981. if (!qdf_nbuf_put_tail(msg, HTT_3_TUPLE_HASH_CFG_REQ_BYTES)) {
  3982. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  3983. "Failed to expand head for HTT_3TUPLE_CONFIG");
  3984. qdf_nbuf_free(msg);
  3985. return QDF_STATUS_E_FAILURE;
  3986. }
  3987. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
  3988. "config_param_sent %s:%d 0x%x for target_pdev %d\n -------------",
  3989. __func__, __LINE__, tuple_mask, target_pdev_id);
  3990. msg_word = (uint32_t *)qdf_nbuf_data(msg);
  3991. qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
  3992. htt_logger_bufp = (uint8_t *)msg_word;
  3993. *msg_word = 0;
  3994. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_3_TUPLE_HASH_CFG);
  3995. HTT_RX_3_TUPLE_HASH_PDEV_ID_SET(*msg_word, target_pdev_id);
  3996. msg_word++;
  3997. *msg_word = 0;
  3998. HTT_H2T_FLOW_ID_TOEPLITZ_FIELD_CONFIG_SET(*msg_word, tuple_mask);
  3999. HTT_H2T_TOEPLITZ_2_OR_4_FIELD_CONFIG_SET(*msg_word, tuple_mask);
  4000. pkt = htt_htc_pkt_alloc(soc);
  4001. if (!pkt) {
  4002. qdf_nbuf_free(msg);
  4003. return QDF_STATUS_E_NOMEM;
  4004. }
  4005. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  4006. SET_HTC_PACKET_INFO_TX(
  4007. &pkt->htc_pkt,
  4008. dp_htt_h2t_send_complete_free_netbuf,
  4009. qdf_nbuf_data(msg),
  4010. qdf_nbuf_len(msg),
  4011. soc->htc_endpoint,
  4012. 1);
  4013. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
  4014. DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_3_TUPLE_HASH_CFG,
  4015. htt_logger_bufp);
  4016. return QDF_STATUS_SUCCESS;
  4017. }
  4018. /* This macro will revert once proper HTT header will define for
  4019. * HTT_H2T_MSG_TYPE_PPDU_STATS_CFG in htt.h file
  4020. * */
  4021. #if defined(WDI_EVENT_ENABLE)
  4022. /**
  4023. * dp_h2t_cfg_stats_msg_send(): function to construct HTT message to pass to FW
  4024. * @pdev: DP PDEV handle
  4025. * @stats_type_upload_mask: stats type requested by user
  4026. * @mac_id: Mac id number
  4027. *
  4028. * return: QDF STATUS
  4029. */
  4030. QDF_STATUS dp_h2t_cfg_stats_msg_send(struct dp_pdev *pdev,
  4031. uint32_t stats_type_upload_mask, uint8_t mac_id)
  4032. {
  4033. struct htt_soc *soc = pdev->soc->htt_handle;
  4034. struct dp_htt_htc_pkt *pkt;
  4035. qdf_nbuf_t msg;
  4036. uint32_t *msg_word;
  4037. uint8_t pdev_mask;
  4038. QDF_STATUS status;
  4039. msg = qdf_nbuf_alloc(
  4040. soc->osdev,
  4041. HTT_MSG_BUF_SIZE(HTT_H2T_PPDU_STATS_CFG_MSG_SZ),
  4042. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, true);
  4043. if (!msg) {
  4044. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  4045. "Fail to allocate HTT_H2T_PPDU_STATS_CFG_MSG_SZ msg buffer");
  4046. qdf_assert(0);
  4047. return QDF_STATUS_E_NOMEM;
  4048. }
  4049. /*TODO:Add support for SOC stats
  4050. * Bit 0: SOC Stats
  4051. * Bit 1: Pdev stats for pdev id 0
  4052. * Bit 2: Pdev stats for pdev id 1
  4053. * Bit 3: Pdev stats for pdev id 2
  4054. */
  4055. pdev_mask = 1 << dp_get_target_pdev_id_for_host_pdev_id(pdev->soc,
  4056. mac_id);
  4057. /*
  4058. * Set the length of the message.
  4059. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  4060. * separately during the below call to qdf_nbuf_push_head.
  4061. * The contribution from the HTC header is added separately inside HTC.
  4062. */
  4063. if (qdf_nbuf_put_tail(msg, HTT_H2T_PPDU_STATS_CFG_MSG_SZ) == NULL) {
  4064. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  4065. "Failed to expand head for HTT_CFG_STATS");
  4066. qdf_nbuf_free(msg);
  4067. return QDF_STATUS_E_FAILURE;
  4068. }
  4069. msg_word = (uint32_t *) qdf_nbuf_data(msg);
  4070. qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
  4071. *msg_word = 0;
  4072. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_PPDU_STATS_CFG);
  4073. HTT_H2T_PPDU_STATS_CFG_PDEV_MASK_SET(*msg_word, pdev_mask);
  4074. HTT_H2T_PPDU_STATS_CFG_TLV_BITMASK_SET(*msg_word,
  4075. stats_type_upload_mask);
  4076. pkt = htt_htc_pkt_alloc(soc);
  4077. if (!pkt) {
  4078. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  4079. "Fail to allocate dp_htt_htc_pkt buffer");
  4080. qdf_assert(0);
  4081. qdf_nbuf_free(msg);
  4082. return QDF_STATUS_E_NOMEM;
  4083. }
  4084. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  4085. SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
  4086. dp_htt_h2t_send_complete_free_netbuf,
  4087. qdf_nbuf_data(msg), qdf_nbuf_len(msg),
  4088. soc->htc_endpoint,
  4089. 1); /* tag - not relevant here */
  4090. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
  4091. status = DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_PPDU_STATS_CFG,
  4092. (uint8_t *)msg_word);
  4093. if (status != QDF_STATUS_SUCCESS) {
  4094. qdf_nbuf_free(msg);
  4095. htt_htc_pkt_free(soc, pkt);
  4096. }
  4097. return status;
  4098. }
  4099. #endif
  4100. void
  4101. dp_peer_update_inactive_time(struct dp_pdev *pdev, uint32_t tag_type,
  4102. uint32_t *tag_buf)
  4103. {
  4104. switch (tag_type) {
  4105. case HTT_STATS_PEER_DETAILS_TAG:
  4106. {
  4107. htt_peer_details_tlv *dp_stats_buf =
  4108. (htt_peer_details_tlv *)tag_buf;
  4109. pdev->fw_stats_peer_id = dp_stats_buf->sw_peer_id;
  4110. }
  4111. break;
  4112. case HTT_STATS_PEER_STATS_CMN_TAG:
  4113. {
  4114. htt_peer_stats_cmn_tlv *dp_stats_buf =
  4115. (htt_peer_stats_cmn_tlv *)tag_buf;
  4116. struct dp_peer *peer = dp_peer_find_by_id(pdev->soc,
  4117. pdev->fw_stats_peer_id);
  4118. if (peer && !peer->bss_peer) {
  4119. peer->stats.tx.inactive_time =
  4120. dp_stats_buf->inactive_time;
  4121. qdf_event_set(&pdev->fw_peer_stats_event);
  4122. }
  4123. if (peer)
  4124. dp_peer_unref_del_find_by_id(peer);
  4125. }
  4126. break;
  4127. default:
  4128. qdf_err("Invalid tag_type");
  4129. }
  4130. }
  4131. /**
  4132. * dp_htt_rx_flow_fst_setup(): Send HTT Rx FST setup message to FW
  4133. * @pdev: DP pdev handle
  4134. * @fse_setup_info: FST setup parameters
  4135. *
  4136. * Return: Success when HTT message is sent, error on failure
  4137. */
  4138. QDF_STATUS
  4139. dp_htt_rx_flow_fst_setup(struct dp_pdev *pdev,
  4140. struct dp_htt_rx_flow_fst_setup *fse_setup_info)
  4141. {
  4142. struct htt_soc *soc = pdev->soc->htt_handle;
  4143. struct dp_htt_htc_pkt *pkt;
  4144. qdf_nbuf_t msg;
  4145. u_int32_t *msg_word;
  4146. struct htt_h2t_msg_rx_fse_setup_t *fse_setup;
  4147. uint8_t *htt_logger_bufp;
  4148. u_int32_t *key;
  4149. QDF_STATUS status;
  4150. msg = qdf_nbuf_alloc(
  4151. soc->osdev,
  4152. HTT_MSG_BUF_SIZE(sizeof(struct htt_h2t_msg_rx_fse_setup_t)),
  4153. /* reserve room for the HTC header */
  4154. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  4155. if (!msg)
  4156. return QDF_STATUS_E_NOMEM;
  4157. /*
  4158. * Set the length of the message.
  4159. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  4160. * separately during the below call to qdf_nbuf_push_head.
  4161. * The contribution from the HTC header is added separately inside HTC.
  4162. */
  4163. if (!qdf_nbuf_put_tail(msg,
  4164. sizeof(struct htt_h2t_msg_rx_fse_setup_t))) {
  4165. qdf_err("Failed to expand head for HTT RX_FSE_SETUP msg");
  4166. return QDF_STATUS_E_FAILURE;
  4167. }
  4168. /* fill in the message contents */
  4169. msg_word = (u_int32_t *)qdf_nbuf_data(msg);
  4170. memset(msg_word, 0, sizeof(struct htt_h2t_msg_rx_fse_setup_t));
  4171. /* rewind beyond alignment pad to get to the HTC header reserved area */
  4172. qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
  4173. htt_logger_bufp = (uint8_t *)msg_word;
  4174. *msg_word = 0;
  4175. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_FSE_SETUP_CFG);
  4176. fse_setup = (struct htt_h2t_msg_rx_fse_setup_t *)msg_word;
  4177. HTT_RX_FSE_SETUP_PDEV_ID_SET(*msg_word, fse_setup_info->pdev_id);
  4178. msg_word++;
  4179. HTT_RX_FSE_SETUP_NUM_REC_SET(*msg_word, fse_setup_info->max_entries);
  4180. HTT_RX_FSE_SETUP_MAX_SEARCH_SET(*msg_word, fse_setup_info->max_search);
  4181. HTT_RX_FSE_SETUP_IP_DA_SA_PREFIX_SET(*msg_word,
  4182. fse_setup_info->ip_da_sa_prefix);
  4183. msg_word++;
  4184. HTT_RX_FSE_SETUP_BASE_ADDR_LO_SET(*msg_word,
  4185. fse_setup_info->base_addr_lo);
  4186. msg_word++;
  4187. HTT_RX_FSE_SETUP_BASE_ADDR_HI_SET(*msg_word,
  4188. fse_setup_info->base_addr_hi);
  4189. key = (u_int32_t *)fse_setup_info->hash_key;
  4190. fse_setup->toeplitz31_0 = *key++;
  4191. fse_setup->toeplitz63_32 = *key++;
  4192. fse_setup->toeplitz95_64 = *key++;
  4193. fse_setup->toeplitz127_96 = *key++;
  4194. fse_setup->toeplitz159_128 = *key++;
  4195. fse_setup->toeplitz191_160 = *key++;
  4196. fse_setup->toeplitz223_192 = *key++;
  4197. fse_setup->toeplitz255_224 = *key++;
  4198. fse_setup->toeplitz287_256 = *key++;
  4199. fse_setup->toeplitz314_288 = *key;
  4200. msg_word++;
  4201. HTT_RX_FSE_SETUP_HASH_VALUE_SET(*msg_word, fse_setup->toeplitz31_0);
  4202. msg_word++;
  4203. HTT_RX_FSE_SETUP_HASH_VALUE_SET(*msg_word, fse_setup->toeplitz63_32);
  4204. msg_word++;
  4205. HTT_RX_FSE_SETUP_HASH_VALUE_SET(*msg_word, fse_setup->toeplitz95_64);
  4206. msg_word++;
  4207. HTT_RX_FSE_SETUP_HASH_VALUE_SET(*msg_word, fse_setup->toeplitz127_96);
  4208. msg_word++;
  4209. HTT_RX_FSE_SETUP_HASH_VALUE_SET(*msg_word, fse_setup->toeplitz159_128);
  4210. msg_word++;
  4211. HTT_RX_FSE_SETUP_HASH_VALUE_SET(*msg_word, fse_setup->toeplitz191_160);
  4212. msg_word++;
  4213. HTT_RX_FSE_SETUP_HASH_VALUE_SET(*msg_word, fse_setup->toeplitz223_192);
  4214. msg_word++;
  4215. HTT_RX_FSE_SETUP_HASH_VALUE_SET(*msg_word, fse_setup->toeplitz255_224);
  4216. msg_word++;
  4217. HTT_RX_FSE_SETUP_HASH_VALUE_SET(*msg_word, fse_setup->toeplitz287_256);
  4218. msg_word++;
  4219. HTT_RX_FSE_SETUP_HASH_314_288_SET(*msg_word,
  4220. fse_setup->toeplitz314_288);
  4221. pkt = htt_htc_pkt_alloc(soc);
  4222. if (!pkt) {
  4223. qdf_err("Fail to allocate dp_htt_htc_pkt buffer");
  4224. qdf_assert(0);
  4225. qdf_nbuf_free(msg);
  4226. return QDF_STATUS_E_RESOURCES; /* failure */
  4227. }
  4228. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  4229. SET_HTC_PACKET_INFO_TX(
  4230. &pkt->htc_pkt,
  4231. dp_htt_h2t_send_complete_free_netbuf,
  4232. qdf_nbuf_data(msg),
  4233. qdf_nbuf_len(msg),
  4234. soc->htc_endpoint,
  4235. HTC_TX_PACKET_TAG_RUNTIME_PUT);
  4236. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
  4237. status = DP_HTT_SEND_HTC_PKT(soc, pkt,
  4238. HTT_H2T_MSG_TYPE_RX_FSE_SETUP_CFG,
  4239. htt_logger_bufp);
  4240. if (status == QDF_STATUS_SUCCESS) {
  4241. dp_info("HTT_H2T RX_FSE_SETUP sent to FW for pdev = %u",
  4242. fse_setup_info->pdev_id);
  4243. QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_ANY, QDF_TRACE_LEVEL_DEBUG,
  4244. (void *)fse_setup_info->hash_key,
  4245. fse_setup_info->hash_key_len);
  4246. } else {
  4247. qdf_nbuf_free(msg);
  4248. htt_htc_pkt_free(soc, pkt);
  4249. }
  4250. return status;
  4251. }
  4252. /**
  4253. * dp_htt_rx_flow_fse_operation(): Send HTT Flow Search Entry msg to
  4254. * add/del a flow in HW
  4255. * @pdev: DP pdev handle
  4256. * @fse_op_info: Flow entry parameters
  4257. *
  4258. * Return: Success when HTT message is sent, error on failure
  4259. */
  4260. QDF_STATUS
  4261. dp_htt_rx_flow_fse_operation(struct dp_pdev *pdev,
  4262. struct dp_htt_rx_flow_fst_operation *fse_op_info)
  4263. {
  4264. struct htt_soc *soc = pdev->soc->htt_handle;
  4265. struct dp_htt_htc_pkt *pkt;
  4266. qdf_nbuf_t msg;
  4267. u_int32_t *msg_word;
  4268. struct htt_h2t_msg_rx_fse_operation_t *fse_operation;
  4269. uint8_t *htt_logger_bufp;
  4270. QDF_STATUS status;
  4271. msg = qdf_nbuf_alloc(
  4272. soc->osdev,
  4273. HTT_MSG_BUF_SIZE(sizeof(struct htt_h2t_msg_rx_fse_operation_t)),
  4274. /* reserve room for the HTC header */
  4275. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
  4276. if (!msg)
  4277. return QDF_STATUS_E_NOMEM;
  4278. /*
  4279. * Set the length of the message.
  4280. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  4281. * separately during the below call to qdf_nbuf_push_head.
  4282. * The contribution from the HTC header is added separately inside HTC.
  4283. */
  4284. if (!qdf_nbuf_put_tail(msg,
  4285. sizeof(struct htt_h2t_msg_rx_fse_operation_t))) {
  4286. qdf_err("Failed to expand head for HTT_RX_FSE_OPERATION msg");
  4287. qdf_nbuf_free(msg);
  4288. return QDF_STATUS_E_FAILURE;
  4289. }
  4290. /* fill in the message contents */
  4291. msg_word = (u_int32_t *)qdf_nbuf_data(msg);
  4292. memset(msg_word, 0, sizeof(struct htt_h2t_msg_rx_fse_operation_t));
  4293. /* rewind beyond alignment pad to get to the HTC header reserved area */
  4294. qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
  4295. htt_logger_bufp = (uint8_t *)msg_word;
  4296. *msg_word = 0;
  4297. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_FSE_OPERATION_CFG);
  4298. fse_operation = (struct htt_h2t_msg_rx_fse_operation_t *)msg_word;
  4299. HTT_RX_FSE_OPERATION_PDEV_ID_SET(*msg_word, fse_op_info->pdev_id);
  4300. msg_word++;
  4301. HTT_RX_FSE_IPSEC_VALID_SET(*msg_word, false);
  4302. if (fse_op_info->op_code == DP_HTT_FST_CACHE_INVALIDATE_ENTRY) {
  4303. HTT_RX_FSE_OPERATION_SET(*msg_word,
  4304. HTT_RX_FSE_CACHE_INVALIDATE_ENTRY);
  4305. msg_word++;
  4306. HTT_RX_FSE_OPERATION_IP_ADDR_SET(
  4307. *msg_word,
  4308. qdf_htonl(fse_op_info->rx_flow->flow_tuple_info.src_ip_31_0));
  4309. msg_word++;
  4310. HTT_RX_FSE_OPERATION_IP_ADDR_SET(
  4311. *msg_word,
  4312. qdf_htonl(fse_op_info->rx_flow->flow_tuple_info.src_ip_63_32));
  4313. msg_word++;
  4314. HTT_RX_FSE_OPERATION_IP_ADDR_SET(
  4315. *msg_word,
  4316. qdf_htonl(fse_op_info->rx_flow->flow_tuple_info.src_ip_95_64));
  4317. msg_word++;
  4318. HTT_RX_FSE_OPERATION_IP_ADDR_SET(
  4319. *msg_word,
  4320. qdf_htonl(fse_op_info->rx_flow->flow_tuple_info.src_ip_127_96));
  4321. msg_word++;
  4322. HTT_RX_FSE_OPERATION_IP_ADDR_SET(
  4323. *msg_word,
  4324. qdf_htonl(fse_op_info->rx_flow->flow_tuple_info.dest_ip_31_0));
  4325. msg_word++;
  4326. HTT_RX_FSE_OPERATION_IP_ADDR_SET(
  4327. *msg_word,
  4328. qdf_htonl(fse_op_info->rx_flow->flow_tuple_info.dest_ip_63_32));
  4329. msg_word++;
  4330. HTT_RX_FSE_OPERATION_IP_ADDR_SET(
  4331. *msg_word,
  4332. qdf_htonl(fse_op_info->rx_flow->flow_tuple_info.dest_ip_95_64));
  4333. msg_word++;
  4334. HTT_RX_FSE_OPERATION_IP_ADDR_SET(
  4335. *msg_word,
  4336. qdf_htonl(
  4337. fse_op_info->rx_flow->flow_tuple_info.dest_ip_127_96));
  4338. msg_word++;
  4339. HTT_RX_FSE_SOURCEPORT_SET(
  4340. *msg_word,
  4341. fse_op_info->rx_flow->flow_tuple_info.src_port);
  4342. HTT_RX_FSE_DESTPORT_SET(
  4343. *msg_word,
  4344. fse_op_info->rx_flow->flow_tuple_info.dest_port);
  4345. msg_word++;
  4346. HTT_RX_FSE_L4_PROTO_SET(
  4347. *msg_word,
  4348. fse_op_info->rx_flow->flow_tuple_info.l4_protocol);
  4349. } else if (fse_op_info->op_code == DP_HTT_FST_CACHE_INVALIDATE_FULL) {
  4350. HTT_RX_FSE_OPERATION_SET(*msg_word,
  4351. HTT_RX_FSE_CACHE_INVALIDATE_FULL);
  4352. } else if (fse_op_info->op_code == DP_HTT_FST_DISABLE) {
  4353. HTT_RX_FSE_OPERATION_SET(*msg_word, HTT_RX_FSE_DISABLE);
  4354. } else if (fse_op_info->op_code == DP_HTT_FST_ENABLE) {
  4355. HTT_RX_FSE_OPERATION_SET(*msg_word, HTT_RX_FSE_ENABLE);
  4356. }
  4357. pkt = htt_htc_pkt_alloc(soc);
  4358. if (!pkt) {
  4359. qdf_err("Fail to allocate dp_htt_htc_pkt buffer");
  4360. qdf_assert(0);
  4361. qdf_nbuf_free(msg);
  4362. return QDF_STATUS_E_RESOURCES; /* failure */
  4363. }
  4364. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  4365. SET_HTC_PACKET_INFO_TX(
  4366. &pkt->htc_pkt,
  4367. dp_htt_h2t_send_complete_free_netbuf,
  4368. qdf_nbuf_data(msg),
  4369. qdf_nbuf_len(msg),
  4370. soc->htc_endpoint,
  4371. HTC_TX_PACKET_TAG_RUNTIME_PUT);
  4372. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
  4373. status = DP_HTT_SEND_HTC_PKT(soc, pkt,
  4374. HTT_H2T_MSG_TYPE_RX_FSE_OPERATION_CFG,
  4375. htt_logger_bufp);
  4376. if (status == QDF_STATUS_SUCCESS) {
  4377. dp_info("HTT_H2T RX_FSE_OPERATION_CFG sent to FW for pdev = %u",
  4378. fse_op_info->pdev_id);
  4379. } else {
  4380. qdf_nbuf_free(msg);
  4381. htt_htc_pkt_free(soc, pkt);
  4382. }
  4383. return status;
  4384. }
  4385. /**
  4386. * dp_htt_rx_fisa_config(): Send HTT msg to configure FISA
  4387. * @pdev: DP pdev handle
  4388. * @fse_op_info: Flow entry parameters
  4389. *
  4390. * Return: Success when HTT message is sent, error on failure
  4391. */
  4392. QDF_STATUS
  4393. dp_htt_rx_fisa_config(struct dp_pdev *pdev,
  4394. struct dp_htt_rx_fisa_cfg *fisa_config)
  4395. {
  4396. struct htt_soc *soc = pdev->soc->htt_handle;
  4397. struct dp_htt_htc_pkt *pkt;
  4398. qdf_nbuf_t msg;
  4399. u_int32_t *msg_word;
  4400. struct htt_h2t_msg_type_fisa_config_t *htt_fisa_config;
  4401. uint8_t *htt_logger_bufp;
  4402. uint32_t len;
  4403. QDF_STATUS status;
  4404. len = HTT_MSG_BUF_SIZE(sizeof(struct htt_h2t_msg_type_fisa_config_t));
  4405. msg = qdf_nbuf_alloc(soc->osdev,
  4406. len,
  4407. /* reserve room for the HTC header */
  4408. HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING,
  4409. 4,
  4410. TRUE);
  4411. if (!msg)
  4412. return QDF_STATUS_E_NOMEM;
  4413. /*
  4414. * Set the length of the message.
  4415. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
  4416. * separately during the below call to qdf_nbuf_push_head.
  4417. * The contribution from the HTC header is added separately inside HTC.
  4418. */
  4419. if (!qdf_nbuf_put_tail(msg,
  4420. sizeof(struct htt_h2t_msg_type_fisa_config_t))) {
  4421. qdf_err("Failed to expand head for HTT_RX_FSE_OPERATION msg");
  4422. qdf_nbuf_free(msg);
  4423. return QDF_STATUS_E_FAILURE;
  4424. }
  4425. /* fill in the message contents */
  4426. msg_word = (u_int32_t *)qdf_nbuf_data(msg);
  4427. memset(msg_word, 0, sizeof(struct htt_h2t_msg_type_fisa_config_t));
  4428. /* rewind beyond alignment pad to get to the HTC header reserved area */
  4429. qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
  4430. htt_logger_bufp = (uint8_t *)msg_word;
  4431. *msg_word = 0;
  4432. HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_FISA_CFG);
  4433. htt_fisa_config = (struct htt_h2t_msg_type_fisa_config_t *)msg_word;
  4434. HTT_RX_FSE_OPERATION_PDEV_ID_SET(*msg_word, htt_fisa_config->pdev_id);
  4435. msg_word++;
  4436. HTT_RX_FISA_CONFIG_FISA_ENABLE_SET(*msg_word, 1);
  4437. HTT_RX_FISA_CONFIG_IPSEC_SKIP_SEARCH_SET(*msg_word, 1);
  4438. HTT_RX_FISA_CONFIG_NON_TCP_SKIP_SEARCH_SET(*msg_word, 0);
  4439. HTT_RX_FISA_CONFIG_ADD_IPV4_FIXED_HDR_LEN_SET(*msg_word, 0);
  4440. HTT_RX_FISA_CONFIG_ADD_IPV6_FIXED_HDR_LEN_SET(*msg_word, 0);
  4441. HTT_RX_FISA_CONFIG_ADD_TCP_FIXED_HDR_LEN_SET(*msg_word, 0);
  4442. HTT_RX_FISA_CONFIG_ADD_UDP_HDR_LEN_SET(*msg_word, 0);
  4443. HTT_RX_FISA_CONFIG_CHKSUM_CUM_IP_LEN_EN_SET(*msg_word, 1);
  4444. HTT_RX_FISA_CONFIG_DISABLE_TID_CHECK_SET(*msg_word, 1);
  4445. HTT_RX_FISA_CONFIG_DISABLE_TA_CHECK_SET(*msg_word, 1);
  4446. HTT_RX_FISA_CONFIG_DISABLE_QOS_CHECK_SET(*msg_word, 1);
  4447. HTT_RX_FISA_CONFIG_DISABLE_RAW_CHECK_SET(*msg_word, 1);
  4448. HTT_RX_FISA_CONFIG_DISABLE_DECRYPT_ERR_CHECK_SET(*msg_word, 1);
  4449. HTT_RX_FISA_CONFIG_DISABLE_MSDU_DROP_CHECK_SET(*msg_word, 1);
  4450. HTT_RX_FISA_CONFIG_FISA_AGGR_LIMIT_SET(*msg_word, 0xf);
  4451. msg_word++;
  4452. htt_fisa_config->fisa_timeout_threshold = fisa_config->fisa_timeout;
  4453. pkt = htt_htc_pkt_alloc(soc);
  4454. if (!pkt) {
  4455. qdf_err("Fail to allocate dp_htt_htc_pkt buffer");
  4456. qdf_assert(0);
  4457. qdf_nbuf_free(msg);
  4458. return QDF_STATUS_E_RESOURCES; /* failure */
  4459. }
  4460. pkt->soc_ctxt = NULL; /* not used during send-done callback */
  4461. SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
  4462. dp_htt_h2t_send_complete_free_netbuf,
  4463. qdf_nbuf_data(msg),
  4464. qdf_nbuf_len(msg),
  4465. soc->htc_endpoint,
  4466. HTC_TX_PACKET_TAG_RUNTIME_PUT);
  4467. SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
  4468. status = DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_RX_FISA_CFG,
  4469. htt_logger_bufp);
  4470. if (status == QDF_STATUS_SUCCESS) {
  4471. dp_info("HTT_H2T_MSG_TYPE_RX_FISA_CFG sent to FW for pdev = %u",
  4472. fisa_config->pdev_id);
  4473. } else {
  4474. qdf_nbuf_free(msg);
  4475. htt_htc_pkt_free(soc, pkt);
  4476. }
  4477. return status;
  4478. }