qdf_nbuf.h 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292
  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_MAX_STRING 12
  43. #define QDF_NBUF_PKT_TRAC_PROTO_STRING 4
  44. #define QDF_NBUF_PKT_ERROR 1
  45. /* Tracked Packet types */
  46. #define QDF_NBUF_TX_PKT_INVALID 0
  47. #define QDF_NBUF_TX_PKT_DATA_TRACK 1
  48. #define QDF_NBUF_TX_PKT_MGMT_TRACK 2
  49. /* Different Packet states */
  50. #define QDF_NBUF_TX_PKT_HDD 1
  51. #define QDF_NBUF_TX_PKT_TXRX_ENQUEUE 2
  52. #define QDF_NBUF_TX_PKT_TXRX_DEQUEUE 3
  53. #define QDF_NBUF_TX_PKT_TXRX 4
  54. #define QDF_NBUF_TX_PKT_HTT 5
  55. #define QDF_NBUF_TX_PKT_HTC 6
  56. #define QDF_NBUF_TX_PKT_HIF 7
  57. #define QDF_NBUF_TX_PKT_CE 8
  58. #define QDF_NBUF_TX_PKT_FREE 9
  59. #define QDF_NBUF_TX_PKT_STATE_MAX 10
  60. #define QDF_NBUF_IPA_CHECK_MASK 0x80000000
  61. /**
  62. * @qdf_nbuf_t - Platform indepedent packet abstraction
  63. */
  64. typedef __qdf_nbuf_t qdf_nbuf_t;
  65. /**
  66. * @qdf_dma_map_cb_t - Dma map callback prototype
  67. */
  68. typedef void (*qdf_dma_map_cb_t)(void *arg, qdf_nbuf_t buf,
  69. qdf_dma_map_t dmap);
  70. /**
  71. * @qdf_nbuf_queue_t - Platform independent packet queue abstraction
  72. */
  73. typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t;
  74. /* BUS/DMA mapping routines */
  75. static inline QDF_STATUS
  76. qdf_nbuf_dmamap_create(qdf_device_t osdev, qdf_dma_map_t *dmap)
  77. {
  78. return __qdf_nbuf_dmamap_create(osdev, dmap);
  79. }
  80. static inline void
  81. qdf_nbuf_dmamap_destroy(qdf_device_t osdev, qdf_dma_map_t dmap)
  82. {
  83. __qdf_nbuf_dmamap_destroy(osdev, dmap);
  84. }
  85. static inline void
  86. qdf_nbuf_dmamap_set_cb(qdf_dma_map_t dmap, qdf_dma_map_cb_t cb, void *arg)
  87. {
  88. __qdf_nbuf_dmamap_set_cb(dmap, cb, arg);
  89. }
  90. static inline void
  91. qdf_nbuf_set_send_complete_flag(qdf_nbuf_t buf, bool flag)
  92. {
  93. __qdf_nbuf_set_send_complete_flag(buf, flag);
  94. }
  95. static inline QDF_STATUS
  96. qdf_nbuf_map(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  97. {
  98. return __qdf_nbuf_map(osdev, buf, dir);
  99. }
  100. static inline void
  101. qdf_nbuf_unmap(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  102. {
  103. __qdf_nbuf_unmap(osdev, buf, dir);
  104. }
  105. static inline QDF_STATUS
  106. qdf_nbuf_map_nbytes(qdf_device_t osdev, qdf_nbuf_t buf,
  107. qdf_dma_dir_t dir, int nbytes)
  108. {
  109. return __qdf_nbuf_map_nbytes(osdev, buf, dir, nbytes);
  110. }
  111. static inline void
  112. qdf_nbuf_unmap_nbytes(qdf_device_t osdev,
  113. qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  114. {
  115. __qdf_nbuf_unmap_nbytes(osdev, buf, dir, nbytes);
  116. }
  117. #ifndef REMOVE_INIT_DEBUG_CODE
  118. static inline void
  119. qdf_nbuf_sync_for_cpu(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  120. {
  121. __qdf_nbuf_sync_for_cpu(osdev, buf, dir);
  122. }
  123. #endif
  124. static inline QDF_STATUS
  125. qdf_nbuf_map_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  126. {
  127. return __qdf_nbuf_map_single(osdev, buf, dir);
  128. }
  129. static inline QDF_STATUS
  130. qdf_nbuf_map_nbytes_single(
  131. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  132. {
  133. return __qdf_nbuf_map_nbytes_single(osdev, buf, dir, nbytes);
  134. }
  135. static inline void
  136. qdf_nbuf_unmap_single(qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir)
  137. {
  138. __qdf_nbuf_unmap_single(osdev, buf, dir);
  139. }
  140. static inline void
  141. qdf_nbuf_unmap_nbytes_single(
  142. qdf_device_t osdev, qdf_nbuf_t buf, qdf_dma_dir_t dir, int nbytes)
  143. {
  144. return __qdf_nbuf_unmap_nbytes_single(osdev, buf, dir, nbytes);
  145. }
  146. static inline int qdf_nbuf_get_num_frags(qdf_nbuf_t buf)
  147. {
  148. return __qdf_nbuf_get_num_frags(buf);
  149. }
  150. /**
  151. * qdf_nbuf_get_frag_len() - get fragment length
  152. * @buf: Network buffer
  153. * @frag_num: Fragment number
  154. *
  155. * Return: Fragment length
  156. */
  157. static inline int qdf_nbuf_get_frag_len(qdf_nbuf_t buf, int frag_num)
  158. {
  159. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  160. return __qdf_nbuf_get_frag_len(buf, frag_num);
  161. }
  162. /**
  163. * qdf_nbuf_get_frag_vaddr() - get fragment virtual address
  164. * @buf: Network buffer
  165. * @frag_num: Fragment number
  166. *
  167. * Return: Fragment virtual address
  168. */
  169. static inline unsigned char *qdf_nbuf_get_frag_vaddr(qdf_nbuf_t buf,
  170. int frag_num)
  171. {
  172. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  173. return __qdf_nbuf_get_frag_vaddr(buf, frag_num);
  174. }
  175. /**
  176. * qdf_nbuf_get_frag_vaddr_always() - get fragment virtual address
  177. * @buf: Network buffer
  178. *
  179. * Return: Fragment virtual address
  180. */
  181. static inline unsigned char *
  182. qdf_nbuf_get_frag_vaddr_always(qdf_nbuf_t buf)
  183. {
  184. return __qdf_nbuf_get_frag_vaddr_always(buf);
  185. }
  186. /**
  187. * qdf_nbuf_get_frag_paddr() - get fragment physical address
  188. * @buf: Network buffer
  189. * @frag_num: Fragment number
  190. *
  191. * Return: Fragment physical address
  192. */
  193. static inline qdf_dma_addr_t qdf_nbuf_get_frag_paddr(qdf_nbuf_t buf,
  194. unsigned int frag_num)
  195. {
  196. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  197. return __qdf_nbuf_get_frag_paddr(buf, frag_num);
  198. }
  199. /**
  200. * qdf_nbuf_get_frag_is_wordstream() - is fragment wordstream
  201. * @buf: Network buffer
  202. * @frag_num: Fragment number
  203. *
  204. * Return: Fragment wordstream or not
  205. */
  206. static inline int qdf_nbuf_get_frag_is_wordstream(qdf_nbuf_t buf, int frag_num)
  207. {
  208. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  209. return __qdf_nbuf_get_frag_is_wordstream(buf, frag_num);
  210. }
  211. static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)
  212. {
  213. return __qdf_nbuf_ipa_owned_get(buf);
  214. }
  215. static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)
  216. {
  217. __qdf_nbuf_ipa_owned_set(buf);
  218. }
  219. static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)
  220. {
  221. return __qdf_nbuf_ipa_priv_get(buf);
  222. }
  223. static inline void qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf, uint32_t priv)
  224. {
  225. QDF_BUG(!(priv & QDF_NBUF_IPA_CHECK_MASK));
  226. __qdf_nbuf_ipa_priv_set(buf, priv);
  227. }
  228. /**
  229. * qdf_nbuf_set_frag_is_wordstream() - set fragment wordstream
  230. * @buf: Network buffer
  231. * @frag_num: Fragment number
  232. * @is_wordstream: Wordstream
  233. *
  234. * Return: none
  235. */
  236. static inline void
  237. qdf_nbuf_set_frag_is_wordstream(qdf_nbuf_t buf,
  238. int frag_num, int is_wordstream)
  239. {
  240. QDF_BUG(!(frag_num >= QDF_NBUF_CB_TX_MAX_EXTRA_FRAGS));
  241. __qdf_nbuf_set_frag_is_wordstream(buf, frag_num, is_wordstream);
  242. }
  243. static inline void
  244. qdf_nbuf_set_vdev_ctx(qdf_nbuf_t buf, void *vdev_ctx)
  245. {
  246. __qdf_nbuf_set_vdev_ctx(buf, vdev_ctx);
  247. }
  248. static inline void
  249. qdf_nbuf_set_fctx_type(qdf_nbuf_t buf, void *ctx, uint8_t type)
  250. {
  251. __qdf_nbuf_set_fctx_type(buf, ctx, type);
  252. }
  253. static inline void *
  254. qdf_nbuf_get_vdev_ctx(qdf_nbuf_t buf)
  255. {
  256. return __qdf_nbuf_get_vdev_ctx(buf);
  257. }
  258. static inline void *qdf_nbuf_get_fctx(qdf_nbuf_t buf)
  259. {
  260. return __qdf_nbuf_get_fctx(buf);
  261. }
  262. static inline uint8_t qdf_nbuf_get_ftype(qdf_nbuf_t buf)
  263. {
  264. return __qdf_nbuf_get_ftype(buf);
  265. }
  266. static inline qdf_dma_addr_t
  267. qdf_nbuf_mapped_paddr_get(qdf_nbuf_t buf)
  268. {
  269. return __qdf_nbuf_mapped_paddr_get(buf);
  270. }
  271. static inline void
  272. qdf_nbuf_mapped_paddr_set(qdf_nbuf_t buf, qdf_dma_addr_t paddr)
  273. {
  274. __qdf_nbuf_mapped_paddr_set(buf, paddr);
  275. }
  276. static inline void
  277. qdf_nbuf_frag_push_head(qdf_nbuf_t buf,
  278. int frag_len, char *frag_vaddr,
  279. qdf_dma_addr_t frag_paddr)
  280. {
  281. __qdf_nbuf_frag_push_head(buf, frag_len, frag_vaddr, frag_paddr);
  282. }
  283. /* For efficiency, it is the responsibility of the caller to ensure that val
  284. * is either 0 or 1.
  285. */
  286. static inline void
  287. qdf_nbuf_set_chfrag_start(qdf_nbuf_t buf, uint8_t val)
  288. {
  289. __qdf_nbuf_set_chfrag_start(buf, val);
  290. }
  291. static inline int qdf_nbuf_is_chfrag_start(qdf_nbuf_t buf)
  292. {
  293. return __qdf_nbuf_is_chfrag_start(buf);
  294. }
  295. /* For efficiency, it is the responsibility of the caller to ensure that val
  296. * is either 0 or 1.
  297. */
  298. static inline void qdf_nbuf_set_chfrag_end(qdf_nbuf_t buf, uint8_t val)
  299. {
  300. __qdf_nbuf_set_chfrag_end(buf, val);
  301. }
  302. static inline int qdf_nbuf_is_chfrag_end(qdf_nbuf_t buf)
  303. {
  304. return __qdf_nbuf_is_chfrag_end(buf);
  305. }
  306. static inline void
  307. qdf_nbuf_dma_map_info(qdf_dma_map_t bmap, qdf_dmamap_info_t *sg)
  308. {
  309. __qdf_nbuf_dma_map_info(bmap, sg);
  310. }
  311. #ifdef MEMORY_DEBUG
  312. void qdf_net_buf_debug_init(void);
  313. void qdf_net_buf_debug_exit(void);
  314. void qdf_net_buf_debug_clean(void);
  315. void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
  316. uint8_t *file_name, uint32_t line_num);
  317. void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
  318. void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
  319. /* nbuf allocation rouines */
  320. #define qdf_nbuf_alloc(d, s, r, a, p) \
  321. qdf_nbuf_alloc_debug(d, s, r, a, p, __FILE__, __LINE__)
  322. static inline qdf_nbuf_t
  323. qdf_nbuf_alloc_debug(qdf_device_t osdev, qdf_size_t size, int reserve,
  324. int align, int prio, uint8_t *file_name,
  325. uint32_t line_num)
  326. {
  327. qdf_nbuf_t net_buf;
  328. net_buf = __qdf_nbuf_alloc(osdev, size, reserve, align, prio);
  329. /* Store SKB in internal QDF tracking table */
  330. if (qdf_likely(net_buf))
  331. qdf_net_buf_debug_add_node(net_buf, size, file_name, line_num);
  332. return net_buf;
  333. }
  334. static inline void qdf_nbuf_free(qdf_nbuf_t net_buf)
  335. {
  336. /* Remove SKB from internal QDF tracking table */
  337. if (qdf_likely(net_buf))
  338. qdf_net_buf_debug_delete_node(net_buf);
  339. __qdf_nbuf_free(net_buf);
  340. }
  341. #else
  342. static inline void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
  343. {
  344. return;
  345. }
  346. /* Nbuf allocation rouines */
  347. static inline qdf_nbuf_t
  348. qdf_nbuf_alloc(qdf_device_t osdev,
  349. qdf_size_t size, int reserve, int align, int prio)
  350. {
  351. return __qdf_nbuf_alloc(osdev, size, reserve, align, prio);
  352. }
  353. static inline void qdf_nbuf_free(qdf_nbuf_t buf)
  354. {
  355. __qdf_nbuf_free(buf);
  356. }
  357. #endif
  358. static inline void qdf_nbuf_tx_free(qdf_nbuf_t buf_list, int tx_err)
  359. {
  360. __qdf_nbuf_tx_free(buf_list, tx_err);
  361. }
  362. static inline void qdf_nbuf_ref(qdf_nbuf_t buf)
  363. {
  364. __qdf_nbuf_ref(buf);
  365. }
  366. static inline int qdf_nbuf_shared(qdf_nbuf_t buf)
  367. {
  368. return __qdf_nbuf_shared(buf);
  369. }
  370. static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf)
  371. {
  372. return __qdf_nbuf_copy(buf);
  373. }
  374. static inline QDF_STATUS qdf_nbuf_cat(qdf_nbuf_t dst, qdf_nbuf_t src)
  375. {
  376. return __qdf_nbuf_cat(dst, src);
  377. }
  378. /**
  379. * @qdf_nbuf_copy_bits() - return the length of the copy bits for skb
  380. * @skb: SKB pointer
  381. * @offset: offset
  382. * @len: Length
  383. * @to: To
  384. *
  385. * Return: int32_t
  386. */
  387. static inline int32_t
  388. qdf_nbuf_copy_bits(qdf_nbuf_t nbuf, uint32_t offset, uint32_t len, void *to)
  389. {
  390. return __qdf_nbuf_copy_bits(nbuf, offset, len, to);
  391. }
  392. /**
  393. * qdf_nbuf_clone() - clone the nbuf (copy is readonly)
  394. * @buf: nbuf to clone from
  395. *
  396. * Return: cloned buffer
  397. */
  398. static inline qdf_nbuf_t qdf_nbuf_clone(qdf_nbuf_t buf)
  399. {
  400. return __qdf_nbuf_clone(buf);
  401. }
  402. /* nbuf manipulation routines */
  403. /**
  404. * @qdf_nbuf_head() - return the address of an nbuf's buffer
  405. * @buf: netbuf
  406. *
  407. * Return: head address
  408. */
  409. static inline uint8_t *qdf_nbuf_head(qdf_nbuf_t buf)
  410. {
  411. return __qdf_nbuf_head(buf);
  412. }
  413. /**
  414. * qdf_nbuf_data() - Return the address of the start of data within an nbuf
  415. * @buf: Network buffer
  416. *
  417. * Return: Data address
  418. */
  419. static inline uint8_t *qdf_nbuf_data(qdf_nbuf_t buf)
  420. {
  421. return __qdf_nbuf_data(buf);
  422. }
  423. /**
  424. * qdf_nbuf_headroom() - amount of headroom int the current nbuf
  425. * @buf: Network buffer
  426. *
  427. * Return: Amount of head room
  428. */
  429. static inline uint32_t qdf_nbuf_headroom(qdf_nbuf_t buf)
  430. {
  431. return __qdf_nbuf_headroom(buf);
  432. }
  433. /**
  434. * qdf_nbuf_tailroom() - amount of tail space available
  435. * @buf: Network buffer
  436. *
  437. * Return: amount of tail room
  438. */
  439. static inline uint32_t qdf_nbuf_tailroom(qdf_nbuf_t buf)
  440. {
  441. return __qdf_nbuf_tailroom(buf);
  442. }
  443. /**
  444. * qdf_nbuf_push_head() - push data in the front
  445. * @buf: Network buf instance
  446. * @size: Size to be pushed
  447. *
  448. * Return: New data pointer of this buf after data has been pushed,
  449. * or NULL if there is not enough room in this buf.
  450. */
  451. static inline uint8_t *qdf_nbuf_push_head(qdf_nbuf_t buf, qdf_size_t size)
  452. {
  453. return __qdf_nbuf_push_head(buf, size);
  454. }
  455. /**
  456. * qdf_nbuf_put_tail() - puts data in the end
  457. * @buf: Network buf instance
  458. * @size: Size to be pushed
  459. *
  460. * Return: Data pointer of this buf where new data has to be
  461. * put, or NULL if there is not enough room in this buf.
  462. */
  463. static inline uint8_t *qdf_nbuf_put_tail(qdf_nbuf_t buf, qdf_size_t size)
  464. {
  465. return __qdf_nbuf_put_tail(buf, size);
  466. }
  467. /**
  468. * qdf_nbuf_pull_head() - pull data out from the front
  469. * @buf: Network buf instance
  470. * @size: Size to be popped
  471. *
  472. * Return: New data pointer of this buf after data has been popped,
  473. * or NULL if there is not sufficient data to pull.
  474. */
  475. static inline uint8_t *qdf_nbuf_pull_head(qdf_nbuf_t buf, qdf_size_t size)
  476. {
  477. return __qdf_nbuf_pull_head(buf, size);
  478. }
  479. /**
  480. * qdf_nbuf_trim_tail() - trim data out from the end
  481. * @buf: Network buf instance
  482. * @size: Size to be popped
  483. *
  484. * Return: none
  485. */
  486. static inline void qdf_nbuf_trim_tail(qdf_nbuf_t buf, qdf_size_t size)
  487. {
  488. __qdf_nbuf_trim_tail(buf, size);
  489. }
  490. /**
  491. * qdf_nbuf_len() - get the length of the buf
  492. * @buf: Network buf instance
  493. *
  494. * Return: total length of this buf.
  495. */
  496. static inline qdf_size_t qdf_nbuf_len(qdf_nbuf_t buf)
  497. {
  498. return __qdf_nbuf_len(buf);
  499. }
  500. /**
  501. * qdf_nbuf_set_pktlen() - set the length of the buf
  502. * @buf: Network buf instance
  503. * @size: Size to be set
  504. *
  505. * Return: none
  506. */
  507. static inline void qdf_nbuf_set_pktlen(qdf_nbuf_t buf, uint32_t len)
  508. {
  509. __qdf_nbuf_set_pktlen(buf, len);
  510. }
  511. /**
  512. * qdf_nbuf_reserve() - trim data out from the end
  513. * @buf: Network buf instance
  514. * @size: Size to be popped
  515. *
  516. * Return: none
  517. */
  518. static inline void qdf_nbuf_reserve(qdf_nbuf_t buf, qdf_size_t size)
  519. {
  520. __qdf_nbuf_reserve(buf, size);
  521. }
  522. /**
  523. * qdf_nbuf_peek_header() - return the data pointer & length of the header
  524. * @buf: Network nbuf
  525. * @addr: Data pointer
  526. * @len: Length of the data
  527. *
  528. * Return: none
  529. */
  530. static inline void
  531. qdf_nbuf_peek_header(qdf_nbuf_t buf, uint8_t **addr, uint32_t *len)
  532. {
  533. __qdf_nbuf_peek_header(buf, addr, len);
  534. }
  535. /* nbuf queue routines */
  536. /**
  537. * qdf_nbuf_queue_init() - initialize buf queue
  538. * @head: Network buf queue head
  539. *
  540. * Return: none
  541. */
  542. static inline void qdf_nbuf_queue_init(qdf_nbuf_queue_t *head)
  543. {
  544. __qdf_nbuf_queue_init(head);
  545. }
  546. /**
  547. * qdf_nbuf_queue_add() - append a nbuf to the tail of the buf queue
  548. * @head: Network buf queue head
  549. * @buf: Network buf
  550. *
  551. * Return: none
  552. */
  553. static inline void qdf_nbuf_queue_add(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  554. {
  555. __qdf_nbuf_queue_add(head, buf);
  556. }
  557. /**
  558. * qdf_nbuf_queue_insert_head() - insert nbuf at the head of queue
  559. * @head: Network buf queue head
  560. * @buf: Network buf
  561. *
  562. * Return: none
  563. */
  564. static inline void
  565. qdf_nbuf_queue_insert_head(qdf_nbuf_queue_t *head, qdf_nbuf_t buf)
  566. {
  567. __qdf_nbuf_queue_insert_head(head, buf);
  568. }
  569. /**
  570. * qdf_nbuf_queue_remove() - retrieve a buf from the head of the buf queue
  571. * @head: Network buf queue head
  572. *
  573. * Return: The head buf in the buf queue.
  574. */
  575. static inline qdf_nbuf_t qdf_nbuf_queue_remove(qdf_nbuf_queue_t *head)
  576. {
  577. return __qdf_nbuf_queue_remove(head);
  578. }
  579. /**
  580. * qdf_nbuf_queue_len() - get the length of the queue
  581. * @head: Network buf queue head
  582. *
  583. * Return: length of the queue
  584. */
  585. static inline uint32_t qdf_nbuf_queue_len(qdf_nbuf_queue_t *head)
  586. {
  587. return __qdf_nbuf_queue_len(head);
  588. }
  589. /**
  590. * qdf_nbuf_queue_next() - get the next guy/packet of the given buffer
  591. * @buf: Network buffer
  592. *
  593. * Return: next buffer/packet
  594. */
  595. static inline qdf_nbuf_t qdf_nbuf_queue_next(qdf_nbuf_t buf)
  596. {
  597. return __qdf_nbuf_queue_next(buf);
  598. }
  599. /**
  600. * @qdf_nbuf_is_queue_empty() - check if the buf queue is empty
  601. * @nbq: Network buf queue handle
  602. *
  603. * Return: true if queue is empty
  604. * false if queue is not emty
  605. */
  606. static inline bool qdf_nbuf_is_queue_empty(qdf_nbuf_queue_t *nbq)
  607. {
  608. return __qdf_nbuf_is_queue_empty(nbq);
  609. }
  610. static inline qdf_nbuf_queue_t *
  611. qdf_nbuf_queue_append(qdf_nbuf_queue_t *dest, qdf_nbuf_queue_t *src)
  612. {
  613. return __qdf_nbuf_queue_append(dest, src);
  614. }
  615. static inline void
  616. qdf_nbuf_queue_free(qdf_nbuf_queue_t *head)
  617. {
  618. __qdf_nbuf_queue_free(head);
  619. }
  620. static inline qdf_nbuf_t
  621. qdf_nbuf_queue_first(qdf_nbuf_queue_t *head)
  622. {
  623. return __qdf_nbuf_queue_first(head);
  624. }
  625. /**
  626. * qdf_nbuf_next() - get the next packet in the linked list
  627. * @buf: Network buffer
  628. *
  629. * This function can be used when nbufs are directly linked into a list,
  630. * rather than using a separate network buffer queue object.
  631. *
  632. * Return: next network buffer in the linked list
  633. */
  634. static inline qdf_nbuf_t qdf_nbuf_next(qdf_nbuf_t buf)
  635. {
  636. return __qdf_nbuf_next(buf);
  637. }
  638. /**
  639. * qdf_nbuf_get_protocol() - return the protocol value of the skb
  640. * @skb: Pointer to network buffer
  641. *
  642. * Return: skb protocol
  643. */
  644. static inline uint16_t qdf_nbuf_get_protocol(struct sk_buff *skb)
  645. {
  646. return __qdf_nbuf_get_protocol(skb);
  647. }
  648. /**
  649. * qdf_nbuf_get_ip_summed() - return the ip checksum value of the skb
  650. * @skb: Pointer to network buffer
  651. *
  652. * Return: skb ip_summed
  653. */
  654. static inline uint8_t qdf_nbuf_get_ip_summed(struct sk_buff *skb)
  655. {
  656. return __qdf_nbuf_get_ip_summed(skb);
  657. }
  658. /**
  659. * qdf_nbuf_set_ip_summed() - sets the ip_summed value of the skb
  660. * @skb: Pointer to network buffer
  661. * @ip_summed: ip checksum
  662. *
  663. * Return: none
  664. */
  665. static inline void qdf_nbuf_set_ip_summed(struct sk_buff *skb,
  666. uint8_t ip_summed)
  667. {
  668. __qdf_nbuf_set_ip_summed(skb, ip_summed);
  669. }
  670. /**
  671. * qdf_nbuf_set_next() - add a packet to a linked list
  672. * @this_buf: Predecessor buffer
  673. * @next_buf: Successor buffer
  674. *
  675. * This function can be used to directly link nbufs, rather than using
  676. * a separate network buffer queue object.
  677. *
  678. * Return: none
  679. */
  680. static inline void qdf_nbuf_set_next(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  681. {
  682. __qdf_nbuf_set_next(this_buf, next_buf);
  683. }
  684. /* nbuf extension routines */
  685. /**
  686. * qdf_nbuf_set_next_ext() - link extension of this packet contained in a new
  687. * nbuf
  688. * @this_buf: predecessor buffer
  689. * @next_buf: successor buffer
  690. *
  691. * This function is used to link up many nbufs containing a single logical
  692. * packet - not a collection of packets. Do not use for linking the first
  693. * extension to the head
  694. *
  695. * Return: none
  696. */
  697. static inline void
  698. qdf_nbuf_set_next_ext(qdf_nbuf_t this_buf, qdf_nbuf_t next_buf)
  699. {
  700. __qdf_nbuf_set_next_ext(this_buf, next_buf);
  701. }
  702. /**
  703. * qdf_nbuf_next_ext() - get the next packet extension in the linked list
  704. * @buf: Network buffer
  705. *
  706. * Return: Next network buffer in the linked list
  707. */
  708. static inline qdf_nbuf_t qdf_nbuf_next_ext(qdf_nbuf_t buf)
  709. {
  710. return __qdf_nbuf_next_ext(buf);
  711. }
  712. /**
  713. * qdf_nbuf_append_ext_list() - link list of packet extensions to the head
  714. * segment
  715. * @head_buf: Network buf holding head segment (single)
  716. * @ext_list: Network buf list holding linked extensions to the head
  717. * @ext_len: Total length of all buffers in the extension list
  718. *
  719. * This function is used to link up a list of packet extensions (seg1, 2,
  720. * ...) to the nbuf holding the head segment (seg0)
  721. *
  722. * Return: none
  723. */
  724. static inline void
  725. qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list,
  726. qdf_size_t ext_len)
  727. {
  728. __qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len);
  729. }
  730. /**
  731. * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
  732. * @buf: Network buffer
  733. *
  734. * Return: qdf_nbuf_tx_cksum_t checksum offload demand for the frame
  735. */
  736. static inline qdf_nbuf_tx_cksum_t qdf_nbuf_get_tx_cksum(qdf_nbuf_t buf)
  737. {
  738. return __qdf_nbuf_get_tx_cksum(buf);
  739. }
  740. /**
  741. * qdf_nbuf_set_rx_cksum() - drivers that support hw checksumming use this to
  742. * indicate checksum info to the stack.
  743. * @buf: Network buffer
  744. * @cksum: Checksum
  745. *
  746. * Return: none
  747. */
  748. static inline void
  749. qdf_nbuf_set_rx_cksum(qdf_nbuf_t buf, qdf_nbuf_rx_cksum_t *cksum)
  750. {
  751. __qdf_nbuf_set_rx_cksum(buf, cksum);
  752. }
  753. /**
  754. * qdf_nbuf_get_tid() - this function extracts the TID value from nbuf
  755. * @buf: Network buffer
  756. *
  757. * Return: TID value
  758. */
  759. static inline uint8_t qdf_nbuf_get_tid(qdf_nbuf_t buf)
  760. {
  761. return __qdf_nbuf_get_tid(buf);
  762. }
  763. /**
  764. * qdf_nbuf_set_tid() - this function sets the TID value in nbuf
  765. * @buf: Network buffer
  766. * @tid: TID value
  767. *
  768. * Return: none
  769. */
  770. static inline void qdf_nbuf_set_tid(qdf_nbuf_t buf, uint8_t tid)
  771. {
  772. __qdf_nbuf_set_tid(buf, tid);
  773. }
  774. /**
  775. * qdf_nbuf_get_exemption_type() - this function extracts the exemption type
  776. * from nbuf
  777. * @buf: Network buffer
  778. *
  779. * Return: Exemption type
  780. */
  781. static inline uint8_t qdf_nbuf_get_exemption_type(qdf_nbuf_t buf)
  782. {
  783. return __qdf_nbuf_get_exemption_type(buf);
  784. }
  785. /**
  786. * qdf_nbuf_set_protocol() - this function peeks data into the buffer at given
  787. * offset
  788. * @buf: Network buffer
  789. * @proto: Protocol
  790. *
  791. * Return: none
  792. */
  793. static inline void qdf_nbuf_set_protocol(qdf_nbuf_t buf, uint16_t proto)
  794. {
  795. __qdf_nbuf_set_protocol(buf, proto);
  796. }
  797. /**
  798. * qdf_nbuf_trace_get_proto_type() - this function return packet proto type
  799. * @buf: Network buffer
  800. *
  801. * Return: Packet protocol type
  802. */
  803. static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf)
  804. {
  805. return __qdf_nbuf_trace_get_proto_type(buf);
  806. }
  807. #ifdef QCA_PKT_PROTO_TRACE
  808. /**
  809. * qdf_nbuf_trace_set_proto_type() - this function updates packet proto type
  810. * @buf: Network buffer
  811. * @proto_type: Protocol type
  812. *
  813. * Return: none
  814. */
  815. static inline void
  816. qdf_nbuf_trace_set_proto_type(qdf_nbuf_t buf, uint8_t proto_type)
  817. {
  818. __qdf_nbuf_trace_set_proto_type(buf, proto_type);
  819. }
  820. #else
  821. static inline void
  822. qdf_nbuf_trace_set_proto_type(qdf_nbuf_t buf, uint8_t proto_type)
  823. {
  824. return;
  825. }
  826. #endif
  827. /**
  828. * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback
  829. * @cb_func_ptr: Callback pointer
  830. *
  831. * Return: none
  832. */
  833. static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr)
  834. {
  835. __qdf_nbuf_reg_trace_cb(cb_func_ptr);
  836. }
  837. /**
  838. * qdf_nbuf_trace_update() - this function updates protocol event
  839. * @buf: Network buffer
  840. * @event_string: Event string pointer
  841. *
  842. * Return: none
  843. */
  844. static inline void qdf_nbuf_trace_update(qdf_nbuf_t buf, char *event_string)
  845. {
  846. __qdf_nbuf_trace_update(buf, event_string);
  847. }
  848. /**
  849. * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download
  850. * @buf: Network buffer
  851. * @candi: Candidate of parallel download frame
  852. *
  853. * This function stores a flag specifying this TX frame is suitable for
  854. * downloading though a 2nd TX data pipe that is used for short frames for
  855. * protocols that can accept out-of-order delivery.
  856. *
  857. * Return: none
  858. */
  859. static inline void
  860. qdf_nbuf_set_tx_parallel_dnload_frm(qdf_nbuf_t buf, uint8_t candi)
  861. {
  862. __qdf_nbuf_set_tx_htt2_frm(buf, candi);
  863. }
  864. /**
  865. * qdf_nbuf_get_tx_parallel_dnload_frm() - get tx parallel download
  866. * @buf: Network buffer
  867. *
  868. * This function return whether this TX frame is allow to download though a 2nd
  869. * TX data pipe or not.
  870. *
  871. * Return: none
  872. */
  873. static inline uint8_t qdf_nbuf_get_tx_parallel_dnload_frm(qdf_nbuf_t buf)
  874. {
  875. return __qdf_nbuf_get_tx_htt2_frm(buf);
  876. }
  877. /**
  878. * qdf_invalidate_range() - invalidate the virtual address range specified by
  879. * start and end addresses.
  880. * Note: This does not write back the cache entries.
  881. *
  882. * Return: none
  883. */
  884. #ifdef MSM_PLATFORM
  885. static inline void qdf_invalidate_range(void *start, void *end)
  886. {
  887. dmac_inv_range(start, end);
  888. }
  889. #else
  890. static inline void qdf_invalidate_range(void *start, void *end)
  891. {
  892. /* TODO figure out how to invalidate cache on x86 and other
  893. non-MSM platform */
  894. QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL,
  895. "Cache invalidate not yet implemneted for non-MSM platform");
  896. return;
  897. }
  898. #endif
  899. /**
  900. * qdf_nbuf_reset_num_frags() - decrement the number of fragments
  901. * @buf: Network buffer
  902. *
  903. * Return: Number of fragments
  904. */
  905. static inline void qdf_nbuf_reset_num_frags(qdf_nbuf_t buf)
  906. {
  907. __qdf_nbuf_reset_num_frags(buf);
  908. }
  909. /**
  910. * qdf_nbuf_is_tso() - is the network buffer a jumbo packet?
  911. * @buf: Network buffer
  912. *
  913. * Return: 1 - this is a jumbo packet 0 - not a jumbo packet
  914. */
  915. static inline uint8_t qdf_nbuf_is_tso(qdf_nbuf_t nbuf)
  916. {
  917. return __qdf_nbuf_is_tso(nbuf);
  918. }
  919. /**
  920. * qdf_nbuf_get_tso_info() - function to divide a jumbo TSO
  921. * network buffer into segments
  922. * @nbuf: network buffer to be segmented
  923. * @tso_info: This is the output. The information about the
  924. * TSO segments will be populated within this.
  925. *
  926. * This function fragments a TCP jumbo packet into smaller
  927. * segments to be transmitted by the driver. It chains the TSO
  928. * segments created into a list.
  929. *
  930. * Return: number of TSO segments
  931. */
  932. static inline uint32_t qdf_nbuf_get_tso_info(qdf_device_t osdev,
  933. qdf_nbuf_t nbuf, struct qdf_tso_info_t *tso_info)
  934. {
  935. return __qdf_nbuf_get_tso_info(osdev, nbuf, tso_info);
  936. }
  937. /**
  938. * qdf_nbuf_get_tso_num_seg() - function to calculate the number
  939. * of TCP segments within the TSO jumbo packet
  940. * @nbuf: TSO jumbo network buffer to be segmented
  941. *
  942. * This function calculates the number of TCP segments that the
  943. network buffer can be divided into.
  944. *
  945. * Return: number of TCP segments
  946. */
  947. static inline uint32_t qdf_nbuf_get_tso_num_seg(qdf_nbuf_t nbuf)
  948. {
  949. return __qdf_nbuf_get_tso_num_seg(nbuf);
  950. }
  951. /**
  952. * qdf_nbuf_inc_users() - function to increment the number of
  953. * users referencing this network buffer
  954. *
  955. * @nbuf: network buffer
  956. *
  957. * This function increments the number of users referencing this
  958. * network buffer
  959. *
  960. * Return: the network buffer
  961. */
  962. static inline qdf_nbuf_t qdf_nbuf_inc_users(qdf_nbuf_t nbuf)
  963. {
  964. return __qdf_nbuf_inc_users(nbuf);
  965. }
  966. /**
  967. * qdf_nbuf_data_attr_get() - Get data_attr field from cvg_nbuf_cb
  968. *
  969. * @nbuf: Network buffer (skb on linux)
  970. *
  971. * This function returns the values of data_attr field
  972. * in struct cvg_nbuf_cb{}, to which skb->cb is typecast.
  973. * This value is actually the value programmed in CE descriptor.
  974. *
  975. * Return: Value of data_attr
  976. */
  977. static inline uint32_t qdf_nbuf_data_attr_get(qdf_nbuf_t buf)
  978. {
  979. return __qdf_nbuf_data_attr_get(buf);
  980. }
  981. /**
  982. * qdf_nbuf_data_attr_set() - Sets data_attr field in cvg_nbuf_cb
  983. *
  984. * @nbuf: Network buffer (skb on linux)
  985. * @data_attr: Value to be stored cvg_nbuf_cb->data_attr
  986. *
  987. * This function stores the value to be programmed in CE
  988. * descriptor as part skb->cb which is typecast to struct cvg_nbuf_cb{}
  989. *
  990. * Return: void
  991. */
  992. static inline
  993. void qdf_nbuf_data_attr_set(qdf_nbuf_t buf, uint32_t data_attr)
  994. {
  995. __qdf_nbuf_data_attr_set(buf, data_attr);
  996. }
  997. /**
  998. * qdf_nbuf_tx_info_get() - Parse skb and get Tx metadata
  999. *
  1000. * @nbuf: Network buffer (skb on linux)
  1001. *
  1002. * This function parses the payload to figure out relevant
  1003. * Tx meta-data e.g. whether to enable tx_classify bit
  1004. * in CE.
  1005. *
  1006. * Return: void
  1007. */
  1008. #define qdf_nbuf_tx_info_get __qdf_nbuf_tx_info_get
  1009. void qdf_nbuf_set_state(qdf_nbuf_t nbuf, uint8_t current_state);
  1010. void qdf_nbuf_tx_desc_count_display(void);
  1011. void qdf_nbuf_tx_desc_count_clear(void);
  1012. static inline qdf_nbuf_t
  1013. qdf_nbuf_realloc_headroom(qdf_nbuf_t buf, uint32_t headroom)
  1014. {
  1015. return __qdf_nbuf_realloc_headroom(buf, headroom);
  1016. }
  1017. static inline qdf_nbuf_t
  1018. qdf_nbuf_realloc_tailroom(qdf_nbuf_t buf, uint32_t tailroom)
  1019. {
  1020. return __qdf_nbuf_realloc_tailroom(buf, tailroom);
  1021. }
  1022. static inline qdf_nbuf_t
  1023. qdf_nbuf_expand(qdf_nbuf_t buf, uint32_t headroom, uint32_t tailroom)
  1024. {
  1025. return __qdf_nbuf_expand(buf, headroom, tailroom);
  1026. }
  1027. static inline qdf_nbuf_t
  1028. qdf_nbuf_unshare(qdf_nbuf_t buf)
  1029. {
  1030. return __qdf_nbuf_unshare(buf);
  1031. }
  1032. static inline bool
  1033. qdf_nbuf_is_cloned(qdf_nbuf_t buf)
  1034. {
  1035. return __qdf_nbuf_is_cloned(buf);
  1036. }
  1037. static inline void
  1038. qdf_nbuf_frag_info(qdf_nbuf_t buf, qdf_sglist_t *sg)
  1039. {
  1040. __qdf_nbuf_frag_info(buf, sg);
  1041. }
  1042. static inline qdf_nbuf_tx_cksum_t
  1043. qdf_nbuf_tx_cksum_info(qdf_nbuf_t buf, uint8_t **hdr_off, uint8_t **where)
  1044. {
  1045. return __qdf_nbuf_tx_cksum_info(buf, hdr_off, where);
  1046. }
  1047. static inline QDF_STATUS
  1048. qdf_nbuf_get_vlan_info(qdf_net_handle_t hdl, qdf_nbuf_t buf,
  1049. qdf_net_vlanhdr_t *vlan)
  1050. {
  1051. return __qdf_nbuf_get_vlan_info(hdl, buf, vlan);
  1052. }
  1053. static inline void qdf_nbuf_reset_ctxt(__qdf_nbuf_t nbuf)
  1054. {
  1055. __qdf_nbuf_reset_ctxt(nbuf);
  1056. }
  1057. static inline void
  1058. qdf_nbuf_set_rx_info(__qdf_nbuf_t nbuf, void *info, uint32_t len)
  1059. {
  1060. __qdf_nbuf_set_rx_info(nbuf, info, len);
  1061. }
  1062. static inline void *qdf_nbuf_get_rx_info(__qdf_nbuf_t nbuf)
  1063. {
  1064. return __qdf_nbuf_get_rx_info(nbuf);
  1065. }
  1066. static inline void qdf_nbuf_init(qdf_nbuf_t buf)
  1067. {
  1068. __qdf_nbuf_init(buf);
  1069. }
  1070. static inline void *qdf_nbuf_network_header(qdf_nbuf_t buf)
  1071. {
  1072. return __qdf_nbuf_network_header(buf);
  1073. }
  1074. static inline void *qdf_nbuf_transport_header(qdf_nbuf_t buf)
  1075. {
  1076. return __qdf_nbuf_transport_header(buf);
  1077. }
  1078. static inline qdf_size_t qdf_nbuf_tcp_tso_size(qdf_nbuf_t buf)
  1079. {
  1080. return __qdf_nbuf_tcp_tso_size(buf);
  1081. }
  1082. static inline void *qdf_nbuf_get_cb(qdf_nbuf_t nbuf)
  1083. {
  1084. return __qdf_nbuf_get_cb(nbuf);
  1085. }
  1086. static inline uint32_t qdf_nbuf_get_nr_frags(qdf_nbuf_t nbuf)
  1087. {
  1088. return __qdf_nbuf_get_nr_frags(nbuf);
  1089. }
  1090. static inline qdf_size_t qdf_nbuf_headlen(qdf_nbuf_t buf)
  1091. {
  1092. return __qdf_nbuf_headlen(buf);
  1093. }
  1094. static inline QDF_STATUS qdf_nbuf_frag_map(qdf_device_t osdev,
  1095. qdf_nbuf_t buf, int offset,
  1096. qdf_dma_dir_t dir, int cur_frag)
  1097. {
  1098. return __qdf_nbuf_frag_map(osdev, buf, offset, dir, cur_frag);
  1099. }
  1100. static inline bool qdf_nbuf_tso_tcp_v4(qdf_nbuf_t buf)
  1101. {
  1102. return __qdf_nbuf_tso_tcp_v4(buf);
  1103. }
  1104. static inline bool qdf_nbuf_tso_tcp_v6(qdf_nbuf_t buf)
  1105. {
  1106. return __qdf_nbuf_tso_tcp_v6(buf);
  1107. }
  1108. static inline uint32_t qdf_nbuf_tcp_seq(qdf_nbuf_t buf)
  1109. {
  1110. return __qdf_nbuf_tcp_seq(buf);
  1111. }
  1112. static inline qdf_size_t qdf_nbuf_l2l3l4_hdr_len(qdf_nbuf_t buf)
  1113. {
  1114. return __qdf_nbuf_l2l3l4_hdr_len(buf);
  1115. }
  1116. static inline bool qdf_nbuf_is_nonlinear(qdf_nbuf_t buf)
  1117. {
  1118. return __qdf_nbuf_is_nonlinear(buf);
  1119. }
  1120. static inline uint32_t
  1121. qdf_nbuf_get_frag_size(qdf_nbuf_t buf, uint32_t frag_num)
  1122. {
  1123. return __qdf_nbuf_get_frag_size(buf, frag_num);
  1124. }
  1125. static inline uint32_t qdf_nbuf_get_priority(qdf_nbuf_t buf)
  1126. {
  1127. return __qdf_nbuf_get_priority(buf);
  1128. }
  1129. static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p)
  1130. {
  1131. __qdf_nbuf_set_priority(buf, p);
  1132. }
  1133. static inline uint8_t *
  1134. qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf)
  1135. {
  1136. return __qdf_nbuf_get_priv_ptr(buf);
  1137. }
  1138. #endif /* _QDF_NBUF_H */