dp_tx.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #ifndef __DP_TX_H
  20. #define __DP_TX_H
  21. #include <qdf_types.h>
  22. #include <qdf_nbuf.h>
  23. #include "dp_types.h"
  24. #ifdef FEATURE_PERPKT_INFO
  25. #if defined(QCA_SUPPORT_LATENCY_CAPTURE) || \
  26. defined(QCA_TX_CAPTURE_SUPPORT) || \
  27. defined(QCA_MCOPY_SUPPORT)
  28. #include "if_meta_hdr.h"
  29. #endif
  30. #endif
  31. #include "dp_internal.h"
  32. #include "hal_tx.h"
  33. #include <qdf_tracepoint.h>
  34. #ifdef CONFIG_SAWF
  35. #include "dp_sawf.h"
  36. #endif
  37. #include <qdf_pkt_add_timestamp.h>
  38. #define DP_INVALID_VDEV_ID 0xFF
  39. #define DP_TX_MAX_NUM_FRAGS 6
  40. /*
  41. * DP_TX_DESC_FLAG_FRAG flags should always be defined to 0x1
  42. * please do not change this flag's definition
  43. */
  44. #define DP_TX_DESC_FLAG_FRAG 0x1
  45. #define DP_TX_DESC_FLAG_TO_FW 0x2
  46. #define DP_TX_DESC_FLAG_SIMPLE 0x4
  47. #define DP_TX_DESC_FLAG_RAW 0x8
  48. #define DP_TX_DESC_FLAG_MESH 0x10
  49. #define DP_TX_DESC_FLAG_QUEUED_TX 0x20
  50. #define DP_TX_DESC_FLAG_COMPLETED_TX 0x40
  51. #define DP_TX_DESC_FLAG_ME 0x80
  52. #define DP_TX_DESC_FLAG_TDLS_FRAME 0x100
  53. #define DP_TX_DESC_FLAG_ALLOCATED 0x200
  54. #define DP_TX_DESC_FLAG_MESH_MODE 0x400
  55. #define DP_TX_DESC_FLAG_UNMAP_DONE 0x800
  56. #define DP_TX_DESC_FLAG_TX_COMP_ERR 0x1000
  57. #define DP_TX_DESC_FLAG_FLUSH 0x2000
  58. #define DP_TX_EXT_DESC_FLAG_METADATA_VALID 0x1
  59. #define DP_TX_FREE_SINGLE_BUF(soc, buf) \
  60. do { \
  61. qdf_nbuf_unmap(soc->osdev, buf, QDF_DMA_TO_DEVICE); \
  62. qdf_nbuf_free(buf); \
  63. } while (0)
  64. #define OCB_HEADER_VERSION 1
  65. #ifdef TX_PER_PDEV_DESC_POOL
  66. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  67. #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id)
  68. #else /* QCA_LL_TX_FLOW_CONTROL_V2 */
  69. #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->pdev->pdev_id)
  70. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  71. #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id)
  72. #else
  73. #ifdef TX_PER_VDEV_DESC_POOL
  74. #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id)
  75. #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id)
  76. #endif /* TX_PER_VDEV_DESC_POOL */
  77. #endif /* TX_PER_PDEV_DESC_POOL */
  78. #define DP_TX_QUEUE_MASK 0x3
  79. #define MAX_CDP_SEC_TYPE 12
  80. /* number of dwords for htt_tx_msdu_desc_ext2_t */
  81. #define DP_TX_MSDU_INFO_META_DATA_DWORDS 7
  82. #define dp_tx_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_TX, params)
  83. #define dp_tx_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_TX, params)
  84. #define dp_tx_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP_TX, params)
  85. #define dp_tx_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_TX, params)
  86. #define dp_tx_info(params...) \
  87. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_TX, ## params)
  88. #define dp_tx_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_TX, params)
  89. #define dp_tx_comp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_TX_COMP, params)
  90. #define dp_tx_comp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_TX_COMP, params)
  91. #define dp_tx_comp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_TX_COMP, params)
  92. #define dp_tx_comp_info(params...) \
  93. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_TX_COMP, ## params)
  94. #define dp_tx_comp_info_rl(params...) \
  95. __QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_TX_COMP, ## params)
  96. #define dp_tx_comp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_TX_COMP, params)
  97. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  98. /**
  99. * struct dp_tx_frag_info_s
  100. * @vaddr: hlos vritual address for buffer
  101. * @paddr_lo: physical address lower 32bits
  102. * @paddr_hi: physical address higher bits
  103. * @len: length of the buffer
  104. */
  105. struct dp_tx_frag_info_s {
  106. uint8_t *vaddr;
  107. uint32_t paddr_lo;
  108. uint16_t paddr_hi;
  109. uint16_t len;
  110. };
  111. /**
  112. * struct dp_tx_seg_info_s - Segmentation Descriptor
  113. * @nbuf: NBUF pointer if segment corresponds to separate nbuf
  114. * @frag_cnt: Fragment count in this segment
  115. * @total_len: Total length of segment
  116. * @frags: per-Fragment information
  117. * @next: pointer to next MSDU segment
  118. */
  119. struct dp_tx_seg_info_s {
  120. qdf_nbuf_t nbuf;
  121. uint16_t frag_cnt;
  122. uint16_t total_len;
  123. struct dp_tx_frag_info_s frags[DP_TX_MAX_NUM_FRAGS];
  124. struct dp_tx_seg_info_s *next;
  125. };
  126. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  127. /**
  128. * struct dp_tx_sg_info_s - Scatter Gather Descriptor
  129. * @num_segs: Number of segments (TSO/ME) in the frame
  130. * @total_len: Total length of the frame
  131. * @curr_seg: Points to current segment descriptor to be processed. Chain of
  132. * descriptors for SG frames/multicast-unicast converted packets.
  133. *
  134. * Used for SG (802.3 or Raw) frames and Multicast-Unicast converted frames to
  135. * carry fragmentation information
  136. * Raw Frames will be handed over to driver as an SKB chain with MPDU boundaries
  137. * indicated through flags in SKB CB (first_msdu and last_msdu). This will be
  138. * converted into set of skb sg (nr_frags) structures.
  139. */
  140. struct dp_tx_sg_info_s {
  141. uint32_t num_segs;
  142. uint32_t total_len;
  143. struct dp_tx_seg_info_s *curr_seg;
  144. };
  145. /**
  146. * struct dp_tx_queue - Tx queue
  147. * @desc_pool_id: Descriptor Pool to be used for the tx queue
  148. * @ring_id: TCL descriptor ring ID corresponding to the tx queue
  149. *
  150. * Tx queue contains information of the software (Descriptor pool)
  151. * and hardware resources (TCL ring id) to be used for a particular
  152. * transmit queue (obtained from skb_queue_mapping in case of linux)
  153. */
  154. struct dp_tx_queue {
  155. uint8_t desc_pool_id;
  156. uint8_t ring_id;
  157. };
  158. /**
  159. * struct dp_tx_msdu_info_s - MSDU Descriptor
  160. * @frm_type: Frame type - Regular/TSO/SG/Multicast enhancement
  161. * @tx_queue: Tx queue on which this MSDU should be transmitted
  162. * @num_seg: Number of segments (TSO)
  163. * @tid: TID (override) that is sent from HLOS
  164. * @u.tso_info: TSO information for TSO frame types
  165. * (chain of the TSO segments, number of segments)
  166. * @u.sg_info: Scatter Gather information for non-TSO SG frames
  167. * @meta_data: Mesh meta header information
  168. * @exception_fw: Duplicate frame to be sent to firmware
  169. * @ppdu_cookie: 16-bit ppdu_cookie that has to be replayed back in completions
  170. * @ix_tx_sniffer: Indicates if the packet has to be sniffed
  171. * @gsn: global sequence for reinjected mcast packets
  172. * @vdev_id : vdev_id for reinjected mcast packets
  173. * @skip_hp_update : Skip HP update for TSO segments and update in last segment
  174. *
  175. * This structure holds the complete MSDU information needed to program the
  176. * Hardware TCL and MSDU extension descriptors for different frame types
  177. *
  178. */
  179. struct dp_tx_msdu_info_s {
  180. enum dp_tx_frm_type frm_type;
  181. struct dp_tx_queue tx_queue;
  182. uint32_t num_seg;
  183. uint8_t tid;
  184. uint8_t exception_fw;
  185. uint8_t is_tx_sniffer;
  186. union {
  187. struct qdf_tso_info_t tso_info;
  188. struct dp_tx_sg_info_s sg_info;
  189. } u;
  190. uint32_t meta_data[DP_TX_MSDU_INFO_META_DATA_DWORDS];
  191. uint16_t ppdu_cookie;
  192. #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
  193. #ifdef WLAN_MCAST_MLO
  194. uint16_t gsn;
  195. uint8_t vdev_id;
  196. #endif
  197. #endif
  198. #ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR
  199. uint8_t skip_hp_update;
  200. #endif
  201. };
  202. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  203. /**
  204. * dp_tx_deinit_pair_by_index() - Deinit TX rings based on index
  205. * @soc: core txrx context
  206. * @index: index of ring to deinit
  207. *
  208. * Deinit 1 TCL and 1 WBM2SW release ring on as needed basis using
  209. * index of the respective TCL/WBM2SW release in soc structure.
  210. * For example, if the index is 2 then &soc->tcl_data_ring[2]
  211. * and &soc->tx_comp_ring[2] will be deinitialized.
  212. *
  213. * Return: none
  214. */
  215. void dp_tx_deinit_pair_by_index(struct dp_soc *soc, int index);
  216. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  217. void dp_tx_tso_cmn_desc_pool_deinit(struct dp_soc *soc, uint8_t num_pool);
  218. void dp_tx_tso_cmn_desc_pool_free(struct dp_soc *soc, uint8_t num_pool);
  219. void dp_tx_tso_cmn_desc_pool_deinit(struct dp_soc *soc, uint8_t num_pool);
  220. void dp_tx_tso_cmn_desc_pool_free(struct dp_soc *soc, uint8_t num_pool);
  221. QDF_STATUS dp_tx_tso_cmn_desc_pool_alloc(struct dp_soc *soc,
  222. uint8_t num_pool,
  223. uint32_t num_desc);
  224. QDF_STATUS dp_tx_tso_cmn_desc_pool_init(struct dp_soc *soc,
  225. uint8_t num_pool,
  226. uint32_t num_desc);
  227. void dp_tx_comp_free_buf(struct dp_soc *soc, struct dp_tx_desc_s *desc);
  228. void dp_tx_desc_release(struct dp_tx_desc_s *tx_desc, uint8_t desc_pool_id);
  229. void dp_tx_compute_delay(struct dp_vdev *vdev, struct dp_tx_desc_s *tx_desc,
  230. uint8_t tid, uint8_t ring_id);
  231. void dp_tx_comp_process_tx_status(struct dp_soc *soc,
  232. struct dp_tx_desc_s *tx_desc,
  233. struct hal_tx_completion_status *ts,
  234. struct dp_txrx_peer *txrx_peer,
  235. uint8_t ring_id);
  236. void dp_tx_comp_process_desc(struct dp_soc *soc,
  237. struct dp_tx_desc_s *desc,
  238. struct hal_tx_completion_status *ts,
  239. struct dp_txrx_peer *txrx_peer);
  240. void dp_tx_reinject_handler(struct dp_soc *soc,
  241. struct dp_vdev *vdev,
  242. struct dp_tx_desc_s *tx_desc,
  243. uint8_t *status,
  244. uint8_t reinject_reason);
  245. void dp_tx_inspect_handler(struct dp_soc *soc,
  246. struct dp_vdev *vdev,
  247. struct dp_tx_desc_s *tx_desc,
  248. uint8_t *status);
  249. void dp_tx_update_peer_basic_stats(struct dp_txrx_peer *txrx_peer,
  250. uint32_t length, uint8_t tx_status,
  251. bool update);
  252. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  253. /**
  254. * dp_tso_attach() - TSO Attach handler
  255. * @txrx_soc: Opaque Dp handle
  256. *
  257. * Reserve TSO descriptor buffers
  258. *
  259. * Return: QDF_STATUS_E_FAILURE on failure or
  260. * QDF_STATUS_SUCCESS on success
  261. */
  262. QDF_STATUS dp_tso_soc_attach(struct cdp_soc_t *txrx_soc);
  263. /**
  264. * dp_tso_detach() - TSO Detach handler
  265. * @txrx_soc: Opaque Dp handle
  266. *
  267. * Deallocate TSO descriptor buffers
  268. *
  269. * Return: QDF_STATUS_E_FAILURE on failure or
  270. * QDF_STATUS_SUCCESS on success
  271. */
  272. QDF_STATUS dp_tso_soc_detach(struct cdp_soc_t *txrx_soc);
  273. qdf_nbuf_t dp_tx_send(struct cdp_soc_t *soc, uint8_t vdev_id, qdf_nbuf_t nbuf);
  274. qdf_nbuf_t dp_tx_send_vdev_id_check(struct cdp_soc_t *soc, uint8_t vdev_id,
  275. qdf_nbuf_t nbuf);
  276. qdf_nbuf_t dp_tx_send_exception(struct cdp_soc_t *soc, uint8_t vdev_id,
  277. qdf_nbuf_t nbuf,
  278. struct cdp_tx_exception_metadata *tx_exc);
  279. qdf_nbuf_t dp_tx_send_exception_vdev_id_check(struct cdp_soc_t *soc,
  280. uint8_t vdev_id,
  281. qdf_nbuf_t nbuf,
  282. struct cdp_tx_exception_metadata *tx_exc);
  283. qdf_nbuf_t dp_tx_send_mesh(struct cdp_soc_t *soc, uint8_t vdev_id,
  284. qdf_nbuf_t nbuf);
  285. qdf_nbuf_t
  286. dp_tx_send_msdu_single(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  287. struct dp_tx_msdu_info_s *msdu_info, uint16_t peer_id,
  288. struct cdp_tx_exception_metadata *tx_exc_metadata);
  289. #if QDF_LOCK_STATS
  290. noinline qdf_nbuf_t
  291. dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  292. struct dp_tx_msdu_info_s *msdu_info);
  293. #else
  294. qdf_nbuf_t dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  295. struct dp_tx_msdu_info_s *msdu_info);
  296. #endif
  297. #ifdef FEATURE_WLAN_TDLS
  298. /**
  299. * dp_tx_non_std() - Allow the control-path SW to send data frames
  300. * @soc_hdl: Datapath soc handle
  301. * @vdev_id: id of vdev
  302. * @tx_spec: what non-standard handling to apply to the tx data frames
  303. * @msdu_list: NULL-terminated list of tx MSDUs
  304. *
  305. * Return: NULL on success,
  306. * nbuf when it fails to send
  307. */
  308. qdf_nbuf_t dp_tx_non_std(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  309. enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list);
  310. #endif
  311. int dp_tx_frame_is_drop(struct dp_vdev *vdev, uint8_t *srcmac, uint8_t *dstmac);
  312. /**
  313. * dp_tx_comp_handler() - Tx completion handler
  314. * @int_ctx: pointer to DP interrupt context
  315. * @soc: core txrx main context
  316. * @hal_srng: Opaque HAL SRNG pointer
  317. * @ring_id: completion ring id
  318. * @quota: No. of packets/descriptors that can be serviced in one loop
  319. *
  320. * This function will collect hardware release ring element contents and
  321. * handle descriptor contents. Based on contents, free packet or handle error
  322. * conditions
  323. *
  324. * Return: Number of TX completions processed
  325. */
  326. uint32_t dp_tx_comp_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
  327. hal_ring_handle_t hal_srng, uint8_t ring_id,
  328. uint32_t quota);
  329. QDF_STATUS
  330. dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  331. QDF_STATUS
  332. dp_tx_prepare_send_igmp_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  333. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  334. #if defined(QCA_HOST_MODE_WIFI_DISABLED) || !defined(ATH_SUPPORT_IQUE)
  335. static inline void dp_tx_me_exit(struct dp_pdev *pdev)
  336. {
  337. return;
  338. }
  339. #endif
  340. /**
  341. * dp_tx_pdev_init() - dp tx pdev init
  342. * @pdev: physical device instance
  343. *
  344. * Return: QDF_STATUS_SUCCESS: success
  345. * QDF_STATUS_E_RESOURCES: Error return
  346. */
  347. static inline QDF_STATUS dp_tx_pdev_init(struct dp_pdev *pdev)
  348. {
  349. struct dp_soc *soc = pdev->soc;
  350. /* Initialize Flow control counters */
  351. qdf_atomic_init(&pdev->num_tx_outstanding);
  352. pdev->tx_descs_max = 0;
  353. if (wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) {
  354. /* Initialize descriptors in TCL Ring */
  355. hal_tx_init_data_ring(soc->hal_soc,
  356. soc->tcl_data_ring[pdev->pdev_id].hal_srng);
  357. }
  358. return QDF_STATUS_SUCCESS;
  359. }
  360. /**
  361. * dp_tx_prefetch_hw_sw_nbuf_desc() - function to prefetch HW and SW desc
  362. * @soc: Handle to HAL Soc structure
  363. * @hal_soc: HAL SOC handle
  364. * @num_avail_for_reap: descriptors available for reap
  365. * @hal_ring_hdl: ring pointer
  366. * @last_prefetched_hw_desc: pointer to the last prefetched HW descriptor
  367. * @last_prefetched_sw_desc: pointer to last prefetch SW desc
  368. *
  369. * Return: None
  370. */
  371. #ifdef QCA_DP_TX_HW_SW_NBUF_DESC_PREFETCH
  372. static inline
  373. void dp_tx_prefetch_hw_sw_nbuf_desc(struct dp_soc *soc,
  374. hal_soc_handle_t hal_soc,
  375. uint32_t num_avail_for_reap,
  376. hal_ring_handle_t hal_ring_hdl,
  377. void **last_prefetched_hw_desc,
  378. struct dp_tx_desc_s
  379. **last_prefetched_sw_desc)
  380. {
  381. if (*last_prefetched_sw_desc) {
  382. qdf_prefetch((uint8_t *)(*last_prefetched_sw_desc)->nbuf);
  383. qdf_prefetch((uint8_t *)(*last_prefetched_sw_desc)->nbuf + 64);
  384. }
  385. if (num_avail_for_reap && *last_prefetched_hw_desc) {
  386. dp_tx_comp_get_prefetched_params_from_hal_desc(
  387. soc,
  388. *last_prefetched_hw_desc,
  389. last_prefetched_sw_desc);
  390. *last_prefetched_hw_desc =
  391. hal_srng_dst_prefetch_next_cached_desc(
  392. hal_soc,
  393. hal_ring_hdl,
  394. (uint8_t *)*last_prefetched_hw_desc);
  395. }
  396. }
  397. #else
  398. static inline
  399. void dp_tx_prefetch_hw_sw_nbuf_desc(struct dp_soc *soc,
  400. hal_soc_handle_t hal_soc,
  401. uint32_t num_avail_for_reap,
  402. hal_ring_handle_t hal_ring_hdl,
  403. void **last_prefetched_hw_desc,
  404. struct dp_tx_desc_s
  405. **last_prefetched_sw_desc)
  406. {
  407. }
  408. #endif
  409. #ifndef FEATURE_WDS
  410. static inline void dp_tx_mec_handler(struct dp_vdev *vdev, uint8_t *status)
  411. {
  412. return;
  413. }
  414. #endif
  415. #ifndef QCA_MULTIPASS_SUPPORT
  416. static inline
  417. bool dp_tx_multipass_process(struct dp_soc *soc, struct dp_vdev *vdev,
  418. qdf_nbuf_t nbuf,
  419. struct dp_tx_msdu_info_s *msdu_info)
  420. {
  421. return true;
  422. }
  423. static inline
  424. void dp_tx_vdev_multipass_deinit(struct dp_vdev *vdev)
  425. {
  426. }
  427. #else
  428. bool dp_tx_multipass_process(struct dp_soc *soc, struct dp_vdev *vdev,
  429. qdf_nbuf_t nbuf,
  430. struct dp_tx_msdu_info_s *msdu_info);
  431. void dp_tx_vdev_multipass_deinit(struct dp_vdev *vdev);
  432. void dp_tx_remove_vlan_tag(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  433. void dp_tx_add_groupkey_metadata(struct dp_vdev *vdev,
  434. struct dp_tx_msdu_info_s *msdu_info,
  435. uint16_t group_key);
  436. #endif
  437. /**
  438. * dp_tx_hw_to_qdf()- convert hw status to qdf status
  439. * @status: hw status
  440. *
  441. * Return: qdf tx rx status
  442. */
  443. static inline enum qdf_dp_tx_rx_status dp_tx_hw_to_qdf(uint16_t status)
  444. {
  445. switch (status) {
  446. case HAL_TX_TQM_RR_FRAME_ACKED:
  447. return QDF_TX_RX_STATUS_OK;
  448. case HAL_TX_TQM_RR_REM_CMD_TX:
  449. return QDF_TX_RX_STATUS_NO_ACK;
  450. case HAL_TX_TQM_RR_REM_CMD_REM:
  451. case HAL_TX_TQM_RR_REM_CMD_NOTX:
  452. case HAL_TX_TQM_RR_REM_CMD_AGED:
  453. return QDF_TX_RX_STATUS_FW_DISCARD;
  454. default:
  455. return QDF_TX_RX_STATUS_DEFAULT;
  456. }
  457. }
  458. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  459. /**
  460. * dp_tx_get_queue() - Returns Tx queue IDs to be used for this Tx frame
  461. * @vdev: DP Virtual device handle
  462. * @nbuf: Buffer pointer
  463. * @queue: queue ids container for nbuf
  464. *
  465. * TX packet queue has 2 instances, software descriptors id and dma ring id
  466. * Based on tx feature and hardware configuration queue id combination could be
  467. * different.
  468. * For example -
  469. * With XPS enabled,all TX descriptor pools and dma ring are assigned per cpu id
  470. * With no XPS,lock based resource protection, Descriptor pool ids are different
  471. * for each vdev, dma ring id will be same as single pdev id
  472. *
  473. * Return: None
  474. */
  475. #ifdef QCA_OL_TX_MULTIQ_SUPPORT
  476. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  477. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  478. {
  479. uint16_t queue_offset = qdf_nbuf_get_queue_mapping(nbuf) &
  480. DP_TX_QUEUE_MASK;
  481. queue->desc_pool_id = queue_offset;
  482. queue->ring_id = qdf_nbuf_get_queue_mapping(nbuf);
  483. }
  484. /*
  485. * dp_tx_get_hal_ring_hdl()- Get the hal_tx_ring_hdl for data transmission
  486. * @dp_soc - DP soc structure pointer
  487. * @ring_id - Transmit Queue/ring_id to be used when XPS is enabled
  488. *
  489. * Return - HAL ring handle
  490. */
  491. static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc,
  492. uint8_t ring_id)
  493. {
  494. if (ring_id == soc->num_tcl_data_rings)
  495. return soc->tcl_cmd_credit_ring.hal_srng;
  496. return soc->tcl_data_ring[ring_id].hal_srng;
  497. }
  498. #else /* QCA_OL_TX_MULTIQ_SUPPORT */
  499. #ifdef TX_MULTI_TCL
  500. #ifdef IPA_OFFLOAD
  501. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  502. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  503. {
  504. /* get flow id */
  505. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  506. if (vdev->pdev->soc->wlan_cfg_ctx->ipa_enabled)
  507. queue->ring_id = DP_TX_GET_RING_ID(vdev);
  508. else
  509. queue->ring_id = (qdf_nbuf_get_queue_mapping(nbuf) %
  510. vdev->pdev->soc->num_tcl_data_rings);
  511. }
  512. #else
  513. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  514. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  515. {
  516. /* get flow id */
  517. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  518. queue->ring_id = (qdf_nbuf_get_queue_mapping(nbuf) %
  519. vdev->pdev->soc->num_tcl_data_rings);
  520. }
  521. #endif
  522. #else
  523. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  524. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  525. {
  526. /* get flow id */
  527. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  528. queue->ring_id = DP_TX_GET_RING_ID(vdev);
  529. }
  530. #endif
  531. static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc,
  532. uint8_t ring_id)
  533. {
  534. return soc->tcl_data_ring[ring_id].hal_srng;
  535. }
  536. #endif
  537. #ifdef QCA_OL_TX_LOCK_LESS_ACCESS
  538. /*
  539. * dp_tx_hal_ring_access_start()- hal_tx_ring access for data transmission
  540. * @dp_soc - DP soc structure pointer
  541. * @hal_ring_hdl - HAL ring handle
  542. *
  543. * Return - None
  544. */
  545. static inline int dp_tx_hal_ring_access_start(struct dp_soc *soc,
  546. hal_ring_handle_t hal_ring_hdl)
  547. {
  548. return hal_srng_access_start_unlocked(soc->hal_soc, hal_ring_hdl);
  549. }
  550. /*
  551. * dp_tx_hal_ring_access_end()- hal_tx_ring access for data transmission
  552. * @dp_soc - DP soc structure pointer
  553. * @hal_ring_hdl - HAL ring handle
  554. *
  555. * Return - None
  556. */
  557. static inline void dp_tx_hal_ring_access_end(struct dp_soc *soc,
  558. hal_ring_handle_t hal_ring_hdl)
  559. {
  560. hal_srng_access_end_unlocked(soc->hal_soc, hal_ring_hdl);
  561. }
  562. /*
  563. * dp_tx_hal_ring_access_reap()- hal_tx_ring access for data transmission
  564. * @dp_soc - DP soc structure pointer
  565. * @hal_ring_hdl - HAL ring handle
  566. *
  567. * Return - None
  568. */
  569. static inline void dp_tx_hal_ring_access_end_reap(struct dp_soc *soc,
  570. hal_ring_handle_t
  571. hal_ring_hdl)
  572. {
  573. }
  574. #else
  575. static inline int dp_tx_hal_ring_access_start(struct dp_soc *soc,
  576. hal_ring_handle_t hal_ring_hdl)
  577. {
  578. return hal_srng_access_start(soc->hal_soc, hal_ring_hdl);
  579. }
  580. static inline void dp_tx_hal_ring_access_end(struct dp_soc *soc,
  581. hal_ring_handle_t hal_ring_hdl)
  582. {
  583. hal_srng_access_end(soc->hal_soc, hal_ring_hdl);
  584. }
  585. static inline void dp_tx_hal_ring_access_end_reap(struct dp_soc *soc,
  586. hal_ring_handle_t
  587. hal_ring_hdl)
  588. {
  589. hal_srng_access_end_reap(soc->hal_soc, hal_ring_hdl);
  590. }
  591. #endif
  592. #ifdef ATH_TX_PRI_OVERRIDE
  593. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf) \
  594. ((_msdu_info)->tid = qdf_nbuf_get_priority(_nbuf))
  595. #else
  596. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf)
  597. #endif
  598. /* TODO TX_FEATURE_NOT_YET */
  599. static inline void dp_tx_comp_process_exception(struct dp_tx_desc_s *tx_desc)
  600. {
  601. return;
  602. }
  603. /* TODO TX_FEATURE_NOT_YET */
  604. void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev,
  605. bool force_free);
  606. QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev);
  607. QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev);
  608. void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev);
  609. QDF_STATUS dp_soc_tx_desc_sw_pools_alloc(struct dp_soc *soc);
  610. QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc);
  611. void dp_soc_tx_desc_sw_pools_free(struct dp_soc *soc);
  612. void dp_soc_tx_desc_sw_pools_deinit(struct dp_soc *soc);
  613. void
  614. dp_handle_wbm_internal_error(struct dp_soc *soc, void *hal_desc,
  615. uint32_t buf_type);
  616. #else /* QCA_HOST_MODE_WIFI_DISABLED */
  617. static inline
  618. QDF_STATUS dp_soc_tx_desc_sw_pools_alloc(struct dp_soc *soc)
  619. {
  620. return QDF_STATUS_SUCCESS;
  621. }
  622. static inline
  623. QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc)
  624. {
  625. return QDF_STATUS_SUCCESS;
  626. }
  627. static inline void dp_soc_tx_desc_sw_pools_free(struct dp_soc *soc)
  628. {
  629. }
  630. static inline void dp_soc_tx_desc_sw_pools_deinit(struct dp_soc *soc)
  631. {
  632. }
  633. static inline
  634. void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev,
  635. bool force_free)
  636. {
  637. }
  638. static inline QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev)
  639. {
  640. return QDF_STATUS_SUCCESS;
  641. }
  642. static inline QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev)
  643. {
  644. return QDF_STATUS_SUCCESS;
  645. }
  646. static inline void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev)
  647. {
  648. }
  649. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  650. #if defined(QCA_SUPPORT_LATENCY_CAPTURE) || \
  651. defined(QCA_TX_CAPTURE_SUPPORT) || \
  652. defined(QCA_MCOPY_SUPPORT)
  653. #ifdef FEATURE_PERPKT_INFO
  654. QDF_STATUS
  655. dp_get_completion_indication_for_stack(struct dp_soc *soc,
  656. struct dp_pdev *pdev,
  657. struct dp_txrx_peer *peer,
  658. struct hal_tx_completion_status *ts,
  659. qdf_nbuf_t netbuf,
  660. uint64_t time_latency);
  661. void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev,
  662. uint16_t peer_id, uint32_t ppdu_id,
  663. qdf_nbuf_t netbuf);
  664. #endif
  665. #else
  666. static inline
  667. QDF_STATUS dp_get_completion_indication_for_stack(struct dp_soc *soc,
  668. struct dp_pdev *pdev,
  669. struct dp_txrx_peer *peer,
  670. struct hal_tx_completion_status *ts,
  671. qdf_nbuf_t netbuf,
  672. uint64_t time_latency)
  673. {
  674. return QDF_STATUS_E_NOSUPPORT;
  675. }
  676. static inline
  677. void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev,
  678. uint16_t peer_id, uint32_t ppdu_id,
  679. qdf_nbuf_t netbuf)
  680. {
  681. }
  682. #endif
  683. #ifdef WLAN_FEATURE_PKT_CAPTURE_V2
  684. void dp_send_completion_to_pkt_capture(struct dp_soc *soc,
  685. struct dp_tx_desc_s *desc,
  686. struct hal_tx_completion_status *ts);
  687. #else
  688. static inline void
  689. dp_send_completion_to_pkt_capture(struct dp_soc *soc,
  690. struct dp_tx_desc_s *desc,
  691. struct hal_tx_completion_status *ts)
  692. {
  693. }
  694. #endif
  695. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  696. #ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR
  697. /**
  698. * dp_tx_update_stats() - Update soc level tx stats
  699. * @soc: DP soc handle
  700. * @tx_desc: TX descriptor reference
  701. * @ring_id: TCL ring id
  702. *
  703. * Returns: none
  704. */
  705. void dp_tx_update_stats(struct dp_soc *soc,
  706. struct dp_tx_desc_s *tx_desc,
  707. uint8_t ring_id);
  708. /**
  709. * dp_tx_attempt_coalescing() - Check and attempt TCL register write coalescing
  710. * @soc: Datapath soc handle
  711. * @tx_desc: tx packet descriptor
  712. * @tid: TID for pkt transmission
  713. * @msdu_info: MSDU info of tx packet
  714. * @ring_id: TCL ring id
  715. *
  716. * Returns: 1, if coalescing is to be done
  717. * 0, if coalescing is not to be done
  718. */
  719. int
  720. dp_tx_attempt_coalescing(struct dp_soc *soc, struct dp_vdev *vdev,
  721. struct dp_tx_desc_s *tx_desc,
  722. uint8_t tid,
  723. struct dp_tx_msdu_info_s *msdu_info,
  724. uint8_t ring_id);
  725. /**
  726. * dp_tx_ring_access_end() - HAL ring access end for data transmission
  727. * @soc: Datapath soc handle
  728. * @hal_ring_hdl: HAL ring handle
  729. * @coalesce: Coalesce the current write or not
  730. *
  731. * Returns: none
  732. */
  733. void
  734. dp_tx_ring_access_end(struct dp_soc *soc, hal_ring_handle_t hal_ring_hdl,
  735. int coalesce);
  736. #else
  737. /**
  738. * dp_tx_update_stats() - Update soc level tx stats
  739. * @soc: DP soc handle
  740. * @tx_desc: TX descriptor reference
  741. * @ring_id: TCL ring id
  742. *
  743. * Returns: none
  744. */
  745. static inline void dp_tx_update_stats(struct dp_soc *soc,
  746. struct dp_tx_desc_s *tx_desc,
  747. uint8_t ring_id){ }
  748. static inline void
  749. dp_tx_ring_access_end(struct dp_soc *soc, hal_ring_handle_t hal_ring_hdl,
  750. int coalesce)
  751. {
  752. dp_tx_hal_ring_access_end(soc, hal_ring_hdl);
  753. }
  754. static inline int
  755. dp_tx_attempt_coalescing(struct dp_soc *soc, struct dp_vdev *vdev,
  756. struct dp_tx_desc_s *tx_desc,
  757. uint8_t tid,
  758. struct dp_tx_msdu_info_s *msdu_info,
  759. uint8_t ring_id)
  760. {
  761. return 0;
  762. }
  763. #endif /* WLAN_DP_FEATURE_SW_LATENCY_MGR */
  764. #ifdef FEATURE_RUNTIME_PM
  765. /**
  766. * dp_set_rtpm_tput_policy_requirement() - Update RTPM throughput policy
  767. * @soc_hdl: DP soc handle
  768. * @is_high_tput: flag to indicate whether throughput is high
  769. *
  770. * Returns: none
  771. */
  772. static inline
  773. void dp_set_rtpm_tput_policy_requirement(struct cdp_soc_t *soc_hdl,
  774. bool is_high_tput)
  775. {
  776. struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
  777. qdf_atomic_set(&soc->rtpm_high_tput_flag, is_high_tput);
  778. }
  779. void
  780. dp_tx_ring_access_end_wrapper(struct dp_soc *soc,
  781. hal_ring_handle_t hal_ring_hdl,
  782. int coalesce);
  783. #else
  784. #ifdef DP_POWER_SAVE
  785. void
  786. dp_tx_ring_access_end_wrapper(struct dp_soc *soc,
  787. hal_ring_handle_t hal_ring_hdl,
  788. int coalesce);
  789. #else
  790. static inline void
  791. dp_tx_ring_access_end_wrapper(struct dp_soc *soc,
  792. hal_ring_handle_t hal_ring_hdl,
  793. int coalesce)
  794. {
  795. dp_tx_ring_access_end(soc, hal_ring_hdl, coalesce);
  796. }
  797. #endif
  798. static inline void
  799. dp_set_rtpm_tput_policy_requirement(struct cdp_soc_t *soc_hdl,
  800. bool is_high_tput)
  801. { }
  802. #endif
  803. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  804. #ifdef DP_TX_HW_DESC_HISTORY
  805. static inline void
  806. dp_tx_hw_desc_update_evt(uint8_t *hal_tx_desc_cached,
  807. hal_ring_handle_t hal_ring_hdl,
  808. struct dp_soc *soc)
  809. {
  810. struct dp_tx_hw_desc_evt *evt;
  811. uint64_t idx = 0;
  812. if (!soc->tx_hw_desc_history)
  813. return;
  814. idx = ++soc->tx_hw_desc_history->index;
  815. if (idx == DP_TX_HW_DESC_HIST_MAX)
  816. soc->tx_hw_desc_history->index = 0;
  817. idx = qdf_do_div_rem(idx, DP_TX_HW_DESC_HIST_MAX);
  818. evt = &soc->tx_hw_desc_history->entry[idx];
  819. qdf_mem_copy(evt->tcl_desc, hal_tx_desc_cached, HAL_TX_DESC_LEN_BYTES);
  820. evt->posted = qdf_get_log_timestamp();
  821. hal_get_sw_hptp(soc->hal_soc, hal_ring_hdl, &evt->tp, &evt->hp);
  822. }
  823. #else
  824. static inline void
  825. dp_tx_hw_desc_update_evt(uint8_t *hal_tx_desc_cached,
  826. hal_ring_handle_t hal_ring_hdl,
  827. struct dp_soc *soc)
  828. {
  829. }
  830. #endif
  831. #if defined(WLAN_FEATURE_TSF_UPLINK_DELAY) || defined(CONFIG_SAWF)
  832. /**
  833. * dp_tx_compute_hw_delay_us() - Compute hardware Tx completion delay
  834. * @ts: Tx completion status
  835. * @delta_tsf: Difference between TSF clock and qtimer
  836. * @delay_us: Delay in microseconds
  837. *
  838. * Return: QDF_STATUS_SUCCESS : Success
  839. * QDF_STATUS_E_INVAL : Tx completion status is invalid or
  840. * delay_us is NULL
  841. * QDF_STATUS_E_FAILURE : Error in delay calculation
  842. */
  843. QDF_STATUS
  844. dp_tx_compute_hw_delay_us(struct hal_tx_completion_status *ts,
  845. uint32_t delta_tsf,
  846. uint32_t *delay_us);
  847. /**
  848. * dp_set_delta_tsf() - Set delta_tsf to dp_soc structure
  849. * @soc_hdl: cdp soc pointer
  850. * @vdev_id: vdev id
  851. * @delta_tsf: difference between TSF clock and qtimer
  852. *
  853. * Return: None
  854. */
  855. void dp_set_delta_tsf(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  856. uint32_t delta_tsf);
  857. #endif
  858. #ifdef WLAN_FEATURE_TSF_UPLINK_DELAY
  859. /**
  860. * dp_set_tsf_report_ul_delay() - Enable or disable reporting uplink delay
  861. * @soc_hdl: cdp soc pointer
  862. * @vdev_id: vdev id
  863. * @enable: true to enable and false to disable
  864. *
  865. * Return: QDF_STATUS
  866. */
  867. QDF_STATUS dp_set_tsf_ul_delay_report(struct cdp_soc_t *soc_hdl,
  868. uint8_t vdev_id, bool enable);
  869. /**
  870. * dp_get_uplink_delay() - Get uplink delay value
  871. * @soc_hdl: cdp soc pointer
  872. * @vdev_id: vdev id
  873. * @val: pointer to save uplink delay value
  874. *
  875. * Return: QDF_STATUS
  876. */
  877. QDF_STATUS dp_get_uplink_delay(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  878. uint32_t *val);
  879. #endif /* WLAN_FEATURE_TSF_UPLINK_TSF */
  880. /**
  881. * dp_tx_pkt_tracepoints_enabled() - Get the state of tx pkt tracepoint
  882. *
  883. * Return: True if any tx pkt tracepoint is enabled else false
  884. */
  885. static inline
  886. bool dp_tx_pkt_tracepoints_enabled(void)
  887. {
  888. return (qdf_trace_dp_tx_comp_tcp_pkt_enabled() ||
  889. qdf_trace_dp_tx_comp_udp_pkt_enabled() ||
  890. qdf_trace_dp_tx_comp_pkt_enabled());
  891. }
  892. #ifdef DP_TX_TRACKING
  893. /**
  894. * dp_tx_desc_set_timestamp() - set timestamp in tx descriptor
  895. * @tx_desc - tx descriptor
  896. *
  897. * Return: None
  898. */
  899. static inline
  900. void dp_tx_desc_set_timestamp(struct dp_tx_desc_s *tx_desc)
  901. {
  902. tx_desc->timestamp_tick = qdf_system_ticks();
  903. }
  904. /**
  905. * dp_tx_desc_check_corruption() - Verify magic pattern in tx descriptor
  906. * @tx_desc: tx descriptor
  907. *
  908. * Check for corruption in tx descriptor, if magic pattern is not matching
  909. * trigger self recovery
  910. *
  911. * Return: none
  912. */
  913. void dp_tx_desc_check_corruption(struct dp_tx_desc_s *tx_desc);
  914. #else
  915. static inline
  916. void dp_tx_desc_set_timestamp(struct dp_tx_desc_s *tx_desc)
  917. {
  918. }
  919. static inline
  920. void dp_tx_desc_check_corruption(struct dp_tx_desc_s *tx_desc)
  921. {
  922. }
  923. #endif
  924. #ifndef CONFIG_SAWF
  925. static inline bool dp_sawf_tag_valid_get(qdf_nbuf_t nbuf)
  926. {
  927. return false;
  928. }
  929. #endif
  930. #ifdef HW_TX_DELAY_STATS_ENABLE
  931. /**
  932. * dp_tx_desc_set_ktimestamp() - set kernel timestamp in tx descriptor
  933. * @vdev: DP vdev handle
  934. * @tx_desc: tx descriptor
  935. *
  936. * Return: true when descriptor is timestamped, false otherwise
  937. */
  938. static inline
  939. bool dp_tx_desc_set_ktimestamp(struct dp_vdev *vdev,
  940. struct dp_tx_desc_s *tx_desc)
  941. {
  942. if (qdf_unlikely(vdev->pdev->delay_stats_flag) ||
  943. qdf_unlikely(vdev->pdev->soc->wlan_cfg_ctx->pext_stats_enabled) ||
  944. qdf_unlikely(dp_tx_pkt_tracepoints_enabled()) ||
  945. qdf_unlikely(vdev->pdev->soc->peerstats_enabled) ||
  946. qdf_unlikely(dp_is_vdev_tx_delay_stats_enabled(vdev))) {
  947. tx_desc->timestamp = qdf_ktime_real_get();
  948. return true;
  949. }
  950. return false;
  951. }
  952. #else
  953. static inline
  954. bool dp_tx_desc_set_ktimestamp(struct dp_vdev *vdev,
  955. struct dp_tx_desc_s *tx_desc)
  956. {
  957. if (qdf_unlikely(vdev->pdev->delay_stats_flag) ||
  958. qdf_unlikely(vdev->pdev->soc->wlan_cfg_ctx->pext_stats_enabled) ||
  959. qdf_unlikely(dp_tx_pkt_tracepoints_enabled()) ||
  960. qdf_unlikely(vdev->pdev->soc->peerstats_enabled)) {
  961. tx_desc->timestamp = qdf_ktime_real_get();
  962. return true;
  963. }
  964. return false;
  965. }
  966. #endif
  967. #ifdef CONFIG_DP_PKT_ADD_TIMESTAMP
  968. /**
  969. * dp_pkt_add_timestamp() - add timestamp in data payload
  970. *
  971. * @vdev: dp vdev
  972. * @index: index to decide offset in payload
  973. * @time: timestamp to add in data payload
  974. * @nbuf: network buffer
  975. *
  976. * Return: none
  977. */
  978. void dp_pkt_add_timestamp(struct dp_vdev *vdev,
  979. enum qdf_pkt_timestamp_index index, uint64_t time,
  980. qdf_nbuf_t nbuf);
  981. /**
  982. * dp_pkt_get_timestamp() - get current system time
  983. *
  984. * @time: return current system time
  985. *
  986. * Return: none
  987. */
  988. void dp_pkt_get_timestamp(uint64_t *time);
  989. #else
  990. #define dp_pkt_add_timestamp(vdev, index, time, nbuf)
  991. static inline
  992. void dp_pkt_get_timestamp(uint64_t *time)
  993. {
  994. }
  995. #endif
  996. #endif