dp_tx.h 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099
  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. #ifdef DP_UMAC_HW_RESET_SUPPORT
  253. qdf_nbuf_t dp_tx_drop(struct cdp_soc_t *soc, uint8_t vdev_id, qdf_nbuf_t nbuf);
  254. qdf_nbuf_t dp_tx_exc_drop(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  255. qdf_nbuf_t nbuf,
  256. struct cdp_tx_exception_metadata *tx_exc_metadata);
  257. #endif
  258. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  259. /**
  260. * dp_tso_attach() - TSO Attach handler
  261. * @txrx_soc: Opaque Dp handle
  262. *
  263. * Reserve TSO descriptor buffers
  264. *
  265. * Return: QDF_STATUS_E_FAILURE on failure or
  266. * QDF_STATUS_SUCCESS on success
  267. */
  268. QDF_STATUS dp_tso_soc_attach(struct cdp_soc_t *txrx_soc);
  269. /**
  270. * dp_tso_detach() - TSO Detach handler
  271. * @txrx_soc: Opaque Dp handle
  272. *
  273. * Deallocate TSO descriptor buffers
  274. *
  275. * Return: QDF_STATUS_E_FAILURE on failure or
  276. * QDF_STATUS_SUCCESS on success
  277. */
  278. QDF_STATUS dp_tso_soc_detach(struct cdp_soc_t *txrx_soc);
  279. qdf_nbuf_t dp_tx_send(struct cdp_soc_t *soc, uint8_t vdev_id, qdf_nbuf_t nbuf);
  280. qdf_nbuf_t dp_tx_send_vdev_id_check(struct cdp_soc_t *soc, uint8_t vdev_id,
  281. qdf_nbuf_t nbuf);
  282. qdf_nbuf_t dp_tx_send_exception(struct cdp_soc_t *soc, uint8_t vdev_id,
  283. qdf_nbuf_t nbuf,
  284. struct cdp_tx_exception_metadata *tx_exc);
  285. qdf_nbuf_t dp_tx_send_exception_vdev_id_check(struct cdp_soc_t *soc,
  286. uint8_t vdev_id,
  287. qdf_nbuf_t nbuf,
  288. struct cdp_tx_exception_metadata *tx_exc);
  289. qdf_nbuf_t dp_tx_send_mesh(struct cdp_soc_t *soc, uint8_t vdev_id,
  290. qdf_nbuf_t nbuf);
  291. qdf_nbuf_t
  292. dp_tx_send_msdu_single(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  293. struct dp_tx_msdu_info_s *msdu_info, uint16_t peer_id,
  294. struct cdp_tx_exception_metadata *tx_exc_metadata);
  295. #if QDF_LOCK_STATS
  296. noinline qdf_nbuf_t
  297. dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  298. struct dp_tx_msdu_info_s *msdu_info);
  299. #else
  300. qdf_nbuf_t dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  301. struct dp_tx_msdu_info_s *msdu_info);
  302. #endif
  303. #ifdef FEATURE_WLAN_TDLS
  304. /**
  305. * dp_tx_non_std() - Allow the control-path SW to send data frames
  306. * @soc_hdl: Datapath soc handle
  307. * @vdev_id: id of vdev
  308. * @tx_spec: what non-standard handling to apply to the tx data frames
  309. * @msdu_list: NULL-terminated list of tx MSDUs
  310. *
  311. * Return: NULL on success,
  312. * nbuf when it fails to send
  313. */
  314. qdf_nbuf_t dp_tx_non_std(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  315. enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list);
  316. #endif
  317. int dp_tx_frame_is_drop(struct dp_vdev *vdev, uint8_t *srcmac, uint8_t *dstmac);
  318. /**
  319. * dp_tx_comp_handler() - Tx completion handler
  320. * @int_ctx: pointer to DP interrupt context
  321. * @soc: core txrx main context
  322. * @hal_srng: Opaque HAL SRNG pointer
  323. * @ring_id: completion ring id
  324. * @quota: No. of packets/descriptors that can be serviced in one loop
  325. *
  326. * This function will collect hardware release ring element contents and
  327. * handle descriptor contents. Based on contents, free packet or handle error
  328. * conditions
  329. *
  330. * Return: Number of TX completions processed
  331. */
  332. uint32_t dp_tx_comp_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
  333. hal_ring_handle_t hal_srng, uint8_t ring_id,
  334. uint32_t quota);
  335. QDF_STATUS
  336. dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  337. QDF_STATUS
  338. dp_tx_prepare_send_igmp_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  339. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  340. #if defined(QCA_HOST_MODE_WIFI_DISABLED) || !defined(ATH_SUPPORT_IQUE)
  341. static inline void dp_tx_me_exit(struct dp_pdev *pdev)
  342. {
  343. return;
  344. }
  345. #endif
  346. /**
  347. * dp_tx_pdev_init() - dp tx pdev init
  348. * @pdev: physical device instance
  349. *
  350. * Return: QDF_STATUS_SUCCESS: success
  351. * QDF_STATUS_E_RESOURCES: Error return
  352. */
  353. static inline QDF_STATUS dp_tx_pdev_init(struct dp_pdev *pdev)
  354. {
  355. struct dp_soc *soc = pdev->soc;
  356. /* Initialize Flow control counters */
  357. qdf_atomic_init(&pdev->num_tx_outstanding);
  358. pdev->tx_descs_max = 0;
  359. if (wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) {
  360. /* Initialize descriptors in TCL Ring */
  361. hal_tx_init_data_ring(soc->hal_soc,
  362. soc->tcl_data_ring[pdev->pdev_id].hal_srng);
  363. }
  364. return QDF_STATUS_SUCCESS;
  365. }
  366. /**
  367. * dp_tx_prefetch_hw_sw_nbuf_desc() - function to prefetch HW and SW desc
  368. * @soc: Handle to HAL Soc structure
  369. * @hal_soc: HAL SOC handle
  370. * @num_avail_for_reap: descriptors available for reap
  371. * @hal_ring_hdl: ring pointer
  372. * @last_prefetched_hw_desc: pointer to the last prefetched HW descriptor
  373. * @last_prefetched_sw_desc: pointer to last prefetch SW desc
  374. *
  375. * Return: None
  376. */
  377. #ifdef QCA_DP_TX_HW_SW_NBUF_DESC_PREFETCH
  378. static inline
  379. void dp_tx_prefetch_hw_sw_nbuf_desc(struct dp_soc *soc,
  380. hal_soc_handle_t hal_soc,
  381. uint32_t num_avail_for_reap,
  382. hal_ring_handle_t hal_ring_hdl,
  383. void **last_prefetched_hw_desc,
  384. struct dp_tx_desc_s
  385. **last_prefetched_sw_desc)
  386. {
  387. if (*last_prefetched_sw_desc) {
  388. qdf_prefetch((uint8_t *)(*last_prefetched_sw_desc)->nbuf);
  389. qdf_prefetch((uint8_t *)(*last_prefetched_sw_desc)->nbuf + 64);
  390. }
  391. if (num_avail_for_reap && *last_prefetched_hw_desc) {
  392. dp_tx_comp_get_prefetched_params_from_hal_desc(
  393. soc,
  394. *last_prefetched_hw_desc,
  395. last_prefetched_sw_desc);
  396. *last_prefetched_hw_desc =
  397. hal_srng_dst_prefetch_next_cached_desc(
  398. hal_soc,
  399. hal_ring_hdl,
  400. (uint8_t *)*last_prefetched_hw_desc);
  401. }
  402. }
  403. #else
  404. static inline
  405. void dp_tx_prefetch_hw_sw_nbuf_desc(struct dp_soc *soc,
  406. hal_soc_handle_t hal_soc,
  407. uint32_t num_avail_for_reap,
  408. hal_ring_handle_t hal_ring_hdl,
  409. void **last_prefetched_hw_desc,
  410. struct dp_tx_desc_s
  411. **last_prefetched_sw_desc)
  412. {
  413. }
  414. #endif
  415. #ifndef FEATURE_WDS
  416. static inline void dp_tx_mec_handler(struct dp_vdev *vdev, uint8_t *status)
  417. {
  418. return;
  419. }
  420. #endif
  421. #ifndef QCA_MULTIPASS_SUPPORT
  422. static inline
  423. bool dp_tx_multipass_process(struct dp_soc *soc, struct dp_vdev *vdev,
  424. qdf_nbuf_t nbuf,
  425. struct dp_tx_msdu_info_s *msdu_info)
  426. {
  427. return true;
  428. }
  429. static inline
  430. void dp_tx_vdev_multipass_deinit(struct dp_vdev *vdev)
  431. {
  432. }
  433. #else
  434. bool dp_tx_multipass_process(struct dp_soc *soc, struct dp_vdev *vdev,
  435. qdf_nbuf_t nbuf,
  436. struct dp_tx_msdu_info_s *msdu_info);
  437. void dp_tx_vdev_multipass_deinit(struct dp_vdev *vdev);
  438. void dp_tx_remove_vlan_tag(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  439. void dp_tx_add_groupkey_metadata(struct dp_vdev *vdev,
  440. struct dp_tx_msdu_info_s *msdu_info,
  441. uint16_t group_key);
  442. #endif
  443. /**
  444. * dp_tx_hw_to_qdf()- convert hw status to qdf status
  445. * @status: hw status
  446. *
  447. * Return: qdf tx rx status
  448. */
  449. static inline enum qdf_dp_tx_rx_status dp_tx_hw_to_qdf(uint16_t status)
  450. {
  451. switch (status) {
  452. case HAL_TX_TQM_RR_FRAME_ACKED:
  453. return QDF_TX_RX_STATUS_OK;
  454. case HAL_TX_TQM_RR_REM_CMD_TX:
  455. return QDF_TX_RX_STATUS_NO_ACK;
  456. case HAL_TX_TQM_RR_REM_CMD_REM:
  457. case HAL_TX_TQM_RR_REM_CMD_NOTX:
  458. case HAL_TX_TQM_RR_REM_CMD_AGED:
  459. return QDF_TX_RX_STATUS_FW_DISCARD;
  460. default:
  461. return QDF_TX_RX_STATUS_DEFAULT;
  462. }
  463. }
  464. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  465. /**
  466. * dp_tx_get_queue() - Returns Tx queue IDs to be used for this Tx frame
  467. * @vdev: DP Virtual device handle
  468. * @nbuf: Buffer pointer
  469. * @queue: queue ids container for nbuf
  470. *
  471. * TX packet queue has 2 instances, software descriptors id and dma ring id
  472. * Based on tx feature and hardware configuration queue id combination could be
  473. * different.
  474. * For example -
  475. * With XPS enabled,all TX descriptor pools and dma ring are assigned per cpu id
  476. * With no XPS,lock based resource protection, Descriptor pool ids are different
  477. * for each vdev, dma ring id will be same as single pdev id
  478. *
  479. * Return: None
  480. */
  481. #ifdef QCA_OL_TX_MULTIQ_SUPPORT
  482. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  483. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  484. {
  485. queue->ring_id = qdf_get_cpu();
  486. queue->desc_pool_id = queue->ring_id;
  487. }
  488. /*
  489. * dp_tx_get_hal_ring_hdl()- Get the hal_tx_ring_hdl for data transmission
  490. * @dp_soc - DP soc structure pointer
  491. * @ring_id - Transmit Queue/ring_id to be used when XPS is enabled
  492. *
  493. * Return - HAL ring handle
  494. */
  495. static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc,
  496. uint8_t ring_id)
  497. {
  498. if (ring_id == soc->num_tcl_data_rings)
  499. return soc->tcl_cmd_credit_ring.hal_srng;
  500. return soc->tcl_data_ring[ring_id].hal_srng;
  501. }
  502. #else /* QCA_OL_TX_MULTIQ_SUPPORT */
  503. #ifdef TX_MULTI_TCL
  504. #ifdef IPA_OFFLOAD
  505. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  506. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  507. {
  508. /* get flow id */
  509. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  510. if (vdev->pdev->soc->wlan_cfg_ctx->ipa_enabled)
  511. queue->ring_id = DP_TX_GET_RING_ID(vdev);
  512. else
  513. queue->ring_id = (qdf_nbuf_get_queue_mapping(nbuf) %
  514. vdev->pdev->soc->num_tcl_data_rings);
  515. }
  516. #else
  517. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  518. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  519. {
  520. /* get flow id */
  521. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  522. queue->ring_id = (qdf_nbuf_get_queue_mapping(nbuf) %
  523. vdev->pdev->soc->num_tcl_data_rings);
  524. }
  525. #endif
  526. #else
  527. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  528. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  529. {
  530. /* get flow id */
  531. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  532. queue->ring_id = DP_TX_GET_RING_ID(vdev);
  533. }
  534. #endif
  535. static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc,
  536. uint8_t ring_id)
  537. {
  538. return soc->tcl_data_ring[ring_id].hal_srng;
  539. }
  540. #endif
  541. #ifdef QCA_OL_TX_LOCK_LESS_ACCESS
  542. /*
  543. * dp_tx_hal_ring_access_start()- hal_tx_ring access for data transmission
  544. * @dp_soc - DP soc structure pointer
  545. * @hal_ring_hdl - HAL ring handle
  546. *
  547. * Return - None
  548. */
  549. static inline int dp_tx_hal_ring_access_start(struct dp_soc *soc,
  550. hal_ring_handle_t hal_ring_hdl)
  551. {
  552. return hal_srng_access_start_unlocked(soc->hal_soc, hal_ring_hdl);
  553. }
  554. /*
  555. * dp_tx_hal_ring_access_end()- hal_tx_ring access for data transmission
  556. * @dp_soc - DP soc structure pointer
  557. * @hal_ring_hdl - HAL ring handle
  558. *
  559. * Return - None
  560. */
  561. static inline void dp_tx_hal_ring_access_end(struct dp_soc *soc,
  562. hal_ring_handle_t hal_ring_hdl)
  563. {
  564. hal_srng_access_end_unlocked(soc->hal_soc, hal_ring_hdl);
  565. }
  566. /*
  567. * dp_tx_hal_ring_access_reap()- hal_tx_ring access for data transmission
  568. * @dp_soc - DP soc structure pointer
  569. * @hal_ring_hdl - HAL ring handle
  570. *
  571. * Return - None
  572. */
  573. static inline void dp_tx_hal_ring_access_end_reap(struct dp_soc *soc,
  574. hal_ring_handle_t
  575. hal_ring_hdl)
  576. {
  577. }
  578. #else
  579. static inline int dp_tx_hal_ring_access_start(struct dp_soc *soc,
  580. hal_ring_handle_t hal_ring_hdl)
  581. {
  582. return hal_srng_access_start(soc->hal_soc, hal_ring_hdl);
  583. }
  584. static inline void dp_tx_hal_ring_access_end(struct dp_soc *soc,
  585. hal_ring_handle_t hal_ring_hdl)
  586. {
  587. hal_srng_access_end(soc->hal_soc, hal_ring_hdl);
  588. }
  589. static inline void dp_tx_hal_ring_access_end_reap(struct dp_soc *soc,
  590. hal_ring_handle_t
  591. hal_ring_hdl)
  592. {
  593. hal_srng_access_end_reap(soc->hal_soc, hal_ring_hdl);
  594. }
  595. #endif
  596. #ifdef ATH_TX_PRI_OVERRIDE
  597. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf) \
  598. ((_msdu_info)->tid = qdf_nbuf_get_priority(_nbuf))
  599. #else
  600. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf)
  601. #endif
  602. /* TODO TX_FEATURE_NOT_YET */
  603. static inline void dp_tx_comp_process_exception(struct dp_tx_desc_s *tx_desc)
  604. {
  605. return;
  606. }
  607. /* TODO TX_FEATURE_NOT_YET */
  608. void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev,
  609. bool force_free);
  610. QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev);
  611. QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev);
  612. void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev);
  613. QDF_STATUS dp_soc_tx_desc_sw_pools_alloc(struct dp_soc *soc);
  614. QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc);
  615. void dp_soc_tx_desc_sw_pools_free(struct dp_soc *soc);
  616. void dp_soc_tx_desc_sw_pools_deinit(struct dp_soc *soc);
  617. void
  618. dp_handle_wbm_internal_error(struct dp_soc *soc, void *hal_desc,
  619. uint32_t buf_type);
  620. #else /* QCA_HOST_MODE_WIFI_DISABLED */
  621. static inline
  622. QDF_STATUS dp_soc_tx_desc_sw_pools_alloc(struct dp_soc *soc)
  623. {
  624. return QDF_STATUS_SUCCESS;
  625. }
  626. static inline
  627. QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc)
  628. {
  629. return QDF_STATUS_SUCCESS;
  630. }
  631. static inline void dp_soc_tx_desc_sw_pools_free(struct dp_soc *soc)
  632. {
  633. }
  634. static inline void dp_soc_tx_desc_sw_pools_deinit(struct dp_soc *soc)
  635. {
  636. }
  637. static inline
  638. void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev,
  639. bool force_free)
  640. {
  641. }
  642. static inline QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev)
  643. {
  644. return QDF_STATUS_SUCCESS;
  645. }
  646. static inline QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev)
  647. {
  648. return QDF_STATUS_SUCCESS;
  649. }
  650. static inline void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev)
  651. {
  652. }
  653. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  654. #if defined(QCA_SUPPORT_LATENCY_CAPTURE) || \
  655. defined(QCA_TX_CAPTURE_SUPPORT) || \
  656. defined(QCA_MCOPY_SUPPORT)
  657. #ifdef FEATURE_PERPKT_INFO
  658. QDF_STATUS
  659. dp_get_completion_indication_for_stack(struct dp_soc *soc,
  660. struct dp_pdev *pdev,
  661. struct dp_txrx_peer *peer,
  662. struct hal_tx_completion_status *ts,
  663. qdf_nbuf_t netbuf,
  664. uint64_t time_latency);
  665. void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev,
  666. uint16_t peer_id, uint32_t ppdu_id,
  667. qdf_nbuf_t netbuf);
  668. #endif
  669. #else
  670. static inline
  671. QDF_STATUS dp_get_completion_indication_for_stack(struct dp_soc *soc,
  672. struct dp_pdev *pdev,
  673. struct dp_txrx_peer *peer,
  674. struct hal_tx_completion_status *ts,
  675. qdf_nbuf_t netbuf,
  676. uint64_t time_latency)
  677. {
  678. return QDF_STATUS_E_NOSUPPORT;
  679. }
  680. static inline
  681. void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev,
  682. uint16_t peer_id, uint32_t ppdu_id,
  683. qdf_nbuf_t netbuf)
  684. {
  685. }
  686. #endif
  687. #ifdef WLAN_FEATURE_PKT_CAPTURE_V2
  688. void dp_send_completion_to_pkt_capture(struct dp_soc *soc,
  689. struct dp_tx_desc_s *desc,
  690. struct hal_tx_completion_status *ts);
  691. #else
  692. static inline void
  693. dp_send_completion_to_pkt_capture(struct dp_soc *soc,
  694. struct dp_tx_desc_s *desc,
  695. struct hal_tx_completion_status *ts)
  696. {
  697. }
  698. #endif
  699. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  700. #ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR
  701. /**
  702. * dp_tx_update_stats() - Update soc level tx stats
  703. * @soc: DP soc handle
  704. * @tx_desc: TX descriptor reference
  705. * @ring_id: TCL ring id
  706. *
  707. * Returns: none
  708. */
  709. void dp_tx_update_stats(struct dp_soc *soc,
  710. struct dp_tx_desc_s *tx_desc,
  711. uint8_t ring_id);
  712. /**
  713. * dp_tx_attempt_coalescing() - Check and attempt TCL register write coalescing
  714. * @soc: Datapath soc handle
  715. * @tx_desc: tx packet descriptor
  716. * @tid: TID for pkt transmission
  717. * @msdu_info: MSDU info of tx packet
  718. * @ring_id: TCL ring id
  719. *
  720. * Returns: 1, if coalescing is to be done
  721. * 0, if coalescing is not to be done
  722. */
  723. int
  724. dp_tx_attempt_coalescing(struct dp_soc *soc, struct dp_vdev *vdev,
  725. struct dp_tx_desc_s *tx_desc,
  726. uint8_t tid,
  727. struct dp_tx_msdu_info_s *msdu_info,
  728. uint8_t ring_id);
  729. /**
  730. * dp_tx_ring_access_end() - HAL ring access end for data transmission
  731. * @soc: Datapath soc handle
  732. * @hal_ring_hdl: HAL ring handle
  733. * @coalesce: Coalesce the current write or not
  734. *
  735. * Returns: none
  736. */
  737. void
  738. dp_tx_ring_access_end(struct dp_soc *soc, hal_ring_handle_t hal_ring_hdl,
  739. int coalesce);
  740. #else
  741. /**
  742. * dp_tx_update_stats() - Update soc level tx stats
  743. * @soc: DP soc handle
  744. * @tx_desc: TX descriptor reference
  745. * @ring_id: TCL ring id
  746. *
  747. * Returns: none
  748. */
  749. static inline void dp_tx_update_stats(struct dp_soc *soc,
  750. struct dp_tx_desc_s *tx_desc,
  751. uint8_t ring_id){ }
  752. static inline void
  753. dp_tx_ring_access_end(struct dp_soc *soc, hal_ring_handle_t hal_ring_hdl,
  754. int coalesce)
  755. {
  756. dp_tx_hal_ring_access_end(soc, hal_ring_hdl);
  757. }
  758. static inline int
  759. dp_tx_attempt_coalescing(struct dp_soc *soc, struct dp_vdev *vdev,
  760. struct dp_tx_desc_s *tx_desc,
  761. uint8_t tid,
  762. struct dp_tx_msdu_info_s *msdu_info,
  763. uint8_t ring_id)
  764. {
  765. return 0;
  766. }
  767. #endif /* WLAN_DP_FEATURE_SW_LATENCY_MGR */
  768. #ifdef FEATURE_RUNTIME_PM
  769. /**
  770. * dp_set_rtpm_tput_policy_requirement() - Update RTPM throughput policy
  771. * @soc_hdl: DP soc handle
  772. * @is_high_tput: flag to indicate whether throughput is high
  773. *
  774. * Returns: none
  775. */
  776. static inline
  777. void dp_set_rtpm_tput_policy_requirement(struct cdp_soc_t *soc_hdl,
  778. bool is_high_tput)
  779. {
  780. struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
  781. qdf_atomic_set(&soc->rtpm_high_tput_flag, is_high_tput);
  782. }
  783. void
  784. dp_tx_ring_access_end_wrapper(struct dp_soc *soc,
  785. hal_ring_handle_t hal_ring_hdl,
  786. int coalesce);
  787. #else
  788. #ifdef DP_POWER_SAVE
  789. void
  790. dp_tx_ring_access_end_wrapper(struct dp_soc *soc,
  791. hal_ring_handle_t hal_ring_hdl,
  792. int coalesce);
  793. #else
  794. static inline void
  795. dp_tx_ring_access_end_wrapper(struct dp_soc *soc,
  796. hal_ring_handle_t hal_ring_hdl,
  797. int coalesce)
  798. {
  799. dp_tx_ring_access_end(soc, hal_ring_hdl, coalesce);
  800. }
  801. #endif
  802. static inline void
  803. dp_set_rtpm_tput_policy_requirement(struct cdp_soc_t *soc_hdl,
  804. bool is_high_tput)
  805. { }
  806. #endif
  807. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  808. #ifdef DP_TX_HW_DESC_HISTORY
  809. static inline void
  810. dp_tx_hw_desc_update_evt(uint8_t *hal_tx_desc_cached,
  811. hal_ring_handle_t hal_ring_hdl,
  812. struct dp_soc *soc)
  813. {
  814. struct dp_tx_hw_desc_evt *evt;
  815. uint64_t idx = 0;
  816. if (!soc->tx_hw_desc_history)
  817. return;
  818. idx = ++soc->tx_hw_desc_history->index;
  819. if (idx == DP_TX_HW_DESC_HIST_MAX)
  820. soc->tx_hw_desc_history->index = 0;
  821. idx = qdf_do_div_rem(idx, DP_TX_HW_DESC_HIST_MAX);
  822. evt = &soc->tx_hw_desc_history->entry[idx];
  823. qdf_mem_copy(evt->tcl_desc, hal_tx_desc_cached, HAL_TX_DESC_LEN_BYTES);
  824. evt->posted = qdf_get_log_timestamp();
  825. hal_get_sw_hptp(soc->hal_soc, hal_ring_hdl, &evt->tp, &evt->hp);
  826. }
  827. #else
  828. static inline void
  829. dp_tx_hw_desc_update_evt(uint8_t *hal_tx_desc_cached,
  830. hal_ring_handle_t hal_ring_hdl,
  831. struct dp_soc *soc)
  832. {
  833. }
  834. #endif
  835. #if defined(WLAN_FEATURE_TSF_UPLINK_DELAY) || defined(CONFIG_SAWF)
  836. /**
  837. * dp_tx_compute_hw_delay_us() - Compute hardware Tx completion delay
  838. * @ts: Tx completion status
  839. * @delta_tsf: Difference between TSF clock and qtimer
  840. * @delay_us: Delay in microseconds
  841. *
  842. * Return: QDF_STATUS_SUCCESS : Success
  843. * QDF_STATUS_E_INVAL : Tx completion status is invalid or
  844. * delay_us is NULL
  845. * QDF_STATUS_E_FAILURE : Error in delay calculation
  846. */
  847. QDF_STATUS
  848. dp_tx_compute_hw_delay_us(struct hal_tx_completion_status *ts,
  849. uint32_t delta_tsf,
  850. uint32_t *delay_us);
  851. /**
  852. * dp_set_delta_tsf() - Set delta_tsf to dp_soc structure
  853. * @soc_hdl: cdp soc pointer
  854. * @vdev_id: vdev id
  855. * @delta_tsf: difference between TSF clock and qtimer
  856. *
  857. * Return: None
  858. */
  859. void dp_set_delta_tsf(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  860. uint32_t delta_tsf);
  861. #endif
  862. #ifdef WLAN_FEATURE_TSF_UPLINK_DELAY
  863. /**
  864. * dp_set_tsf_report_ul_delay() - Enable or disable reporting uplink delay
  865. * @soc_hdl: cdp soc pointer
  866. * @vdev_id: vdev id
  867. * @enable: true to enable and false to disable
  868. *
  869. * Return: QDF_STATUS
  870. */
  871. QDF_STATUS dp_set_tsf_ul_delay_report(struct cdp_soc_t *soc_hdl,
  872. uint8_t vdev_id, bool enable);
  873. /**
  874. * dp_get_uplink_delay() - Get uplink delay value
  875. * @soc_hdl: cdp soc pointer
  876. * @vdev_id: vdev id
  877. * @val: pointer to save uplink delay value
  878. *
  879. * Return: QDF_STATUS
  880. */
  881. QDF_STATUS dp_get_uplink_delay(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  882. uint32_t *val);
  883. #endif /* WLAN_FEATURE_TSF_UPLINK_TSF */
  884. /**
  885. * dp_tx_pkt_tracepoints_enabled() - Get the state of tx pkt tracepoint
  886. *
  887. * Return: True if any tx pkt tracepoint is enabled else false
  888. */
  889. static inline
  890. bool dp_tx_pkt_tracepoints_enabled(void)
  891. {
  892. return (qdf_trace_dp_tx_comp_tcp_pkt_enabled() ||
  893. qdf_trace_dp_tx_comp_udp_pkt_enabled() ||
  894. qdf_trace_dp_tx_comp_pkt_enabled());
  895. }
  896. #ifdef DP_TX_TRACKING
  897. /**
  898. * dp_tx_desc_set_timestamp() - set timestamp in tx descriptor
  899. * @tx_desc - tx descriptor
  900. *
  901. * Return: None
  902. */
  903. static inline
  904. void dp_tx_desc_set_timestamp(struct dp_tx_desc_s *tx_desc)
  905. {
  906. tx_desc->timestamp_tick = qdf_system_ticks();
  907. }
  908. /**
  909. * dp_tx_desc_check_corruption() - Verify magic pattern in tx descriptor
  910. * @tx_desc: tx descriptor
  911. *
  912. * Check for corruption in tx descriptor, if magic pattern is not matching
  913. * trigger self recovery
  914. *
  915. * Return: none
  916. */
  917. void dp_tx_desc_check_corruption(struct dp_tx_desc_s *tx_desc);
  918. #else
  919. static inline
  920. void dp_tx_desc_set_timestamp(struct dp_tx_desc_s *tx_desc)
  921. {
  922. }
  923. static inline
  924. void dp_tx_desc_check_corruption(struct dp_tx_desc_s *tx_desc)
  925. {
  926. }
  927. #endif
  928. #ifndef CONFIG_SAWF
  929. static inline bool dp_sawf_tag_valid_get(qdf_nbuf_t nbuf)
  930. {
  931. return false;
  932. }
  933. #endif
  934. #ifdef HW_TX_DELAY_STATS_ENABLE
  935. /**
  936. * dp_tx_desc_set_ktimestamp() - set kernel timestamp in tx descriptor
  937. * @vdev: DP vdev handle
  938. * @tx_desc: tx descriptor
  939. *
  940. * Return: true when descriptor is timestamped, false otherwise
  941. */
  942. static inline
  943. bool dp_tx_desc_set_ktimestamp(struct dp_vdev *vdev,
  944. struct dp_tx_desc_s *tx_desc)
  945. {
  946. if (qdf_unlikely(vdev->pdev->delay_stats_flag) ||
  947. qdf_unlikely(vdev->pdev->soc->wlan_cfg_ctx->pext_stats_enabled) ||
  948. qdf_unlikely(dp_tx_pkt_tracepoints_enabled()) ||
  949. qdf_unlikely(vdev->pdev->soc->peerstats_enabled) ||
  950. qdf_unlikely(dp_is_vdev_tx_delay_stats_enabled(vdev))) {
  951. tx_desc->timestamp = qdf_ktime_real_get();
  952. return true;
  953. }
  954. return false;
  955. }
  956. #else
  957. static inline
  958. bool dp_tx_desc_set_ktimestamp(struct dp_vdev *vdev,
  959. struct dp_tx_desc_s *tx_desc)
  960. {
  961. if (qdf_unlikely(vdev->pdev->delay_stats_flag) ||
  962. qdf_unlikely(vdev->pdev->soc->wlan_cfg_ctx->pext_stats_enabled) ||
  963. qdf_unlikely(dp_tx_pkt_tracepoints_enabled()) ||
  964. qdf_unlikely(vdev->pdev->soc->peerstats_enabled)) {
  965. tx_desc->timestamp = qdf_ktime_real_get();
  966. return true;
  967. }
  968. return false;
  969. }
  970. #endif
  971. #ifdef CONFIG_DP_PKT_ADD_TIMESTAMP
  972. /**
  973. * dp_pkt_add_timestamp() - add timestamp in data payload
  974. *
  975. * @vdev: dp vdev
  976. * @index: index to decide offset in payload
  977. * @time: timestamp to add in data payload
  978. * @nbuf: network buffer
  979. *
  980. * Return: none
  981. */
  982. void dp_pkt_add_timestamp(struct dp_vdev *vdev,
  983. enum qdf_pkt_timestamp_index index, uint64_t time,
  984. qdf_nbuf_t nbuf);
  985. /**
  986. * dp_pkt_get_timestamp() - get current system time
  987. *
  988. * @time: return current system time
  989. *
  990. * Return: none
  991. */
  992. void dp_pkt_get_timestamp(uint64_t *time);
  993. #else
  994. #define dp_pkt_add_timestamp(vdev, index, time, nbuf)
  995. static inline
  996. void dp_pkt_get_timestamp(uint64_t *time)
  997. {
  998. }
  999. #endif
  1000. #endif