qdf_nbuf.h 61 KB

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