1 /*
2 * Copyright (c) 2018-2019 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
20 /**
21 * DOC: This target interface shall be used by DP
22 * to communicate with target using WMI.
23 */
24
25 #ifndef _WLAN_TARGET_IF_DP_H_
26 #define _WLAN_TARGET_IF_DP_H_
27
28 #include <qdf_types.h>
29 #include <qdf_status.h>
30 #include <wmi_unified_priv.h>
31 #include <wlan_objmgr_psoc_obj.h>
32 #include <target_if.h>
33 #include <cdp_txrx_ops.h>
34 #include <wlan_cfg.h>
35
36 #define PEER_ROUTING_LMAC_ID_INDEX 6
37 #define PEER_ROUTING_LMAC_ID_BITS 2
38
39 /**
40 * struct reorder_q_setup - reorder queue setup params
41 * @psoc: psoc
42 * @vdev_id: vdev id
43 * @pdev_id: pdev id
44 * @peer_mac: peer mac address
45 * @hw_qdesc_paddr: hw queue descriptor
46 * @tid: tid number
47 * @queue_no: queue number
48 * @ba_window_size_valid: BA window size validity flag
49 * @ba_window_size: BA window size
50 */
51 struct reorder_q_setup {
52 struct cdp_ctrl_objmgr_psoc *psoc;
53 uint8_t vdev_id;
54 uint8_t pdev_id;
55 uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
56 qdf_dma_addr_t hw_qdesc_paddr;
57 uint8_t tid;
58 uint16_t queue_no;
59 uint8_t ba_window_size_valid;
60 uint16_t ba_window_size;
61 };
62
63 /**
64 * struct reorder_q_setup_list - Specific tid params for each tid
65 * @hw_qdesc_paddr: hw queue descriptor
66 * @queue_no: queue number
67 * @ba_window_size: BA window size
68 * @ba_window_size_valid: BA window size validity flag
69 */
70 struct reorder_q_setup_list {
71 qdf_dma_addr_t hw_qdesc_paddr;
72 uint16_t queue_no;
73 uint16_t ba_window_size;
74 uint8_t ba_window_size_valid;
75 };
76
77 /**
78 * struct multi_reorder_q_setup - multi reorder queue setup
79 * params for setting up TIDs at a time
80 * @q_setup_list: An array for recording the specific params for each tid
81 * @peer_mac: peer mac address
82 * @psoc: psoc
83 * @vdev_id: vdev id
84 * @pdev_id: pdev id
85 * @tid_num: Total number of TIDs to be set up
86 * @tid_bitmap: TIDs to be set up
87 */
88 struct multi_reorder_q_setup {
89 struct reorder_q_setup_list q_setup_list[DP_MAX_TIDS];
90 uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
91 struct cdp_ctrl_objmgr_psoc *psoc;
92 uint8_t vdev_id;
93 uint8_t pdev_id;
94 uint8_t tid_num;
95 uint32_t tid_bitmap;
96 };
97
98 /**
99 * target_if_get_active_mac_phy_number() - Get max MAC-PHY number enabled by
100 * target
101 * @psoc: psoc
102 *
103 * Get max active MAC-PHY number in all type of hw modes.
104 *
105 * return: active number of MAC-PHY pairs
106 */
107 uint32_t target_if_get_active_mac_phy_number(struct wlan_objmgr_psoc *psoc);
108
109 /**
110 * target_if_peer_set_default_routing() - set peer default routing
111 * @psoc: psoc pointer
112 * @pdev_id: pdev id
113 * @peer_macaddr: peer mac address
114 * @vdev_id: vdev id
115 * @hash_based: hash based routing
116 * @ring_num: ring number
117 * @lmac_peer_id_msb: lmac_peer_id_msb
118 *
119 * return: void
120 */
121 void
122 target_if_peer_set_default_routing(struct cdp_ctrl_objmgr_psoc *psoc,
123 uint8_t pdev_id,
124 uint8_t *peer_macaddr, uint8_t vdev_id,
125 bool hash_based, uint8_t ring_num,
126 uint8_t lmac_peer_id_msb);
127 /**
128 * target_if_peer_rx_reorder_queue_setup() - set up rx reorder queue
129 * @psoc: psoc pointer
130 * @pdev_id: pdev id
131 * @vdev_id: vdev id
132 * @peer_macaddr: peer mac address
133 * @hw_qdesc: hw queue descriptor
134 * @tid: tid number
135 * @queue_no: queue number
136 * @ba_window_size_valid: BA window size validity flag
137 * @ba_window_size: BA window size
138 *
139 * return: QDF_STATUS_SUCCESS for success or error code
140 */
141 QDF_STATUS
142 target_if_peer_rx_reorder_queue_setup(struct cdp_ctrl_objmgr_psoc *psoc,
143 uint8_t pdev_id,
144 uint8_t vdev_id, uint8_t *peer_macaddr,
145 qdf_dma_addr_t hw_qdesc, int tid,
146 uint16_t queue_no,
147 uint8_t ba_window_size_valid,
148 uint16_t ba_window_size);
149
150 /**
151 * target_if_peer_multi_rx_reorder_queue_setup() - set up multi rx reorder queue
152 * @psoc: psoc pointer
153 * @pdev_id: pdev id
154 * @tid_params: TIDs with their parameters to be set
155 *
156 * return: QDF_STATUS_SUCCESS for success or error code
157 */
158 QDF_STATUS
159 target_if_peer_multi_rx_reorder_queue_setup(
160 struct cdp_ctrl_objmgr_psoc *psoc,
161 uint8_t pdev_id,
162 struct multi_rx_reorder_queue_setup_params *tid_params);
163
164 /**
165 * target_if_peer_rx_reorder_queue_remove() - remove rx reorder queue
166 * @psoc: psoc pointer
167 * @pdev_id: pdev id
168 * @vdev_id: vdev id
169 * @peer_macaddr: peer mac address
170 * @peer_tid_bitmap: peer tid bitmap
171 *
172 * return: QDF_STATUS_SUCCESS for success or error code
173 */
174 QDF_STATUS
175 target_if_peer_rx_reorder_queue_remove(struct cdp_ctrl_objmgr_psoc *psoc,
176 uint8_t pdev_id,
177 uint8_t vdev_id, uint8_t *peer_macaddr,
178 uint32_t peer_tid_bitmap);
179
180 /**
181 * target_if_lro_hash_config() - send LRO hash config to FW
182 * @psoc: psoc pointer
183 * @pdev_id: pdev id
184 * @lro_hash_cfg: LRO hash config parameters
185 *
186 * return: QDF_STATUS_SUCCESS for success or error code
187 */
188 QDF_STATUS
189 target_if_lro_hash_config(struct cdp_ctrl_objmgr_psoc *psoc, uint8_t pdev_id,
190 struct cdp_lro_hash_config *lro_hash_cfg);
191
192 #ifdef WLAN_SUPPORT_PPEDS
193 /**
194 * target_if_peer_set_ppeds_default_routing() - Set PPE DS routing API
195 * @soc: psoc handle pointer
196 * @peer_macaddr: Peer MAC address
197 * @service_code: Service code
198 * @priority_valid: Priority valid field
199 * @src_info: Source information
200 * @vdev_id: VDEV ID
201 * @use_ppe: use ppe field value
202 * @ppe_routing_enabled: PPE routing enabled
203 *
204 * This API is used for setting PPE default routing configuration
205 *
206 * return: QDF_STATUS_SUCCESS for success or error code
207 */
208 QDF_STATUS
209 target_if_peer_set_ppeds_default_routing(struct cdp_ctrl_objmgr_psoc *soc,
210 uint8_t *peer_macaddr,
211 uint16_t service_code,
212 uint8_t priority_valid,
213 uint16_t src_info,
214 uint8_t vdev_id, uint8_t use_ppe,
215 uint8_t ppe_routing_enabled);
216 #endif
217
218 #ifdef WDS_CONV_TARGET_IF_OPS_ENABLE
219 /**
220 * target_if_add_wds_entry() - send wds peer add command to fw
221 * @soc: SoC handle
222 * @vdev_id: vdev_id
223 * @peer_mac: peer mac address
224 * @dest_mac: MAC address of ast node
225 * @flags: WDS entry type WMI_HOST_WDS_FLAG_STATIC for static entry
226 * @type: type from enum cdp_txrx_ast_entry_type
227 *
228 * This API is used by WDS source port learning function to
229 * add a new AST entry in the fw.
230 *
231 * return: QDF_STATUS_SUCCESS for success or error code
232 */
233 QDF_STATUS
234 target_if_add_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
235 uint8_t *peer_mac, const uint8_t *dest_mac,
236 uint32_t flags, uint8_t type);
237
238 /**
239 * target_if_del_wds_entry() - send wds peer del command to fw
240 * @soc: SoC handle
241 * @vdev_id: vdev_id
242 * @dest_mac: MAC address of ast node
243 * @type: type from enum cdp_txrx_ast_entry_type
244 * @delete_in_fw: flag to indicate if entry needs to be deleted in fw
245 *
246 * This API is used to delete an AST entry from fw
247 *
248 * Return: None
249 */
250 void
251 target_if_del_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
252 uint8_t *dest_mac, uint8_t type, uint8_t delete_in_fw);
253
254 /**
255 * target_if_update_wds_entry() - send wds peer update command to fw
256 * @soc: SoC handle
257 * @vdev_id: vdev_id
258 * @dest_mac: MAC address of ast node
259 * @peer_mac: peer mac address
260 * @flags: WDS entry type WMI_HOST_WDS_FLAG_STATIC for static entry
261 *
262 * This API is used by update the peer mac address for the ast
263 * in the fw.
264 *
265 * return: QDF_STATUS_SUCCESS for success or error code
266 */
267 QDF_STATUS
268 target_if_update_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
269 uint8_t *dest_mac, uint8_t *peer_mac,
270 uint32_t flags);
271 #else
272 static inline QDF_STATUS
target_if_add_wds_entry(struct cdp_ctrl_objmgr_psoc * soc,uint8_t vdev_id,uint8_t * peer_mac,const uint8_t * dest_mac,uint32_t flags,uint8_t type)273 target_if_add_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
274 uint8_t *peer_mac, const uint8_t *dest_mac,
275 uint32_t flags, uint8_t type)
276 {
277 return QDF_STATUS_SUCCESS;
278 }
279
280 static inline void
target_if_del_wds_entry(struct cdp_ctrl_objmgr_psoc * soc,uint8_t vdev_id,uint8_t * dest_mac,uint8_t type,uint8_t delete_in_fw)281 target_if_del_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
282 uint8_t *dest_mac, uint8_t type, uint8_t delete_in_fw)
283 {
284 }
285
286 static inline QDF_STATUS
target_if_update_wds_entry(struct cdp_ctrl_objmgr_psoc * soc,uint8_t vdev_id,uint8_t * dest_mac,uint8_t * peer_mac,uint32_t flags)287 target_if_update_wds_entry(struct cdp_ctrl_objmgr_psoc *soc, uint8_t vdev_id,
288 uint8_t *dest_mac, uint8_t *peer_mac,
289 uint32_t flags)
290 {
291 return QDF_STATUS_SUCCESS;
292 }
293 #endif /* FEATURE_MCL_REPEATER */
294
295 #ifdef WLAN_FEATURE_PEER_TXQ_FLUSH_CONF
296 /**
297 * target_if_peer_txq_flush_config() - Send flush command for pending frames
298 * @psoc: psoc handle pointer
299 * @vdev_id: VDEV id
300 * @mac: MAC addr of peer for which the tx queue flush is intended
301 * @ac: AC mask for identifying the tx queues to be flushed
302 * @tid: TID mask for identifying the tx queues to be flushed
303 * @policy: Defines the flush policy
304 *
305 * Return: 0 for success or error code
306 */
307 int target_if_peer_txq_flush_config(struct cdp_ctrl_objmgr_psoc *psoc,
308 uint8_t vdev_id, uint8_t *mac,
309 uint8_t ac, uint32_t tid, uint32_t policy);
310 #else
311 static inline int
target_if_peer_txq_flush_config(struct cdp_ctrl_objmgr_psoc * psoc,uint8_t vdev_id,uint8_t * mac,uint8_t ac,uint32_t tid,enum cdp_peer_txq_flush_policy policy)312 target_if_peer_txq_flush_config(struct cdp_ctrl_objmgr_psoc *psoc,
313 uint8_t vdev_id, uint8_t *mac,
314 uint8_t ac, uint32_t tid,
315 enum cdp_peer_txq_flush_policy policy)
316 {
317 return 0;
318 }
319 #endif /* WLAN_FEATURE_PEER_TXQ_FLUSH_CONF */
320 #endif /* _WLAN_TARGET_IF_DP_H_ */
321