qdf_nbuf.h 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320
  1. /*
  2. * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /**
  27. * DOC: qdf_nbuf_public network buffer API
  28. * This file defines the network buffer abstraction.
  29. */
  30. #ifndef _QDF_NBUF_H
  31. #define _QDF_NBUF_H
  32. #include <qdf_util.h>
  33. #include <qdf_types.h>
  34. #include <qdf_lock.h>
  35. #include <i_qdf_nbuf.h>
  36. #include <i_qdf_trace.h>
  37. #include <qdf_net_types.h>
  38. #define IPA_NBUF_OWNER_ID 0xaa55aa55
  39. #define QDF_NBUF_PKT_TRAC_TYPE_EAPOL 0x02
  40. #define QDF_NBUF_PKT_TRAC_TYPE_DHCP 0x04
  41. #define QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION 0x08
  42. #define QDF_NBUF_PKT_TRAC_TYPE_ARP 0x10
  43. #define QDF_NBUF_PKT_TRAC_MAX_STRING 12
  44. #define QDF_NBUF_PKT_TRAC_PROTO_STRING 4
  45. #define QDF_NBUF_PKT_ERROR 1
  46. #define QDF_NBUF_TRAC_IPV4_OFFSET 14
  47. #define QDF_NBUF_TRAC_IPV4_HEADER_SIZE 20
  48. #define QDF_NBUF_TRAC_DHCP_SRV_PORT 67
  49. #define QDF_NBUF_TRAC_DHCP_CLI_PORT 68
  50. #define QDF_NBUF_TRAC_ETH_TYPE_OFFSET 12
  51. #define QDF_NBUF_TRAC_EAPOL_ETH_TYPE 0x888E
  52. #define QDF_NBUF_TRAC_WAPI_ETH_TYPE 0x88b4
  53. #define QDF_NBUF_TRAC_ARP_ETH_TYPE 0x0806
  54. #define QDF_NBUF_TRAC_IPV4_ETH_TYPE 0x0800
  55. #define QDF_NBUF_TRAC_IPV6_ETH_TYPE 0x86dd
  56. #define QDF_NBUF_DEST_MAC_OFFSET 0
  57. #define QDF_NBUF_SRC_MAC_OFFSET 6
  58. #define QDF_NBUF_TRAC_IPV4_PROTO_TYPE_OFFSET 23
  59. #define QDF_NBUF_TRAC_IPV4_DEST_ADDR_OFFSET 30
  60. #define QDF_NBUF_TRAC_IPV6_PROTO_TYPE_OFFSET 20
  61. #define QDF_NBUF_TRAC_IPV4_ADDR_MCAST_MASK 0xE0000000
  62. #define QDF_NBUF_TRAC_IPV4_ADDR_BCAST_MASK 0xF0000000
  63. #define QDF_NBUF_TRAC_IPV6_DEST_ADDR_OFFSET 38
  64. #define QDF_NBUF_TRAC_IPV6_DEST_ADDR 0xFF00
  65. #define QDF_NBUF_TRAC_ICMP_TYPE 1
  66. #define QDF_NBUF_TRAC_TCP_TYPE 6
  67. #define QDF_NBUF_TRAC_UDP_TYPE 17
  68. #define QDF_NBUF_TRAC_ICMPV6_TYPE 0x3a
  69. /* EAPOL Related MASK */
  70. #define EAPOL_PACKET_TYPE_OFFSET 15
  71. #define EAPOL_KEY_INFO_OFFSET 19
  72. #define EAPOL_PKT_LEN_OFFSET 16
  73. #define EAPOL_KEY_LEN_OFFSET 21
  74. #define EAPOL_MASK 0x8013
  75. #define EAPOL_M1_BIT_MASK 0x8000
  76. #define EAPOL_M2_BIT_MASK 0x0001
  77. #define EAPOL_M3_BIT_MASK 0x8013
  78. #define EAPOL_M4_BIT_MASK 0x0003
  79. /* Tracked Packet types */
  80. #define QDF_NBUF_TX_PKT_INVALID 0
  81. #define QDF_NBUF_TX_PKT_DATA_TRACK 1
  82. #define QDF_NBUF_TX_PKT_MGMT_TRACK 2
  83. /* Different Packet states */
  84. #define QDF_NBUF_TX_PKT_HDD 1
  85. #define QDF_NBUF_TX_PKT_TXRX_ENQUEUE 2
  86. #define QDF_NBUF_TX_PKT_TXRX_DEQUEUE 3
  87. #define QDF_NBUF_TX_PKT_TXRX 4
  88. #define QDF_NBUF_TX_PKT_HTT 5
  89. #define QDF_NBUF_TX_PKT_HTC 6
  90. #define QDF_NBUF_TX_PKT_HIF 7
  91. #define QDF_NBUF_TX_PKT_CE 8
  92. #define QDF_NBUF_TX_PKT_FREE 9
  93. #define QDF_NBUF_TX_PKT_STATE_MAX 10
  94. #define QDF_NBUF_TX_PKT_LI_DP 11
  95. /* Enable flag to print TSO specific prints in datapath */
  96. #ifdef TSO_DEBUG_LOG_ENABLE
  97. #define TSO_DEBUG(fmt, args ...) \
  98. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_NONE, \
  99. fmt, ## args)
  100. #else
  101. #define TSO_DEBUG(fmt, args ...)
  102. #endif
  103. /**
  104. * struct mon_rx_status - This will have monitor mode rx_status extracted from
  105. * htt_rx_desc used later to update radiotap information.
  106. * @tsft: Time Synchronization Function timer
  107. * @he_sig_A1: HE (11ax) sig A1 field
  108. * @he_sig_A2: HE (11ax) sig A1 field
  109. * @he_sig_b_user: HE (11ax) sig B user field
  110. * @he_sig_b_user_known: HE (11ax) sig B user known field
  111. * @chan_freq: Capture channel frequency
  112. * @chan_num: Capture channel number
  113. * @chan_flags: Bitmap of Channel flags, IEEE80211_CHAN_TURBO,
  114. * IEEE80211_CHAN_CCK...
  115. * @ht_flags: HT flags, only present for HT frames.
  116. * @vht_flags: VHT flags, only present for VHT frames.
  117. * @vht_flag_values1-5: Contains corresponding data for flags field
  118. * @he_flags: HE (11ax) flags, only present in HE frames
  119. * @he_sig_A1_known: HE (11ax) sig A1 known field
  120. * @he_sig_A2_known: HE (11ax) sig A2 known field
  121. * @he_sig_b_common: HE (11ax) sig B common field
  122. * @he_sig_b_common_known: HE (11ax) sig B common known field
  123. * @rate: Rate in terms 500Kbps
  124. * @rtap_flags: Bit map of available fields in the radiotap
  125. * @ant_signal_db: Rx packet RSSI
  126. * @nr_ant: Number of Antennas used for streaming
  127. * @mcs: MCS index of Rx frame
  128. * @bw: bandwidth of rx frame
  129. * @is_stbc: Is STBC enabled
  130. * @sgi: Rx frame short guard interval
  131. * @ldpc: ldpc enabled
  132. * @beamformed: Is frame beamformed.
  133. * @he_sig_b_common_RU[4]: HE (11ax) common RU assignment index
  134. */
  135. struct mon_rx_status {
  136. uint64_t tsft;
  137. uint32_t he_sig_A1;
  138. uint32_t he_sig_A2;
  139. uint32_t he_sig_b_user;
  140. uint32_t he_sig_b_user_known;
  141. uint16_t chan_freq;
  142. uint16_t chan_num;
  143. uint16_t chan_flags;
  144. uint16_t ht_flags;
  145. uint16_t vht_flags;
  146. uint16_t vht_flag_values6;
  147. uint16_t he_flags;
  148. uint16_t he_sig_A1_known;
  149. uint16_t he_sig_A2_known;
  150. uint16_t he_sig_b_common;
  151. uint16_t he_sig_b_common_known;
  152. uint8_t rate;
  153. uint8_t rtap_flags;
  154. uint8_t ant_signal_db;
  155. uint8_t nr_ant;
  156. uint8_t mcs;
  157. uint8_t bw;
  158. uint8_t vht_flag_values1;
  159. uint8_t vht_flag_values2;
  160. uint8_t vht_flag_values3[4];
  161. uint8_t vht_flag_values4;
  162. uint8_t vht_flag_values5;
  163. uint8_t is_stbc;
  164. uint8_t sgi;
  165. uint8_t ldpc;
  166. uint8_t beamformed;
  167. uint8_t he_sig_b_common_RU[4];
  168. };
  169. /* DHCP Related Mask */
  170. #define QDF_DHCP_OPTION53 (0x35)
  171. #define QDF_DHCP_OPTION53_LENGTH (1)
  172. #define QDF_DHCP_OPTION53_OFFSET (0x11A)
  173. #define QDF_DHCP_OPTION53_LENGTH_OFFSET (0x11B)
  174. #define QDF_DHCP_OPTION53_STATUS_OFFSET (0x11C)
  175. #define DHCP_PKT_LEN_OFFSET 16
  176. #define DHCP_TRANSACTION_ID_OFFSET 46
  177. #define QDF_DHCP_DISCOVER (1)
  178. #define QDF_DHCP_OFFER (2)
  179. #define QDF_DHCP_REQUEST (3)
  180. #define QDF_DHCP_DECLINE (4)
  181. #define QDF_DHCP_ACK (5)
  182. #define QDF_DHCP_NAK (6)
  183. #define QDF_DHCP_RELEASE (7)
  184. #define QDF_DHCP_INFORM (8)
  185. /* ARP Related Mask */
  186. #define ARP_SUB_TYPE_OFFSET 20
  187. #define ARP_REQUEST (1)
  188. #define ARP_RESPONSE (2)
  189. /* IPV4 Related Mask */
  190. #define IPV4_PKT_LEN_OFFSET 16
  191. #define IPV4_TCP_SEQ_NUM_OFFSET 38
  192. #define IPV4_SRC_PORT_OFFSET 34
  193. #define IPV4_DST_PORT_OFFSET 36
  194. /* IPV4 ICMP Related Mask */
  195. #define ICMP_SEQ_NUM_OFFSET 40
  196. #define ICMP_SUBTYPE_OFFSET 34
  197. #define ICMP_REQUEST 0x08
  198. #define ICMP_RESPONSE 0x00
  199. /* IPV6 Related Mask */
  200. #define IPV6_PKT_LEN_OFFSET 18
  201. #define IPV6_TCP_SEQ_NUM_OFFSET 58
  202. #define IPV6_SRC_PORT_OFFSET 54
  203. #define IPV6_DST_PORT_OFFSET 56
  204. /* IPV6 ICMPV6 Related Mask */
  205. #define ICMPV6_SEQ_NUM_OFFSET 60
  206. #define ICMPV6_SUBTYPE_OFFSET 54
  207. #define ICMPV6_REQUEST 0x80
  208. #define ICMPV6_RESPONSE 0x81
  209. #define ICMPV6_RS 0x85
  210. #define ICMPV6_RA 0x86
  211. #define ICMPV6_NS 0x87
  212. #define ICMPV6_NA 0x88
  213. #define QDF_NBUF_IPA_CHECK_MASK 0x80000000
  214. /**
  215. * qdf_proto_type - protocol type
  216. * @QDF_PROTO_TYPE_DHCP - DHCP
  217. * @QDF_PROTO_TYPE_EAPOL - EAPOL
  218. * @QDF_PROTO_TYPE_ARP - ARP
  219. * @QDF_PROTO_TYPE_MGMT - MGMT
  220. * QDF_PROTO_TYPE_EVENT - EVENT
  221. */
  222. enum qdf_proto_type {
  223. QDF_PROTO_TYPE_DHCP,
  224. QDF_PROTO_TYPE_EAPOL,
  225. QDF_PROTO_TYPE_ARP,
  226. QDF_PROTO_TYPE_MGMT,
  227. QDF_PROTO_TYPE_EVENT,
  228. QDF_PROTO_TYPE_MAX
  229. };
  230. /**
  231. * qdf_proto_subtype - subtype of packet
  232. * @QDF_PROTO_EAPOL_M1 - EAPOL 1/4
  233. * @QDF_PROTO_EAPOL_M2 - EAPOL 2/4
  234. * @QDF_PROTO_EAPOL_M3 - EAPOL 3/4
  235. * @QDF_PROTO_EAPOL_M4 - EAPOL 4/4
  236. * @QDF_PROTO_DHCP_DISCOVER - discover
  237. * @QDF_PROTO_DHCP_REQUEST - request
  238. * @QDF_PROTO_DHCP_OFFER - offer
  239. * @QDF_PROTO_DHCP_ACK - ACK
  240. * @QDF_PROTO_DHCP_NACK - NACK
  241. * @QDF_PROTO_DHCP_RELEASE - release
  242. * @QDF_PROTO_DHCP_INFORM - inform
  243. * @QDF_PROTO_DHCP_DECLINE - decline
  244. * @QDF_PROTO_ARP_REQ - arp request
  245. * @QDF_PROTO_ARP_RES - arp response
  246. * @QDF_PROTO_ICMP_REQ - icmp request
  247. * @QDF_PROTO_ICMP_RES - icmp response
  248. * @QDF_PROTO_ICMPV6_REQ - icmpv6 request
  249. * @QDF_PROTO_ICMPV6_RES - icmpv6 response
  250. * @QDF_PROTO_ICMPV6_RS - icmpv6 rs packet
  251. * @QDF_PROTO_ICMPV6_RA - icmpv6 ra packet
  252. * @QDF_PROTO_ICMPV6_NS - icmpv6 ns packet
  253. * @QDF_PROTO_ICMPV6_NA - icmpv6 na packet
  254. * @QDF_PROTO_IPV4_UDP - ipv4 udp
  255. * @QDF_PROTO_IPV4_TCP - ipv4 tcp
  256. * @QDF_PROTO_IPV6_UDP - ipv6 udp
  257. * @QDF_PROTO_IPV6_TCP - ipv6 tcp
  258. * @QDF_PROTO_MGMT_ASSOC -assoc
  259. * @QDF_PROTO_MGMT_DISASSOC - disassoc
  260. * @QDF_PROTO_MGMT_AUTH - auth
  261. * @QDF_PROTO_MGMT_DEAUTH - deauth
  262. * QDF_ROAM_SYNCH - roam synch indication from fw
  263. * QDF_ROAM_COMPLETE - roam complete cmd to fw
  264. * QDF_ROAM_EVENTID - roam eventid from fw
  265. */
  266. enum qdf_proto_subtype {
  267. QDF_PROTO_INVALID,
  268. QDF_PROTO_EAPOL_M1,
  269. QDF_PROTO_EAPOL_M2,
  270. QDF_PROTO_EAPOL_M3,
  271. QDF_PROTO_EAPOL_M4,
  272. QDF_PROTO_DHCP_DISCOVER,
  273. QDF_PROTO_DHCP_REQUEST,
  274. QDF_PROTO_DHCP_OFFER,
  275. QDF_PROTO_DHCP_ACK,
  276. QDF_PROTO_DHCP_NACK,
  277. QDF_PROTO_DHCP_RELEASE,
  278. QDF_PROTO_DHCP_INFORM,
  279. QDF_PROTO_DHCP_DECLINE,
  280. QDF_PROTO_ARP_REQ,
  281. QDF_PROTO_ARP_RES,
  282. QDF_PROTO_ICMP_REQ,
  283. QDF_PROTO_ICMP_RES,
  284. QDF_PROTO_ICMPV6_REQ,
  285. QDF_PROTO_ICMPV6_RES,
  286. QDF_PROTO_ICMPV6_RS,
  287. QDF_PROTO_ICMPV6_RA,
  288. QDF_PROTO_ICMPV6_NS,
  289. QDF_PROTO_ICMPV6_NA,
  290. QDF_PROTO_IPV4_UDP,
  291. QDF_PROTO_IPV4_TCP,
  292. QDF_PROTO_IPV6_UDP,
  293. QDF_PROTO_IPV6_TCP,
  294. QDF_PROTO_MGMT_ASSOC,
  295. QDF_PROTO_MGMT_DISASSOC,
  296. QDF_PROTO_MGMT_AUTH,
  297. QDF_PROTO_MGMT_DEAUTH,
  298. QDF_ROAM_SYNCH,
  299. QDF_ROAM_COMPLETE,
  300. QDF_ROAM_EVENTID,
  301. QDF_PROTO_SUBTYPE_MAX
  302. };
  303. /**
  304. * @qdf_nbuf_t - Platform indepedent packet abstraction
  305. */
  306. typedef __qdf_nbuf_t qdf_nbuf_t;
  307. /**
  308. * @qdf_dma_map_cb_t - Dma map callback prototype
  309. */
  310. typedef void (*qdf_dma_map_cb_t)(void *arg, qdf_nbuf_t buf,
  311. qdf_dma_map_t dmap);
  312. /**
  313. * @qdf_nbuf_queue_t - Platform independent packet queue abstraction
  314. */
  315. typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t;
  316. /* BUS/DMA mapping routines */
  317. static inline QDF_STATUS
  318. qdf_nbuf_dmamap_create(qdf_device_t osdev, qdf_dma_map_t *dmap)
  319. {
  320. return __qdf_nbuf_dmamap_create(osdev, dmap);
  321. }
  322. static inline void
  323. qdf_nbuf_dmamap_destroy(qdf_device_t osdev, qdf_dma_map_t dmap)
  324. {
  325. __qdf_nbuf_dmamap_destroy(osdev, dmap);
  326. }
  327. static inline void
  328. qdf_nbuf_dmamap_set_cb(qdf_dma_map_t dmap, qdf_dma_map_cb_t cb, void *arg)
  329. {
  330. __qdf_nbuf_dmamap_set_cb(dmap, cb, arg);
  331. }
  332. static inline void
  333. qdf_nbuf_set_send_complete_flag(qdf_nbuf_t buf, bool flag)
  334. {
  335. __qdf_nbuf_set_send_complete_flag(buf, flag);
  336. }
  337. static inline QDF_STATUS
  338. qdf_nbuf_map(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  339. {
  340. return __qdf_nbuf_map(osdev, buf, dir);
  341. }
  342. static inline void
  343. qdf_nbuf_unmap(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  344. {
  345. __qdf_nbuf_unmap(osdev, buf, dir);
  346. }
  347. static inline QDF_STATUS
  348. qdf_nbuf_map_nbytes(qdf_device_t osdev, qdf_nbuf_t buf,
  349. qdf_dma_dir_t dir, int nbytes)
  350. {
  351. return __qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes);
  352. }
  353. static inline void
  354. qdf_nbuf_unmap_nbytes(qdf_device_t osdev,
  355. qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  356. {
  357. __qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes);
  358. }
  359. static inline void
  360. qdf_nbuf_sync_for_cpu(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  361. {
  362. __qdf_nbuf_sync_for_cpu(osdev, buf, dir);
  363. }
  364. static inline QDF_STATUS
  365. qdf_nbuf_map_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  366. {
  367. return __qdf_nbuf_map_single(osdev, buf, dir);
  368. }
  369. static inline QDF_STATUS
  370. qdf_nbuf_map_nbytes_single(
  371. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  372. {
  373. return __qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes);
  374. }
  375. static inline void
  376. qdf_nbuf_unmap_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  377. {
  378. __qdf_nbuf_unmap_single(osdev, buf, dir);
  379. }
  380. static inline void
  381. qdf_nbuf_unmap_nbytes_single(
  382. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  383. {
  384. return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes);
  385. }
  386. static inline int qdf_nbuf_get_num_frags(qdf_nbuf_t buf)
  387. {
  388. return __qdf_nbuf_get_num_frags(buf);
  389. }
  390. /**
  391. * qdf_nbuf_get_frag_len() - get fragment length
  392. * @buf: Network buffer
  393. * @frag_num: Fragment number
  394. *
  395. * Return: Fragment length
  396. */
  397. static inline int qdf_nbuf_get_frag_len(qdf_nbuf_t buf, int frag_num)
  398. {
  399. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  400. return __qdf_nbuf_get_frag_len(buf, frag_num);
  401. }
  402. /**
  403. * qdf_nbuf_get_frag_vaddr() - get fragment virtual address
  404. * @buf: Network buffer
  405. * @frag_num: Fragment number
  406. *
  407. * Return: Fragment virtual address
  408. */
  409. static inline unsigned char *qdf_nbuf_get_frag_vaddr(qdf_nbuf_t buf,
  410. int frag_num)
  411. {
  412. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  413. return __qdf_nbuf_get_frag_vaddr(buf, frag_num);
  414. }
  415. /**
  416. * qdf_nbuf_get_frag_vaddr_always() - get fragment virtual address
  417. * @buf: Network buffer
  418. *
  419. * Return: Fragment virtual address
  420. */
  421. static inline unsigned char *
  422. qdf_nbuf_get_frag_vaddr_always(qdf_nbuf_t buf)
  423. {
  424. return __qdf_nbuf_get_frag_vaddr_always(buf);
  425. }
  426. /**
  427. * qdf_nbuf_get_frag_paddr() - get fragment physical address
  428. * @buf: Network buffer
  429. * @frag_num: Fragment number
  430. *
  431. * Return: Fragment physical address
  432. */
  433. static inline qdf_dma_addr_t qdf_nbuf_get_frag_paddr(qdf_nbuf_t buf,
  434. unsigned int frag_num)
  435. {
  436. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  437. return __qdf_nbuf_get_frag_paddr(buf, frag_num);
  438. }
  439. /**
  440. * qdf_nbuf_get_frag_is_wordstream() - is fragment wordstream
  441. * @buf: Network buffer
  442. * @frag_num: Fragment number
  443. *
  444. * Return: Fragment wordstream or not
  445. */
  446. static inline int qdf_nbuf_get_frag_is_wordstream(qdf_nbuf_t buf, int frag_num)
  447. {
  448. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  449. return __qdf_nbuf_get_frag_is_wordstream(buf, frag_num);
  450. }
  451. static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)
  452. {
  453. return __qdf_nbuf_ipa_owned_get(buf);
  454. }
  455. static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)
  456. {
  457. __qdf_nbuf_ipa_owned_set(buf);
  458. }
  459. static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)
  460. {
  461. return __qdf_nbuf_ipa_priv_get(buf);
  462. }
  463. static inline void qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf, uint32_t priv)
  464. {
  465. QDF_BUG(!(priv & QDF_NBUF_IPA_CHECK_MASK));
  466. __qdf_nbuf_ipa_priv_set(buf, priv);
  467. }
  468. /**
  469. * qdf_nbuf_set_frag_is_wordstream() - set fragment wordstream
  470. * @buf: Network buffer
  471. * @frag_num: Fragment number
  472. * @is_wordstream: Wordstream
  473. *
  474. * Return: none
  475. */
  476. static inline void
  477. qdf_nbuf_set_frag_is_wordstream(qdf_nbuf_t buf,
  478. int frag_num, int is_wordstream)
  479. {
  480. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  481. __qdf_nbuf_set_frag_is_wordstream(buf, frag_num, is_wordstream);
  482. }
  483. static inline void
  484. qdf_nbuf_set_vdev_ctx(qdf_nbuf_t buf, void *vdev_ctx)
  485. {
  486. __qdf_nbuf_set_vdev_ctx(buf, vdev_ctx);
  487. }
  488. static inline void
  489. qdf_nbuf_set_fctx_type(qdf_nbuf_t buf, void *ctx, uint8_t type)
  490. {
  491. __qdf_nbuf_set_fctx_type(buf, ctx, type);
  492. }
  493. static inline void *
  494. qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf)
  495. {
  496. return __qdf_nbuf_get_vdev_ctx(buf);
  497. }
  498. static inline void *qdf_nbuf_get_fctx(qdf_nbuf_t buf)
  499. {
  500. return __qdf_nbuf_get_fctx(buf);
  501. }
  502. static inline uint8_t qdf_nbuf_get_ftype(qdf_nbuf_t buf)
  503. {
  504. return __qdf_nbuf_get_ftype(buf);
  505. }
  506. static inline qdf_dma_addr_t
  507. qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf)
  508. {
  509. return __qdf_nbuf_mapped_paddr_get(buf);
  510. }
  511. static inline void
  512. qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr)
  513. {
  514. __qdf_nbuf_mapped_paddr_set(buf, paddr);
  515. }
  516. static inline void
  517. qdf_nbuf_frag_push_head(qdf_nbuf_t buf,
  518. int frag_len, char *frag_vaddr,
  519. qdf_dma_addr_t frag_paddr)
  520. {
  521. __qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr);
  522. }
  523. #define qdf_nbuf_num_frags_init(_nbuf) __qdf_nbuf_num_frags_init((_nbuf))
  524. /**
  525. * qdf_nbuf_set_chfrag_start() - set msdu start bit
  526. * @buf: Network buffer
  527. * @val: 0/1
  528. *
  529. * Return: void
  530. */
  531. static inline void
  532. qdf_nbuf_set_chfrag_start(qdf_nbuf_t buf, uint8_t val)
  533. {
  534. __qdf_nbuf_set_chfrag_start(buf, val);
  535. }
  536. /**
  537. * qdf_nbuf_is_chfrag_start() - get msdu start bit
  538. * @buf: Network buffer
  539. *
  540. * Return: integer value - 0/1
  541. */
  542. static inline int qdf_nbuf_is_chfrag_start(qdf_nbuf_t buf)
  543. {
  544. return __qdf_nbuf_is_chfrag_start(buf);
  545. }
  546. /**
  547. * qdf_nbuf_set_chfrag_cont() - set msdu continuation bit
  548. * @buf: Network buffer
  549. * @val: 0/1
  550. *
  551. * Return: void
  552. */
  553. static inline void
  554. qdf_nbuf_set_chfrag_cont(qdf_nbuf_t buf, uint8_t val)
  555. {
  556. __qdf_nbuf_set_chfrag_cont(buf, val);
  557. }
  558. /**
  559. * qdf_nbuf_is_chfrag_cont() - get msdu continuation bit
  560. * @buf: Network buffer
  561. *
  562. * Return: integer value - 0/1
  563. */
  564. static inline int qdf_nbuf_is_chfrag_cont(qdf_nbuf_t buf)
  565. {
  566. return __qdf_nbuf_is_chfrag_cont(buf);
  567. }
  568. /**
  569. * qdf_nbuf_set_chfrag_end() - set msdu end bit
  570. * @buf: Network buffer
  571. * @val: 0/1
  572. *
  573. * Return: void
  574. */
  575. static inline void qdf_nbuf_set_chfrag_end(qdf_nbuf_t buf, uint8_t val)
  576. {
  577. __qdf_nbuf_set_chfrag_end(buf, val);
  578. }
  579. /**
  580. * qdf_nbuf_is_chfrag_end() - set msdu end bit
  581. * @buf: Network buffer
  582. *
  583. * Return: integer value - 0/1
  584. */
  585. static inline int qdf_nbuf_is_chfrag_end(qdf_nbuf_t buf)
  586. {
  587. return __qdf_nbuf_is_chfrag_end(buf);
  588. }
  589. static inline void
  590. qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg)
  591. {
  592. __qdf_nbuf_dma_map_info(bmap, sg);
  593. }
  594. /**
  595. * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
  596. * @buf: Network buffer
  597. *
  598. * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
  599. */
  600. static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
  601. {
  602. return __qdf_nbuf_is_tso(nbuf);
  603. }
  604. /**
  605. * qdf_nbuf_get_users() - function to get the number of users referencing this
  606. * network buffer
  607. *
  608. * @nbuf: network buffer
  609. *
  610. * Return: number of user references to nbuf.
  611. */
  612. static inline int qdf_nbuf_get_users(qdf_nbuf_t nbuf)
  613. {
  614. return __qdf_nbuf_get_users(nbuf);
  615. }
  616. /**
  617. * qdf_nbuf_next() - get the next packet in the linked list
  618. * @buf: Network buffer
  619. *
  620. * This function can be used when nbufs are directly linked into a list,
  621. * rather than using a separate network buffer queue object.
  622. *
  623. * Return: next network buffer in the linked list
  624. */
  625. static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
  626. {
  627. return __qdf_nbuf_next(buf);
  628. }
  629. #ifdef MEMORY_DEBUG
  630. void qdf_net_buf_debug_init(void);
  631. void qdf_net_buf_debug_exit(void);
  632. void qdf_net_buf_debug_clean(void);
  633. void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
  634. uint8_t *file_name, uint32_t line_num);
  635. void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
  636. /**
  637. * qdf_net_buf_debug_acquire_skb() - acquire skb to avoid memory leak
  638. * @net_buf: Network buf holding head segment (single)
  639. * @file_name: pointer to file name
  640. * @line_num: line number
  641. *
  642. * WLAN driver module's SKB which are allocated by network stack are
  643. * suppose to call this API before freeing it such that the SKB
  644. * is not reported as memory leak.
  645. *
  646. * Return: none
  647. */
  648. void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  649. uint8_t *file_name, uint32_t line_num);
  650. void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
  651. /* nbuf allocation rouines */
  652. #define qdf_nbuf_alloc(d, s, r, a, p) \
  653. qdf_nbuf_alloc_debug(d, s, r, a, p, __FILE__, __LINE__)
  654. static inline qdf_nbuf_t
  655. qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size, int reserve,
  656. int align, int prio, uint8_t *file_name,
  657. uint32_t line_num)
  658. {
  659. qdf_nbuf_t net_buf;
  660. net_buf = __qdf_nbuf_alloc(osdev, size, reserve, align, prio);
  661. /* Store SKB in internal QDF tracking table */
  662. if (qdf_likely(net_buf))
  663. qdf_net_buf_debug_add_node(net_buf, size, file_name, line_num);
  664. return net_buf;
  665. }
  666. static inline void qdf_nbuf_free(qdf_nbuf_t net_buf)
  667. {
  668. if (qdf_nbuf_is_tso(net_buf) &&
  669. qdf_nbuf_get_users(net_buf) > 1)
  670. goto free_buf;
  671. /* Remove SKB from internal QDF tracking table */
  672. if (qdf_likely(net_buf))
  673. qdf_net_buf_debug_delete_node(net_buf);
  674. free_buf:
  675. __qdf_nbuf_free(net_buf);
  676. }
  677. #define qdf_nbuf_clone(buf) \
  678. qdf_nbuf_clone_debug(buf, __FILE__, __LINE__)
  679. /**
  680. * qdf_nbuf_clone_debug() - clone the nbuf (copy is readonly)
  681. * @buf: nbuf to clone from
  682. * @file_name: pointer to file name
  683. * @line_num: line number
  684. *
  685. * This function clones the nbuf and creates a memory tracking
  686. * node corresponding to that cloned skbuff structure.
  687. *
  688. * Return: cloned buffer
  689. */
  690. static inline qdf_nbuf_t
  691. qdf_nbuf_clone_debug(qdf_nbuf_t buf, uint8_t *file_name,
  692. uint32_t line_num)
  693. {
  694. qdf_nbuf_t cloned_buf;
  695. cloned_buf = __qdf_nbuf_clone(buf);
  696. /* Store SKB in internal QDF tracking table */
  697. if (qdf_likely(cloned_buf))
  698. qdf_net_buf_debug_add_node(cloned_buf, 0, file_name, line_num);
  699. return cloned_buf;
  700. }
  701. #define qdf_nbuf_copy(buf) \
  702. qdf_nbuf_copy_debug(buf, __FILE__, __LINE__)
  703. /**
  704. * qdf_nbuf_copy_debug() - returns a private copy of the buf
  705. * @buf: nbuf to copy from
  706. * @file_name: pointer to file name
  707. * @line_num: line number
  708. *
  709. * This API returns a private copy of the buf, the buf returned is completely
  710. * modifiable by callers. It also creates a memory tracking node corresponding
  711. * to that new skbuff structure.
  712. *
  713. * Return: copied buffer
  714. */
  715. static inline qdf_nbuf_t
  716. qdf_nbuf_copy_debug(qdf_nbuf_t buf, uint8_t *file_name,
  717. uint32_t line_num)
  718. {
  719. qdf_nbuf_t copied_buf;
  720. copied_buf = __qdf_nbuf_copy(buf);
  721. /* Store SKB in internal QDF tracking table */
  722. if (qdf_likely(copied_buf))
  723. qdf_net_buf_debug_add_node(copied_buf, 0, file_name, line_num);
  724. return copied_buf;
  725. }
  726. #else
  727. static inline void qdf_net_buf_debug_acquire_skb(qdf_nbuf_t net_buf,
  728. uint8_t *file_name, uint32_t line_num)
  729. {
  730. }
  731. static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
  732. {
  733. return;
  734. }
  735. /* Nbuf allocation rouines */
  736. static inline qdf_nbuf_t
  737. qdf_nbuf_alloc(qdf_device_t osdev,
  738. qdf_size_t size, int reserve, int align, int prio)
  739. {
  740. return __qdf_nbuf_alloc(osdev, size, reserve, align, prio);
  741. }
  742. static inline void qdf_nbuf_free(qdf_nbuf_t buf)
  743. {
  744. __qdf_nbuf_free(buf);
  745. }
  746. /**
  747. * qdf_nbuf_clone() - clone the nbuf (copy is readonly)
  748. * @buf: Pointer to network buffer
  749. *
  750. * This function clones the nbuf and returns new sk_buff
  751. * structure.
  752. *
  753. * Return: cloned skb
  754. */
  755. static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf)
  756. {
  757. return __qdf_nbuf_clone(buf);
  758. }
  759. /**
  760. * qdf_nbuf_copy() - returns a private copy of the buf
  761. * @buf: Pointer to network buffer
  762. *
  763. * This API returns a private copy of the buf, the buf returned is completely
  764. * modifiable by callers
  765. *
  766. * Return: skb or NULL
  767. */
  768. static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf)
  769. {
  770. return __qdf_nbuf_copy(buf);
  771. }
  772. #endif
  773. #ifdef WLAN_FEATURE_FASTPATH
  774. /**
  775. * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state
  776. *
  777. * @buf: buf instance
  778. * Return: data pointer of this buf where new data has to be
  779. * put, or NULL if there is not enough room in this buf.
  780. */
  781. static inline void qdf_nbuf_init_fast(qdf_nbuf_t nbuf)
  782. {
  783. atomic_set(&nbuf->users, 1);
  784. nbuf->data = nbuf->head + NET_SKB_PAD;
  785. skb_reset_tail_pointer(nbuf);
  786. }
  787. #endif /* WLAN_FEATURE_FASTPATH */
  788. static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err)
  789. {
  790. while (buf_list) {
  791. qdf_nbuf_t next = qdf_nbuf_next(buf_list);
  792. qdf_nbuf_free(buf_list);
  793. buf_list = next;
  794. }
  795. }
  796. static inline void qdf_nbuf_ref(qdf_nbuf_t buf)
  797. {
  798. __qdf_nbuf_ref(buf);
  799. }
  800. static inline int qdf_nbuf_shared(qdf_nbuf_t buf)
  801. {
  802. return __qdf_nbuf_shared(buf);
  803. }
  804. static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src)
  805. {
  806. return __qdf_nbuf_cat(dst, src);
  807. }
  808. /**
  809. * @qdf_nbuf_copy_bits() - return the length of the copy bits for skb
  810. * @skb: SKB pointer
  811. * @offset: offset
  812. * @len: Length
  813. * @to: To
  814. *
  815. * Return: int32_t
  816. */
  817. static inline int32_t
  818. qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to)
  819. {
  820. return __qdf_nbuf_copy_bits(nbuf, offset, len, to);
  821. }
  822. /* nbuf manipulation routines */
  823. /**
  824. * @qdf_nbuf_head() - return the address of an nbuf's buffer
  825. * @buf: netbuf
  826. *
  827. * Return: head address
  828. */
  829. static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf)
  830. {
  831. return __qdf_nbuf_head(buf);
  832. }
  833. /**
  834. * qdf_nbuf_data() - Return the address of the start of data within an nbuf
  835. * @buf: Network buffer
  836. *
  837. * Return: Data address
  838. */
  839. static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf)
  840. {
  841. return __qdf_nbuf_data(buf);
  842. }
  843. /**
  844. * qdf_nbuf_data_addr() - Return the address of skb->data
  845. * @buf: Network buffer
  846. *
  847. * Return: Data address
  848. */
  849. static inline uint8_t *qdf_nbuf_data_addr(qdf_nbuf_t buf)
  850. {
  851. return __qdf_nbuf_data_addr(buf);
  852. }
  853. /**
  854. * qdf_nbuf_headroom() - amount of headroom int the current nbuf
  855. * @buf: Network buffer
  856. *
  857. * Return: Amount of head room
  858. */
  859. static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf)
  860. {
  861. return __qdf_nbuf_headroom(buf);
  862. }
  863. /**
  864. * qdf_nbuf_tailroom() - amount of tail space available
  865. * @buf: Network buffer
  866. *
  867. * Return: amount of tail room
  868. */
  869. static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf)
  870. {
  871. return __qdf_nbuf_tailroom(buf);
  872. }
  873. /**
  874. * qdf_nbuf_push_head() - push data in the front
  875. * @buf: Network buf instance
  876. * @size: Size to be pushed
  877. *
  878. * Return: New data pointer of this buf after data has been pushed,
  879. * or NULL if there is not enough room in this buf.
  880. */
  881. static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size)
  882. {
  883. return __qdf_nbuf_push_head(buf, size);
  884. }
  885. /**
  886. * qdf_nbuf_put_tail() - puts data in the end
  887. * @buf: Network buf instance
  888. * @size: Size to be pushed
  889. *
  890. * Return: Data pointer of this buf where new data has to be
  891. * put, or NULL if there is not enough room in this buf.
  892. */
  893. static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size)
  894. {
  895. return __qdf_nbuf_put_tail(buf, size);
  896. }
  897. /**
  898. * qdf_nbuf_pull_head() - pull data out from the front
  899. * @buf: Network buf instance
  900. * @size: Size to be popped
  901. *
  902. * Return: New data pointer of this buf after data has been popped,
  903. * or NULL if there is not sufficient data to pull.
  904. */
  905. static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size)
  906. {
  907. return __qdf_nbuf_pull_head(buf, size);
  908. }
  909. /**
  910. * qdf_nbuf_trim_tail() - trim data out from the end
  911. * @buf: Network buf instance
  912. * @size: Size to be popped
  913. *
  914. * Return: none
  915. */
  916. static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size)
  917. {
  918. __qdf_nbuf_trim_tail(buf, size);
  919. }
  920. /**
  921. * qdf_nbuf_len() - get the length of the buf
  922. * @buf: Network buf instance
  923. *
  924. * Return: total length of this buf.
  925. */
  926. static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf)
  927. {
  928. return __qdf_nbuf_len(buf);
  929. }
  930. /**
  931. * qdf_nbuf_set_pktlen() - set the length of the buf
  932. * @buf: Network buf instance
  933. * @size: Size to be set
  934. *
  935. * Return: none
  936. */
  937. static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len)
  938. {
  939. __qdf_nbuf_set_pktlen(buf, len);
  940. }
  941. /**
  942. * qdf_nbuf_reserve() - trim data out from the end
  943. * @buf: Network buf instance
  944. * @size: Size to be popped
  945. *
  946. * Return: none
  947. */
  948. static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size)
  949. {
  950. __qdf_nbuf_reserve(buf, size);
  951. }
  952. /**
  953. * qdf_nbuf_peek_header() - return the data pointer & length of the header
  954. * @buf: Network nbuf
  955. * @addr: Data pointer
  956. * @len: Length of the data
  957. *
  958. * Return: none
  959. */
  960. static inline void
  961. qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len)
  962. {
  963. __qdf_nbuf_peek_header(buf, addr, len);
  964. }
  965. /* nbuf queue routines */
  966. /**
  967. * qdf_nbuf_queue_init() - initialize buf queue
  968. * @head: Network buf queue head
  969. *
  970. * Return: none
  971. */
  972. static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head)
  973. {
  974. __qdf_nbuf_queue_init(head);
  975. }
  976. /**
  977. * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue
  978. * @head: Network buf queue head
  979. * @buf: Network buf
  980. *
  981. * Return: none
  982. */
  983. static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  984. {
  985. __qdf_nbuf_queue_add(head, buf);
  986. }
  987. /**
  988. * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue
  989. * @head: Network buf queue head
  990. * @buf: Network buf
  991. *
  992. * Return: none
  993. */
  994. static inline void
  995. qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  996. {
  997. __qdf_nbuf_queue_insert_head(head, buf);
  998. }
  999. /**
  1000. * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue
  1001. * @head: Network buf queue head
  1002. *
  1003. * Return: The head buf in the buf queue.
  1004. */
  1005. static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head)
  1006. {
  1007. return __qdf_nbuf_queue_remove(head);
  1008. }
  1009. /**
  1010. * qdf_nbuf_queue_len() - get the length of the queue
  1011. * @head: Network buf queue head
  1012. *
  1013. * Return: length of the queue
  1014. */
  1015. static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head)
  1016. {
  1017. return __qdf_nbuf_queue_len(head);
  1018. }
  1019. /**
  1020. * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer
  1021. * @buf: Network buffer
  1022. *
  1023. * Return: next buffer/packet
  1024. */
  1025. static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf)
  1026. {
  1027. return __qdf_nbuf_queue_next(buf);
  1028. }
  1029. /**
  1030. * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty
  1031. * @nbq: Network buf queue handle
  1032. *
  1033. * Return: true if queue is empty
  1034. * false if queue is not emty
  1035. */
  1036. static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq)
  1037. {
  1038. return __qdf_nbuf_is_queue_empty(nbq);
  1039. }
  1040. static inline qdf_nbuf_queue_t *
  1041. qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src)
  1042. {
  1043. return __qdf_nbuf_queue_append(dest, src);
  1044. }
  1045. static inline void
  1046. qdf_nbuf_queue_free(qdf_nbuf_queue_t *head)
  1047. {
  1048. __qdf_nbuf_queue_free(head);
  1049. }
  1050. static inline qdf_nbuf_t
  1051. qdf_nbuf_queue_first(qdf_nbuf_queue_t *head)
  1052. {
  1053. return __qdf_nbuf_queue_first(head);
  1054. }
  1055. /**
  1056. * qdf_nbuf_get_protocol() - return the protocol value of the skb
  1057. * @skb: Pointer to network buffer
  1058. *
  1059. * Return: skb protocol
  1060. */
  1061. static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb)
  1062. {
  1063. return __qdf_nbuf_get_protocol(skb);
  1064. }
  1065. /**
  1066. * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb
  1067. * @skb: Pointer to network buffer
  1068. *
  1069. * Return: skb ip_summed
  1070. */
  1071. static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb)
  1072. {
  1073. return __qdf_nbuf_get_ip_summed(skb);
  1074. }
  1075. /**
  1076. * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb
  1077. * @skb: Pointer to network buffer
  1078. * @ip_summed: ip checksum
  1079. *
  1080. * Return: none
  1081. */
  1082. static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb,
  1083. uint8_t ip_summed)
  1084. {
  1085. __qdf_nbuf_set_ip_summed(skb, ip_summed);
  1086. }
  1087. /**
  1088. * qdf_nbuf_set_next() - add a packet to a linked list
  1089. * @this_buf: Predecessor buffer
  1090. * @next_buf: Successor buffer
  1091. *
  1092. * This function can be used to directly link nbufs, rather than using
  1093. * a separate network buffer queue object.
  1094. *
  1095. * Return: none
  1096. */
  1097. static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  1098. {
  1099. __qdf_nbuf_set_next(this_buf, next_buf);
  1100. }
  1101. /* nbuf extension routines */
  1102. /**
  1103. * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new
  1104. * nbuf
  1105. * @this_buf: predecessor buffer
  1106. * @next_buf: successor buffer
  1107. *
  1108. * This function is used to link up many nbufs containing a single logical
  1109. * packet - not a collection of packets. Do not use for linking the first
  1110. * extension to the head
  1111. *
  1112. * Return: none
  1113. */
  1114. static inline void
  1115. qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  1116. {
  1117. __qdf_nbuf_set_next_ext(this_buf, next_buf);
  1118. }
  1119. /**
  1120. * qdf_nbuf_next_ext() - get the next packet extension in the linked list
  1121. * @buf: Network buffer
  1122. *
  1123. * Return: Next network buffer in the linked list
  1124. */
  1125. static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf)
  1126. {
  1127. return __qdf_nbuf_next_ext(buf);
  1128. }
  1129. /**
  1130. * qdf_nbuf_append_ext_list() - link list of packet extensions to the head
  1131. * segment
  1132. * @head_buf: Network buf holding head segment (single)
  1133. * @ext_list: Network buf list holding linked extensions to the head
  1134. * @ext_len: Total length of all buffers in the extension list
  1135. *
  1136. * This function is used to link up a list of packet extensions (seg1, 2,
  1137. * ...) to the nbuf holding the head segment (seg0)
  1138. *
  1139. * Return: none
  1140. */
  1141. static inline void
  1142. qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list,
  1143. qdf_size_t ext_len)
  1144. {
  1145. __qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len);
  1146. }
  1147. /**
  1148. * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
  1149. * @head_buf: Network buf holding head segment (single)
  1150. *
  1151. * This ext_list is populated when we have Jumbo packet, for example in case of
  1152. * monitor mode amsdu packet reception, and are stiched using frags_list.
  1153. *
  1154. * Return: Network buf list holding linked extensions from head buf.
  1155. */
  1156. static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf)
  1157. {
  1158. return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf);
  1159. }
  1160. /**
  1161. * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
  1162. * @buf: Network buffer
  1163. *
  1164. * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame
  1165. */
  1166. static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf)
  1167. {
  1168. return __qdf_nbuf_get_tx_cksum(buf);
  1169. }
  1170. /**
  1171. * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to
  1172. * indicate checksum info to the stack.
  1173. * @buf: Network buffer
  1174. * @cksum: Checksum
  1175. *
  1176. * Return: none
  1177. */
  1178. static inline void
  1179. qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum)
  1180. {
  1181. __qdf_nbuf_set_rx_cksum(buf, cksum);
  1182. }
  1183. /**
  1184. * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf
  1185. * @buf: Network buffer
  1186. *
  1187. * Return: TID value
  1188. */
  1189. static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf)
  1190. {
  1191. return __qdf_nbuf_get_tid(buf);
  1192. }
  1193. /**
  1194. * qdf_nbuf_set_tid() - this function sets the TID value in nbuf
  1195. * @buf: Network buffer
  1196. * @tid: TID value
  1197. *
  1198. * Return: none
  1199. */
  1200. static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid)
  1201. {
  1202. __qdf_nbuf_set_tid(buf, tid);
  1203. }
  1204. /**
  1205. * qdf_nbuf_get_exemption_type() - this function extracts the exemption type
  1206. * from nbuf
  1207. * @buf: Network buffer
  1208. *
  1209. * Return: Exemption type
  1210. */
  1211. static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf)
  1212. {
  1213. return __qdf_nbuf_get_exemption_type(buf);
  1214. }
  1215. /**
  1216. * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given
  1217. * offset
  1218. * @buf: Network buffer
  1219. * @proto: Protocol
  1220. *
  1221. * Return: none
  1222. */
  1223. static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto)
  1224. {
  1225. __qdf_nbuf_set_protocol(buf, proto);
  1226. }
  1227. /**
  1228. * qdf_nbuf_trace_get_proto_type() - this function return packet proto type
  1229. * @buf: Network buffer
  1230. *
  1231. * Return: Packet protocol type
  1232. */
  1233. static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf)
  1234. {
  1235. return __qdf_nbuf_trace_get_proto_type(buf);
  1236. }
  1237. /**
  1238. * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback
  1239. * @cb_func_ptr: Callback pointer
  1240. *
  1241. * Return: none
  1242. */
  1243. static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr)
  1244. {
  1245. __qdf_nbuf_reg_trace_cb(cb_func_ptr);
  1246. }
  1247. /**
  1248. * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download
  1249. * @buf: Network buffer
  1250. * @candi: Candidate of parallel download frame
  1251. *
  1252. * This function stores a flag specifying this TX frame is suitable for
  1253. * downloading though a 2nd TX data pipe that is used for short frames for
  1254. * protocols that can accept out-of-order delivery.
  1255. *
  1256. * Return: none
  1257. */
  1258. static inline void
  1259. qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi)
  1260. {
  1261. __qdf_nbuf_set_tx_htt2_frm(buf, candi);
  1262. }
  1263. /**
  1264. * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download
  1265. * @buf: Network buffer
  1266. *
  1267. * This function return whether this TX frame is allow to download though a 2nd
  1268. * TX data pipe or not.
  1269. *
  1270. * Return: none
  1271. */
  1272. static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf)
  1273. {
  1274. return __qdf_nbuf_get_tx_htt2_frm(buf);
  1275. }
  1276. /**
  1277. * qdf_nbuf_get_dhcp_subtype() - get the subtype
  1278. * of DHCP packet.
  1279. * @buf: Pointer to DHCP packet buffer
  1280. *
  1281. * This func. returns the subtype of DHCP packet.
  1282. *
  1283. * Return: subtype of the DHCP packet.
  1284. */
  1285. static inline enum qdf_proto_subtype
  1286. qdf_nbuf_get_dhcp_subtype(qdf_nbuf_t buf)
  1287. {
  1288. return __qdf_nbuf_data_get_dhcp_subtype(qdf_nbuf_data(buf));
  1289. }
  1290. /**
  1291. * qdf_nbuf_data_get_dhcp_subtype() - get the subtype
  1292. * of DHCP packet.
  1293. * @buf: Pointer to DHCP packet data buffer
  1294. *
  1295. * This func. returns the subtype of DHCP packet.
  1296. *
  1297. * Return: subtype of the DHCP packet.
  1298. */
  1299. static inline enum qdf_proto_subtype
  1300. qdf_nbuf_data_get_dhcp_subtype(uint8_t *data)
  1301. {
  1302. return __qdf_nbuf_data_get_dhcp_subtype(data);
  1303. }
  1304. /**
  1305. * qdf_nbuf_get_eapol_subtype() - get the subtype
  1306. * of EAPOL packet.
  1307. * @buf: Pointer to EAPOL packet buffer
  1308. *
  1309. * This func. returns the subtype of EAPOL packet.
  1310. *
  1311. * Return: subtype of the EAPOL packet.
  1312. */
  1313. static inline enum qdf_proto_subtype
  1314. qdf_nbuf_get_eapol_subtype(qdf_nbuf_t buf)
  1315. {
  1316. return __qdf_nbuf_data_get_eapol_subtype(qdf_nbuf_data(buf));
  1317. }
  1318. /**
  1319. * qdf_nbuf_data_get_eapol_subtype() - get the subtype
  1320. * of EAPOL packet.
  1321. * @data: Pointer to EAPOL packet data buffer
  1322. *
  1323. * This func. returns the subtype of EAPOL packet.
  1324. *
  1325. * Return: subtype of the EAPOL packet.
  1326. */
  1327. static inline enum qdf_proto_subtype
  1328. qdf_nbuf_data_get_eapol_subtype(uint8_t *data)
  1329. {
  1330. return __qdf_nbuf_data_get_eapol_subtype(data);
  1331. }
  1332. /**
  1333. * qdf_nbuf_get_arp_subtype() - get the subtype
  1334. * of ARP packet.
  1335. * @buf: Pointer to ARP packet buffer
  1336. *
  1337. * This func. returns the subtype of ARP packet.
  1338. *
  1339. * Return: subtype of the ARP packet.
  1340. */
  1341. static inline enum qdf_proto_subtype
  1342. qdf_nbuf_get_arp_subtype(qdf_nbuf_t buf)
  1343. {
  1344. return __qdf_nbuf_data_get_arp_subtype(qdf_nbuf_data(buf));
  1345. }
  1346. /**
  1347. * qdf_nbuf_data_get_arp_subtype() - get the subtype
  1348. * of ARP packet.
  1349. * @data: Pointer to ARP packet data buffer
  1350. *
  1351. * This func. returns the subtype of ARP packet.
  1352. *
  1353. * Return: subtype of the ARP packet.
  1354. */
  1355. static inline enum qdf_proto_subtype
  1356. qdf_nbuf_data_get_arp_subtype(uint8_t *data)
  1357. {
  1358. return __qdf_nbuf_data_get_arp_subtype(data);
  1359. }
  1360. /**
  1361. * qdf_nbuf_get_icmp_subtype() - get the subtype
  1362. * of IPV4 ICMP packet.
  1363. * @buf: Pointer to IPV4 ICMP packet buffer
  1364. *
  1365. * This func. returns the subtype of ICMP packet.
  1366. *
  1367. * Return: subtype of the ICMP packet.
  1368. */
  1369. static inline enum qdf_proto_subtype
  1370. qdf_nbuf_get_icmp_subtype(qdf_nbuf_t buf)
  1371. {
  1372. return __qdf_nbuf_data_get_icmp_subtype(qdf_nbuf_data(buf));
  1373. }
  1374. /**
  1375. * qdf_nbuf_data_get_icmp_subtype() - get the subtype
  1376. * of IPV4 ICMP packet.
  1377. * @data: Pointer to IPV4 ICMP packet data buffer
  1378. *
  1379. * This func. returns the subtype of ICMP packet.
  1380. *
  1381. * Return: subtype of the ICMP packet.
  1382. */
  1383. static inline enum qdf_proto_subtype
  1384. qdf_nbuf_data_get_icmp_subtype(uint8_t *data)
  1385. {
  1386. return __qdf_nbuf_data_get_icmp_subtype(data);
  1387. }
  1388. /**
  1389. * qdf_nbuf_get_icmpv6_subtype() - get the subtype
  1390. * of IPV6 ICMPV6 packet.
  1391. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  1392. *
  1393. * This func. returns the subtype of ICMPV6 packet.
  1394. *
  1395. * Return: subtype of the ICMPV6 packet.
  1396. */
  1397. static inline enum qdf_proto_subtype
  1398. qdf_nbuf_get_icmpv6_subtype(qdf_nbuf_t buf)
  1399. {
  1400. return __qdf_nbuf_data_get_icmpv6_subtype(qdf_nbuf_data(buf));
  1401. }
  1402. /**
  1403. * qdf_nbuf_data_get_icmpv6_subtype() - get the subtype
  1404. * of IPV6 ICMPV6 packet.
  1405. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  1406. *
  1407. * This func. returns the subtype of ICMPV6 packet.
  1408. *
  1409. * Return: subtype of the ICMPV6 packet.
  1410. */
  1411. static inline enum qdf_proto_subtype
  1412. qdf_nbuf_data_get_icmpv6_subtype(uint8_t *data)
  1413. {
  1414. return __qdf_nbuf_data_get_icmpv6_subtype(data);
  1415. }
  1416. /**
  1417. * qdf_nbuf_data_get_ipv4_proto() - get the proto type
  1418. * of IPV4 packet.
  1419. * @data: Pointer to IPV4 packet data buffer
  1420. *
  1421. * This func. returns the proto type of IPV4 packet.
  1422. *
  1423. * Return: proto type of IPV4 packet.
  1424. */
  1425. static inline uint8_t
  1426. qdf_nbuf_data_get_ipv4_proto(uint8_t *data)
  1427. {
  1428. return __qdf_nbuf_data_get_ipv4_proto(data);
  1429. }
  1430. /**
  1431. * qdf_nbuf_data_get_ipv6_proto() - get the proto type
  1432. * of IPV6 packet.
  1433. * @data: Pointer to IPV6 packet data buffer
  1434. *
  1435. * This func. returns the proto type of IPV6 packet.
  1436. *
  1437. * Return: proto type of IPV6 packet.
  1438. */
  1439. static inline uint8_t
  1440. qdf_nbuf_data_get_ipv6_proto(uint8_t *data)
  1441. {
  1442. return __qdf_nbuf_data_get_ipv6_proto(data);
  1443. }
  1444. /**
  1445. * qdf_nbuf_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  1446. * @buf: buffer
  1447. *
  1448. * This api is for Tx packets.
  1449. *
  1450. * Return: true if packet is ipv4 packet
  1451. */
  1452. static inline
  1453. bool qdf_nbuf_is_ipv4_pkt(qdf_nbuf_t buf)
  1454. {
  1455. return __qdf_nbuf_data_is_ipv4_pkt(qdf_nbuf_data(buf));
  1456. }
  1457. /**
  1458. * qdf_nbuf_data_is_ipv4_pkt() - check if packet is a ipv4 packet or not
  1459. * @data: data
  1460. *
  1461. * This api is for Tx packets.
  1462. *
  1463. * Return: true if packet is ipv4 packet
  1464. */
  1465. static inline
  1466. bool qdf_nbuf_data_is_ipv4_pkt(uint8_t *data)
  1467. {
  1468. return __qdf_nbuf_data_is_ipv4_pkt(data);
  1469. }
  1470. /**
  1471. * qdf_nbuf_is_ipv4_dhcp_pkt() - check if packet is a dhcp packet or not
  1472. * @buf: buffer
  1473. *
  1474. * This api is for ipv4 packet.
  1475. *
  1476. * Return: true if packet is DHCP packet
  1477. */
  1478. static inline
  1479. bool qdf_nbuf_is_ipv4_dhcp_pkt(qdf_nbuf_t buf)
  1480. {
  1481. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(qdf_nbuf_data(buf));
  1482. }
  1483. /**
  1484. * qdf_nbuf_data_is_ipv4_dhcp_pkt() - check if it is DHCP packet.
  1485. * @data: Pointer to DHCP packet data buffer
  1486. *
  1487. * This func. checks whether it is a DHCP packet or not.
  1488. *
  1489. * Return: true if it is a DHCP packet
  1490. * false if not
  1491. */
  1492. static inline
  1493. bool qdf_nbuf_data_is_ipv4_dhcp_pkt(uint8_t *data)
  1494. {
  1495. return __qdf_nbuf_data_is_ipv4_dhcp_pkt(data);
  1496. }
  1497. /**
  1498. * qdf_nbuf_is_ipv4_eapol_pkt() - check if packet is a eapol packet or not
  1499. * @buf: buffer
  1500. *
  1501. * This api is for ipv4 packet.
  1502. *
  1503. * Return: true if packet is EAPOL packet
  1504. */
  1505. static inline
  1506. bool qdf_nbuf_is_ipv4_eapol_pkt(qdf_nbuf_t buf)
  1507. {
  1508. return __qdf_nbuf_data_is_ipv4_eapol_pkt(qdf_nbuf_data(buf));
  1509. }
  1510. /**
  1511. * qdf_nbuf_data_is_ipv4_eapol_pkt() - check if it is EAPOL packet.
  1512. * @data: Pointer to EAPOL packet data buffer
  1513. *
  1514. * This func. checks whether it is a EAPOL packet or not.
  1515. *
  1516. * Return: true if it is a EAPOL packet
  1517. * false if not
  1518. */
  1519. static inline
  1520. bool qdf_nbuf_data_is_ipv4_eapol_pkt(uint8_t *data)
  1521. {
  1522. return __qdf_nbuf_data_is_ipv4_eapol_pkt(data);
  1523. }
  1524. /**
  1525. * qdf_nbuf_is_ipv4_wapi_pkt() - check if packet is a wapi packet or not
  1526. * @buf: buffer
  1527. *
  1528. * This api is for ipv4 packet.
  1529. *
  1530. * Return: true if packet is WAPI packet
  1531. */
  1532. static inline
  1533. bool qdf_nbuf_is_ipv4_wapi_pkt(qdf_nbuf_t buf)
  1534. {
  1535. return __qdf_nbuf_is_ipv4_wapi_pkt(buf);
  1536. }
  1537. /**
  1538. * qdf_nbuf_is_ipv4_arp_pkt() - check if packet is a arp packet or not
  1539. * @buf: buffer
  1540. *
  1541. * This api is for ipv4 packet.
  1542. *
  1543. * Return: true if packet is ARP packet
  1544. */
  1545. static inline
  1546. bool qdf_nbuf_is_ipv4_arp_pkt(qdf_nbuf_t buf)
  1547. {
  1548. return __qdf_nbuf_data_is_ipv4_arp_pkt(qdf_nbuf_data(buf));
  1549. }
  1550. /**
  1551. * qdf_nbuf_data_is_ipv4_arp_pkt() - check if it is ARP packet.
  1552. * @data: Pointer to ARP packet data buffer
  1553. *
  1554. * This func. checks whether it is a ARP packet or not.
  1555. *
  1556. * Return: TRUE if it is a ARP packet
  1557. * FALSE if not
  1558. */
  1559. static inline
  1560. bool qdf_nbuf_data_is_ipv4_arp_pkt(uint8_t *data)
  1561. {
  1562. return __qdf_nbuf_data_is_ipv4_arp_pkt(data);
  1563. }
  1564. /**
  1565. * qdf_nbuf_is_ipv6_pkt() - check if it is IPV6 packet.
  1566. * @buf: Pointer to IPV6 packet buffer
  1567. *
  1568. * This func. checks whether it is a IPV6 packet or not.
  1569. *
  1570. * Return: TRUE if it is a IPV6 packet
  1571. * FALSE if not
  1572. */
  1573. static inline
  1574. bool qdf_nbuf_is_ipv6_pkt(qdf_nbuf_t buf)
  1575. {
  1576. return __qdf_nbuf_data_is_ipv6_pkt(qdf_nbuf_data(buf));
  1577. }
  1578. /**
  1579. * qdf_nbuf_data_is_ipv6_pkt() - check if it is IPV6 packet.
  1580. * @data: Pointer to IPV6 packet data buffer
  1581. *
  1582. * This func. checks whether it is a IPV6 packet or not.
  1583. *
  1584. * Return: TRUE if it is a IPV6 packet
  1585. * FALSE if not
  1586. */
  1587. static inline
  1588. bool qdf_nbuf_data_is_ipv6_pkt(uint8_t *data)
  1589. {
  1590. return __qdf_nbuf_data_is_ipv6_pkt(data);
  1591. }
  1592. /**
  1593. * qdf_nbuf_data_is_ipv4_mcast_pkt() - check if it is IPV4 multicast packet.
  1594. * @data: Pointer to IPV4 packet data buffer
  1595. *
  1596. * This func. checks whether it is a IPV4 multicast packet or not.
  1597. *
  1598. * Return: TRUE if it is a IPV4 multicast packet
  1599. * FALSE if not
  1600. */
  1601. static inline
  1602. bool qdf_nbuf_data_is_ipv4_mcast_pkt(uint8_t *data)
  1603. {
  1604. return __qdf_nbuf_data_is_ipv4_mcast_pkt(data);
  1605. }
  1606. /**
  1607. * qdf_nbuf_data_is_ipv6_mcast_pkt() - check if it is IPV6 multicast packet.
  1608. * @data: Pointer to IPV6 packet data buffer
  1609. *
  1610. * This func. checks whether it is a IPV6 multicast packet or not.
  1611. *
  1612. * Return: TRUE if it is a IPV6 multicast packet
  1613. * FALSE if not
  1614. */
  1615. static inline
  1616. bool qdf_nbuf_data_is_ipv6_mcast_pkt(uint8_t *data)
  1617. {
  1618. return __qdf_nbuf_data_is_ipv6_mcast_pkt(data);
  1619. }
  1620. /**
  1621. * qdf_nbuf_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  1622. * @buf: Pointer to IPV4 ICMP packet buffer
  1623. *
  1624. * This func. checks whether it is a ICMP packet or not.
  1625. *
  1626. * Return: TRUE if it is a ICMP packet
  1627. * FALSE if not
  1628. */
  1629. static inline
  1630. bool qdf_nbuf_is_icmp_pkt(qdf_nbuf_t buf)
  1631. {
  1632. return __qdf_nbuf_data_is_icmp_pkt(qdf_nbuf_data(buf));
  1633. }
  1634. /**
  1635. * qdf_nbuf_data_is_icmp_pkt() - check if it is IPV4 ICMP packet.
  1636. * @data: Pointer to IPV4 ICMP packet data buffer
  1637. *
  1638. * This func. checks whether it is a ICMP packet or not.
  1639. *
  1640. * Return: TRUE if it is a ICMP packet
  1641. * FALSE if not
  1642. */
  1643. static inline
  1644. bool qdf_nbuf_data_is_icmp_pkt(uint8_t *data)
  1645. {
  1646. return __qdf_nbuf_data_is_icmp_pkt(data);
  1647. }
  1648. /**
  1649. * qdf_nbuf_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  1650. * @buf: Pointer to IPV6 ICMPV6 packet buffer
  1651. *
  1652. * This func. checks whether it is a ICMPV6 packet or not.
  1653. *
  1654. * Return: TRUE if it is a ICMPV6 packet
  1655. * FALSE if not
  1656. */
  1657. static inline
  1658. bool qdf_nbuf_is_icmpv6_pkt(qdf_nbuf_t buf)
  1659. {
  1660. return __qdf_nbuf_data_is_icmpv6_pkt(qdf_nbuf_data(buf));
  1661. }
  1662. /**
  1663. * qdf_nbuf_data_is_icmpv6_pkt() - check if it is IPV6 ICMPV6 packet.
  1664. * @data: Pointer to IPV6 ICMPV6 packet data buffer
  1665. *
  1666. * This func. checks whether it is a ICMPV6 packet or not.
  1667. *
  1668. * Return: TRUE if it is a ICMPV6 packet
  1669. * FALSE if not
  1670. */
  1671. static inline
  1672. bool qdf_nbuf_data_is_icmpv6_pkt(uint8_t *data)
  1673. {
  1674. return __qdf_nbuf_data_is_icmpv6_pkt(data);
  1675. }
  1676. /**
  1677. * qdf_nbuf_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  1678. * @buf: Pointer to IPV4 UDP packet buffer
  1679. *
  1680. * This func. checks whether it is a IPV4 UDP packet or not.
  1681. *
  1682. * Return: TRUE if it is a IPV4 UDP packet
  1683. * FALSE if not
  1684. */
  1685. static inline
  1686. bool qdf_nbuf_is_ipv4_udp_pkt(qdf_nbuf_t buf)
  1687. {
  1688. return __qdf_nbuf_data_is_ipv4_udp_pkt(qdf_nbuf_data(buf));
  1689. }
  1690. /**
  1691. * qdf_nbuf_data_is_ipv4_udp_pkt() - check if it is IPV4 UDP packet.
  1692. * @data: Pointer to IPV4 UDP packet data buffer
  1693. *
  1694. * This func. checks whether it is a IPV4 UDP packet or not.
  1695. *
  1696. * Return: TRUE if it is a IPV4 UDP packet
  1697. * FALSE if not
  1698. */
  1699. static inline
  1700. bool qdf_nbuf_data_is_ipv4_udp_pkt(uint8_t *data)
  1701. {
  1702. return __qdf_nbuf_data_is_ipv4_udp_pkt(data);
  1703. }
  1704. /**
  1705. * qdf_nbuf_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  1706. * @buf: Pointer to IPV4 TCP packet buffer
  1707. *
  1708. * This func. checks whether it is a IPV4 TCP packet or not.
  1709. *
  1710. * Return: TRUE if it is a IPV4 TCP packet
  1711. * FALSE if not
  1712. */
  1713. static inline
  1714. bool qdf_nbuf_is_ipv4_tcp_pkt(qdf_nbuf_t buf)
  1715. {
  1716. return __qdf_nbuf_data_is_ipv4_tcp_pkt(qdf_nbuf_data(buf));
  1717. }
  1718. /**
  1719. * qdf_nbuf_data_is_ipv4_tcp_pkt() - check if it is IPV4 TCP packet.
  1720. * @data: Pointer to IPV4 TCP packet data buffer
  1721. *
  1722. * This func. checks whether it is a IPV4 TCP packet or not.
  1723. *
  1724. * Return: TRUE if it is a IPV4 TCP packet
  1725. * FALSE if not
  1726. */
  1727. static inline
  1728. bool qdf_nbuf_data_is_ipv4_tcp_pkt(uint8_t *data)
  1729. {
  1730. return __qdf_nbuf_data_is_ipv4_tcp_pkt(data);
  1731. }
  1732. /**
  1733. * qdf_nbuf_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  1734. * @buf: Pointer to IPV6 UDP packet buffer
  1735. *
  1736. * This func. checks whether it is a IPV6 UDP packet or not.
  1737. *
  1738. * Return: TRUE if it is a IPV6 UDP packet
  1739. * FALSE if not
  1740. */
  1741. static inline
  1742. bool qdf_nbuf_is_ipv6_udp_pkt(qdf_nbuf_t buf)
  1743. {
  1744. return __qdf_nbuf_data_is_ipv6_udp_pkt(qdf_nbuf_data(buf));
  1745. }
  1746. /**
  1747. * qdf_nbuf_data_is_ipv6_udp_pkt() - check if it is IPV6 UDP packet.
  1748. * @data: Pointer to IPV6 UDP packet data buffer
  1749. *
  1750. * This func. checks whether it is a IPV6 UDP packet or not.
  1751. *
  1752. * Return: TRUE if it is a IPV6 UDP packet
  1753. * FALSE if not
  1754. */
  1755. static inline
  1756. bool qdf_nbuf_data_is_ipv6_udp_pkt(uint8_t *data)
  1757. {
  1758. return __qdf_nbuf_data_is_ipv6_udp_pkt(data);
  1759. }
  1760. /**
  1761. * qdf_nbuf_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  1762. * @buf: Pointer to IPV6 TCP packet buffer
  1763. *
  1764. * This func. checks whether it is a IPV6 TCP packet or not.
  1765. *
  1766. * Return: TRUE if it is a IPV6 TCP packet
  1767. * FALSE if not
  1768. */
  1769. static inline
  1770. bool qdf_nbuf_is_ipv6_tcp_pkt(qdf_nbuf_t buf)
  1771. {
  1772. return __qdf_nbuf_data_is_ipv6_tcp_pkt(qdf_nbuf_data(buf));
  1773. }
  1774. /**
  1775. * qdf_nbuf_data_is_ipv6_tcp_pkt() - check if it is IPV6 TCP packet.
  1776. * @data: Pointer to IPV6 TCP packet data buffer
  1777. *
  1778. * This func. checks whether it is a IPV6 TCP packet or not.
  1779. *
  1780. * Return: TRUE if it is a IPV6 TCP packet
  1781. * FALSE if not
  1782. */
  1783. static inline
  1784. bool qdf_nbuf_data_is_ipv6_tcp_pkt(uint8_t *data)
  1785. {
  1786. return __qdf_nbuf_data_is_ipv6_tcp_pkt(data);
  1787. }
  1788. /**
  1789. * qdf_invalidate_range() - invalidate virtual address range
  1790. * @start: start address of the address range
  1791. * @end: end address of the address range
  1792. *
  1793. * Note that this function does not write back the cache entries.
  1794. *
  1795. * Return: none
  1796. */
  1797. static inline void qdf_invalidate_range(void *start, void *end)
  1798. {
  1799. __qdf_invalidate_range(start, end);
  1800. }
  1801. /**
  1802. * qdf_nbuf_reset_num_frags() - decrement the number of fragments
  1803. * @buf: Network buffer
  1804. *
  1805. * Return: Number of fragments
  1806. */
  1807. static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf)
  1808. {
  1809. __qdf_nbuf_reset_num_frags(buf);
  1810. }
  1811. /**
  1812. * qdf_dmaaddr_to_32s - return high and low parts of dma_addr
  1813. *
  1814. * Returns the high and low 32-bits of the DMA addr in the provided ptrs
  1815. *
  1816. * Return: N/A
  1817. */
  1818. static inline void qdf_dmaaddr_to_32s(qdf_dma_addr_t dmaaddr,
  1819. uint32_t *lo, uint32_t *hi)
  1820. {
  1821. return __qdf_dmaaddr_to_32s(dmaaddr, lo, hi);
  1822. }
  1823. /**
  1824. * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO
  1825. * network buffer into segments
  1826. * @nbuf: network buffer to be segmented
  1827. * @tso_info: This is the output. The information about the
  1828. * TSO segments will be populated within this.
  1829. *
  1830. * This function fragments a TCP jumbo packet into smaller
  1831. * segments to be transmitted by the driver. It chains the TSO
  1832. * segments created into a list.
  1833. *
  1834. * Return: number of TSO segments
  1835. */
  1836. static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev,
  1837. qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info)
  1838. {
  1839. return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info);
  1840. }
  1841. /**
  1842. * qdf_nbuf_unmap_tso_segment() - function to dma unmap TSO segment element
  1843. *
  1844. * @osdev: qdf device handle
  1845. * @tso_seg: TSO segment element to be unmapped
  1846. * @is_last_seg: whether this is last tso seg or not
  1847. *
  1848. * Return: none
  1849. */
  1850. static inline void qdf_nbuf_unmap_tso_segment(qdf_device_t osdev,
  1851. struct qdf_tso_seg_elem_t *tso_seg,
  1852. bool is_last_seg)
  1853. {
  1854. return __qdf_nbuf_unmap_tso_segment(osdev, tso_seg, is_last_seg);
  1855. }
  1856. /**
  1857. * qdf_nbuf_get_tso_num_seg() - function to calculate the number
  1858. * of TCP segments within the TSO jumbo packet
  1859. * @nbuf: TSO jumbo network buffer to be segmented
  1860. *
  1861. * This function calculates the number of TCP segments that the
  1862. network buffer can be divided into.
  1863. *
  1864. * Return: number of TCP segments
  1865. */
  1866. static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf)
  1867. {
  1868. return __qdf_nbuf_get_tso_num_seg(nbuf);
  1869. }
  1870. /**
  1871. * qdf_nbuf_inc_users() - function to increment the number of
  1872. * users referencing this network buffer
  1873. *
  1874. * @nbuf: network buffer
  1875. *
  1876. * This function increments the number of users referencing this
  1877. * network buffer
  1878. *
  1879. * Return: the network buffer
  1880. */
  1881. static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf)
  1882. {
  1883. return __qdf_nbuf_inc_users(nbuf);
  1884. }
  1885. /**
  1886. * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb
  1887. *
  1888. * @nbuf: Network buffer (skb on linux)
  1889. *
  1890. * This function returns the values of data_attr field
  1891. * in struct cvg_nbuf_cb{}, to which skb->cb is typecast.
  1892. * This value is actually the value programmed in CE descriptor.
  1893. *
  1894. * Return: Value of data_attr
  1895. */
  1896. static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf)
  1897. {
  1898. return __qdf_nbuf_data_attr_get(buf);
  1899. }
  1900. /**
  1901. * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb
  1902. *
  1903. * @nbuf: Network buffer (skb on linux)
  1904. * @data_attr: Value to be stored cvg_nbuf_cb->data_attr
  1905. *
  1906. * This function stores the value to be programmed in CE
  1907. * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{}
  1908. *
  1909. * Return: void
  1910. */
  1911. static inline
  1912. void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr)
  1913. {
  1914. __qdf_nbuf_data_attr_set(buf, data_attr);
  1915. }
  1916. /**
  1917. * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata
  1918. *
  1919. * @nbuf: Network buffer (skb on linux)
  1920. *
  1921. * This function parses the payload to figure out relevant
  1922. * Tx meta-data e.g. whether to enable tx_classify bit
  1923. * in CE.
  1924. *
  1925. * Return: void
  1926. */
  1927. #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get
  1928. void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state);
  1929. void qdf_nbuf_tx_desc_count_display(void);
  1930. void qdf_nbuf_tx_desc_count_clear(void);
  1931. static inline qdf_nbuf_t
  1932. qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom)
  1933. {
  1934. return __qdf_nbuf_realloc_headroom(buf, headroom);
  1935. }
  1936. static inline qdf_nbuf_t
  1937. qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom)
  1938. {
  1939. return __qdf_nbuf_realloc_tailroom(buf, tailroom);
  1940. }
  1941. static inline qdf_nbuf_t
  1942. qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom)
  1943. {
  1944. return __qdf_nbuf_expand(buf, headroom, tailroom);
  1945. }
  1946. static inline qdf_nbuf_t
  1947. qdf_nbuf_unshare(qdf_nbuf_t buf)
  1948. {
  1949. return __qdf_nbuf_unshare(buf);
  1950. }
  1951. static inline bool
  1952. qdf_nbuf_is_cloned(qdf_nbuf_t buf)
  1953. {
  1954. return __qdf_nbuf_is_cloned(buf);
  1955. }
  1956. static inline void
  1957. qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg)
  1958. {
  1959. __qdf_nbuf_frag_info(buf, sg);
  1960. }
  1961. static inline qdf_nbuf_tx_cksum_t
  1962. qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where)
  1963. {
  1964. return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where);
  1965. }
  1966. static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf)
  1967. {
  1968. __qdf_nbuf_reset_ctxt(nbuf);
  1969. }
  1970. static inline void
  1971. qdf_nbuf_set_rx_info(__qdf_nbuf_t nbuf, void *info, uint32_t len)
  1972. {
  1973. __qdf_nbuf_set_rx_info(nbuf, info, len);
  1974. }
  1975. static inline void *qdf_nbuf_get_rx_info(__qdf_nbuf_t nbuf)
  1976. {
  1977. return __qdf_nbuf_get_rx_info(nbuf);
  1978. }
  1979. static inline void qdf_nbuf_init(qdf_nbuf_t buf)
  1980. {
  1981. __qdf_nbuf_init(buf);
  1982. }
  1983. static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf)
  1984. {
  1985. return __qdf_nbuf_network_header(buf);
  1986. }
  1987. static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf)
  1988. {
  1989. return __qdf_nbuf_transport_header(buf);
  1990. }
  1991. static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf)
  1992. {
  1993. return __qdf_nbuf_tcp_tso_size(buf);
  1994. }
  1995. static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf)
  1996. {
  1997. return __qdf_nbuf_get_cb(nbuf);
  1998. }
  1999. static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf)
  2000. {
  2001. return __qdf_nbuf_get_nr_frags(nbuf);
  2002. }
  2003. static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf)
  2004. {
  2005. return __qdf_nbuf_headlen(buf);
  2006. }
  2007. static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev,
  2008. qdf_nbuf_t buf, int offset,
  2009. qdf_dma_dir_t dir, int cur_frag)
  2010. {
  2011. return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag);
  2012. }
  2013. static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf)
  2014. {
  2015. return __qdf_nbuf_tso_tcp_v4(buf);
  2016. }
  2017. static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf)
  2018. {
  2019. return __qdf_nbuf_tso_tcp_v6(buf);
  2020. }
  2021. static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf)
  2022. {
  2023. return __qdf_nbuf_tcp_seq(buf);
  2024. }
  2025. static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf)
  2026. {
  2027. return __qdf_nbuf_l2l3l4_hdr_len(buf);
  2028. }
  2029. static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf)
  2030. {
  2031. return __qdf_nbuf_is_nonlinear(buf);
  2032. }
  2033. static inline uint32_t
  2034. qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num)
  2035. {
  2036. return __qdf_nbuf_get_frag_size(buf, frag_num);
  2037. }
  2038. static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf)
  2039. {
  2040. return __qdf_nbuf_get_priority(buf);
  2041. }
  2042. static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p)
  2043. {
  2044. __qdf_nbuf_set_priority(buf, p);
  2045. }
  2046. static inline uint16_t
  2047. qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf)
  2048. {
  2049. return __qdf_nbuf_get_queue_mapping(buf);
  2050. }
  2051. static inline uint8_t *
  2052. qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf)
  2053. {
  2054. return __qdf_nbuf_get_priv_ptr(buf);
  2055. }
  2056. /**
  2057. * qdf_nbuf_update_radiotap() - update radiotap at head of nbuf.
  2058. * @rx_status: rx_status containing required info to update radiotap
  2059. * @nbuf: Pointer to nbuf
  2060. * @headroom_sz: Available headroom size
  2061. *
  2062. * Return: radiotap length.
  2063. */
  2064. unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status,
  2065. qdf_nbuf_t nbuf, uint32_t headroom_sz);
  2066. /**
  2067. * qdf_nbuf_mark_wakeup_frame() - mark wakeup frame.
  2068. * @buf: Pointer to nbuf
  2069. *
  2070. * Return: None
  2071. */
  2072. static inline void
  2073. qdf_nbuf_mark_wakeup_frame(qdf_nbuf_t buf)
  2074. {
  2075. __qdf_nbuf_mark_wakeup_frame(buf);
  2076. }
  2077. /**
  2078. * qdf_nbuf_reg_free_cb - Registers nbuf free callback
  2079. * @cb_func_ptr: Callback pointer
  2080. *
  2081. * This function registers nbuf free callback
  2082. *
  2083. * Return: void
  2084. */
  2085. static inline void
  2086. qdf_nbuf_reg_free_cb(qdf_nbuf_free_t cb_func_ptr)
  2087. {
  2088. __qdf_nbuf_reg_free_cb(cb_func_ptr);
  2089. }
  2090. #endif /* _QDF_NBUF_H */