qdf_nbuf.h 91 KB

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