qdf_nbuf.h 88 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547
  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. #ifdef NBUF_MAP_UNMAP_DEBUG
  702. /**
  703. * qdf_nbuf_map_check_for_leaks() - check for nbut map leaks
  704. *
  705. * Check for net buffers that have been mapped, but never unmapped.
  706. *
  707. * Returns: None
  708. */
  709. void qdf_nbuf_map_check_for_leaks(void);
  710. QDF_STATUS qdf_nbuf_map_debug(qdf_device_t osdev,
  711. qdf_nbuf_t buf,
  712. qdf_dma_dir_t dir,
  713. const char *func,
  714. uint32_t line);
  715. #define qdf_nbuf_map(osdev, buf, dir) \
  716. qdf_nbuf_map_debug(osdev, buf, dir, __func__, __LINE__)
  717. void qdf_nbuf_unmap_debug(qdf_device_t osdev,
  718. qdf_nbuf_t buf,
  719. qdf_dma_dir_t dir,
  720. const char *func,
  721. uint32_t line);
  722. #define qdf_nbuf_unmap(osdev, buf, dir) \
  723. qdf_nbuf_unmap_debug(osdev, buf, dir, __func__, __LINE__)
  724. QDF_STATUS qdf_nbuf_map_single_debug(qdf_device_t osdev,
  725. qdf_nbuf_t buf,
  726. qdf_dma_dir_t dir,
  727. const char *func,
  728. uint32_t line);
  729. #define qdf_nbuf_map_single(osdev, buf, dir) \
  730. qdf_nbuf_map_single_debug(osdev, buf, dir, __func__, __LINE__)
  731. void qdf_nbuf_unmap_single_debug(qdf_device_t osdev,
  732. qdf_nbuf_t buf,
  733. qdf_dma_dir_t dir,
  734. const char *func,
  735. uint32_t line);
  736. #define qdf_nbuf_unmap_single(osdev, buf, dir) \
  737. qdf_nbuf_unmap_single_debug(osdev, buf, dir, __func__, __LINE__)
  738. QDF_STATUS qdf_nbuf_map_nbytes_debug(qdf_device_t osdev,
  739. qdf_nbuf_t buf,
  740. qdf_dma_dir_t dir,
  741. int nbytes,
  742. const char *func,
  743. uint32_t line);
  744. #define qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes) \
  745. qdf_nbuf_map_nbytes_debug(osdev, buf, dir, nbytes, __func__, __LINE__)
  746. void qdf_nbuf_unmap_nbytes_debug(qdf_device_t osdev,
  747. qdf_nbuf_t buf,
  748. qdf_dma_dir_t dir,
  749. int nbytes,
  750. const char *func,
  751. uint32_t line);
  752. #define qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes) \
  753. qdf_nbuf_unmap_nbytes_debug(osdev, buf, dir, nbytes, __func__, __LINE__)
  754. QDF_STATUS qdf_nbuf_map_nbytes_single_debug(qdf_device_t osdev,
  755. qdf_nbuf_t buf,
  756. qdf_dma_dir_t dir,
  757. int nbytes,
  758. const char *func,
  759. uint32_t line);
  760. #define qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes) \
  761. qdf_nbuf_map_nbytes_single_debug(osdev, buf, dir, nbytes, \
  762. __func__, __LINE__)
  763. void qdf_nbuf_unmap_nbytes_single_debug(qdf_device_t osdev,
  764. qdf_nbuf_t buf,
  765. qdf_dma_dir_t dir,
  766. int nbytes,
  767. const char *func,
  768. uint32_t line);
  769. #define qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes) \
  770. qdf_nbuf_unmap_nbytes_single_debug(osdev, buf, dir, nbytes, \
  771. __func__, __LINE__)
  772. #else /* NBUF_MAP_UNMAP_DEBUG */
  773. static inline void qdf_nbuf_map_check_for_leaks(void) {}
  774. static inline QDF_STATUS
  775. qdf_nbuf_map(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  776. {
  777. return __qdf_nbuf_map(osdev, buf, dir);
  778. }
  779. static inline void
  780. qdf_nbuf_unmap(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  781. {
  782. __qdf_nbuf_unmap(osdev, buf, dir);
  783. }
  784. static inline QDF_STATUS
  785. qdf_nbuf_map_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  786. {
  787. return __qdf_nbuf_map_single(osdev, buf, dir);
  788. }
  789. static inline void
  790. qdf_nbuf_unmap_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  791. {
  792. __qdf_nbuf_unmap_single(osdev, buf, dir);
  793. }
  794. static inline QDF_STATUS
  795. qdf_nbuf_map_nbytes(qdf_device_t osdev, qdf_nbuf_t buf,
  796. qdf_dma_dir_t dir, int nbytes)
  797. {
  798. return __qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes);
  799. }
  800. static inline void
  801. qdf_nbuf_unmap_nbytes(qdf_device_t osdev,
  802. qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  803. {
  804. __qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes);
  805. }
  806. static inline QDF_STATUS
  807. qdf_nbuf_map_nbytes_single(
  808. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  809. {
  810. return __qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes);
  811. }
  812. static inline void
  813. qdf_nbuf_unmap_nbytes_single(
  814. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  815. {
  816. return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes);
  817. }
  818. #endif /* NBUF_MAP_UNMAP_DEBUG */
  819. /**
  820. * qdf_nbuf_queue_head_dequeue() - dequeue nbuf from the head of queue
  821. * @nbuf_queue_head: pointer to nbuf queue head
  822. *
  823. * Return: pointer to network buffer dequeued
  824. */
  825. static inline
  826. qdf_nbuf_t qdf_nbuf_queue_head_dequeue(qdf_nbuf_queue_head_t *nbuf_queue_head)
  827. {
  828. return __qdf_nbuf_queue_head_dequeue(nbuf_queue_head);
  829. }
  830. /**
  831. * qdf_nbuf_queue_head_qlen() - length of the queue
  832. * @nbuf_queue_head: pointer to nbuf queue head
  833. *
  834. * Return: length of queue (number of nbufs) pointed by qdf_nbuf_queue_head_t
  835. */
  836. static inline
  837. uint32_t qdf_nbuf_queue_head_qlen(qdf_nbuf_queue_head_t *nbuf_queue_head)
  838. {
  839. return __qdf_nbuf_queue_head_qlen(nbuf_queue_head);
  840. }
  841. /**
  842. * qdf_nbuf_queue_head_enqueue_tail() - enqueue nbuf into queue tail
  843. * @nbuf_queue_head: pointer to nbuf queue head
  844. * @nbuf: nbuf to be enqueued
  845. *
  846. * Return: None
  847. */
  848. static inline
  849. void qdf_nbuf_queue_head_enqueue_tail(qdf_nbuf_queue_head_t *nbuf_queue_head,
  850. qdf_nbuf_t nbuf)
  851. {
  852. return __qdf_nbuf_queue_head_enqueue_tail(nbuf_queue_head, nbuf);
  853. }
  854. /**
  855. * qdf_nbuf_queue_head_init() - initialize qdf_nbuf_queue_head_t
  856. * @nbuf_queue_head: pointer to nbuf queue head to be initialized
  857. *
  858. * Return: None
  859. */
  860. static inline
  861. void qdf_nbuf_queue_head_init(qdf_nbuf_queue_head_t *nbuf_queue_head)
  862. {
  863. return __qdf_nbuf_queue_head_init(nbuf_queue_head);
  864. }
  865. /**
  866. * qdf_nbuf_queue_head_purge() - purge qdf_nbuf_queue_head_t
  867. * @nbuf_queue_head: pointer to nbuf queue head to be purged
  868. *
  869. * Return: None
  870. */
  871. static inline
  872. void qdf_nbuf_queue_head_purge(qdf_nbuf_queue_head_t *nbuf_queue_head)
  873. {
  874. return __qdf_nbuf_queue_head_purge(nbuf_queue_head);
  875. }
  876. static inline void
  877. qdf_nbuf_sync_for_cpu(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  878. {
  879. __qdf_nbuf_sync_for_cpu(osdev, buf, dir);
  880. }
  881. static inline int qdf_nbuf_get_num_frags(qdf_nbuf_t buf)
  882. {
  883. return __qdf_nbuf_get_num_frags(buf);
  884. }
  885. /**
  886. * qdf_nbuf_get_frag_len() - get fragment length
  887. * @buf: Network buffer
  888. * @frag_num: Fragment number
  889. *
  890. * Return: Fragment length
  891. */
  892. static inline int qdf_nbuf_get_frag_len(qdf_nbuf_t buf, int frag_num)
  893. {
  894. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  895. return __qdf_nbuf_get_frag_len(buf, frag_num);
  896. }
  897. /**
  898. * qdf_nbuf_get_frag_vaddr() - get fragment virtual address
  899. * @buf: Network buffer
  900. * @frag_num: Fragment number
  901. *
  902. * Return: Fragment virtual address
  903. */
  904. static inline unsigned char *qdf_nbuf_get_frag_vaddr(qdf_nbuf_t buf,
  905. int frag_num)
  906. {
  907. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  908. return __qdf_nbuf_get_frag_vaddr(buf, frag_num);
  909. }
  910. /**
  911. * qdf_nbuf_get_frag_vaddr_always() - get fragment virtual address
  912. * @buf: Network buffer
  913. *
  914. * Return: Fragment virtual address
  915. */
  916. static inline unsigned char *
  917. qdf_nbuf_get_frag_vaddr_always(qdf_nbuf_t buf)
  918. {
  919. return __qdf_nbuf_get_frag_vaddr_always(buf);
  920. }
  921. /**
  922. * qdf_nbuf_get_frag_paddr() - get physical address for skb linear buffer
  923. * or skb fragment, based on frag_num passed
  924. * @buf: Network buffer
  925. * @frag_num: Fragment number
  926. *
  927. * Return: Fragment physical address
  928. */
  929. static inline qdf_dma_addr_t qdf_nbuf_get_frag_paddr(qdf_nbuf_t buf,
  930. unsigned int frag_num)
  931. {
  932. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  933. return __qdf_nbuf_get_frag_paddr(buf, frag_num);
  934. }
  935. /**
  936. * qdf_nbuf_get_tx_frag_paddr() - get physical address for skb fragments only
  937. * @buf: Network buffer
  938. *
  939. * Return: Fragment physical address
  940. * Usage guideline: Use “qdf_nbuf_frag_map()” to dma map the specific
  941. * skb fragment , followed by “qdf_nbuf_get_tx_frag_paddr”
  942. */
  943. static inline qdf_dma_addr_t qdf_nbuf_get_tx_frag_paddr(qdf_nbuf_t buf)
  944. {
  945. return __qdf_nbuf_get_tx_frag_paddr(buf);
  946. }
  947. /**
  948. * qdf_nbuf_get_frag_is_wordstream() - is fragment wordstream
  949. * @buf: Network buffer
  950. * @frag_num: Fragment number
  951. *
  952. * Return: Fragment wordstream or not
  953. */
  954. static inline int qdf_nbuf_get_frag_is_wordstream(qdf_nbuf_t buf, int frag_num)
  955. {
  956. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  957. return __qdf_nbuf_get_frag_is_wordstream(buf, frag_num);
  958. }
  959. /**
  960. * qdf_nbuf_set_frag_is_wordstream() - set fragment wordstream
  961. * @buf: Network buffer
  962. * @frag_num: Fragment number
  963. * @is_wordstream: Wordstream
  964. *
  965. * Return: none
  966. */
  967. static inline void
  968. qdf_nbuf_set_frag_is_wordstream(qdf_nbuf_t buf,
  969. int frag_num, int is_wordstream)
  970. {
  971. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  972. __qdf_nbuf_set_frag_is_wordstream(buf, frag_num, is_wordstream);
  973. }
  974. static inline void
  975. qdf_nbuf_set_vdev_ctx(qdf_nbuf_t buf, uint8_t vdev_id)
  976. {
  977. __qdf_nbuf_set_vdev_ctx(buf, vdev_id);
  978. }
  979. static inline void
  980. qdf_nbuf_set_tx_ftype(qdf_nbuf_t buf, enum cb_ftype type)
  981. {
  982. __qdf_nbuf_set_tx_ftype(buf, type);
  983. }
  984. static inline void
  985. qdf_nbuf_set_rx_ftype(qdf_nbuf_t buf, enum cb_ftype type)
  986. {
  987. __qdf_nbuf_set_rx_ftype(buf, type);
  988. }
  989. static inline uint8_t
  990. qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf)
  991. {
  992. return __qdf_nbuf_get_vdev_ctx(buf);
  993. }
  994. static inline enum cb_ftype qdf_nbuf_get_tx_ftype(qdf_nbuf_t buf)
  995. {
  996. return __qdf_nbuf_get_tx_ftype(buf);
  997. }
  998. static inline enum cb_ftype qdf_nbuf_get_rx_ftype(qdf_nbuf_t buf)
  999. {
  1000. return __qdf_nbuf_get_rx_ftype(buf);
  1001. }
  1002. static inline qdf_dma_addr_t
  1003. qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf)
  1004. {
  1005. return __qdf_nbuf_mapped_paddr_get(buf);
  1006. }
  1007. static inline void
  1008. qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr)
  1009. {
  1010. __qdf_nbuf_mapped_paddr_set(buf, paddr);
  1011. }
  1012. static inline void
  1013. qdf_nbuf_frag_push_head(qdf_nbuf_t buf,
  1014. int frag_len, char *frag_vaddr,
  1015. qdf_dma_addr_t frag_paddr)
  1016. {
  1017. __qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr);
  1018. }
  1019. #define qdf_nbuf_num_frags_init(_nbuf) __qdf_nbuf_num_frags_init((_nbuf))
  1020. /**
  1021. * qdf_nbuf_set_rx_chfrag_start() - set msdu start bit
  1022. * @buf: Network buffer
  1023. * @val: 0/1
  1024. *
  1025. * Return: void
  1026. */
  1027. static inline void
  1028. qdf_nbuf_set_rx_chfrag_start(qdf_nbuf_t buf, uint8_t val)
  1029. {
  1030. __qdf_nbuf_set_rx_chfrag_start(buf, val);
  1031. }
  1032. /**
  1033. * qdf_nbuf_is_rx_chfrag_start() - get msdu start bit
  1034. * @buf: Network buffer
  1035. *
  1036. * Return: integer value - 0/1
  1037. */
  1038. static inline int qdf_nbuf_is_rx_chfrag_start(qdf_nbuf_t buf)
  1039. {
  1040. return __qdf_nbuf_is_rx_chfrag_start(buf);
  1041. }
  1042. /**
  1043. * qdf_nbuf_set_rx_chfrag_cont() - set msdu continuation bit
  1044. * @buf: Network buffer
  1045. * @val: 0/1
  1046. *
  1047. * Return: void
  1048. */
  1049. static inline void
  1050. qdf_nbuf_set_rx_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
  1051. {
  1052. __qdf_nbuf_set_rx_chfrag_cont(buf, val);
  1053. }
  1054. /**
  1055. * qdf_nbuf_is_rx_chfrag_cont() - get msdu continuation bit
  1056. * @buf: Network buffer
  1057. *
  1058. * Return: integer value - 0/1
  1059. */
  1060. static inline int qdf_nbuf_is_rx_chfrag_cont(qdf_nbuf_t buf)
  1061. {
  1062. return __qdf_nbuf_is_rx_chfrag_cont(buf);
  1063. }
  1064. /**
  1065. * qdf_nbuf_set_rx_chfrag_end() - set msdu end bit
  1066. * @buf: Network buffer
  1067. * @val: 0/1
  1068. *
  1069. * Return: void
  1070. */
  1071. static inline void qdf_nbuf_set_rx_chfrag_end(qdf_nbuf_t buf, uint8_t val)
  1072. {
  1073. __qdf_nbuf_set_rx_chfrag_end(buf, val);
  1074. }
  1075. /**
  1076. * qdf_nbuf_is_rx_chfrag_end() - set msdu end bit
  1077. * @buf: Network buffer
  1078. *
  1079. * Return: integer value - 0/1
  1080. */
  1081. static inline int qdf_nbuf_is_rx_chfrag_end(qdf_nbuf_t buf)
  1082. {
  1083. return __qdf_nbuf_is_rx_chfrag_end(buf);
  1084. }
  1085. /**
  1086. * qdf_nbuf_set_da_mcbc() - set da is mcbc
  1087. * @buf: Network buffer
  1088. * @val: 0/1
  1089. *
  1090. * Return: void
  1091. */
  1092. static inline void
  1093. qdf_nbuf_set_da_mcbc(qdf_nbuf_t buf, uint8_t val)
  1094. {
  1095. __qdf_nbuf_set_da_mcbc(buf, val);
  1096. }
  1097. /**
  1098. * qdf_nbuf_is_da_mcbc() - get da is mcbc bit
  1099. * @buf: Network buffer
  1100. *
  1101. * Return: integer value - 0/1
  1102. */
  1103. static inline int qdf_nbuf_is_da_mcbc(qdf_nbuf_t buf)
  1104. {
  1105. return __qdf_nbuf_is_da_mcbc(buf);
  1106. }
  1107. /**
  1108. * qdf_nbuf_set_da_valid() - set da valid bit
  1109. * @buf: Network buffer
  1110. * @val: 0/1
  1111. *
  1112. * Return: void
  1113. */
  1114. static inline void qdf_nbuf_set_da_valid(qdf_nbuf_t buf, uint8_t val)
  1115. {
  1116. __qdf_nbuf_set_da_valid(buf, val);
  1117. }
  1118. /**
  1119. * qdf_nbuf_is_da_valid() - get da valid bit
  1120. * @buf: Network buffer
  1121. *
  1122. * Return: integer value - 0/1
  1123. */
  1124. static inline int qdf_nbuf_is_da_valid(qdf_nbuf_t buf)
  1125. {
  1126. return __qdf_nbuf_is_da_valid(buf);
  1127. }
  1128. /**
  1129. * qdf_nbuf_set_sa_valid() - set sa valid bit
  1130. * @buf: Network buffer
  1131. * @val: 0/1
  1132. *
  1133. * Return: void
  1134. */
  1135. static inline void qdf_nbuf_set_sa_valid(qdf_nbuf_t buf, uint8_t val)
  1136. {
  1137. __qdf_nbuf_set_sa_valid(buf, val);
  1138. }
  1139. /**
  1140. * qdf_nbuf_is_sa_valid() - get da valid bit
  1141. * @buf: Network buffer
  1142. *
  1143. * Return: integer value - 0/1
  1144. */
  1145. static inline int qdf_nbuf_is_sa_valid(qdf_nbuf_t buf)
  1146. {
  1147. return __qdf_nbuf_is_sa_valid(buf);
  1148. }
  1149. /**
  1150. * qdf_nbuf_set_raw_frame() - set raw_frame bit
  1151. * @buf: Network buffer
  1152. * @val: 0/1
  1153. *
  1154. * Return: void
  1155. */
  1156. static inline void qdf_nbuf_set_raw_frame(qdf_nbuf_t buf, uint8_t val)
  1157. {
  1158. __qdf_nbuf_set_raw_frame(buf, val);
  1159. }
  1160. /**
  1161. * qdf_nbuf_is_raw_frame() - get raw_frame bit
  1162. * @buf: Network buffer
  1163. *
  1164. * Return: integer value - 0/1
  1165. */
  1166. static inline int qdf_nbuf_is_raw_frame(qdf_nbuf_t buf)
  1167. {
  1168. return __qdf_nbuf_is_raw_frame(buf);
  1169. }
  1170. /**
  1171. * qdf_nbuf_set_tid_val() - set tid_val
  1172. * @buf: Network buffer
  1173. * @val: 4 bits tid value
  1174. */
  1175. static inline void qdf_nbuf_set_tid_val(qdf_nbuf_t buf, uint8_t val)
  1176. {
  1177. __qdf_nbuf_set_tid_val(buf, val);
  1178. }
  1179. /**
  1180. * qdf_nbuf_get_tid_val() - get tid_val
  1181. * @buf: Network buffer
  1182. *
  1183. * Return: integer value[4 bits tid value]
  1184. */
  1185. static inline uint8_t qdf_nbuf_get_tid_val(qdf_nbuf_t buf)
  1186. {
  1187. return __qdf_nbuf_get_tid_val(buf);
  1188. }
  1189. /**
  1190. * qdf_nbuf_set_frag_list() - set frag list bit
  1191. * @buf: Network buffer
  1192. * @val: 0/1
  1193. *
  1194. * Return: void
  1195. */
  1196. static inline void qdf_nbuf_set_is_frag(qdf_nbuf_t buf, uint8_t val)
  1197. {
  1198. __qdf_nbuf_set_is_frag(buf, val);
  1199. }
  1200. /**
  1201. * qdf_nbuf_is_sa_valid() - get da frag list bit
  1202. * @buf: Network buffer
  1203. *
  1204. * Return: integer value - 0/1
  1205. */
  1206. static inline int qdf_nbuf_is_frag(qdf_nbuf_t buf)
  1207. {
  1208. return __qdf_nbuf_is_frag(buf);
  1209. }
  1210. /**
  1211. * qdf_nbuf_set_tx_chfrag_start() - set msdu start bit
  1212. * @buf: Network buffer
  1213. * @val: 0/1
  1214. *
  1215. * Return: void
  1216. */
  1217. static inline void
  1218. qdf_nbuf_set_tx_chfrag_start(qdf_nbuf_t buf, uint8_t val)
  1219. {
  1220. __qdf_nbuf_set_tx_chfrag_start(buf, val);
  1221. }
  1222. /**
  1223. * qdf_nbuf_is_tx_chfrag_start() - get msdu start bit
  1224. * @buf: Network buffer
  1225. *
  1226. * Return: integer value - 0/1
  1227. */
  1228. static inline int qdf_nbuf_is_tx_chfrag_start(qdf_nbuf_t buf)
  1229. {
  1230. return __qdf_nbuf_is_tx_chfrag_start(buf);
  1231. }
  1232. /**
  1233. * qdf_nbuf_set_tx_chfrag_cont() - set msdu continuation bit
  1234. * @buf: Network buffer
  1235. * @val: 0/1
  1236. *
  1237. * Return: void
  1238. */
  1239. static inline void
  1240. qdf_nbuf_set_tx_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
  1241. {
  1242. __qdf_nbuf_set_tx_chfrag_cont(buf, val);
  1243. }
  1244. /**
  1245. * qdf_nbuf_is_tx_chfrag_cont() - get msdu continuation bit
  1246. * @buf: Network buffer
  1247. *
  1248. * Return: integer value - 0/1
  1249. */
  1250. static inline int qdf_nbuf_is_tx_chfrag_cont(qdf_nbuf_t buf)
  1251. {
  1252. return __qdf_nbuf_is_tx_chfrag_cont(buf);
  1253. }
  1254. /**
  1255. * qdf_nbuf_set_tx_chfrag_end() - set msdu end bit
  1256. * @buf: Network buffer
  1257. * @val: 0/1
  1258. *
  1259. * Return: void
  1260. */
  1261. static inline void qdf_nbuf_set_tx_chfrag_end(qdf_nbuf_t buf, uint8_t val)
  1262. {
  1263. __qdf_nbuf_set_tx_chfrag_end(buf, val);
  1264. }
  1265. /**
  1266. * qdf_nbuf_is_tx_chfrag_end() - set msdu end bit
  1267. * @buf: Network buffer
  1268. *
  1269. * Return: integer value - 0/1
  1270. */
  1271. static inline int qdf_nbuf_is_tx_chfrag_end(qdf_nbuf_t buf)
  1272. {
  1273. return __qdf_nbuf_is_tx_chfrag_end(buf);
  1274. }
  1275. static inline void
  1276. qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg)
  1277. {
  1278. __qdf_nbuf_dma_map_info(bmap, sg);
  1279. }
  1280. /**
  1281. * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
  1282. * @buf: Network buffer
  1283. *
  1284. * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
  1285. */
  1286. static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
  1287. {
  1288. return __qdf_nbuf_is_tso(nbuf);
  1289. }
  1290. /**
  1291. * qdf_nbuf_get_users() - function to get the number of users referencing this
  1292. * network buffer
  1293. *
  1294. * @nbuf: network buffer
  1295. *
  1296. * Return: number of user references to nbuf.
  1297. */
  1298. static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf)
  1299. {
  1300. return __qdf_nbuf_get_users(nbuf);
  1301. }
  1302. /**
  1303. * qdf_nbuf_next() - get the next packet in the linked list
  1304. * @buf: Network buffer
  1305. *
  1306. * This function can be used when nbufs are directly linked into a list,
  1307. * rather than using a separate network buffer queue object.
  1308. *
  1309. * Return: next network buffer in the linked list
  1310. */
  1311. static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
  1312. {
  1313. return __qdf_nbuf_next(buf);
  1314. }
  1315. #ifdef NBUF_MEMORY_DEBUG
  1316. void qdf_net_buf_debug_init(void);
  1317. void qdf_net_buf_debug_exit(void);
  1318. void qdf_net_buf_debug_clean(void);
  1319. void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
  1320. const char *func_name, uint32_t line_num);
  1321. /**
  1322. * qdf_net_buf_debug_update_node() - update nbuf in debug hash table
  1323. *
  1324. * Return: none
  1325. */
  1326. void qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name,
  1327. uint32_t line_num);
  1328. void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
  1329. /**
  1330. * qdf_net_buf_debug_acquire_skb() - acquire skb to avoid memory leak
  1331. * @net_buf: Network buf holding head segment (single)
  1332. * @func_name: pointer to function name
  1333. * @line_num: line number
  1334. *
  1335. * WLAN driver module's SKB which are allocated by network stack are
  1336. * suppose to call this API before freeing it such that the SKB
  1337. * is not reported as memory leak.
  1338. *
  1339. * Return: none
  1340. */
  1341. void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  1342. const char *func_name,
  1343. uint32_t line_num);
  1344. void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
  1345. /* nbuf allocation rouines */
  1346. #define qdf_nbuf_alloc(d, s, r, a, p) \
  1347. qdf_nbuf_alloc_debug(d, s, r, a, p, __func__, __LINE__)
  1348. qdf_nbuf_t qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size,
  1349. int reserve, int align, int prio,
  1350. const char *func, uint32_t line);
  1351. #define qdf_nbuf_free(d) \
  1352. qdf_nbuf_free_debug(d, __func__, __LINE__)
  1353. void qdf_nbuf_free_debug(qdf_nbuf_t nbuf, const char *func, uint32_t line);
  1354. #define qdf_nbuf_clone(buf) \
  1355. qdf_nbuf_clone_debug(buf, __func__, __LINE__)
  1356. /**
  1357. * qdf_nbuf_clone_debug() - clone the nbuf (copy is readonly)
  1358. * @buf: nbuf to clone from
  1359. * @func: name of the calling function
  1360. * @line: line number of the callsite
  1361. *
  1362. * This function clones the nbuf and creates a memory tracking
  1363. * node corresponding to that cloned skbuff structure.
  1364. *
  1365. * Return: cloned buffer
  1366. */
  1367. qdf_nbuf_t qdf_nbuf_clone_debug(qdf_nbuf_t buf, const char *func,
  1368. uint32_t line);
  1369. #define qdf_nbuf_copy(buf) \
  1370. qdf_nbuf_copy_debug(buf, __func__, __LINE__)
  1371. /**
  1372. * qdf_nbuf_copy_debug() - returns a private copy of the buf
  1373. * @buf: nbuf to copy from
  1374. * @func: name of the calling function
  1375. * @line: line number of the callsite
  1376. *
  1377. * This API returns a private copy of the buf, the buf returned is completely
  1378. * modifiable by callers. It also creates a memory tracking node corresponding
  1379. * to that new skbuff structure.
  1380. *
  1381. * Return: copied buffer
  1382. */
  1383. qdf_nbuf_t qdf_nbuf_copy_debug(qdf_nbuf_t buf, const char *func, uint32_t line);
  1384. #else /* NBUF_MEMORY_DEBUG */
  1385. static inline void qdf_net_buf_debug_init(void) {}
  1386. static inline void qdf_net_buf_debug_exit(void) {}
  1387. static inline void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  1388. const char *func_name,
  1389. uint32_t line_num)
  1390. {
  1391. }
  1392. static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
  1393. {
  1394. }
  1395. static inline void
  1396. qdf_net_buf_debug_update_node(qdf_nbuf_t net_buf, const char *func_name,
  1397. uint32_t line_num)
  1398. {
  1399. }
  1400. /* Nbuf allocation rouines */
  1401. #define qdf_nbuf_alloc(osdev, size, reserve, align, prio) \
  1402. qdf_nbuf_alloc_fl(osdev, size, reserve, align, prio, \
  1403. __func__, __LINE__)
  1404. static inline qdf_nbuf_t
  1405. qdf_nbuf_alloc_fl(qdf_device_t osdev, qdf_size_t size, int reserve, int align,
  1406. int prio, const char *func, uint32_t line)
  1407. {
  1408. return __qdf_nbuf_alloc(osdev, size, reserve, align, prio, func, line);
  1409. }
  1410. static inline void qdf_nbuf_free(qdf_nbuf_t buf)
  1411. {
  1412. if (qdf_likely(buf))
  1413. __qdf_nbuf_free(buf);
  1414. }
  1415. /**
  1416. * qdf_nbuf_clone() - clone the nbuf (copy is readonly)
  1417. * @buf: Pointer to network buffer
  1418. *
  1419. * This function clones the nbuf and returns new sk_buff
  1420. * structure.
  1421. *
  1422. * Return: cloned skb
  1423. */
  1424. static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf)
  1425. {
  1426. return __qdf_nbuf_clone(buf);
  1427. }
  1428. /**
  1429. * qdf_nbuf_copy() - returns a private copy of the buf
  1430. * @buf: Pointer to network buffer
  1431. *
  1432. * This API returns a private copy of the buf, the buf returned is completely
  1433. * modifiable by callers
  1434. *
  1435. * Return: skb or NULL
  1436. */
  1437. static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf)
  1438. {
  1439. return __qdf_nbuf_copy(buf);
  1440. }
  1441. #endif /* NBUF_MEMORY_DEBUG */
  1442. #ifdef WLAN_FEATURE_FASTPATH
  1443. /**
  1444. * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state
  1445. *
  1446. * @buf: buf instance
  1447. * Return: data pointer of this buf where new data has to be
  1448. * put, or NULL if there is not enough room in this buf.
  1449. */
  1450. void qdf_nbuf_init_fast(qdf_nbuf_t nbuf);
  1451. #endif /* WLAN_FEATURE_FASTPATH */
  1452. /**
  1453. * @qdf_nbuf_list_free() - free a list of nbufs
  1454. * @buf_list: A list of nbufs to be freed
  1455. *
  1456. * Return: none
  1457. */
  1458. static inline void qdf_nbuf_list_free(qdf_nbuf_t buf_list)
  1459. {
  1460. while (buf_list) {
  1461. qdf_nbuf_t next = qdf_nbuf_next(buf_list);
  1462. qdf_nbuf_free(buf_list);
  1463. buf_list = next;
  1464. }
  1465. }
  1466. static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err)
  1467. {
  1468. qdf_nbuf_list_free(buf_list);
  1469. }
  1470. static inline void qdf_nbuf_ref(qdf_nbuf_t buf)
  1471. {
  1472. __qdf_nbuf_ref(buf);
  1473. }
  1474. static inline int qdf_nbuf_shared(qdf_nbuf_t buf)
  1475. {
  1476. return __qdf_nbuf_shared(buf);
  1477. }
  1478. static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src)
  1479. {
  1480. return __qdf_nbuf_cat(dst, src);
  1481. }
  1482. /**
  1483. * @qdf_nbuf_copy_bits() - return the length of the copy bits for skb
  1484. * @skb: SKB pointer
  1485. * @offset: offset
  1486. * @len: Length
  1487. * @to: To
  1488. *
  1489. * Return: int32_t
  1490. */
  1491. static inline int32_t
  1492. qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to)
  1493. {
  1494. return __qdf_nbuf_copy_bits(nbuf, offset, len, to);
  1495. }
  1496. /* nbuf manipulation routines */
  1497. /**
  1498. * @qdf_nbuf_head() - return the address of an nbuf's buffer
  1499. * @buf: netbuf
  1500. *
  1501. * Return: head address
  1502. */
  1503. static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf)
  1504. {
  1505. return __qdf_nbuf_head(buf);
  1506. }
  1507. /**
  1508. * qdf_nbuf_data() - Return the address of the start of data within an nbuf
  1509. * @buf: Network buffer
  1510. *
  1511. * Return: Data address
  1512. */
  1513. static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf)
  1514. {
  1515. return __qdf_nbuf_data(buf);
  1516. }
  1517. /**
  1518. * qdf_nbuf_data_addr() - Return the address of skb->data
  1519. * @buf: Network buffer
  1520. *
  1521. * Return: Data address
  1522. */
  1523. static inline uint8_t *qdf_nbuf_data_addr(qdf_nbuf_t buf)
  1524. {
  1525. return __qdf_nbuf_data_addr(buf);
  1526. }
  1527. /**
  1528. * qdf_nbuf_headroom() - amount of headroom int the current nbuf
  1529. * @buf: Network buffer
  1530. *
  1531. * Return: Amount of head room
  1532. */
  1533. static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf)
  1534. {
  1535. return __qdf_nbuf_headroom(buf);
  1536. }
  1537. /**
  1538. * qdf_nbuf_tailroom() - amount of tail space available
  1539. * @buf: Network buffer
  1540. *
  1541. * Return: amount of tail room
  1542. */
  1543. static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf)
  1544. {
  1545. return __qdf_nbuf_tailroom(buf);
  1546. }
  1547. /**
  1548. * qdf_nbuf_push_head() - push data in the front
  1549. * @buf: Network buf instance
  1550. * @size: Size to be pushed
  1551. *
  1552. * Return: New data pointer of this buf after data has been pushed,
  1553. * or NULL if there is not enough room in this buf.
  1554. */
  1555. static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size)
  1556. {
  1557. return __qdf_nbuf_push_head(buf, size);
  1558. }
  1559. /**
  1560. * qdf_nbuf_put_tail() - puts data in the end
  1561. * @buf: Network buf instance
  1562. * @size: Size to be pushed
  1563. *
  1564. * Return: Data pointer of this buf where new data has to be
  1565. * put, or NULL if there is not enough room in this buf.
  1566. */
  1567. static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size)
  1568. {
  1569. return __qdf_nbuf_put_tail(buf, size);
  1570. }
  1571. /**
  1572. * qdf_nbuf_pull_head() - pull data out from the front
  1573. * @buf: Network buf instance
  1574. * @size: Size to be popped
  1575. *
  1576. * Return: New data pointer of this buf after data has been popped,
  1577. * or NULL if there is not sufficient data to pull.
  1578. */
  1579. static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size)
  1580. {
  1581. return __qdf_nbuf_pull_head(buf, size);
  1582. }
  1583. /**
  1584. * qdf_nbuf_trim_tail() - trim data out from the end
  1585. * @buf: Network buf instance
  1586. * @size: Size to be popped
  1587. *
  1588. * Return: none
  1589. */
  1590. static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size)
  1591. {
  1592. __qdf_nbuf_trim_tail(buf, size);
  1593. }
  1594. /**
  1595. * qdf_nbuf_len() - get the length of the buf
  1596. * @buf: Network buf instance
  1597. *
  1598. * Return: total length of this buf.
  1599. */
  1600. static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf)
  1601. {
  1602. return __qdf_nbuf_len(buf);
  1603. }
  1604. /**
  1605. * qdf_nbuf_set_pktlen() - set the length of the buf
  1606. * @buf: Network buf instance
  1607. * @size: Size to be set
  1608. *
  1609. * Return: none
  1610. */
  1611. static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len)
  1612. {
  1613. __qdf_nbuf_set_pktlen(buf, len);
  1614. }
  1615. /**
  1616. * qdf_nbuf_reserve() - trim data out from the end
  1617. * @buf: Network buf instance
  1618. * @size: Size to be popped
  1619. *
  1620. * Return: none
  1621. */
  1622. static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size)
  1623. {
  1624. __qdf_nbuf_reserve(buf, size);
  1625. }
  1626. /**
  1627. * qdf_nbuf_set_data_pointer() - set data pointer
  1628. * @buf: Network buf instance
  1629. * @data: data pointer
  1630. *
  1631. * Return: none
  1632. */
  1633. static inline void qdf_nbuf_set_data_pointer(qdf_nbuf_t buf, uint8_t *data)
  1634. {
  1635. __qdf_nbuf_set_data_pointer(buf, data);
  1636. }
  1637. /**
  1638. * qdf_nbuf_set_len() - set data length
  1639. * @buf: Network buf instance
  1640. * @len: data length
  1641. * Return: none
  1642. */
  1643. static inline void qdf_nbuf_set_len(qdf_nbuf_t buf, uint32_t len)
  1644. {
  1645. __qdf_nbuf_set_len(buf, len);
  1646. }
  1647. /**
  1648. * qdf_nbuf_set_tail_pointer() - set data tail pointer
  1649. * @buf: Network buf instance
  1650. * @len: length of data
  1651. *
  1652. * Return: none
  1653. */
  1654. static inline void qdf_nbuf_set_tail_pointer(qdf_nbuf_t buf, int len)
  1655. {
  1656. __qdf_nbuf_set_tail_pointer(buf, len);
  1657. }
  1658. /**
  1659. * qdf_nbuf_reset() - reset the buffer data and pointer
  1660. * @buf: Network buf instance
  1661. * @reserve: reserve
  1662. * @align: align
  1663. *
  1664. * Return: none
  1665. */
  1666. static inline void qdf_nbuf_reset(qdf_nbuf_t buf, int reserve, int align)
  1667. {
  1668. __qdf_nbuf_reset(buf, reserve, align);
  1669. }
  1670. /**
  1671. * qdf_nbuf_dev_scratch_is_supported() - dev_scratch support for network buffer
  1672. * in kernel
  1673. *
  1674. * Return: true if dev_scratch is supported
  1675. * false if dev_scratch is not supported
  1676. */
  1677. static inline bool qdf_nbuf_is_dev_scratch_supported(void)
  1678. {
  1679. return __qdf_nbuf_is_dev_scratch_supported();
  1680. }
  1681. /**
  1682. * qdf_nbuf_get_dev_scratch() - get dev_scratch of network buffer
  1683. * @buf: Pointer to network buffer
  1684. *
  1685. * Return: dev_scratch if dev_scratch supported
  1686. * 0 if dev_scratch not supported
  1687. */
  1688. static inline unsigned long qdf_nbuf_get_dev_scratch(qdf_nbuf_t buf)
  1689. {
  1690. return __qdf_nbuf_get_dev_scratch(buf);
  1691. }
  1692. /**
  1693. * qdf_nbuf_set_dev_scratch() - set dev_scratch of network buffer
  1694. * @buf: Pointer to network buffer
  1695. * @value: value to be set in dev_scratch of network buffer
  1696. *
  1697. * Return: void
  1698. */
  1699. static inline void qdf_nbuf_set_dev_scratch(qdf_nbuf_t buf, unsigned long value)
  1700. {
  1701. __qdf_nbuf_set_dev_scratch(buf, value);
  1702. }
  1703. /**
  1704. * qdf_nbuf_peek_header() - return the data pointer & length of the header
  1705. * @buf: Network nbuf
  1706. * @addr: Data pointer
  1707. * @len: Length of the data
  1708. *
  1709. * Return: none
  1710. */
  1711. static inline void
  1712. qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len)
  1713. {
  1714. __qdf_nbuf_peek_header(buf, addr, len);
  1715. }
  1716. /* nbuf queue routines */
  1717. /**
  1718. * qdf_nbuf_queue_init() - initialize buf queue
  1719. * @head: Network buf queue head
  1720. *
  1721. * Return: none
  1722. */
  1723. static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head)
  1724. {
  1725. __qdf_nbuf_queue_init(head);
  1726. }
  1727. /**
  1728. * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue
  1729. * @head: Network buf queue head
  1730. * @buf: Network buf
  1731. *
  1732. * Return: none
  1733. */
  1734. static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  1735. {
  1736. __qdf_nbuf_queue_add(head, buf);
  1737. }
  1738. /**
  1739. * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue
  1740. * @head: Network buf queue head
  1741. * @buf: Network buf
  1742. *
  1743. * Return: none
  1744. */
  1745. static inline void
  1746. qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  1747. {
  1748. __qdf_nbuf_queue_insert_head(head, buf);
  1749. }
  1750. /**
  1751. * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue
  1752. * @head: Network buf queue head
  1753. *
  1754. * Return: The head buf in the buf queue.
  1755. */
  1756. static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head)
  1757. {
  1758. return __qdf_nbuf_queue_remove(head);
  1759. }
  1760. /**
  1761. * qdf_nbuf_queue_len() - get the length of the queue
  1762. * @head: Network buf queue head
  1763. *
  1764. * Return: length of the queue
  1765. */
  1766. static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head)
  1767. {
  1768. return __qdf_nbuf_queue_len(head);
  1769. }
  1770. /**
  1771. * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer
  1772. * @buf: Network buffer
  1773. *
  1774. * Return: next buffer/packet
  1775. */
  1776. static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf)
  1777. {
  1778. return __qdf_nbuf_queue_next(buf);
  1779. }
  1780. /**
  1781. * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty
  1782. * @nbq: Network buf queue handle
  1783. *
  1784. * Return: true if queue is empty
  1785. * false if queue is not emty
  1786. */
  1787. static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq)
  1788. {
  1789. return __qdf_nbuf_is_queue_empty(nbq);
  1790. }
  1791. static inline qdf_nbuf_queue_t *
  1792. qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src)
  1793. {
  1794. return __qdf_nbuf_queue_append(dest, src);
  1795. }
  1796. static inline void
  1797. qdf_nbuf_queue_free(qdf_nbuf_queue_t *head)
  1798. {
  1799. __qdf_nbuf_queue_free(head);
  1800. }
  1801. static inline qdf_nbuf_t
  1802. qdf_nbuf_queue_first(qdf_nbuf_queue_t *head)
  1803. {
  1804. return __qdf_nbuf_queue_first(head);
  1805. }
  1806. static inline qdf_nbuf_t
  1807. qdf_nbuf_queue_last(qdf_nbuf_queue_t *head)
  1808. {
  1809. return __qdf_nbuf_queue_last(head);
  1810. }
  1811. /**
  1812. * qdf_nbuf_get_protocol() - return the protocol value of the skb
  1813. * @skb: Pointer to network buffer
  1814. *
  1815. * Return: skb protocol
  1816. */
  1817. static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb)
  1818. {
  1819. return __qdf_nbuf_get_protocol(skb);
  1820. }
  1821. /**
  1822. * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb
  1823. * @skb: Pointer to network buffer
  1824. *
  1825. * Return: skb ip_summed
  1826. */
  1827. static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb)
  1828. {
  1829. return __qdf_nbuf_get_ip_summed(skb);
  1830. }
  1831. /**
  1832. * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb
  1833. * @skb: Pointer to network buffer
  1834. * @ip_summed: ip checksum
  1835. *
  1836. * Return: none
  1837. */
  1838. static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb,
  1839. uint8_t ip_summed)
  1840. {
  1841. __qdf_nbuf_set_ip_summed(skb, ip_summed);
  1842. }
  1843. /**
  1844. * qdf_nbuf_set_next() - add a packet to a linked list
  1845. * @this_buf: Predecessor buffer
  1846. * @next_buf: Successor buffer
  1847. *
  1848. * This function can be used to directly link nbufs, rather than using
  1849. * a separate network buffer queue object.
  1850. *
  1851. * Return: none
  1852. */
  1853. static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  1854. {
  1855. __qdf_nbuf_set_next(this_buf, next_buf);
  1856. }
  1857. /* nbuf extension routines */
  1858. /**
  1859. * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new
  1860. * nbuf
  1861. * @this_buf: predecessor buffer
  1862. * @next_buf: successor buffer
  1863. *
  1864. * This function is used to link up many nbufs containing a single logical
  1865. * packet - not a collection of packets. Do not use for linking the first
  1866. * extension to the head
  1867. *
  1868. * Return: none
  1869. */
  1870. static inline void
  1871. qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  1872. {
  1873. __qdf_nbuf_set_next_ext(this_buf, next_buf);
  1874. }
  1875. /**
  1876. * qdf_nbuf_next_ext() - get the next packet extension in the linked list
  1877. * @buf: Network buffer
  1878. *
  1879. * Return: Next network buffer in the linked list
  1880. */
  1881. static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf)
  1882. {
  1883. return __qdf_nbuf_next_ext(buf);
  1884. }
  1885. /**
  1886. * qdf_nbuf_append_ext_list() - link list of packet extensions to the head
  1887. * segment
  1888. * @head_buf: Network buf holding head segment (single)
  1889. * @ext_list: Network buf list holding linked extensions to the head
  1890. * @ext_len: Total length of all buffers in the extension list
  1891. *
  1892. * This function is used to link up a list of packet extensions (seg1, 2,
  1893. * ...) to the nbuf holding the head segment (seg0)
  1894. *
  1895. * Return: none
  1896. */
  1897. static inline void
  1898. qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list,
  1899. qdf_size_t ext_len)
  1900. {
  1901. __qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len);
  1902. }
  1903. /**
  1904. * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
  1905. * @head_buf: Network buf holding head segment (single)
  1906. *
  1907. * This ext_list is populated when we have Jumbo packet, for example in case of
  1908. * monitor mode amsdu packet reception, and are stiched using frags_list.
  1909. *
  1910. * Return: Network buf list holding linked extensions from head buf.
  1911. */
  1912. static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf)
  1913. {
  1914. return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf);
  1915. }
  1916. /**
  1917. * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
  1918. * @buf: Network buffer
  1919. *
  1920. * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame
  1921. */
  1922. static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf)
  1923. {
  1924. return __qdf_nbuf_get_tx_cksum(buf);
  1925. }
  1926. /**
  1927. * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to
  1928. * indicate checksum info to the stack.
  1929. * @buf: Network buffer
  1930. * @cksum: Checksum
  1931. *
  1932. * Return: none
  1933. */
  1934. static inline void
  1935. qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum)
  1936. {
  1937. __qdf_nbuf_set_rx_cksum(buf, cksum);
  1938. }
  1939. /**
  1940. * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf
  1941. * @buf: Network buffer
  1942. *
  1943. * Return: TID value
  1944. */
  1945. static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf)
  1946. {
  1947. return __qdf_nbuf_get_tid(buf);
  1948. }
  1949. /**
  1950. * qdf_nbuf_set_tid() - this function sets the TID value in nbuf
  1951. * @buf: Network buffer
  1952. * @tid: TID value
  1953. *
  1954. * Return: none
  1955. */
  1956. static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid)
  1957. {
  1958. __qdf_nbuf_set_tid(buf, tid);
  1959. }
  1960. /**
  1961. * qdf_nbuf_get_exemption_type() - this function extracts the exemption type
  1962. * from nbuf
  1963. * @buf: Network buffer
  1964. *
  1965. * Return: Exemption type
  1966. */
  1967. static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf)
  1968. {
  1969. return __qdf_nbuf_get_exemption_type(buf);
  1970. }
  1971. /**
  1972. * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given
  1973. * offset
  1974. * @buf: Network buffer
  1975. * @proto: Protocol
  1976. *
  1977. * Return: none
  1978. */
  1979. static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto)
  1980. {
  1981. __qdf_nbuf_set_protocol(buf, proto);
  1982. }
  1983. /**
  1984. * qdf_nbuf_trace_get_proto_type() - this function return packet proto type
  1985. * @buf: Network buffer
  1986. *
  1987. * Return: Packet protocol type
  1988. */
  1989. static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf)
  1990. {
  1991. return __qdf_nbuf_trace_get_proto_type(buf);
  1992. }
  1993. /**
  1994. * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback
  1995. * @cb_func_ptr: Callback pointer
  1996. *
  1997. * Return: none
  1998. */
  1999. static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr)
  2000. {
  2001. __qdf_nbuf_reg_trace_cb(cb_func_ptr);
  2002. }
  2003. /**
  2004. * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download
  2005. * @buf: Network buffer
  2006. * @candi: Candidate of parallel download frame
  2007. *
  2008. * This function stores a flag specifying this TX frame is suitable for
  2009. * downloading though a 2nd TX data pipe that is used for short frames for
  2010. * protocols that can accept out-of-order delivery.
  2011. *
  2012. * Return: none
  2013. */
  2014. static inline void
  2015. qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi)
  2016. {
  2017. __qdf_nbuf_set_tx_htt2_frm(buf, candi);
  2018. }
  2019. /**
  2020. * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download
  2021. * @buf: Network buffer
  2022. *
  2023. * This function return whether this TX frame is allow to download though a 2nd
  2024. * TX data pipe or not.
  2025. *
  2026. * Return: none
  2027. */
  2028. static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf)
  2029. {
  2030. return __qdf_nbuf_get_tx_htt2_frm(buf);
  2031. }
  2032. /**
  2033. * qdf_nbuf_get_dhcp_subtype() - get the subtype
  2034. * of DHCP packet.
  2035. * @buf: Pointer to DHCP packet buffer
  2036. *
  2037. * This func. returns the subtype of DHCP packet.
  2038. *
  2039. * Return: subtype of the DHCP packet.
  2040. */
  2041. static inline enum qdf_proto_subtype
  2042. qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf)
  2043. {
  2044. return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf));
  2045. }
  2046. /**
  2047. * qdf_nbuf_data_get_dhcp_subtype() - get the subtype
  2048. * of DHCP packet.
  2049. * @buf: Pointer to DHCP packet data buffer
  2050. *
  2051. * This func. returns the subtype of DHCP packet.
  2052. *
  2053. * Return: subtype of the DHCP packet.
  2054. */
  2055. static inline enum qdf_proto_subtype
  2056. qdf_nbuf_data_get_dhcp_subtype(uint8_t *data)
  2057. {
  2058. return __qdf_nbuf_data_get_dhcp_subtype(data);
  2059. }
  2060. /**
  2061. * qdf_nbuf_get_eapol_subtype() - get the subtype
  2062. * of EAPOL packet.
  2063. * @buf: Pointer to EAPOL packet buffer
  2064. *
  2065. * This func. returns the subtype of EAPOL packet.
  2066. *
  2067. * Return: subtype of the EAPOL packet.
  2068. */
  2069. static inline enum qdf_proto_subtype
  2070. qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf)
  2071. {
  2072. return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf));
  2073. }
  2074. /**
  2075. * qdf_nbuf_data_get_eapol_subtype() - get the subtype
  2076. * of EAPOL packet.
  2077. * @data: Pointer to EAPOL packet data buffer
  2078. *
  2079. * This func. returns the subtype of EAPOL packet.
  2080. *
  2081. * Return: subtype of the EAPOL packet.
  2082. */
  2083. static inline enum qdf_proto_subtype
  2084. qdf_nbuf_data_get_eapol_subtype(uint8_t *data)
  2085. {
  2086. return __qdf_nbuf_data_get_eapol_subtype(data);
  2087. }
  2088. /**
  2089. * qdf_nbuf_get_arp_subtype() - get the subtype
  2090. * of ARP packet.
  2091. * @buf: Pointer to ARP packet buffer
  2092. *
  2093. * This func. returns the subtype of ARP packet.
  2094. *
  2095. * Return: subtype of the ARP packet.
  2096. */
  2097. static inline enum qdf_proto_subtype
  2098. qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf)
  2099. {
  2100. return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf));
  2101. }
  2102. /**
  2103. * qdf_nbuf_data_get_arp_subtype() - get the subtype
  2104. * of ARP packet.
  2105. * @data: Pointer to ARP packet data buffer
  2106. *
  2107. * This func. returns the subtype of ARP packet.
  2108. *
  2109. * Return: subtype of the ARP packet.
  2110. */
  2111. static inline enum qdf_proto_subtype
  2112. qdf_nbuf_data_get_arp_subtype(uint8_t *data)
  2113. {
  2114. return __qdf_nbuf_data_get_arp_subtype(data);
  2115. }
  2116. /**
  2117. * qdf_nbuf_get_icmp_subtype() - get the subtype
  2118. * of IPV4 ICMP packet.
  2119. * @buf: Pointer to IPV4 ICMP packet buffer
  2120. *
  2121. * This func. returns the subtype of ICMP packet.
  2122. *
  2123. * Return: subtype of the ICMP packet.
  2124. */
  2125. static inline enum qdf_proto_subtype
  2126. qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf)
  2127. {
  2128. return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf));
  2129. }
  2130. /**
  2131. * qdf_nbuf_data_get_icmp_subtype() - get the subtype
  2132. * of IPV4 ICMP packet.
  2133. * @data: Pointer to IPV4 ICMP packet data buffer
  2134. *
  2135. * This func. returns the subtype of ICMP packet.
  2136. *
  2137. * Return: subtype of the ICMP packet.
  2138. */
  2139. static inline enum qdf_proto_subtype
  2140. qdf_nbuf_data_get_icmp_subtype(uint8_t *data)
  2141. {
  2142. return __qdf_nbuf_data_get_icmp_subtype(data);
  2143. }
  2144. /**
  2145. * qdf_nbuf_get_icmpv6_subtype() - get the subtype
  2146. * of IPV6 ICMPV6 packet.
  2147. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  2148. *
  2149. * This func. returns the subtype of ICMPV6 packet.
  2150. *
  2151. * Return: subtype of the ICMPV6 packet.
  2152. */
  2153. static inline enum qdf_proto_subtype
  2154. qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf)
  2155. {
  2156. return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf));
  2157. }
  2158. /**
  2159. * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype
  2160. * of IPV6 ICMPV6 packet.
  2161. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  2162. *
  2163. * This func. returns the subtype of ICMPV6 packet.
  2164. *
  2165. * Return: subtype of the ICMPV6 packet.
  2166. */
  2167. static inline enum qdf_proto_subtype
  2168. qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data)
  2169. {
  2170. return __qdf_nbuf_data_get_icmpv6_subtype(data);
  2171. }
  2172. /**
  2173. * qdf_nbuf_data_get_ipv4_proto() - get the proto type
  2174. * of IPV4 packet.
  2175. * @data: Pointer to IPV4 packet data buffer
  2176. *
  2177. * This func. returns the proto type of IPV4 packet.
  2178. *
  2179. * Return: proto type of IPV4 packet.
  2180. */
  2181. static inline uint8_t
  2182. qdf_nbuf_data_get_ipv4_proto(uint8_t *data)
  2183. {
  2184. return __qdf_nbuf_data_get_ipv4_proto(data);
  2185. }
  2186. /**
  2187. * qdf_nbuf_data_get_ipv6_proto() - get the proto type
  2188. * of IPV6 packet.
  2189. * @data: Pointer to IPV6 packet data buffer
  2190. *
  2191. * This func. returns the proto type of IPV6 packet.
  2192. *
  2193. * Return: proto type of IPV6 packet.
  2194. */
  2195. static inline uint8_t
  2196. qdf_nbuf_data_get_ipv6_proto(uint8_t *data)
  2197. {
  2198. return __qdf_nbuf_data_get_ipv6_proto(data);
  2199. }
  2200. /**
  2201. * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  2202. * @buf: buffer
  2203. *
  2204. * This api is for Tx packets.
  2205. *
  2206. * Return: true if packet is ipv4 packet
  2207. */
  2208. static inline
  2209. bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf)
  2210. {
  2211. return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf));
  2212. }
  2213. /**
  2214. * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  2215. * @data: data
  2216. *
  2217. * This api is for Tx packets.
  2218. *
  2219. * Return: true if packet is ipv4 packet
  2220. */
  2221. static inline
  2222. bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data)
  2223. {
  2224. return __qdf_nbuf_data_is_ipv4_pkt(data);
  2225. }
  2226. /**
  2227. * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not
  2228. * @buf: buffer
  2229. *
  2230. * This api is for ipv4 packet.
  2231. *
  2232. * Return: true if packet is DHCP packet
  2233. */
  2234. static inline
  2235. bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf)
  2236. {
  2237. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf));
  2238. }
  2239. /**
  2240. * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet.
  2241. * @data: Pointer to DHCP packet data buffer
  2242. *
  2243. * This func. checks whether it is a DHCP packet or not.
  2244. *
  2245. * Return: true if it is a DHCP packet
  2246. * false if not
  2247. */
  2248. static inline
  2249. bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data)
  2250. {
  2251. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data);
  2252. }
  2253. /**
  2254. * qdf_nbuf_data_is_ipv6_mdsn_pkt() - check if it is MDNS packet.
  2255. * @data: Pointer to packet data buffer
  2256. *
  2257. * This func. checks whether it is a MDNS packet or not.
  2258. *
  2259. * Return: true if it is a MDNS packet, false if not
  2260. */
  2261. static inline
  2262. bool qdf_nbuf_is_ipv6_mdns_pkt(qdf_nbuf_t buf)
  2263. {
  2264. return __qdf_nbuf_data_is_ipv6_mdns_pkt(qdf_nbuf_data(buf));
  2265. }
  2266. /**
  2267. * qdf_nbuf_data_is_ipv6_dhcp_pkt() - check if it is DHCP packet.
  2268. * @data: Pointer to DHCP packet data buffer
  2269. *
  2270. * This func. checks whether it is a DHCP packet or not.
  2271. *
  2272. * Return: true if it is a DHCP packet
  2273. * false if not
  2274. */
  2275. static inline
  2276. bool qdf_nbuf_is_ipv6_dhcp_pkt(qdf_nbuf_t buf)
  2277. {
  2278. return __qdf_nbuf_data_is_ipv6_dhcp_pkt(qdf_nbuf_data(buf));
  2279. }
  2280. /**
  2281. * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not
  2282. * @buf: buffer
  2283. *
  2284. * This api is for ipv4 packet.
  2285. *
  2286. * Return: true if packet is EAPOL packet
  2287. */
  2288. static inline
  2289. bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf)
  2290. {
  2291. return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf));
  2292. }
  2293. /**
  2294. * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet.
  2295. * @data: Pointer to EAPOL packet data buffer
  2296. *
  2297. * This func. checks whether it is a EAPOL packet or not.
  2298. *
  2299. * Return: true if it is a EAPOL packet
  2300. * false if not
  2301. */
  2302. static inline
  2303. bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data)
  2304. {
  2305. return __qdf_nbuf_data_is_ipv4_eapol_pkt(data);
  2306. }
  2307. /**
  2308. * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not
  2309. * @buf: buffer
  2310. *
  2311. * This api is for ipv4 packet.
  2312. *
  2313. * Return: true if packet is WAPI packet
  2314. */
  2315. static inline
  2316. bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf)
  2317. {
  2318. return __qdf_nbuf_is_ipv4_wapi_pkt(buf);
  2319. }
  2320. /**
  2321. * qdf_nbuf_is_ipv4_tdls_pkt() - check if packet is a tdls packet or not
  2322. * @buf: buffer
  2323. *
  2324. * This api is for ipv4 packet.
  2325. *
  2326. * Return: true if packet is TDLS packet
  2327. */
  2328. static inline
  2329. bool qdf_nbuf_is_ipv4_tdls_pkt(qdf_nbuf_t buf)
  2330. {
  2331. return __qdf_nbuf_is_ipv4_tdls_pkt(buf);
  2332. }
  2333. /**
  2334. * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not
  2335. * @buf: buffer
  2336. *
  2337. * This api is for ipv4 packet.
  2338. *
  2339. * Return: true if packet is ARP packet
  2340. */
  2341. static inline
  2342. bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf)
  2343. {
  2344. return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf));
  2345. }
  2346. /**
  2347. * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet.
  2348. * @data: Pointer to ARP packet data buffer
  2349. *
  2350. * This func. checks whether it is a ARP packet or not.
  2351. *
  2352. * Return: TRUE if it is a ARP packet
  2353. * FALSE if not
  2354. */
  2355. static inline
  2356. bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data)
  2357. {
  2358. return __qdf_nbuf_data_is_ipv4_arp_pkt(data);
  2359. }
  2360. /**
  2361. * qdf_nbuf_data_is_arp_req() - check if ARP packet is request.
  2362. * @buf: buffer
  2363. *
  2364. * This func. checks whether it is a ARP request or not.
  2365. *
  2366. * Return: true if it is a ARP request or FALSE if not
  2367. */
  2368. static inline
  2369. bool qdf_nbuf_data_is_arp_req(qdf_nbuf_t buf)
  2370. {
  2371. return __qdf_nbuf_data_is_arp_req(qdf_nbuf_data(buf));
  2372. }
  2373. /**
  2374. * qdf_nbuf_data_is_arp_rsp() - check if ARP packet is response.
  2375. * @buf: buffer
  2376. *
  2377. * This func. checks whether it is a ARP response or not.
  2378. *
  2379. * Return: true if it is a ARP response or FALSE if not
  2380. */
  2381. static inline
  2382. bool qdf_nbuf_data_is_arp_rsp(qdf_nbuf_t buf)
  2383. {
  2384. return __qdf_nbuf_data_is_arp_rsp(qdf_nbuf_data(buf));
  2385. }
  2386. /**
  2387. * qdf_nbuf_data_get_arp_src_ip() - get ARP packet source IP gateway.
  2388. * @buf: buffer
  2389. *
  2390. * Return: ARP packet source IP value.
  2391. */
  2392. static inline
  2393. uint32_t qdf_nbuf_get_arp_src_ip(qdf_nbuf_t buf)
  2394. {
  2395. return __qdf_nbuf_get_arp_src_ip(qdf_nbuf_data(buf));
  2396. }
  2397. /**
  2398. * qdf_nbuf_data_get_arp_tgt_ip() - get ARP packet target IP gateway.
  2399. * @buf: buffer
  2400. *
  2401. * Return: ARP packet target IP value.
  2402. */
  2403. static inline
  2404. uint32_t qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_t buf)
  2405. {
  2406. return __qdf_nbuf_get_arp_tgt_ip(qdf_nbuf_data(buf));
  2407. }
  2408. /**
  2409. * qdf_nbuf_get_dns_domain_name() - get dns domain name of required length
  2410. * @buf: buffer
  2411. * @len: length to copy
  2412. *
  2413. * Return: dns domain name
  2414. */
  2415. static inline
  2416. uint8_t *qdf_nbuf_get_dns_domain_name(qdf_nbuf_t buf, uint32_t len)
  2417. {
  2418. return __qdf_nbuf_get_dns_domain_name(qdf_nbuf_data(buf), len);
  2419. }
  2420. /**
  2421. * qdf_nbuf_data_is_dns_query() - check if skb data is a dns query
  2422. * @buf: buffer
  2423. *
  2424. * Return: true if packet is dns query packet.
  2425. * false otherwise.
  2426. */
  2427. static inline
  2428. bool qdf_nbuf_data_is_dns_query(qdf_nbuf_t buf)
  2429. {
  2430. return __qdf_nbuf_data_is_dns_query(qdf_nbuf_data(buf));
  2431. }
  2432. /**
  2433. * qdf_nbuf_data_is_dns_response() - check if skb data is a dns response
  2434. * @buf: buffer
  2435. *
  2436. * Return: true if packet is dns response packet.
  2437. * false otherwise.
  2438. */
  2439. static inline
  2440. bool qdf_nbuf_data_is_dns_response(qdf_nbuf_t buf)
  2441. {
  2442. return __qdf_nbuf_data_is_dns_response(qdf_nbuf_data(buf));
  2443. }
  2444. /**
  2445. * qdf_nbuf_data_is_tcp_syn() - check if skb data is a tcp syn
  2446. * @buf: buffer
  2447. *
  2448. * Return: true if packet is tcp syn packet.
  2449. * false otherwise.
  2450. */
  2451. static inline
  2452. bool qdf_nbuf_data_is_tcp_syn(qdf_nbuf_t buf)
  2453. {
  2454. return __qdf_nbuf_data_is_tcp_syn(qdf_nbuf_data(buf));
  2455. }
  2456. /**
  2457. * qdf_nbuf_data_is_tcp_syn_ack() - check if skb data is a tcp syn ack
  2458. * @buf: buffer
  2459. *
  2460. * Return: true if packet is tcp syn ack packet.
  2461. * false otherwise.
  2462. */
  2463. static inline
  2464. bool qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_t buf)
  2465. {
  2466. return __qdf_nbuf_data_is_tcp_syn_ack(qdf_nbuf_data(buf));
  2467. }
  2468. /**
  2469. * qdf_nbuf_data_is_tcp_ack() - check if skb data is a tcp ack
  2470. * @buf: buffer
  2471. *
  2472. * Return: true if packet is tcp ack packet.
  2473. * false otherwise.
  2474. */
  2475. static inline
  2476. bool qdf_nbuf_data_is_tcp_ack(qdf_nbuf_t buf)
  2477. {
  2478. return __qdf_nbuf_data_is_tcp_ack(qdf_nbuf_data(buf));
  2479. }
  2480. /**
  2481. * qdf_nbuf_data_get_tcp_src_port() - get tcp src port
  2482. * @buf: buffer
  2483. *
  2484. * Return: tcp source port value.
  2485. */
  2486. static inline
  2487. uint16_t qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_t buf)
  2488. {
  2489. return __qdf_nbuf_data_get_tcp_src_port(qdf_nbuf_data(buf));
  2490. }
  2491. /**
  2492. * qdf_nbuf_data_get_tcp_dst_port() - get tcp dst port
  2493. * @buf: buffer
  2494. *
  2495. * Return: tcp destination port value.
  2496. */
  2497. static inline
  2498. uint16_t qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_t buf)
  2499. {
  2500. return __qdf_nbuf_data_get_tcp_dst_port(qdf_nbuf_data(buf));
  2501. }
  2502. /**
  2503. * qdf_nbuf_data_is_icmpv4_req() - check if ICMPv4 packet is request.
  2504. * @buf: buffer
  2505. *
  2506. * This func. checks whether it is a ICMPv4 request or not.
  2507. *
  2508. * Return: true if it is a ICMPv4 request or fALSE if not
  2509. */
  2510. static inline
  2511. bool qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_t buf)
  2512. {
  2513. return __qdf_nbuf_data_is_icmpv4_req(qdf_nbuf_data(buf));
  2514. }
  2515. /**
  2516. * qdf_nbuf_data_is_icmpv4_rsp() - check if ICMPv4 packet is res
  2517. * @buf: buffer
  2518. *
  2519. * Return: true if packet is icmpv4 response
  2520. * false otherwise.
  2521. */
  2522. static inline
  2523. bool qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_t buf)
  2524. {
  2525. return __qdf_nbuf_data_is_icmpv4_rsp(qdf_nbuf_data(buf));
  2526. }
  2527. /**
  2528. * qdf_nbuf_get_icmpv4_src_ip() - get icmpv4 src IP
  2529. * @buf: buffer
  2530. *
  2531. * Return: icmpv4 packet source IP value.
  2532. */
  2533. static inline
  2534. uint32_t qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_t buf)
  2535. {
  2536. return __qdf_nbuf_get_icmpv4_src_ip(qdf_nbuf_data(buf));
  2537. }
  2538. /**
  2539. * qdf_nbuf_data_get_icmpv4_tgt_ip() - get icmpv4 target IP
  2540. * @buf: buffer
  2541. *
  2542. * Return: icmpv4 packet target IP value.
  2543. */
  2544. static inline
  2545. uint32_t qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_t buf)
  2546. {
  2547. return __qdf_nbuf_get_icmpv4_tgt_ip(qdf_nbuf_data(buf));
  2548. }
  2549. /**
  2550. * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet.
  2551. * @buf: Pointer to IPV6 packet buffer
  2552. *
  2553. * This func. checks whether it is a IPV6 packet or not.
  2554. *
  2555. * Return: TRUE if it is a IPV6 packet
  2556. * FALSE if not
  2557. */
  2558. static inline
  2559. bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf)
  2560. {
  2561. return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf));
  2562. }
  2563. /**
  2564. * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet.
  2565. * @data: Pointer to IPV6 packet data buffer
  2566. *
  2567. * This func. checks whether it is a IPV6 packet or not.
  2568. *
  2569. * Return: TRUE if it is a IPV6 packet
  2570. * FALSE if not
  2571. */
  2572. static inline
  2573. bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data)
  2574. {
  2575. return __qdf_nbuf_data_is_ipv6_pkt(data);
  2576. }
  2577. /**
  2578. * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet.
  2579. * @data: Pointer to IPV4 packet data buffer
  2580. *
  2581. * This func. checks whether it is a IPV4 multicast packet or not.
  2582. *
  2583. * Return: TRUE if it is a IPV4 multicast packet
  2584. * FALSE if not
  2585. */
  2586. static inline
  2587. bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data)
  2588. {
  2589. return __qdf_nbuf_data_is_ipv4_mcast_pkt(data);
  2590. }
  2591. /**
  2592. * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet.
  2593. * @data: Pointer to IPV6 packet data buffer
  2594. *
  2595. * This func. checks whether it is a IPV6 multicast packet or not.
  2596. *
  2597. * Return: TRUE if it is a IPV6 multicast packet
  2598. * FALSE if not
  2599. */
  2600. static inline
  2601. bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data)
  2602. {
  2603. return __qdf_nbuf_data_is_ipv6_mcast_pkt(data);
  2604. }
  2605. /**
  2606. * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  2607. * @buf: Pointer to IPV4 ICMP packet buffer
  2608. *
  2609. * This func. checks whether it is a ICMP packet or not.
  2610. *
  2611. * Return: TRUE if it is a ICMP packet
  2612. * FALSE if not
  2613. */
  2614. static inline
  2615. bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf)
  2616. {
  2617. return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf));
  2618. }
  2619. /**
  2620. * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  2621. * @data: Pointer to IPV4 ICMP packet data buffer
  2622. *
  2623. * This func. checks whether it is a ICMP packet or not.
  2624. *
  2625. * Return: TRUE if it is a ICMP packet
  2626. * FALSE if not
  2627. */
  2628. static inline
  2629. bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data)
  2630. {
  2631. return __qdf_nbuf_data_is_icmp_pkt(data);
  2632. }
  2633. /**
  2634. * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  2635. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  2636. *
  2637. * This func. checks whether it is a ICMPV6 packet or not.
  2638. *
  2639. * Return: TRUE if it is a ICMPV6 packet
  2640. * FALSE if not
  2641. */
  2642. static inline
  2643. bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf)
  2644. {
  2645. return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf));
  2646. }
  2647. /**
  2648. * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  2649. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  2650. *
  2651. * This func. checks whether it is a ICMPV6 packet or not.
  2652. *
  2653. * Return: TRUE if it is a ICMPV6 packet
  2654. * FALSE if not
  2655. */
  2656. static inline
  2657. bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data)
  2658. {
  2659. return __qdf_nbuf_data_is_icmpv6_pkt(data);
  2660. }
  2661. /**
  2662. * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  2663. * @buf: Pointer to IPV4 UDP packet buffer
  2664. *
  2665. * This func. checks whether it is a IPV4 UDP packet or not.
  2666. *
  2667. * Return: TRUE if it is a IPV4 UDP packet
  2668. * FALSE if not
  2669. */
  2670. static inline
  2671. bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf)
  2672. {
  2673. return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf));
  2674. }
  2675. /**
  2676. * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  2677. * @data: Pointer to IPV4 UDP packet data buffer
  2678. *
  2679. * This func. checks whether it is a IPV4 UDP packet or not.
  2680. *
  2681. * Return: TRUE if it is a IPV4 UDP packet
  2682. * FALSE if not
  2683. */
  2684. static inline
  2685. bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data)
  2686. {
  2687. return __qdf_nbuf_data_is_ipv4_udp_pkt(data);
  2688. }
  2689. /**
  2690. * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  2691. * @buf: Pointer to IPV4 TCP packet buffer
  2692. *
  2693. * This func. checks whether it is a IPV4 TCP packet or not.
  2694. *
  2695. * Return: TRUE if it is a IPV4 TCP packet
  2696. * FALSE if not
  2697. */
  2698. static inline
  2699. bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf)
  2700. {
  2701. return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf));
  2702. }
  2703. /**
  2704. * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  2705. * @data: Pointer to IPV4 TCP packet data buffer
  2706. *
  2707. * This func. checks whether it is a IPV4 TCP packet or not.
  2708. *
  2709. * Return: TRUE if it is a IPV4 TCP packet
  2710. * FALSE if not
  2711. */
  2712. static inline
  2713. bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data)
  2714. {
  2715. return __qdf_nbuf_data_is_ipv4_tcp_pkt(data);
  2716. }
  2717. /**
  2718. * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  2719. * @buf: Pointer to IPV6 UDP packet buffer
  2720. *
  2721. * This func. checks whether it is a IPV6 UDP packet or not.
  2722. *
  2723. * Return: TRUE if it is a IPV6 UDP packet
  2724. * FALSE if not
  2725. */
  2726. static inline
  2727. bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf)
  2728. {
  2729. return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf));
  2730. }
  2731. /**
  2732. * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  2733. * @data: Pointer to IPV6 UDP packet data buffer
  2734. *
  2735. * This func. checks whether it is a IPV6 UDP packet or not.
  2736. *
  2737. * Return: TRUE if it is a IPV6 UDP packet
  2738. * FALSE if not
  2739. */
  2740. static inline
  2741. bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data)
  2742. {
  2743. return __qdf_nbuf_data_is_ipv6_udp_pkt(data);
  2744. }
  2745. /**
  2746. * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  2747. * @buf: Pointer to IPV6 TCP packet buffer
  2748. *
  2749. * This func. checks whether it is a IPV6 TCP packet or not.
  2750. *
  2751. * Return: TRUE if it is a IPV6 TCP packet
  2752. * FALSE if not
  2753. */
  2754. static inline
  2755. bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf)
  2756. {
  2757. return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf));
  2758. }
  2759. /**
  2760. * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  2761. * @data: Pointer to IPV6 TCP packet data buffer
  2762. *
  2763. * This func. checks whether it is a IPV6 TCP packet or not.
  2764. *
  2765. * Return: TRUE if it is a IPV6 TCP packet
  2766. * FALSE if not
  2767. */
  2768. static inline
  2769. bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data)
  2770. {
  2771. return __qdf_nbuf_data_is_ipv6_tcp_pkt(data);
  2772. }
  2773. /**
  2774. * qdf_nbuf_is_bcast_pkt() - check if it is broadcast packet.
  2775. * @buf: Network buffer
  2776. *
  2777. * This func. checks whether packet is broadcast or not.
  2778. *
  2779. * Return: TRUE if it is broadcast packet
  2780. * FALSE if not
  2781. */
  2782. static inline
  2783. bool qdf_nbuf_is_bcast_pkt(qdf_nbuf_t buf)
  2784. {
  2785. return __qdf_nbuf_is_bcast_pkt(buf);
  2786. }
  2787. /**
  2788. * qdf_nbuf_reset_num_frags() - decrement the number of fragments
  2789. * @buf: Network buffer
  2790. *
  2791. * Return: Number of fragments
  2792. */
  2793. static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf)
  2794. {
  2795. __qdf_nbuf_reset_num_frags(buf);
  2796. }
  2797. /**
  2798. * qdf_dmaaddr_to_32s - return high and low parts of dma_addr
  2799. *
  2800. * Returns the high and low 32-bits of the DMA addr in the provided ptrs
  2801. *
  2802. * Return: N/A
  2803. */
  2804. static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
  2805. uint32_t *lo, uint32_t *hi)
  2806. {
  2807. return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi);
  2808. }
  2809. /**
  2810. * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO
  2811. * network buffer into segments
  2812. * @nbuf: network buffer to be segmented
  2813. * @tso_info: This is the output. The information about the
  2814. * TSO segments will be populated within this.
  2815. *
  2816. * This function fragments a TCP jumbo packet into smaller
  2817. * segments to be transmitted by the driver. It chains the TSO
  2818. * segments created into a list.
  2819. *
  2820. * Return: number of TSO segments
  2821. */
  2822. static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev,
  2823. qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info)
  2824. {
  2825. return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info);
  2826. }
  2827. /**
  2828. * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element
  2829. *
  2830. * @osdev: qdf device handle
  2831. * @tso_seg: TSO segment element to be unmapped
  2832. * @is_last_seg: whether this is last tso seg or not
  2833. *
  2834. * Return: none
  2835. */
  2836. static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev,
  2837. struct qdf_tso_seg_elem_t *tso_seg,
  2838. bool is_last_seg)
  2839. {
  2840. return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg);
  2841. }
  2842. /**
  2843. * qdf_nbuf_get_tso_num_seg() - function to calculate the number
  2844. * of TCP segments within the TSO jumbo packet
  2845. * @nbuf: TSO jumbo network buffer to be segmented
  2846. *
  2847. * This function calculates the number of TCP segments that the
  2848. network buffer can be divided into.
  2849. *
  2850. * Return: number of TCP segments
  2851. */
  2852. static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf)
  2853. {
  2854. return __qdf_nbuf_get_tso_num_seg(nbuf);
  2855. }
  2856. /**
  2857. * qdf_nbuf_inc_users() - function to increment the number of
  2858. * users referencing this network buffer
  2859. *
  2860. * @nbuf: network buffer
  2861. *
  2862. * This function increments the number of users referencing this
  2863. * network buffer
  2864. *
  2865. * Return: the network buffer
  2866. */
  2867. static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf)
  2868. {
  2869. return __qdf_nbuf_inc_users(nbuf);
  2870. }
  2871. /**
  2872. * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb
  2873. *
  2874. * @nbuf: Network buffer (skb on linux)
  2875. *
  2876. * This function returns the values of data_attr field
  2877. * in struct cvg_nbuf_cb{}, to which skb->cb is typecast.
  2878. * This value is actually the value programmed in CE descriptor.
  2879. *
  2880. * Return: Value of data_attr
  2881. */
  2882. static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf)
  2883. {
  2884. return __qdf_nbuf_data_attr_get(buf);
  2885. }
  2886. /**
  2887. * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb
  2888. *
  2889. * @nbuf: Network buffer (skb on linux)
  2890. * @data_attr: Value to be stored cvg_nbuf_cb->data_attr
  2891. *
  2892. * This function stores the value to be programmed in CE
  2893. * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{}
  2894. *
  2895. * Return: void
  2896. */
  2897. static inline
  2898. void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr)
  2899. {
  2900. __qdf_nbuf_data_attr_set(buf, data_attr);
  2901. }
  2902. /**
  2903. * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata
  2904. *
  2905. * @nbuf: Network buffer (skb on linux)
  2906. *
  2907. * This function parses the payload to figure out relevant
  2908. * Tx meta-data e.g. whether to enable tx_classify bit
  2909. * in CE.
  2910. *
  2911. * Return: void
  2912. */
  2913. #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get
  2914. void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state);
  2915. void qdf_nbuf_tx_desc_count_display(void);
  2916. void qdf_nbuf_tx_desc_count_clear(void);
  2917. static inline qdf_nbuf_t
  2918. qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom)
  2919. {
  2920. return __qdf_nbuf_realloc_headroom(buf, headroom);
  2921. }
  2922. static inline qdf_nbuf_t
  2923. qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom)
  2924. {
  2925. return __qdf_nbuf_realloc_tailroom(buf, tailroom);
  2926. }
  2927. static inline qdf_nbuf_t
  2928. qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom)
  2929. {
  2930. return __qdf_nbuf_expand(buf, headroom, tailroom);
  2931. }
  2932. static inline int
  2933. qdf_nbuf_linearize(qdf_nbuf_t buf)
  2934. {
  2935. return __qdf_nbuf_linearize(buf);
  2936. }
  2937. #ifdef NBUF_MEMORY_DEBUG
  2938. #define qdf_nbuf_unshare(d) \
  2939. qdf_nbuf_unshare_debug(d, __func__, __LINE__)
  2940. static inline qdf_nbuf_t
  2941. qdf_nbuf_unshare_debug(qdf_nbuf_t buf, const char *func_name, uint32_t line_num)
  2942. {
  2943. qdf_nbuf_t unshared_buf;
  2944. unshared_buf = __qdf_nbuf_unshare(buf);
  2945. if (qdf_likely(buf != unshared_buf)) {
  2946. qdf_net_buf_debug_delete_node(buf);
  2947. qdf_net_buf_debug_add_node(unshared_buf, 0,
  2948. func_name, line_num);
  2949. }
  2950. return unshared_buf;
  2951. }
  2952. #else
  2953. static inline qdf_nbuf_t
  2954. qdf_nbuf_unshare(qdf_nbuf_t buf)
  2955. {
  2956. return __qdf_nbuf_unshare(buf);
  2957. }
  2958. #endif
  2959. static inline bool
  2960. qdf_nbuf_is_cloned(qdf_nbuf_t buf)
  2961. {
  2962. return __qdf_nbuf_is_cloned(buf);
  2963. }
  2964. static inline void
  2965. qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg)
  2966. {
  2967. __qdf_nbuf_frag_info(buf, sg);
  2968. }
  2969. static inline qdf_nbuf_tx_cksum_t
  2970. qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where)
  2971. {
  2972. return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where);
  2973. }
  2974. static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf)
  2975. {
  2976. __qdf_nbuf_reset_ctxt(nbuf);
  2977. }
  2978. static inline void qdf_nbuf_init(qdf_nbuf_t buf)
  2979. {
  2980. __qdf_nbuf_init(buf);
  2981. }
  2982. static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf)
  2983. {
  2984. return __qdf_nbuf_network_header(buf);
  2985. }
  2986. static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf)
  2987. {
  2988. return __qdf_nbuf_transport_header(buf);
  2989. }
  2990. static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf)
  2991. {
  2992. return __qdf_nbuf_tcp_tso_size(buf);
  2993. }
  2994. static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf)
  2995. {
  2996. return __qdf_nbuf_get_cb(nbuf);
  2997. }
  2998. static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf)
  2999. {
  3000. return __qdf_nbuf_get_nr_frags(nbuf);
  3001. }
  3002. static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf)
  3003. {
  3004. return __qdf_nbuf_headlen(buf);
  3005. }
  3006. static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev,
  3007. qdf_nbuf_t buf, int offset,
  3008. qdf_dma_dir_t dir, int cur_frag)
  3009. {
  3010. return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag);
  3011. }
  3012. static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf)
  3013. {
  3014. return __qdf_nbuf_tso_tcp_v4(buf);
  3015. }
  3016. static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf)
  3017. {
  3018. return __qdf_nbuf_tso_tcp_v6(buf);
  3019. }
  3020. static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf)
  3021. {
  3022. return __qdf_nbuf_tcp_seq(buf);
  3023. }
  3024. static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf)
  3025. {
  3026. return __qdf_nbuf_l2l3l4_hdr_len(buf);
  3027. }
  3028. static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf)
  3029. {
  3030. return __qdf_nbuf_is_nonlinear(buf);
  3031. }
  3032. static inline uint32_t
  3033. qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num)
  3034. {
  3035. return __qdf_nbuf_get_frag_size(buf, frag_num);
  3036. }
  3037. static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf)
  3038. {
  3039. return __qdf_nbuf_get_priority(buf);
  3040. }
  3041. static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p)
  3042. {
  3043. __qdf_nbuf_set_priority(buf, p);
  3044. }
  3045. static inline void qdf_nbuf_record_rx_queue(qdf_nbuf_t buf, uint32_t queue_id)
  3046. {
  3047. __qdf_nbuf_record_rx_queue(buf, queue_id);
  3048. }
  3049. static inline uint16_t
  3050. qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf)
  3051. {
  3052. return __qdf_nbuf_get_queue_mapping(buf);
  3053. }
  3054. static inline uint8_t *
  3055. qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf)
  3056. {
  3057. return __qdf_nbuf_get_priv_ptr(buf);
  3058. }
  3059. /**
  3060. * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf.
  3061. * @rx_status: rx_status containing required info to update radiotap
  3062. * @nbuf: Pointer to nbuf
  3063. * @headroom_sz: Available headroom size
  3064. *
  3065. * Return: radiotap length.
  3066. */
  3067. unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status,
  3068. qdf_nbuf_t nbuf, uint32_t headroom_sz);
  3069. /**
  3070. * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame.
  3071. * @buf: Pointer to nbuf
  3072. *
  3073. * Return: None
  3074. */
  3075. static inline void
  3076. qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf)
  3077. {
  3078. __qdf_nbuf_mark_wakeup_frame(buf);
  3079. }
  3080. /**
  3081. * qdf_nbuf_reg_free_cb - Registers nbuf free callback
  3082. * @cb_func_ptr: Callback pointer
  3083. *
  3084. * This function registers nbuf free callback
  3085. *
  3086. * Return: void
  3087. */
  3088. static inline void
  3089. qdf_nbuf_reg_free_cb(qdf_nbuf_free_t cb_func_ptr)
  3090. {
  3091. __qdf_nbuf_reg_free_cb(cb_func_ptr);
  3092. }
  3093. /**
  3094. * qdf_nbuf_set_timestamp() - set the timestamp for frame
  3095. *
  3096. * @buf: sk buff
  3097. *
  3098. * Return: void
  3099. */
  3100. static inline void
  3101. qdf_nbuf_set_timestamp(struct sk_buff *skb)
  3102. {
  3103. __qdf_nbuf_set_timestamp(skb);
  3104. }
  3105. /**
  3106. * qdf_nbuf_get_timestamp() - get the timestamp for frame
  3107. *
  3108. * @buf: sk buff
  3109. *
  3110. * Return: timestamp stored in skb in ms
  3111. */
  3112. static inline uint64_t
  3113. qdf_nbuf_get_timestamp(struct sk_buff *skb)
  3114. {
  3115. return __qdf_nbuf_get_timestamp(skb);
  3116. }
  3117. /**
  3118. * qdf_nbuf_get_timedelta_ms() - get time difference in ms
  3119. *
  3120. * @buf: sk buff
  3121. *
  3122. * Return: time difference ms
  3123. */
  3124. static inline uint64_t
  3125. qdf_nbuf_get_timedelta_ms(struct sk_buff *skb)
  3126. {
  3127. return __qdf_nbuf_get_timedelta_ms(skb);
  3128. }
  3129. /**
  3130. * qdf_nbuf_get_timedelta_us() - get time difference in micro seconds
  3131. *
  3132. * @buf: sk buff
  3133. *
  3134. * Return: time difference in micro seconds
  3135. */
  3136. static inline uint64_t
  3137. qdf_nbuf_get_timedelta_us(struct sk_buff *skb)
  3138. {
  3139. return __qdf_nbuf_get_timedelta_us(skb);
  3140. }
  3141. /**
  3142. * qdf_nbuf_count_get() - get global nbuf gauge
  3143. *
  3144. * Return: global nbuf gauge
  3145. */
  3146. static inline int qdf_nbuf_count_get(void)
  3147. {
  3148. return __qdf_nbuf_count_get();
  3149. }
  3150. /**
  3151. * qdf_nbuf_count_inc() - increment nbuf global count
  3152. *
  3153. * @buf: sk buff
  3154. *
  3155. * Return: void
  3156. */
  3157. static inline void qdf_nbuf_count_inc(qdf_nbuf_t buf)
  3158. {
  3159. return __qdf_nbuf_count_inc(buf);
  3160. }
  3161. /**
  3162. * qdf_nbuf_count_dec() - decrement nbuf global count
  3163. *
  3164. * @buf: sk buff
  3165. *
  3166. * Return: void
  3167. */
  3168. static inline void qdf_nbuf_count_dec(qdf_nbuf_t buf)
  3169. {
  3170. return __qdf_nbuf_count_dec(buf);
  3171. }
  3172. /**
  3173. * qdf_nbuf_mod_init() - Intialization routine for qdf_nbuf
  3174. *
  3175. * Return void
  3176. */
  3177. static inline void qdf_nbuf_mod_init(void)
  3178. {
  3179. return __qdf_nbuf_mod_init();
  3180. }
  3181. /**
  3182. * qdf_nbuf_mod_init() - Unintialization routine for qdf_nbuf
  3183. *
  3184. * Return void
  3185. */
  3186. static inline void qdf_nbuf_mod_exit(void)
  3187. {
  3188. return __qdf_nbuf_mod_exit();
  3189. }
  3190. /**
  3191. * qdf_nbuf_orphan() - orphan a nbuf
  3192. * @buf: Pointer to network buffer
  3193. *
  3194. * If a buffer currently has an owner then we call the
  3195. * owner's destructor function
  3196. *
  3197. * Return: void
  3198. */
  3199. static inline void qdf_nbuf_orphan(qdf_nbuf_t buf)
  3200. {
  3201. return __qdf_nbuf_orphan(buf);
  3202. }
  3203. #ifdef CONFIG_NBUF_AP_PLATFORM
  3204. #include <i_qdf_nbuf_api_w.h>
  3205. #else
  3206. #include <i_qdf_nbuf_api_m.h>
  3207. #endif
  3208. #endif /* _QDF_NBUF_H */