qdf_nbuf.h 48 KB

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