qdf_nbuf.h 127 KB

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