dp_tx.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef __DP_TX_H
  19. #define __DP_TX_H
  20. #include <qdf_types.h>
  21. #include <qdf_nbuf.h>
  22. #include "dp_types.h"
  23. #if defined(MESH_MODE_SUPPORT) || defined(FEATURE_PERPKT_INFO)
  24. #include "if_meta_hdr.h"
  25. #endif
  26. #include "dp_internal.h"
  27. #define DP_INVALID_VDEV_ID 0xFF
  28. #define DP_TX_MAX_NUM_FRAGS 6
  29. /*
  30. * DP_TX_DESC_FLAG_FRAG flags should always be defined to 0x1
  31. * please do not change this flag's definition
  32. */
  33. #define DP_TX_DESC_FLAG_FRAG 0x1
  34. #define DP_TX_DESC_FLAG_TO_FW 0x2
  35. #define DP_TX_DESC_FLAG_SIMPLE 0x4
  36. #define DP_TX_DESC_FLAG_RAW 0x8
  37. #define DP_TX_DESC_FLAG_MESH 0x10
  38. #define DP_TX_DESC_FLAG_QUEUED_TX 0x20
  39. #define DP_TX_DESC_FLAG_COMPLETED_TX 0x40
  40. #define DP_TX_DESC_FLAG_ME 0x80
  41. #define DP_TX_DESC_FLAG_TDLS_FRAME 0x100
  42. #define DP_TX_DESC_FLAG_ALLOCATED 0x200
  43. #define DP_TX_DESC_FLAG_MESH_MODE 0x400
  44. #define DP_TX_DESC_FLAG_UNMAP_DONE 0x800
  45. #define DP_TX_DESC_FLAG_TX_COMP_ERR 0x1000
  46. #define DP_TX_DESC_FLAG_FLUSH 0x2000
  47. #define DP_TX_EXT_DESC_FLAG_METADATA_VALID 0x1
  48. #define DP_TX_FREE_SINGLE_BUF(soc, buf) \
  49. do { \
  50. qdf_nbuf_unmap(soc->osdev, buf, QDF_DMA_TO_DEVICE); \
  51. qdf_nbuf_free(buf); \
  52. } while (0)
  53. #define OCB_HEADER_VERSION 1
  54. #ifdef TX_PER_PDEV_DESC_POOL
  55. #ifdef QCA_LL_TX_FLOW_CONTROL_V2
  56. #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id)
  57. #else /* QCA_LL_TX_FLOW_CONTROL_V2 */
  58. #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->pdev->pdev_id)
  59. #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
  60. #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id)
  61. #else
  62. #ifdef TX_PER_VDEV_DESC_POOL
  63. #define DP_TX_GET_DESC_POOL_ID(vdev) (vdev->vdev_id)
  64. #define DP_TX_GET_RING_ID(vdev) (vdev->pdev->pdev_id)
  65. #endif /* TX_PER_VDEV_DESC_POOL */
  66. #endif /* TX_PER_PDEV_DESC_POOL */
  67. #define DP_TX_QUEUE_MASK 0x3
  68. /* number of dwords for htt_tx_msdu_desc_ext2_t */
  69. #define DP_TX_MSDU_INFO_META_DATA_DWORDS 7
  70. #define dp_tx_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_TX, params)
  71. #define dp_tx_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_TX, params)
  72. #define dp_tx_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP_TX, params)
  73. #define dp_tx_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_TX, params)
  74. #define dp_tx_info(params...) \
  75. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_TX, ## params)
  76. #define dp_tx_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_TX, params)
  77. #define dp_tx_comp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_TX_COMP, params)
  78. #define dp_tx_comp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_TX_COMP, params)
  79. #define dp_tx_comp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_TX_COMP, params)
  80. #define dp_tx_comp_info(params...) \
  81. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_TX_COMP, ## params)
  82. #define dp_tx_comp_info_rl(params...) \
  83. __QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_TX_COMP, ## params)
  84. #define dp_tx_comp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_TX_COMP, params)
  85. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  86. /**
  87. * struct dp_tx_frag_info_s
  88. * @vaddr: hlos vritual address for buffer
  89. * @paddr_lo: physical address lower 32bits
  90. * @paddr_hi: physical address higher bits
  91. * @len: length of the buffer
  92. */
  93. struct dp_tx_frag_info_s {
  94. uint8_t *vaddr;
  95. uint32_t paddr_lo;
  96. uint16_t paddr_hi;
  97. uint16_t len;
  98. };
  99. /**
  100. * struct dp_tx_seg_info_s - Segmentation Descriptor
  101. * @nbuf: NBUF pointer if segment corresponds to separate nbuf
  102. * @frag_cnt: Fragment count in this segment
  103. * @total_len: Total length of segment
  104. * @frags: per-Fragment information
  105. * @next: pointer to next MSDU segment
  106. */
  107. struct dp_tx_seg_info_s {
  108. qdf_nbuf_t nbuf;
  109. uint16_t frag_cnt;
  110. uint16_t total_len;
  111. struct dp_tx_frag_info_s frags[DP_TX_MAX_NUM_FRAGS];
  112. struct dp_tx_seg_info_s *next;
  113. };
  114. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  115. /**
  116. * struct dp_tx_sg_info_s - Scatter Gather Descriptor
  117. * @num_segs: Number of segments (TSO/ME) in the frame
  118. * @total_len: Total length of the frame
  119. * @curr_seg: Points to current segment descriptor to be processed. Chain of
  120. * descriptors for SG frames/multicast-unicast converted packets.
  121. *
  122. * Used for SG (802.3 or Raw) frames and Multicast-Unicast converted frames to
  123. * carry fragmentation information
  124. * Raw Frames will be handed over to driver as an SKB chain with MPDU boundaries
  125. * indicated through flags in SKB CB (first_msdu and last_msdu). This will be
  126. * converted into set of skb sg (nr_frags) structures.
  127. */
  128. struct dp_tx_sg_info_s {
  129. uint32_t num_segs;
  130. uint32_t total_len;
  131. struct dp_tx_seg_info_s *curr_seg;
  132. };
  133. /**
  134. * struct dp_tx_queue - Tx queue
  135. * @desc_pool_id: Descriptor Pool to be used for the tx queue
  136. * @ring_id: TCL descriptor ring ID corresponding to the tx queue
  137. *
  138. * Tx queue contains information of the software (Descriptor pool)
  139. * and hardware resources (TCL ring id) to be used for a particular
  140. * transmit queue (obtained from skb_queue_mapping in case of linux)
  141. */
  142. struct dp_tx_queue {
  143. uint8_t desc_pool_id;
  144. uint8_t ring_id;
  145. };
  146. /**
  147. * struct dp_tx_msdu_info_s - MSDU Descriptor
  148. * @frm_type: Frame type - Regular/TSO/SG/Multicast enhancement
  149. * @tx_queue: Tx queue on which this MSDU should be transmitted
  150. * @num_seg: Number of segments (TSO)
  151. * @tid: TID (override) that is sent from HLOS
  152. * @u.tso_info: TSO information for TSO frame types
  153. * (chain of the TSO segments, number of segments)
  154. * @u.sg_info: Scatter Gather information for non-TSO SG frames
  155. * @meta_data: Mesh meta header information
  156. * @exception_fw: Duplicate frame to be sent to firmware
  157. * @ppdu_cookie: 16-bit ppdu_cookie that has to be replayed back in completions
  158. * @ix_tx_sniffer: Indicates if the packet has to be sniffed
  159. *
  160. * This structure holds the complete MSDU information needed to program the
  161. * Hardware TCL and MSDU extension descriptors for different frame types
  162. *
  163. */
  164. struct dp_tx_msdu_info_s {
  165. enum dp_tx_frm_type frm_type;
  166. struct dp_tx_queue tx_queue;
  167. uint32_t num_seg;
  168. uint8_t tid;
  169. uint8_t exception_fw;
  170. uint8_t is_tx_sniffer;
  171. union {
  172. struct qdf_tso_info_t tso_info;
  173. struct dp_tx_sg_info_s sg_info;
  174. } u;
  175. uint32_t meta_data[DP_TX_MSDU_INFO_META_DATA_DWORDS];
  176. uint16_t ppdu_cookie;
  177. };
  178. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  179. /**
  180. * dp_tx_deinit_pair_by_index() - Deinit TX rings based on index
  181. * @soc: core txrx context
  182. * @index: index of ring to deinit
  183. *
  184. * Deinit 1 TCL and 1 WBM2SW release ring on as needed basis using
  185. * index of the respective TCL/WBM2SW release in soc structure.
  186. * For example, if the index is 2 then &soc->tcl_data_ring[2]
  187. * and &soc->tx_comp_ring[2] will be deinitialized.
  188. *
  189. * Return: none
  190. */
  191. void dp_tx_deinit_pair_by_index(struct dp_soc *soc, int index);
  192. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  193. void dp_tx_tso_cmn_desc_pool_deinit(struct dp_soc *soc, uint8_t num_pool);
  194. void dp_tx_tso_cmn_desc_pool_free(struct dp_soc *soc, uint8_t num_pool);
  195. QDF_STATUS dp_tx_tso_cmn_desc_pool_alloc(struct dp_soc *soc,
  196. uint8_t num_pool,
  197. uint16_t num_desc);
  198. QDF_STATUS dp_tx_tso_cmn_desc_pool_init(struct dp_soc *soc,
  199. uint8_t num_pool,
  200. uint16_t num_desc);
  201. void dp_tx_tso_cmn_desc_pool_deinit(struct dp_soc *soc, uint8_t num_pool);
  202. void dp_tx_tso_cmn_desc_pool_free(struct dp_soc *soc, uint8_t num_pool);
  203. QDF_STATUS dp_tx_tso_cmn_desc_pool_alloc(struct dp_soc *soc,
  204. uint8_t num_pool,
  205. uint16_t num_desc);
  206. QDF_STATUS dp_tx_tso_cmn_desc_pool_init(struct dp_soc *soc,
  207. uint8_t num_pool,
  208. uint16_t num_desc);
  209. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  210. /**
  211. * dp_tso_attach() - TSO Attach handler
  212. * @txrx_soc: Opaque Dp handle
  213. *
  214. * Reserve TSO descriptor buffers
  215. *
  216. * Return: QDF_STATUS_E_FAILURE on failure or
  217. * QDF_STATUS_SUCCESS on success
  218. */
  219. QDF_STATUS dp_tso_soc_attach(struct cdp_soc_t *txrx_soc);
  220. /**
  221. * dp_tso_detach() - TSO Detach handler
  222. * @txrx_soc: Opaque Dp handle
  223. *
  224. * Deallocate TSO descriptor buffers
  225. *
  226. * Return: QDF_STATUS_E_FAILURE on failure or
  227. * QDF_STATUS_SUCCESS on success
  228. */
  229. QDF_STATUS dp_tso_soc_detach(struct cdp_soc_t *txrx_soc);
  230. qdf_nbuf_t dp_tx_send(struct cdp_soc_t *soc, uint8_t vdev_id, qdf_nbuf_t nbuf);
  231. qdf_nbuf_t dp_tx_send_vdev_id_check(struct cdp_soc_t *soc, uint8_t vdev_id,
  232. qdf_nbuf_t nbuf);
  233. qdf_nbuf_t dp_tx_send_exception(struct cdp_soc_t *soc, uint8_t vdev_id,
  234. qdf_nbuf_t nbuf,
  235. struct cdp_tx_exception_metadata *tx_exc);
  236. qdf_nbuf_t dp_tx_send_exception_vdev_id_check(struct cdp_soc_t *soc,
  237. uint8_t vdev_id,
  238. qdf_nbuf_t nbuf,
  239. struct cdp_tx_exception_metadata *tx_exc);
  240. qdf_nbuf_t dp_tx_send_mesh(struct cdp_soc_t *soc, uint8_t vdev_id,
  241. qdf_nbuf_t nbuf);
  242. qdf_nbuf_t
  243. dp_tx_send_msdu_single(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  244. struct dp_tx_msdu_info_s *msdu_info, uint16_t peer_id,
  245. struct cdp_tx_exception_metadata *tx_exc_metadata);
  246. #if QDF_LOCK_STATS
  247. noinline qdf_nbuf_t
  248. dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  249. struct dp_tx_msdu_info_s *msdu_info);
  250. #else
  251. qdf_nbuf_t dp_tx_send_msdu_multiple(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  252. struct dp_tx_msdu_info_s *msdu_info);
  253. #endif
  254. #ifdef FEATURE_WLAN_TDLS
  255. /**
  256. * dp_tx_non_std() - Allow the control-path SW to send data frames
  257. * @soc_hdl: Datapath soc handle
  258. * @vdev_id: id of vdev
  259. * @tx_spec: what non-standard handling to apply to the tx data frames
  260. * @msdu_list: NULL-terminated list of tx MSDUs
  261. *
  262. * Return: NULL on success,
  263. * nbuf when it fails to send
  264. */
  265. qdf_nbuf_t dp_tx_non_std(struct cdp_soc_t *soc_hdl, uint8_t vdev_id,
  266. enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list);
  267. #endif
  268. int dp_tx_frame_is_drop(struct dp_vdev *vdev, uint8_t *srcmac, uint8_t *dstmac);
  269. /**
  270. * dp_tx_comp_handler() - Tx completion handler
  271. * @int_ctx: pointer to DP interrupt context
  272. * @soc: core txrx main context
  273. * @hal_srng: Opaque HAL SRNG pointer
  274. * @ring_id: completion ring id
  275. * @quota: No. of packets/descriptors that can be serviced in one loop
  276. *
  277. * This function will collect hardware release ring element contents and
  278. * handle descriptor contents. Based on contents, free packet or handle error
  279. * conditions
  280. *
  281. * Return: Number of TX completions processed
  282. */
  283. uint32_t dp_tx_comp_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
  284. hal_ring_handle_t hal_srng, uint8_t ring_id,
  285. uint32_t quota);
  286. QDF_STATUS
  287. dp_tx_prepare_send_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  288. QDF_STATUS
  289. dp_tx_prepare_send_igmp_me(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  290. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  291. #if defined(QCA_HOST_MODE_WIFI_DISABLED) || !defined(ATH_SUPPORT_IQUE)
  292. static inline void dp_tx_me_exit(struct dp_pdev *pdev)
  293. {
  294. return;
  295. }
  296. #endif
  297. /**
  298. * dp_tx_pdev_init() - dp tx pdev init
  299. * @pdev: physical device instance
  300. *
  301. * Return: QDF_STATUS_SUCCESS: success
  302. * QDF_STATUS_E_RESOURCES: Error return
  303. */
  304. static inline QDF_STATUS dp_tx_pdev_init(struct dp_pdev *pdev)
  305. {
  306. struct dp_soc *soc = pdev->soc;
  307. /* Initialize Flow control counters */
  308. qdf_atomic_init(&pdev->num_tx_outstanding);
  309. pdev->tx_descs_max = 0;
  310. if (wlan_cfg_per_pdev_tx_ring(soc->wlan_cfg_ctx)) {
  311. /* Initialize descriptors in TCL Ring */
  312. hal_tx_init_data_ring(soc->hal_soc,
  313. soc->tcl_data_ring[pdev->pdev_id].hal_srng);
  314. }
  315. return QDF_STATUS_SUCCESS;
  316. }
  317. #ifndef FEATURE_WDS
  318. static inline void dp_tx_mec_handler(struct dp_vdev *vdev, uint8_t *status)
  319. {
  320. return;
  321. }
  322. #endif
  323. #ifndef QCA_MULTIPASS_SUPPORT
  324. static inline
  325. bool dp_tx_multipass_process(struct dp_soc *soc, struct dp_vdev *vdev,
  326. qdf_nbuf_t nbuf,
  327. struct dp_tx_msdu_info_s *msdu_info)
  328. {
  329. return true;
  330. }
  331. static inline
  332. void dp_tx_vdev_multipass_deinit(struct dp_vdev *vdev)
  333. {
  334. }
  335. #else
  336. bool dp_tx_multipass_process(struct dp_soc *soc, struct dp_vdev *vdev,
  337. qdf_nbuf_t nbuf,
  338. struct dp_tx_msdu_info_s *msdu_info);
  339. void dp_tx_vdev_multipass_deinit(struct dp_vdev *vdev);
  340. #endif
  341. /**
  342. * dp_tx_hw_to_qdf()- convert hw status to qdf status
  343. * @status: hw status
  344. *
  345. * Return: qdf tx rx status
  346. */
  347. static inline enum qdf_dp_tx_rx_status dp_tx_hw_to_qdf(uint16_t status)
  348. {
  349. switch (status) {
  350. case HAL_TX_TQM_RR_FRAME_ACKED:
  351. return QDF_TX_RX_STATUS_OK;
  352. case HAL_TX_TQM_RR_REM_CMD_REM:
  353. case HAL_TX_TQM_RR_REM_CMD_TX:
  354. case HAL_TX_TQM_RR_REM_CMD_NOTX:
  355. case HAL_TX_TQM_RR_REM_CMD_AGED:
  356. return QDF_TX_RX_STATUS_FW_DISCARD;
  357. default:
  358. return QDF_TX_RX_STATUS_DEFAULT;
  359. }
  360. }
  361. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  362. /**
  363. * dp_tx_get_queue() - Returns Tx queue IDs to be used for this Tx frame
  364. * @vdev: DP Virtual device handle
  365. * @nbuf: Buffer pointer
  366. * @queue: queue ids container for nbuf
  367. *
  368. * TX packet queue has 2 instances, software descriptors id and dma ring id
  369. * Based on tx feature and hardware configuration queue id combination could be
  370. * different.
  371. * For example -
  372. * With XPS enabled,all TX descriptor pools and dma ring are assigned per cpu id
  373. * With no XPS,lock based resource protection, Descriptor pool ids are different
  374. * for each vdev, dma ring id will be same as single pdev id
  375. *
  376. * Return: None
  377. */
  378. #ifdef QCA_OL_TX_MULTIQ_SUPPORT
  379. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  380. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  381. {
  382. uint16_t queue_offset = qdf_nbuf_get_queue_mapping(nbuf) &
  383. DP_TX_QUEUE_MASK;
  384. queue->desc_pool_id = queue_offset;
  385. queue->ring_id = qdf_get_cpu();
  386. dp_tx_debug("pool_id:%d ring_id: %d",
  387. queue->desc_pool_id, queue->ring_id);
  388. }
  389. /*
  390. * dp_tx_get_hal_ring_hdl()- Get the hal_tx_ring_hdl for data transmission
  391. * @dp_soc - DP soc structure pointer
  392. * @ring_id - Transmit Queue/ring_id to be used when XPS is enabled
  393. *
  394. * Return - HAL ring handle
  395. */
  396. static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc,
  397. uint8_t ring_id)
  398. {
  399. if (ring_id == soc->num_tcl_data_rings)
  400. return soc->tcl_cmd_credit_ring.hal_srng;
  401. return soc->tcl_data_ring[ring_id].hal_srng;
  402. }
  403. /*
  404. * dp_tx_get_rbm_id()- Get the RBM ID for data transmission completion.
  405. * @dp_soc - DP soc structure pointer
  406. * @ring_id - Transmit Queue/ring_id to be used when XPS is enabled
  407. *
  408. * Return - HAL ring handle
  409. */
  410. static inline uint8_t dp_tx_get_rbm_id(struct dp_soc *doc,
  411. uint8_t ring_id)
  412. {
  413. return (ring_id ? HAL_WBM_SW0_BM_ID + (ring_id - 1) :
  414. HAL_WBM_SW2_BM_ID);
  415. }
  416. #else /* QCA_OL_TX_MULTIQ_SUPPORT */
  417. static inline void dp_tx_get_queue(struct dp_vdev *vdev,
  418. qdf_nbuf_t nbuf, struct dp_tx_queue *queue)
  419. {
  420. /* get flow id */
  421. queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev);
  422. queue->ring_id = DP_TX_GET_RING_ID(vdev);
  423. dp_tx_debug("pool_id:%d ring_id: %d",
  424. queue->desc_pool_id, queue->ring_id);
  425. }
  426. static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc,
  427. uint8_t ring_id)
  428. {
  429. return soc->tcl_data_ring[ring_id].hal_srng;
  430. }
  431. static inline uint8_t dp_tx_get_rbm_id(struct dp_soc *soc,
  432. uint8_t ring_id)
  433. {
  434. return (ring_id + HAL_WBM_SW0_BM_ID);
  435. }
  436. #endif
  437. #ifdef QCA_OL_TX_LOCK_LESS_ACCESS
  438. /*
  439. * dp_tx_hal_ring_access_start()- hal_tx_ring access for data transmission
  440. * @dp_soc - DP soc structure pointer
  441. * @hal_ring_hdl - HAL ring handle
  442. *
  443. * Return - None
  444. */
  445. static inline int dp_tx_hal_ring_access_start(struct dp_soc *soc,
  446. hal_ring_handle_t hal_ring_hdl)
  447. {
  448. return hal_srng_access_start_unlocked(soc->hal_soc, hal_ring_hdl);
  449. }
  450. /*
  451. * dp_tx_hal_ring_access_end()- hal_tx_ring access for data transmission
  452. * @dp_soc - DP soc structure pointer
  453. * @hal_ring_hdl - HAL ring handle
  454. *
  455. * Return - None
  456. */
  457. static inline void dp_tx_hal_ring_access_end(struct dp_soc *soc,
  458. hal_ring_handle_t hal_ring_hdl)
  459. {
  460. hal_srng_access_end_unlocked(soc->hal_soc, hal_ring_hdl);
  461. }
  462. /*
  463. * dp_tx_hal_ring_access_reap()- hal_tx_ring access for data transmission
  464. * @dp_soc - DP soc structure pointer
  465. * @hal_ring_hdl - HAL ring handle
  466. *
  467. * Return - None
  468. */
  469. static inline void dp_tx_hal_ring_access_end_reap(struct dp_soc *soc,
  470. hal_ring_handle_t
  471. hal_ring_hdl)
  472. {
  473. }
  474. #else
  475. static inline int dp_tx_hal_ring_access_start(struct dp_soc *soc,
  476. hal_ring_handle_t hal_ring_hdl)
  477. {
  478. return hal_srng_access_start(soc->hal_soc, hal_ring_hdl);
  479. }
  480. static inline void dp_tx_hal_ring_access_end(struct dp_soc *soc,
  481. hal_ring_handle_t hal_ring_hdl)
  482. {
  483. hal_srng_access_end(soc->hal_soc, hal_ring_hdl);
  484. }
  485. static inline void dp_tx_hal_ring_access_end_reap(struct dp_soc *soc,
  486. hal_ring_handle_t
  487. hal_ring_hdl)
  488. {
  489. hal_srng_access_end_reap(soc->hal_soc, hal_ring_hdl);
  490. }
  491. #endif
  492. void dp_iterate_update_peer_list(struct cdp_pdev *pdev_hdl);
  493. #ifdef ATH_TX_PRI_OVERRIDE
  494. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf) \
  495. ((_msdu_info)->tid = qdf_nbuf_get_priority(_nbuf))
  496. #else
  497. #define DP_TX_TID_OVERRIDE(_msdu_info, _nbuf)
  498. #endif
  499. /* TODO TX_FEATURE_NOT_YET */
  500. static inline void dp_tx_comp_process_exception(struct dp_tx_desc_s *tx_desc)
  501. {
  502. return;
  503. }
  504. /* TODO TX_FEATURE_NOT_YET */
  505. void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev,
  506. bool force_free);
  507. QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev);
  508. QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev);
  509. void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev);
  510. QDF_STATUS dp_soc_tx_desc_sw_pools_alloc(struct dp_soc *soc);
  511. QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc);
  512. void dp_soc_tx_desc_sw_pools_free(struct dp_soc *soc);
  513. void dp_soc_tx_desc_sw_pools_deinit(struct dp_soc *soc);
  514. void
  515. dp_handle_wbm_internal_error(struct dp_soc *soc, void *hal_desc,
  516. uint32_t buf_type);
  517. #else /* QCA_HOST_MODE_WIFI_DISABLED */
  518. static inline
  519. QDF_STATUS dp_soc_tx_desc_sw_pools_alloc(struct dp_soc *soc)
  520. {
  521. return QDF_STATUS_SUCCESS;
  522. }
  523. static inline
  524. QDF_STATUS dp_soc_tx_desc_sw_pools_init(struct dp_soc *soc)
  525. {
  526. return QDF_STATUS_SUCCESS;
  527. }
  528. static inline void dp_soc_tx_desc_sw_pools_free(struct dp_soc *soc)
  529. {
  530. }
  531. static inline void dp_soc_tx_desc_sw_pools_deinit(struct dp_soc *soc)
  532. {
  533. }
  534. static inline
  535. void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev,
  536. bool force_free)
  537. {
  538. }
  539. static inline QDF_STATUS dp_tx_vdev_attach(struct dp_vdev *vdev)
  540. {
  541. return QDF_STATUS_SUCCESS;
  542. }
  543. static inline QDF_STATUS dp_tx_vdev_detach(struct dp_vdev *vdev)
  544. {
  545. return QDF_STATUS_SUCCESS;
  546. }
  547. static inline void dp_tx_vdev_update_search_flags(struct dp_vdev *vdev)
  548. {
  549. }
  550. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  551. #ifdef FEATURE_PERPKT_INFO
  552. QDF_STATUS
  553. dp_get_completion_indication_for_stack(struct dp_soc *soc,
  554. struct dp_pdev *pdev,
  555. struct dp_peer *peer,
  556. struct hal_tx_completion_status *ts,
  557. qdf_nbuf_t netbuf,
  558. uint64_t time_latency);
  559. void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev,
  560. uint16_t peer_id, uint32_t ppdu_id,
  561. qdf_nbuf_t netbuf);
  562. #else
  563. static inline
  564. QDF_STATUS dp_get_completion_indication_for_stack(struct dp_soc *soc,
  565. struct dp_pdev *pdev,
  566. struct dp_peer *peer,
  567. struct hal_tx_completion_status *ts,
  568. qdf_nbuf_t netbuf,
  569. uint64_t time_latency)
  570. {
  571. return QDF_STATUS_E_NOSUPPORT;
  572. }
  573. static inline
  574. void dp_send_completion_to_stack(struct dp_soc *soc, struct dp_pdev *pdev,
  575. uint16_t peer_id, uint32_t ppdu_id,
  576. qdf_nbuf_t netbuf)
  577. {
  578. }
  579. #endif
  580. #ifndef WLAN_TX_PKT_CAPTURE_ENH
  581. static inline
  582. QDF_STATUS dp_peer_set_tx_capture_enabled(struct dp_pdev *pdev,
  583. struct dp_peer *peer_handle,
  584. uint8_t value, uint8_t *peer_mac)
  585. {
  586. return QDF_STATUS_SUCCESS;
  587. }
  588. #endif
  589. #ifdef WLAN_FEATURE_PKT_CAPTURE_V2
  590. void dp_send_completion_to_pkt_capture(struct dp_soc *soc,
  591. struct dp_tx_desc_s *desc,
  592. struct hal_tx_completion_status *ts);
  593. #else
  594. static inline void
  595. dp_send_completion_to_pkt_capture(struct dp_soc *soc,
  596. struct dp_tx_desc_s *desc,
  597. struct hal_tx_completion_status *ts)
  598. {
  599. }
  600. #endif
  601. #endif