qdf_nbuf.h 58 KB

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