xref: /wlan-dirver/qca-wifi-host-cmn/dp/wifi3.0/be/dp_be_tx.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
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_BE_TX_H
19 #define __DP_BE_TX_H
20 /**
21  *  DOC: dp_be_tx.h
22  *
23  * BE specific TX Datapath header file. Need not be exposed to common DP code.
24  *
25  */
26 
27 #include <dp_types.h>
28 #include "dp_be.h"
29 
30 /* Invalid TX Bank ID value */
31 #define DP_BE_INVALID_BANK_ID -1
32 
33 /**
34  * dp_tx_hw_enqueue_be() - Enqueue to TCL HW for transmit for BE target
35  * @soc: DP Soc Handle
36  * @vdev: DP vdev handle
37  * @tx_desc: Tx Descriptor Handle
38  * @fw_metadata: Metadata to send to Target Firmware along with frame
39  * @tx_exc_metadata: Handle that holds exception path meta data
40  * @msdu_info: msdu_info containing information about TX buffer
41  *
42  *  Gets the next free TCL HW DMA descriptor and sets up required parameters
43  *  from software Tx descriptor
44  *
45  * Return: QDF_STATUS_SUCCESS: success
46  *         QDF_STATUS_E_RESOURCES: Error return
47  */
48 QDF_STATUS dp_tx_hw_enqueue_be(struct dp_soc *soc, struct dp_vdev *vdev,
49 			       struct dp_tx_desc_s *tx_desc,
50 				uint16_t fw_metadata,
51 				struct cdp_tx_exception_metadata *metadata,
52 				struct dp_tx_msdu_info_s *msdu_info);
53 
54 /**
55  * dp_tx_comp_get_params_from_hal_desc_be() - Get TX desc from HAL comp desc
56  * @soc: DP soc handle
57  * @tx_comp_hal_desc: HAL TX Comp Descriptor
58  * @r_tx_desc: SW Tx Descriptor retrieved from HAL desc.
59  *
60  * Return: None
61  */
62 void dp_tx_comp_get_params_from_hal_desc_be(struct dp_soc *soc,
63 					    void *tx_comp_hal_desc,
64 					    struct dp_tx_desc_s **r_tx_desc);
65 
66 /**
67  * dp_tx_init_bank_profiles() - Init TX bank profiles
68  * @soc: DP soc handle
69  *
70  * Return: QDF_STATUS_SUCCESS or QDF error code.
71  */
72 QDF_STATUS dp_tx_init_bank_profiles(struct dp_soc_be *soc);
73 
74 /**
75  * dp_tx_deinit_bank_profiles() - De-Init TX bank profiles
76  * @soc: DP soc handle
77  *
78  * Return: None
79  */
80 void dp_tx_deinit_bank_profiles(struct dp_soc_be *soc);
81 
82 /**
83  * dp_tx_get_bank_profile() - get TX bank profile for vdev
84  * @soc: DP soc handle
85  * @be_vdev: BE vdev pointer
86  *
87  * Return: bank profile allocated to vdev or DP_BE_INVALID_BANK_ID
88  */
89 int dp_tx_get_bank_profile(struct dp_soc_be *soc,
90 			   struct dp_vdev_be *be_vdev);
91 
92 /**
93  * dp_tx_put_bank_profile() - release TX bank profile for vdev
94  * @soc: DP soc handle
95  *
96  * Return: None
97  */
98 void dp_tx_put_bank_profile(struct dp_soc_be *soc, struct dp_vdev_be *be_vdev);
99 
100 /**
101  * dp_tx_update_bank_profile() - release existing and allocate new bank profile
102  * @soc: DP soc handle
103  * @be_vdev: pointer to be_vdev structure
104  *
105  * The function releases the existing bank profile allocated to the vdev and
106  * looks for a new bank profile based on updated dp_vdev TX params.
107  *
108  * Return: None
109  */
110 void dp_tx_update_bank_profile(struct dp_soc_be *be_soc,
111 			       struct dp_vdev_be *be_vdev);
112 
113 /**
114  * dp_tx_desc_pool_init_be() - Initialize Tx Descriptor pool(s)
115  * @soc: Handle to DP Soc structure
116  * @num_elem: number of descriptor in pool
117  * @pool_id: pool ID to allocate
118  *
119  * Return: QDF_STATUS_SUCCESS - success, others - failure
120  */
121 QDF_STATUS dp_tx_desc_pool_init_be(struct dp_soc *soc,
122 				   uint16_t num_elem,
123 				   uint8_t pool_id);
124 /**
125  * dp_tx_desc_pool_deinit_be() - De-initialize Tx Descriptor pool(s)
126  * @soc: Handle to DP Soc structure
127  * @tx_desc_pool: Tx descriptor pool handler
128  * @pool_id: pool ID to deinit
129  *
130  * Return: None
131  */
132 void dp_tx_desc_pool_deinit_be(struct dp_soc *soc,
133 			       struct dp_tx_desc_pool_s *tx_desc_pool,
134 			       uint8_t pool_id);
135 
136 #ifdef WLAN_FEATURE_NEAR_FULL_IRQ
137 /**
138  * dp_tx_comp_nf_handler() - Tx completion ring Near full scenario handler
139  * @int_ctx: Interrupt context
140  * @soc: Datapath SoC handle
141  * @hal_ring_hdl: TX completion ring handle
142  * @ring_id: TX completion ring number
143  * @quota: Quota of the work to be done
144  *
145  * Return: work done
146  */
147 uint32_t dp_tx_comp_nf_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
148 			       hal_ring_handle_t hal_ring_hdl, uint8_t ring_id,
149 			       uint32_t quota);
150 #else
151 static inline
152 uint32_t dp_tx_comp_nf_handler(struct dp_intr *int_ctx, struct dp_soc *soc,
153 			       hal_ring_handle_t hal_ring_hdl, uint8_t ring_id,
154 			       uint32_t quota)
155 {
156 	return 0;
157 }
158 #endif /* WLAN_FEATURE_NEAR_FULL_IRQ */
159 #endif
160