qdf_nbuf.h 70 KB

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