qdf_nbuf.h 33 KB

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