qdf_nbuf.h 151 KB

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