qdf_nbuf.h 112 KB

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