qdf_nbuf.h 126 KB

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