qdf_nbuf.h 138 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355
  1. /*
  2. * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * DOC: qdf_nbuf_public network buffer API
  21. * This file defines the network buffer abstraction.
  22. */
  23. #ifndef _QDF_NBUF_H
  24. #define _QDF_NBUF_H
  25. #include <qdf_util.h>
  26. #include <qdf_types.h>
  27. #include <qdf_lock.h>
  28. #include <i_qdf_trace.h>
  29. #include <i_qdf_nbuf.h>
  30. #include <qdf_net_types.h>
  31. #define IPA_NBUF_OWNER_ID 0xaa55aa55
  32. #define QDF_NBUF_PKT_TRAC_TYPE_DNS 0x01
  33. #define QDF_NBUF_PKT_TRAC_TYPE_EAPOL 0x02
  34. #define QDF_NBUF_PKT_TRAC_TYPE_DHCP 0x04
  35. #define QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION 0x08
  36. #define QDF_NBUF_PKT_TRAC_TYPE_ARP 0x10
  37. #define QDF_NBUF_PKT_TRAC_TYPE_ICMP 0x20
  38. #define QDF_NBUF_PKT_TRAC_TYPE_ICMPv6 0x40
  39. #define QDF_HL_CREDIT_TRACKING 0x80
  40. #define QDF_NBUF_PKT_TRAC_MAX_STRING 12
  41. #define QDF_NBUF_PKT_TRAC_PROTO_STRING 4
  42. #define QDF_NBUF_PKT_ERROR 1
  43. #define QDF_NBUF_TRAC_IPV4_OFFSET 14
  44. #define QDF_NBUF_TRAC_IPV4_HEADER_MASK 0xF
  45. #define QDF_NBUF_TRAC_IPV4_HEADER_SIZE 20
  46. #define QDF_NBUF_TRAC_DHCP_SRV_PORT 67
  47. #define QDF_NBUF_TRAC_DHCP_CLI_PORT 68
  48. #define QDF_NBUF_TRAC_ETH_TYPE_OFFSET 12
  49. #define QDF_NBUF_TRAC_VLAN_ETH_TYPE_OFFSET 16
  50. #define QDF_NBUF_TRAC_DOUBLE_VLAN_ETH_TYPE_OFFSET 20
  51. #define QDF_NBUF_TRAC_EAPOL_ETH_TYPE 0x888E
  52. #define QDF_NBUF_TRAC_WAPI_ETH_TYPE 0x88b4
  53. #define QDF_NBUF_TRAC_ARP_ETH_TYPE 0x0806
  54. #define QDF_NBUF_PKT_IPV4_DSCP_MASK 0xFC
  55. #define QDF_NBUF_PKT_IPV4_DSCP_SHIFT 0x02
  56. #define QDF_NBUF_TRAC_TDLS_ETH_TYPE 0x890D
  57. #define QDF_NBUF_TRAC_IPV4_ETH_TYPE 0x0800
  58. #define QDF_NBUF_TRAC_IPV6_ETH_TYPE 0x86dd
  59. #define QDF_NBUF_DEST_MAC_OFFSET 0
  60. #define QDF_NBUF_SRC_MAC_OFFSET 6
  61. #define QDF_NBUF_TRAC_IPV4_TOS_OFFSET 15
  62. #define QDF_NBUF_TRAC_IPV4_PROTO_TYPE_OFFSET 23
  63. #define QDF_NBUF_TRAC_VLAN_IPV4_PROTO_TYPE_OFFSET 27
  64. #define QDF_NBUF_TRAC_IPV4_DEST_ADDR_OFFSET 30
  65. #define QDF_NBUF_TRAC_IPV4_SRC_ADDR_OFFSET 26
  66. #define QDF_NBUF_TRAC_IPV6_PROTO_TYPE_OFFSET 20
  67. #define QDF_NBUF_TRAC_VLAN_IPV6_PROTO_TYPE_OFFSET 24
  68. #define QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK 0xE0000000
  69. #define QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK 0xF0000000
  70. #define QDF_NBUF_TRAC_IPV6_DEST_ADDR_OFFSET 38
  71. #define QDF_NBUF_TRAC_IPV6_DEST_ADDR 0xFF00
  72. #define QDF_NBUF_TRAC_IPV6_OFFSET 14
  73. #define QDF_NBUF_TRAC_VLAN_IPV6_OFFSET 18
  74. #define QDF_NBUF_TRAC_IPV6_HEADER_SIZE 40
  75. #define QDF_NBUF_TRAC_ICMP_TYPE 1
  76. #define QDF_NBUF_TRAC_IGMP_TYPE 2
  77. #define QDF_NBUF_TRAC_TCP_TYPE 6
  78. #define QDF_NBUF_TRAC_TCP_FLAGS_OFFSET (47 - 34)
  79. #define QDF_NBUF_TRAC_TCP_ACK_OFFSET (42 - 34)
  80. #define QDF_NBUF_TRAC_TCP_HEADER_LEN_OFFSET (46 - 34)
  81. #define QDF_NBUF_TRAC_TCP_ACK_MASK 0x10
  82. #define QDF_NBUF_TRAC_TCP_SPORT_OFFSET (34 - 34)
  83. #define QDF_NBUF_TRAC_TCP_DPORT_OFFSET (36 - 34)
  84. #define QDF_NBUF_TRAC_UDP_TYPE 17
  85. #define QDF_NBUF_TRAC_ICMPV6_TYPE 0x3a
  86. #define QDF_NBUF_TRAC_HOPOPTS_TYPE 0
  87. #define QDF_NBUF_TRAC_DHCP6_SRV_PORT 547
  88. #define QDF_NBUF_TRAC_DHCP6_CLI_PORT 546
  89. #define QDF_NBUF_TRAC_MDNS_SRC_N_DST_PORT 5353
  90. #define QDF_NBUF_TRAC_IP_OFFSET 14
  91. #define QDF_NBUF_TRAC_VLAN_IP_OFFSET 18
  92. #define QDF_NBUF_TRAC_DOUBLE_VLAN_IP_OFFSET 22
  93. /* One dword for IPv4 header size unit */
  94. #define QDF_NBUF_IPV4_HDR_SIZE_UNIT 4
  95. /* EAPOL Related MASK */
  96. #define EAPOL_PACKET_TYPE_OFFSET 15
  97. #define EAPOL_KEY_INFO_OFFSET 19
  98. #define EAPOL_PKT_LEN_OFFSET 16
  99. #define EAPOL_KEY_LEN_OFFSET 21
  100. #define EAPOL_KEY_DATA_LENGTH_OFFSET 111
  101. #define EAPOL_WPA_KEY_NONCE_OFFSET 31
  102. #define EAPOL_PACKET_TYPE_EAP 0
  103. #define EAPOL_PACKET_TYPE_START 1
  104. #define EAPOL_PACKET_TYPE_LOGOFF 2
  105. #define EAPOL_PACKET_TYPE_KEY 3
  106. #define EAPOL_PACKET_TYPE_ASF 4
  107. #define EAPOL_KEY_TYPE_MASK 0x0800
  108. #define EAPOL_KEY_ENCRYPTED_MASK 0x0010
  109. /* EAP Related Mask */
  110. #define EAP_CODE_OFFSET 18
  111. #define EAP_LENGTH_OFFSET 20
  112. #define EAP_TYPE_OFFSET 22
  113. #define QDF_EAP_REQUEST 1
  114. #define QDF_EAP_RESPONSE 2
  115. #define QDF_EAP_SUCCESS 3
  116. #define QDF_EAP_FAILURE 4
  117. #define QDF_EAP_INITIATE 5
  118. #define QDF_EAP_FINISH 6
  119. /* ARP Related MASK */
  120. #define QDF_NBUF_PKT_ARP_OPCODE_OFFSET 20
  121. #define QDF_NBUF_PKT_ARPOP_REQ 1
  122. #define QDF_NBUF_PKT_ARPOP_REPLY 2
  123. #define QDF_NBUF_PKT_ARP_SRC_IP_OFFSET 28
  124. #define QDF_NBUF_PKT_ARP_TGT_IP_OFFSET 38
  125. /* ICMPv4 Related MASK */
  126. #define QDF_NBUF_PKT_ICMPv4_OPCODE_OFFSET 34
  127. #define QDF_NBUF_PKT_ICMPv4OP_REQ 0x08
  128. #define QDF_NBUF_PKT_ICMPv4OP_REPLY 0x00
  129. #define QDF_NBUF_PKT_ICMPv4_SRC_IP_OFFSET 26
  130. #define QDF_NBUF_PKT_ICMPv4_TGT_IP_OFFSET 30
  131. #define QDF_NBUF_PKT_ICMPV4_REDIRECT 0x05
  132. /* TCP Related MASK */
  133. #define QDF_NBUF_PKT_TCP_OPCODE_OFFSET 47
  134. #define QDF_NBUF_PKT_TCPOP_SYN 0x02
  135. #define QDF_NBUF_PKT_TCPOP_SYN_ACK 0x12
  136. #define QDF_NBUF_PKT_TCPOP_ACK 0x10
  137. #define QDF_NBUF_PKT_TCP_SRC_PORT_OFFSET 34
  138. #define QDF_NBUF_PKT_TCP_DST_PORT_OFFSET 36
  139. /* DNS Related MASK */
  140. #define QDF_NBUF_PKT_DNS_OVER_UDP_OPCODE_OFFSET 44
  141. #define QDF_NBUF_PKT_DNSOP_BITMAP 0xF800
  142. #define QDF_NBUF_PKT_DNSOP_STANDARD_QUERY 0x0000
  143. #define QDF_NBUF_PKT_DNSOP_STANDARD_RESPONSE 0x8000
  144. #define QDF_NBUF_PKT_DNS_SRC_PORT_OFFSET 34
  145. #define QDF_NBUF_PKT_DNS_DST_PORT_OFFSET 36
  146. #define QDF_NBUF_PKT_DNS_NAME_OVER_UDP_OFFSET 54
  147. #define QDF_NBUF_PKT_DNS_STANDARD_PORT 53
  148. /* Tracked Packet types */
  149. #define QDF_NBUF_TX_PKT_INVALID 0
  150. #define QDF_NBUF_TX_PKT_DATA_TRACK 1
  151. #define QDF_NBUF_TX_PKT_MGMT_TRACK 2
  152. #define QDF_NBUF_RX_PKT_DATA_TRACK 3
  153. /* Different Packet states */
  154. #define QDF_NBUF_TX_PKT_HDD 1
  155. #define QDF_NBUF_TX_PKT_TXRX_ENQUEUE 2
  156. #define QDF_NBUF_TX_PKT_TXRX_DEQUEUE 3
  157. #define QDF_NBUF_TX_PKT_TXRX 4
  158. #define QDF_NBUF_TX_PKT_HTT 5
  159. #define QDF_NBUF_TX_PKT_HTC 6
  160. #define QDF_NBUF_TX_PKT_HIF 7
  161. #define QDF_NBUF_TX_PKT_CE 8
  162. #define QDF_NBUF_TX_PKT_FREE 9
  163. #define QDF_NBUF_TX_PKT_LI_DP 10
  164. #define QDF_NBUF_TX_PKT_DP 11
  165. #define QDF_NBUF_TX_PKT_STATE_MAX 12
  166. /* nbuf allocations only come from one domain */
  167. #define QDF_DEBUG_NBUF_DOMAIN 0
  168. /* qdf_nbuf allocate and map max retry threshold when failed */
  169. #define QDF_NBUF_ALLOC_MAP_RETRY_THRESHOLD 20
  170. /* Enable flag to print TSO specific prints in datapath */
  171. #ifdef TSO_DEBUG_LOG_ENABLE
  172. #define TSO_DEBUG(fmt, args ...) \
  173. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_NONE, \
  174. fmt, ## args)
  175. #else
  176. #define TSO_DEBUG(fmt, args ...)
  177. #endif
  178. #define IEEE80211_AMPDU_FLAG 0x01
  179. #ifdef GET_MSDU_AGGREGATION
  180. #define IEEE80211_AMSDU_FLAG 0x02
  181. #endif
  182. #define MAX_CHAIN 8
  183. #define QDF_MON_STATUS_MPDU_FCS_BMAP_NWORDS 8
  184. /**
  185. * @qdf_nbuf_queue_t - Platform independent packet queue abstraction
  186. */
  187. typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t;
  188. /**
  189. * This is the length for radiotap, combined length
  190. * (Mandatory part struct ieee80211_radiotap_header + RADIOTAP_HEADER_LEN)
  191. * cannot be more than available headroom_sz.
  192. * increase this when we add more radiotap elements.
  193. * Number after '+' indicates maximum possible increase due to alignment
  194. */
  195. #define RADIOTAP_TX_FLAGS_LEN (2 + 1)
  196. #define RADIOTAP_VHT_FLAGS_LEN (12 + 1)
  197. #define RADIOTAP_HE_FLAGS_LEN (12 + 1)
  198. #define RADIOTAP_HE_MU_FLAGS_LEN (8 + 1)
  199. #define RADIOTAP_HE_MU_OTHER_FLAGS_LEN (18 + 1)
  200. #define RADIOTAP_U_SIG_FLAGS_LEN (12 + 3)
  201. #define RADIOTAP_EHT_FLAGS_LEN (32 + 3)
  202. #define RADIOTAP_FIXED_HEADER_LEN 17
  203. #define RADIOTAP_HT_FLAGS_LEN 3
  204. #define RADIOTAP_AMPDU_STATUS_LEN (8 + 3)
  205. #define RADIOTAP_VENDOR_NS_LEN \
  206. (sizeof(struct qdf_radiotap_vendor_ns_ath) + 1)
  207. /* This is Radio Tap Header Extension Length.
  208. * 4 Bytes for Extended it_present bit map +
  209. * 4 bytes padding for alignment
  210. */
  211. #define RADIOTAP_HEADER_EXT_LEN (2 * sizeof(uint32_t))
  212. #define RADIOTAP_HEADER_EXT2_LEN \
  213. (sizeof(struct qdf_radiotap_ext2))
  214. #define RADIOTAP_HEADER_LEN (RADIOTAP_BASE_HEADER_LEN + \
  215. RADIOTAP_FIXED_HEADER_LEN + \
  216. RADIOTAP_TX_FLAGS_LEN + \
  217. RADIOTAP_HT_FLAGS_LEN + \
  218. RADIOTAP_VHT_FLAGS_LEN + \
  219. RADIOTAP_AMPDU_STATUS_LEN + \
  220. RADIOTAP_HE_FLAGS_LEN + \
  221. RADIOTAP_HE_MU_FLAGS_LEN + \
  222. RADIOTAP_HE_MU_OTHER_FLAGS_LEN + \
  223. RADIOTAP_VENDOR_NS_LEN + \
  224. RADIOTAP_HEADER_EXT_LEN + \
  225. RADIOTAP_HEADER_EXT2_LEN + \
  226. RADIOTAP_U_SIG_FLAGS_LEN + \
  227. RADIOTAP_EHT_FLAGS_LEN)
  228. /**
  229. * struct mon_rx_status - This will have monitor mode rx_status extracted from
  230. * htt_rx_desc used later to update radiotap information.
  231. * @tsft: Time Synchronization Function timer
  232. * @ppdu_timestamp: Timestamp in the PPDU_START TLV
  233. * @chan_freq: Capture channel frequency
  234. * @chan_num: Capture channel number
  235. * @chan_flags: Bitmap of Channel flags, IEEE80211_CHAN_TURBO,
  236. * IEEE80211_CHAN_CCK...
  237. * @ht_flags: HT flags, only present for HT frames.
  238. * @vht_flags: VHT flags, only present for VHT frames.
  239. * @vht_flag_values1-5: Contains corresponding data for flags field
  240. * @he_flags: HE (11ax) flags, only present in HE frames
  241. * @he_mu_flags: HE-MU (11ax) flags, only present in HE frames
  242. * @he_mu_other_flags: HE-MU-OTHER (11ax) flags, only present in HE frames
  243. * @usig_flags: USIG flags, only present in 802.11BE and subsequent protocol
  244. * @eht_flags: EHT (11be) flags, only present in EHT frames
  245. * @nr_ant: Number of Antennas used for streaming
  246. * @mcs: MCS index of Rx frame
  247. * @nss: Number of spatial streams
  248. * @bw: bandwidth of rx frame
  249. * @is_stbc: Is STBC enabled
  250. * @sgi: Rx frame short guard interval
  251. * @he_re: HE range extension
  252. * @ldpc: ldpc enabled
  253. * @beamformed: Is frame beamformed.
  254. * @dcm: dcm
  255. * @preamble_type: Preamble type in radio header
  256. * @tid: QoS traffic tid number
  257. * @rs_fcs_err: FCS error flag
  258. * @cck_flag: Flag to indicate CCK modulation
  259. * @ofdm_flag: Flag to indicate OFDM modulation
  260. * @ulofdma_flag: Flag to indicate UL OFDMA PPDU
  261. * @monitor_direct_used: monitor direct mode
  262. * @data_sequence_control_info_valid: field to indicate validity of seq control
  263. * @rxpcu_filter_pass: Flag which indicates whether RX packets are received in
  264. * BSS mode(not in promisc mode)
  265. * @add_rtap_ext: add radio tap extension
  266. * @frame_control_info_valid: field indicates if fc value is valid
  267. * @add_rtap_ext2: add radiotap extension2
  268. * @reception_type: PPDU reception type
  269. * @ltf_size: ltf size
  270. * @tx_status: packet tx status
  271. * @mu_dl_ul: MU down or up link, 0 downlink, 1 uplink
  272. * @rx_antenna: rx antenna
  273. * @vht_flag_values6: VHT flag value6
  274. * @he_mu_other_flags: HE MU other flag
  275. * @he_sig_b_common: HE (11ax) sig B common field
  276. * @he_sig_b_common_known: HE (11ax) sig B common known field
  277. * @l_sig_a_info: L_SIG_A value coming in Rx descriptor
  278. * @l_sig_b_info: L_SIG_B value coming in Rx descriptor
  279. * @num_eht_user_info_valid: Number of valid EHT user info
  280. * @rate: Rate in terms 500Kbps
  281. * @rtap_flags: Bit map of available fields in the radiotap
  282. * @ant_signal_db: Rx packet RSSI
  283. * @ht_mcs: MCS index for HT RX frames
  284. * @tcp_msdu_count: TCP MSDU Count
  285. * @udp_msdu_count: UDP MSDU Count
  286. * @other_msdu_count: Other MSDU Count
  287. * @vht_flag_values1: VHT flag value 1
  288. * @vht_flag_values2: VHT flag value 2
  289. * @vht_flag_values3: VHT flag value 3
  290. * @vht_flag_values4: VHT flag value 4
  291. * @vht_flag_values5: VHT flag value 5
  292. * @he_sig_b_common_RU[4]: HE (11ax) common RU assignment index
  293. * @rssi_comb: Combined RSSI
  294. * @rssi[MAX_CHAIN]: 8 bits RSSI per 20Mhz per chain
  295. * @duration: 802.11 Duration
  296. * @frame_control: frame control field
  297. * @ast_index: AST table hash index
  298. * @rs_flags: Flags to indicate AMPDU or AMSDU aggregation
  299. * @he_per_user_1: HE per user info1
  300. * @he_per_user_2: HE per user info2
  301. * @he_per_user_position: HE per user position info
  302. * @he_per_user_known: HE per user known info
  303. * @he_flags1: HE flags
  304. * @he_flags2: HE flags
  305. * @he_RU[4]: HE RU assignment index
  306. * @he_data1: HE property of received frame
  307. * @he_data2: HE property of received frame
  308. * @he_data3: HE property of received frame
  309. * @he_data4: HE property of received frame
  310. * @he_data5: HE property of received frame
  311. * @prev_ppdu_id: ppdu_id in previously received message
  312. * @ppdu_id: Id of the PLCP protocol data unit
  313. *
  314. * The following variables are not coming from the TLVs.
  315. * These variables are placeholders for passing information to update_radiotap
  316. * function.
  317. * @device_id: Device ID coming from sub-system (PCI, AHB etc..)
  318. * @chan_noise_floor: Channel Noise Floor for the pdev
  319. * @first_data_seq_ctrl: Sequence ctrl field of first data frame
  320. * @rssi_chain: Rssi chain per nss per bw
  321. * @tx_retry_cnt: tx retry count
  322. * @start_seq: starting sequence number
  323. * @ba_bitmap: 256 bit block ack bitmap
  324. * @mpdu_retry_cnt: Rx mpdu retry count
  325. * @punctured_pattern: punctured pattern (0 means the band is punctured)
  326. * @usig_common: U-SIG property of received frame
  327. * @usig_value: U-SIG property of received frame
  328. * @usig_mask: U-SIG property of received frame
  329. * @eht_known: EHT property of received frame
  330. * @eht_data: EHT property of received frame
  331. * @eht_user_info: EHT USER property of received frame
  332. * @phyrx_abort: phy aborted undecoded frame indication
  333. * @phyrx_abort_reason: abort reason in phyrx_abort_request_info
  334. * @vht_crc: vht crc
  335. * @vht_no_txop_ps: TXOP power save mode
  336. * @he_crc: he crc
  337. * @l_sig_length: L SIG A length
  338. * @l_sig_a_parity: L SIG A parity
  339. * @l_sig_a_pkt_type: L SIG A info pkt type
  340. * @l_sig_a_implicit_sounding: L SIG A info captured implicit sounding
  341. * @ht_length: num of bytes in PSDU
  342. * @smoothing: Indicate smoothing
  343. * @not_sounding: Indicate sounding
  344. * @aggregation: Indicate A-MPDU format
  345. * @ht_stbc: Indicate stbc
  346. * @ht_crc: ht crc
  347. * @rx_user_status: pointer to mon_rx_user_status, when set update
  348. * @rssi_offset: This offset value will use for RSSI db to dbm conversion
  349. * @rssi_dbm_conv_support: Rssi dbm conversion support param
  350. * radiotap header will use userinfo from this structure.
  351. */
  352. struct mon_rx_status {
  353. uint64_t tsft;
  354. uint32_t ppdu_timestamp;
  355. qdf_freq_t chan_freq;
  356. uint16_t chan_num;
  357. uint16_t chan_flags;
  358. uint32_t ht_flags : 1,
  359. vht_flags : 1,
  360. he_flags : 1,
  361. he_mu_flags : 1,
  362. usig_flags : 1,
  363. eht_flags : 1,
  364. nr_ant : 3,
  365. mcs : 4,
  366. nss : 3,
  367. bw : 4,
  368. is_stbc : 1,
  369. sgi : 2,
  370. he_re : 1,
  371. ldpc : 1,
  372. beamformed : 1,
  373. dcm : 1,
  374. preamble_type : 4;
  375. uint32_t tid : 5,
  376. rs_fcs_err : 1,
  377. cck_flag : 1,
  378. ofdm_flag : 1,
  379. ulofdma_flag : 1,
  380. monitor_direct_used : 1,
  381. data_sequence_control_info_valid : 1,
  382. rxpcu_filter_pass : 1,
  383. add_rtap_ext : 1,
  384. frame_control_info_valid : 1,
  385. add_rtap_ext2 : 1,
  386. reception_type : 4,
  387. ltf_size : 2,
  388. tx_status : 4,
  389. mu_dl_ul : 1;
  390. uint32_t rx_antenna : 24;
  391. uint16_t vht_flag_values6;
  392. uint16_t he_mu_other_flags;
  393. uint16_t he_sig_b_common;
  394. uint16_t he_sig_b_common_known;
  395. uint32_t l_sig_a_info;
  396. uint32_t l_sig_b_info;
  397. uint8_t num_eht_user_info_valid;
  398. uint8_t rate;
  399. uint8_t rtap_flags;
  400. uint8_t ant_signal_db;
  401. uint8_t ht_mcs;
  402. uint16_t tcp_msdu_count;
  403. uint16_t udp_msdu_count;
  404. uint16_t other_msdu_count;
  405. uint8_t vht_flag_values1;
  406. uint8_t vht_flag_values2;
  407. uint8_t vht_flag_values3[4];
  408. uint8_t vht_flag_values4;
  409. uint8_t vht_flag_values5;
  410. uint8_t he_sig_b_common_RU[4];
  411. int8_t rssi_comb;
  412. int8_t rssi[MAX_CHAIN];
  413. uint16_t duration;
  414. uint16_t frame_control;
  415. uint16_t ast_index;
  416. uint8_t rs_flags;
  417. /* New HE radiotap fields */
  418. uint16_t he_per_user_1;
  419. uint16_t he_per_user_2;
  420. uint8_t he_per_user_position;
  421. uint8_t he_per_user_known;
  422. uint16_t he_flags1;
  423. uint16_t he_flags2;
  424. uint8_t he_RU[8];
  425. uint16_t he_data1;
  426. uint16_t he_data2;
  427. uint16_t he_data3;
  428. uint16_t he_data4;
  429. uint16_t he_data5;
  430. uint16_t he_data6;
  431. uint32_t ppdu_len;
  432. uint16_t prev_ppdu_id;
  433. uint16_t ppdu_id;
  434. uint16_t device_id;
  435. int16_t chan_noise_floor;
  436. uint16_t first_data_seq_ctrl;
  437. int8_t rssi_chain[8][8];
  438. uint8_t tx_retry_cnt;
  439. uint16_t start_seq;
  440. uint32_t ba_bitmap[8];
  441. uint16_t mpdu_retry_cnt;
  442. #ifdef WLAN_FEATURE_11BE
  443. uint16_t punctured_pattern;
  444. #endif
  445. uint32_t usig_common;
  446. uint32_t usig_value;
  447. uint32_t usig_mask;
  448. uint32_t eht_known;
  449. uint32_t eht_data[6];
  450. uint32_t eht_user_info[4];
  451. #ifdef QCA_UNDECODED_METADATA_SUPPORT
  452. uint32_t phyrx_abort:1,
  453. phyrx_abort_reason:8,
  454. vht_crc:8,
  455. vht_no_txop_ps:1,
  456. he_crc:4;
  457. uint32_t l_sig_length:12,
  458. l_sig_a_parity:1,
  459. l_sig_a_pkt_type:4,
  460. l_sig_a_implicit_sounding:1;
  461. uint32_t ht_length:16,
  462. smoothing:1,
  463. not_sounding:1,
  464. aggregation:1,
  465. ht_stbc:2,
  466. ht_crc:8;
  467. #endif
  468. struct mon_rx_user_status *rx_user_status;
  469. int32_t rssi_offset;
  470. bool rssi_dbm_conv_support;
  471. };
  472. /**
  473. * struct mon_rx_user_status - This will have monitor mode per user rx_status
  474. * extracted from hardware TLV.
  475. * @mcs: MCS index of Rx frame
  476. * @nss: Number of spatial streams
  477. * @mu_ul_info_valid: MU UL info below is valid
  478. * @ofdma_ru_start_index: OFDMA RU start index
  479. * @ofdma_ru_width: OFDMA total RU width
  480. * @ofdma_ru_size: OFDMA RU size index
  481. * @is_ampdu: AMPDU flag
  482. * @mu_ul_user_v0_word0: MU UL user info word 0
  483. * @mu_ul_user_v0_word1: MU UL user info word 1
  484. * @ast_index: AST table hash index
  485. * @sw_peer_id: software peer id
  486. * @tid: QoS traffic tid number
  487. * @preamble_type: Preamble type in radio header
  488. * @ht_flags: HT flags, only present for HT frames.
  489. * @vht_flags: VHT flags, only present for VHT frames.
  490. * @he_flags: HE (11ax) flags, only present in HE frames
  491. * @frame_control_info_valid: field indicates if fc value is valid
  492. * @frame_control: frame control field
  493. * @data_sequence_control_info_valid: field to indicate validity of seq control
  494. * @filter_category: mpdu filter category
  495. * @tcp_msdu_count: tcp protocol msdu count
  496. * @udp_msdu_count: udp protocol msdu count
  497. * @other_msdu_count: other protocol msdu count
  498. * @first_data_seq_ctrl: Sequence ctrl field of first data frame
  499. * @duration: 802.11 Duration
  500. * @vht_flag_values1-5: Contains corresponding data for flags field
  501. * @he_flags1: HE flags
  502. * @he_flags2: HE flags
  503. * @he_RU[4]: HE RU assignment index
  504. * @he_data1: HE property of received frame
  505. * @he_data2: HE property of received frame
  506. * @he_data3: HE property of received frame
  507. * @he_data4: HE property of received frame
  508. * @he_data5: HE property of received frame
  509. * @he_data6: HE property of received frame
  510. * @he_per_user_1: HE per user info1
  511. * @he_per_user_2: HE per user info2
  512. * @he_per_user_position: HE per user position info
  513. * @he_per_user_known: HE per user known info
  514. * @rtap_flags: Bit map of available fields in the radiotap
  515. * @rs_flags: Flags to indicate AMPDU or AMSDU aggregation
  516. * @mpdu_cnt_fcs_ok: mpdu count received with fcs ok
  517. * @mpdu_cnt_fcs_err: mpdu count received with fcs ok bitmap
  518. * @mpdu_fcs_ok_bitmap: mpdu with fcs ok bitmap
  519. * @mpdu_ok_byte_count: mpdu byte count with fcs ok
  520. * @mpdu_err_byte_count: mpdu byte count with fcs err
  521. * @retry_mpdu: mpdu retry count
  522. * @start_seq: starting sequence number
  523. * @ba_control: Block ack control
  524. * @ba_bitmap: 256 bit block ack bitmap
  525. * @aid: Association ID
  526. * @mpdu_q: user mpdu_queue used for monitor
  527. */
  528. struct mon_rx_user_status {
  529. uint32_t mcs:4,
  530. nss:3,
  531. mu_ul_info_valid:1,
  532. ofdma_ru_start_index:7,
  533. ofdma_ru_width:7,
  534. ofdma_ru_size:8,
  535. is_ampdu:1;
  536. uint32_t mu_ul_user_v0_word0;
  537. uint32_t mu_ul_user_v0_word1;
  538. uint32_t ast_index : 16,
  539. sw_peer_id : 16;
  540. uint32_t tid : 4,
  541. preamble_type : 4,
  542. ht_flags : 1,
  543. vht_flags : 1,
  544. he_flags : 1,
  545. frame_control_info_valid : 1,
  546. frame_control : 16,
  547. data_sequence_control_info_valid : 1,
  548. ba_bitmap_sz : 2,
  549. filter_category : 2;
  550. uint16_t tcp_msdu_count;
  551. uint16_t udp_msdu_count;
  552. uint16_t other_msdu_count;
  553. uint16_t first_data_seq_ctrl;
  554. uint16_t duration;
  555. uint8_t vht_flag_values2;
  556. uint8_t vht_flag_values3[4];
  557. uint8_t vht_flag_values4;
  558. uint8_t vht_flag_values5;
  559. uint16_t vht_flag_values6;
  560. uint16_t he_flags1;
  561. uint16_t he_flags2;
  562. uint8_t he_RU[8];
  563. uint16_t he_data1;
  564. uint16_t he_data2;
  565. uint16_t he_data3;
  566. uint16_t he_data4;
  567. uint16_t he_data5;
  568. uint16_t he_data6;
  569. uint8_t he_per_user_1;
  570. uint8_t he_per_user_2;
  571. uint8_t he_per_user_position;
  572. uint8_t he_per_user_known;
  573. uint8_t rtap_flags;
  574. uint8_t rs_flags;
  575. uint16_t mpdu_cnt_fcs_ok;
  576. uint8_t mpdu_cnt_fcs_err;
  577. uint32_t mpdu_fcs_ok_bitmap[QDF_MON_STATUS_MPDU_FCS_BMAP_NWORDS];
  578. uint32_t mpdu_ok_byte_count;
  579. uint32_t mpdu_err_byte_count;
  580. uint16_t retry_mpdu;
  581. uint16_t start_seq;
  582. uint16_t ba_control;
  583. uint32_t ba_bitmap[8];
  584. uint16_t aid;
  585. qdf_nbuf_queue_t mpdu_q;
  586. };
  587. /**
  588. * struct qdf_radiotap_vendor_ns - Vendor Namespace header as per
  589. * Radiotap spec: https://www.radiotap.org/fields/Vendor%20Namespace.html
  590. * @oui: Vendor OUI
  591. * @selector: sub_namespace selector
  592. * @skip_length: How many bytes of Vendor Namespace data that follows
  593. */
  594. struct qdf_radiotap_vendor_ns {
  595. uint8_t oui[3];
  596. uint8_t selector;
  597. uint16_t skip_length;
  598. } __attribute__((__packed__));
  599. /**
  600. * struct qdf_radiotap_vendor_ns_ath - Combined QTI Vendor NS
  601. * including the Radiotap specified Vendor Namespace header and
  602. * QTI specific Vendor Namespace data
  603. * @lsig: L_SIG_A (or L_SIG)
  604. * @device_id: Device Identification
  605. * @lsig_b: L_SIG_B
  606. * @ppdu_start_timestamp: Timestamp from RX_PPDU_START TLV
  607. */
  608. struct qdf_radiotap_vendor_ns_ath {
  609. struct qdf_radiotap_vendor_ns hdr;
  610. /* QTI specific data follows */
  611. uint32_t lsig;
  612. uint32_t device_id;
  613. uint32_t lsig_b;
  614. uint32_t ppdu_start_timestamp;
  615. } __attribute__((__packed__));
  616. /**
  617. * struct qdf_radiotap_ext2 - radiotap ext2 fields
  618. * ppdu_id: ppdu_id of current msdu
  619. * prev_ppdu_id: ppdu_id of previous msdu
  620. * tid: tid number of previous msdu
  621. * start_seq: start sequence of previous msdu
  622. * ba_bitmap: block ack bitmap of previous msdu
  623. */
  624. struct qdf_radiotap_ext2 {
  625. uint32_t ppdu_id;
  626. uint32_t prev_ppdu_id;
  627. uint16_t tid:8,
  628. reserved:8;
  629. uint16_t start_seq;
  630. uint32_t ba_bitmap[8];
  631. } __attribute__((__packed__));
  632. #define QDF_MEM_FUNC_NAME_SIZE 48
  633. /* Masks for HE SIG known fields in mon_rx_status structure */
  634. #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU0 0x00000001
  635. #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU1 0x00000002
  636. #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU2 0x00000004
  637. #define QDF_MON_STATUS_HE_SIG_B_COMMON_KNOWN_RU3 0x00000008
  638. #define QDF_MON_STATUS_HE_SIG_B_USER_KNOWN_SIG_B_ALL 0x00fe0000
  639. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_SU 0x00000000
  640. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_EXT_SU 0x40000000
  641. #define QDF_MON_STATUS_HE_SIG_A1_HE_FORMAT_TRIG 0xc0000000
  642. /* DHCP Related Mask */
  643. #define QDF_DHCP_OPTION53 (0x35)
  644. #define QDF_DHCP_OPTION53_LENGTH (1)
  645. #define QDF_DHCP_OPTION53_OFFSET (0x11A)
  646. #define QDF_DHCP_OPTION53_LENGTH_OFFSET (0x11B)
  647. #define QDF_DHCP_OPTION53_STATUS_OFFSET (0x11C)
  648. #define DHCP_PKT_LEN_OFFSET 16
  649. #define DHCP_TRANSACTION_ID_OFFSET 46
  650. #define QDF_DHCP_DISCOVER (1)
  651. #define QDF_DHCP_OFFER (2)
  652. #define QDF_DHCP_REQUEST (3)
  653. #define QDF_DHCP_DECLINE (4)
  654. #define QDF_DHCP_ACK (5)
  655. #define QDF_DHCP_NAK (6)
  656. #define QDF_DHCP_RELEASE (7)
  657. #define QDF_DHCP_INFORM (8)
  658. /* ARP Related Mask */
  659. #define ARP_SUB_TYPE_OFFSET 20
  660. #define ARP_REQUEST (1)
  661. #define ARP_RESPONSE (2)
  662. /* IPV4 header fields offset values */
  663. #define IPV4_PKT_LEN_OFFSET 16
  664. #define IPV4_TCP_SEQ_NUM_OFFSET 38
  665. #define IPV4_SRC_ADDR_OFFSET 26
  666. #define IPV4_DST_ADDR_OFFSET 30
  667. #define IPV4_SRC_PORT_OFFSET 34
  668. #define IPV4_DST_PORT_OFFSET 36
  669. /* IPV4 ICMP Related Mask */
  670. #define ICMP_ID_OFFSET 38
  671. #define ICMP_SEQ_NUM_OFFSET 40
  672. #define ICMP_SUBTYPE_OFFSET 34
  673. #define ICMP_REQUEST 0x08
  674. #define ICMP_RESPONSE 0x00
  675. #define IPV6_ADDR_STR "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:"\
  676. "%02x%02x:%02x%02x"
  677. /* IPV6 header fields offset values */
  678. #define IPV6_PKT_LEN_OFFSET 18
  679. #define IPV6_TCP_SEQ_NUM_OFFSET 58
  680. #define IPV6_SRC_ADDR_OFFSET 22
  681. #define IPV6_DST_ADDR_OFFSET 38
  682. #define IPV6_SRC_PORT_OFFSET 54
  683. #define IPV6_DST_PORT_OFFSET 56
  684. /* IPV6 ICMPV6 Related Mask */
  685. #define ICMPV6_REDIRECT 137
  686. #define ICMPV6_SEQ_NUM_OFFSET 60
  687. #define ICMPV6_SUBTYPE_OFFSET 54
  688. #define ICMPV6_REQUEST 0x80
  689. #define ICMPV6_RESPONSE 0x81
  690. #define ICMPV6_RS 0x85
  691. #define ICMPV6_RA 0x86
  692. #define ICMPV6_NS 0x87
  693. #define ICMPV6_NA 0x88
  694. #define QDF_NBUF_IPA_CHECK_MASK 0x80000000
  695. /* HE Radiotap data1 Mask */
  696. #define QDF_MON_STATUS_HE_SU_FORMAT_TYPE 0x0000
  697. #define QDF_MON_STATUS_HE_EXT_SU_FORMAT_TYPE 0x0001
  698. #define QDF_MON_STATUS_HE_MU_FORMAT_TYPE 0x0002
  699. #define QDF_MON_STATUS_HE_TRIG_FORMAT_TYPE 0x0003
  700. #define QDF_MON_STATUS_HE_BEAM_CHANGE_KNOWN 0x0008
  701. #define QDF_MON_STATUS_HE_DL_UL_KNOWN 0x0010
  702. #define QDF_MON_STATUS_HE_MCS_KNOWN 0x0020
  703. #define QDF_MON_STATUS_HE_DCM_KNOWN 0x0040
  704. #define QDF_MON_STATUS_HE_CODING_KNOWN 0x0080
  705. #define QDF_MON_STATUS_HE_LDPC_EXTRA_SYMBOL_KNOWN 0x0100
  706. #define QDF_MON_STATUS_HE_STBC_KNOWN 0x0200
  707. #define QDF_MON_STATUS_HE_SPATIAL_REUSE_1_KNOWN 0x0400
  708. #define QDF_MON_STATUS_HE_SPATIAL_REUSE_2_KNOWN 0x0800
  709. #define QDF_MON_STATUS_HE_SPATIAL_REUSE_3_KNOWN 0x1000
  710. #define QDF_MON_STATUS_HE_SPATIAL_REUSE_4_KNOWN 0x2000
  711. #define QDF_MON_STATUS_HE_DATA_BW_RU_KNOWN 0x4000
  712. #define QDF_MON_STATUS_HE_DOPPLER_KNOWN 0x8000
  713. #define QDF_MON_STATUS_HE_BSS_COLOR_KNOWN 0x0004
  714. /* HE Radiotap data2 Mask */
  715. #define QDF_MON_STATUS_HE_GI_KNOWN 0x0002
  716. #define QDF_MON_STATUS_TXBF_KNOWN 0x0010
  717. #define QDF_MON_STATUS_PE_DISAMBIGUITY_KNOWN 0x0020
  718. #define QDF_MON_STATUS_TXOP_KNOWN 0x0040
  719. #define QDF_MON_STATUS_LTF_SYMBOLS_KNOWN 0x0004
  720. #define QDF_MON_STATUS_PRE_FEC_PADDING_KNOWN 0x0008
  721. #define QDF_MON_STATUS_MIDABLE_PERIODICITY_KNOWN 0x0080
  722. #define QDF_MON_STATUS_RU_ALLOCATION_OFFSET_KNOWN 0x4000
  723. #define QDF_MON_STATUS_RU_ALLOCATION_SHIFT 8
  724. /* HE radiotap data3 shift values */
  725. #define QDF_MON_STATUS_BEAM_CHANGE_SHIFT 6
  726. #define QDF_MON_STATUS_DL_UL_SHIFT 7
  727. #define QDF_MON_STATUS_TRANSMIT_MCS_SHIFT 8
  728. #define QDF_MON_STATUS_DCM_SHIFT 12
  729. #define QDF_MON_STATUS_CODING_SHIFT 13
  730. #define QDF_MON_STATUS_LDPC_EXTRA_SYMBOL_SHIFT 14
  731. #define QDF_MON_STATUS_STBC_SHIFT 15
  732. /* HE radiotap data4 shift values */
  733. #define QDF_MON_STATUS_STA_ID_SHIFT 4
  734. /* HE radiotap data5 */
  735. #define QDF_MON_STATUS_GI_SHIFT 4
  736. #define QDF_MON_STATUS_HE_LTF_SIZE_SHIFT 6
  737. #define QDF_MON_STATUS_HE_LTF_SYM_SHIFT 8
  738. #define QDF_MON_STATUS_TXBF_SHIFT 14
  739. #define QDF_MON_STATUS_PE_DISAMBIGUITY_SHIFT 15
  740. #define QDF_MON_STATUS_PRE_FEC_PAD_SHIFT 12
  741. /* HE radiotap data6 */
  742. #define QDF_MON_STATUS_HE_DATA_6_NSS_SHIFT 0
  743. #define QDF_MON_STATUS_DOPPLER_SHIFT 4
  744. #define QDF_MON_STATUS_TXOP_SHIFT 8
  745. /* HE radiotap HE-MU flags1 */
  746. #define QDF_MON_STATUS_SIG_B_MCS_SHIFT 0x0000
  747. #define QDF_MON_STATUS_SIG_B_MCS_KNOWN 0x0010
  748. #define QDF_MON_STATUS_SIG_B_DCM_SHIFT 5
  749. #define QDF_MON_STATUS_SIG_B_DCM_KNOWN 0x0040
  750. #define QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_KNOWN 0x0080
  751. #define QDF_MON_STATUS_CHANNEL_1_RU_KNOWN 0x0100
  752. #define QDF_MON_STATUS_CHANNEL_2_RU_KNOWN 0x0200
  753. #define QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_KNOWN 0x1000
  754. #define QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_VALUE 0x2000
  755. #define QDF_MON_STATUS_CHANNEL_1_CENTER_26_RU_SHIFT 13
  756. #define QDF_MON_STATUS_SIG_B_SYM_NUM_KNOWN 0x8000
  757. #define QDF_MON_STATUS_RU_0_KNOWN 0x0100
  758. #define QDF_MON_STATUS_RU_1_KNOWN 0x0200
  759. #define QDF_MON_STATUS_RU_2_KNOWN 0x0400
  760. #define QDF_MON_STATUS_RU_3_KNOWN 0x0800
  761. #define QDF_MON_STATUS_DCM_FLAG_1_SHIFT 5
  762. #define QDF_MON_STATUS_SPATIAL_REUSE_MU_KNOWN 0x0100
  763. #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_1_KNOWN 0x4000
  764. #define QDF_MON_STATUS_SIG_B_SYMBOL_USER_KNOWN 0x8000
  765. /* HE radiotap HE-MU flags2 */
  766. #define QDF_MON_STATUS_SIG_A_BANDWIDTH_KNOWN 0x0004
  767. #define QDF_MON_STATUS_SIG_A_BANDWIDTH_SHIFT 0
  768. #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT 3
  769. #define QDF_MON_STATUS_BW_KNOWN 0x0004
  770. #define QDF_MON_STATUS_NUM_SIG_B_SYMBOLS_SHIFT 4
  771. #define QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_KNOWN 0x0100
  772. #define QDF_MON_STATUS_NUM_SIG_B_FLAG_2_SHIFT 9
  773. #define QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_KNOWN 0x0400
  774. #define QDF_MON_STATUS_SIG_A_PUNC_BANDWIDTH_SHIFT 8
  775. #define QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_VALUE 0x0800
  776. #define QDF_MON_STATUS_CHANNEL_2_CENTER_26_RU_SHIFT 11
  777. #define QDF_MON_STATUS_LTF_FLAG_2_SYMBOLS_SHIFT 12
  778. #define QDF_MON_STATUS_LTF_KNOWN 0x8000
  779. /* HE radiotap per_user_1 */
  780. #define QDF_MON_STATUS_STA_SPATIAL_SHIFT 11
  781. #define QDF_MON_STATUS_TXBF_SHIFT 14
  782. #define QDF_MON_STATUS_RESERVED_SET_TO_1_SHIFT 19
  783. #define QDF_MON_STATUS_STA_CODING_SHIFT 20
  784. /* HE radiotap per_user_2 */
  785. #define QDF_MON_STATUS_STA_MCS_SHIFT 4
  786. #define QDF_MON_STATUS_STA_DCM_SHIFT 5
  787. /* HE radiotap per user known */
  788. #define QDF_MON_STATUS_USER_FIELD_POSITION_KNOWN 0x01
  789. #define QDF_MON_STATUS_STA_ID_PER_USER_KNOWN 0x02
  790. #define QDF_MON_STATUS_STA_NSTS_KNOWN 0x04
  791. #define QDF_MON_STATUS_STA_TX_BF_KNOWN 0x08
  792. #define QDF_MON_STATUS_STA_SPATIAL_CONFIG_KNOWN 0x10
  793. #define QDF_MON_STATUS_STA_MCS_KNOWN 0x20
  794. #define QDF_MON_STATUS_STA_DCM_KNOWN 0x40
  795. #define QDF_MON_STATUS_STA_CODING_KNOWN 0x80
  796. /* U-SIG Common Mask */
  797. #define QDF_MON_STATUS_USIG_PHY_VERSION_KNOWN 0x00000001
  798. #define QDF_MON_STATUS_USIG_BW_KNOWN 0x00000002
  799. #define QDF_MON_STATUS_USIG_UL_DL_KNOWN 0x00000004
  800. #define QDF_MON_STATUS_USIG_BSS_COLOR_KNOWN 0x00000008
  801. #define QDF_MON_STATUS_USIG_TXOP_KNOWN 0x00000010
  802. #define QDF_MON_STATUS_USIG_PHY_VERSION_SHIFT 12
  803. #define QDF_MON_STATUS_USIG_BW_SHIFT 15
  804. #define QDF_MON_STATUS_USIG_UL_DL_SHIFT 18
  805. #define QDF_MON_STATUS_USIG_BSS_COLOR_SHIFT 19
  806. #define QDF_MON_STATUS_USIG_TXOP_SHIFT 25
  807. /* U-SIG MU/TB Value */
  808. #define QDF_MON_STATUS_USIG_DISREGARD_SHIFT 0
  809. #define QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_SHIFT 6
  810. #define QDF_MON_STATUS_USIG_VALIDATE_SHIFT 8
  811. #define QDF_MON_STATUS_USIG_MU_VALIDATE1_SHIFT 5
  812. #define QDF_MON_STATUS_USIG_MU_PUNCTURE_CH_INFO_SHIFT 9
  813. #define QDF_MON_STATUS_USIG_MU_VALIDATE2_SHIFT 14
  814. #define QDF_MON_STATUS_USIG_MU_EHT_SIG_MCS_SHIFT 15
  815. #define QDF_MON_STATUS_USIG_MU_NUM_EHT_SIG_SYM_SHIFT 17
  816. #define QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_1_SHIFT 9
  817. #define QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_2_SHIFT 13
  818. #define QDF_MON_STATUS_USIG_TB_DISREGARD1_SHIFT 17
  819. #define QDF_MON_STATUS_USIG_CRC_SHIFT 22
  820. #define QDF_MON_STATUS_USIG_TAIL_SHIFT 26
  821. /* U-SIG MU/TB Mask */
  822. #define QDF_MON_STATUS_USIG_DISREGARD_KNOWN 0x00000001
  823. #define QDF_MON_STATUS_USIG_PPDU_TYPE_N_COMP_MODE_KNOWN 0x00000004
  824. #define QDF_MON_STATUS_USIG_VALIDATE_KNOWN 0x00000008
  825. #define QDF_MON_STATUS_USIG_MU_VALIDATE1_KNOWN 0x00000002
  826. #define QDF_MON_STATUS_USIG_MU_PUNCTURE_CH_INFO_KNOWN 0x00000010
  827. #define QDF_MON_STATUS_USIG_MU_VALIDATE2_KNOWN 0x00000020
  828. #define QDF_MON_STATUS_USIG_MU_EHT_SIG_MCS_KNOWN 0x00000040
  829. #define QDF_MON_STATUS_USIG_MU_NUM_EHT_SIG_SYM_KNOWN 0x00000080
  830. #define QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_1_KNOWN 0x00000010
  831. #define QDF_MON_STATUS_USIG_TB_SPATIAL_REUSE_2_KNOWN 0x00000020
  832. #define QDF_MON_STATUS_USIG_TB_DISREGARD1_KNOWN 0x00000040
  833. #define QDF_MON_STATUS_USIG_CRC_KNOWN 0x00000100
  834. #define QDF_MON_STATUS_USIG_TAIL_KNOWN 0x00000200
  835. /* EHT known Mask */
  836. #define QDF_MON_STATUS_EHT_CONTENT_CH_INDEX_KNOWN 0x00000001
  837. #define QDF_MON_STATUS_EHT_SPATIAL_REUSE_KNOWN 0x00000002
  838. #define QDF_MON_STATUS_EHT_GUARD_INTERVAL_KNOWN 0x00000004
  839. #define QDF_MON_STATUS_EHT_LTF_KNOWN 0x00000008
  840. #define QDF_MON_STATUS_EHT_EHT_LTF_KNOWN 0x00000010
  841. #define QDF_MON_STATUS_EHT_LDPC_EXTRA_SYMBOL_SEG_KNOWN 0x00000020
  842. #define QDF_MON_STATUS_EHT_PRE_FEC_PADDING_FACTOR_KNOWN 0x00000040
  843. #define QDF_MON_STATUS_EHT_PE_DISAMBIGUITY_KNOWN 0x00000080
  844. #define QDF_MON_STATUS_EHT_DISREARD_KNOWN 0x00000100
  845. #define QDF_MON_STATUS_EHT_CRC1_KNOWN 0x00002000
  846. #define QDF_MON_STATUS_EHT_TAIL1_KNOWN 0x00004000
  847. #define QDF_MON_STATUS_EHT_CRC2_KNOWN 0x00008000
  848. #define QDF_MON_STATUS_EHT_TAIL2_KNOWN 0x00010000
  849. #define QDF_MON_STATUS_EHT_RU_MRU_SIZE_KNOWN 0x00400000
  850. #define QDF_MON_STATUS_EHT_RU_MRU_INDEX_KNOWN 0x00800000
  851. #define QDF_MON_STATUS_EHT_TB_RU_ALLOCATION_KNOWN 0x01000000
  852. #define QDF_MON_STATUS_EHT_NUM_NON_OFDMA_USERS_KNOWN 0x00080000
  853. #define QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_KNOWN 0x00100000
  854. #define QDF_MON_STATUS_EHT_USER_ENC_BLOCK_TAIL_KNOWN 0x00200000
  855. #define QDF_MON_STATUS_EHT_NDP_DISREGARD_KNOWN 0x00000200
  856. #define QDF_MON_STATUS_EHT_NDP_NSS_KNOWN 0x00020000
  857. #define QDF_MON_STATUS_EHT_NDP_BEAMFORMED_KNOWN 0x00040000
  858. #define QDF_MON_STATUS_EHT_NUM_KNOWN_RU_ALLOCATIONS_SHIFT 10
  859. /* EHT data0 Mask/SHIFT */
  860. #define QDF_MON_STATUS_EHT_CONTENT_CH_INDEX_SHIFT 0
  861. #define QDF_MON_STATUS_EHT_SPATIAL_REUSE_SHIFT 3
  862. #define QDF_MON_STATUS_EHT_GI_SHIFT 7
  863. #define QDF_MON_STATUS_EHT_LTF_SHIFT 9
  864. #define QDF_MON_STATUS_EHT_EHT_LTF_SHIFT 11
  865. #define QDF_MON_STATUS_EHT_LDPC_EXTRA_SYMBOL_SEG_SHIFT 14
  866. #define QDF_MON_STATUS_EHT_PRE_FEC_PADDING_FACTOR_SHIFT 15
  867. #define QDF_MON_STATUS_EHT_PE_DISAMBIGUITY_SHIFT 17
  868. #define QDF_MON_STATUS_EHT_NDP_DISREGARD_SHIFT 18
  869. #define QDF_MON_STATUS_EHT_DISREGARD_SHIFT 18
  870. #define QDF_MON_STATUS_EHT_CRC1_SHIFT 22
  871. #define QDF_MON_STATUS_EHT_TAIL1_SHIFT 26
  872. /* EHT data1 Mask/SHIFT */
  873. #define QDF_MON_STATUS_EHT_RU_MRU_SIZE_SHIFT 0
  874. #define QDF_MON_STATUS_EHT_RU_MRU_INDEX_SHIFT 5
  875. #define QDF_MON_STATUS_EHT_RU_ALLOCATION1_1_SHIFT 13
  876. #define QDF_MON_STATUS_EHT_RU_ALLOCATION1_2_SHIFT 22
  877. /* EHT data2 Mask/SHIFT */
  878. #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_1_SHIFT 0
  879. #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_2_SHIFT 9
  880. #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_3_SHIFT 18
  881. /* EHT data3 Mask/SHIFT */
  882. #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_4_SHIFT 0
  883. #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_5_SHIFT 9
  884. #define QDF_MON_STATUS_EHT_RU_ALLOCATION2_6_SHIFT 18
  885. /* EHT data4 Mask/SHIFT */
  886. #define QDF_MON_STATUS_EHT_CRC2_SHIFT 0
  887. #define QDF_MON_STATUS_EHT_TAIL2_SHIFT 4
  888. #define QDF_MON_STATUS_EHT_NDP_NSS_SHIFT 12
  889. #define QDF_MON_STATUS_EHT_NDP_BEAMFORMED_SHIFT 16
  890. #define QDF_MON_STATUS_EHT_NUM_NON_OFDMA_USERS_SHIFT 17
  891. #define QDF_MON_STATUS_EHT_USER_ENC_BLOCK_CRC_SHIFT 20
  892. #define QDF_MON_STATUS_EHT_USER_ENC_BLOCK_TAIL_SHIFT 24
  893. /* EHT data5 Mask/SHIFT */
  894. #define QDF_MON_STATUS_EHT_TB_RU_PS160_SHIFT 0
  895. #define QDF_MON_STATUS_EHT_TB_RU_PS80_SHIFT 1
  896. #define QDF_MON_STATUS_EHT_TB_RU_B7_B1_SHIFT 2
  897. /* EHT user info Mask/SHIFT */
  898. #define QDF_MON_STATUS_EHT_USER_STA_ID_KNOWN 0x00000001
  899. #define QDF_MON_STATUS_EHT_USER_MCS_KNOWN 0x00000002
  900. #define QDF_MON_STATUS_EHT_USER_CODING_KNOWN 0x00000004
  901. #define QDF_MON_STATUS_EHT_USER_RESERVED_KNOWN 0x00000008
  902. #define QDF_MON_STATUS_EHT_USER_NSS_KNOWN 0x00000010
  903. #define QDF_MON_STATUS_EHT_USER_BEAMFORMING_KNOWN 0x00000020
  904. #define QDF_MON_STATUS_EHT_USER_SPATIAL_CONFIG_KNOWN 0x00000040
  905. #define QDF_MON_STATUS_EHT_USER_DATA_FOR_THIS_USER_SHIFT 7
  906. #define QDF_MON_STATUS_EHT_USER_STA_ID_SHIFT 8
  907. #define QDF_MON_STATUS_EHT_USER_CODING_SHIFT 19
  908. #define QDF_MON_STATUS_EHT_USER_MCS_SHIFT 20
  909. #define QDF_MON_STATUS_EHT_USER_NSS_SHIFT 24
  910. #define QDF_MON_STATUS_EHT_USER_RESERVED_SHIFT 28
  911. #define QDF_MON_STATUS_EHT_USER_BEAMFORMING_SHIFT 29
  912. #define QDF_MON_STATUS_EHT_USER_SPATIAL_CONFIG_SHIFT 24
  913. /**
  914. * enum qdf_proto_type - protocol type
  915. * @QDF_PROTO_TYPE_DHCP - DHCP
  916. * @QDF_PROTO_TYPE_EAPOL - EAPOL
  917. * @QDF_PROTO_TYPE_ARP - ARP
  918. * @QDF_PROTO_TYPE_MGMT - MGMT
  919. * @QDF_PROTO_TYPE_ICMP - ICMP
  920. * @QDF_PROTO_TYPE_ICMPv6 - ICMPv6
  921. * @QDF_PROTO_TYPE_EVENT - EVENT
  922. * @QDF_PROTO_TYPE_DNS - DNS
  923. */
  924. enum qdf_proto_type {
  925. QDF_PROTO_TYPE_DHCP,
  926. QDF_PROTO_TYPE_EAPOL,
  927. QDF_PROTO_TYPE_ARP,
  928. QDF_PROTO_TYPE_MGMT,
  929. QDF_PROTO_TYPE_ICMP,
  930. QDF_PROTO_TYPE_ICMPv6,
  931. QDF_PROTO_TYPE_EVENT,
  932. QDF_PROTO_TYPE_DNS,
  933. QDF_PROTO_TYPE_MAX
  934. };
  935. /**
  936. * qdf_reception_type - reception type used by lithium phy TLV
  937. * @QDF_RECEPTION_TYPE_ULOFMDA - UL OFDMA
  938. * @QDF_RECEPTION_TYPE_ULMIMO - UL MIMO
  939. * @QQDF_RECEPTION_TYPE_FRAMELESS - Frame less
  940. * @QDF_RECEPTION_TYPE_OTHER - All the other types
  941. */
  942. enum qdf_reception_type {
  943. QDF_RECEPTION_TYPE_ULOFMDA,
  944. QDF_RECEPTION_TYPE_ULMIMO,
  945. QDF_RECEPTION_TYPE_OTHER,
  946. QDF_RECEPTION_TYPE_FRAMELESS
  947. };
  948. /**
  949. * cb_ftype - Frame type information in skb cb
  950. * @CB_FTYPE_INVALID - Invalid
  951. * @CB_FTYPE_MCAST2UCAST - Multicast to Unicast converted packet
  952. * @CB_FTYPE_TSO - TCP Segmentation Offload
  953. * @CB_FTYPE_TSO_SG - TSO Scatter Gather
  954. * @CB_FTYPE_SG - Scatter Gather
  955. * @CB_FTYPE_INTRABSS_FWD - Intra BSS forwarding
  956. * @CB_FTYPE_RX_INFO - Rx information
  957. * @CB_FTYPE_MESH_RX_INFO - Mesh Rx information
  958. * @CB_FTYPE_MESH_TX_INFO - Mesh Tx information
  959. * @CB_FTYPE_DMS - Directed Multicast Service
  960. * @CB_FTYPE_SAWF - SAWF information
  961. * @CB_FTYPE_MLO_MCAST - MLO MCAST enable information
  962. */
  963. enum cb_ftype {
  964. CB_FTYPE_INVALID = 0,
  965. CB_FTYPE_MCAST2UCAST = 1,
  966. CB_FTYPE_TSO = 2,
  967. CB_FTYPE_TSO_SG = 3,
  968. CB_FTYPE_SG = 4,
  969. CB_FTYPE_INTRABSS_FWD = 5,
  970. CB_FTYPE_RX_INFO = 6,
  971. CB_FTYPE_MESH_RX_INFO = 7,
  972. CB_FTYPE_MESH_TX_INFO = 8,
  973. CB_FTYPE_DMS = 9,
  974. CB_FTYPE_SAWF = 10,
  975. CB_FTYPE_MLO_MCAST = 11,
  976. };
  977. /**
  978. * @qdf_nbuf_t - Platform independent packet abstraction
  979. */
  980. typedef __qdf_nbuf_t qdf_nbuf_t;
  981. /**
  982. * @qdf_nbuf_shared_info_t- Platform independent shared info
  983. */
  984. typedef __qdf_nbuf_shared_info_t qdf_nbuf_shared_info_t;
  985. /**
  986. * struct qdf_nbuf_track_t - Network buffer track structure
  987. *
  988. * @p_next: Pointer to next
  989. * @net_buf: Pointer to network buffer
  990. * @func_name: Function name
  991. * @line_num: Line number
  992. * @size: Size
  993. * @map_func_name: nbuf mapping function name
  994. * @map_line_num: mapping function line number
  995. * @unmap_func_name: nbuf unmapping function name
  996. * @unmap_line_num: mapping function line number
  997. * @is_nbuf_mapped: indicate mapped/unmapped nbuf
  998. * @time: mapping function timestamp
  999. * @smmu_map_line_num: smmu mapping line number
  1000. * @smmu_unmap_line_num: smmu unmapping line number
  1001. * @smmu_map_func_name: smmu mapping function name
  1002. * @smmu_unmap_func_name: smmu unmapping function name
  1003. * @is_nbuf_smmu_mapped: nbuf is smmu mapped
  1004. * @smmu_map_iova_addr: nbuf smmu map virtual address
  1005. * @smmu_map_pa_addr: nbuf smmu map physical address
  1006. * @smmu_unmap_iova_addr: nbuf smmu unmap virtual address
  1007. * @smmu_unmap_pa_addr: nbuf smmu unmap physical address
  1008. */
  1009. struct qdf_nbuf_track_t {
  1010. struct qdf_nbuf_track_t *p_next;
  1011. qdf_nbuf_t net_buf;
  1012. char func_name[QDF_MEM_FUNC_NAME_SIZE];
  1013. uint32_t line_num;
  1014. size_t size;
  1015. char map_func_name[QDF_MEM_FUNC_NAME_SIZE];
  1016. uint32_t map_line_num;
  1017. char unmap_func_name[QDF_MEM_FUNC_NAME_SIZE];
  1018. uint32_t unmap_line_num;
  1019. bool is_nbuf_mapped;
  1020. qdf_time_t time;
  1021. #ifdef NBUF_SMMU_MAP_UNMAP_DEBUG
  1022. uint32_t smmu_map_line_num;
  1023. uint32_t smmu_unmap_line_num;
  1024. char smmu_map_func_name[QDF_MEM_FUNC_NAME_SIZE];
  1025. char smmu_unmap_func_name[QDF_MEM_FUNC_NAME_SIZE];
  1026. bool is_nbuf_smmu_mapped;
  1027. unsigned long smmu_map_iova_addr;
  1028. unsigned long smmu_map_pa_addr;
  1029. unsigned long smmu_unmap_iova_addr;
  1030. unsigned long smmu_unmap_pa_addr;
  1031. #endif
  1032. };
  1033. typedef struct qdf_nbuf_track_t QDF_NBUF_TRACK;
  1034. /**
  1035. * typedef qdf_nbuf_queue_head_t - Platform independent nbuf queue head
  1036. */
  1037. typedef __qdf_nbuf_queue_head_t qdf_nbuf_queue_head_t;
  1038. /**
  1039. * @qdf_dma_map_cb_t - Dma map callback prototype
  1040. */
  1041. typedef void (*qdf_dma_map_cb_t)(void *arg, qdf_nbuf_t buf,
  1042. qdf_dma_map_t dmap);
  1043. /* BUS/DMA mapping routines */
  1044. static inline QDF_STATUS
  1045. qdf_nbuf_dmamap_create(qdf_device_t osdev, qdf_dma_map_t *dmap)
  1046. {
  1047. return __qdf_nbuf_dmamap_create(osdev, dmap);
  1048. }
  1049. static inline void
  1050. qdf_nbuf_dmamap_destroy(qdf_device_t osdev, qdf_dma_map_t dmap)
  1051. {
  1052. __qdf_nbuf_dmamap_destroy(osdev, dmap);
  1053. }
  1054. static inline void
  1055. qdf_nbuf_dmamap_set_cb(qdf_dma_map_t dmap, qdf_dma_map_cb_t cb, void *arg)
  1056. {
  1057. __qdf_nbuf_dmamap_set_cb(dmap, cb, arg);
  1058. }
  1059. static inline void
  1060. qdf_nbuf_set_send_complete_flag(qdf_nbuf_t buf, bool flag)
  1061. {
  1062. __qdf_nbuf_set_send_complete_flag(buf, flag);
  1063. }
  1064. #define QDF_NBUF_QUEUE_WALK_SAFE(queue, var, tvar) \
  1065. __qdf_nbuf_queue_walk_safe(queue, var, tvar)
  1066. #ifdef NBUF_MAP_UNMAP_DEBUG
  1067. /**
  1068. * qdf_nbuf_map_check_for_leaks() - check for nbuf map leaks
  1069. *
  1070. * Check for net buffers that have been mapped, but never unmapped.
  1071. *
  1072. * Returns: None
  1073. */
  1074. void qdf_nbuf_map_check_for_leaks(void);
  1075. QDF_STATUS qdf_nbuf_map_debug(qdf_device_t osdev,
  1076. qdf_nbuf_t buf,
  1077. qdf_dma_dir_t dir,
  1078. const char *func,
  1079. uint32_t line);
  1080. #define qdf_nbuf_map(osdev, buf, dir) \
  1081. qdf_nbuf_map_debug(osdev, buf, dir, __func__, __LINE__)
  1082. void qdf_nbuf_unmap_debug(qdf_device_t osdev,
  1083. qdf_nbuf_t buf,
  1084. qdf_dma_dir_t dir,
  1085. const char *func,
  1086. uint32_t line);
  1087. #define qdf_nbuf_unmap(osdev, buf, dir) \
  1088. qdf_nbuf_unmap_debug(osdev, buf, dir, __func__, __LINE__)
  1089. QDF_STATUS qdf_nbuf_map_single_debug(qdf_device_t osdev,
  1090. qdf_nbuf_t buf,
  1091. qdf_dma_dir_t dir,
  1092. const char *func,
  1093. uint32_t line);
  1094. #define qdf_nbuf_map_single(osdev, buf, dir) \
  1095. qdf_nbuf_map_single_debug(osdev, buf, dir, __func__, __LINE__)
  1096. void qdf_nbuf_unmap_single_debug(qdf_device_t osdev,
  1097. qdf_nbuf_t buf,
  1098. qdf_dma_dir_t dir,
  1099. const char *func,
  1100. uint32_t line);
  1101. #define qdf_nbuf_unmap_single(osdev, buf, dir) \
  1102. qdf_nbuf_unmap_single_debug(osdev, buf, dir, __func__, __LINE__)
  1103. QDF_STATUS qdf_nbuf_map_nbytes_debug(qdf_device_t osdev,
  1104. qdf_nbuf_t buf,
  1105. qdf_dma_dir_t dir,
  1106. int nbytes,
  1107. const char *func,
  1108. uint32_t line);
  1109. #define qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes) \
  1110. qdf_nbuf_map_nbytes_debug(osdev, buf, dir, nbytes, __func__, __LINE__)
  1111. void qdf_nbuf_unmap_nbytes_debug(qdf_device_t osdev,
  1112. qdf_nbuf_t buf,
  1113. qdf_dma_dir_t dir,
  1114. int nbytes,
  1115. const char *func,
  1116. uint32_t line);
  1117. #define qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes) \
  1118. qdf_nbuf_unmap_nbytes_debug(osdev, buf, dir, nbytes, __func__, __LINE__)
  1119. QDF_STATUS qdf_nbuf_map_nbytes_single_debug(qdf_device_t osdev,
  1120. qdf_nbuf_t buf,
  1121. qdf_dma_dir_t dir,
  1122. int nbytes,
  1123. const char *func,
  1124. uint32_t line);
  1125. #define qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes) \
  1126. qdf_nbuf_map_nbytes_single_debug(osdev, buf, dir, nbytes, \
  1127. __func__, __LINE__)
  1128. void qdf_nbuf_unmap_nbytes_single_debug(qdf_device_t osdev,
  1129. qdf_nbuf_t buf,
  1130. qdf_dma_dir_t dir,
  1131. int nbytes,
  1132. const char *func,
  1133. uint32_t line);
  1134. #define qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes) \
  1135. qdf_nbuf_unmap_nbytes_single_debug(osdev, buf, dir, nbytes, \
  1136. __func__, __LINE__)
  1137. void qdf_nbuf_unmap_nbytes_single_paddr_debug(qdf_device_t osdev,
  1138. qdf_nbuf_t buf,
  1139. qdf_dma_addr_t phy_addr,
  1140. qdf_dma_dir_t dir, int nbytes,
  1141. const char *func, uint32_t line);
  1142. #define qdf_nbuf_unmap_nbytes_single_paddr(osdev, buf, phy_addr, dir, nbytes) \
  1143. qdf_nbuf_unmap_nbytes_single_paddr_debug(osdev, buf, phy_addr, \
  1144. dir, nbytes, __func__, \
  1145. __LINE__)
  1146. #else /* NBUF_MAP_UNMAP_DEBUG */
  1147. static inline void qdf_nbuf_map_check_for_leaks(void) {}
  1148. static inline QDF_STATUS
  1149. qdf_nbuf_map(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  1150. {
  1151. return __qdf_nbuf_map(osdev, buf, dir);
  1152. }
  1153. static inline void
  1154. qdf_nbuf_unmap(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  1155. {
  1156. __qdf_nbuf_unmap(osdev, buf, dir);
  1157. }
  1158. static inline QDF_STATUS
  1159. qdf_nbuf_map_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  1160. {
  1161. return __qdf_nbuf_map_single(osdev, buf, dir);
  1162. }
  1163. static inline void
  1164. qdf_nbuf_unmap_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  1165. {
  1166. __qdf_nbuf_unmap_single(osdev, buf, dir);
  1167. }
  1168. static inline QDF_STATUS
  1169. qdf_nbuf_map_nbytes(qdf_device_t osdev, qdf_nbuf_t buf,
  1170. qdf_dma_dir_t dir, int nbytes)
  1171. {
  1172. return __qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes);
  1173. }
  1174. static inline void
  1175. qdf_nbuf_unmap_nbytes(qdf_device_t osdev,
  1176. qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  1177. {
  1178. __qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes);
  1179. }
  1180. static inline QDF_STATUS
  1181. qdf_nbuf_map_nbytes_single(
  1182. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  1183. {
  1184. return __qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes);
  1185. }
  1186. static inline void
  1187. qdf_nbuf_unmap_nbytes_single(
  1188. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  1189. {
  1190. return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes);
  1191. }
  1192. static inline void
  1193. qdf_nbuf_unmap_nbytes_single_paddr(qdf_device_t osdev, qdf_nbuf_t buf,
  1194. qdf_dma_addr_t phy_addr, qdf_dma_dir_t dir,
  1195. int nbytes)
  1196. {
  1197. __qdf_mem_unmap_nbytes_single(osdev, phy_addr, dir, nbytes);
  1198. }
  1199. #endif /* NBUF_MAP_UNMAP_DEBUG */
  1200. /**
  1201. * qdf_nbuf_queue_head_dequeue() - dequeue nbuf from the head of queue
  1202. * @nbuf_queue_head: pointer to nbuf queue head
  1203. *
  1204. * Return: pointer to network buffer dequeued
  1205. */
  1206. static inline
  1207. qdf_nbuf_t qdf_nbuf_queue_head_dequeue(qdf_nbuf_queue_head_t *nbuf_queue_head)
  1208. {
  1209. return __qdf_nbuf_queue_head_dequeue(nbuf_queue_head);
  1210. }
  1211. /**
  1212. * qdf_nbuf_queue_head_qlen() - length of the queue
  1213. * @nbuf_queue_head: pointer to nbuf queue head
  1214. *
  1215. * Return: length of queue (number of nbufs) pointed by qdf_nbuf_queue_head_t
  1216. */
  1217. static inline
  1218. uint32_t qdf_nbuf_queue_head_qlen(qdf_nbuf_queue_head_t *nbuf_queue_head)
  1219. {
  1220. return __qdf_nbuf_queue_head_qlen(nbuf_queue_head);
  1221. }
  1222. /**
  1223. * qdf_nbuf_queue_head_enqueue_tail() - enqueue nbuf into queue tail
  1224. * @nbuf_queue_head: pointer to nbuf queue head
  1225. * @nbuf: nbuf to be enqueued
  1226. *
  1227. * Return: None
  1228. */
  1229. static inline
  1230. void qdf_nbuf_queue_head_enqueue_tail(qdf_nbuf_queue_head_t *nbuf_queue_head,
  1231. qdf_nbuf_t nbuf)
  1232. {
  1233. return __qdf_nbuf_queue_head_enqueue_tail(nbuf_queue_head, nbuf);
  1234. }
  1235. /**
  1236. * qdf_nbuf_queue_head_init() - initialize qdf_nbuf_queue_head_t
  1237. * @nbuf_queue_head: pointer to nbuf queue head to be initialized
  1238. *
  1239. * Return: None
  1240. */
  1241. static inline
  1242. void qdf_nbuf_queue_head_init(qdf_nbuf_queue_head_t *nbuf_queue_head)
  1243. {
  1244. return __qdf_nbuf_queue_head_init(nbuf_queue_head);
  1245. }
  1246. /**
  1247. * qdf_nbuf_queue_head_purge() - purge qdf_nbuf_queue_head_t
  1248. * @nbuf_queue_head: pointer to nbuf queue head to be purged
  1249. *
  1250. * Return: None
  1251. */
  1252. static inline
  1253. void qdf_nbuf_queue_head_purge(qdf_nbuf_queue_head_t *nbuf_queue_head)
  1254. {
  1255. return __qdf_nbuf_queue_head_purge(nbuf_queue_head);
  1256. }
  1257. /**
  1258. * qdf_nbuf_queue_empty() - dequeue nbuf from the head of queue
  1259. * @nbuf_queue_head: pointer to nbuf queue head
  1260. *
  1261. * Return: true if queue is empty else false
  1262. */
  1263. static inline
  1264. int qdf_nbuf_queue_empty(qdf_nbuf_queue_head_t *nbuf_queue_head)
  1265. {
  1266. return __qdf_nbuf_queue_empty(nbuf_queue_head);
  1267. }
  1268. /**
  1269. * qdf_nbuf_queue_head_lock() - Acquire the nbuf_queue_head lock
  1270. * @head: nbuf_queue_head of the nbuf_list for which lock is to be acquired
  1271. *
  1272. * Return: void
  1273. */
  1274. static inline void qdf_nbuf_queue_head_lock(qdf_nbuf_queue_head_t *head)
  1275. {
  1276. __qdf_nbuf_queue_head_lock(head);
  1277. }
  1278. /**
  1279. * qdf_nbuf_queue_head_unlock() - Release the nbuf queue lock
  1280. * @head: nbuf_queue_head of the nbuf_list for which lock is to be release
  1281. *
  1282. * Return: void
  1283. */
  1284. static inline void qdf_nbuf_queue_head_unlock(qdf_nbuf_queue_head_t *head)
  1285. {
  1286. __qdf_nbuf_queue_head_unlock(head);
  1287. }
  1288. static inline void
  1289. qdf_nbuf_sync_for_cpu(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  1290. {
  1291. __qdf_nbuf_sync_for_cpu(osdev, buf, dir);
  1292. }
  1293. /**
  1294. * qdf_nbuf_dma_inv_range() - Invalidate the specified virtual address range
  1295. * @buf_start: start address
  1296. * @buf_end: end address
  1297. *
  1298. * Return: none
  1299. */
  1300. static inline void
  1301. qdf_nbuf_dma_inv_range(const void *buf_start, const void *buf_end)
  1302. {
  1303. __qdf_nbuf_dma_inv_range(buf_start, buf_end);
  1304. }
  1305. /**
  1306. * qdf_nbuf_dma_inv_range_no_dsb() - barrierless Invalidate the specified
  1307. * virtual address range
  1308. * @buf_start: start address
  1309. * @buf_end: end address
  1310. *
  1311. * Return: none
  1312. */
  1313. static inline void
  1314. qdf_nbuf_dma_inv_range_no_dsb(const void *buf_start, const void *buf_end)
  1315. {
  1316. __qdf_nbuf_dma_inv_range_no_dsb(buf_start, buf_end);
  1317. }
  1318. /**
  1319. * qdf_nbuf_dma_clean_range_no_dsb() - barrierless clean the specified
  1320. * virtual address range
  1321. * @buf_start: start address
  1322. * @buf_end: end address
  1323. *
  1324. * Return: none
  1325. */
  1326. static inline void
  1327. qdf_nbuf_dma_clean_range_no_dsb(const void *buf_start, const void *buf_end)
  1328. {
  1329. __qdf_nbuf_dma_clean_range_no_dsb(buf_start, buf_end);
  1330. }
  1331. static inline void
  1332. qdf_dsb(void)
  1333. {
  1334. __qdf_dsb();
  1335. }
  1336. static inline int qdf_nbuf_get_num_frags(qdf_nbuf_t buf)
  1337. {
  1338. return __qdf_nbuf_get_num_frags(buf);
  1339. }
  1340. /**
  1341. * qdf_nbuf_dma_clean_range() - Clean the specified virtual address range
  1342. * @buf_start: start address
  1343. * @buf_end: end address
  1344. *
  1345. * Return: none
  1346. */
  1347. static inline void
  1348. qdf_nbuf_dma_clean_range(const void *buf_start, const void *buf_end)
  1349. {
  1350. __qdf_nbuf_dma_clean_range(buf_start, buf_end);
  1351. }
  1352. /**
  1353. * qdf_nbuf_get_frag_len() - get fragment length
  1354. * @buf: Network buffer
  1355. * @frag_num: Fragment number
  1356. *
  1357. * Return: Fragment length
  1358. */
  1359. static inline int qdf_nbuf_get_frag_len(qdf_nbuf_t buf, int frag_num)
  1360. {
  1361. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  1362. return __qdf_nbuf_get_frag_len(buf, frag_num);
  1363. }
  1364. /**
  1365. * qdf_nbuf_get_frag_vaddr() - get fragment virtual address
  1366. * @buf: Network buffer
  1367. * @frag_num: Fragment number
  1368. *
  1369. * Return: Fragment virtual address
  1370. */
  1371. static inline unsigned char *qdf_nbuf_get_frag_vaddr(qdf_nbuf_t buf,
  1372. int frag_num)
  1373. {
  1374. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  1375. return __qdf_nbuf_get_frag_vaddr(buf, frag_num);
  1376. }
  1377. /**
  1378. * qdf_nbuf_get_frag_vaddr_always() - get fragment virtual address
  1379. * @buf: Network buffer
  1380. *
  1381. * Return: Fragment virtual address
  1382. */
  1383. static inline unsigned char *
  1384. qdf_nbuf_get_frag_vaddr_always(qdf_nbuf_t buf)
  1385. {
  1386. return __qdf_nbuf_get_frag_vaddr_always(buf);
  1387. }
  1388. /**
  1389. * qdf_nbuf_get_frag_paddr() - get physical address for skb linear buffer
  1390. * or skb fragment, based on frag_num passed
  1391. * @buf: Network buffer
  1392. * @frag_num: Fragment number
  1393. *
  1394. * Return: Fragment physical address
  1395. */
  1396. static inline qdf_dma_addr_t qdf_nbuf_get_frag_paddr(qdf_nbuf_t buf,
  1397. unsigned int frag_num)
  1398. {
  1399. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  1400. return __qdf_nbuf_get_frag_paddr(buf, frag_num);
  1401. }
  1402. /**
  1403. * qdf_nbuf_get_tx_frag_paddr() - get physical address for skb fragments only
  1404. * @buf: Network buffer
  1405. *
  1406. * Return: Fragment physical address
  1407. * Usage guideline: Use “qdf_nbuf_frag_map()” to dma map the specific
  1408. * skb fragment , followed by “qdf_nbuf_get_tx_frag_paddr”
  1409. */
  1410. static inline qdf_dma_addr_t qdf_nbuf_get_tx_frag_paddr(qdf_nbuf_t buf)
  1411. {
  1412. return __qdf_nbuf_get_tx_frag_paddr(buf);
  1413. }
  1414. /**
  1415. * qdf_nbuf_get_frag_is_wordstream() - is fragment wordstream
  1416. * @buf: Network buffer
  1417. * @frag_num: Fragment number
  1418. *
  1419. * Return: Fragment wordstream or not
  1420. */
  1421. static inline int qdf_nbuf_get_frag_is_wordstream(qdf_nbuf_t buf, int frag_num)
  1422. {
  1423. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  1424. return __qdf_nbuf_get_frag_is_wordstream(buf, frag_num);
  1425. }
  1426. /**
  1427. * qdf_nbuf_set_frag_is_wordstream() - set fragment wordstream
  1428. * @buf: Network buffer
  1429. * @frag_num: Fragment number
  1430. * @is_wordstream: Wordstream
  1431. *
  1432. * Return: none
  1433. */
  1434. static inline void
  1435. qdf_nbuf_set_frag_is_wordstream(qdf_nbuf_t buf,
  1436. int frag_num, int is_wordstream)
  1437. {
  1438. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  1439. __qdf_nbuf_set_frag_is_wordstream(buf, frag_num, is_wordstream);
  1440. }
  1441. static inline void
  1442. qdf_nbuf_set_vdev_ctx(qdf_nbuf_t buf, uint8_t vdev_id)
  1443. {
  1444. __qdf_nbuf_set_vdev_ctx(buf, vdev_id);
  1445. }
  1446. static inline void
  1447. qdf_nbuf_set_tx_ftype(qdf_nbuf_t buf, enum cb_ftype type)
  1448. {
  1449. __qdf_nbuf_set_tx_ftype(buf, type);
  1450. }
  1451. static inline void
  1452. qdf_nbuf_set_rx_ftype(qdf_nbuf_t buf, enum cb_ftype type)
  1453. {
  1454. __qdf_nbuf_set_rx_ftype(buf, type);
  1455. }
  1456. static inline uint8_t
  1457. qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf)
  1458. {
  1459. return __qdf_nbuf_get_vdev_ctx(buf);
  1460. }
  1461. static inline enum cb_ftype qdf_nbuf_get_tx_ftype(qdf_nbuf_t buf)
  1462. {
  1463. return __qdf_nbuf_get_tx_ftype(buf);
  1464. }
  1465. static inline enum cb_ftype qdf_nbuf_get_rx_ftype(qdf_nbuf_t buf)
  1466. {
  1467. return __qdf_nbuf_get_rx_ftype(buf);
  1468. }
  1469. static inline qdf_dma_addr_t
  1470. qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf)
  1471. {
  1472. return __qdf_nbuf_mapped_paddr_get(buf);
  1473. }
  1474. static inline void
  1475. qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr)
  1476. {
  1477. __qdf_nbuf_mapped_paddr_set(buf, paddr);
  1478. }
  1479. static inline void
  1480. qdf_nbuf_frag_push_head(qdf_nbuf_t buf,
  1481. int frag_len, unsigned char *frag_vaddr,
  1482. qdf_dma_addr_t frag_paddr)
  1483. {
  1484. __qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr);
  1485. }
  1486. #define qdf_nbuf_num_frags_init(_nbuf) __qdf_nbuf_num_frags_init((_nbuf))
  1487. /**
  1488. * qdf_nbuf_set_rx_chfrag_start() - set msdu start bit
  1489. * @buf: Network buffer
  1490. * @val: 0/1
  1491. *
  1492. * Return: void
  1493. */
  1494. static inline void
  1495. qdf_nbuf_set_rx_chfrag_start(qdf_nbuf_t buf, uint8_t val)
  1496. {
  1497. __qdf_nbuf_set_rx_chfrag_start(buf, val);
  1498. }
  1499. /**
  1500. * qdf_nbuf_is_rx_chfrag_start() - get msdu start bit
  1501. * @buf: Network buffer
  1502. *
  1503. * Return: integer value - 0/1
  1504. */
  1505. static inline int qdf_nbuf_is_rx_chfrag_start(qdf_nbuf_t buf)
  1506. {
  1507. return __qdf_nbuf_is_rx_chfrag_start(buf);
  1508. }
  1509. /**
  1510. * qdf_nbuf_set_rx_chfrag_cont() - set msdu continuation bit
  1511. * @buf: Network buffer
  1512. * @val: 0/1
  1513. *
  1514. * Return: void
  1515. */
  1516. static inline void
  1517. qdf_nbuf_set_rx_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
  1518. {
  1519. __qdf_nbuf_set_rx_chfrag_cont(buf, val);
  1520. }
  1521. /**
  1522. * qdf_nbuf_is_rx_chfrag_cont() - get msdu continuation bit
  1523. * @buf: Network buffer
  1524. *
  1525. * Return: integer value - 0/1
  1526. */
  1527. static inline int qdf_nbuf_is_rx_chfrag_cont(qdf_nbuf_t buf)
  1528. {
  1529. return __qdf_nbuf_is_rx_chfrag_cont(buf);
  1530. }
  1531. /**
  1532. * qdf_nbuf_set_rx_chfrag_end() - set msdu end bit
  1533. * @buf: Network buffer
  1534. * @val: 0/1
  1535. *
  1536. * Return: void
  1537. */
  1538. static inline void qdf_nbuf_set_rx_chfrag_end(qdf_nbuf_t buf, uint8_t val)
  1539. {
  1540. __qdf_nbuf_set_rx_chfrag_end(buf, val);
  1541. }
  1542. /**
  1543. * qdf_nbuf_is_rx_chfrag_end() - set msdu end bit
  1544. * @buf: Network buffer
  1545. *
  1546. * Return: integer value - 0/1
  1547. */
  1548. static inline int qdf_nbuf_is_rx_chfrag_end(qdf_nbuf_t buf)
  1549. {
  1550. return __qdf_nbuf_is_rx_chfrag_end(buf);
  1551. }
  1552. /**
  1553. * qdf_nbuf_set_da_mcbc() - set da is mcbc
  1554. * @buf: Network buffer
  1555. * @val: 0/1
  1556. *
  1557. * Return: void
  1558. */
  1559. static inline void
  1560. qdf_nbuf_set_da_mcbc(qdf_nbuf_t buf, uint8_t val)
  1561. {
  1562. __qdf_nbuf_set_da_mcbc(buf, val);
  1563. }
  1564. /**
  1565. * qdf_nbuf_is_da_mcbc() - get da is mcbc bit
  1566. * @buf: Network buffer
  1567. *
  1568. * Return: integer value - 0/1
  1569. */
  1570. static inline int qdf_nbuf_is_da_mcbc(qdf_nbuf_t buf)
  1571. {
  1572. return __qdf_nbuf_is_da_mcbc(buf);
  1573. }
  1574. /**
  1575. * qdf_nbuf_set_da_valid() - set da valid bit
  1576. * @buf: Network buffer
  1577. * @val: 0/1
  1578. *
  1579. * Return: void
  1580. */
  1581. static inline void qdf_nbuf_set_da_valid(qdf_nbuf_t buf, uint8_t val)
  1582. {
  1583. __qdf_nbuf_set_da_valid(buf, val);
  1584. }
  1585. /**
  1586. * qdf_nbuf_is_da_valid() - get da valid bit
  1587. * @buf: Network buffer
  1588. *
  1589. * Return: integer value - 0/1
  1590. */
  1591. static inline int qdf_nbuf_is_da_valid(qdf_nbuf_t buf)
  1592. {
  1593. return __qdf_nbuf_is_da_valid(buf);
  1594. }
  1595. /**
  1596. * qdf_nbuf_set_sa_valid() - set sa valid bit
  1597. * @buf: Network buffer
  1598. * @val: 0/1
  1599. *
  1600. * Return: void
  1601. */
  1602. static inline void qdf_nbuf_set_sa_valid(qdf_nbuf_t buf, uint8_t val)
  1603. {
  1604. __qdf_nbuf_set_sa_valid(buf, val);
  1605. }
  1606. /**
  1607. * qdf_nbuf_is_sa_valid() - get da valid bit
  1608. * @buf: Network buffer
  1609. *
  1610. * Return: integer value - 0/1
  1611. */
  1612. static inline int qdf_nbuf_is_sa_valid(qdf_nbuf_t buf)
  1613. {
  1614. return __qdf_nbuf_is_sa_valid(buf);
  1615. }
  1616. /**
  1617. * qdf_nbuf_set_rx_retry_flag() - set rx retry flag bit
  1618. * @buf: Network buffer
  1619. * @val: 0/1
  1620. *
  1621. * Return: void
  1622. */
  1623. static inline void qdf_nbuf_set_rx_retry_flag(qdf_nbuf_t buf, uint8_t val)
  1624. {
  1625. __qdf_nbuf_set_rx_retry_flag(buf, val);
  1626. }
  1627. /**
  1628. * qdf_nbuf_is_rx_retry_flag() - get rx retry flag bit
  1629. * @buf: Network buffer
  1630. *
  1631. * Return: integer value - 0/1
  1632. */
  1633. static inline int qdf_nbuf_is_rx_retry_flag(qdf_nbuf_t buf)
  1634. {
  1635. return __qdf_nbuf_is_rx_retry_flag(buf);
  1636. }
  1637. /**
  1638. * qdf_nbuf_set_raw_frame() - set raw_frame bit
  1639. * @buf: Network buffer
  1640. * @val: 0/1
  1641. *
  1642. * Return: void
  1643. */
  1644. static inline void qdf_nbuf_set_raw_frame(qdf_nbuf_t buf, uint8_t val)
  1645. {
  1646. __qdf_nbuf_set_raw_frame(buf, val);
  1647. }
  1648. /**
  1649. * qdf_nbuf_is_raw_frame() - get raw_frame bit
  1650. * @buf: Network buffer
  1651. *
  1652. * Return: integer value - 0/1
  1653. */
  1654. static inline int qdf_nbuf_is_raw_frame(qdf_nbuf_t buf)
  1655. {
  1656. return __qdf_nbuf_is_raw_frame(buf);
  1657. }
  1658. /**
  1659. * qdf_nbuf_set_tid_val() - set tid_val
  1660. * @buf: Network buffer
  1661. * @val: 4 bits tid value
  1662. */
  1663. static inline void qdf_nbuf_set_tid_val(qdf_nbuf_t buf, uint8_t val)
  1664. {
  1665. __qdf_nbuf_set_tid_val(buf, val);
  1666. }
  1667. /**
  1668. * qdf_nbuf_get_tid_val() - get tid_val
  1669. * @buf: Network buffer
  1670. *
  1671. * Return: integer value[4 bits tid value]
  1672. */
  1673. static inline uint8_t qdf_nbuf_get_tid_val(qdf_nbuf_t buf)
  1674. {
  1675. return __qdf_nbuf_get_tid_val(buf);
  1676. }
  1677. /**
  1678. * qdf_nbuf_set_frag_list() - set frag list bit
  1679. * @buf: Network buffer
  1680. * @val: 0/1
  1681. *
  1682. * Return: void
  1683. */
  1684. static inline void qdf_nbuf_set_is_frag(qdf_nbuf_t buf, uint8_t val)
  1685. {
  1686. __qdf_nbuf_set_is_frag(buf, val);
  1687. }
  1688. /**
  1689. * qdf_nbuf_is_sa_valid() - get da frag list bit
  1690. * @buf: Network buffer
  1691. *
  1692. * Return: integer value - 0/1
  1693. */
  1694. static inline int qdf_nbuf_is_frag(qdf_nbuf_t buf)
  1695. {
  1696. return __qdf_nbuf_is_frag(buf);
  1697. }
  1698. /**
  1699. * qdf_nbuf_set_tx_chfrag_start() - set msdu start bit
  1700. * @buf: Network buffer
  1701. * @val: 0/1
  1702. *
  1703. * Return: void
  1704. */
  1705. static inline void
  1706. qdf_nbuf_set_tx_chfrag_start(qdf_nbuf_t buf, uint8_t val)
  1707. {
  1708. __qdf_nbuf_set_tx_chfrag_start(buf, val);
  1709. }
  1710. /**
  1711. * qdf_nbuf_is_tx_chfrag_start() - get msdu start bit
  1712. * @buf: Network buffer
  1713. *
  1714. * Return: integer value - 0/1
  1715. */
  1716. static inline int qdf_nbuf_is_tx_chfrag_start(qdf_nbuf_t buf)
  1717. {
  1718. return __qdf_nbuf_is_tx_chfrag_start(buf);
  1719. }
  1720. /**
  1721. * qdf_nbuf_set_tx_chfrag_cont() - set msdu continuation bit
  1722. * @buf: Network buffer
  1723. * @val: 0/1
  1724. *
  1725. * Return: void
  1726. */
  1727. static inline void
  1728. qdf_nbuf_set_tx_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
  1729. {
  1730. __qdf_nbuf_set_tx_chfrag_cont(buf, val);
  1731. }
  1732. /**
  1733. * qdf_nbuf_is_tx_chfrag_cont() - get msdu continuation bit
  1734. * @buf: Network buffer
  1735. *
  1736. * Return: integer value - 0/1
  1737. */
  1738. static inline int qdf_nbuf_is_tx_chfrag_cont(qdf_nbuf_t buf)
  1739. {
  1740. return __qdf_nbuf_is_tx_chfrag_cont(buf);
  1741. }
  1742. /**
  1743. * qdf_nbuf_set_tx_chfrag_end() - set msdu end bit
  1744. * @buf: Network buffer
  1745. * @val: 0/1
  1746. *
  1747. * Return: void
  1748. */
  1749. static inline void qdf_nbuf_set_tx_chfrag_end(qdf_nbuf_t buf, uint8_t val)
  1750. {
  1751. __qdf_nbuf_set_tx_chfrag_end(buf, val);
  1752. }
  1753. /**
  1754. * qdf_nbuf_is_tx_chfrag_end() - set msdu end bit
  1755. * @buf: Network buffer
  1756. *
  1757. * Return: integer value - 0/1
  1758. */
  1759. static inline int qdf_nbuf_is_tx_chfrag_end(qdf_nbuf_t buf)
  1760. {
  1761. return __qdf_nbuf_is_tx_chfrag_end(buf);
  1762. }
  1763. static inline void
  1764. qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg)
  1765. {
  1766. __qdf_nbuf_dma_map_info(bmap, sg);
  1767. }
  1768. /**
  1769. * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
  1770. * @buf: Network buffer
  1771. *
  1772. * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
  1773. */
  1774. static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
  1775. {
  1776. return __qdf_nbuf_is_tso(nbuf);
  1777. }
  1778. /**
  1779. * qdf_nbuf_get_users() - function to get the number of users referencing this
  1780. * network buffer
  1781. *
  1782. * @nbuf: network buffer
  1783. *
  1784. * Return: number of user references to nbuf.
  1785. */
  1786. static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf)
  1787. {
  1788. return __qdf_nbuf_get_users(nbuf);
  1789. }
  1790. /**
  1791. * qdf_nbuf_next() - get the next packet in the linked list
  1792. * @buf: Network buffer
  1793. *
  1794. * This function can be used when nbufs are directly linked into a list,
  1795. * rather than using a separate network buffer queue object.
  1796. *
  1797. * Return: next network buffer in the linked list
  1798. */
  1799. static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
  1800. {
  1801. return __qdf_nbuf_next(buf);
  1802. }
  1803. #ifdef IPA_OFFLOAD
  1804. /**
  1805. * qdf_nbuf_smmu_map_debug() - map smmu buffer
  1806. * @nbuf: network buffer
  1807. * @hdl: ipa handle
  1808. * @num_buffers: number of buffers
  1809. * @info: memory info
  1810. * @func: function name
  1811. * @line: line number
  1812. *
  1813. * Return: QDF_STATUS
  1814. */
  1815. QDF_STATUS qdf_nbuf_smmu_map_debug(qdf_nbuf_t nbuf,
  1816. uint8_t hdl,
  1817. uint8_t num_buffers,
  1818. qdf_mem_info_t *info,
  1819. const char *func,
  1820. uint32_t line);
  1821. /**
  1822. * qdf_nbuf_smmu_unmap_debug() - unmap smmu buffer
  1823. * @nbuf: network buffer
  1824. * @hdl: ipa handle
  1825. * @num_buffers: number of buffers
  1826. * @info: memory info
  1827. * @func: function name
  1828. * @line: line number
  1829. *
  1830. * Return: QDF_STATUS
  1831. */
  1832. QDF_STATUS qdf_nbuf_smmu_unmap_debug(qdf_nbuf_t nbuf,
  1833. uint8_t hdl,
  1834. uint8_t num_buffers,
  1835. qdf_mem_info_t *info,
  1836. const char *func,
  1837. uint32_t line);
  1838. #endif /* IPA_OFFLOAD */
  1839. #ifdef NBUF_MEMORY_DEBUG
  1840. #define QDF_NET_BUF_TRACK_MAX_SIZE (1024)
  1841. enum qdf_nbuf_event_type {
  1842. QDF_NBUF_ALLOC,
  1843. QDF_NBUF_ALLOC_CLONE,
  1844. QDF_NBUF_ALLOC_COPY,
  1845. QDF_NBUF_ALLOC_FAILURE,
  1846. QDF_NBUF_FREE,
  1847. QDF_NBUF_MAP,
  1848. QDF_NBUF_UNMAP,
  1849. QDF_NBUF_ALLOC_COPY_EXPAND,
  1850. QDF_NBUF_SMMU_MAP,
  1851. QDF_NBUF_SMMU_UNMAP,
  1852. };
  1853. void qdf_net_buf_debug_init(void);
  1854. void qdf_net_buf_debug_exit(void);
  1855. void qdf_net_buf_debug_clean(void);
  1856. void qdf_nbuf_history_add(qdf_nbuf_t nbuf, const char *func, uint32_t line,
  1857. enum qdf_nbuf_event_type type);
  1858. void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
  1859. const char *func_name, uint32_t line_num);
  1860. /**
  1861. * qdf_net_buf_debug_update_node() - update nbuf in debug hash table
  1862. *
  1863. * Return: none
  1864. */
  1865. void qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name,
  1866. uint32_t line_num);
  1867. void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
  1868. /**
  1869. * qdf_net_buf_debug_update_map_node() - update nbuf in debug
  1870. * hash table with the mapping function info
  1871. * @nbuf: network buffer
  1872. * @func: function name that requests for mapping the nbuf
  1873. * @line_num: function line number
  1874. *
  1875. * Return: none
  1876. */
  1877. void qdf_net_buf_debug_update_map_node(qdf_nbuf_t net_buf,
  1878. const char *func_name,
  1879. uint32_t line_num);
  1880. #ifdef NBUF_SMMU_MAP_UNMAP_DEBUG
  1881. /**
  1882. * qdf_nbuf_map_check_for_smmu_leaks() - check for nbuf smmu map leaks
  1883. *
  1884. * Check for net buffers that have been smmu mapped, but never smmu unmapped.
  1885. *
  1886. * Returns: None
  1887. */
  1888. void qdf_nbuf_map_check_for_smmu_leaks(void);
  1889. /**
  1890. * qdf_net_buf_debug_update_smmu_map_node() - update nbuf in debug
  1891. * hash table with the mapping function info
  1892. * @nbuf: network buffer
  1893. * @iova: Virtual address of buffer
  1894. * @pa: Physical address of buffer
  1895. * @func: function name that requests for mapping the nbuf
  1896. * @line: function line number
  1897. *
  1898. * Return: none
  1899. */
  1900. void qdf_net_buf_debug_update_smmu_map_node(qdf_nbuf_t nbuf,
  1901. unsigned long iova,
  1902. unsigned long pa,
  1903. const char *func,
  1904. uint32_t line);
  1905. /**
  1906. * qdf_net_buf_debug_update_smmu_unmap_node() - update nbuf in debug
  1907. * hash table with the unmapping function info
  1908. * @nbuf: network buffer
  1909. * @iova: Virtual address of buffer
  1910. * @pa: Physical address of buffer
  1911. * @func: function name that requests for unmapping the nbuf
  1912. * @line: function line number
  1913. *
  1914. * Return: none
  1915. */
  1916. void qdf_net_buf_debug_update_smmu_unmap_node(qdf_nbuf_t nbuf,
  1917. unsigned long iova,
  1918. unsigned long pa,
  1919. const char *func,
  1920. uint32_t line);
  1921. #endif /* NBUF_SMMU_MAP_UNMAP_DEBUG */
  1922. /**
  1923. * qdf_net_buf_debug_update_unmap_node() - update nbuf in debug
  1924. * hash table with the unmap function info
  1925. * @nbuf: network buffer
  1926. * @func: function name that requests for unmapping the nbuf
  1927. * @line_num: function line number
  1928. *
  1929. * Return: none
  1930. */
  1931. void qdf_net_buf_debug_update_unmap_node(qdf_nbuf_t net_buf,
  1932. const char *func_name,
  1933. uint32_t line_num);
  1934. /**
  1935. * qdf_net_buf_debug_acquire_skb() - acquire skb to avoid memory leak
  1936. * @net_buf: Network buf holding head segment (single)
  1937. * @func_name: pointer to function name
  1938. * @line_num: line number
  1939. *
  1940. * WLAN driver module's SKB which are allocated by network stack are
  1941. * suppose to call this API before freeing it such that the SKB
  1942. * is not reported as memory leak.
  1943. *
  1944. * Return: none
  1945. */
  1946. void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  1947. const char *func_name,
  1948. uint32_t line_num);
  1949. void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
  1950. /* nbuf allocation routines */
  1951. #define qdf_nbuf_alloc_simple(d, s, r, a, p) \
  1952. __qdf_nbuf_alloc_simple(d, s, __func__, __LINE__)
  1953. #define qdf_nbuf_alloc(d, s, r, a, p) \
  1954. qdf_nbuf_alloc_debug(d, s, r, a, p, __func__, __LINE__)
  1955. qdf_nbuf_t qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size,
  1956. int reserve, int align, int prio,
  1957. const char *func, uint32_t line);
  1958. /**
  1959. * qdf_nbuf_alloc_no_recycler() - Allocates skb
  1960. * @size: Size to be allocated for skb
  1961. * @reserve: Reserved headroom size
  1962. * @align: Align
  1963. * @func: Function name of the call site
  1964. * @line: Line number of the callsite
  1965. *
  1966. * This API allocates skb of required size and aligns if needed and reserves
  1967. * some space in the front. This skb allocation is not from skb recycler pool.
  1968. *
  1969. * Return: Allocated nbuf pointer
  1970. */
  1971. #define qdf_nbuf_alloc_no_recycler(s, r, a) \
  1972. qdf_nbuf_alloc_no_recycler_debug(s, r, a, __func__, __LINE__)
  1973. qdf_nbuf_t qdf_nbuf_alloc_no_recycler_debug(size_t size, int reserve, int align,
  1974. const char *func, uint32_t line);
  1975. #define qdf_nbuf_free(d) \
  1976. qdf_nbuf_free_debug(d, __func__, __LINE__)
  1977. void qdf_nbuf_free_debug(qdf_nbuf_t nbuf, const char *func, uint32_t line);
  1978. #define qdf_nbuf_free_simple(d) \
  1979. qdf_nbuf_free_debug_simple(d, __func__, __LINE__)
  1980. void qdf_nbuf_free_debug_simple(qdf_nbuf_t nbuf, const char *func,
  1981. uint32_t line);
  1982. #define qdf_nbuf_clone(buf) \
  1983. qdf_nbuf_clone_debug(buf, __func__, __LINE__)
  1984. /**
  1985. * qdf_nbuf_clone_debug() - clone the nbuf (copy is readonly)
  1986. * @buf: nbuf to clone from
  1987. * @func: name of the calling function
  1988. * @line: line number of the callsite
  1989. *
  1990. * This function clones the nbuf and creates a memory tracking
  1991. * node corresponding to that cloned skbuff structure.
  1992. *
  1993. * Return: cloned buffer
  1994. */
  1995. qdf_nbuf_t qdf_nbuf_clone_debug(qdf_nbuf_t buf, const char *func,
  1996. uint32_t line);
  1997. #define qdf_nbuf_copy(buf) \
  1998. qdf_nbuf_copy_debug(buf, __func__, __LINE__)
  1999. /**
  2000. * qdf_nbuf_copy_debug() - returns a private copy of the buf
  2001. * @buf: nbuf to copy from
  2002. * @func: name of the calling function
  2003. * @line: line number of the callsite
  2004. *
  2005. * This API returns a private copy of the buf, the buf returned is completely
  2006. * modifiable by callers. It also creates a memory tracking node corresponding
  2007. * to that new skbuff structure.
  2008. *
  2009. * Return: copied buffer
  2010. */
  2011. qdf_nbuf_t qdf_nbuf_copy_debug(qdf_nbuf_t buf, const char *func, uint32_t line);
  2012. #define qdf_nbuf_copy_expand(buf, headroom, tailroom) \
  2013. qdf_nbuf_copy_expand_debug(buf, headroom, tailroom, __func__, __LINE__)
  2014. /**
  2015. * qdf_nbuf_copy_expand_debug() - copy and expand nbuf
  2016. * @buf: Network buf instance
  2017. * @headroom: Additional headroom to be added
  2018. * @tailroom: Additional tailroom to be added
  2019. * @func: name of the calling function
  2020. * @line: line number of the callsite
  2021. *
  2022. * Return: New nbuf that is a copy of buf, with additional head and tailroom
  2023. * or NULL if there is no memory
  2024. */
  2025. qdf_nbuf_t
  2026. qdf_nbuf_copy_expand_debug(qdf_nbuf_t buf, int headroom, int tailroom,
  2027. const char *func, uint32_t line);
  2028. /**
  2029. * qdf_nbuf_unshare() - make a copy of the shared nbuf
  2030. * @buf: Network buf instance
  2031. *
  2032. * Return: New nbuf which is a copy of the received nbuf if it is cloned,
  2033. * else, return the original nbuf
  2034. */
  2035. #define qdf_nbuf_unshare(d) \
  2036. qdf_nbuf_unshare_debug(d, __func__, __LINE__)
  2037. qdf_nbuf_t
  2038. qdf_nbuf_unshare_debug(qdf_nbuf_t buf, const char *func_name,
  2039. uint32_t line_num);
  2040. /**
  2041. * qdf_nbuf_kfree_list() - Free nbuf list using kfree
  2042. * @buf: Pointer to network buffer head
  2043. *
  2044. * This function is called to free the nbuf list on failure cases
  2045. *
  2046. * Return: None
  2047. */
  2048. #define qdf_nbuf_dev_kfree_list(d) \
  2049. qdf_nbuf_dev_kfree_list_debug(d, __func__, __LINE__)
  2050. void
  2051. qdf_nbuf_dev_kfree_list_debug(qdf_nbuf_queue_head_t *nbuf_queue_head,
  2052. const char *func_name,
  2053. uint32_t line_num);
  2054. #else /* NBUF_MEMORY_DEBUG */
  2055. static inline void qdf_net_buf_debug_init(void) {}
  2056. static inline void qdf_net_buf_debug_exit(void) {}
  2057. static inline void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  2058. const char *func_name,
  2059. uint32_t line_num)
  2060. {
  2061. }
  2062. static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
  2063. {
  2064. }
  2065. static inline void
  2066. qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name,
  2067. uint32_t line_num)
  2068. {
  2069. }
  2070. static inline void
  2071. qdf_net_buf_debug_update_map_node(qdf_nbuf_t net_buf,
  2072. const char *func_name,
  2073. uint32_t line_num)
  2074. {
  2075. }
  2076. static inline void
  2077. qdf_net_buf_debug_update_unmap_node(qdf_nbuf_t net_buf,
  2078. const char *func_name,
  2079. uint32_t line_num)
  2080. {
  2081. }
  2082. /* Nbuf allocation routines */
  2083. #define qdf_nbuf_alloc_simple(osdev, size, reserve, align, prio) \
  2084. qdf_nbuf_alloc_fl(osdev, size, reserve, align, prio, \
  2085. __func__, __LINE__)
  2086. #define qdf_nbuf_alloc(osdev, size, reserve, align, prio) \
  2087. qdf_nbuf_alloc_fl(osdev, size, reserve, align, prio, \
  2088. __func__, __LINE__)
  2089. #define qdf_nbuf_alloc_no_recycler(size, reserve, align) \
  2090. qdf_nbuf_alloc_no_recycler_fl(size, reserve, align, __func__, __LINE__)
  2091. static inline qdf_nbuf_t
  2092. qdf_nbuf_alloc_fl(qdf_device_t osdev, qdf_size_t size, int reserve, int align,
  2093. int prio, const char *func, uint32_t line)
  2094. {
  2095. return __qdf_nbuf_alloc(osdev, size, reserve, align, prio, func, line);
  2096. }
  2097. /**
  2098. * qdf_nbuf_alloc_no_recycler_fl() - Allocate SKB
  2099. * @size: Size to be allocated for skb
  2100. * @reserve: Reserved headroom size
  2101. * @align: Align
  2102. * @func: Function name of the call site
  2103. * @line: Line number of the callsite
  2104. *
  2105. * This API allocates skb of required size and aligns if needed and reserves
  2106. * some space in the front. This skb allocation is not from skb recycler pool.
  2107. *
  2108. * Return: Allocated nbuf pointer
  2109. */
  2110. static inline qdf_nbuf_t
  2111. qdf_nbuf_alloc_no_recycler_fl(size_t size, int reserve, int align,
  2112. const char *func, uint32_t line)
  2113. {
  2114. return __qdf_nbuf_alloc_no_recycler(size, reserve, align, func, line);
  2115. }
  2116. #define qdf_nbuf_free_simple(d) qdf_nbuf_free(d)
  2117. static inline void qdf_nbuf_free(qdf_nbuf_t buf)
  2118. {
  2119. if (qdf_likely(buf))
  2120. __qdf_nbuf_free(buf);
  2121. }
  2122. /**
  2123. * qdf_nbuf_clone() - clone the nbuf (copy is readonly)
  2124. * @buf: Pointer to network buffer
  2125. *
  2126. * This function clones the nbuf and returns new sk_buff
  2127. * structure.
  2128. *
  2129. * Return: cloned skb
  2130. */
  2131. static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf)
  2132. {
  2133. return __qdf_nbuf_clone(buf);
  2134. }
  2135. /**
  2136. * qdf_nbuf_copy() - returns a private copy of the buf
  2137. * @buf: Pointer to network buffer
  2138. *
  2139. * This API returns a private copy of the buf, the buf returned is completely
  2140. * modifiable by callers
  2141. *
  2142. * Return: skb or NULL
  2143. */
  2144. static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf)
  2145. {
  2146. return __qdf_nbuf_copy(buf);
  2147. }
  2148. /**
  2149. * qdf_nbuf_copy_expand() - copy and expand nbuf
  2150. * @buf: Network buf instance
  2151. * @headroom: Additional headroom to be added
  2152. * @tailroom: Additional tailroom to be added
  2153. *
  2154. * Return: New nbuf that is a copy of buf, with additional head and tailroom
  2155. * or NULL if there is no memory
  2156. */
  2157. static inline qdf_nbuf_t qdf_nbuf_copy_expand(qdf_nbuf_t buf, int headroom,
  2158. int tailroom)
  2159. {
  2160. return __qdf_nbuf_copy_expand(buf, headroom, tailroom);
  2161. }
  2162. static inline qdf_nbuf_t qdf_nbuf_unshare(qdf_nbuf_t buf)
  2163. {
  2164. return __qdf_nbuf_unshare(buf);
  2165. }
  2166. /**
  2167. * qdf_nbuf_kfree_list() - Free nbuf list using kfree
  2168. * @buf: Pointer to network buffer head
  2169. *
  2170. * This function is called to free the nbuf list on failure cases
  2171. *
  2172. * Return: None
  2173. */
  2174. static inline void
  2175. qdf_nbuf_dev_kfree_list(qdf_nbuf_queue_head_t *nbuf_queue_head)
  2176. {
  2177. __qdf_nbuf_dev_kfree_list(nbuf_queue_head);
  2178. }
  2179. #endif /* NBUF_MEMORY_DEBUG */
  2180. #if defined(QCA_DP_NBUF_FAST_PPEDS)
  2181. #define qdf_nbuf_alloc_ppe_ds(d, s, r, a, p) \
  2182. __qdf_nbuf_alloc_ppe_ds(d, s, __func__, __LINE__)
  2183. #endif /* QCA_DP_NBUF_FAST_PPEDS */
  2184. /**
  2185. * qdf_nbuf_dev_queue_head() - Queue a buffer at the list head
  2186. * @nbuf_queue_head: Pointer to buffer list head
  2187. * @buff: Pointer to network buffer head
  2188. *
  2189. * This function is called to queue a buffer at the list head
  2190. *
  2191. * Return: None
  2192. */
  2193. static inline void
  2194. qdf_nbuf_dev_queue_head(qdf_nbuf_queue_head_t *nbuf_queue_head,
  2195. qdf_nbuf_t buf)
  2196. {
  2197. __qdf_nbuf_dev_queue_head(nbuf_queue_head, buf);
  2198. }
  2199. /**
  2200. * qdf_nbuf_kfree() - Free nbuf using kfree
  2201. * @buf: Pointer to network buffer
  2202. *
  2203. * This function is called to free the skb on failure cases
  2204. *
  2205. * Return: None
  2206. */
  2207. static inline void qdf_nbuf_kfree(qdf_nbuf_t buf)
  2208. {
  2209. __qdf_nbuf_kfree(buf);
  2210. }
  2211. /**
  2212. * qdf_nbuf_dev_kfree() - Free nbuf using dev based os call
  2213. * @buf: Pointer to network buffer
  2214. *
  2215. * This function is called to free the skb on failure cases
  2216. *
  2217. * Return: None
  2218. */
  2219. static inline void qdf_nbuf_dev_kfree(qdf_nbuf_t buf)
  2220. {
  2221. __qdf_nbuf_dev_kfree(buf);
  2222. }
  2223. /**
  2224. * qdf_nbuf_copy_expand_fraglist() - copy and expand nbuf and
  2225. * get reference of the fraglist.
  2226. * @buf: Network buf instance
  2227. * @headroom: Additional headroom to be added
  2228. * @tailroom: Additional tailroom to be added
  2229. *
  2230. * Return: New nbuf that is a copy of buf, with additional head and tailroom
  2231. * or NULL if there is no memory
  2232. */
  2233. static inline qdf_nbuf_t
  2234. qdf_nbuf_copy_expand_fraglist(qdf_nbuf_t buf, int headroom,
  2235. int tailroom)
  2236. {
  2237. buf = qdf_nbuf_copy_expand(buf, headroom, tailroom);
  2238. /* get fraglist reference */
  2239. if (buf)
  2240. __qdf_nbuf_get_ref_fraglist(buf);
  2241. return buf;
  2242. }
  2243. #ifdef WLAN_FEATURE_FASTPATH
  2244. /**
  2245. * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state
  2246. *
  2247. * @buf: buf instance
  2248. * Return: data pointer of this buf where new data has to be
  2249. * put, or NULL if there is not enough room in this buf.
  2250. */
  2251. void qdf_nbuf_init_fast(qdf_nbuf_t nbuf);
  2252. #endif /* WLAN_FEATURE_FASTPATH */
  2253. /**
  2254. * @qdf_nbuf_list_free() - free a list of nbufs
  2255. * @buf_list: A list of nbufs to be freed
  2256. *
  2257. * Return: none
  2258. */
  2259. static inline void qdf_nbuf_list_free(qdf_nbuf_t buf_list)
  2260. {
  2261. while (buf_list) {
  2262. qdf_nbuf_t next = qdf_nbuf_next(buf_list);
  2263. qdf_nbuf_free(buf_list);
  2264. buf_list = next;
  2265. }
  2266. }
  2267. static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err)
  2268. {
  2269. qdf_nbuf_list_free(buf_list);
  2270. }
  2271. static inline void qdf_nbuf_ref(qdf_nbuf_t buf)
  2272. {
  2273. __qdf_nbuf_ref(buf);
  2274. }
  2275. static inline int qdf_nbuf_shared(qdf_nbuf_t buf)
  2276. {
  2277. return __qdf_nbuf_shared(buf);
  2278. }
  2279. static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src)
  2280. {
  2281. return __qdf_nbuf_cat(dst, src);
  2282. }
  2283. /**
  2284. * @qdf_nbuf_copy_bits() - return the length of the copy bits for skb
  2285. * @skb: SKB pointer
  2286. * @offset: offset
  2287. * @len: Length
  2288. * @to: To
  2289. *
  2290. * Return: int32_t
  2291. */
  2292. static inline int32_t
  2293. qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to)
  2294. {
  2295. return __qdf_nbuf_copy_bits(nbuf, offset, len, to);
  2296. }
  2297. /* nbuf manipulation routines */
  2298. /**
  2299. * @qdf_nbuf_head() - return the address of an nbuf's buffer
  2300. * @buf: netbuf
  2301. *
  2302. * Return: head address
  2303. */
  2304. static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf)
  2305. {
  2306. return __qdf_nbuf_head(buf);
  2307. }
  2308. /**
  2309. * qdf_nbuf_data() - Return the address of the start of data within an nbuf
  2310. * @buf: Network buffer
  2311. *
  2312. * Return: Data address
  2313. */
  2314. static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf)
  2315. {
  2316. return __qdf_nbuf_data(buf);
  2317. }
  2318. /**
  2319. * qdf_nbuf_data_addr() - Return the address of skb->data
  2320. * @buf: Network buffer
  2321. *
  2322. * Return: Data address
  2323. */
  2324. static inline uint8_t *qdf_nbuf_data_addr(qdf_nbuf_t buf)
  2325. {
  2326. return __qdf_nbuf_data_addr(buf);
  2327. }
  2328. /**
  2329. * qdf_nbuf_headroom() - amount of headroom int the current nbuf
  2330. * @buf: Network buffer
  2331. *
  2332. * Return: Amount of head room
  2333. */
  2334. static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf)
  2335. {
  2336. return __qdf_nbuf_headroom(buf);
  2337. }
  2338. /**
  2339. * qdf_nbuf_tailroom() - amount of tail space available
  2340. * @buf: Network buffer
  2341. *
  2342. * Return: amount of tail room
  2343. */
  2344. static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf)
  2345. {
  2346. return __qdf_nbuf_tailroom(buf);
  2347. }
  2348. /**
  2349. * qdf_nbuf_push_head() - push data in the front
  2350. * @buf: Network buf instance
  2351. * @size: Size to be pushed
  2352. *
  2353. * Return: New data pointer of this buf after data has been pushed,
  2354. * or NULL if there is not enough room in this buf.
  2355. */
  2356. static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size)
  2357. {
  2358. return __qdf_nbuf_push_head(buf, size);
  2359. }
  2360. /**
  2361. * qdf_nbuf_put_tail() - puts data in the end
  2362. * @buf: Network buf instance
  2363. * @size: Size to be pushed
  2364. *
  2365. * Return: Data pointer of this buf where new data has to be
  2366. * put, or NULL if there is not enough room in this buf.
  2367. */
  2368. static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size)
  2369. {
  2370. return __qdf_nbuf_put_tail(buf, size);
  2371. }
  2372. /**
  2373. * qdf_nbuf_pull_head() - pull data out from the front
  2374. * @buf: Network buf instance
  2375. * @size: Size to be popped
  2376. *
  2377. * Return: New data pointer of this buf after data has been popped,
  2378. * or NULL if there is not sufficient data to pull.
  2379. */
  2380. static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size)
  2381. {
  2382. return __qdf_nbuf_pull_head(buf, size);
  2383. }
  2384. /**
  2385. * qdf_nbuf_trim_tail() - trim data out from the end
  2386. * @buf: Network buf instance
  2387. * @size: Size to be popped
  2388. *
  2389. * Return: none
  2390. */
  2391. static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size)
  2392. {
  2393. __qdf_nbuf_trim_tail(buf, size);
  2394. }
  2395. /**
  2396. * qdf_nbuf_len() - get the length of the buf
  2397. * @buf: Network buf instance
  2398. *
  2399. * Return: total length of this buf.
  2400. */
  2401. static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf)
  2402. {
  2403. return __qdf_nbuf_len(buf);
  2404. }
  2405. /**
  2406. * qdf_nbuf_set_pktlen() - set the length of the buf
  2407. * @buf: Network buf instance
  2408. * @size: Size to be set
  2409. *
  2410. * Return: none
  2411. */
  2412. static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len)
  2413. {
  2414. __qdf_nbuf_set_pktlen(buf, len);
  2415. }
  2416. /**
  2417. * qdf_nbuf_reserve() - trim data out from the end
  2418. * @buf: Network buf instance
  2419. * @size: Size to be popped
  2420. *
  2421. * Return: none
  2422. */
  2423. static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size)
  2424. {
  2425. __qdf_nbuf_reserve(buf, size);
  2426. }
  2427. /**
  2428. * qdf_nbuf_set_data_pointer() - set data pointer
  2429. * @buf: Network buf instance
  2430. * @data: data pointer
  2431. *
  2432. * Return: none
  2433. */
  2434. static inline void qdf_nbuf_set_data_pointer(qdf_nbuf_t buf, uint8_t *data)
  2435. {
  2436. __qdf_nbuf_set_data_pointer(buf, data);
  2437. }
  2438. /**
  2439. * qdf_nbuf_set_len() - set data length
  2440. * @buf: Network buf instance
  2441. * @len: data length
  2442. * Return: none
  2443. */
  2444. static inline void qdf_nbuf_set_len(qdf_nbuf_t buf, uint32_t len)
  2445. {
  2446. __qdf_nbuf_set_len(buf, len);
  2447. }
  2448. /**
  2449. * qdf_nbuf_set_tail_pointer() - set data tail pointer
  2450. * @buf: Network buf instance
  2451. * @len: length of data
  2452. *
  2453. * Return: none
  2454. */
  2455. static inline void qdf_nbuf_set_tail_pointer(qdf_nbuf_t buf, int len)
  2456. {
  2457. __qdf_nbuf_set_tail_pointer(buf, len);
  2458. }
  2459. /**
  2460. * qdf_nbuf_unlink_no_lock() - unlink a nbuf from nbuf list
  2461. * @buf: Network buf instance
  2462. * @list: list to use
  2463. *
  2464. * This is a lockless version, driver must acquire locks if it
  2465. * needs to synchronize
  2466. *
  2467. * Return: none
  2468. */
  2469. static inline void
  2470. qdf_nbuf_unlink_no_lock(qdf_nbuf_t buf, qdf_nbuf_queue_head_t *list)
  2471. {
  2472. __qdf_nbuf_unlink_no_lock(buf, list);
  2473. }
  2474. /**
  2475. * qdf_nbuf_reset() - reset the buffer data and pointer
  2476. * @buf: Network buf instance
  2477. * @reserve: reserve
  2478. * @align: align
  2479. *
  2480. * Return: none
  2481. */
  2482. static inline void qdf_nbuf_reset(qdf_nbuf_t buf, int reserve, int align)
  2483. {
  2484. __qdf_nbuf_reset(buf, reserve, align);
  2485. }
  2486. /**
  2487. * qdf_nbuf_dev_scratch_is_supported() - dev_scratch support for network buffer
  2488. * in kernel
  2489. *
  2490. * Return: true if dev_scratch is supported
  2491. * false if dev_scratch is not supported
  2492. */
  2493. static inline bool qdf_nbuf_is_dev_scratch_supported(void)
  2494. {
  2495. return __qdf_nbuf_is_dev_scratch_supported();
  2496. }
  2497. /**
  2498. * qdf_nbuf_get_dev_scratch() - get dev_scratch of network buffer
  2499. * @buf: Pointer to network buffer
  2500. *
  2501. * Return: dev_scratch if dev_scratch supported
  2502. * 0 if dev_scratch not supported
  2503. */
  2504. static inline unsigned long qdf_nbuf_get_dev_scratch(qdf_nbuf_t buf)
  2505. {
  2506. return __qdf_nbuf_get_dev_scratch(buf);
  2507. }
  2508. /**
  2509. * qdf_nbuf_set_dev_scratch() - set dev_scratch of network buffer
  2510. * @buf: Pointer to network buffer
  2511. * @value: value to be set in dev_scratch of network buffer
  2512. *
  2513. * Return: void
  2514. */
  2515. static inline void qdf_nbuf_set_dev_scratch(qdf_nbuf_t buf, unsigned long value)
  2516. {
  2517. __qdf_nbuf_set_dev_scratch(buf, value);
  2518. }
  2519. /**
  2520. * qdf_nbuf_set_dev() - set dev in network buffer
  2521. * @buf: Pointer to network buffer
  2522. * @dev: netdev to be set in network buffer
  2523. *
  2524. * Return: void
  2525. */
  2526. static inline
  2527. void qdf_nbuf_set_dev(qdf_nbuf_t nbuf, qdf_netdev_t dev)
  2528. {
  2529. __qdf_nbuf_set_dev(nbuf, dev);
  2530. }
  2531. /**
  2532. * qdf_nbuf_get_dev_mtu() - get dev mtu in n/w buffer
  2533. * @buf: Pointer to network buffer
  2534. *
  2535. * Return: dev mtu value in nbuf
  2536. */
  2537. static inline
  2538. unsigned int qdf_nbuf_get_dev_mtu(qdf_nbuf_t nbuf)
  2539. {
  2540. return __qdf_nbuf_get_dev_mtu(nbuf);
  2541. }
  2542. /**
  2543. * qdf_nbuf_set_protocol_eth_tye_trans() - set protocol using eth trans os API
  2544. * @buf: Pointer to network buffer
  2545. *
  2546. * Return: None
  2547. */
  2548. static inline
  2549. void qdf_nbuf_set_protocol_eth_tye_trans(qdf_nbuf_t nbuf)
  2550. {
  2551. __qdf_nbuf_set_protocol_eth_type_trans(nbuf);
  2552. }
  2553. /**
  2554. * qdf_nbuf_peek_header() - return the data pointer & length of the header
  2555. * @buf: Network nbuf
  2556. * @addr: Data pointer
  2557. * @len: Length of the data
  2558. *
  2559. * Return: none
  2560. */
  2561. static inline void
  2562. qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len)
  2563. {
  2564. __qdf_nbuf_peek_header(buf, addr, len);
  2565. }
  2566. /* nbuf queue routines */
  2567. /**
  2568. * qdf_nbuf_queue_init() - initialize buf queue
  2569. * @head: Network buf queue head
  2570. *
  2571. * Return: none
  2572. */
  2573. static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head)
  2574. {
  2575. __qdf_nbuf_queue_init(head);
  2576. }
  2577. /**
  2578. * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue
  2579. * @head: Network buf queue head
  2580. * @buf: Network buf
  2581. *
  2582. * Return: none
  2583. */
  2584. static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  2585. {
  2586. __qdf_nbuf_queue_add(head, buf);
  2587. }
  2588. /**
  2589. * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue
  2590. * @head: Network buf queue head
  2591. * @buf: Network buf
  2592. *
  2593. * Return: none
  2594. */
  2595. static inline void
  2596. qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  2597. {
  2598. __qdf_nbuf_queue_insert_head(head, buf);
  2599. }
  2600. /**
  2601. * qdf_nbuf_queue_remove_last() - remove last nbuf from queue
  2602. * @head: Network buf queue head
  2603. *
  2604. * Return: none
  2605. */
  2606. static inline qdf_nbuf_t qdf_nbuf_queue_remove_last(qdf_nbuf_queue_t *head)
  2607. {
  2608. return __qdf_nbuf_queue_remove_last(head);
  2609. }
  2610. /**
  2611. * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue
  2612. * @head: Network buf queue head
  2613. *
  2614. * Return: The head buf in the buf queue.
  2615. */
  2616. static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head)
  2617. {
  2618. return __qdf_nbuf_queue_remove(head);
  2619. }
  2620. /**
  2621. * qdf_nbuf_queue_len() - get the length of the queue
  2622. * @head: Network buf queue head
  2623. *
  2624. * Return: length of the queue
  2625. */
  2626. static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head)
  2627. {
  2628. return __qdf_nbuf_queue_len(head);
  2629. }
  2630. /**
  2631. * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer
  2632. * @buf: Network buffer
  2633. *
  2634. * Return: next buffer/packet
  2635. */
  2636. static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf)
  2637. {
  2638. return __qdf_nbuf_queue_next(buf);
  2639. }
  2640. /**
  2641. * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty
  2642. * @nbq: Network buf queue handle
  2643. *
  2644. * Return: true if queue is empty
  2645. * false if queue is not empty
  2646. */
  2647. static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq)
  2648. {
  2649. return __qdf_nbuf_is_queue_empty(nbq);
  2650. }
  2651. static inline qdf_nbuf_queue_t *
  2652. qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src)
  2653. {
  2654. return __qdf_nbuf_queue_append(dest, src);
  2655. }
  2656. static inline void
  2657. qdf_nbuf_queue_free(qdf_nbuf_queue_t *head)
  2658. {
  2659. qdf_nbuf_t buf = NULL;
  2660. while ((buf = qdf_nbuf_queue_remove(head)) != NULL)
  2661. qdf_nbuf_free(buf);
  2662. }
  2663. static inline qdf_nbuf_t
  2664. qdf_nbuf_queue_first(qdf_nbuf_queue_t *head)
  2665. {
  2666. return __qdf_nbuf_queue_first(head);
  2667. }
  2668. static inline qdf_nbuf_t
  2669. qdf_nbuf_queue_last(qdf_nbuf_queue_t *head)
  2670. {
  2671. return __qdf_nbuf_queue_last(head);
  2672. }
  2673. /**
  2674. * qdf_nbuf_get_protocol() - return the protocol value of the skb
  2675. * @skb: Pointer to network buffer
  2676. *
  2677. * Return: skb protocol
  2678. */
  2679. static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb)
  2680. {
  2681. return __qdf_nbuf_get_protocol(skb);
  2682. }
  2683. /**
  2684. * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb
  2685. * @skb: Pointer to network buffer
  2686. *
  2687. * Return: skb ip_summed
  2688. */
  2689. static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb)
  2690. {
  2691. return __qdf_nbuf_get_ip_summed(skb);
  2692. }
  2693. /**
  2694. * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb
  2695. * @skb: Pointer to network buffer
  2696. * @ip_summed: ip checksum
  2697. *
  2698. * Return: none
  2699. */
  2700. static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb,
  2701. uint8_t ip_summed)
  2702. {
  2703. __qdf_nbuf_set_ip_summed(skb, ip_summed);
  2704. }
  2705. /**
  2706. * qdf_nbuf_set_next() - add a packet to a linked list
  2707. * @this_buf: Predecessor buffer
  2708. * @next_buf: Successor buffer
  2709. *
  2710. * This function can be used to directly link nbufs, rather than using
  2711. * a separate network buffer queue object.
  2712. *
  2713. * Return: none
  2714. */
  2715. static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  2716. {
  2717. __qdf_nbuf_set_next(this_buf, next_buf);
  2718. }
  2719. /* nbuf extension routines */
  2720. /**
  2721. * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new
  2722. * nbuf
  2723. * @this_buf: predecessor buffer
  2724. * @next_buf: successor buffer
  2725. *
  2726. * This function is used to link up many nbufs containing a single logical
  2727. * packet - not a collection of packets. Do not use for linking the first
  2728. * extension to the head
  2729. *
  2730. * Return: none
  2731. */
  2732. static inline void
  2733. qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  2734. {
  2735. __qdf_nbuf_set_next_ext(this_buf, next_buf);
  2736. }
  2737. /**
  2738. * qdf_nbuf_next_ext() - get the next packet extension in the linked list
  2739. * @buf: Network buffer
  2740. *
  2741. * Return: Next network buffer in the linked list
  2742. */
  2743. static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf)
  2744. {
  2745. return __qdf_nbuf_next_ext(buf);
  2746. }
  2747. /**
  2748. * qdf_nbuf_append_ext_list() - link list of packet extensions to the head
  2749. * segment
  2750. * @head_buf: Network buf holding head segment (single)
  2751. * @ext_list: Network buf list holding linked extensions to the head
  2752. * @ext_len: Total length of all buffers in the extension list
  2753. *
  2754. * This function is used to link up a list of packet extensions (seg1, 2,
  2755. * ...) to the nbuf holding the head segment (seg0)
  2756. *
  2757. * Return: none
  2758. */
  2759. static inline void
  2760. qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list,
  2761. qdf_size_t ext_len)
  2762. {
  2763. __qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len);
  2764. }
  2765. /**
  2766. * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
  2767. * @head_buf: Network buf holding head segment (single)
  2768. *
  2769. * This ext_list is populated when we have Jumbo packet, for example in case of
  2770. * monitor mode amsdu packet reception, and are stiched using frags_list.
  2771. *
  2772. * Return: Network buf list holding linked extensions from head buf.
  2773. */
  2774. static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf)
  2775. {
  2776. return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf);
  2777. }
  2778. /**
  2779. * qdf_nbuf_get_shinfo() - gets the shared info of head buf
  2780. * @head_buf: Network buffer
  2781. *
  2782. * Return: shared info of head buf
  2783. */
  2784. static inline qdf_nbuf_shared_info_t qdf_nbuf_get_shinfo(qdf_nbuf_t head_buf)
  2785. {
  2786. return (qdf_nbuf_shared_info_t)__qdf_nbuf_get_shinfo(head_buf);
  2787. }
  2788. /**
  2789. * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
  2790. * @buf: Network buffer
  2791. *
  2792. * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame
  2793. */
  2794. static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf)
  2795. {
  2796. return __qdf_nbuf_get_tx_cksum(buf);
  2797. }
  2798. /**
  2799. * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to
  2800. * indicate checksum info to the stack.
  2801. * @buf: Network buffer
  2802. * @cksum: Checksum
  2803. *
  2804. * Return: none
  2805. */
  2806. static inline void
  2807. qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum)
  2808. {
  2809. __qdf_nbuf_set_rx_cksum(buf, cksum);
  2810. }
  2811. /**
  2812. * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf
  2813. * @buf: Network buffer
  2814. *
  2815. * Return: TID value
  2816. */
  2817. static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf)
  2818. {
  2819. return __qdf_nbuf_get_tid(buf);
  2820. }
  2821. /**
  2822. * qdf_nbuf_set_tid() - this function sets the TID value in nbuf
  2823. * @buf: Network buffer
  2824. * @tid: TID value
  2825. *
  2826. * Return: none
  2827. */
  2828. static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid)
  2829. {
  2830. __qdf_nbuf_set_tid(buf, tid);
  2831. }
  2832. /**
  2833. * qdf_nbuf_get_exemption_type() - this function extracts the exemption type
  2834. * from nbuf
  2835. * @buf: Network buffer
  2836. *
  2837. * Return: Exemption type
  2838. */
  2839. static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf)
  2840. {
  2841. return __qdf_nbuf_get_exemption_type(buf);
  2842. }
  2843. /**
  2844. * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given
  2845. * offset
  2846. * @buf: Network buffer
  2847. * @proto: Protocol
  2848. *
  2849. * Return: none
  2850. */
  2851. static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto)
  2852. {
  2853. __qdf_nbuf_set_protocol(buf, proto);
  2854. }
  2855. /**
  2856. * qdf_nbuf_trace_get_proto_type() - this function return packet proto type
  2857. * @buf: Network buffer
  2858. *
  2859. * Return: Packet protocol type
  2860. */
  2861. static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf)
  2862. {
  2863. return __qdf_nbuf_trace_get_proto_type(buf);
  2864. }
  2865. /**
  2866. * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback
  2867. * @cb_func_ptr: Callback pointer
  2868. *
  2869. * Return: none
  2870. */
  2871. static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr)
  2872. {
  2873. __qdf_nbuf_reg_trace_cb(cb_func_ptr);
  2874. }
  2875. /**
  2876. * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download
  2877. * @buf: Network buffer
  2878. * @candi: Candidate of parallel download frame
  2879. *
  2880. * This function stores a flag specifying this TX frame is suitable for
  2881. * downloading though a 2nd TX data pipe that is used for short frames for
  2882. * protocols that can accept out-of-order delivery.
  2883. *
  2884. * Return: none
  2885. */
  2886. static inline void
  2887. qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi)
  2888. {
  2889. __qdf_nbuf_set_tx_htt2_frm(buf, candi);
  2890. }
  2891. /**
  2892. * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download
  2893. * @buf: Network buffer
  2894. *
  2895. * This function return whether this TX frame is allow to download though a 2nd
  2896. * TX data pipe or not.
  2897. *
  2898. * Return: none
  2899. */
  2900. static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf)
  2901. {
  2902. return __qdf_nbuf_get_tx_htt2_frm(buf);
  2903. }
  2904. /**
  2905. * qdf_nbuf_get_dhcp_subtype() - get the subtype
  2906. * of DHCP packet.
  2907. * @buf: Pointer to DHCP packet buffer
  2908. *
  2909. * This func. returns the subtype of DHCP packet.
  2910. *
  2911. * Return: subtype of the DHCP packet.
  2912. */
  2913. static inline enum qdf_proto_subtype
  2914. qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf)
  2915. {
  2916. return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf));
  2917. }
  2918. /**
  2919. * qdf_nbuf_data_get_dhcp_subtype() - get the subtype
  2920. * of DHCP packet.
  2921. * @buf: Pointer to DHCP packet data buffer
  2922. *
  2923. * This func. returns the subtype of DHCP packet.
  2924. *
  2925. * Return: subtype of the DHCP packet.
  2926. */
  2927. static inline enum qdf_proto_subtype
  2928. qdf_nbuf_data_get_dhcp_subtype(uint8_t *data)
  2929. {
  2930. return __qdf_nbuf_data_get_dhcp_subtype(data);
  2931. }
  2932. /**
  2933. * qdf_nbuf_get_eapol_subtype() - get the subtype
  2934. * of EAPOL packet.
  2935. * @buf: Pointer to EAPOL packet buffer
  2936. *
  2937. * This func. returns the subtype of EAPOL packet.
  2938. *
  2939. * Return: subtype of the EAPOL packet.
  2940. */
  2941. static inline enum qdf_proto_subtype
  2942. qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf)
  2943. {
  2944. return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf));
  2945. }
  2946. /**
  2947. * qdf_nbuf_data_get_eapol_subtype() - get the subtype
  2948. * of EAPOL packet.
  2949. * @data: Pointer to EAPOL packet data buffer
  2950. *
  2951. * This func. returns the subtype of EAPOL packet.
  2952. *
  2953. * Return: subtype of the EAPOL packet.
  2954. */
  2955. static inline enum qdf_proto_subtype
  2956. qdf_nbuf_data_get_eapol_subtype(uint8_t *data)
  2957. {
  2958. return __qdf_nbuf_data_get_eapol_subtype(data);
  2959. }
  2960. /**
  2961. * qdf_nbuf_get_arp_subtype() - get the subtype
  2962. * of ARP packet.
  2963. * @buf: Pointer to ARP packet buffer
  2964. *
  2965. * This func. returns the subtype of ARP packet.
  2966. *
  2967. * Return: subtype of the ARP packet.
  2968. */
  2969. static inline enum qdf_proto_subtype
  2970. qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf)
  2971. {
  2972. return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf));
  2973. }
  2974. /**
  2975. * qdf_nbuf_data_get_arp_subtype() - get the subtype
  2976. * of ARP packet.
  2977. * @data: Pointer to ARP packet data buffer
  2978. *
  2979. * This func. returns the subtype of ARP packet.
  2980. *
  2981. * Return: subtype of the ARP packet.
  2982. */
  2983. static inline enum qdf_proto_subtype
  2984. qdf_nbuf_data_get_arp_subtype(uint8_t *data)
  2985. {
  2986. return __qdf_nbuf_data_get_arp_subtype(data);
  2987. }
  2988. /**
  2989. * qdf_nbuf_get_icmp_subtype() - get the subtype
  2990. * of IPV4 ICMP packet.
  2991. * @buf: Pointer to IPV4 ICMP packet buffer
  2992. *
  2993. * This func. returns the subtype of ICMP packet.
  2994. *
  2995. * Return: subtype of the ICMP packet.
  2996. */
  2997. static inline enum qdf_proto_subtype
  2998. qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf)
  2999. {
  3000. return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf));
  3001. }
  3002. /**
  3003. * qdf_nbuf_data_get_icmp_subtype() - get the subtype
  3004. * of IPV4 ICMP packet.
  3005. * @data: Pointer to IPV4 ICMP packet data buffer
  3006. *
  3007. * This func. returns the subtype of ICMP packet.
  3008. *
  3009. * Return: subtype of the ICMP packet.
  3010. */
  3011. static inline enum qdf_proto_subtype
  3012. qdf_nbuf_data_get_icmp_subtype(uint8_t *data)
  3013. {
  3014. return __qdf_nbuf_data_get_icmp_subtype(data);
  3015. }
  3016. /**
  3017. * qdf_nbuf_get_icmpv6_subtype() - get the subtype
  3018. * of IPV6 ICMPV6 packet.
  3019. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  3020. *
  3021. * This func. returns the subtype of ICMPV6 packet.
  3022. *
  3023. * Return: subtype of the ICMPV6 packet.
  3024. */
  3025. static inline enum qdf_proto_subtype
  3026. qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf)
  3027. {
  3028. return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf));
  3029. }
  3030. /**
  3031. * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype
  3032. * of IPV6 ICMPV6 packet.
  3033. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  3034. *
  3035. * This func. returns the subtype of ICMPV6 packet.
  3036. *
  3037. * Return: subtype of the ICMPV6 packet.
  3038. */
  3039. static inline enum qdf_proto_subtype
  3040. qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data)
  3041. {
  3042. return __qdf_nbuf_data_get_icmpv6_subtype(data);
  3043. }
  3044. /**
  3045. * qdf_nbuf_is_ipv4_last_fragment() - Check if IPV4 packet is last fragment
  3046. * @nbuf: Network buffer
  3047. *
  3048. * This function check if IPV4 packet is last fragment or not.
  3049. * Caller has to call this function for ipv4 packets only.
  3050. *
  3051. * Return: True if ipv4 packet is last fragment otherwise false
  3052. */
  3053. static inline bool
  3054. qdf_nbuf_is_ipv4_last_fragment(qdf_nbuf_t nbuf)
  3055. {
  3056. return __qdf_nbuf_is_ipv4_last_fragment(nbuf);
  3057. }
  3058. /**
  3059. * qdf_nbuf_data_set_ipv4_tos() - set the TOS field of IPV4 packet.
  3060. *
  3061. * @data: Pointer to IPV4 packet data buffer
  3062. * @tos: TOS value to be set in IPV4 packet
  3063. *
  3064. * This func. set the TOS field of IPV4 packet.
  3065. *
  3066. * Return: None
  3067. */
  3068. static inline void
  3069. qdf_nbuf_data_set_ipv4_tos(uint8_t *data, uint8_t tos)
  3070. {
  3071. __qdf_nbuf_data_set_ipv4_tos(data, tos);
  3072. }
  3073. /**
  3074. * qdf_nbuf_data_get_ipv4_tos() - get the TOS field of IPV4 packet.
  3075. *
  3076. * @data: Pointer to IPV4 packet data buffer
  3077. *
  3078. * This func. returns the TOS field of IPV4 packet.
  3079. *
  3080. * Return: TOS of IPV4 packet.
  3081. */
  3082. static inline uint8_t
  3083. qdf_nbuf_data_get_ipv4_tos(uint8_t *data)
  3084. {
  3085. return __qdf_nbuf_data_get_ipv4_tos(data);
  3086. }
  3087. /**
  3088. * qdf_nbuf_data_get_ipv4_proto() - get the proto type
  3089. * of IPV4 packet.
  3090. * @data: Pointer to IPV4 packet data buffer
  3091. *
  3092. * This func. returns the proto type of IPV4 packet.
  3093. *
  3094. * Return: proto type of IPV4 packet.
  3095. */
  3096. static inline uint8_t
  3097. qdf_nbuf_data_get_ipv4_proto(uint8_t *data)
  3098. {
  3099. return __qdf_nbuf_data_get_ipv4_proto(data);
  3100. }
  3101. /**
  3102. * qdf_nbuf_data_set_ipv6_tc() - set the TC field
  3103. * of IPV6 packet.
  3104. * @data: Pointer to IPV6 packet data buffer
  3105. * @tc: Value to IPV6 packet TC field
  3106. *
  3107. * This func. set the TC field of IPV6 packet.
  3108. *
  3109. * Return: None
  3110. */
  3111. static inline void
  3112. qdf_nbuf_data_set_ipv6_tc(uint8_t *data, uint8_t tc)
  3113. {
  3114. __qdf_nbuf_data_set_ipv6_tc(data, tc);
  3115. }
  3116. /**
  3117. * qdf_nbuf_data_get_ipv6_tc() - get the TC field
  3118. * of IPV6 packet.
  3119. * @data: Pointer to IPV6 packet data buffer
  3120. *
  3121. * This func. returns the TC field of IPV6 packet.
  3122. *
  3123. * Return: Traffic classification field of IPV6 packet.
  3124. */
  3125. static inline uint8_t
  3126. qdf_nbuf_data_get_ipv6_tc(uint8_t *data)
  3127. {
  3128. return __qdf_nbuf_data_get_ipv6_tc(data);
  3129. }
  3130. /**
  3131. * qdf_nbuf_data_get_ipv6_proto() - get the proto type
  3132. * of IPV6 packet.
  3133. * @data: Pointer to IPV6 packet data buffer
  3134. *
  3135. * This func. returns the proto type of IPV6 packet.
  3136. *
  3137. * Return: proto type of IPV6 packet.
  3138. */
  3139. static inline uint8_t
  3140. qdf_nbuf_data_get_ipv6_proto(uint8_t *data)
  3141. {
  3142. return __qdf_nbuf_data_get_ipv6_proto(data);
  3143. }
  3144. /**
  3145. * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  3146. * @buf: buffer
  3147. *
  3148. * This api is for Tx packets.
  3149. *
  3150. * Return: true if packet is ipv4 packet
  3151. */
  3152. static inline
  3153. bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf)
  3154. {
  3155. return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf));
  3156. }
  3157. /**
  3158. * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  3159. * @data: data
  3160. *
  3161. * This api is for Tx packets.
  3162. *
  3163. * Return: true if packet is ipv4 packet
  3164. */
  3165. static inline
  3166. bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data)
  3167. {
  3168. return __qdf_nbuf_data_is_ipv4_pkt(data);
  3169. }
  3170. /**
  3171. * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not
  3172. * @buf: buffer
  3173. *
  3174. * This api is for ipv4 packet.
  3175. *
  3176. * Return: true if packet is DHCP packet
  3177. */
  3178. static inline
  3179. bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf)
  3180. {
  3181. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf));
  3182. }
  3183. /**
  3184. * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet.
  3185. * @data: Pointer to DHCP packet data buffer
  3186. *
  3187. * This func. checks whether it is a DHCP packet or not.
  3188. *
  3189. * Return: true if it is a DHCP packet
  3190. * false if not
  3191. */
  3192. static inline
  3193. bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data)
  3194. {
  3195. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data);
  3196. }
  3197. /**
  3198. * qdf_nbuf_data_is_ipv6_mdsn_pkt() - check if it is MDNS packet.
  3199. * @data: Pointer to packet data buffer
  3200. *
  3201. * This func. checks whether it is a MDNS packet or not.
  3202. *
  3203. * Return: true if it is a MDNS packet, false if not
  3204. */
  3205. static inline
  3206. bool qdf_nbuf_is_ipv6_mdns_pkt(qdf_nbuf_t buf)
  3207. {
  3208. return __qdf_nbuf_data_is_ipv6_mdns_pkt(qdf_nbuf_data(buf));
  3209. }
  3210. /**
  3211. * qdf_nbuf_data_is_ipv6_dhcp_pkt() - check if it is DHCP packet.
  3212. * @data: Pointer to DHCP packet data buffer
  3213. *
  3214. * This func. checks whether it is a DHCP packet or not.
  3215. *
  3216. * Return: true if it is a DHCP packet
  3217. * false if not
  3218. */
  3219. static inline
  3220. bool qdf_nbuf_is_ipv6_dhcp_pkt(qdf_nbuf_t buf)
  3221. {
  3222. return __qdf_nbuf_data_is_ipv6_dhcp_pkt(qdf_nbuf_data(buf));
  3223. }
  3224. /**
  3225. * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not
  3226. * @buf: buffer
  3227. *
  3228. * This api is for ipv4 packet.
  3229. *
  3230. * Return: true if packet is EAPOL packet
  3231. */
  3232. static inline
  3233. bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf)
  3234. {
  3235. return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf));
  3236. }
  3237. /**
  3238. * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet.
  3239. * @data: Pointer to EAPOL packet data buffer
  3240. *
  3241. * This func. checks whether it is a EAPOL packet or not.
  3242. *
  3243. * Return: true if it is a EAPOL packet
  3244. * false if not
  3245. */
  3246. static inline
  3247. bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data)
  3248. {
  3249. return __qdf_nbuf_data_is_ipv4_eapol_pkt(data);
  3250. }
  3251. /**
  3252. * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not
  3253. * @buf: buffer
  3254. *
  3255. * This api is for ipv4 packet.
  3256. *
  3257. * Return: true if packet is WAPI packet
  3258. */
  3259. static inline
  3260. bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf)
  3261. {
  3262. return __qdf_nbuf_is_ipv4_wapi_pkt(buf);
  3263. }
  3264. /**
  3265. * qdf_nbuf_is_ipv4_igmp_pkt() - check if packet is a igmp packet or not
  3266. * @buf: buffer
  3267. *
  3268. * This api is for ipv4 packet.
  3269. *
  3270. * Return: true if packet is igmp packet
  3271. */
  3272. static inline
  3273. bool qdf_nbuf_is_ipv4_igmp_pkt(qdf_nbuf_t buf)
  3274. {
  3275. return __qdf_nbuf_data_is_ipv4_igmp_pkt(qdf_nbuf_data(buf));
  3276. }
  3277. /**
  3278. * qdf_nbuf_is_ipv6_igmp_pkt() - check if packet is a igmp packet or not
  3279. * @buf: buffer
  3280. *
  3281. * This api is for ipv6 packet.
  3282. *
  3283. * Return: true if packet is igmp packet
  3284. */
  3285. static inline
  3286. bool qdf_nbuf_is_ipv6_igmp_pkt(qdf_nbuf_t buf)
  3287. {
  3288. return __qdf_nbuf_data_is_ipv6_igmp_pkt(qdf_nbuf_data(buf));
  3289. }
  3290. /**
  3291. * qdf_nbuf_is_ipv4_igmp_leave_pkt() - check if it is a igmp leave packet or not
  3292. * @buf: buffer
  3293. *
  3294. * This api is for ipv4 packet.
  3295. *
  3296. * Return: true if packet is igmp packet
  3297. */
  3298. static inline
  3299. bool qdf_nbuf_is_ipv4_igmp_leave_pkt(qdf_nbuf_t buf)
  3300. {
  3301. return __qdf_nbuf_is_ipv4_igmp_leave_pkt(buf);
  3302. }
  3303. /**
  3304. * qdf_nbuf_is_ipv6_igmp_leave_pkt() - check if it is a igmp leave packet or not
  3305. * @buf: buffer
  3306. *
  3307. * This api is for ipv6 packet.
  3308. *
  3309. * Return: true if packet is igmp packet
  3310. */
  3311. static inline
  3312. bool qdf_nbuf_is_ipv6_igmp_leave_pkt(qdf_nbuf_t buf)
  3313. {
  3314. return __qdf_nbuf_is_ipv6_igmp_leave_pkt(buf);
  3315. }
  3316. /**
  3317. * qdf_nbuf_is_ipv4_tdls_pkt() - check if packet is a tdls packet or not
  3318. * @buf: buffer
  3319. *
  3320. * This api is for ipv4 packet.
  3321. *
  3322. * Return: true if packet is TDLS packet
  3323. */
  3324. static inline
  3325. bool qdf_nbuf_is_ipv4_tdls_pkt(qdf_nbuf_t buf)
  3326. {
  3327. return __qdf_nbuf_is_ipv4_tdls_pkt(buf);
  3328. }
  3329. /**
  3330. * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not
  3331. * @buf: buffer
  3332. *
  3333. * This api is for ipv4 packet.
  3334. *
  3335. * Return: true if packet is ARP packet
  3336. */
  3337. static inline
  3338. bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf)
  3339. {
  3340. return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf));
  3341. }
  3342. /**
  3343. * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet.
  3344. * @data: Pointer to ARP packet data buffer
  3345. *
  3346. * This func. checks whether it is a ARP packet or not.
  3347. *
  3348. * Return: TRUE if it is a ARP packet
  3349. * FALSE if not
  3350. */
  3351. static inline
  3352. bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data)
  3353. {
  3354. return __qdf_nbuf_data_is_ipv4_arp_pkt(data);
  3355. }
  3356. /**
  3357. * qdf_nbuf_data_is_arp_req() - check if ARP packet is request.
  3358. * @buf: buffer
  3359. *
  3360. * This func. checks whether it is a ARP request or not.
  3361. *
  3362. * Return: true if it is a ARP request or FALSE if not
  3363. */
  3364. static inline
  3365. bool qdf_nbuf_data_is_arp_req(qdf_nbuf_t buf)
  3366. {
  3367. return __qdf_nbuf_data_is_arp_req(qdf_nbuf_data(buf));
  3368. }
  3369. /**
  3370. * qdf_nbuf_data_is_arp_rsp() - check if ARP packet is response.
  3371. * @buf: buffer
  3372. *
  3373. * This func. checks whether it is a ARP response or not.
  3374. *
  3375. * Return: true if it is a ARP response or FALSE if not
  3376. */
  3377. static inline
  3378. bool qdf_nbuf_data_is_arp_rsp(qdf_nbuf_t buf)
  3379. {
  3380. return __qdf_nbuf_data_is_arp_rsp(qdf_nbuf_data(buf));
  3381. }
  3382. /**
  3383. * qdf_nbuf_data_get_arp_src_ip() - get ARP packet source IP gateway.
  3384. * @buf: buffer
  3385. *
  3386. * Return: ARP packet source IP value.
  3387. */
  3388. static inline
  3389. uint32_t qdf_nbuf_get_arp_src_ip(qdf_nbuf_t buf)
  3390. {
  3391. return __qdf_nbuf_get_arp_src_ip(qdf_nbuf_data(buf));
  3392. }
  3393. /**
  3394. * qdf_nbuf_data_get_arp_tgt_ip() - get ARP packet target IP gateway.
  3395. * @buf: buffer
  3396. *
  3397. * Return: ARP packet target IP value.
  3398. */
  3399. static inline
  3400. uint32_t qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_t buf)
  3401. {
  3402. return __qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_data(buf));
  3403. }
  3404. /**
  3405. * qdf_nbuf_get_dns_domain_name() - get dns domain name of required length
  3406. * @buf: buffer
  3407. * @len: length to copy
  3408. *
  3409. * Return: dns domain name
  3410. */
  3411. static inline
  3412. uint8_t *qdf_nbuf_get_dns_domain_name(qdf_nbuf_t buf, uint32_t len)
  3413. {
  3414. return __qdf_nbuf_get_dns_domain_name(qdf_nbuf_data(buf), len);
  3415. }
  3416. /**
  3417. * qdf_nbuf_data_is_dns_query() - check if skb data is a dns query
  3418. * @buf: buffer
  3419. *
  3420. * Return: true if packet is dns query packet.
  3421. * false otherwise.
  3422. */
  3423. static inline
  3424. bool qdf_nbuf_data_is_dns_query(qdf_nbuf_t buf)
  3425. {
  3426. return __qdf_nbuf_data_is_dns_query(qdf_nbuf_data(buf));
  3427. }
  3428. /**
  3429. * qdf_nbuf_data_is_dns_response() - check if skb data is a dns response
  3430. * @buf: buffer
  3431. *
  3432. * Return: true if packet is dns response packet.
  3433. * false otherwise.
  3434. */
  3435. static inline
  3436. bool qdf_nbuf_data_is_dns_response(qdf_nbuf_t buf)
  3437. {
  3438. return __qdf_nbuf_data_is_dns_response(qdf_nbuf_data(buf));
  3439. }
  3440. /**
  3441. * qdf_nbuf_data_is_tcp_fin() - check if skb data is a tcp fin
  3442. * @buf: buffer
  3443. *
  3444. * Return: true if packet is tcp fin packet.
  3445. * false otherwise.
  3446. */
  3447. static inline
  3448. bool qdf_nbuf_data_is_tcp_fin(qdf_nbuf_t buf)
  3449. {
  3450. return __qdf_nbuf_data_is_tcp_fin(qdf_nbuf_data(buf));
  3451. }
  3452. /**
  3453. * qdf_nbuf_data_is_tcp_fin_ack() - check if skb data is a tcp fin ack
  3454. * @buf: buffer
  3455. *
  3456. * Return: true if packet is tcp fin ack packet.
  3457. * false otherwise.
  3458. */
  3459. static inline
  3460. bool qdf_nbuf_data_is_tcp_fin_ack(qdf_nbuf_t buf)
  3461. {
  3462. return __qdf_nbuf_data_is_tcp_fin_ack(qdf_nbuf_data(buf));
  3463. }
  3464. /**
  3465. * qdf_nbuf_data_is_tcp_syn() - check if skb data is a tcp syn
  3466. * @buf: buffer
  3467. *
  3468. * Return: true if packet is tcp syn packet.
  3469. * false otherwise.
  3470. */
  3471. static inline
  3472. bool qdf_nbuf_data_is_tcp_syn(qdf_nbuf_t buf)
  3473. {
  3474. return __qdf_nbuf_data_is_tcp_syn(qdf_nbuf_data(buf));
  3475. }
  3476. /**
  3477. * qdf_nbuf_data_is_tcp_syn_ack() - check if skb data is a tcp syn ack
  3478. * @buf: buffer
  3479. *
  3480. * Return: true if packet is tcp syn ack packet.
  3481. * false otherwise.
  3482. */
  3483. static inline
  3484. bool qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_t buf)
  3485. {
  3486. return __qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_data(buf));
  3487. }
  3488. /**
  3489. * qdf_nbuf_data_is_tcp_rst() - check if skb data is a tcp rst
  3490. * @buf: buffer
  3491. *
  3492. * Return: true if packet is tcp rst packet.
  3493. * false otherwise.
  3494. */
  3495. static inline
  3496. bool qdf_nbuf_data_is_tcp_rst(qdf_nbuf_t buf)
  3497. {
  3498. return __qdf_nbuf_data_is_tcp_rst(qdf_nbuf_data(buf));
  3499. }
  3500. /**
  3501. * qdf_nbuf_data_is_tcp_ack() - check if skb data is a tcp ack
  3502. * @buf: buffer
  3503. *
  3504. * Return: true if packet is tcp ack packet.
  3505. * false otherwise.
  3506. */
  3507. static inline
  3508. bool qdf_nbuf_data_is_tcp_ack(qdf_nbuf_t buf)
  3509. {
  3510. return __qdf_nbuf_data_is_tcp_ack(qdf_nbuf_data(buf));
  3511. }
  3512. /**
  3513. * qdf_nbuf_data_get_tcp_src_port() - get tcp src port
  3514. * @buf: buffer
  3515. *
  3516. * Return: tcp source port value.
  3517. */
  3518. static inline
  3519. uint16_t qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_t buf)
  3520. {
  3521. return __qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_data(buf));
  3522. }
  3523. /**
  3524. * qdf_nbuf_data_get_tcp_dst_port() - get tcp dst port
  3525. * @buf: buffer
  3526. *
  3527. * Return: tcp destination port value.
  3528. */
  3529. static inline
  3530. uint16_t qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_t buf)
  3531. {
  3532. return __qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_data(buf));
  3533. }
  3534. /**
  3535. * qdf_nbuf_data_is_icmpv4_req() - check if ICMPv4 packet is request.
  3536. * @buf: buffer
  3537. *
  3538. * This func. checks whether it is a ICMPv4 request or not.
  3539. *
  3540. * Return: true if it is a ICMPv4 request or fALSE if not
  3541. */
  3542. static inline
  3543. bool qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_t buf)
  3544. {
  3545. return __qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_data(buf));
  3546. }
  3547. /**
  3548. * qdf_nbuf_data_is_icmpv4_rsp() - check if ICMPv4 packet is res
  3549. * @buf: buffer
  3550. *
  3551. * Return: true if packet is icmpv4 response
  3552. * false otherwise.
  3553. */
  3554. static inline
  3555. bool qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_t buf)
  3556. {
  3557. return __qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_data(buf));
  3558. }
  3559. static inline
  3560. bool qdf_nbuf_is_icmpv4_redirect(qdf_nbuf_t buf)
  3561. {
  3562. return __qdf_nbuf_data_is_icmpv4_redirect(qdf_nbuf_data(buf));
  3563. }
  3564. /**
  3565. * qdf_nbuf_get_icmpv4_src_ip() - get icmpv4 src IP
  3566. * @buf: buffer
  3567. *
  3568. * Return: icmpv4 packet source IP value.
  3569. */
  3570. static inline
  3571. uint32_t qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_t buf)
  3572. {
  3573. return __qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_data(buf));
  3574. }
  3575. /**
  3576. * qdf_nbuf_data_get_icmpv4_tgt_ip() - get icmpv4 target IP
  3577. * @buf: buffer
  3578. *
  3579. * Return: icmpv4 packet target IP value.
  3580. */
  3581. static inline
  3582. uint32_t qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_t buf)
  3583. {
  3584. return __qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_data(buf));
  3585. }
  3586. /**
  3587. * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet.
  3588. * @buf: Pointer to IPV6 packet buffer
  3589. *
  3590. * This func. checks whether it is a IPV6 packet or not.
  3591. *
  3592. * Return: TRUE if it is a IPV6 packet
  3593. * FALSE if not
  3594. */
  3595. static inline
  3596. bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf)
  3597. {
  3598. return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf));
  3599. }
  3600. static inline
  3601. bool qdf_nbuf_is_icmpv6_redirect(qdf_nbuf_t buf)
  3602. {
  3603. return __qdf_nbuf_data_is_icmpv6_redirect(qdf_nbuf_data(buf));
  3604. }
  3605. /**
  3606. * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet.
  3607. * @data: Pointer to IPV6 packet data buffer
  3608. *
  3609. * This func. checks whether it is a IPV6 packet or not.
  3610. *
  3611. * Return: TRUE if it is a IPV6 packet
  3612. * FALSE if not
  3613. */
  3614. static inline
  3615. bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data)
  3616. {
  3617. return __qdf_nbuf_data_is_ipv6_pkt(data);
  3618. }
  3619. /**
  3620. * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet.
  3621. * @data: Pointer to IPV4 packet data buffer
  3622. *
  3623. * This func. checks whether it is a IPV4 multicast packet or not.
  3624. *
  3625. * Return: TRUE if it is a IPV4 multicast packet
  3626. * FALSE if not
  3627. */
  3628. static inline
  3629. bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data)
  3630. {
  3631. return __qdf_nbuf_data_is_ipv4_mcast_pkt(data);
  3632. }
  3633. /**
  3634. * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet.
  3635. * @data: Pointer to IPV6 packet data buffer
  3636. *
  3637. * This func. checks whether it is a IPV6 multicast packet or not.
  3638. *
  3639. * Return: TRUE if it is a IPV6 multicast packet
  3640. * FALSE if not
  3641. */
  3642. static inline
  3643. bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data)
  3644. {
  3645. return __qdf_nbuf_data_is_ipv6_mcast_pkt(data);
  3646. }
  3647. /**
  3648. * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  3649. * @buf: Pointer to IPV4 ICMP packet buffer
  3650. *
  3651. * This func. checks whether it is a ICMP packet or not.
  3652. *
  3653. * Return: TRUE if it is a ICMP packet
  3654. * FALSE if not
  3655. */
  3656. static inline
  3657. bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf)
  3658. {
  3659. return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf));
  3660. }
  3661. /**
  3662. * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  3663. * @data: Pointer to IPV4 ICMP packet data buffer
  3664. *
  3665. * This func. checks whether it is a ICMP packet or not.
  3666. *
  3667. * Return: TRUE if it is a ICMP packet
  3668. * FALSE if not
  3669. */
  3670. static inline
  3671. bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data)
  3672. {
  3673. return __qdf_nbuf_data_is_icmp_pkt(data);
  3674. }
  3675. /**
  3676. * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  3677. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  3678. *
  3679. * This func. checks whether it is a ICMPV6 packet or not.
  3680. *
  3681. * Return: TRUE if it is a ICMPV6 packet
  3682. * FALSE if not
  3683. */
  3684. static inline
  3685. bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf)
  3686. {
  3687. return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf));
  3688. }
  3689. /**
  3690. * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  3691. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  3692. *
  3693. * This func. checks whether it is a ICMPV6 packet or not.
  3694. *
  3695. * Return: TRUE if it is a ICMPV6 packet
  3696. * FALSE if not
  3697. */
  3698. static inline
  3699. bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data)
  3700. {
  3701. return __qdf_nbuf_data_is_icmpv6_pkt(data);
  3702. }
  3703. /**
  3704. * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  3705. * @buf: Pointer to IPV4 UDP packet buffer
  3706. *
  3707. * This func. checks whether it is a IPV4 UDP packet or not.
  3708. *
  3709. * Return: TRUE if it is a IPV4 UDP packet
  3710. * FALSE if not
  3711. */
  3712. static inline
  3713. bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf)
  3714. {
  3715. return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf));
  3716. }
  3717. /**
  3718. * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  3719. * @data: Pointer to IPV4 UDP packet data buffer
  3720. *
  3721. * This func. checks whether it is a IPV4 UDP packet or not.
  3722. *
  3723. * Return: TRUE if it is a IPV4 UDP packet
  3724. * FALSE if not
  3725. */
  3726. static inline
  3727. bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data)
  3728. {
  3729. return __qdf_nbuf_data_is_ipv4_udp_pkt(data);
  3730. }
  3731. /**
  3732. * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  3733. * @buf: Pointer to IPV4 TCP packet buffer
  3734. *
  3735. * This func. checks whether it is a IPV4 TCP packet or not.
  3736. *
  3737. * Return: TRUE if it is a IPV4 TCP packet
  3738. * FALSE if not
  3739. */
  3740. static inline
  3741. bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf)
  3742. {
  3743. return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf));
  3744. }
  3745. /**
  3746. * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  3747. * @data: Pointer to IPV4 TCP packet data buffer
  3748. *
  3749. * This func. checks whether it is a IPV4 TCP packet or not.
  3750. *
  3751. * Return: TRUE if it is a IPV4 TCP packet
  3752. * FALSE if not
  3753. */
  3754. static inline
  3755. bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data)
  3756. {
  3757. return __qdf_nbuf_data_is_ipv4_tcp_pkt(data);
  3758. }
  3759. /**
  3760. * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  3761. * @buf: Pointer to IPV6 UDP packet buffer
  3762. *
  3763. * This func. checks whether it is a IPV6 UDP packet or not.
  3764. *
  3765. * Return: TRUE if it is a IPV6 UDP packet
  3766. * FALSE if not
  3767. */
  3768. static inline
  3769. bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf)
  3770. {
  3771. return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf));
  3772. }
  3773. /**
  3774. * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  3775. * @data: Pointer to IPV6 UDP packet data buffer
  3776. *
  3777. * This func. checks whether it is a IPV6 UDP packet or not.
  3778. *
  3779. * Return: TRUE if it is a IPV6 UDP packet
  3780. * FALSE if not
  3781. */
  3782. static inline
  3783. bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data)
  3784. {
  3785. return __qdf_nbuf_data_is_ipv6_udp_pkt(data);
  3786. }
  3787. /**
  3788. * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  3789. * @buf: Pointer to IPV6 TCP packet buffer
  3790. *
  3791. * This func. checks whether it is a IPV6 TCP packet or not.
  3792. *
  3793. * Return: TRUE if it is a IPV6 TCP packet
  3794. * FALSE if not
  3795. */
  3796. static inline
  3797. bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf)
  3798. {
  3799. return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf));
  3800. }
  3801. /**
  3802. * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  3803. * @data: Pointer to IPV6 TCP packet data buffer
  3804. *
  3805. * This func. checks whether it is a IPV6 TCP packet or not.
  3806. *
  3807. * Return: TRUE if it is a IPV6 TCP packet
  3808. * FALSE if not
  3809. */
  3810. static inline
  3811. bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data)
  3812. {
  3813. return __qdf_nbuf_data_is_ipv6_tcp_pkt(data);
  3814. }
  3815. /**
  3816. * qdf_nbuf_is_bcast_pkt() - check if it is broadcast packet.
  3817. * @buf: Network buffer
  3818. *
  3819. * This func. checks whether packet is broadcast or not.
  3820. *
  3821. * Return: TRUE if it is broadcast packet
  3822. * FALSE if not
  3823. */
  3824. static inline
  3825. bool qdf_nbuf_is_bcast_pkt(qdf_nbuf_t buf)
  3826. {
  3827. return __qdf_nbuf_is_bcast_pkt(buf);
  3828. }
  3829. /**
  3830. * qdf_nbuf_pkt_type_is_mcast() - check if skb pkt type is mcast
  3831. * @buf: Network buffer
  3832. *
  3833. * Return: TRUE if skb pkt type is mcast
  3834. * FALSE if not
  3835. */
  3836. static inline
  3837. bool qdf_nbuf_pkt_type_is_mcast(qdf_nbuf_t buf)
  3838. {
  3839. return __qdf_nbuf_pkt_type_is_mcast(buf);
  3840. }
  3841. /**
  3842. * qdf_nbuf_pkt_type_is_bcast() - check if skb pkt type is bcast
  3843. * @buf: Network buffer
  3844. *
  3845. * Return: TRUE if skb pkt type is mcast
  3846. * FALSE if not
  3847. */
  3848. static inline
  3849. bool qdf_nbuf_pkt_type_is_bcast(qdf_nbuf_t buf)
  3850. {
  3851. return __qdf_nbuf_pkt_type_is_bcast(buf);
  3852. }
  3853. /**
  3854. * qdf_nbuf_is_mcast_replay() - check if it is multicast replay packet.
  3855. * @buf: Network buffer
  3856. *
  3857. * This func. checks whether packet is multicast replay packet or not.
  3858. *
  3859. * Return: TRUE if it is multicast packet
  3860. * FALSE if not
  3861. */
  3862. static inline
  3863. bool qdf_nbuf_is_mcast_replay(qdf_nbuf_t buf)
  3864. {
  3865. return __qdf_nbuf_is_mcast_replay(buf);
  3866. }
  3867. /**
  3868. * qdf_nbuf_is_arp_local() - check if it is local or no local arp
  3869. * @buf: Network buffer
  3870. *
  3871. * This func. checks whether packet is local or no local arp.
  3872. *
  3873. * Return: TRUE if it is broadcast packet
  3874. * FALSE if not
  3875. */
  3876. static inline
  3877. bool qdf_nbuf_is_arp_local(qdf_nbuf_t buf)
  3878. {
  3879. return __qdf_nbuf_is_arp_local(buf);
  3880. }
  3881. /**
  3882. * qdf_nbuf_reset_num_frags() - decrement the number of fragments
  3883. * @buf: Network buffer
  3884. *
  3885. * Return: Number of fragments
  3886. */
  3887. static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf)
  3888. {
  3889. __qdf_nbuf_reset_num_frags(buf);
  3890. }
  3891. /**
  3892. * qdf_dmaaddr_to_32s - return high and low parts of dma_addr
  3893. *
  3894. * Returns the high and low 32-bits of the DMA addr in the provided ptrs
  3895. *
  3896. * Return: N/A
  3897. */
  3898. static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
  3899. uint32_t *lo, uint32_t *hi)
  3900. {
  3901. return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi);
  3902. }
  3903. /**
  3904. * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO
  3905. * network buffer into segments
  3906. * @nbuf: network buffer to be segmented
  3907. * @tso_info: This is the output. The information about the
  3908. * TSO segments will be populated within this.
  3909. *
  3910. * This function fragments a TCP jumbo packet into smaller
  3911. * segments to be transmitted by the driver. It chains the TSO
  3912. * segments created into a list.
  3913. *
  3914. * Return: number of TSO segments
  3915. */
  3916. static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev,
  3917. qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info)
  3918. {
  3919. return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info);
  3920. }
  3921. /**
  3922. * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element
  3923. *
  3924. * @osdev: qdf device handle
  3925. * @tso_seg: TSO segment element to be unmapped
  3926. * @is_last_seg: whether this is last tso seg or not
  3927. *
  3928. * Return: none
  3929. */
  3930. static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev,
  3931. struct qdf_tso_seg_elem_t *tso_seg,
  3932. bool is_last_seg)
  3933. {
  3934. return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg);
  3935. }
  3936. /**
  3937. * qdf_nbuf_get_tcp_payload_len() - function to return the tso payload len
  3938. * @nbuf: network buffer
  3939. *
  3940. * Return: size of the tso packet
  3941. */
  3942. static inline size_t qdf_nbuf_get_tcp_payload_len(qdf_nbuf_t nbuf)
  3943. {
  3944. return __qdf_nbuf_get_tcp_payload_len(nbuf);
  3945. }
  3946. /**
  3947. * qdf_nbuf_get_tso_num_seg() - function to calculate the number
  3948. * of TCP segments within the TSO jumbo packet
  3949. * @nbuf: TSO jumbo network buffer to be segmented
  3950. *
  3951. * This function calculates the number of TCP segments that the
  3952. network buffer can be divided into.
  3953. *
  3954. * Return: number of TCP segments
  3955. */
  3956. static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf)
  3957. {
  3958. return __qdf_nbuf_get_tso_num_seg(nbuf);
  3959. }
  3960. /**
  3961. * qdf_nbuf_get_gso_segs() - Return the number of gso segments in
  3962. * nbuf
  3963. * @nbuf: Network buffer
  3964. *
  3965. * Return: number of gso segments in nbuf
  3966. */
  3967. static inline uint16_t qdf_nbuf_get_gso_segs(qdf_nbuf_t nbuf)
  3968. {
  3969. return __qdf_nbuf_get_gso_segs(nbuf);
  3970. }
  3971. /**
  3972. * qdf_nbuf_set_gso_segs() - set the number of gso segments in
  3973. * nbuf
  3974. * @nbuf: Network buffer
  3975. * @val: val to be set
  3976. *
  3977. * Return: None
  3978. */
  3979. static inline void qdf_nbuf_set_gso_segs(qdf_nbuf_t nbuf, uint16_t val)
  3980. {
  3981. __qdf_nbuf_set_gso_segs(nbuf, val);
  3982. }
  3983. /**
  3984. * qdf_nbuf_set_gso_type_udp_l4() - set the gso type to GSO UDP L4
  3985. * @nbuf: Network buffer
  3986. *
  3987. * Return: None
  3988. */
  3989. static inline void qdf_nbuf_set_gso_type_udp_l4(qdf_nbuf_t nbuf)
  3990. {
  3991. __qdf_nbuf_set_gso_type_udp_l4(nbuf);
  3992. }
  3993. /**
  3994. * qdf_nbuf_set_ip_summed_partial() - set the ip summed to CHECKSUM_PARTIAL
  3995. * @nbuf: Network buffer
  3996. *
  3997. * Return: None
  3998. */
  3999. static inline void qdf_nbuf_set_ip_summed_partial(qdf_nbuf_t nbuf)
  4000. {
  4001. __qdf_nbuf_set_ip_summed_partial(nbuf);
  4002. }
  4003. /**
  4004. * qdf_nbuf_get_gso_size() - Return the number of gso size in
  4005. * nbuf
  4006. * @nbuf: Network buffer
  4007. *
  4008. * Return: number of gso segments in nbuf
  4009. */
  4010. static inline unsigned int qdf_nbuf_get_gso_size(qdf_nbuf_t nbuf)
  4011. {
  4012. return __qdf_nbuf_get_gso_size(nbuf);
  4013. }
  4014. /**
  4015. * qdf_nbuf_set_gso_size() - Set the gso size in nbuf
  4016. * @skb: Pointer to network buffer
  4017. *
  4018. * Return: Return the number of gso segments
  4019. */
  4020. static inline void qdf_nbuf_set_gso_size(qdf_nbuf_t nbuf, unsigned int val)
  4021. {
  4022. __qdf_nbuf_set_gso_size(nbuf, val);
  4023. }
  4024. /**
  4025. * qdf_nbuf_inc_users() - function to increment the number of
  4026. * users referencing this network buffer
  4027. *
  4028. * @nbuf: network buffer
  4029. *
  4030. * This function increments the number of users referencing this
  4031. * network buffer
  4032. *
  4033. * Return: the network buffer
  4034. */
  4035. static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf)
  4036. {
  4037. return __qdf_nbuf_inc_users(nbuf);
  4038. }
  4039. /**
  4040. * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb
  4041. *
  4042. * @nbuf: Network buffer (skb on linux)
  4043. *
  4044. * This function returns the values of data_attr field
  4045. * in struct cvg_nbuf_cb{}, to which skb->cb is typecast.
  4046. * This value is actually the value programmed in CE descriptor.
  4047. *
  4048. * Return: Value of data_attr
  4049. */
  4050. static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf)
  4051. {
  4052. return __qdf_nbuf_data_attr_get(buf);
  4053. }
  4054. /**
  4055. * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb
  4056. *
  4057. * @nbuf: Network buffer (skb on linux)
  4058. * @data_attr: Value to be stored cvg_nbuf_cb->data_attr
  4059. *
  4060. * This function stores the value to be programmed in CE
  4061. * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{}
  4062. *
  4063. * Return: void
  4064. */
  4065. static inline
  4066. void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr)
  4067. {
  4068. __qdf_nbuf_data_attr_set(buf, data_attr);
  4069. }
  4070. /**
  4071. * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata
  4072. *
  4073. * @nbuf: Network buffer (skb on linux)
  4074. *
  4075. * This function parses the payload to figure out relevant
  4076. * Tx meta-data e.g. whether to enable tx_classify bit
  4077. * in CE.
  4078. *
  4079. * Return: void
  4080. */
  4081. #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get
  4082. void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state);
  4083. void qdf_nbuf_tx_desc_count_display(void);
  4084. void qdf_nbuf_tx_desc_count_clear(void);
  4085. static inline qdf_nbuf_t
  4086. qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom)
  4087. {
  4088. return __qdf_nbuf_realloc_headroom(buf, headroom);
  4089. }
  4090. static inline qdf_nbuf_t
  4091. qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom)
  4092. {
  4093. return __qdf_nbuf_realloc_tailroom(buf, tailroom);
  4094. }
  4095. static inline qdf_nbuf_t
  4096. qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom)
  4097. {
  4098. return __qdf_nbuf_expand(buf, headroom, tailroom);
  4099. }
  4100. static inline int
  4101. qdf_nbuf_linearize(qdf_nbuf_t buf)
  4102. {
  4103. return __qdf_nbuf_linearize(buf);
  4104. }
  4105. static inline bool
  4106. qdf_nbuf_is_cloned(qdf_nbuf_t buf)
  4107. {
  4108. return __qdf_nbuf_is_cloned(buf);
  4109. }
  4110. static inline void
  4111. qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg)
  4112. {
  4113. __qdf_nbuf_frag_info(buf, sg);
  4114. }
  4115. static inline qdf_nbuf_tx_cksum_t
  4116. qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where)
  4117. {
  4118. return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where);
  4119. }
  4120. static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf)
  4121. {
  4122. __qdf_nbuf_reset_ctxt(nbuf);
  4123. }
  4124. static inline void qdf_nbuf_init(qdf_nbuf_t buf)
  4125. {
  4126. __qdf_nbuf_init(buf);
  4127. }
  4128. static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf)
  4129. {
  4130. return __qdf_nbuf_network_header(buf);
  4131. }
  4132. static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf)
  4133. {
  4134. return __qdf_nbuf_transport_header(buf);
  4135. }
  4136. static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf)
  4137. {
  4138. return __qdf_nbuf_tcp_tso_size(buf);
  4139. }
  4140. static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf)
  4141. {
  4142. return __qdf_nbuf_get_cb(nbuf);
  4143. }
  4144. static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf)
  4145. {
  4146. return __qdf_nbuf_get_nr_frags(nbuf);
  4147. }
  4148. static inline uint32_t qdf_nbuf_get_nr_frags_in_fraglist(qdf_nbuf_t nbuf)
  4149. {
  4150. return __qdf_nbuf_get_nr_frags_in_fraglist(nbuf);
  4151. }
  4152. static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf)
  4153. {
  4154. return __qdf_nbuf_headlen(buf);
  4155. }
  4156. static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev,
  4157. qdf_nbuf_t buf, int offset,
  4158. qdf_dma_dir_t dir, int cur_frag)
  4159. {
  4160. return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag);
  4161. }
  4162. static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf)
  4163. {
  4164. return __qdf_nbuf_tso_tcp_v4(buf);
  4165. }
  4166. static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf)
  4167. {
  4168. return __qdf_nbuf_tso_tcp_v6(buf);
  4169. }
  4170. static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf)
  4171. {
  4172. return __qdf_nbuf_tcp_seq(buf);
  4173. }
  4174. static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf)
  4175. {
  4176. return __qdf_nbuf_l2l3l4_hdr_len(buf);
  4177. }
  4178. /**
  4179. * qdf_nbuf_get_tcp_hdr_len() - return TCP header length of the skb
  4180. * @skb: sk buff
  4181. *
  4182. * Return: size of TCP header length
  4183. */
  4184. static inline size_t qdf_nbuf_get_tcp_hdr_len(qdf_nbuf_t nbuf)
  4185. {
  4186. return __qdf_nbuf_get_tcp_hdr_len(nbuf);
  4187. }
  4188. static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf)
  4189. {
  4190. return __qdf_nbuf_is_nonlinear(buf);
  4191. }
  4192. static inline uint32_t
  4193. qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num)
  4194. {
  4195. return __qdf_nbuf_get_frag_size(buf, frag_num);
  4196. }
  4197. static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf)
  4198. {
  4199. return __qdf_nbuf_get_priority(buf);
  4200. }
  4201. static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p)
  4202. {
  4203. __qdf_nbuf_set_priority(buf, p);
  4204. }
  4205. static inline void qdf_nbuf_record_rx_queue(qdf_nbuf_t buf, uint32_t queue_id)
  4206. {
  4207. __qdf_nbuf_record_rx_queue(buf, queue_id);
  4208. }
  4209. static inline uint16_t
  4210. qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf)
  4211. {
  4212. return __qdf_nbuf_get_queue_mapping(buf);
  4213. }
  4214. static inline void
  4215. qdf_nbuf_set_queue_mapping(qdf_nbuf_t buf, uint16_t val)
  4216. {
  4217. __qdf_nbuf_set_queue_mapping(buf, val);
  4218. }
  4219. static inline char *
  4220. qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf)
  4221. {
  4222. return __qdf_nbuf_get_priv_ptr(buf);
  4223. }
  4224. /**
  4225. * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf.
  4226. * @rx_status: rx_status containing required info to update radiotap
  4227. * @nbuf: Pointer to nbuf
  4228. * @headroom_sz: Available headroom size
  4229. *
  4230. * Return: radiotap length.
  4231. */
  4232. unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status,
  4233. qdf_nbuf_t nbuf, uint32_t headroom_sz);
  4234. /**
  4235. * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame.
  4236. * @buf: Pointer to nbuf
  4237. *
  4238. * Return: None
  4239. */
  4240. static inline void
  4241. qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf)
  4242. {
  4243. __qdf_nbuf_mark_wakeup_frame(buf);
  4244. }
  4245. /**
  4246. * qdf_nbuf_reg_free_cb - Registers nbuf free callback
  4247. * @cb_func_ptr: Callback pointer
  4248. *
  4249. * This function registers nbuf free callback
  4250. *
  4251. * Return: void
  4252. */
  4253. static inline void
  4254. qdf_nbuf_reg_free_cb(qdf_nbuf_free_t cb_func_ptr)
  4255. {
  4256. __qdf_nbuf_reg_free_cb(cb_func_ptr);
  4257. }
  4258. /**
  4259. * qdf_nbuf_count_get() - get global nbuf gauge
  4260. *
  4261. * Return: global nbuf gauge
  4262. */
  4263. static inline int qdf_nbuf_count_get(void)
  4264. {
  4265. return __qdf_nbuf_count_get();
  4266. }
  4267. /**
  4268. * qdf_nbuf_count_inc() - increment nbuf global count
  4269. *
  4270. * @buf: sk buff
  4271. *
  4272. * Return: void
  4273. */
  4274. static inline void qdf_nbuf_count_inc(qdf_nbuf_t buf)
  4275. {
  4276. return __qdf_nbuf_count_inc(buf);
  4277. }
  4278. /**
  4279. * qdf_nbuf_count_dec() - decrement nbuf global count
  4280. *
  4281. * @buf: sk buff
  4282. *
  4283. * Return: void
  4284. */
  4285. static inline void qdf_nbuf_count_dec(qdf_nbuf_t buf)
  4286. {
  4287. return __qdf_nbuf_count_dec(buf);
  4288. }
  4289. /**
  4290. * qdf_nbuf_mod_init() - Initialization routine for qdf_nbuf
  4291. *
  4292. * Return void
  4293. */
  4294. static inline void qdf_nbuf_mod_init(void)
  4295. {
  4296. return __qdf_nbuf_mod_init();
  4297. }
  4298. /**
  4299. * qdf_nbuf_mod_init() - Unintialization routine for qdf_nbuf
  4300. *
  4301. * Return void
  4302. */
  4303. static inline void qdf_nbuf_mod_exit(void)
  4304. {
  4305. return __qdf_nbuf_mod_exit();
  4306. }
  4307. /**
  4308. * qdf_nbuf_orphan() - orphan a nbuf
  4309. * @buf: Pointer to network buffer
  4310. *
  4311. * If a buffer currently has an owner then we call the
  4312. * owner's destructor function
  4313. *
  4314. * Return: void
  4315. */
  4316. static inline void qdf_nbuf_orphan(qdf_nbuf_t buf)
  4317. {
  4318. return __qdf_nbuf_orphan(buf);
  4319. }
  4320. /**
  4321. * qdf_nbuf_get_frag_size_by_idx() - Get size of nbuf frag at index idx
  4322. * @nbuf: qdf_nbuf_t
  4323. * @idx: Frag index for which frag size is requested
  4324. *
  4325. * Return: Frag size
  4326. */
  4327. static inline unsigned int qdf_nbuf_get_frag_size_by_idx(qdf_nbuf_t nbuf,
  4328. uint8_t idx)
  4329. {
  4330. return __qdf_nbuf_get_frag_size_by_idx(nbuf, idx);
  4331. }
  4332. /**
  4333. * qdf_nbuf_get_frag_addr() - Get nbuf frag address at index idx
  4334. * @nbuf: qdf_nbuf_t
  4335. * @idx: Frag index for which frag address is requested
  4336. *
  4337. * Return: Frag address
  4338. */
  4339. static inline qdf_frag_t qdf_nbuf_get_frag_addr(qdf_nbuf_t nbuf, uint8_t idx)
  4340. {
  4341. return __qdf_nbuf_get_frag_addr(nbuf, idx);
  4342. }
  4343. /**
  4344. * qdf_nbuf_trim_add_frag_size() - Increase/Decrease frag_size by size
  4345. * @nbuf: qdf_nbuf_t
  4346. * @idx: Frag index
  4347. * @size: Size by which frag_size needs to be increased/decreased
  4348. * +Ve means increase, -Ve means decrease
  4349. * @truesize: truesize
  4350. */
  4351. static inline void qdf_nbuf_trim_add_frag_size(qdf_nbuf_t nbuf, uint8_t idx,
  4352. int size, unsigned int truesize)
  4353. {
  4354. __qdf_nbuf_trim_add_frag_size(nbuf, idx, size, truesize);
  4355. }
  4356. /**
  4357. * qdf_nbuf_set_mark() - Set nbuf mark
  4358. * @nbuf: qdf_nbuf_t
  4359. * @mark: Value to set mark
  4360. *
  4361. * Return: none
  4362. */
  4363. static inline void qdf_nbuf_set_mark(qdf_nbuf_t nbuf, uint32_t mark)
  4364. {
  4365. __qdf_nbuf_set_mark(nbuf, mark);
  4366. }
  4367. /**
  4368. * qdf_nbuf_get_mark() - Get nbuf mark
  4369. * @nbuf: qdf_nbuf_t
  4370. *
  4371. * Return: mark value
  4372. */
  4373. static inline uint32_t qdf_nbuf_get_mark(qdf_nbuf_t nbuf)
  4374. {
  4375. return __qdf_nbuf_get_mark(nbuf);
  4376. }
  4377. /**
  4378. * qdf_nbuf_get_data_len() - Return the size of the nbuf from
  4379. * data pointer to end pointer
  4380. * @nbuf: qdf_nbuf_t
  4381. *
  4382. * Return: size of network buffer from data pointer to end
  4383. * pointer
  4384. */
  4385. static inline qdf_size_t qdf_nbuf_get_data_len(qdf_nbuf_t nbuf)
  4386. {
  4387. return __qdf_nbuf_get_data_len(nbuf);
  4388. }
  4389. /**
  4390. * qdf_nbuf_set_data_len() - Return the data_len of the nbuf
  4391. * @nbuf: qdf_nbuf_t
  4392. * @len: data_len to be set
  4393. *
  4394. * Return: set data_len value
  4395. */
  4396. static inline qdf_size_t qdf_nbuf_set_data_len(qdf_nbuf_t nbuf, uint32_t len)
  4397. {
  4398. return __qdf_nbuf_set_data_len(nbuf, len);
  4399. }
  4400. /**
  4401. * qdf_nbuf_get_only_data_len() - Return the data_len of the nbuf
  4402. * @nbuf: qdf_nbuf_t
  4403. *
  4404. * Return: data_len value
  4405. */
  4406. static inline qdf_size_t qdf_nbuf_get_only_data_len(qdf_nbuf_t nbuf)
  4407. {
  4408. return __qdf_nbuf_get_only_data_len(nbuf);
  4409. }
  4410. /**
  4411. * qdf_nbuf_set_hash() - set the hash of the buf
  4412. * @buf: Network buf instance
  4413. * @len: len to be set
  4414. *
  4415. * Return: none
  4416. */
  4417. static inline void qdf_nbuf_set_hash(qdf_nbuf_t buf, uint32_t len)
  4418. {
  4419. __qdf_nbuf_set_hash(buf, len);
  4420. }
  4421. /**
  4422. * qdf_nbuf_set_sw_hash() - set the sw hash of the buf
  4423. * @buf: Network buf instance
  4424. * @len: len to be set
  4425. *
  4426. * Return: none
  4427. */
  4428. static inline void qdf_nbuf_set_sw_hash(qdf_nbuf_t buf, uint32_t len)
  4429. {
  4430. __qdf_nbuf_set_sw_hash(buf, len);
  4431. }
  4432. /**
  4433. * qdf_nbuf_set_csum_start() - set the csum start of the buf
  4434. * @buf: Network buf instance
  4435. * @len: len to be set
  4436. *
  4437. * Return: none
  4438. */
  4439. static inline void qdf_nbuf_set_csum_start(qdf_nbuf_t buf, uint16_t len)
  4440. {
  4441. __qdf_nbuf_set_csum_start(buf, len);
  4442. }
  4443. /**
  4444. * qdf_nbuf_set_csum_offset() - set the csum offset of the buf
  4445. * @buf: Network buf instance
  4446. * @len: len to be set
  4447. *
  4448. * Return: none
  4449. */
  4450. static inline void qdf_nbuf_set_csum_offset(qdf_nbuf_t buf, uint16_t len)
  4451. {
  4452. __qdf_nbuf_set_csum_offset(buf, len);
  4453. }
  4454. /**
  4455. * qdf_nbuf_get_end_offset() - Return the size of the nbuf from
  4456. * head pointer to end pointer
  4457. * @nbuf: qdf_nbuf_t
  4458. *
  4459. * Return: size of network buffer from head pointer to end
  4460. * pointer
  4461. */
  4462. static inline qdf_size_t qdf_nbuf_get_end_offset(qdf_nbuf_t nbuf)
  4463. {
  4464. return __qdf_nbuf_get_end_offset(nbuf);
  4465. }
  4466. /**
  4467. * qdf_nbuf_get_truesize() - Return the true size of the nbuf
  4468. * including the header and variable data area
  4469. * @nbuf: qdf_nbuf_t
  4470. *
  4471. * Return: size of network buffer
  4472. */
  4473. static inline qdf_size_t qdf_nbuf_get_truesize(qdf_nbuf_t nbuf)
  4474. {
  4475. return __qdf_nbuf_get_truesize(nbuf);
  4476. }
  4477. #ifdef NBUF_FRAG_MEMORY_DEBUG
  4478. #define qdf_nbuf_move_frag_page_offset(f, i, o) \
  4479. qdf_nbuf_move_frag_page_offset_debug(f, i, o, __func__, __LINE__)
  4480. /**
  4481. * qdf_nbuf_move_frag_page_offset_debug() - Move frag page_offset by size
  4482. * and adjust length by size.
  4483. * @nbuf: qdf_nbuf_t
  4484. * @idx: Frag index
  4485. * @offset: Frag page offset should be moved by offset.
  4486. * +Ve - Move offset forward.
  4487. * -Ve - Move offset backward.
  4488. * @func: Caller function name
  4489. * @line: Caller function line no.
  4490. *
  4491. * Return: QDF_STATUS
  4492. */
  4493. QDF_STATUS qdf_nbuf_move_frag_page_offset_debug(qdf_nbuf_t nbuf, uint8_t idx,
  4494. int offset, const char *func,
  4495. uint32_t line);
  4496. #define qdf_nbuf_remove_frag(n, i, t) \
  4497. qdf_nbuf_remove_frag_debug(n, i, t, __func__, __LINE__)
  4498. /**
  4499. * qdf_nbuf_remove_frag_debug - Remove frag from nbuf
  4500. * @nbuf: nbuf where frag will be removed
  4501. * @idx: frag index
  4502. * @truesize: truesize of frag
  4503. * @func: Caller function name
  4504. * @line: Caller function line no.
  4505. *
  4506. * Return: QDF_STATUS
  4507. *
  4508. */
  4509. QDF_STATUS
  4510. qdf_nbuf_remove_frag_debug(qdf_nbuf_t nbuf,
  4511. uint16_t idx,
  4512. uint16_t truesize,
  4513. const char *func,
  4514. uint32_t line);
  4515. #define qdf_nbuf_add_rx_frag(f, b, o, l, s, r) \
  4516. qdf_nbuf_add_rx_frag_debug(f, b, o, l, s, r, __func__, __LINE__)
  4517. /**
  4518. * qdf_nbuf_add_rx_frag_debug() - Add frag to nbuf at index frag_idx
  4519. * @buf: Frag pointer needs to be added in nbuf
  4520. * @nbuf: qdf_nbuf_t where frag will be added
  4521. * @offset: Offset in frag to be added to nbuf_frags
  4522. * @frag_len: Frag length
  4523. * @truesize: truesize
  4524. * @take_frag_ref: Whether to take ref for frag or not
  4525. * This bool must be set as per below comdition:
  4526. * 1. False: If this frag is being added in any nbuf
  4527. * for the first time after allocation
  4528. * 2. True: If frag is already attached part of any
  4529. * nbuf
  4530. * @func: Caller function name
  4531. * @line: Caller function line no.
  4532. *
  4533. * Return: none
  4534. */
  4535. void qdf_nbuf_add_rx_frag_debug(qdf_frag_t buf, qdf_nbuf_t nbuf,
  4536. int offset, int frag_len,
  4537. unsigned int truesize, bool take_frag_ref,
  4538. const char *func, uint32_t line);
  4539. #define qdf_nbuf_ref_frag(f) \
  4540. qdf_nbuf_ref_frag_debug(f, __func__, __LINE__)
  4541. /**
  4542. * qdf_nbuf_ref_frag_debug() - get frag reference
  4543. * @buf: Frag pointer needs to be taken reference.
  4544. * @func: Caller function name
  4545. * @line: Caller function line no.
  4546. *
  4547. * Return: none
  4548. */
  4549. void qdf_nbuf_ref_frag_debug(qdf_frag_t buf, const char *func, uint32_t line);
  4550. /**
  4551. * qdf_net_buf_debug_acquire_frag() - Add frag nodes to frag debug tracker
  4552. * when nbuf is received from network stack
  4553. * @buf: qdf_nbuf_t
  4554. * @func: Caller function name
  4555. * @line: Caller function line no.
  4556. *
  4557. * Return: none
  4558. */
  4559. void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf, const char *func,
  4560. uint32_t line);
  4561. /**
  4562. * qdf_net_buf_debug_release_frag() - Update frag nodes in frag debug tracker
  4563. * when nbuf is sent to network stack
  4564. * @buf: qdf_nbuf_t
  4565. * @func: Caller function name
  4566. * @line: Caller function line no.
  4567. *
  4568. * Return: none
  4569. */
  4570. void qdf_net_buf_debug_release_frag(qdf_nbuf_t buf, const char *func,
  4571. uint32_t line);
  4572. /**
  4573. * qdf_nbuf_frag_count_inc() - Increment global frag counter
  4574. * @buf: qdf_nbuf_t
  4575. *
  4576. * Return: none
  4577. */
  4578. void qdf_nbuf_frag_count_inc(qdf_nbuf_t buf);
  4579. /**
  4580. * qdf_nbuf_frag_count_dec() - Decrement global frag counter
  4581. * @buf: qdf_nbuf_t
  4582. *
  4583. * Return: none
  4584. */
  4585. void qdf_nbuf_frag_count_dec(qdf_nbuf_t buf);
  4586. #else /* NBUF_FRAG_MEMORY_DEBUG */
  4587. /**
  4588. * qdf_nbuf_move_frag_page_offset() - Move frag page_offset by size
  4589. * and adjust length by size.
  4590. * @nbuf: qdf_nbuf_t
  4591. * @idx: Frag index
  4592. * @offset: Frag page offset should be moved by offset.
  4593. * +Ve - Move offset forward.
  4594. * -Ve - Move offset backward.
  4595. */
  4596. static inline QDF_STATUS qdf_nbuf_move_frag_page_offset(qdf_nbuf_t nbuf,
  4597. uint8_t idx,
  4598. int offset)
  4599. {
  4600. return __qdf_nbuf_move_frag_page_offset(nbuf, idx, offset);
  4601. }
  4602. /**
  4603. * qdf_nbuf_remove_frag() - Remove frag from nbuf
  4604. *
  4605. * @nbuf: nbuf pointer
  4606. * @idx: idx at which frag need to be removed
  4607. * @truesize: truesize of frag
  4608. *
  4609. * Return: void
  4610. */
  4611. static inline void qdf_nbuf_remove_frag(qdf_nbuf_t nbuf,
  4612. uint16_t idx,
  4613. uint16_t truesize)
  4614. {
  4615. return __qdf_nbuf_remove_frag(nbuf, idx, truesize);
  4616. }
  4617. /**
  4618. * qdf_nbuf_add_rx_frag() - Add frag to nbuf at index frag_idx
  4619. * @buf: Frag pointer needs to be added in nbuf frag
  4620. * @nbuf: qdf_nbuf_t where frag will be added
  4621. * @offset: Offset in frag to be added to nbuf_frags
  4622. * @frag_len: Frag length
  4623. * @truesize: truesize
  4624. * @take_frag_ref: Whether to take ref for frag or not
  4625. * This bool must be set as per below comdition:
  4626. * 1. False: If this frag is being added in any nbuf
  4627. * for the first time after allocation
  4628. * 2. True: If frag is already attached part of any
  4629. * nbuf
  4630. *
  4631. * qdf_nbuf_add_rx_frag takes ref_count based on boolean flag take_frag_ref
  4632. */
  4633. static inline void qdf_nbuf_add_rx_frag(qdf_frag_t buf, qdf_nbuf_t nbuf,
  4634. int offset, int frag_len,
  4635. unsigned int truesize,
  4636. bool take_frag_ref)
  4637. {
  4638. __qdf_nbuf_add_rx_frag(buf, nbuf, offset,
  4639. frag_len, truesize, take_frag_ref);
  4640. }
  4641. /**
  4642. * qdf_nbuf_ref_frag() - get frag reference
  4643. * @buf: Frag pointer needs to be taken reference.
  4644. *
  4645. * Return: void
  4646. */
  4647. static inline void qdf_nbuf_ref_frag(qdf_frag_t buf)
  4648. {
  4649. __qdf_nbuf_ref_frag(buf);
  4650. }
  4651. static inline void qdf_net_buf_debug_acquire_frag(qdf_nbuf_t buf,
  4652. const char *func,
  4653. uint32_t line)
  4654. {
  4655. }
  4656. static inline void qdf_net_buf_debug_release_frag(qdf_nbuf_t buf,
  4657. const char *func,
  4658. uint32_t line)
  4659. {
  4660. }
  4661. static inline void qdf_nbuf_frag_count_inc(qdf_nbuf_t buf)
  4662. {
  4663. }
  4664. static inline void qdf_nbuf_frag_count_dec(qdf_nbuf_t buf)
  4665. {
  4666. }
  4667. #endif /* NBUF_FRAG_MEMORY_DEBUG */
  4668. #define qdf_nbuf_add_frag(dev, f, n, o, f_l, t_sz, f_r, sz) \
  4669. qdf_nbuf_add_frag_debug(dev, f, n, o, f_l, t_sz, \
  4670. f_r, sz, __func__, __LINE__)
  4671. /**
  4672. * qdf_nbuf_add_frag_debug() - Add frag to nbuf
  4673. * @osdev: Device handle
  4674. * @buf: Frag pointer needs to be added in nbuf frag
  4675. * @nbuf: qdf_nbuf_t where frag will be added
  4676. * @offset: Offset in frag to be added to nbuf_frags
  4677. * @frag_len: Frag length
  4678. * @truesize: truesize
  4679. * @take_frag_ref: Whether to take ref for frag or not
  4680. * This bool must be set as per below comdition:
  4681. * 1. False: If this frag is being added in any nbuf
  4682. * for the first time after allocation
  4683. * 2. True: If frag is already attached part of any
  4684. * nbuf
  4685. * @minsize: Minimum size to allocate
  4686. * @func: Caller function name
  4687. * @line: Caller function line no.
  4688. *
  4689. * if number of frag exceed maximum frag array. A new nbuf is allocated
  4690. * with minimum headroom and frag it added to that nbuf.
  4691. * new nbuf is added as frag_list to the master nbuf.
  4692. *
  4693. * Return: QDF_STATUS
  4694. */
  4695. QDF_STATUS
  4696. qdf_nbuf_add_frag_debug(qdf_device_t osdev, qdf_frag_t buf,
  4697. qdf_nbuf_t nbuf, int offset,
  4698. int frag_len, unsigned int truesize,
  4699. bool take_frag_ref, unsigned int minsize,
  4700. const char *func, uint32_t line);
  4701. #ifdef MEMORY_DEBUG
  4702. /**
  4703. * qdf_nbuf_acquire_track_lock - acquire the nbuf spinlock at the
  4704. * specified index
  4705. * @index: index to get the lock
  4706. * @irq_flag: lock flag for using nbuf lock
  4707. *
  4708. * Return: none
  4709. */
  4710. void qdf_nbuf_acquire_track_lock(uint32_t index,
  4711. unsigned long irq_flag);
  4712. /**
  4713. * qdf_nbuf_release_track_lock - release the nbuf spinlock at the
  4714. * specified index
  4715. * @index: index of the lock to be released
  4716. * @irq_flag: lock flag for using nbuf lock
  4717. *
  4718. * Return: none
  4719. */
  4720. void qdf_nbuf_release_track_lock(uint32_t index,
  4721. unsigned long irq_flag);
  4722. /**
  4723. * qdf_nbuf_get_track_tbl - get the QDF_NBUF_TRACK entry from the track
  4724. * table at the specified index
  4725. * @index: index to get the table entry
  4726. *
  4727. * Return: the QDF_NBUF_TRACK entry at the specified index in the table
  4728. */
  4729. QDF_NBUF_TRACK *qdf_nbuf_get_track_tbl(uint32_t index);
  4730. #endif /* MEMORY_DEBUG */
  4731. #ifdef CONFIG_WLAN_SYSFS_MEM_STATS
  4732. /**
  4733. * qdf_record_nbuf_nbytes() - add or subtract the size of the nbuf
  4734. * from the total skb mem and DP tx/rx skb mem
  4735. * @nbytes: number of bytes
  4736. * @dir: direction
  4737. * @is_mapped: is mapped or unmapped memory
  4738. *
  4739. * Return: none
  4740. */
  4741. void qdf_record_nbuf_nbytes(
  4742. uint32_t nbytes, qdf_dma_dir_t dir, bool is_mapped);
  4743. #else /* CONFIG_WLAN_SYSFS_MEM_STATS */
  4744. static inline void qdf_record_nbuf_nbytes(
  4745. int nbytes, qdf_dma_dir_t dir, bool is_mapped)
  4746. {
  4747. }
  4748. #endif /* CONFIG_WLAN_SYSFS_MEM_STATS */
  4749. #ifdef ENHANCED_OS_ABSTRACTION
  4750. /**
  4751. * qdf_nbuf_set_timestamp() - set the timestamp for frame
  4752. * @buf: pointer to network buffer
  4753. *
  4754. * Return: none
  4755. */
  4756. void qdf_nbuf_set_timestamp(qdf_nbuf_t buf);
  4757. /**
  4758. * qdf_nbuf_get_timestamp() - get the timestamp for frame
  4759. * @buf: pointer to network buffer
  4760. *
  4761. * Return: timestamp stored in skb in ms
  4762. */
  4763. uint64_t qdf_nbuf_get_timestamp(qdf_nbuf_t buf);
  4764. /**
  4765. * qdf_nbuf_get_timestamp_us() - get the timestamp for frame
  4766. * @buf: pointer to network buffer
  4767. *
  4768. * Return: timestamp stored in nbuf in us
  4769. */
  4770. uint64_t qdf_nbuf_get_timestamp_us(qdf_nbuf_t buf);
  4771. /**
  4772. * qdf_nbuf_get_timedelta_ms() - get time difference in ms
  4773. * @buf: pointer to network buffer
  4774. *
  4775. * Return: time difference ms
  4776. */
  4777. uint64_t qdf_nbuf_get_timedelta_ms(qdf_nbuf_t buf);
  4778. /**
  4779. * qdf_nbuf_get_timedelta_us() - get time difference in micro seconds
  4780. * @buf: pointer to network buffer
  4781. *
  4782. * Return: time difference in micro seconds
  4783. */
  4784. uint64_t qdf_nbuf_get_timedelta_us(qdf_nbuf_t buf);
  4785. /**
  4786. * qdf_nbuf_net_timedelta() - get time delta
  4787. * @t: time as qdf_ktime_t object
  4788. *
  4789. * Return: time delta as ktime_t object
  4790. */
  4791. qdf_ktime_t qdf_nbuf_net_timedelta(qdf_ktime_t t);
  4792. #else
  4793. static inline void
  4794. qdf_nbuf_set_timestamp(struct sk_buff *skb)
  4795. {
  4796. __qdf_nbuf_set_timestamp(skb);
  4797. }
  4798. static inline uint64_t
  4799. qdf_nbuf_get_timestamp(struct sk_buff *skb)
  4800. {
  4801. return __qdf_nbuf_get_timestamp(skb);
  4802. }
  4803. static inline uint64_t
  4804. qdf_nbuf_get_timestamp_us(qdf_nbuf_t buf)
  4805. {
  4806. return __qdf_nbuf_get_timestamp_us(buf);
  4807. }
  4808. static inline uint64_t
  4809. qdf_nbuf_get_timedelta_ms(struct sk_buff *skb)
  4810. {
  4811. return __qdf_nbuf_get_timedelta_ms(skb);
  4812. }
  4813. static inline uint64_t
  4814. qdf_nbuf_get_timedelta_us(struct sk_buff *skb)
  4815. {
  4816. return __qdf_nbuf_get_timedelta_us(skb);
  4817. }
  4818. static inline qdf_ktime_t qdf_nbuf_net_timedelta(qdf_ktime_t t)
  4819. {
  4820. return __qdf_nbuf_net_timedelta(t);
  4821. }
  4822. #endif /* ENHANCED_OS_ABSTRACTION */
  4823. #ifdef NBUF_MEMORY_DEBUG
  4824. /**
  4825. * qdf_set_smmu_fault_state() - Set smmu fault state
  4826. * @smmu_fault_state: state of the wlan smmu
  4827. *
  4828. * Return: void
  4829. */
  4830. void qdf_set_smmu_fault_state(bool smmu_fault_state);
  4831. #else
  4832. static inline void qdf_set_smmu_fault_state(bool smmu_fault_state)
  4833. {
  4834. }
  4835. #endif
  4836. #ifdef CONFIG_NBUF_AP_PLATFORM
  4837. #include <i_qdf_nbuf_api_w.h>
  4838. #else
  4839. #include <i_qdf_nbuf_api_m.h>
  4840. #endif
  4841. /**
  4842. * qdf_nbuf_stop_replenish_timer - Stop alloc fail replenish timer
  4843. *
  4844. * This function stops the alloc fail replenish timer.
  4845. *
  4846. * Return: void
  4847. */
  4848. void qdf_nbuf_stop_replenish_timer(void);
  4849. /**
  4850. * qdf_get_nbuf_valid_frag() - Get nbuf to store frag
  4851. * @nbuf: qdf_nbuf_t master nbuf
  4852. *
  4853. * Return: qdf_nbuf_t
  4854. */
  4855. qdf_nbuf_t qdf_get_nbuf_valid_frag(qdf_nbuf_t nbuf);
  4856. #endif /* _QDF_NBUF_H */