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