qdf_nbuf.h 70 KB

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