qdf_nbuf.h 137 KB

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