xref: /wlan-dirver/qca-wifi-host-cmn/dp/wifi3.0/li/dp_li_tx.h (revision 8cfe6b10058a04cafb17eed051f2ddf11bee8931)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 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_LI_TX_H
20 #define __DP_LI_TX_H
21 
22 #include <dp_types.h>
23 
24 /**
25  * dp_tx_hw_enqueue_li() - Enqueue to TCL HW for transmit
26  * @soc: DP Soc Handle
27  * @vdev: DP vdev handle
28  * @tx_desc: Tx Descriptor Handle
29  * @fw_metadata: Metadata to send to Target Firmware along with frame
30  * @tx_exc_metadata: Handle that holds exception path meta data
31  * @msdu_info: MSDU information
32  *
33  *  Gets the next free TCL HW DMA descriptor and sets up required parameters
34  *  from software Tx descriptor
35  *
36  * Return: QDF_STATUS_SUCCESS: success
37  *         QDF_STATUS_E_RESOURCES: Error return
38  */
39 QDF_STATUS
40 dp_tx_hw_enqueue_li(struct dp_soc *soc, struct dp_vdev *vdev,
41 		    struct dp_tx_desc_s *tx_desc, uint16_t fw_metadata,
42 		    struct cdp_tx_exception_metadata *tx_exc_metadata,
43 		    struct dp_tx_msdu_info_s *msdu_info);
44 /**
45  * dp_tx_comp_get_params_from_hal_desc_li() - Get TX desc from HAL comp desc
46  * @soc: DP soc handle
47  * @tx_comp_hal_desc: HAL TX Comp Descriptor
48  * @r_tx_desc: SW Tx Descriptor retrieved from HAL desc.
49  *
50  * Return: None
51  */
52 void dp_tx_comp_get_params_from_hal_desc_li(struct dp_soc *soc,
53 					    void *tx_comp_hal_desc,
54 					    struct dp_tx_desc_s **r_tx_desc);
55 
56 /**
57  * dp_tx_process_htt_completion_li() - Tx HTT Completion Indication Handler
58  * @soc: Handle to DP soc structure
59  * @tx_desc: software descriptor head pointer
60  * @status: Tx completion status from HTT descriptor
61  * @ring_id: ring number
62  *
63  * This function will process HTT Tx indication messages from Target
64  *
65  * Return: none
66  */
67 void dp_tx_process_htt_completion_li(struct dp_soc *soc,
68 				     struct dp_tx_desc_s *tx_desc,
69 				     uint8_t *status,
70 				     uint8_t ring_id);
71 
72 /**
73  * dp_tx_desc_pool_init_li() - Initialize Tx Descriptor pool(s)
74  * @soc: Handle to DP Soc structure
75  * @num_elem: pool descriptor number
76  * @pool_id: pool to allocate
77  *
78  * Return: QDF_STATUS_SUCCESS - success, others - failure
79  */
80 QDF_STATUS dp_tx_desc_pool_init_li(struct dp_soc *soc,
81 				   uint32_t num_elem,
82 				   uint8_t pool_id);
83 
84 /**
85  * dp_tx_desc_pool_deinit_li() - De-initialize Tx Descriptor pool(s)
86  * @soc: Handle to DP Soc structure
87  * @tx_desc_pool: Tx descriptor pool handler
88  * @pool_id: pool to deinit
89  *
90  * Return: None.
91  */
92 void dp_tx_desc_pool_deinit_li(struct dp_soc *soc,
93 			       struct dp_tx_desc_pool_s *tx_desc_pool,
94 			       uint8_t pool_id);
95 
96 /**
97  * dp_tx_compute_tx_delay_li() - Compute HW Tx completion delay
98  * @soc: Handle to DP Soc structure
99  * @vdev: vdev
100  * @ts: Tx completion status
101  * @delay_us: Delay to be calculated in microseconds
102  *
103  * Return: QDF_STATUS
104  */
105 QDF_STATUS dp_tx_compute_tx_delay_li(struct dp_soc *soc,
106 				     struct dp_vdev *vdev,
107 				     struct hal_tx_completion_status *ts,
108 				     uint32_t *delay_us);
109 #endif
110