qdf_nbuf.h 51 KB

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