xref: /wlan-driver/qca-wifi-host-cmn/dp/inc/cdp_txrx_cmn.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 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: cdp_txrx_cmn.h
22  * Define the host data path converged API functions
23  * called by the host control SW and the OS interface module
24  */
25 #ifndef _CDP_TXRX_CMN_H_
26 #define _CDP_TXRX_CMN_H_
27 
28 #include "qdf_types.h"
29 #include "qdf_nbuf.h"
30 #include "cdp_txrx_ops.h"
31 #include "cdp_txrx_handle.h"
32 #include "cdp_txrx_cmn_struct.h"
33 #include "wlan_objmgr_global_obj.h"
34 
35 #ifdef WLAN_SUPPORT_DPDK
36 #include <cfgmgr_api_if.h>
37 #include <dpdk_wlan_msg_types.h>
38 #endif
39 
40 #ifdef ENABLE_VERBOSE_DEBUG
41 extern bool is_dp_verbose_debug_enabled;
42 #endif
43 
44 /******************************************************************************
45  *
46  * Common Data Path Header File
47  *
48  *****************************************************************************/
49 #define dp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP, params)
50 #define dp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
51 #define dp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP, params)
52 #define dp_info(params...) \
53 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
54 #define dp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
55 
56 #ifdef DP_PRINT_NO_CONSOLE
57 #define dp_err_log(params...) \
58 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
59 #define dp_info_rl(params...) \
60 	__QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
61 #else
62 #define dp_err_log(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
63 #define dp_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_DP, params)
64 #endif /* DP_PRINT_NO_CONSOLE */
65 
66 #ifdef ENABLE_VERBOSE_DEBUG
67 /**
68  * enum verbose_debug_module -
69  * if INI "enable_verbose_debug" has to set following bit positions to enable
70  * respective module's excessive logging,
71  *
72  * @hif_verbose_debug_mask: 1st bit [0th index] is  for HIF module
73  * @hal_verbose_debug_mask: 2nd bit [1st index] is for HAL module
74  * @dp_verbose_debug_mask:  3rd bit [2nd index] is for DP module
75  */
76 enum verbose_debug_module {
77 	hif_verbose_debug_mask   = 1 << 0,
78 	hal_verbose_debug_mask   = 1 << 1,
79 	dp_verbose_debug_mask    = 1 << 2,
80 };
81 
82 /* legacy misspelled enumerator */
83 #define hif_vebose_debug_mask hif_verbose_debug_mask
84 
85 #define dp_verbose_debug(params...) \
86 		if (unlikely(is_dp_verbose_debug_enabled)) \
87 			do {\
88 				QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params); \
89 			} while (0)
90 #else
91 #define dp_verbose_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
92 #endif
93 
94 #define dp_nofl_alert(params...) \
95 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_DP, params)
96 #define dp_nofl_err(params...) \
97 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_DP, params)
98 #define dp_nofl_warn(params...) \
99 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_DP, params)
100 #define dp_nofl_info(params...) \
101 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_DP, params)
102 #define dp_nofl_debug(params...) \
103 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP, params)
104 
105 #define dp_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_DP, params)
106 #define dp_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP, params)
107 #define dp_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_DP, params)
108 #define dp_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_DP, params)
109 
110 #define dp_cdp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_CDP, params)
111 #define dp_cdp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_CDP, params)
112 #define dp_cdp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_CDP, params)
113 #define dp_cdp_info(params...) \
114 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_CDP, ## params)
115 #define dp_cdp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_CDP, params)
116 
117 #define dp_cdp_nofl_alert(params...) \
118 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_DP_CDP, params)
119 #define dp_cdp_nofl_err(params...) \
120 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_DP_CDP, params)
121 #define dp_cdp_nofl_warn(params...) \
122 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_DP_CDP, params)
123 #define dp_cdp_nofl_info(params...) \
124 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP_CDP, params)
125 #define dp_cdp_nofl_debug(params...) \
126 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP_CDP, params)
127 
128 #define DP_PEER_INFO_PARAMS_INIT(peer_info, _vdev_id, \
129 				_peer_mac, _addr_align, _peer_type) \
130 ({	typeof(peer_info) _peer_info = (peer_info); \
131 	do {								\
132 		(_peer_info)->vdev_id = (_vdev_id);			\
133 		(_peer_info)->mac_addr = (_peer_mac);			\
134 		(_peer_info)->mac_addr_is_aligned = (_addr_align);	\
135 		(_peer_info)->peer_type = (_peer_type);			\
136 	} while (0); })
137 
138 #ifdef WLAN_FEATURE_11BE_MLO
139 #define CDP_RX_ML_PEER_VALID_MASK  (0x00002000)
140 #define CDP_RX_ML_PEER_VALID_SHIFT (13)
141 #define CDP_RX_GET_ML_PEER_VALID(skb) \
142 	((QDF_NBUF_CB_RX_PEER_ID(skb) & \
143 	  CDP_RX_ML_PEER_VALID_MASK) >> CDP_RX_ML_PEER_VALID_SHIFT)
144 #endif
145 
146 /**
147  * enum vdev_host_stats_id -
148  * host stats update from CDP have to set one of the following stats ID
149  *
150  * @DP_VDEV_STATS_PKT_CNT_ONLY: update Tx packet count only
151  * @DP_VDEV_STATS_TX_ME: update Tx ingress stats
152  */
153 enum vdev_host_stats_id {
154 	DP_VDEV_STATS_PKT_CNT_ONLY,
155 	DP_VDEV_STATS_TX_ME,
156 };
157 
158 /*
159  * BW types used for RX PPDU
160  */
161 enum rx_tlv_bw {
162 	RX_TLV_BW_20MHZ,
163 	RX_TLV_BW_40MHZ,
164 	RX_TLV_BW_80MHZ,
165 	RX_TLV_BW_160MHZ,
166 	RX_TLV_BW_320MHZ,
167 	RX_TLV_BW_240MHZ,
168 	RX_TLV_BW_CNT,
169 };
170 
171 /**
172  * typedef ipa_uc_op_cb_type() - Register OP handler function
173  * @op_msg: message
174  * @osif_ctxt: OSIF context
175  */
176 typedef void (*ipa_uc_op_cb_type)(uint8_t *op_msg,
177 				  void *osif_ctxt);
178 
179 #ifdef QCA_SUPPORT_DP_GLOBAL_CTX
180 /* Global level structure for win contexts */
181 struct dp_global_context {
182 	struct dp_rx_fst *fst_ctx;
183 	struct dp_tx_desc_pool_s *tx_desc[2][4];
184 	struct dp_hw_cookie_conversion_t *tx_cc_ctx[4];
185 	struct dp_tx_desc_pool_s *spcl_tx_desc[2][4];
186 	struct dp_hw_cookie_conversion_t *spcl_tx_cc_ctx[4];
187 	qdf_atomic_t rx_fst_ref_cnt;
188 	qdf_atomic_t global_descriptor_in_use;
189 	int tx_cookie_ctx_alloc_cnt;
190 	int tx_desc_pool_alloc_cnt[2];
191 	int tx_desc_pool_init_cnt[2];
192 	int spcl_tx_cookie_ctx_alloc_cnt;
193 	int spcl_tx_desc_pool_alloc_cnt[2];
194 	int spcl_tx_desc_pool_init_cnt[2];
195 };
196 
197 /**
198  * cdp_global_ctx_init() - to initialise global context for tx descriptors
199  *
200  * Return: QDF_STATUS on success
201  */
cdp_global_ctx_init(void)202 static inline QDF_STATUS cdp_global_ctx_init(void)
203 {
204 	struct dp_global_context *dp_global;
205 	QDF_STATUS status = QDF_STATUS_SUCCESS;
206 
207 	if (wlan_objmgr_get_global_ctx()) {
208 		dp_err("Global object is already created");
209 		return QDF_STATUS_SUCCESS;
210 	}
211 
212 	dp_global =  (struct dp_global_context *)
213 			qdf_mem_malloc(sizeof(*dp_global));
214 
215 	if (!dp_global)
216 		return QDF_STATUS_E_FAILURE;
217 
218 	qdf_mem_zero(dp_global, sizeof(*dp_global));
219 	wlan_objmgr_set_global_ctx(dp_global);
220 	qdf_atomic_set(&dp_global->global_descriptor_in_use, 0);
221 	dp_global->fst_ctx = NULL;
222 	qdf_atomic_set(&dp_global->rx_fst_ref_cnt, 0);
223 
224 	return status;
225 }
226 
227 /**
228  * cdp_global_ctx_deinit() - to deinitialise global context for tx descriptors
229  *
230  * Return: SUCCESS status on success
231  */
cdp_global_ctx_deinit(void)232 static inline QDF_STATUS cdp_global_ctx_deinit(void)
233 {
234 	struct dp_global_context *dp_global = wlan_objmgr_get_global_ctx();
235 	QDF_STATUS status = QDF_STATUS_SUCCESS;
236 
237 	if (!dp_global)
238 		return QDF_STATUS_SUCCESS;
239 
240 	qdf_mem_free(dp_global);
241 	wlan_objmgr_set_global_ctx(NULL);
242 
243 	return status;
244 }
245 #else
cdp_global_ctx_init(void)246 static inline QDF_STATUS cdp_global_ctx_init(void)
247 {
248 	return QDF_STATUS_SUCCESS;
249 }
250 
cdp_global_ctx_deinit(void)251 static inline QDF_STATUS cdp_global_ctx_deinit(void)
252 {
253 	return QDF_STATUS_SUCCESS;
254 }
255 #endif
256 
257 static inline QDF_STATUS
cdp_soc_attach_target(ol_txrx_soc_handle soc)258 cdp_soc_attach_target(ol_txrx_soc_handle soc)
259 {
260 	if (!soc || !soc->ops) {
261 		dp_cdp_debug("Invalid Instance:");
262 		QDF_BUG(0);
263 		return QDF_STATUS_E_INVAL;
264 	}
265 
266 	if (!soc->ops->cmn_drv_ops ||
267 	    !soc->ops->cmn_drv_ops->txrx_soc_attach_target)
268 		return QDF_STATUS_SUCCESS;
269 
270 	return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc);
271 
272 }
273 
274 static inline QDF_STATUS
cdp_vdev_attach(ol_txrx_soc_handle soc,uint8_t pdev_id,struct cdp_vdev_info * vdev_info)275 cdp_vdev_attach(ol_txrx_soc_handle soc, uint8_t pdev_id,
276 		struct cdp_vdev_info *vdev_info)
277 {
278 	if (!soc || !soc->ops) {
279 		dp_cdp_debug("Invalid Instance:");
280 		QDF_BUG(0);
281 		return QDF_STATUS_E_FAILURE;
282 	}
283 
284 	if (!soc->ops->cmn_drv_ops ||
285 	    !soc->ops->cmn_drv_ops->txrx_vdev_attach)
286 		return QDF_STATUS_E_FAILURE;
287 
288 	return soc->ops->cmn_drv_ops->txrx_vdev_attach(soc, pdev_id, vdev_info);
289 }
290 
291 #ifdef DP_FLOW_CTL
292 /**
293  * cdp_flow_pool_map() - Create flow pool for vdev
294  * @soc: data path soc handle
295  * @pdev_id: id of dp pdev handle
296  * @vdev_id: vdev_id corresponding to vdev start
297  *
298  * Create per vdev flow pool.
299  *
300  * Return: QDF_STATUS
301  */
cdp_flow_pool_map(ol_txrx_soc_handle soc,uint8_t pdev_id,uint8_t vdev_id)302 static inline QDF_STATUS cdp_flow_pool_map(ol_txrx_soc_handle soc,
303 					   uint8_t pdev_id, uint8_t vdev_id)
304 {
305 	if (!soc || !soc->ops) {
306 		dp_cdp_debug("Invalid Instance:");
307 		QDF_BUG(0);
308 		return QDF_STATUS_E_INVAL;
309 	}
310 
311 	if (!soc->ops->flowctl_ops ||
312 	    !soc->ops->flowctl_ops->flow_pool_map_handler)
313 		return QDF_STATUS_E_INVAL;
314 
315 	return soc->ops->flowctl_ops->flow_pool_map_handler(soc, pdev_id,
316 							    vdev_id);
317 }
318 
319 /**
320  * cdp_flow_pool_unmap() - Delete flow pool
321  * @soc: data path soc handle
322  * @pdev_id: id of dp pdev handle
323  * @vdev_id: vdev_id corresponding to vdev start
324  *
325  * Delete flow pool
326  *
327  * Return: none
328  */
cdp_flow_pool_unmap(ol_txrx_soc_handle soc,uint8_t pdev_id,uint8_t vdev_id)329 static inline void cdp_flow_pool_unmap(ol_txrx_soc_handle soc,
330 				       uint8_t pdev_id, uint8_t vdev_id)
331 {
332 	if (!soc || !soc->ops) {
333 		dp_cdp_debug("Invalid Instance:");
334 		QDF_BUG(0);
335 		return;
336 	}
337 
338 	if (!soc->ops->flowctl_ops ||
339 	    !soc->ops->flowctl_ops->flow_pool_unmap_handler)
340 		return;
341 
342 	return soc->ops->flowctl_ops->flow_pool_unmap_handler(soc, pdev_id,
343 							vdev_id);
344 }
345 #endif
346 
347 static inline QDF_STATUS
cdp_vdev_detach(ol_txrx_soc_handle soc,uint8_t vdev_id,ol_txrx_vdev_delete_cb callback,void * cb_context)348 cdp_vdev_detach(ol_txrx_soc_handle soc, uint8_t vdev_id,
349 		ol_txrx_vdev_delete_cb callback, void *cb_context)
350 {
351 	if (!soc || !soc->ops) {
352 		dp_cdp_debug("Invalid Instance:");
353 		QDF_BUG(0);
354 		return QDF_STATUS_E_FAILURE;
355 	}
356 
357 	if (!soc->ops->cmn_drv_ops ||
358 	    !soc->ops->cmn_drv_ops->txrx_vdev_detach)
359 		return QDF_STATUS_E_FAILURE;
360 
361 	return soc->ops->cmn_drv_ops->txrx_vdev_detach(soc, vdev_id,
362 						       callback, cb_context);
363 }
364 
365 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
366 static inline void
cdp_vdev_recovery_flush_peers(ol_txrx_soc_handle soc,uint8_t vdev_id,bool mlo_peers_only)367 cdp_vdev_recovery_flush_peers(ol_txrx_soc_handle soc,
368 			      uint8_t vdev_id,
369 			      bool mlo_peers_only)
370 {
371 	if (!soc || !soc->ops) {
372 		dp_cdp_debug("Invalid Instance:");
373 		QDF_BUG(0);
374 		return;
375 	}
376 
377 	if (!soc->ops->cmn_drv_ops ||
378 	    !soc->ops->cmn_drv_ops->txrx_recovery_vdev_flush_peers)
379 		return;
380 
381 	soc->ops->cmn_drv_ops->txrx_recovery_vdev_flush_peers(soc,
382 							      vdev_id,
383 							      mlo_peers_only);
384 }
385 #endif
386 
387 static inline int
cdp_pdev_attach_target(ol_txrx_soc_handle soc,uint8_t pdev_id)388 cdp_pdev_attach_target(ol_txrx_soc_handle soc, uint8_t pdev_id)
389 {
390 	if (!soc || !soc->ops) {
391 		dp_cdp_debug("Invalid Instance:");
392 		QDF_BUG(0);
393 		return 0;
394 	}
395 
396 	if (!soc->ops->cmn_drv_ops ||
397 	    !soc->ops->cmn_drv_ops->txrx_pdev_attach_target)
398 		return 0;
399 
400 	return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(soc, pdev_id);
401 }
402 
cdp_pdev_attach(ol_txrx_soc_handle soc,struct cdp_pdev_attach_params * params)403 static inline QDF_STATUS cdp_pdev_attach
404 	(ol_txrx_soc_handle soc, struct cdp_pdev_attach_params *params)
405 {
406 	if (!soc || !soc->ops) {
407 		dp_cdp_debug("Invalid Instance:");
408 		QDF_BUG(0);
409 		return QDF_STATUS_E_FAILURE;
410 	}
411 
412 	if (!soc->ops->cmn_drv_ops ||
413 	    !soc->ops->cmn_drv_ops->txrx_pdev_attach)
414 		return QDF_STATUS_E_FAILURE;
415 
416 	return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, params);
417 }
418 
419 /**
420  * cdp_pdev_post_attach() - attach the data SW state
421  * @soc: datapath soc handle
422  * @pdev_id: the data physical device id being removed
423  *
424  * This function is used when the WLAN driver is being loaded to
425  * attach the host data component within the driver.
426  *
427  * Return: 0 for success or error code
428  */
cdp_pdev_post_attach(ol_txrx_soc_handle soc,uint8_t pdev_id)429 static inline int cdp_pdev_post_attach(ol_txrx_soc_handle soc, uint8_t pdev_id)
430 {
431 	if (!soc || !soc->ops) {
432 		dp_cdp_debug("Invalid Instance:");
433 		QDF_BUG(0);
434 		return 0;
435 	}
436 
437 	if (!soc->ops->cmn_drv_ops ||
438 	    !soc->ops->cmn_drv_ops->txrx_pdev_post_attach)
439 		return 0;
440 
441 	return soc->ops->cmn_drv_ops->txrx_pdev_post_attach(soc, pdev_id);
442 }
443 
444 /**
445  * cdp_pdev_pre_detach() - detach the data SW state
446  * @soc: datapath soc handle
447  * @pdev_id: the data physical device id being removed
448  * @force: delete the pdev (and its vdevs and peers) even if
449  * there are outstanding references by the target to the vdevs
450  * and peers within the pdev
451  *
452  * This function is used when the WLAN driver is being removed to
453  * detach the host data component within the driver.
454  *
455  * Return: None
456  */
457 static inline void
cdp_pdev_pre_detach(ol_txrx_soc_handle soc,uint8_t pdev_id,int force)458 cdp_pdev_pre_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
459 {
460 	if (!soc || !soc->ops) {
461 		dp_cdp_debug("Invalid Instance:");
462 		QDF_BUG(0);
463 		return;
464 	}
465 
466 	if (!soc->ops->cmn_drv_ops ||
467 	    !soc->ops->cmn_drv_ops->txrx_pdev_pre_detach)
468 		return;
469 
470 	soc->ops->cmn_drv_ops->txrx_pdev_pre_detach(soc, pdev_id, force);
471 }
472 
473 static inline QDF_STATUS
cdp_pdev_detach(ol_txrx_soc_handle soc,uint8_t pdev_id,int force)474 cdp_pdev_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
475 {
476 	if (!soc || !soc->ops) {
477 		dp_cdp_debug("Invalid Instance:");
478 		QDF_BUG(0);
479 		return QDF_STATUS_E_FAILURE;
480 	}
481 
482 	if (!soc->ops->cmn_drv_ops ||
483 	    !soc->ops->cmn_drv_ops->txrx_pdev_detach)
484 		return QDF_STATUS_E_FAILURE;
485 
486 	return soc->ops->cmn_drv_ops->txrx_pdev_detach(soc, pdev_id, force);
487 }
488 
489 static inline void
cdp_pdev_deinit(ol_txrx_soc_handle soc,uint8_t pdev_id,int force)490 cdp_pdev_deinit(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
491 {
492 	if (!soc || !soc->ops) {
493 		dp_cdp_debug("Invalid Instance:");
494 		QDF_BUG(0);
495 		return;
496 	}
497 
498 	if (!soc->ops->cmn_drv_ops ||
499 	    !soc->ops->cmn_drv_ops->txrx_pdev_deinit)
500 		return;
501 
502 	soc->ops->cmn_drv_ops->txrx_pdev_deinit(soc, pdev_id, force);
503 }
504 
cdp_peer_create(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac_addr)505 static inline QDF_STATUS cdp_peer_create
506 	(ol_txrx_soc_handle soc, uint8_t vdev_id,
507 	uint8_t *peer_mac_addr)
508 {
509 	if (!soc || !soc->ops) {
510 		dp_cdp_debug("Invalid Instance:");
511 		QDF_BUG(0);
512 		return QDF_STATUS_E_FAILURE;
513 	}
514 
515 	if (!soc->ops->cmn_drv_ops ||
516 	    !soc->ops->cmn_drv_ops->txrx_peer_create)
517 		return QDF_STATUS_E_FAILURE;
518 
519 	return soc->ops->cmn_drv_ops->txrx_peer_create(soc, vdev_id,
520 			peer_mac_addr, CDP_LINK_PEER_TYPE);
521 }
522 
cdp_peer_setup(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,struct cdp_peer_setup_info * setup_info)523 static inline  QDF_STATUS cdp_peer_setup
524 	(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
525 	 struct cdp_peer_setup_info *setup_info)
526 {
527 	if (!soc || !soc->ops) {
528 		dp_cdp_debug("Invalid Instance:");
529 		QDF_BUG(0);
530 		return  QDF_STATUS_E_FAILURE;
531 	}
532 
533 	if (!soc->ops->cmn_drv_ops ||
534 	    !soc->ops->cmn_drv_ops->txrx_peer_setup)
535 		return QDF_STATUS_E_FAILURE;
536 
537 	return soc->ops->cmn_drv_ops->txrx_peer_setup(soc, vdev_id,
538 						      peer_mac, setup_info);
539 }
540 
541 /**
542  * cdp_cp_peer_del_response() - Call the peer delete response handler
543  * @soc: Datapath SOC handle
544  * @vdev_id: id of virtual device object
545  * @peer_mac_addr: Mac address of the peer
546  *
547  * Return: void
548  */
cdp_cp_peer_del_response(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac_addr)549 static inline QDF_STATUS cdp_cp_peer_del_response
550 	(ol_txrx_soc_handle soc,
551 	 uint8_t vdev_id,
552 	 uint8_t *peer_mac_addr)
553 {
554 	if (!soc || !soc->ops) {
555 		dp_cdp_debug("Invalid Instance:");
556 		QDF_BUG(0);
557 		return QDF_STATUS_E_FAILURE;
558 	}
559 
560 	if (!soc->ops->cmn_drv_ops ||
561 	    !soc->ops->cmn_drv_ops->txrx_cp_peer_del_response)
562 		return QDF_STATUS_E_FAILURE;
563 
564 	return soc->ops->cmn_drv_ops->txrx_cp_peer_del_response(soc,
565 								vdev_id,
566 								peer_mac_addr);
567 }
568 /**
569  * cdp_peer_get_ast_info_by_soc() - search the soc AST hash table
570  *                                  and return ast entry information
571  *                                  of first ast entry found in the
572  *                                  table with given mac address
573  *
574  * @soc: data path soc handle
575  * @ast_mac_addr: AST entry mac address
576  * @ast_entry_info: ast entry information
577  *
578  * return: true if ast entry found with ast_mac_addr
579  *          false if ast entry not found
580  */
cdp_peer_get_ast_info_by_soc(ol_txrx_soc_handle soc,uint8_t * ast_mac_addr,struct cdp_ast_entry_info * ast_entry_info)581 static inline bool cdp_peer_get_ast_info_by_soc
582 	(ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
583 	 struct cdp_ast_entry_info *ast_entry_info)
584 {
585 	if (!soc || !soc->ops) {
586 		dp_cdp_debug("Invalid Instance:");
587 		QDF_BUG(0);
588 		return false;
589 	}
590 
591 	if (!soc->ops->cmn_drv_ops ||
592 	    !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc)
593 		return false;
594 
595 	return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc
596 					(soc, ast_mac_addr,
597 					 ast_entry_info);
598 }
599 
600 /**
601  * cdp_peer_get_ast_info_by_pdev() - search the soc AST hash table
602  *                                   and return ast entry information
603  *                                   if mac address and pdev_id matches
604  *
605  * @soc: data path soc handle
606  * @ast_mac_addr: AST entry mac address
607  * @pdev_id: pdev_id
608  * @ast_entry_info: ast entry information
609  *
610  * return: true if ast entry found with ast_mac_addr
611  *          false if ast entry not found
612  */
cdp_peer_get_ast_info_by_pdev(ol_txrx_soc_handle soc,uint8_t * ast_mac_addr,uint8_t pdev_id,struct cdp_ast_entry_info * ast_entry_info)613 static inline bool cdp_peer_get_ast_info_by_pdev
614 	(ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
615 	 uint8_t pdev_id,
616 	 struct cdp_ast_entry_info *ast_entry_info)
617 {
618 	if (!soc || !soc->ops) {
619 		dp_cdp_debug("Invalid Instance:");
620 		QDF_BUG(0);
621 		return false;
622 	}
623 
624 	if (!soc->ops->cmn_drv_ops ||
625 	    !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev)
626 		return false;
627 
628 	return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev
629 					(soc,
630 					 ast_mac_addr,
631 					 pdev_id,
632 					 ast_entry_info);
633 }
634 
635 /**
636  * cdp_peer_ast_delete_by_soc() - delete the ast entry from soc AST hash table
637  *                                with given mac address
638  *
639  * @soc: data path soc handle
640  * @ast_mac_addr: AST entry mac address
641  * @callback: callback function to called on ast delete response from FW
642  * @cookie: argument to be passed to callback
643  *
644  * return: QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
645  *          is sent
646  *          QDF_STATUS_E_INVAL false if ast entry not found
647  */
cdp_peer_ast_delete_by_soc(ol_txrx_soc_handle soc,uint8_t * ast_mac_addr,txrx_ast_free_cb callback,void * cookie)648 static inline QDF_STATUS cdp_peer_ast_delete_by_soc
649 	(ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
650 	 txrx_ast_free_cb callback,
651 	 void *cookie)
652 {
653 	if (!soc || !soc->ops) {
654 		dp_cdp_debug("Invalid Instance:");
655 		QDF_BUG(0);
656 		return QDF_STATUS_E_INVAL;
657 	}
658 
659 	if (!soc->ops->cmn_drv_ops ||
660 	    !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc)
661 		return QDF_STATUS_E_INVAL;
662 
663 	return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc
664 							(soc,
665 							 ast_mac_addr,
666 							 callback,
667 							 cookie);
668 }
669 
670 /**
671  * cdp_peer_ast_delete_by_pdev() - delete the ast entry from soc AST hash table
672  *                                 if mac address and pdev_id matches
673  *
674  * @soc: data path soc handle
675  * @ast_mac_addr: AST entry mac address
676  * @pdev_id: pdev id
677  * @callback: callback function to called on ast delete response from FW
678  * @cookie: argument to be passed to callback
679  *
680  * return: QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
681  *          is sent
682  *          QDF_STATUS_E_INVAL false if ast entry not found
683  */
cdp_peer_ast_delete_by_pdev(ol_txrx_soc_handle soc,uint8_t * ast_mac_addr,uint8_t pdev_id,txrx_ast_free_cb callback,void * cookie)684 static inline QDF_STATUS cdp_peer_ast_delete_by_pdev
685 	(ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
686 	 uint8_t pdev_id, txrx_ast_free_cb callback,
687 	 void *cookie)
688 {
689 	if (!soc || !soc->ops) {
690 		dp_cdp_debug("Invalid Instance:");
691 		QDF_BUG(0);
692 		return QDF_STATUS_E_INVAL;
693 	}
694 
695 	if (!soc->ops->cmn_drv_ops ||
696 	    !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev)
697 		return QDF_STATUS_E_INVAL;
698 
699 	return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev
700 					(soc,
701 					 ast_mac_addr,
702 					 pdev_id,
703 					 callback,
704 					 cookie);
705 }
706 
707 /**
708  * cdp_peer_HMWDS_ast_delete() - delete the ast entry from soc AST hash table
709  *                               for HMWDS rem-addr command
710  *
711  * @soc: data path soc handle
712  * @vdev_id: vdev id
713  * @dest_mac: AST entry mac address to delete
714  * @type: cdp_txrx_ast_entry_type to send to FW
715  * @delete_in_fw: flag to indicate AST entry deletion in FW
716  *
717  * Return: QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
718  *         is sent
719  *         QDF_STATUS_E_INVAL false if ast entry not found
720  */
cdp_peer_HMWDS_ast_delete(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * dest_mac,uint8_t type,uint8_t delete_in_fw)721 static inline QDF_STATUS cdp_peer_HMWDS_ast_delete
722 	(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *dest_mac,
723 	 uint8_t type, uint8_t delete_in_fw)
724 {
725 	if (!soc || !soc->ops) {
726 		dp_cdp_debug("Invalid Instance:");
727 		QDF_BUG(0);
728 		return QDF_STATUS_E_INVAL;
729 	}
730 
731 	if (!soc->ops->cmn_drv_ops ||
732 	    !soc->ops->cmn_drv_ops->txrx_peer_HMWDS_ast_delete)
733 		return QDF_STATUS_E_INVAL;
734 
735 	return soc->ops->cmn_drv_ops->txrx_peer_HMWDS_ast_delete
736 					(soc,
737 					 vdev_id,
738 					 dest_mac,
739 					 type,
740 					 delete_in_fw);
741 }
742 
cdp_peer_add_ast(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,uint8_t * mac_addr,enum cdp_txrx_ast_entry_type type,uint32_t flags)743 static inline int cdp_peer_add_ast
744 	(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
745 	uint8_t *mac_addr,
746 	enum cdp_txrx_ast_entry_type type, uint32_t flags)
747 {
748 	if (!soc || !soc->ops) {
749 		dp_cdp_debug("Invalid Instance:");
750 		QDF_BUG(0);
751 		return 0;
752 	}
753 
754 	if (!soc->ops->cmn_drv_ops ||
755 	    !soc->ops->cmn_drv_ops->txrx_peer_add_ast)
756 		return 0;
757 
758 	return soc->ops->cmn_drv_ops->txrx_peer_add_ast(soc,
759 							vdev_id,
760 							peer_mac,
761 							mac_addr,
762 							type,
763 							flags);
764 }
765 
cdp_peer_reset_ast(ol_txrx_soc_handle soc,uint8_t * wds_macaddr,uint8_t * peer_macaddr,uint8_t vdev_id)766 static inline QDF_STATUS cdp_peer_reset_ast
767 	(ol_txrx_soc_handle soc, uint8_t *wds_macaddr, uint8_t *peer_macaddr,
768 	 uint8_t vdev_id)
769 {
770 
771 	if (!soc || !soc->ops) {
772 		dp_cdp_debug("Invalid Instance:");
773 		QDF_BUG(0);
774 		return QDF_STATUS_E_FAILURE;
775 	}
776 	if (!soc->ops->cmn_drv_ops ||
777 	    !soc->ops->cmn_drv_ops->txrx_peer_reset_ast)
778 		return QDF_STATUS_E_FAILURE;
779 
780 	return soc->ops->cmn_drv_ops->txrx_peer_reset_ast(soc, wds_macaddr,
781 						   peer_macaddr, vdev_id);
782 }
783 
cdp_peer_reset_ast_table(ol_txrx_soc_handle soc,uint8_t vdev_id)784 static inline QDF_STATUS cdp_peer_reset_ast_table
785 	(ol_txrx_soc_handle soc, uint8_t vdev_id)
786 {
787 	if (!soc || !soc->ops) {
788 		dp_cdp_debug("Invalid Instance:");
789 		QDF_BUG(0);
790 		return QDF_STATUS_E_FAILURE;
791 	}
792 
793 	if (!soc->ops->cmn_drv_ops ||
794 	    !soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table)
795 		return QDF_STATUS_E_FAILURE;
796 
797 	return soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table(soc, vdev_id);
798 }
799 
cdp_peer_flush_ast_table(ol_txrx_soc_handle soc)800 static inline void cdp_peer_flush_ast_table
801 	(ol_txrx_soc_handle soc)
802 {
803 	if (!soc || !soc->ops) {
804 		dp_cdp_debug("Invalid Instance:");
805 		QDF_BUG(0);
806 		return;
807 	}
808 
809 	if (!soc->ops->cmn_drv_ops ||
810 	    !soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table)
811 		return;
812 
813 	soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table(soc);
814 }
815 
cdp_peer_update_ast(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,uint8_t * wds_macaddr,uint32_t flags)816 static inline int cdp_peer_update_ast
817 	(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
818 	 uint8_t *wds_macaddr, uint32_t flags)
819 {
820 	if (!soc || !soc->ops) {
821 		dp_cdp_debug("Invalid Instance:");
822 		QDF_BUG(0);
823 		return 0;
824 	}
825 
826 	if (!soc->ops->cmn_drv_ops ||
827 	    !soc->ops->cmn_drv_ops->txrx_peer_update_ast)
828 		return 0;
829 
830 
831 	return soc->ops->cmn_drv_ops->txrx_peer_update_ast(soc,
832 							vdev_id,
833 							peer_mac,
834 							wds_macaddr,
835 							flags);
836 }
837 
cdp_peer_teardown(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac)838 static inline void cdp_peer_teardown
839 	(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac)
840 {
841 	if (!soc || !soc->ops) {
842 		dp_cdp_debug("Invalid Instance:");
843 		QDF_BUG(0);
844 		return;
845 	}
846 
847 	if (!soc->ops->cmn_drv_ops ||
848 	    !soc->ops->cmn_drv_ops->txrx_peer_teardown)
849 		return;
850 
851 	soc->ops->cmn_drv_ops->txrx_peer_teardown(soc, vdev_id, peer_mac);
852 }
853 
854 static inline void
cdp_peer_delete(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,uint32_t bitmap)855 cdp_peer_delete(ol_txrx_soc_handle soc, uint8_t vdev_id,
856 		uint8_t *peer_mac, uint32_t bitmap)
857 {
858 	if (!soc || !soc->ops) {
859 		dp_cdp_debug("Invalid Instance:");
860 		QDF_BUG(0);
861 		return;
862 	}
863 
864 	if (!soc->ops->cmn_drv_ops ||
865 	    !soc->ops->cmn_drv_ops->txrx_peer_delete)
866 		return;
867 
868 	soc->ops->cmn_drv_ops->txrx_peer_delete(soc, vdev_id, peer_mac,
869 						bitmap, CDP_LINK_PEER_TYPE);
870 }
871 
872 #ifdef DP_RX_UDP_OVER_PEER_ROAM
873 static inline void
cdp_update_roaming_peer_in_vdev(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,uint32_t auth_status)874 cdp_update_roaming_peer_in_vdev(ol_txrx_soc_handle soc, uint8_t vdev_id,
875 				uint8_t *peer_mac, uint32_t auth_status)
876 {
877 	if (!soc || !soc->ops) {
878 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
879 			  "%s: Invalid Instance:", __func__);
880 		QDF_BUG(0);
881 		return;
882 	}
883 
884 	if (!soc->ops->cmn_drv_ops ||
885 	    !soc->ops->cmn_drv_ops->txrx_update_roaming_peer)
886 		return;
887 
888 	soc->ops->cmn_drv_ops->txrx_update_roaming_peer(soc, vdev_id,
889 							peer_mac, auth_status);
890 }
891 #else
892 static inline void
cdp_update_roaming_peer_in_vdev(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,uint32_t auth_status)893 cdp_update_roaming_peer_in_vdev(ol_txrx_soc_handle soc, uint8_t vdev_id,
894 				uint8_t *peer_mac, uint32_t auth_status)
895 {
896 }
897 #endif
898 /**
899  * cdp_peer_delete_sync() - peer delete sync callback
900  * @soc: datapath soc handle
901  * @vdev_id: virtual device/interface id
902  * @peer_mac: peer mac address
903  * @delete_cb: peer delete sync cb.
904  * @bitmap: bitmap indicating special handling of request.
905  *
906  * Return: None
907  */
908 static inline void
cdp_peer_delete_sync(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,QDF_STATUS (* delete_cb)(uint8_t vdev_id,uint32_t peerid_cnt,uint16_t * peerid_list),uint32_t bitmap)909 cdp_peer_delete_sync(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
910 		     QDF_STATUS(*delete_cb)(
911 				uint8_t vdev_id,
912 				uint32_t peerid_cnt,
913 				uint16_t *peerid_list),
914 		     uint32_t bitmap)
915 {
916 	if (!soc || !soc->ops) {
917 		dp_cdp_debug("Invalid Instance:");
918 		QDF_BUG(0);
919 		return;
920 	}
921 
922 	if (!soc->ops->cmn_drv_ops ||
923 	    !soc->ops->cmn_drv_ops->txrx_peer_delete_sync)
924 		return;
925 
926 	soc->ops->cmn_drv_ops->txrx_peer_delete_sync(soc, vdev_id, peer_mac,
927 						     delete_cb,
928 						     bitmap);
929 }
930 
931 static inline int
cdp_set_monitor_mode(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t smart_monitor)932 cdp_set_monitor_mode(ol_txrx_soc_handle soc, uint8_t vdev_id,
933 		     uint8_t smart_monitor)
934 {
935 	if (!soc || !soc->ops) {
936 		dp_cdp_debug("Invalid Instance:");
937 		QDF_BUG(0);
938 		return 0;
939 	}
940 
941 	if (!soc->ops->cmn_drv_ops ||
942 	    !soc->ops->cmn_drv_ops->txrx_set_monitor_mode)
943 		return 0;
944 
945 	return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(soc, vdev_id,
946 					smart_monitor);
947 }
948 
949 static inline QDF_STATUS
cdp_set_curchan(ol_txrx_soc_handle soc,uint8_t pdev_id,uint32_t chan_mhz)950 cdp_set_curchan(ol_txrx_soc_handle soc,
951 	uint8_t pdev_id,
952 	uint32_t chan_mhz)
953 {
954 	if (!soc || !soc->ops) {
955 		dp_cdp_debug("Invalid Instance:");
956 		QDF_BUG(0);
957 		return QDF_STATUS_E_FAILURE;
958 	}
959 
960 	if (!soc->ops->cmn_drv_ops ||
961 	    !soc->ops->cmn_drv_ops->txrx_set_curchan)
962 		return QDF_STATUS_E_FAILURE;
963 
964 	return soc->ops->cmn_drv_ops->txrx_set_curchan(soc, pdev_id, chan_mhz);
965 }
966 
967 static inline QDF_STATUS
cdp_set_privacy_filters(ol_txrx_soc_handle soc,uint8_t vdev_id,void * filter,uint32_t num)968 cdp_set_privacy_filters(ol_txrx_soc_handle soc, uint8_t vdev_id,
969 			void *filter, uint32_t num)
970 {
971 	if (!soc || !soc->ops) {
972 		dp_cdp_debug("Invalid Instance:");
973 		QDF_BUG(0);
974 		return QDF_STATUS_E_FAILURE;
975 	}
976 
977 	if (!soc->ops->cmn_drv_ops ||
978 	    !soc->ops->cmn_drv_ops->txrx_set_privacy_filters)
979 		return QDF_STATUS_E_FAILURE;
980 
981 	return soc->ops->cmn_drv_ops->txrx_set_privacy_filters(soc, vdev_id,
982 			filter, num);
983 }
984 
985 static inline int
cdp_set_monitor_filter(ol_txrx_soc_handle soc,uint8_t pdev_id,struct cdp_monitor_filter * filter_val)986 cdp_set_monitor_filter(ol_txrx_soc_handle soc, uint8_t pdev_id,
987 		       struct cdp_monitor_filter *filter_val)
988 {
989 	if (soc->ops->mon_ops->txrx_set_advance_monitor_filter)
990 		return soc->ops->mon_ops->txrx_set_advance_monitor_filter(soc,
991 								pdev_id,
992 								filter_val);
993 	return 0;
994 }
995 
996 
997 /******************************************************************************
998  * Data Interface (B Interface)
999  *****************************************************************************/
1000 static inline void
cdp_vdev_register(ol_txrx_soc_handle soc,uint8_t vdev_id,ol_osif_vdev_handle osif_vdev,struct ol_txrx_ops * txrx_ops)1001 cdp_vdev_register(ol_txrx_soc_handle soc, uint8_t vdev_id,
1002 		  ol_osif_vdev_handle osif_vdev,
1003 		  struct ol_txrx_ops *txrx_ops)
1004 {
1005 	if (!soc || !soc->ops) {
1006 		dp_cdp_debug("Invalid Instance:");
1007 		QDF_BUG(0);
1008 		return;
1009 	}
1010 
1011 	if (!soc->ops->cmn_drv_ops ||
1012 	    !soc->ops->cmn_drv_ops->txrx_vdev_register)
1013 		return;
1014 
1015 	soc->ops->cmn_drv_ops->txrx_vdev_register(soc, vdev_id,
1016 			osif_vdev, txrx_ops);
1017 }
1018 
1019 static inline int
cdp_mgmt_send(ol_txrx_soc_handle soc,uint8_t vdev_id,qdf_nbuf_t tx_mgmt_frm,uint8_t type)1020 cdp_mgmt_send(ol_txrx_soc_handle soc, uint8_t vdev_id,
1021 	      qdf_nbuf_t tx_mgmt_frm,	uint8_t type)
1022 {
1023 	if (!soc || !soc->ops) {
1024 		dp_cdp_debug("Invalid Instance:");
1025 		QDF_BUG(0);
1026 		return 0;
1027 	}
1028 
1029 	if (!soc->ops->cmn_drv_ops ||
1030 	    !soc->ops->cmn_drv_ops->txrx_mgmt_send)
1031 		return 0;
1032 
1033 	return soc->ops->cmn_drv_ops->txrx_mgmt_send(soc, vdev_id,
1034 			tx_mgmt_frm, type);
1035 }
1036 
1037 static inline int
cdp_mgmt_send_ext(ol_txrx_soc_handle soc,uint8_t vdev_id,qdf_nbuf_t tx_mgmt_frm,uint8_t type,uint8_t use_6mbps,uint16_t chanfreq)1038 cdp_mgmt_send_ext(ol_txrx_soc_handle soc, uint8_t vdev_id,
1039 		  qdf_nbuf_t tx_mgmt_frm, uint8_t type,
1040 		  uint8_t use_6mbps, uint16_t chanfreq)
1041 {
1042 	if (!soc || !soc->ops) {
1043 		dp_cdp_debug("Invalid Instance:");
1044 		QDF_BUG(0);
1045 		return 0;
1046 	}
1047 
1048 	if (!soc->ops->cmn_drv_ops ||
1049 	    !soc->ops->cmn_drv_ops->txrx_mgmt_send_ext)
1050 		return 0;
1051 
1052 	return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext
1053 			(soc, vdev_id, tx_mgmt_frm, type, use_6mbps, chanfreq);
1054 }
1055 
1056 
1057 static inline QDF_STATUS
cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc,uint8_t pdev_id,uint8_t type,ol_txrx_mgmt_tx_cb download_cb,ol_txrx_mgmt_tx_cb ota_ack_cb,void * ctxt)1058 cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, uint8_t pdev_id,
1059 		   uint8_t type, ol_txrx_mgmt_tx_cb download_cb,
1060 		   ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt)
1061 {
1062 	if (!soc || !soc->ops) {
1063 		dp_cdp_debug("Invalid Instance:");
1064 		QDF_BUG(0);
1065 		return QDF_STATUS_E_FAILURE;
1066 	}
1067 
1068 	if (!soc->ops->cmn_drv_ops ||
1069 	    !soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set)
1070 		return QDF_STATUS_E_FAILURE;
1071 
1072 	return soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set
1073 			(soc, pdev_id, type, download_cb, ota_ack_cb, ctxt);
1074 }
1075 
1076 /**
1077  * cdp_peer_unmap_sync_cb_set() - set peer unmap sync callback
1078  * @soc: datapath soc handle
1079  * @pdev_id: physical device instance id
1080  * @unmap_resp_cb: peer unmap sync callback
1081  *
1082  * Return: None
1083  */
1084 static inline void
cdp_peer_unmap_sync_cb_set(ol_txrx_soc_handle soc,uint8_t pdev_id,QDF_STATUS (* unmap_resp_cb)(uint8_t vdev_id,uint32_t peerid_cnt,uint16_t * peerid_list))1085 cdp_peer_unmap_sync_cb_set(ol_txrx_soc_handle soc,
1086 			   uint8_t pdev_id,
1087 			   QDF_STATUS(*unmap_resp_cb)(
1088 					uint8_t vdev_id,
1089 					uint32_t peerid_cnt,
1090 					uint16_t *peerid_list))
1091 {
1092 	if (!soc || !soc->ops) {
1093 		dp_cdp_debug("Invalid Instance:");
1094 		QDF_BUG(0);
1095 		return;
1096 	}
1097 
1098 	if (!soc->ops->cmn_drv_ops ||
1099 	    !soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set)
1100 		return;
1101 
1102 	soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set(soc, pdev_id,
1103 							   unmap_resp_cb);
1104 }
1105 
1106 /**
1107  * cdp_data_tx_cb_set(): set the callback for non standard tx
1108  * @soc: datapath soc handle
1109  * @vdev_id: virtual device/interface id
1110  * @callback: callback function
1111  * @ctxt: callback context
1112  *
1113  */
1114 static inline void
cdp_data_tx_cb_set(ol_txrx_soc_handle soc,uint8_t vdev_id,ol_txrx_data_tx_cb callback,void * ctxt)1115 cdp_data_tx_cb_set(ol_txrx_soc_handle soc, uint8_t vdev_id,
1116 		   ol_txrx_data_tx_cb callback, void *ctxt)
1117 {
1118 	if (!soc || !soc->ops) {
1119 		dp_cdp_debug("Invalid Instance:");
1120 		QDF_BUG(0);
1121 		return;
1122 	}
1123 
1124 	if (!soc->ops->cmn_drv_ops ||
1125 	    !soc->ops->cmn_drv_ops->txrx_data_tx_cb_set)
1126 		return;
1127 
1128 	soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(soc, vdev_id,
1129 						   callback, ctxt);
1130 }
1131 
1132 /******************************************************************************
1133  * Statistics and Debugging Interface (C Interface)
1134  *****************************************************************************/
1135 /*
1136  * External Device physical address types
1137  *
1138  * Currently, both MAC and IPA uController use the same size addresses
1139  * and descriptors are exchanged between these two depending on the mode.
1140  *
1141  * Rationale: qdf_dma_addr_t is the type used internally on the host for DMA
1142  *            operations. However, external device physical address sizes
1143  *            may be different from host-specific physical address sizes.
1144  *            This calls for the following definitions for target devices
1145  *            (MAC, IPA uc).
1146  */
1147 #if HTT_PADDR64
1148 typedef uint64_t target_paddr_t;
1149 #else
1150 typedef uint32_t target_paddr_t;
1151 #endif /*HTT_PADDR64 */
1152 
1153 static inline int
cdp_aggr_cfg(ol_txrx_soc_handle soc,uint8_t vdev_id,int max_subfrms_ampdu,int max_subfrms_amsdu)1154 cdp_aggr_cfg(ol_txrx_soc_handle soc, uint8_t vdev_id,
1155 	     int max_subfrms_ampdu,
1156 	     int max_subfrms_amsdu)
1157 {
1158 	if (!soc || !soc->ops) {
1159 		dp_cdp_debug("Invalid Instance:");
1160 		QDF_BUG(0);
1161 		return 0;
1162 	}
1163 
1164 	if (!soc->ops->cmn_drv_ops ||
1165 	    !soc->ops->cmn_drv_ops->txrx_aggr_cfg)
1166 		return 0;
1167 
1168 	return soc->ops->cmn_drv_ops->txrx_aggr_cfg(soc, vdev_id,
1169 			max_subfrms_ampdu, max_subfrms_amsdu);
1170 }
1171 
1172 static inline int
cdp_fw_stats_get(ol_txrx_soc_handle soc,uint8_t vdev_id,struct ol_txrx_stats_req * req,bool per_vdev,bool response_expected)1173 cdp_fw_stats_get(ol_txrx_soc_handle soc, uint8_t vdev_id,
1174 		 struct ol_txrx_stats_req *req, bool per_vdev,
1175 		 bool response_expected)
1176 {
1177 	if (!soc || !soc->ops) {
1178 		dp_cdp_debug("Invalid Instance:");
1179 		QDF_BUG(0);
1180 		return 0;
1181 	}
1182 
1183 	if (!soc->ops->cmn_drv_ops ||
1184 	    !soc->ops->cmn_drv_ops->txrx_fw_stats_get)
1185 		return 0;
1186 
1187 	return soc->ops->cmn_drv_ops->txrx_fw_stats_get(soc, vdev_id, req,
1188 			per_vdev, response_expected);
1189 }
1190 
1191 static inline int
cdp_debug(ol_txrx_soc_handle soc,uint8_t vdev_id,int debug_specs)1192 cdp_debug(ol_txrx_soc_handle soc, uint8_t vdev_id, int debug_specs)
1193 {
1194 	if (!soc || !soc->ops) {
1195 		dp_cdp_debug("Invalid Instance:");
1196 		QDF_BUG(0);
1197 		return 0;
1198 	}
1199 
1200 	if (!soc->ops->cmn_drv_ops ||
1201 	    !soc->ops->cmn_drv_ops->txrx_debug)
1202 		return 0;
1203 
1204 	return soc->ops->cmn_drv_ops->txrx_debug(soc, vdev_id, debug_specs);
1205 }
1206 
1207 static inline QDF_STATUS
cdp_fw_stats_cfg(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t cfg_stats_type,uint32_t cfg_val)1208 cdp_fw_stats_cfg(ol_txrx_soc_handle soc,
1209 		 uint8_t vdev_id, uint8_t cfg_stats_type, uint32_t cfg_val)
1210 {
1211 	if (!soc || !soc->ops) {
1212 		dp_cdp_debug("Invalid Instance:");
1213 		QDF_BUG(0);
1214 		return QDF_STATUS_E_FAILURE;
1215 	}
1216 
1217 	if (!soc->ops->cmn_drv_ops ||
1218 	    !soc->ops->cmn_drv_ops->txrx_fw_stats_cfg)
1219 		return QDF_STATUS_E_FAILURE;
1220 
1221 	return soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(soc, vdev_id,
1222 						 cfg_stats_type, cfg_val);
1223 }
1224 
cdp_print_level_set(ol_txrx_soc_handle soc,unsigned level)1225 static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level)
1226 {
1227 	if (!soc || !soc->ops) {
1228 		dp_cdp_debug("Invalid Instance:");
1229 		QDF_BUG(0);
1230 		return;
1231 	}
1232 
1233 	if (!soc->ops->cmn_drv_ops ||
1234 	    !soc->ops->cmn_drv_ops->txrx_print_level_set)
1235 		return;
1236 
1237 	soc->ops->cmn_drv_ops->txrx_print_level_set(level);
1238 }
1239 
1240 /**
1241  * cdp_get_vdev_mac_addr() - Detach txrx peer
1242  * @soc: Datapath soc handle
1243  * @vdev_id: virtual device/interface id
1244  *
1245  * Return: MAC address on success, NULL on failure.
1246  *
1247  */
1248 static inline uint8_t *
cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc,uint8_t vdev_id)1249 cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, uint8_t vdev_id)
1250 {
1251 	if (!soc || !soc->ops) {
1252 		dp_cdp_debug("Invalid Instance:");
1253 		QDF_BUG(0);
1254 		return NULL;
1255 	}
1256 
1257 	if (!soc->ops->cmn_drv_ops ||
1258 	    !soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr)
1259 		return NULL;
1260 
1261 	return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(soc, vdev_id);
1262 
1263 }
1264 
1265 /**
1266  * cdp_get_os_rx_handles_from_vdev() - Return os rx handles for a vdev
1267  * @soc: ol_txrx_soc_handle handle
1268  * @vdev_id: vdev id for which os rx handles are needed
1269  * @stack_fn_p: pointer to stack function pointer
1270  * @osif_handle_p: pointer to ol_osif_vdev_handle
1271  *
1272  * Return: void
1273  */
1274 static inline
cdp_get_os_rx_handles_from_vdev(ol_txrx_soc_handle soc,uint8_t vdev_id,ol_txrx_rx_fp * stack_fn_p,ol_osif_vdev_handle * osif_handle_p)1275 void cdp_get_os_rx_handles_from_vdev(ol_txrx_soc_handle soc,
1276 				     uint8_t vdev_id,
1277 				     ol_txrx_rx_fp *stack_fn_p,
1278 				     ol_osif_vdev_handle *osif_handle_p)
1279 {
1280 	if (!soc || !soc->ops) {
1281 		dp_cdp_debug("Invalid Instance:");
1282 		QDF_BUG(0);
1283 		return;
1284 	}
1285 
1286 	if (!soc->ops->cmn_drv_ops ||
1287 	    !soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev)
1288 		return;
1289 
1290 	soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev(soc, vdev_id,
1291 								stack_fn_p,
1292 								osif_handle_p);
1293 }
1294 
1295 /**
1296  * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev
1297  * @soc: datapath soc handle
1298  * @vdev_id: virtual device/interface id
1299  *
1300  * Return: Handle to control pdev
1301  */
1302 static inline struct cdp_cfg *
cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc,uint8_t vdev_id)1303 cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, uint8_t vdev_id)
1304 {
1305 	if (!soc || !soc->ops) {
1306 		dp_cdp_debug("Invalid Instance:");
1307 		QDF_BUG(0);
1308 		return NULL;
1309 	}
1310 
1311 	if (!soc->ops->cmn_drv_ops ||
1312 	    !soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev)
1313 		return NULL;
1314 
1315 	return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev(soc,
1316 								   vdev_id);
1317 }
1318 
1319 /**
1320  * cdp_get_mon_vdev_from_pdev() - Get vdev handle of monitor mode
1321  * @soc: datapath soc handle
1322  * @pdev_id: physical device instance id
1323  *
1324  * Return: virtual interface id
1325  */
1326 static inline uint8_t
cdp_get_mon_vdev_from_pdev(ol_txrx_soc_handle soc,uint8_t pdev_id)1327 cdp_get_mon_vdev_from_pdev(ol_txrx_soc_handle soc, uint8_t pdev_id)
1328 {
1329 	if (!soc || !soc->ops) {
1330 		dp_cdp_debug("Invalid Instance:");
1331 		QDF_BUG(0);
1332 		return -EINVAL;
1333 	}
1334 
1335 	if (!soc->ops->cmn_drv_ops ||
1336 	    !soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev)
1337 		return -EINVAL;
1338 
1339 	return soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev(soc, pdev_id);
1340 }
1341 
1342 static inline void
cdp_soc_detach(ol_txrx_soc_handle soc)1343 cdp_soc_detach(ol_txrx_soc_handle soc)
1344 {
1345 	if (!soc || !soc->ops) {
1346 		dp_cdp_debug("Invalid Instance:");
1347 		QDF_BUG(0);
1348 		return;
1349 	}
1350 
1351 	if (!soc->ops->cmn_drv_ops ||
1352 	    !soc->ops->cmn_drv_ops->txrx_soc_detach)
1353 		return;
1354 
1355 	soc->ops->cmn_drv_ops->txrx_soc_detach(soc);
1356 }
1357 
1358 /**
1359  * cdp_soc_init() - Initialize txrx SOC
1360  * @soc: ol_txrx_soc_handle handle
1361  * @devid: Device ID
1362  * @hif_handle: Opaque HIF handle
1363  * @psoc: Opaque Objmgr handle
1364  * @htc_handle: Opaque HTC handle
1365  * @qdf_dev: QDF device
1366  * @dp_ol_if_ops: Offload Operations
1367  *
1368  * Return: DP SOC handle on success, NULL on failure
1369  */
1370 static inline ol_txrx_soc_handle
cdp_soc_init(ol_txrx_soc_handle soc,u_int16_t devid,void * hif_handle,struct cdp_ctrl_objmgr_psoc * psoc,HTC_HANDLE htc_handle,qdf_device_t qdf_dev,struct ol_if_ops * dp_ol_if_ops)1371 cdp_soc_init(ol_txrx_soc_handle soc, u_int16_t devid,
1372 	     void *hif_handle,
1373 	     struct cdp_ctrl_objmgr_psoc *psoc,
1374 	     HTC_HANDLE htc_handle, qdf_device_t qdf_dev,
1375 	     struct ol_if_ops *dp_ol_if_ops)
1376 {
1377 	if (!soc || !soc->ops) {
1378 		dp_cdp_debug("Invalid Instance:");
1379 		QDF_BUG(0);
1380 		return NULL;
1381 	}
1382 
1383 	if (!soc->ops->cmn_drv_ops ||
1384 	    !soc->ops->cmn_drv_ops->txrx_soc_init)
1385 		return NULL;
1386 
1387 	return soc->ops->cmn_drv_ops->txrx_soc_init(soc, psoc,
1388 						    hif_handle,
1389 						    htc_handle, qdf_dev,
1390 						    dp_ol_if_ops, devid);
1391 }
1392 
1393 /**
1394  * cdp_pdev_init() - Initialize txrx pdev
1395  * @soc: ol_txrx_soc_handle handle
1396  * @htc_handle: Opaque HTC handle
1397  * @qdf_dev: QDF device
1398  * @pdev_id: pdev id
1399  *
1400  * Return: DP SOC handle on success, NULL on failure
1401  */
1402 static inline QDF_STATUS
cdp_pdev_init(ol_txrx_soc_handle soc,HTC_HANDLE htc_handle,qdf_device_t qdf_dev,uint8_t pdev_id)1403 cdp_pdev_init(ol_txrx_soc_handle soc,
1404 	      HTC_HANDLE htc_handle, qdf_device_t qdf_dev,
1405 	      uint8_t pdev_id)
1406 {
1407 	if (!soc || !soc->ops) {
1408 		dp_cdp_debug("Invalid Instance:");
1409 		QDF_BUG(0);
1410 		return 0;
1411 	}
1412 
1413 	if (!soc->ops->cmn_drv_ops ||
1414 	    !soc->ops->cmn_drv_ops->txrx_pdev_init)
1415 		return 0;
1416 
1417 	return soc->ops->cmn_drv_ops->txrx_pdev_init(soc,
1418 						     htc_handle, qdf_dev,
1419 						     pdev_id);
1420 }
1421 
1422 /**
1423  * cdp_soc_deinit() - Deinitialize txrx SOC
1424  * @soc: Opaque DP SOC handle
1425  *
1426  * Return: None
1427  */
1428 static inline void
cdp_soc_deinit(ol_txrx_soc_handle soc)1429 cdp_soc_deinit(ol_txrx_soc_handle soc)
1430 {
1431 	if (!soc || !soc->ops) {
1432 		dp_cdp_debug("Invalid Instance:");
1433 		QDF_BUG(0);
1434 		return;
1435 	}
1436 
1437 	if (!soc->ops->cmn_drv_ops ||
1438 	    !soc->ops->cmn_drv_ops->txrx_soc_deinit)
1439 		return;
1440 
1441 	soc->ops->cmn_drv_ops->txrx_soc_deinit(soc);
1442 }
1443 
1444 /**
1445  * cdp_tso_soc_attach() - TSO attach function
1446  * @soc: ol_txrx_soc_handle handle
1447  *
1448  * Reserve TSO descriptor buffers
1449  *
1450  * Return: QDF_STATUS_SUCCESS on Success or
1451  * QDF_STATUS_E_FAILURE on failure
1452  */
1453 static inline QDF_STATUS
cdp_tso_soc_attach(ol_txrx_soc_handle soc)1454 cdp_tso_soc_attach(ol_txrx_soc_handle soc)
1455 {
1456 	if (!soc || !soc->ops) {
1457 		dp_cdp_debug("Invalid Instance:");
1458 		QDF_BUG(0);
1459 		return 0;
1460 	}
1461 
1462 	if (!soc->ops->cmn_drv_ops ||
1463 	    !soc->ops->cmn_drv_ops->txrx_tso_soc_attach)
1464 		return 0;
1465 
1466 	return soc->ops->cmn_drv_ops->txrx_tso_soc_attach(soc);
1467 }
1468 
1469 /**
1470  * cdp_tso_soc_detach() - TSO detach function
1471  * @soc: ol_txrx_soc_handle handle
1472  *
1473  * Release TSO descriptor buffers
1474  *
1475  * Return: QDF_STATUS_SUCCESS on Success or
1476  * QDF_STATUS_E_FAILURE on failure
1477  */
1478 static inline QDF_STATUS
cdp_tso_soc_detach(ol_txrx_soc_handle soc)1479 cdp_tso_soc_detach(ol_txrx_soc_handle soc)
1480 {
1481 	if (!soc || !soc->ops) {
1482 		dp_cdp_debug("Invalid Instance:");
1483 		QDF_BUG(0);
1484 		return 0;
1485 	}
1486 
1487 	if (!soc->ops->cmn_drv_ops ||
1488 	    !soc->ops->cmn_drv_ops->txrx_tso_soc_detach)
1489 		return 0;
1490 
1491 	return soc->ops->cmn_drv_ops->txrx_tso_soc_detach(soc);
1492 }
1493 
1494 /**
1495  * cdp_tid_update_ba_win_size() - Update the DP tid BA window size
1496  * @soc: soc handle
1497  * @peer_mac: mac address of peer handle
1498  * @vdev_id: id of vdev handle
1499  * @tid: tid
1500  * @buffersize: BA window size
1501  *
1502  * Return: success/failure of tid update
1503  */
1504 static inline QDF_STATUS
cdp_tid_update_ba_win_size(ol_txrx_soc_handle soc,uint8_t * peer_mac,uint16_t vdev_id,uint8_t tid,uint16_t buffersize)1505 cdp_tid_update_ba_win_size(ol_txrx_soc_handle soc,
1506 			   uint8_t *peer_mac, uint16_t vdev_id, uint8_t tid,
1507 			   uint16_t buffersize)
1508 {
1509 	if (!soc || !soc->ops) {
1510 		dp_cdp_debug("Invalid Instance:");
1511 		QDF_BUG(0);
1512 		return 0;
1513 	}
1514 
1515 	if (!soc->ops->cmn_drv_ops ||
1516 	    !soc->ops->cmn_drv_ops->tid_update_ba_win_size)
1517 		return 0;
1518 
1519 	return soc->ops->cmn_drv_ops->tid_update_ba_win_size(soc, peer_mac,
1520 							     vdev_id, tid,
1521 							     buffersize);
1522 }
1523 
1524 /**
1525  * cdp_addba_resp_tx_completion() - Indicate addba response tx
1526  * completion to dp to change tid state.
1527  * @soc: soc handle
1528  * @peer_mac: mac address of peer handle
1529  * @vdev_id: id of vdev handle
1530  * @tid: tid
1531  * @status: Tx completion status
1532  *
1533  * Return: success/failure of tid update
1534  */
cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc,uint8_t * peer_mac,uint16_t vdev_id,uint8_t tid,int status)1535 static inline int cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc,
1536 					       uint8_t *peer_mac,
1537 					       uint16_t vdev_id,
1538 					       uint8_t tid, int status)
1539 {
1540 	if (!soc || !soc->ops) {
1541 		dp_cdp_debug("Invalid Instance:");
1542 		QDF_BUG(0);
1543 		return 0;
1544 	}
1545 
1546 	if (!soc->ops->cmn_drv_ops ||
1547 	    !soc->ops->cmn_drv_ops->addba_resp_tx_completion)
1548 		return 0;
1549 
1550 	return soc->ops->cmn_drv_ops->addba_resp_tx_completion(soc, peer_mac,
1551 					vdev_id, tid, status);
1552 }
1553 
cdp_addba_requestprocess(ol_txrx_soc_handle soc,uint8_t * peer_mac,uint16_t vdev_id,uint8_t dialogtoken,uint16_t tid,uint16_t batimeout,uint16_t buffersize,uint16_t startseqnum)1554 static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc,
1555 	uint8_t *peer_mac, uint16_t vdev_id, uint8_t dialogtoken, uint16_t tid,
1556 	uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum)
1557 {
1558 	if (!soc || !soc->ops) {
1559 		dp_cdp_debug("Invalid Instance:");
1560 		QDF_BUG(0);
1561 		return 0;
1562 	}
1563 
1564 	if (!soc->ops->cmn_drv_ops ||
1565 	    !soc->ops->cmn_drv_ops->addba_requestprocess)
1566 		return 0;
1567 
1568 	return soc->ops->cmn_drv_ops->addba_requestprocess(soc, peer_mac,
1569 			vdev_id, dialogtoken, tid, batimeout, buffersize,
1570 			startseqnum);
1571 }
1572 
1573 static inline QDF_STATUS
cdp_addba_responsesetup(ol_txrx_soc_handle soc,uint8_t * peer_mac,uint16_t vdev_id,uint8_t tid,uint8_t * dialogtoken,uint16_t * statuscode,uint16_t * buffersize,uint16_t * batimeout)1574 cdp_addba_responsesetup(ol_txrx_soc_handle soc,
1575 			uint8_t *peer_mac, uint16_t vdev_id,
1576 			uint8_t tid, uint8_t *dialogtoken,
1577 			uint16_t *statuscode, uint16_t *buffersize,
1578 			uint16_t *batimeout)
1579 {
1580 	if (!soc || !soc->ops) {
1581 		dp_cdp_debug("Invalid Instance:");
1582 		QDF_BUG(0);
1583 		return QDF_STATUS_E_FAILURE;
1584 	}
1585 
1586 	if (!soc->ops->cmn_drv_ops ||
1587 	    !soc->ops->cmn_drv_ops->addba_responsesetup)
1588 		return QDF_STATUS_E_FAILURE;
1589 
1590 	return soc->ops->cmn_drv_ops->addba_responsesetup(soc, peer_mac,
1591 			vdev_id, tid, dialogtoken, statuscode, buffersize,
1592 			batimeout);
1593 }
1594 
cdp_delba_process(ol_txrx_soc_handle soc,uint8_t * peer_mac,uint16_t vdev_id,int tid,uint16_t reasoncode)1595 static inline int cdp_delba_process(ol_txrx_soc_handle soc, uint8_t *peer_mac,
1596 				    uint16_t vdev_id, int tid,
1597 				    uint16_t reasoncode)
1598 {
1599 	if (!soc || !soc->ops) {
1600 		dp_cdp_debug("Invalid Instance:");
1601 		QDF_BUG(0);
1602 		return 0;
1603 	}
1604 
1605 	if (!soc->ops->cmn_drv_ops ||
1606 	    !soc->ops->cmn_drv_ops->delba_process)
1607 		return 0;
1608 
1609 	return soc->ops->cmn_drv_ops->delba_process(soc, peer_mac,
1610 						vdev_id, tid, reasoncode);
1611 }
1612 
1613 /**
1614  * cdp_delba_tx_completion() - Handle delba tx completion
1615  * to update stats and retry transmission if failed.
1616  * @soc: soc handle
1617  * @peer_mac: peer mac address
1618  * @vdev_id: id of vdev handle
1619  * @tid: Tid number
1620  * @status: Tx completion status
1621  *
1622  * Return: 0 on Success, 1 on failure
1623  */
1624 
cdp_delba_tx_completion(ol_txrx_soc_handle soc,uint8_t * peer_mac,uint16_t vdev_id,uint8_t tid,int status)1625 static inline int cdp_delba_tx_completion(ol_txrx_soc_handle soc,
1626 					  uint8_t *peer_mac,
1627 					  uint16_t vdev_id,
1628 					  uint8_t tid, int status)
1629 {
1630 	if (!soc || !soc->ops) {
1631 		dp_cdp_debug("Invalid Instance:");
1632 		QDF_BUG(0);
1633 		return 0;
1634 	}
1635 
1636 	if (!soc->ops->cmn_drv_ops ||
1637 	    !soc->ops->cmn_drv_ops->delba_tx_completion)
1638 		return 0;
1639 
1640 	return soc->ops->cmn_drv_ops->delba_tx_completion(soc, peer_mac,
1641 							  vdev_id,
1642 							  tid, status);
1643 }
1644 
1645 static inline QDF_STATUS
cdp_set_addbaresponse(ol_txrx_soc_handle soc,uint8_t * peer_mac,uint16_t vdev_id,int tid,uint16_t statuscode)1646 cdp_set_addbaresponse(ol_txrx_soc_handle soc,
1647 		      uint8_t *peer_mac, uint16_t vdev_id, int tid,
1648 		      uint16_t statuscode)
1649 {
1650 	if (!soc || !soc->ops) {
1651 		dp_cdp_debug("Invalid Instance:");
1652 		QDF_BUG(0);
1653 		return QDF_STATUS_E_FAILURE;
1654 	}
1655 
1656 	if (!soc->ops->cmn_drv_ops ||
1657 	    !soc->ops->cmn_drv_ops->set_addba_response)
1658 		return QDF_STATUS_E_FAILURE;
1659 
1660 	return soc->ops->cmn_drv_ops->set_addba_response(soc, peer_mac, vdev_id,
1661 						  tid, statuscode);
1662 }
1663 
1664 /**
1665  * cdp_set_vdev_dscp_tid_map(): function to set DSCP-tid map in the vap
1666  * @soc : soc handle
1667  * @vdev_id: id of vdev handle
1668  * @map_id: id of the tid map
1669  *
1670  * Return: QDF_STATUS
1671  */
1672 static inline QDF_STATUS
cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t map_id)1673 cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc,
1674 			  uint8_t vdev_id, uint8_t map_id)
1675 {
1676 	if (!soc || !soc->ops) {
1677 		dp_cdp_debug("Invalid Instance:");
1678 		QDF_BUG(0);
1679 		return QDF_STATUS_E_FAILURE;
1680 	}
1681 
1682 	if (!soc->ops->cmn_drv_ops ||
1683 	    !soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map)
1684 		return QDF_STATUS_E_FAILURE;
1685 
1686 	return soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map(soc, vdev_id,
1687 				map_id);
1688 }
1689 
1690 #ifdef QCA_MULTIPASS_SUPPORT
1691 /**
1692  * cdp_set_vlan_groupkey(): function to set vlan ID - group key map in the vap
1693  * @soc : soc handle
1694  * @vdev_id: id of vdev handle
1695  * @vlan_id: vlan id
1696  * @group_key: corresponding group key to vlan ID
1697  *
1698  * Return: void
1699  */
1700 static inline
cdp_set_vlan_groupkey(ol_txrx_soc_handle soc,uint8_t vdev_id,uint16_t vlan_id,uint16_t group_key)1701 QDF_STATUS cdp_set_vlan_groupkey(ol_txrx_soc_handle soc, uint8_t vdev_id,
1702 				 uint16_t vlan_id, uint16_t group_key)
1703 {
1704 	if (!soc || !soc->ops) {
1705 		dp_cdp_debug("Invalid Instance:");
1706 		QDF_BUG(0);
1707 		return 0;
1708 	}
1709 
1710 	if (!soc->ops->cmn_drv_ops ||
1711 	    !soc->ops->cmn_drv_ops->set_vlan_groupkey)
1712 		return 0;
1713 
1714 	return soc->ops->cmn_drv_ops->set_vlan_groupkey(soc, vdev_id, vlan_id,
1715 							group_key);
1716 }
1717 #endif
1718 
1719 /**
1720  * cdp_ath_get_total_per(): function to get hw retries
1721  * @soc : soc handle
1722  * @pdev_id: id of pdev handle
1723  *
1724  * Return: get hw retries
1725  */
1726 static inline
cdp_ath_get_total_per(ol_txrx_soc_handle soc,uint8_t pdev_id)1727 int cdp_ath_get_total_per(ol_txrx_soc_handle soc, uint8_t pdev_id)
1728 {
1729 	if (!soc || !soc->ops) {
1730 		dp_cdp_debug("Invalid Instance:");
1731 		QDF_BUG(0);
1732 		return 0;
1733 	}
1734 
1735 	if (!soc->ops->cmn_drv_ops ||
1736 	    !soc->ops->cmn_drv_ops->txrx_get_total_per)
1737 		return 0;
1738 
1739 	return soc->ops->cmn_drv_ops->txrx_get_total_per(soc, pdev_id);
1740 }
1741 
1742 /**
1743  * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map
1744  * @soc: soc handle
1745  * @pdev_id: id of pdev handle
1746  * @map_id: id of the tid map
1747  * @tos: index value in map that needs to be changed
1748  * @tid: tid value passed by user
1749  *
1750  * Return: void
1751  */
cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc,uint8_t pdev_id,uint8_t map_id,uint8_t tos,uint8_t tid)1752 static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc,
1753 		uint8_t pdev_id, uint8_t map_id, uint8_t tos, uint8_t tid)
1754 {
1755 	if (!soc || !soc->ops) {
1756 		dp_cdp_debug("Invalid Instance:");
1757 		QDF_BUG(0);
1758 		return;
1759 	}
1760 
1761 	if (!soc->ops->cmn_drv_ops ||
1762 	    !soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map)
1763 		return;
1764 
1765 	soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map(soc, pdev_id,
1766 			map_id, tos, tid);
1767 }
1768 
1769 /**
1770  * cdp_flush_cache_rx_queue() - flush cache rx queue frame
1771  * @soc: soc handle
1772  *
1773  * Return: None
1774  */
cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc)1775 static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc)
1776 {
1777 	if (!soc || !soc->ops) {
1778 		dp_cdp_debug("Invalid Instance:");
1779 		QDF_BUG(0);
1780 		return;
1781 	}
1782 
1783 	if (!soc->ops->cmn_drv_ops ||
1784 	    !soc->ops->cmn_drv_ops->flush_cache_rx_queue)
1785 		return;
1786 	soc->ops->cmn_drv_ops->flush_cache_rx_queue();
1787 }
1788 
1789 /**
1790  * cdp_txrx_stats_request(): function to map to host and firmware statistics
1791  * @soc: soc handle
1792  * @vdev_id: virtual device ID
1793  * @req: stats request container
1794  *
1795  * return: status
1796  */
1797 static inline
cdp_txrx_stats_request(ol_txrx_soc_handle soc,uint8_t vdev_id,struct cdp_txrx_stats_req * req)1798 int cdp_txrx_stats_request(ol_txrx_soc_handle soc, uint8_t vdev_id,
1799 			   struct cdp_txrx_stats_req *req)
1800 {
1801 	if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) {
1802 		dp_cdp_debug("Invalid Instance:");
1803 		QDF_ASSERT(0);
1804 		return 0;
1805 	}
1806 
1807 	if (soc->ops->cmn_drv_ops->txrx_stats_request)
1808 		return soc->ops->cmn_drv_ops->txrx_stats_request(soc, vdev_id,
1809 								 req);
1810 
1811 	return 0;
1812 }
1813 
1814 /**
1815  * cdp_txrx_intr_attach(): function to attach and configure interrupt
1816  * @soc: soc handle
1817  */
cdp_txrx_intr_attach(ol_txrx_soc_handle soc)1818 static inline QDF_STATUS cdp_txrx_intr_attach(ol_txrx_soc_handle soc)
1819 {
1820 	if (!soc || !soc->ops) {
1821 		dp_cdp_debug("Invalid Instance:");
1822 		QDF_BUG(0);
1823 		return 0;
1824 	}
1825 
1826 	if (!soc->ops->cmn_drv_ops ||
1827 	    !soc->ops->cmn_drv_ops->txrx_intr_attach)
1828 		return 0;
1829 
1830 	return soc->ops->cmn_drv_ops->txrx_intr_attach(soc);
1831 }
1832 
1833 /**
1834  * cdp_txrx_intr_detach(): function to detach interrupt
1835  * @soc: soc handle
1836  */
cdp_txrx_intr_detach(ol_txrx_soc_handle soc)1837 static inline void cdp_txrx_intr_detach(ol_txrx_soc_handle soc)
1838 {
1839 	if (!soc || !soc->ops) {
1840 		dp_cdp_debug("Invalid Instance:");
1841 		QDF_BUG(0);
1842 		return;
1843 	}
1844 
1845 	if (!soc->ops->cmn_drv_ops ||
1846 	    !soc->ops->cmn_drv_ops->txrx_intr_detach)
1847 		return;
1848 
1849 	soc->ops->cmn_drv_ops->txrx_intr_detach(soc);
1850 }
1851 
1852 /**
1853  * cdp_txrx_ppeds_stop(): function to stop ppeds
1854  * @soc: soc handle
1855  */
cdp_txrx_ppeds_stop(ol_txrx_soc_handle soc)1856 static inline void cdp_txrx_ppeds_stop(ol_txrx_soc_handle soc)
1857 {
1858 	if (!soc || !soc->ops) {
1859 		dp_cdp_debug("Invalid Instance:");
1860 		QDF_BUG(0);
1861 		return;
1862 	}
1863 
1864 	if (!soc->ops->cmn_drv_ops ||
1865 	    !soc->ops->cmn_drv_ops->txrx_ppeds_stop)
1866 		return;
1867 
1868 	soc->ops->cmn_drv_ops->txrx_ppeds_stop(soc);
1869 }
1870 
1871 /**
1872  * cdp_txrx_umac_reset_init(): De-initialize UMAC HW reset module
1873  * @soc: soc handle
1874  */
cdp_txrx_umac_reset_init(ol_txrx_soc_handle soc)1875 static inline void cdp_txrx_umac_reset_init(ol_txrx_soc_handle soc)
1876 {
1877 	if (!soc || !soc->ops) {
1878 		dp_cdp_debug("Invalid Instance:");
1879 		QDF_BUG(0);
1880 		return;
1881 	}
1882 
1883 	if (!soc->ops->cmn_drv_ops ||
1884 	    !soc->ops->cmn_drv_ops->txrx_umac_reset_init)
1885 		return;
1886 
1887 	soc->ops->cmn_drv_ops->txrx_umac_reset_init(soc);
1888 }
1889 
1890 /**
1891  * cdp_txrx_umac_reset_deinit(): De-initialize UMAC HW reset module
1892  * @soc: soc handle
1893  */
cdp_txrx_umac_reset_deinit(ol_txrx_soc_handle soc)1894 static inline void cdp_txrx_umac_reset_deinit(ol_txrx_soc_handle soc)
1895 {
1896 	if (!soc || !soc->ops) {
1897 		dp_cdp_debug("Invalid Instance:");
1898 		QDF_BUG(0);
1899 		return;
1900 	}
1901 
1902 	if (!soc->ops->cmn_drv_ops ||
1903 	    !soc->ops->cmn_drv_ops->txrx_umac_reset_deinit)
1904 		return;
1905 
1906 	soc->ops->cmn_drv_ops->txrx_umac_reset_deinit(soc);
1907 }
1908 
1909 /**
1910  * cdp_notify_asserted_soc(): function to notify asserted SoC
1911  * @soc: soc handle
1912  *
1913  * Return: QDF_STATUS
1914  */
1915 static inline QDF_STATUS
cdp_notify_asserted_soc(ol_txrx_soc_handle soc)1916 cdp_notify_asserted_soc(ol_txrx_soc_handle soc)
1917 {
1918 	if (!soc || !soc->ops) {
1919 		dp_cdp_debug("Invalid Instance:");
1920 		QDF_BUG(0);
1921 		return QDF_STATUS_E_NULL_VALUE;
1922 	}
1923 
1924 	if (!soc->ops->cmn_drv_ops ||
1925 	    !soc->ops->cmn_drv_ops->notify_asserted_soc)
1926 		return QDF_STATUS_E_NULL_VALUE;
1927 
1928 	return soc->ops->cmn_drv_ops->notify_asserted_soc(soc);
1929 }
1930 
1931 /**
1932  * cdp_display_stats(): function to map to dump stats
1933  * @soc: soc handle
1934  * @value: statistics option
1935  * @level: verbosity level
1936  */
1937 static inline QDF_STATUS
cdp_display_stats(ol_txrx_soc_handle soc,uint16_t value,enum qdf_stats_verbosity_level level)1938 cdp_display_stats(ol_txrx_soc_handle soc, uint16_t value,
1939 		  enum qdf_stats_verbosity_level level)
1940 {
1941 	if (!soc || !soc->ops) {
1942 		dp_cdp_debug("Invalid Instance:");
1943 		QDF_BUG(0);
1944 		return 0;
1945 	}
1946 
1947 	if (!soc->ops->cmn_drv_ops ||
1948 	    !soc->ops->cmn_drv_ops->display_stats)
1949 		return 0;
1950 
1951 	return soc->ops->cmn_drv_ops->display_stats(soc, value, level);
1952 }
1953 
1954 
1955 /**
1956  * cdp_set_pn_check(): function to set pn check
1957  * @soc: soc handle
1958  * @vdev_id: id of virtual device
1959  * @peer_mac: mac address of peer
1960  * @sec_type: security type
1961  * @rx_pn: receive pn
1962  */
cdp_set_pn_check(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,enum cdp_sec_type sec_type,uint32_t * rx_pn)1963 static inline int cdp_set_pn_check(ol_txrx_soc_handle soc,
1964 		uint8_t vdev_id, uint8_t *peer_mac,
1965 		enum cdp_sec_type sec_type,  uint32_t *rx_pn)
1966 {
1967 	if (!soc || !soc->ops) {
1968 		dp_cdp_debug("Invalid Instance:");
1969 		QDF_BUG(0);
1970 		return 0;
1971 	}
1972 
1973 	if (!soc->ops->cmn_drv_ops ||
1974 	    !soc->ops->cmn_drv_ops->set_pn_check)
1975 		return 0;
1976 
1977 	soc->ops->cmn_drv_ops->set_pn_check(soc, vdev_id, peer_mac,
1978 			sec_type, rx_pn);
1979 	return 0;
1980 }
1981 
1982 /**
1983  * cdp_set_key_sec_type(): function to set sec mode of key
1984  * @soc: soc handle
1985  * @vdev_id: id of virtual device
1986  * @peer_mac: mac address of peer
1987  * @sec_type: security type
1988  * @is_unicast: ucast or mcast
1989  */
cdp_set_key_sec_type(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,enum cdp_sec_type sec_type,bool is_unicast)1990 static inline int cdp_set_key_sec_type(ol_txrx_soc_handle soc,
1991 				       uint8_t vdev_id,
1992 				       uint8_t *peer_mac,
1993 				       enum cdp_sec_type sec_type,
1994 				       bool is_unicast)
1995 {
1996 	if (!soc || !soc->ops) {
1997 		dp_cdp_debug("Invalid Instance:");
1998 		QDF_BUG(0);
1999 		return 0;
2000 	}
2001 
2002 	if (!soc->ops->cmn_drv_ops ||
2003 	    !soc->ops->cmn_drv_ops->set_key_sec_type)
2004 		return 0;
2005 
2006 	soc->ops->cmn_drv_ops->set_key_sec_type(soc, vdev_id,
2007 			peer_mac, sec_type, is_unicast);
2008 	return 0;
2009 }
2010 
2011 static inline QDF_STATUS
cdp_set_key(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * mac,bool is_unicast,uint32_t * key)2012 cdp_set_key(ol_txrx_soc_handle soc,
2013 	    uint8_t vdev_id,
2014 	    uint8_t *mac,
2015 	    bool is_unicast, uint32_t *key)
2016 {
2017 	if (!soc || !soc->ops) {
2018 		dp_cdp_debug("Invalid Instance:");
2019 		QDF_BUG(0);
2020 		return QDF_STATUS_E_FAILURE;
2021 	}
2022 
2023 	if (!soc->ops->ctrl_ops ||
2024 	    !soc->ops->ctrl_ops->set_key)
2025 		return QDF_STATUS_E_FAILURE;
2026 
2027 	return soc->ops->ctrl_ops->set_key(soc, vdev_id, mac,
2028 			is_unicast, key);
2029 }
2030 
2031 /**
2032  * cdp_update_config_parameters(): function to propagate configuration
2033  *                                 parameters to datapath
2034  * @soc: opaque soc handle
2035  * @cfg: configuration handle
2036  *
2037  * Return: status: 0 - Success, non-zero: Failure
2038  */
2039 static inline
cdp_update_config_parameters(ol_txrx_soc_handle soc,struct cdp_config_params * cfg)2040 QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc,
2041 	struct cdp_config_params *cfg)
2042 {
2043 	struct cdp_soc *psoc = (struct cdp_soc *)soc;
2044 
2045 	if (!soc || !soc->ops) {
2046 		dp_cdp_debug("Invalid Instance:");
2047 		QDF_BUG(0);
2048 		return 0;
2049 	}
2050 
2051 	if (!soc->ops->cmn_drv_ops ||
2052 	    !soc->ops->cmn_drv_ops->update_config_parameters)
2053 		return QDF_STATUS_SUCCESS;
2054 
2055 	return soc->ops->cmn_drv_ops->update_config_parameters(psoc,
2056 								cfg);
2057 }
2058 
2059 /**
2060  * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev
2061  * @soc: opaque soc handle
2062  * @pdev_id: id of data path pdev handle
2063  *
2064  * Return: opaque dp handle
2065  */
2066 static inline void *
cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc,uint8_t pdev_id)2067 cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id)
2068 {
2069 	if (!soc || !soc->ops) {
2070 		dp_cdp_debug("Invalid Instance:");
2071 		QDF_BUG(0);
2072 		return 0;
2073 	}
2074 
2075 	if (soc->ops->cmn_drv_ops->get_dp_txrx_handle)
2076 		return soc->ops->cmn_drv_ops->get_dp_txrx_handle(soc, pdev_id);
2077 
2078 	return 0;
2079 }
2080 
2081 /**
2082  * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev
2083  * @soc: opaque soc handle
2084  * @pdev_id: id of data path pdev handle
2085  * @dp_hdl: opaque pointer for dp_txrx_handle
2086  *
2087  * Return: void
2088  */
2089 static inline void
cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc,uint8_t pdev_id,void * dp_hdl)2090 cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id,
2091 			    void *dp_hdl)
2092 {
2093 	if (!soc || !soc->ops) {
2094 		dp_cdp_debug("Invalid Instance:");
2095 		QDF_BUG(0);
2096 		return;
2097 	}
2098 
2099 	if (!soc->ops->cmn_drv_ops ||
2100 			!soc->ops->cmn_drv_ops->set_dp_txrx_handle)
2101 		return;
2102 
2103 	soc->ops->cmn_drv_ops->set_dp_txrx_handle(soc, pdev_id, dp_hdl);
2104 }
2105 
2106 /**
2107  * cdp_vdev_get_dp_ext_txrx_handle() - get extended dp handle from vdev
2108  * @soc: opaque soc handle
2109  * @vdev_id: vdev id
2110  *
2111  * Return: opaque dp handle
2112  */
2113 static inline void *
cdp_vdev_get_dp_ext_txrx_handle(ol_txrx_soc_handle soc,uint8_t vdev_id)2114 cdp_vdev_get_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id)
2115 {
2116 	if (!soc || !soc->ops) {
2117 		dp_cdp_debug("Invalid Instance:");
2118 		QDF_BUG(0);
2119 		return 0;
2120 	}
2121 
2122 	if (soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle)
2123 		return soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle(
2124 							soc, vdev_id);
2125 
2126 	return 0;
2127 }
2128 
2129 /**
2130  * cdp_vdev_set_dp_ext_txrx_handle() - set extended dp handle in vdev
2131  * @soc: opaque soc handle
2132  * @vdev_id: vdev id
2133  * @size: size of the advance dp handle
2134  *
2135  * Return: QDF_STATUS
2136  */
2137 static inline QDF_STATUS
cdp_vdev_set_dp_ext_txrx_handle(ol_txrx_soc_handle soc,uint8_t vdev_id,uint16_t size)2138 cdp_vdev_set_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id,
2139 				uint16_t size)
2140 {
2141 	if (!soc || !soc->ops) {
2142 		dp_cdp_debug("Invalid Instance:");
2143 		QDF_BUG(0);
2144 		return QDF_STATUS_E_FAILURE;
2145 	}
2146 
2147 	if (!soc->ops->cmn_drv_ops ||
2148 	    !soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle)
2149 		return QDF_STATUS_E_FAILURE;
2150 
2151 	return soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle(soc,
2152 								  vdev_id,
2153 								  size);
2154 }
2155 
2156 /**
2157  * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc
2158  * @soc: opaque soc handle
2159  *
2160  * Return: opaque extended dp handle
2161  */
2162 static inline void *
cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc)2163 cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc)
2164 {
2165 	if (!soc || !soc->ops) {
2166 		dp_cdp_debug("Invalid Instance:");
2167 		QDF_BUG(0);
2168 		return NULL;
2169 	}
2170 
2171 	if (soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle)
2172 		return soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle(
2173 				(struct cdp_soc *) soc);
2174 
2175 	return NULL;
2176 }
2177 
2178 /**
2179  * cdp_soc_set_dp_txrx_handle() - set advanced dp handle in soc
2180  * @soc: opaque soc handle
2181  * @dp_handle: opaque pointer for dp_txrx_handle
2182  *
2183  * Return: void
2184  */
2185 static inline void
cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc,void * dp_handle)2186 cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle)
2187 {
2188 	if (!soc || !soc->ops) {
2189 		dp_cdp_debug("Invalid Instance:");
2190 		QDF_BUG(0);
2191 		return;
2192 	}
2193 
2194 	if (!soc->ops->cmn_drv_ops ||
2195 			!soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle)
2196 		return;
2197 
2198 	soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle((struct cdp_soc *)soc,
2199 			dp_handle);
2200 }
2201 
2202 /**
2203  * cdp_soc_handle_mode_change() - Update pdev_id to lmac_id mapping
2204  * @soc: opaque soc handle
2205  * @pdev_id: id of data path pdev handle
2206  * @lmac_id: lmac id
2207  *
2208  * Return: QDF_STATUS
2209  */
2210 static inline QDF_STATUS
cdp_soc_handle_mode_change(ol_txrx_soc_handle soc,uint8_t pdev_id,uint32_t lmac_id)2211 cdp_soc_handle_mode_change(ol_txrx_soc_handle soc, uint8_t pdev_id,
2212 			   uint32_t lmac_id)
2213 {
2214 	if (!soc || !soc->ops) {
2215 		dp_cdp_debug("Invalid Instance:");
2216 		QDF_BUG(0);
2217 		return QDF_STATUS_E_FAILURE;
2218 	}
2219 
2220 	if (!soc->ops->cmn_drv_ops ||
2221 	    !soc->ops->cmn_drv_ops->handle_mode_change)
2222 		return QDF_STATUS_E_FAILURE;
2223 
2224 	return soc->ops->cmn_drv_ops->handle_mode_change(soc, pdev_id,
2225 							 lmac_id);
2226 }
2227 
2228 /**
2229  * cdp_soc_map_pdev_to_lmac() - Save pdev_id to lmac_id mapping
2230  * @soc: opaque soc handle
2231  * @pdev_id: id of data path pdev handle
2232  * @lmac_id: lmac id
2233  * Return: QDF_STATUS
2234  */
2235 static inline QDF_STATUS
cdp_soc_map_pdev_to_lmac(ol_txrx_soc_handle soc,uint8_t pdev_id,uint32_t lmac_id)2236 cdp_soc_map_pdev_to_lmac(ol_txrx_soc_handle soc, uint8_t pdev_id,
2237 			 uint32_t lmac_id)
2238 {
2239 	if (!soc || !soc->ops) {
2240 		dp_cdp_debug("Invalid Instance:");
2241 		QDF_BUG(0);
2242 		return QDF_STATUS_E_FAILURE;
2243 	}
2244 
2245 	if (!soc->ops->cmn_drv_ops ||
2246 	    !soc->ops->cmn_drv_ops->map_pdev_to_lmac)
2247 		return QDF_STATUS_E_FAILURE;
2248 
2249 	return soc->ops->cmn_drv_ops->map_pdev_to_lmac(soc, pdev_id,
2250 			lmac_id);
2251 }
2252 
2253 /**
2254  * cdp_txrx_set_pdev_status_down() - set pdev down/up status
2255  * @soc: soc opaque handle
2256  * @pdev_id: id of data path pdev handle
2257  * @is_pdev_down: pdev down/up status
2258  *
2259  * return: QDF_STATUS
2260  */
2261 static inline QDF_STATUS
cdp_txrx_set_pdev_status_down(ol_txrx_soc_handle soc,uint8_t pdev_id,bool is_pdev_down)2262 cdp_txrx_set_pdev_status_down(ol_txrx_soc_handle soc,
2263 			      uint8_t pdev_id,
2264 			      bool is_pdev_down)
2265 {
2266 	if (!soc || !soc->ops) {
2267 		dp_cdp_debug("Invalid Instance:");
2268 		QDF_BUG(0);
2269 		return QDF_STATUS_E_FAILURE;
2270 	}
2271 
2272 	if (!soc->ops->cmn_drv_ops ||
2273 	    !soc->ops->cmn_drv_ops->set_pdev_status_down)
2274 		return QDF_STATUS_E_FAILURE;
2275 
2276 	return soc->ops->cmn_drv_ops->set_pdev_status_down(soc, pdev_id,
2277 						    is_pdev_down);
2278 }
2279 
2280 /**
2281  * cdp_set_tx_pause() - Pause or resume tx path
2282  * @soc: Datapath soc handle
2283  * @flag: set or clear is_tx_pause
2284  *
2285  * Return: None.
2286  */
2287 static inline
cdp_set_tx_pause(ol_txrx_soc_handle soc,bool flag)2288 void cdp_set_tx_pause(ol_txrx_soc_handle soc, bool flag)
2289 {
2290 	if (!soc || !soc->ops) {
2291 		dp_cdp_debug("Invalid Instance:");
2292 		QDF_BUG(0);
2293 		return;
2294 	}
2295 
2296 	if (!soc->ops->cmn_drv_ops ||
2297 				!soc->ops->cmn_drv_ops->set_tx_pause)
2298 		return;
2299 
2300 	soc->ops->cmn_drv_ops->set_tx_pause(soc, flag);
2301 }
2302 
2303 /**
2304  * cdp_tx_send() - enqueue frame for transmission
2305  * @soc: soc opaque handle
2306  * @vdev_id: id of VAP device
2307  * @nbuf: nbuf to be enqueued
2308  *
2309  * This API is used by Extended Datapath modules to enqueue frame for
2310  * transmission
2311  *
2312  * Return: void
2313  */
2314 static inline void
cdp_tx_send(ol_txrx_soc_handle soc,uint8_t vdev_id,qdf_nbuf_t nbuf)2315 cdp_tx_send(ol_txrx_soc_handle soc, uint8_t vdev_id, qdf_nbuf_t nbuf)
2316 {
2317 	if (!soc || !soc->ops) {
2318 		dp_cdp_debug("Invalid Instance:");
2319 		QDF_BUG(0);
2320 		return;
2321 	}
2322 
2323 	if (!soc->ops->cmn_drv_ops ||
2324 			!soc->ops->cmn_drv_ops->tx_send)
2325 		return;
2326 
2327 	soc->ops->cmn_drv_ops->tx_send(soc, vdev_id, nbuf);
2328 }
2329 
2330 /**
2331  * cdp_set_pdev_pcp_tid_map() - set pdev pcp-tid-map
2332  * @soc: opaque soc handle
2333  * @pdev_id: id of data path pdev handle
2334  * @pcp: pcp value
2335  * @tid: tid value
2336  *
2337  * This API is used to configure the pcp-to-tid mapping for a pdev.
2338  *
2339  * Return: QDF_STATUS_SUCCESS if value set successfully
2340  *          QDF_STATUS_E_INVAL false if error
2341  */
2342 static inline
cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc,uint8_t pdev_id,uint32_t pcp,uint32_t tid)2343 QDF_STATUS cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc,
2344 				    uint8_t pdev_id,
2345 				    uint32_t pcp, uint32_t tid)
2346 {
2347 	if (!soc || !soc->ops) {
2348 		dp_cdp_debug("Invalid Instance");
2349 		return QDF_STATUS_E_INVAL;
2350 	}
2351 
2352 	if (!soc->ops->cmn_drv_ops ||
2353 	    !soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map)
2354 		return QDF_STATUS_E_INVAL;
2355 
2356 	return soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map(soc, pdev_id,
2357 							   pcp, tid);
2358 }
2359 
2360 /**
2361  * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id
2362  * @soc: opaque soc handle
2363  * @peer_id: data path peer id
2364  * @peer_mac: peer_mac
2365  *
2366  * Return: QDF_STATUS
2367  */
2368 static inline
cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc,uint32_t peer_id,uint8_t * peer_mac)2369 QDF_STATUS cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc,
2370 					 uint32_t peer_id, uint8_t *peer_mac)
2371 {
2372 	if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id)
2373 		return soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id(
2374 				soc, peer_id, peer_mac);
2375 
2376 	return QDF_STATUS_E_INVAL;
2377 }
2378 
2379 /**
2380  * cdp_vdev_tx_lock() - acquire lock
2381  * @soc: opaque soc handle
2382  * @vdev_id: id of data path vdev handle
2383  *
2384  * Return: void
2385  */
2386 static inline
cdp_vdev_tx_lock(ol_txrx_soc_handle soc,uint8_t vdev_id)2387 void cdp_vdev_tx_lock(ol_txrx_soc_handle soc,
2388 		      uint8_t vdev_id)
2389 {
2390 	if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock)
2391 		soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(soc, vdev_id);
2392 }
2393 
2394 /**
2395  * cdp_vdev_tx_unlock() - release lock
2396  * @soc: opaque soc handle
2397  * @vdev_id: id of data path vdev handle
2398  *
2399  * Return: void
2400  */
2401 static inline
cdp_vdev_tx_unlock(ol_txrx_soc_handle soc,uint8_t vdev_id)2402 void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc,
2403 			uint8_t vdev_id)
2404 {
2405 	if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock)
2406 		soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(soc, vdev_id);
2407 }
2408 
2409 /**
2410  * cdp_ath_getstats() - get updated athstats
2411  * @soc: opaque soc handle
2412  * @id: vdev_id/pdev_id based on type
2413  * @stats: cdp network device stats structure
2414  * @type: device type pdev/vdev
2415  *
2416  * Return: QDF_STATUS
2417  */
2418 static inline QDF_STATUS
cdp_ath_getstats(ol_txrx_soc_handle soc,uint8_t id,struct cdp_dev_stats * stats,uint8_t type)2419 cdp_ath_getstats(ol_txrx_soc_handle soc,
2420 		 uint8_t id, struct cdp_dev_stats *stats,
2421 		 uint8_t type)
2422 {
2423 	if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats)
2424 		return soc->ops->cmn_drv_ops->txrx_ath_getstats(soc, id,
2425 								stats, type);
2426 
2427 	return QDF_STATUS_E_FAILURE;
2428 }
2429 
2430 /**
2431  * cdp_set_gid_flag() - set groupid flag
2432  * @soc: opaque soc handle
2433  * @pdev_id: id of data path pdev handle
2434  * @mem_status: member status from grp management frame
2435  * @user_position: user position from grp management frame
2436  *
2437  * Return: QDF_STATUS
2438  */
2439 static inline QDF_STATUS
cdp_set_gid_flag(ol_txrx_soc_handle soc,uint8_t pdev_id,u_int8_t * mem_status,u_int8_t * user_position)2440 cdp_set_gid_flag(ol_txrx_soc_handle soc,
2441 		 uint8_t pdev_id, u_int8_t *mem_status,
2442 		 u_int8_t *user_position)
2443 {
2444 	if (soc->ops->cmn_drv_ops->txrx_set_gid_flag)
2445 		return soc->ops->cmn_drv_ops->txrx_set_gid_flag(soc, pdev_id,
2446 							 mem_status,
2447 							 user_position);
2448 	return QDF_STATUS_E_FAILURE;
2449 }
2450 
2451 /**
2452  * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version
2453  * @soc: opaque soc handle
2454  * @pdev_id: id of data path pdev handle
2455  *
2456  */
2457 static inline
cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc,uint8_t pdev_id)2458 uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc,
2459 					    uint8_t pdev_id)
2460 {
2461 	if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version)
2462 		return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(soc, pdev_id);
2463 	return 0;
2464 }
2465 
2466 /**
2467  * cdp_if_mgmt_drain() - Drain management frames
2468  * @soc: opaque soc handle
2469  * @vdev_id: id of vdev device
2470  * @force: number of frame in SW queue
2471  *
2472  * Return: void
2473  */
2474 static inline
cdp_if_mgmt_drain(ol_txrx_soc_handle soc,uint8_t vdev_id,int force)2475 void cdp_if_mgmt_drain(ol_txrx_soc_handle soc,
2476 		uint8_t vdev_id, int force)
2477 {
2478 	if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain)
2479 		soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(soc, vdev_id, force);
2480 }
2481 
2482 /**
2483  * cdp_peer_map_attach() - CDP API to allocate PEER map memory
2484  * @soc: opaque soc handle
2485  * @max_peers: number of peers created in FW
2486  * @max_ast_index: max number of AST index supported in FW
2487  * @peer_map_unmap_v: Indicates HTT peer map/unmap versions enabled in FW
2488  *
2489  * Return: QDF_STATUS
2490  */
2491 static inline QDF_STATUS
cdp_peer_map_attach(ol_txrx_soc_handle soc,uint32_t max_peers,uint32_t max_ast_index,uint8_t peer_map_unmap_v)2492 cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers,
2493 		    uint32_t max_ast_index, uint8_t peer_map_unmap_v)
2494 {
2495 	if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2496 	    soc->ops->cmn_drv_ops->txrx_peer_map_attach)
2497 		return soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc,
2498 							max_peers,
2499 							max_ast_index,
2500 							peer_map_unmap_v);
2501 
2502 	return QDF_STATUS_SUCCESS;
2503 }
2504 
2505 /**
2506  * cdp_soc_set_param() - CDP API to set soc parameters
2507  * @soc: opaque soc handle
2508  * @param: parameter type
2509  * @value: parameter value
2510  *
2511  *
2512  * Return: QDF_STATUS
2513  */
2514 static inline QDF_STATUS
cdp_soc_set_param(ol_txrx_soc_handle soc,enum cdp_soc_param_t param,uint32_t value)2515 cdp_soc_set_param(ol_txrx_soc_handle soc, enum cdp_soc_param_t param,
2516 		  uint32_t value)
2517 {
2518 	if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2519 	    soc->ops->cmn_drv_ops->set_soc_param)
2520 		return soc->ops->cmn_drv_ops->set_soc_param(soc, param,
2521 							value);
2522 
2523 	return QDF_STATUS_SUCCESS;
2524 }
2525 
2526 /**
2527  * cdp_txrx_classify_and_update() - To classify the packet and update stats
2528  * @soc: opaque soc handle
2529  * @vdev_id: vdev id
2530  * @skb: data
2531  * @dir: rx or tx packet
2532  * @nbuf_class: packet classification object
2533  *
2534  * Return: 1 on success else return 0
2535  */
2536 static inline int
cdp_txrx_classify_and_update(ol_txrx_soc_handle soc,uint8_t vdev_id,qdf_nbuf_t skb,enum txrx_direction dir,struct ol_txrx_nbuf_classify * nbuf_class)2537 cdp_txrx_classify_and_update(ol_txrx_soc_handle soc,
2538 			     uint8_t vdev_id, qdf_nbuf_t skb,
2539 			     enum txrx_direction dir,
2540 			     struct ol_txrx_nbuf_classify *nbuf_class)
2541 {
2542 	if (!soc || !soc->ops) {
2543 		dp_cdp_debug("Invalid Instance");
2544 		QDF_BUG(0);
2545 		return 0;
2546 	}
2547 
2548 	if (!soc->ops->cmn_drv_ops ||
2549 	    !soc->ops->cmn_drv_ops->txrx_classify_update)
2550 		return 0;
2551 
2552 	return soc->ops->cmn_drv_ops->txrx_classify_update(soc, vdev_id,
2553 							   skb,
2554 							   dir, nbuf_class);
2555 }
2556 
2557 /**
2558  * cdp_get_dp_capabilities() - get DP capabilities
2559  * @soc: opaque soc handle
2560  * @dp_caps: enum of DP capabilities
2561  *
2562  * Return: bool
2563  */
2564 static inline bool
cdp_get_dp_capabilities(struct cdp_soc_t * soc,enum cdp_capabilities dp_caps)2565 cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps)
2566 {
2567 	if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2568 	    soc->ops->cmn_drv_ops->get_dp_capabilities)
2569 		return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps);
2570 
2571 	qdf_err("invalid instance");
2572 	return false;
2573 }
2574 
2575 #ifdef RECEIVE_OFFLOAD
2576 /**
2577  * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer
2578  * @soc: data path soc handle
2579  * @rx_ol_flush_cb: Flush callback function
2580  *
2581  * register rx offload flush callback function pointer
2582  *
2583  * Return: none
2584  */
cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc,void (rx_ol_flush_cb)(void *))2585 static inline void cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc,
2586 						  void (rx_ol_flush_cb)(void *))
2587 {
2588 	if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
2589 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
2590 			  "%s invalid instance", __func__);
2591 		return;
2592 	}
2593 
2594 	if (soc->ops->rx_offld_ops->register_rx_offld_flush_cb)
2595 		return soc->ops->rx_offld_ops->register_rx_offld_flush_cb(
2596 								rx_ol_flush_cb);
2597 }
2598 
2599 /**
2600  * cdp_deregister_rx_offld_flush_cb() - deregister Rx offld flush cb function
2601  * @soc: data path soc handle
2602  *
2603  * deregister rx offload flush callback function pointer
2604  *
2605  * Return: none
2606  */
cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc)2607 static inline void cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc)
2608 {
2609 	if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
2610 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
2611 			  "%s invalid instance", __func__);
2612 		return;
2613 	}
2614 
2615 	if (soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb)
2616 		return soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb();
2617 }
2618 #endif /* RECEIVE_OFFLOAD */
2619 
2620 /**
2621  * cdp_set_ba_timeout() - set ba aging timeout per AC
2622  *
2623  * @soc: pointer to the soc
2624  * @value: timeout value in millisec
2625  * @ac: Access category
2626  *
2627  * Return: void
2628  */
cdp_set_ba_timeout(ol_txrx_soc_handle soc,uint8_t ac,uint32_t value)2629 static inline void cdp_set_ba_timeout(ol_txrx_soc_handle soc,
2630 				      uint8_t ac, uint32_t value)
2631 {
2632 	if (!soc || !soc->ops) {
2633 		dp_cdp_debug("Invalid Instance");
2634 		QDF_BUG(0);
2635 		return;
2636 	}
2637 
2638 	if (!soc->ops->cmn_drv_ops ||
2639 	    !soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout)
2640 		return;
2641 
2642 	soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout(soc, ac, value);
2643 }
2644 
2645 /**
2646  * cdp_get_ba_timeout() - return ba aging timeout per AC
2647  *
2648  * @soc: pointer to the soc
2649  * @ac: access category
2650  * @value: timeout value in millisec
2651  *
2652  * Return: void
2653  */
cdp_get_ba_timeout(ol_txrx_soc_handle soc,uint8_t ac,uint32_t * value)2654 static inline void cdp_get_ba_timeout(ol_txrx_soc_handle soc,
2655 				      uint8_t ac, uint32_t *value)
2656 {
2657 	if (!soc || !soc->ops) {
2658 		dp_cdp_debug("Invalid Instance");
2659 		QDF_BUG(0);
2660 		return;
2661 	}
2662 
2663 	if (!soc->ops->cmn_drv_ops ||
2664 	    !soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout)
2665 		return;
2666 
2667 	soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout(soc, ac, value);
2668 }
2669 
2670 /**
2671  * cdp_cfg_get() - get cfg for dp enum
2672  *
2673  * @soc: pointer to the soc
2674  * @cfg: cfg enum
2675  *
2676  * Return: cfg value
2677  */
cdp_cfg_get(ol_txrx_soc_handle soc,enum cdp_dp_cfg cfg)2678 static inline uint32_t cdp_cfg_get(ol_txrx_soc_handle soc, enum cdp_dp_cfg cfg)
2679 {
2680 	if (!soc || !soc->ops) {
2681 		dp_cdp_debug("Invalid Instance");
2682 		return 0;
2683 	}
2684 
2685 	if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_cfg)
2686 		return 0;
2687 
2688 	return soc->ops->cmn_drv_ops->txrx_get_cfg(soc, cfg);
2689 }
2690 
2691 /**
2692  * cdp_soc_set_rate_stats_ctx() - set rate stats context in soc
2693  * @soc: opaque soc handle
2694  * @ctx: rate stats context
2695  *
2696  * Return: void
2697  */
2698 static inline void
cdp_soc_set_rate_stats_ctx(ol_txrx_soc_handle soc,void * ctx)2699 cdp_soc_set_rate_stats_ctx(ol_txrx_soc_handle soc,
2700 			   void *ctx)
2701 {
2702 	if (!soc || !soc->ops) {
2703 		dp_cdp_debug("Invalid Instance:");
2704 		QDF_BUG(0);
2705 		return;
2706 	}
2707 
2708 	if (!soc->ops->cmn_drv_ops ||
2709 	    !soc->ops->cmn_drv_ops->set_rate_stats_ctx)
2710 		return;
2711 
2712 	soc->ops->cmn_drv_ops->set_rate_stats_ctx((struct cdp_soc_t *)soc,
2713 						  ctx);
2714 }
2715 
2716 /**
2717  * cdp_soc_get_rate_stats_ctx() - get rate stats context in soc
2718  * @soc: opaque soc handle
2719  *
2720  * Return: void
2721  */
2722 static inline void*
cdp_soc_get_rate_stats_ctx(ol_txrx_soc_handle soc)2723 cdp_soc_get_rate_stats_ctx(ol_txrx_soc_handle soc)
2724 {
2725 	if (!soc || !soc->ops) {
2726 		dp_cdp_debug("Invalid Instance:");
2727 		QDF_BUG(0);
2728 		return NULL;
2729 	}
2730 
2731 	if (!soc->ops->cmn_drv_ops ||
2732 	    !soc->ops->cmn_drv_ops->get_rate_stats_ctx)
2733 		return NULL;
2734 
2735 	return soc->ops->cmn_drv_ops->get_rate_stats_ctx(soc);
2736 }
2737 
2738 /**
2739  * cdp_peer_flush_rate_stats() - flush peer rate statistics
2740  * @soc: opaque soc handle
2741  * @pdev_id: id of pdev handle
2742  * @buf: stats buffer
2743  */
2744 static inline void
cdp_peer_flush_rate_stats(ol_txrx_soc_handle soc,uint8_t pdev_id,void * buf)2745 cdp_peer_flush_rate_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
2746 			  void *buf)
2747 {
2748 	if (!soc || !soc->ops) {
2749 		dp_cdp_debug("Invalid Instance:");
2750 		QDF_BUG(0);
2751 		return;
2752 	}
2753 
2754 	if (!soc->ops->cmn_drv_ops ||
2755 	    !soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats)
2756 		return;
2757 
2758 	soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats(soc, pdev_id, buf);
2759 }
2760 
2761 /**
2762  * cdp_peer_get_peerstats_ctx() - get peer stats context
2763  * @soc: opaque soc handle
2764  * @vdev_id: id of vdev handle
2765  * @mac_addr: peer mac address
2766  */
2767 static inline void
cdp_peer_get_peerstats_ctx(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * mac_addr)2768 *cdp_peer_get_peerstats_ctx(ol_txrx_soc_handle soc, uint8_t vdev_id,
2769 			    uint8_t *mac_addr)
2770 {
2771 	if (!soc || !soc->ops) {
2772 		dp_cdp_debug("Invalid Instance:");
2773 		QDF_BUG(0);
2774 		return NULL;
2775 	}
2776 
2777 	if (!soc->ops->cmn_drv_ops ||
2778 	    !soc->ops->cmn_drv_ops->txrx_peer_get_peerstats_ctx)
2779 		return NULL;
2780 
2781 	return soc->ops->cmn_drv_ops->txrx_peer_get_peerstats_ctx(soc,
2782 								  vdev_id,
2783 								  mac_addr);
2784 }
2785 
2786 /**
2787  * cdp_flush_rate_stats_request() - request flush rate statistics
2788  * @soc: opaque soc handle
2789  * @pdev_id: id of pdev handle
2790  */
2791 static inline QDF_STATUS
cdp_flush_rate_stats_request(struct cdp_soc_t * soc,uint8_t pdev_id)2792 cdp_flush_rate_stats_request(struct cdp_soc_t *soc, uint8_t pdev_id)
2793 {
2794 	if (!soc || !soc->ops) {
2795 		dp_cdp_debug("Invalid Instance:");
2796 		QDF_BUG(0);
2797 		return QDF_STATUS_E_FAILURE;
2798 	}
2799 
2800 	if (!soc->ops->cmn_drv_ops ||
2801 	    !soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request)
2802 		return QDF_STATUS_E_FAILURE;
2803 
2804 	return soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request(soc,
2805 								    pdev_id);
2806 }
2807 
2808 /**
2809  * cdp_set_vdev_pcp_tid_map() - set vdev pcp-tid-map
2810  * @soc: opaque soc handle
2811  * @vdev_id: id of data path vdev handle
2812  * @pcp: pcp value
2813  * @tid: tid value
2814  *
2815  * This API is used to configure the pcp-to-tid mapping for a pdev.
2816  *
2817  * Return: QDF_STATUS_SUCCESS if value set successfully
2818  *          QDF_STATUS_E_INVAL false if error
2819  */
2820 static inline
cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t pcp,uint8_t tid)2821 QDF_STATUS cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc,
2822 				    uint8_t vdev_id,
2823 				    uint8_t pcp, uint8_t tid)
2824 {
2825 	if (!soc || !soc->ops) {
2826 		dp_cdp_debug("Invalid Instance");
2827 		return QDF_STATUS_E_INVAL;
2828 	}
2829 
2830 	if (!soc->ops->cmn_drv_ops ||
2831 	    !soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map)
2832 		return QDF_STATUS_E_INVAL;
2833 
2834 	return soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map(soc, vdev_id,
2835 							   pcp, tid);
2836 }
2837 
2838 /**
2839  * cdp_tx_send_exc() - Transmit a frame on a given vdev in exception path
2840  *
2841  * @soc: opaque soc handle
2842  * @vdev_id: vdev id
2843  * @nbuf: skb
2844  * @tx_exc_metadata: Handle that holds exception path meta data
2845  *
2846  * Return: NULL on success
2847  *         nbuf when it fails to send
2848  */
2849 static inline qdf_nbuf_t
cdp_tx_send_exc(ol_txrx_soc_handle soc,uint8_t vdev_id,qdf_nbuf_t nbuf,struct cdp_tx_exception_metadata * tx_exc_metadata)2850 cdp_tx_send_exc(ol_txrx_soc_handle soc,
2851 		uint8_t vdev_id,
2852 		qdf_nbuf_t nbuf,
2853 		struct cdp_tx_exception_metadata *tx_exc_metadata)
2854 {
2855 	if (!soc || !soc->ops) {
2856 		dp_cdp_debug("Invalid Instance");
2857 		QDF_BUG(0);
2858 		return 0;
2859 	}
2860 
2861 	if (!soc->ops->cmn_drv_ops ||
2862 	    !soc->ops->cmn_drv_ops->tx_send_exc)
2863 		return 0;
2864 
2865 	return soc->ops->cmn_drv_ops->tx_send_exc
2866 			(soc, vdev_id, nbuf, tx_exc_metadata);
2867 }
2868 
2869 /**
2870  * cdp_vdev_get_peer_mac_list(): function to get peer mac list of vdev
2871  * @soc: Datapath soc handle
2872  * @vdev_id: vdev id
2873  * @newmac: Table of the clients mac
2874  * @mac_cnt: No. of MACs required
2875  * @limit: Limit the number of clients
2876  *
2877  * return: no of clients
2878  */
2879 static inline uint16_t
cdp_vdev_get_peer_mac_list(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t newmac[][QDF_MAC_ADDR_SIZE],uint16_t mac_cnt,bool limit)2880 cdp_vdev_get_peer_mac_list(ol_txrx_soc_handle soc,
2881 			   uint8_t vdev_id,
2882 			   uint8_t newmac[][QDF_MAC_ADDR_SIZE],
2883 			   uint16_t mac_cnt, bool limit)
2884 {
2885 	if (!soc || !soc->ops) {
2886 		dp_cdp_debug("Invalid Instance");
2887 		QDF_BUG(0);
2888 		return 0;
2889 	}
2890 
2891 	if (!soc->ops->cmn_drv_ops ||
2892 	    !soc->ops->cmn_drv_ops->get_peer_mac_list)
2893 		return 0;
2894 
2895 	return soc->ops->cmn_drv_ops->get_peer_mac_list
2896 			(soc, vdev_id, newmac, mac_cnt, limit);
2897 }
2898 
2899 /**
2900  * cdp_soc_config_full_mon_mode () - Configure Full monitor mode
2901  *
2902  * @soc: dp soc handle
2903  * @val: value to be configured val should be 0 or 1
2904  *
2905  * This API is used to enable/disable support for Full monitor mode feature
2906  *
2907  * Return: QDF_STATUS_SUCCESS if value set successfully
2908  *         QDF_STATUS_E_INVAL false if error
2909  */
2910 static inline QDF_STATUS
cdp_soc_config_full_mon_mode(ol_txrx_soc_handle soc,uint8_t val)2911 cdp_soc_config_full_mon_mode(ol_txrx_soc_handle soc, uint8_t val)
2912 {
2913 	if (!soc || !soc->ops) {
2914 		dp_cdp_debug("Invalid Instance");
2915 		return QDF_STATUS_E_INVAL;
2916 	}
2917 
2918 	if (!soc->ops->mon_ops ||
2919 	    !soc->ops->mon_ops->config_full_mon_mode)
2920 		return QDF_STATUS_E_INVAL;
2921 
2922 	return soc->ops->mon_ops->config_full_mon_mode(soc, val);
2923 }
2924 
2925 /**
2926  * cdp_rx_get_pending() - Get number of pending frames of RX threads
2927  * @soc: opaque soc handle
2928  * Return: number of pending frames
2929  */
2930 static inline int
cdp_rx_get_pending(ol_txrx_soc_handle soc)2931 cdp_rx_get_pending(ol_txrx_soc_handle soc)
2932 {
2933 	if (!soc || !soc->ol_ops ||
2934 	    !soc->ol_ops->dp_rx_get_pending)
2935 		return 0;
2936 
2937 	if (cdp_cfg_get(soc, cfg_dp_wow_check_rx_pending))
2938 		return soc->ol_ops->dp_rx_get_pending(soc);
2939 	else
2940 		return 0;
2941 }
2942 
2943 static inline uint16_t
cdp_get_peer_id(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * mac)2944 cdp_get_peer_id(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *mac)
2945 {
2946 	if (!soc || !soc->ops) {
2947 		dp_cdp_debug("Invalid Instance");
2948 		QDF_BUG(0);
2949 		return 0;
2950 	}
2951 
2952 	if (!soc->ops->cmn_drv_ops ||
2953 	    !soc->ops->cmn_drv_ops->get_peer_id)
2954 		return 0;
2955 
2956 	return soc->ops->cmn_drv_ops->get_peer_id
2957 			(soc, vdev_id, mac);
2958 }
2959 
2960 #ifdef QCA_SUPPORT_WDS_EXTENDED
2961 static inline QDF_STATUS
cdp_wds_ext_set_peer_rx(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * mac,ol_txrx_rx_fp rx,ol_osif_peer_handle osif_peer)2962 cdp_wds_ext_set_peer_rx(ol_txrx_soc_handle soc, uint8_t vdev_id,
2963 			uint8_t *mac, ol_txrx_rx_fp rx,
2964 			ol_osif_peer_handle osif_peer)
2965 {
2966 	if (!soc || !soc->ops) {
2967 		dp_cdp_debug("Invalid Instance");
2968 		QDF_BUG(0);
2969 		return QDF_STATUS_E_FAULT;
2970 	}
2971 
2972 	if (!soc->ops->cmn_drv_ops ||
2973 	    !soc->ops->cmn_drv_ops->set_wds_ext_peer_rx)
2974 		return QDF_STATUS_E_FAULT;
2975 
2976 	return soc->ops->cmn_drv_ops->set_wds_ext_peer_rx
2977 			(soc, vdev_id, mac, rx, osif_peer);
2978 }
2979 
2980 static inline QDF_STATUS
cdp_wds_ext_get_peer_osif_handle(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * mac,ol_osif_peer_handle * osif_peer)2981 cdp_wds_ext_get_peer_osif_handle(
2982 			ol_txrx_soc_handle soc, uint8_t vdev_id,
2983 			uint8_t *mac,
2984 			ol_osif_peer_handle *osif_peer)
2985 {
2986 	if (!soc || !soc->ops) {
2987 		dp_cdp_debug("Invalid Instance");
2988 		QDF_BUG(0);
2989 		return QDF_STATUS_E_FAULT;
2990 	}
2991 
2992 	if (!soc->ops->cmn_drv_ops ||
2993 	    !soc->ops->cmn_drv_ops->get_wds_ext_peer_osif_handle)
2994 		return QDF_STATUS_E_FAULT;
2995 
2996 	return soc->ops->cmn_drv_ops->get_wds_ext_peer_osif_handle
2997 			(soc, vdev_id, mac, osif_peer);
2998 }
2999 
3000 /**
3001  * cdp_wds_ext_set_bit() - set wds-ext peer bit
3002  * @soc: soc handle
3003  * @mac: peer mac address
3004  *
3005  * Return: QDF_STATUS
3006  */
3007 static inline QDF_STATUS
cdp_wds_ext_set_bit(ol_txrx_soc_handle soc,uint8_t * mac)3008 cdp_wds_ext_set_bit(ol_txrx_soc_handle soc, uint8_t *mac)
3009 {
3010 	if (!soc || !soc->ops) {
3011 		dp_cdp_debug("Invalid Instance");
3012 		QDF_BUG(0);
3013 		return QDF_STATUS_E_FAULT;
3014 	}
3015 
3016 	if (!soc->ops->cmn_drv_ops ||
3017 	    !soc->ops->cmn_drv_ops->set_wds_ext_peer_bit)
3018 		return QDF_STATUS_E_FAULT;
3019 
3020 	return soc->ops->cmn_drv_ops->set_wds_ext_peer_bit(soc, mac);
3021 }
3022 #endif /* QCA_SUPPORT_WDS_EXTENDED */
3023 
3024 /**
3025  * cdp_drain_txrx() - drain TX/RX SRNGs
3026  * @soc: opaque soc handle
3027  * @rx_only: drain only RX rings
3028  *
3029  * Return: QDF_STATUS
3030  */
3031 static inline QDF_STATUS
cdp_drain_txrx(ol_txrx_soc_handle soc,uint8_t rx_only)3032 cdp_drain_txrx(ol_txrx_soc_handle soc, uint8_t rx_only)
3033 {
3034 	if (!soc || !soc->ops) {
3035 		dp_cdp_debug("Invalid Instance");
3036 		QDF_BUG(0);
3037 		return QDF_STATUS_E_FAULT;
3038 	}
3039 
3040 	if (!soc->ops->cmn_drv_ops ||
3041 	    !soc->ops->cmn_drv_ops->txrx_drain)
3042 		return QDF_STATUS_E_FAULT;
3043 
3044 	return soc->ops->cmn_drv_ops->txrx_drain(soc, rx_only);
3045 }
3046 
3047 /**
3048  * cdp_get_free_desc_poolsize() - get free desc pool size
3049  * @soc: opaque soc handle
3050  */
3051 static inline int
cdp_get_free_desc_poolsize(ol_txrx_soc_handle soc)3052 cdp_get_free_desc_poolsize(ol_txrx_soc_handle soc)
3053 {
3054 	if (!soc || !soc->ops) {
3055 		dp_cdp_debug("Invalid Instance");
3056 		QDF_BUG(0);
3057 		return 0;
3058 	}
3059 
3060 	if (!soc->ops->cmn_drv_ops ||
3061 	    !soc->ops->cmn_drv_ops->get_free_desc_poolsize)
3062 		return 0;
3063 
3064 	return soc->ops->cmn_drv_ops->get_free_desc_poolsize(soc);
3065 }
3066 
3067 #ifdef WLAN_FEATURE_PKT_CAPTURE_V2
3068 /**
3069  * cdp_set_pkt_capture_mode() - set pkt capture mode in dp ctx
3070  * @soc: opaque soc handle
3071  * @val: value to be set
3072  */
3073 static inline void
cdp_set_pkt_capture_mode(ol_txrx_soc_handle soc,bool val)3074 cdp_set_pkt_capture_mode(ol_txrx_soc_handle soc, bool val)
3075 {
3076 	if (!soc || !soc->ops) {
3077 		dp_cdp_debug("Invalid Instance");
3078 		QDF_BUG(0);
3079 		return;
3080 	}
3081 
3082 	if (!soc->ops->cmn_drv_ops ||
3083 	    !soc->ops->cmn_drv_ops->set_pkt_capture_mode)
3084 		return;
3085 
3086 	soc->ops->cmn_drv_ops->set_pkt_capture_mode(soc, val);
3087 }
3088 #else
3089 static inline void
cdp_set_pkt_capture_mode(ol_txrx_soc_handle soc,bool val)3090 cdp_set_pkt_capture_mode(ol_txrx_soc_handle soc, bool val)
3091 {
3092 }
3093 #endif
3094 
3095 /**
3096  * cdp_get_tx_inqueue() - Get number of Tx frames that are queued
3097  * @soc: opaque soc handle
3098  *
3099  * Return: number of queued frames
3100  */
3101 static inline uint32_t
cdp_get_tx_inqueue(ol_txrx_soc_handle soc)3102 cdp_get_tx_inqueue(ol_txrx_soc_handle soc)
3103 {
3104 	if (!soc || !soc->ol_ops ||
3105 	    !soc->ol_ops->dp_get_tx_inqueue)
3106 		return 0;
3107 
3108 	return soc->ol_ops->dp_get_tx_inqueue(soc);
3109 }
3110 
3111 #ifdef FEATURE_RUNTIME_PM
3112 
3113 /**
3114  * cdp_set_rtpm_tput_policy_requirement() - Set RTPM throughput policy
3115  * @soc: opaque soc handle
3116  * @is_high_tput: flag indicating whether throughput requirement is high or not
3117  *
3118  * The functions sets RTPM throughput policy requirement. If 'is_high_tput' is
3119  * set, the expectation is that runtime_pm APIs will not be invoked per packet.
3120  */
3121 
3122 static inline
cdp_set_rtpm_tput_policy_requirement(ol_txrx_soc_handle soc,bool is_high_tput)3123 void cdp_set_rtpm_tput_policy_requirement(ol_txrx_soc_handle soc,
3124 					  bool is_high_tput)
3125 {
3126 	if (!soc || !soc->ops) {
3127 		dp_cdp_debug("Invalid Instance");
3128 		QDF_BUG(0);
3129 		return;
3130 	}
3131 
3132 	if (!soc->ops->cmn_drv_ops ||
3133 	    !soc->ops->cmn_drv_ops->set_rtpm_tput_policy)
3134 		return;
3135 
3136 	soc->ops->cmn_drv_ops->set_rtpm_tput_policy(soc, is_high_tput);
3137 }
3138 #else
3139 static inline
cdp_set_rtpm_tput_policy_requirement(ol_txrx_soc_handle soc,bool is_high_tput)3140 void cdp_set_rtpm_tput_policy_requirement(ol_txrx_soc_handle soc,
3141 					  bool is_high_tput)
3142 {
3143 }
3144 
3145 #endif /* FEATURE_RUNTIME_PM */
3146 
3147 /**
3148  * cdp_enable_mon_reap_timer() - enable/disable reap timer
3149  * @soc: Datapath soc handle
3150  * @source: monitor reap source
3151  * @enable: enable/disable reap timer of monitor status ring
3152  *
3153  * Return: true if timer start/stop is performed, false otherwise.
3154  */
3155 static inline bool
cdp_enable_mon_reap_timer(ol_txrx_soc_handle soc,enum cdp_mon_reap_source source,bool enable)3156 cdp_enable_mon_reap_timer(ol_txrx_soc_handle soc,
3157 			  enum cdp_mon_reap_source source,
3158 			  bool enable)
3159 {
3160 	if (!soc || !soc->ops) {
3161 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
3162 			  "%s invalid instance", __func__);
3163 		QDF_BUG(0);
3164 		return false;
3165 	}
3166 
3167 	if (!soc->ops->mon_ops ||
3168 	    !soc->ops->mon_ops->txrx_enable_mon_reap_timer)
3169 		return false;
3170 
3171 	return soc->ops->mon_ops->txrx_enable_mon_reap_timer(soc, source,
3172 							     enable);
3173 }
3174 
3175 /**
3176  * cdp_get_tsf_time() - get tsf time
3177  * @soc: Datapath soc handle
3178  * @tsf_id:
3179  * @mac_id: mac_id
3180  * @tsf: pointer to update tsf value
3181  * @tsf_sync_soc_time: pointer to update tsf sync time
3182  *
3183  * Return: None.
3184  */
3185 static inline void
cdp_get_tsf_time(ol_txrx_soc_handle soc,uint32_t tsf_id,uint32_t mac_id,uint64_t * tsf,uint64_t * tsf_sync_soc_time)3186 cdp_get_tsf_time(ol_txrx_soc_handle soc, uint32_t tsf_id, uint32_t mac_id,
3187 		 uint64_t *tsf, uint64_t *tsf_sync_soc_time)
3188 {
3189 	if (!soc) {
3190 		dp_cdp_debug("Invalid Instance");
3191 		return;
3192 	}
3193 	if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_tsf_time)
3194 		return;
3195 
3196 	soc->ops->cmn_drv_ops->txrx_get_tsf_time(soc, tsf_id, mac_id, tsf,
3197 						 tsf_sync_soc_time);
3198 }
3199 
3200 /**
3201  * cdp_get_tsf2_offset() - get tsf2 offset
3202  * @soc: Datapath soc handle
3203  * @mac_id: mac_id
3204  * @value: pointer to update tsf2 value
3205  *
3206  * Return: None.
3207  */
3208 static inline void
cdp_get_tsf2_offset(ol_txrx_soc_handle soc,uint8_t mac_id,uint64_t * value)3209 cdp_get_tsf2_offset(ol_txrx_soc_handle soc, uint8_t mac_id, uint64_t *value)
3210 {
3211 	if (!soc) {
3212 		dp_cdp_debug("Invalid Instance");
3213 		return;
3214 	}
3215 	if (!soc->ops->cmn_drv_ops ||
3216 	    !soc->ops->cmn_drv_ops->txrx_get_tsf2_offset)
3217 		return;
3218 
3219 	soc->ops->cmn_drv_ops->txrx_get_tsf2_offset(soc, mac_id, value);
3220 }
3221 
3222 /**
3223  * cdp_get_tqm_offset() - get tqm offset
3224  * @soc: Datapath soc handle
3225  * @value: pointer to update tqm value
3226  *
3227  * Return: None.
3228  */
3229 static inline void
cdp_get_tqm_offset(ol_txrx_soc_handle soc,uint64_t * value)3230 cdp_get_tqm_offset(ol_txrx_soc_handle soc, uint64_t *value)
3231 {
3232 	if (!soc) {
3233 		dp_cdp_debug("Invalid Instance");
3234 		return;
3235 	}
3236 	if (!soc->ops->cmn_drv_ops ||
3237 	    !soc->ops->cmn_drv_ops->txrx_get_tqm_offset)
3238 		return;
3239 
3240 	soc->ops->cmn_drv_ops->txrx_get_tqm_offset(soc, value);
3241 }
3242 
cdp_get_fst_cem_base(ol_txrx_soc_handle soc,uint64_t size)3243 static inline uint64_t cdp_get_fst_cem_base(ol_txrx_soc_handle soc,
3244 					    uint64_t size)
3245 {
3246 	if (!soc) {
3247 		dp_cdp_debug("Invalid Instance");
3248 		return 0;
3249 	}
3250 
3251 	if (!soc->ops->cmn_drv_ops ||
3252 	    !soc->ops->cmn_drv_ops->get_fst_cmem_base)
3253 		return 0;
3254 
3255 	return soc->ops->cmn_drv_ops->get_fst_cmem_base(soc, size);
3256 }
3257 
3258 #if defined(WLAN_FEATURE_11BE_MLO)
3259 /*
3260  * cdp_mlo_dev_ctxt_create - DP MLO Device context create
3261  * @soc: soc handle
3262  * @mld_mac_addr: MLD MAC Address
3263  *
3264  * return: QDF_STATUS
3265  */
3266 static inline
cdp_mlo_dev_ctxt_create(ol_txrx_soc_handle soc,uint8_t * mld_mac_addr)3267 QDF_STATUS cdp_mlo_dev_ctxt_create(ol_txrx_soc_handle soc,
3268 				   uint8_t *mld_mac_addr)
3269 {
3270 	if (!soc || !soc->ops) {
3271 		QDF_BUG(0);
3272 		return QDF_STATUS_E_FAILURE;
3273 	}
3274 
3275 	if (!soc->ops->cmn_mlo_ops ||
3276 	    !soc->ops->cmn_mlo_ops->mlo_dev_ctxt_create)
3277 		return QDF_STATUS_E_FAILURE;
3278 
3279 	return soc->ops->cmn_mlo_ops->mlo_dev_ctxt_create(soc, mld_mac_addr);
3280 }
3281 
3282 /*
3283  * cdp_mlo_dev_ctxt_destroy - DP MLO Device context destroy
3284  * @soc: soc handle
3285  * @mld_mac_addr: MLD MAC Address
3286  *
3287  * return: QDF_STATUS
3288  */
3289 static inline
cdp_mlo_dev_ctxt_destroy(ol_txrx_soc_handle soc,uint8_t * mld_mac_addr)3290 QDF_STATUS cdp_mlo_dev_ctxt_destroy(ol_txrx_soc_handle soc,
3291 				    uint8_t *mld_mac_addr)
3292 {
3293 	if (!soc || !soc->ops) {
3294 		QDF_BUG(0);
3295 		return QDF_STATUS_E_FAILURE;
3296 	}
3297 
3298 	if (!soc->ops->cmn_mlo_ops ||
3299 	    !soc->ops->cmn_mlo_ops->mlo_dev_ctxt_destroy)
3300 		return QDF_STATUS_E_FAILURE;
3301 
3302 	return soc->ops->cmn_mlo_ops->mlo_dev_ctxt_destroy(soc, mld_mac_addr);
3303 }
3304 
3305 /*
3306  * cdp_mlo_dev_ctxt_attach - DP MLO Device context attach vdev
3307  * @soc: soc handle
3308  * @vdev_id: vdev id
3309  * @mld_mac_addr: MLD MAC Address
3310  *
3311  * return: QDF_STATUS
3312  */
3313 static inline
cdp_mlo_dev_ctxt_attach(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * mld_mac_addr)3314 QDF_STATUS cdp_mlo_dev_ctxt_attach(ol_txrx_soc_handle soc,
3315 				   uint8_t vdev_id,
3316 				   uint8_t *mld_mac_addr)
3317 {
3318 	if (!soc || !soc->ops) {
3319 		QDF_BUG(0);
3320 		return QDF_STATUS_E_FAILURE;
3321 	}
3322 
3323 	if (!soc->ops->cmn_mlo_ops ||
3324 	    !soc->ops->cmn_mlo_ops->mlo_dev_ctxt_attach)
3325 		return QDF_STATUS_E_FAILURE;
3326 
3327 	return soc->ops->cmn_mlo_ops->mlo_dev_ctxt_attach(soc, vdev_id,
3328 							  mld_mac_addr);
3329 }
3330 
3331 /*
3332  * cdp_mlo_dev_ctxt_detach - DP MLO Device context detach vdev
3333  * @soc: soc handle
3334  * @vdev_id: vdev id
3335  * @mld_mac_addr: MLD MAC Address
3336  *
3337  * return: QDF_STATUS
3338  */
3339 static inline
cdp_mlo_dev_ctxt_detach(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * mld_mac_addr)3340 QDF_STATUS cdp_mlo_dev_ctxt_detach(ol_txrx_soc_handle soc,
3341 				   uint8_t vdev_id,
3342 				   uint8_t *mld_mac_addr)
3343 {
3344 	if (!soc || !soc->ops) {
3345 		QDF_BUG(0);
3346 		return QDF_STATUS_E_FAILURE;
3347 	}
3348 
3349 	if (!soc->ops->cmn_mlo_ops ||
3350 	    !soc->ops->cmn_mlo_ops->mlo_dev_ctxt_detach)
3351 		return QDF_STATUS_E_FAILURE;
3352 
3353 	return soc->ops->cmn_mlo_ops->mlo_dev_ctxt_detach(soc, vdev_id,
3354 							  mld_mac_addr);
3355 }
3356 #else
3357 static inline
cdp_mlo_dev_ctxt_create(ol_txrx_soc_handle soc,uint8_t * mld_mac_addr)3358 QDF_STATUS cdp_mlo_dev_ctxt_create(ol_txrx_soc_handle soc,
3359 				   uint8_t *mld_mac_addr)
3360 {
3361 	return QDF_STATUS_SUCCESS;
3362 }
3363 
3364 static inline
cdp_mlo_dev_ctxt_destroy(ol_txrx_soc_handle soc,uint8_t * mld_mac_addr)3365 QDF_STATUS cdp_mlo_dev_ctxt_destroy(ol_txrx_soc_handle soc,
3366 				    uint8_t *mld_mac_addr)
3367 {
3368 	return QDF_STATUS_SUCCESS;
3369 }
3370 
3371 static inline
cdp_mlo_dev_ctxt_attach(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * mld_mac_addr)3372 QDF_STATUS cdp_mlo_dev_ctxt_attach(ol_txrx_soc_handle soc,
3373 				   uint8_t vdev_id,
3374 				   uint8_t *mld_mac_addr)
3375 {
3376 	return QDF_STATUS_SUCCESS;
3377 }
3378 
3379 static inline
cdp_mlo_dev_ctxt_detach(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * mld_mac_addr)3380 QDF_STATUS cdp_mlo_dev_ctxt_detach(ol_txrx_soc_handle soc,
3381 				   uint8_t vdev_id,
3382 				   uint8_t *mld_mac_addr)
3383 {
3384 	return QDF_STATUS_SUCCESS;
3385 }
3386 #endif /* WLAN_FEATURE_11BE_MLO */
3387 
3388 #ifdef WLAN_SUPPORT_DPDK
3389 /*
3390  * cdp_dpdk_get_ring_info - get dp ring info for dpdk
3391  * @soc: soc handle
3392  * @uio_info: pointer to fill dp ring info
3393  *
3394  * Return: no. of mappings filled
3395  */
cdp_dpdk_get_ring_info(ol_txrx_soc_handle soc,qdf_uio_info_t * uio_info)3396 static inline uint8_t cdp_dpdk_get_ring_info(ol_txrx_soc_handle soc,
3397 					     qdf_uio_info_t *uio_info)
3398 {
3399 	if (!soc) {
3400 		dp_cdp_debug("Invalid Instance");
3401 		return 0;
3402 	}
3403 
3404 	if (!soc->ops->cmn_drv_ops ||
3405 	    !soc->ops->cmn_drv_ops->dpdk_get_ring_info)
3406 		return 0;
3407 
3408 	return soc->ops->cmn_drv_ops->dpdk_get_ring_info(soc, uio_info);
3409 }
3410 
3411 /*
3412  * cdp_cfgmgr_get_soc_info - get soc info for dpdk
3413  * @soc: soc handle
3414  * @soc_id: soc id
3415  * @ev_buf: pointer to fill soc info
3416  *
3417  * Return: 0 if info filled successful, error otherwise
3418  */
3419 static inline
cdp_cfgmgr_get_soc_info(struct cdp_soc_t * soc,uint8_t soc_id,struct dpdk_wlan_soc_info_event * ev_buf)3420 int cdp_cfgmgr_get_soc_info(struct cdp_soc_t *soc, uint8_t soc_id,
3421 			    struct dpdk_wlan_soc_info_event *ev_buf)
3422 {
3423 	if (!soc) {
3424 		dp_cdp_debug("Invalid Instance");
3425 		return -EINVAL;
3426 	}
3427 
3428 	if (!soc->ops->cmn_drv_ops ||
3429 	    !soc->ops->cmn_drv_ops->cfgmgr_get_soc_info)
3430 		return -EINVAL;
3431 
3432 	return soc->ops->cmn_drv_ops->cfgmgr_get_soc_info(soc, soc_id, ev_buf);
3433 }
3434 
3435 /*
3436  * cdp_cfgmgr_get_vdev_info - get vdev info of a soc for dpdk
3437  * @soc: soc handle
3438  * @soc_id: soc id
3439  * @ev_buf: pointer to fill vdev info
3440  *
3441  * Return: 0 if info filled successful, error otherwise
3442  */
3443 static inline
cdp_cfgmgr_get_vdev_info(struct cdp_soc_t * soc,uint8_t soc_id,struct dpdk_wlan_vdev_info_event * ev_buf)3444 int cdp_cfgmgr_get_vdev_info(struct cdp_soc_t *soc, uint8_t soc_id,
3445 			     struct dpdk_wlan_vdev_info_event *ev_buf)
3446 {
3447 	if (!soc) {
3448 		dp_cdp_debug("Invalid Instance");
3449 		return -EINVAL;
3450 	}
3451 
3452 	if (!soc->ops->cmn_drv_ops ||
3453 	    !soc->ops->cmn_drv_ops->cfgmgr_get_vdev_info)
3454 		return -EINVAL;
3455 
3456 	return soc->ops->cmn_drv_ops->cfgmgr_get_vdev_info(soc, soc_id, ev_buf);
3457 }
3458 
3459 /*
3460  * cdp_cfgmgr_get_peer_info - get peer info of a soc for dpdk
3461  * @soc: soc handle
3462  * @soc_id: soc id
3463  * @ev_buf: pointer to fill peer info
3464  *
3465  * Return: 0 if info filled successful, error otherwise
3466  */
3467 static inline
cdp_cfgmgr_get_peer_info(struct cdp_soc_t * soc,uint8_t soc_id,struct dpdk_wlan_peer_info * ev_buf)3468 int cdp_cfgmgr_get_peer_info(struct cdp_soc_t *soc, uint8_t soc_id,
3469 			     struct dpdk_wlan_peer_info *ev_buf)
3470 {
3471 	if (!soc) {
3472 		dp_cdp_debug("Invalid Instance");
3473 		return -EINVAL;
3474 	}
3475 
3476 	if (!soc->ops->cmn_drv_ops ||
3477 	    !soc->ops->cmn_drv_ops->cfgmgr_get_peer_info)
3478 		return -EINVAL;
3479 
3480 	return soc->ops->cmn_drv_ops->cfgmgr_get_peer_info(soc, soc_id, ev_buf);
3481 }
3482 
3483 /*
3484  * cdp_cfgmgr_get_vdev_create_evt_info - get vdev create info of a soc for dpdk
3485  * @soc: soc handle
3486  * @vdev_id: vdev id
3487  * @ev_buf: pointer to fill vdev info
3488  *
3489  * Return: 0 if info filled successful, error otherwise
3490  */
3491 static inline
cdp_cfgmgr_get_vdev_create_evt_info(struct cdp_soc_t * soc,uint8_t vdev_id,struct dpdk_wlan_vdev_create_info * ev_buf)3492 int cdp_cfgmgr_get_vdev_create_evt_info(struct cdp_soc_t *soc, uint8_t vdev_id,
3493 					struct dpdk_wlan_vdev_create_info *ev_buf)
3494 {
3495 	if (!soc) {
3496 		dp_cdp_debug("Invalid Instance");
3497 		return -EINVAL;
3498 	}
3499 
3500 	if (!soc->ops->cmn_drv_ops ||
3501 	    !soc->ops->cmn_drv_ops->cfgmgr_get_vdev_create_evt_info)
3502 		return -EINVAL;
3503 
3504 	return soc->ops->cmn_drv_ops->cfgmgr_get_vdev_create_evt_info(
3505 						soc, vdev_id, ev_buf);
3506 }
3507 
3508 /*
3509  * cdp_cfgmgr_get_peer_create_evt_info - get peer create info of a soc for dpdk
3510  * @soc: soc handle
3511  * @peer_id: peer id
3512  * @ev_buf: pointer to fill peer info
3513  *
3514  * Return: 0 if info filled successful, error otherwise
3515  */
3516 static inline
cdp_cfgmgr_get_peer_create_evt_info(struct cdp_soc_t * soc,uint16_t peer_id,struct dpdk_wlan_peer_create_info * ev_buf)3517 int cdp_cfgmgr_get_peer_create_evt_info(struct cdp_soc_t *soc, uint16_t peer_id,
3518 					struct dpdk_wlan_peer_create_info *ev_buf)
3519 {
3520 	if (!soc) {
3521 		dp_cdp_debug("Invalid Instance");
3522 		return -EINVAL;
3523 	}
3524 
3525 	if (!soc->ops->cmn_drv_ops ||
3526 	    !soc->ops->cmn_drv_ops->cfgmgr_get_peer_create_evt_info)
3527 		return -EINVAL;
3528 
3529 	return soc->ops->cmn_drv_ops->cfgmgr_get_peer_create_evt_info(
3530 						soc, peer_id, ev_buf);
3531 }
3532 #endif
3533 #endif /* _CDP_TXRX_CMN_H_ */
3534