qdf_nbuf.h 57 KB

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