xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_cmn.h (revision f28396d060cff5c6519f883cb28ae0116ce479f1)
1 /*
2  * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * @file cdp_txrx_cmn.h
21  * @brief Define the host data path converged API functions
22  * called by the host control SW and the OS interface module
23  */
24 #ifndef _CDP_TXRX_CMN_H_
25 #define _CDP_TXRX_CMN_H_
26 
27 #include "qdf_types.h"
28 #include "qdf_nbuf.h"
29 #include "cdp_txrx_ops.h"
30 #include "cdp_txrx_handle.h"
31 #include "cdp_txrx_cmn_struct.h"
32 
33 #ifdef ENABLE_VERBOSE_DEBUG
34 extern bool is_dp_verbose_debug_enabled;
35 #endif
36 
37 /******************************************************************************
38  *
39  * Common Data Path Header File
40  *
41  *****************************************************************************/
42 #define dp_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP, params)
43 #define dp_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
44 #define dp_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP, params)
45 #define dp_info(params...) \
46 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
47 #define dp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
48 
49 #ifdef DP_PRINT_NO_CONSOLE
50 #define dp_err_log(params...) \
51 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
52 #define dp_info_rl(params...) \
53 	__QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
54 #else
55 #define dp_err_log(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
56 #define dp_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_DP, params)
57 #endif /* DP_PRINT_NO_CONSOLE */
58 
59 #ifdef ENABLE_VERBOSE_DEBUG
60 /**
61  * @enum verbose_debug_module:
62  * if INI "enable_verbose_debug" has to set following bit positions to enable
63  * respective module's excessive logging,
64  *
65  * @hif_verbose_debug_mask: 1st bit [0th index] is  for HIF module
66  * @hal_verbose_debug_mask: 2nd bit [1st index] is for HAL module
67  * @dp_verbose_debug_mask:  3rd bit [2nd index] is for DP module
68  */
69 enum verbose_debug_module {
70 	hif_vebose_debug_mask    = 1 << 0,
71 	hal_verbose_debug_mask   = 1 << 1,
72 	dp_verbose_debug_mask    = 1 << 2,
73 };
74 
75 #define dp_verbose_debug(params...) \
76 		if (unlikely(is_dp_verbose_debug_enabled)) \
77 			do {\
78 				QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params); \
79 			} while (0)
80 #else
81 #define dp_verbose_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
82 #endif
83 
84 #define dp_nofl_alert(params...) \
85 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_DP, params)
86 #define dp_nofl_err(params...) \
87 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_DP, params)
88 #define dp_nofl_warn(params...) \
89 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_DP, params)
90 #define dp_nofl_info(params...) \
91 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP, params)
92 #define dp_nofl_debug(params...) \
93 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_DP, params)
94 
95 #define dp_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_DP, params)
96 #define dp_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_DP, params)
97 #define dp_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_DP, params)
98 #define dp_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_DP, params)
99 
100 /**
101  * @enum vdev_host_stats_id:
102  * host stats update from CDP have to set one of the following stats ID
103  *
104  * @DP_VDEV_STATS_PKT_CNT_ONLY: update Tx packet count only
105  * @DP_VDEV_STATS_TX_ME: update Tx ingress stats
106  */
107 enum {
108 	DP_VDEV_STATS_PKT_CNT_ONLY,
109 	DP_VDEV_STATS_TX_ME,
110 };
111 
112 static inline QDF_STATUS
113 cdp_soc_attach_target(ol_txrx_soc_handle soc)
114 {
115 	if (!soc || !soc->ops) {
116 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
117 				"%s: Invalid Instance:", __func__);
118 		QDF_BUG(0);
119 		return QDF_STATUS_E_INVAL;
120 	}
121 
122 	if (!soc->ops->cmn_drv_ops ||
123 	    !soc->ops->cmn_drv_ops->txrx_soc_attach_target)
124 		return QDF_STATUS_SUCCESS;
125 
126 	return soc->ops->cmn_drv_ops->txrx_soc_attach_target(soc);
127 
128 }
129 
130 static inline QDF_STATUS
131 cdp_vdev_attach(ol_txrx_soc_handle soc, uint8_t pdev_id,
132 		uint8_t *vdev_mac_addr, uint8_t vdev_id,
133 		enum wlan_op_mode op_mode, enum wlan_op_subtype subtype)
134 {
135 	if (!soc || !soc->ops) {
136 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
137 				"%s: Invalid Instance:", __func__);
138 		QDF_BUG(0);
139 		return QDF_STATUS_E_FAILURE;
140 	}
141 
142 	if (!soc->ops->cmn_drv_ops ||
143 	    !soc->ops->cmn_drv_ops->txrx_vdev_attach)
144 		return QDF_STATUS_E_FAILURE;
145 
146 	return soc->ops->cmn_drv_ops->txrx_vdev_attach(soc, pdev_id,
147 						       vdev_mac_addr, vdev_id,
148 						       op_mode, subtype);
149 }
150 
151 #ifdef DP_FLOW_CTL
152 /**
153  * cdp_flow_pool_map() - Create flow pool for vdev
154  * @soc: data path soc handle
155  * @pdev_id: id of dp pdev handle
156  * @vdev_id: vdev_id corresponding to vdev start
157  *
158  * Create per vdev flow pool.
159  *
160  * return none
161  */
162 static inline QDF_STATUS cdp_flow_pool_map(ol_txrx_soc_handle soc,
163 					   uint8_t pdev_id, uint8_t vdev_id)
164 {
165 	if (!soc || !soc->ops) {
166 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
167 			  "%s: Invalid Instance:", __func__);
168 		QDF_BUG(0);
169 		return QDF_STATUS_E_INVAL;
170 	}
171 
172 	if (!soc->ops->flowctl_ops ||
173 	    !soc->ops->flowctl_ops->flow_pool_map_handler)
174 		return QDF_STATUS_E_INVAL;
175 
176 	return soc->ops->flowctl_ops->flow_pool_map_handler(soc, pdev_id,
177 							    vdev_id);
178 }
179 
180 /**
181  * cdp_flow_pool_unmap() - Delete flow pool
182  * @soc: data path soc handle
183  * @pdev_id: id of dp pdev handle
184  * @vdev_id: vdev_id corresponding to vdev start
185  *
186  * Delete flow pool
187  *
188  * return none
189  */
190 static inline void cdp_flow_pool_unmap(ol_txrx_soc_handle soc,
191 				       uint8_t pdev_id, uint8_t vdev_id)
192 {
193 	if (!soc || !soc->ops) {
194 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
195 				"%s: Invalid Instance:", __func__);
196 		QDF_BUG(0);
197 		return;
198 	}
199 
200 	if (!soc->ops->flowctl_ops ||
201 	    !soc->ops->flowctl_ops->flow_pool_unmap_handler)
202 		return;
203 
204 	return soc->ops->flowctl_ops->flow_pool_unmap_handler(soc, pdev_id,
205 							vdev_id);
206 }
207 #endif
208 
209 static inline QDF_STATUS
210 cdp_vdev_detach(ol_txrx_soc_handle soc, uint8_t vdev_id,
211 		ol_txrx_vdev_delete_cb callback, void *cb_context)
212 {
213 	if (!soc || !soc->ops) {
214 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
215 				"%s: Invalid Instance:", __func__);
216 		QDF_BUG(0);
217 		return QDF_STATUS_E_FAILURE;
218 	}
219 
220 	if (!soc->ops->cmn_drv_ops ||
221 	    !soc->ops->cmn_drv_ops->txrx_vdev_detach)
222 		return QDF_STATUS_E_FAILURE;
223 
224 	return soc->ops->cmn_drv_ops->txrx_vdev_detach(soc, vdev_id,
225 						       callback, cb_context);
226 }
227 
228 static inline int
229 cdp_pdev_attach_target(ol_txrx_soc_handle soc, uint8_t pdev_id)
230 {
231 	if (!soc || !soc->ops) {
232 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
233 				"%s: Invalid Instance:", __func__);
234 		QDF_BUG(0);
235 		return 0;
236 	}
237 
238 	if (!soc->ops->cmn_drv_ops ||
239 	    !soc->ops->cmn_drv_ops->txrx_pdev_attach_target)
240 		return 0;
241 
242 	return soc->ops->cmn_drv_ops->txrx_pdev_attach_target(soc, pdev_id);
243 }
244 
245 static inline QDF_STATUS cdp_pdev_attach
246 	(ol_txrx_soc_handle soc, HTC_HANDLE htc_pdev, qdf_device_t osdev,
247 	 uint8_t pdev_id)
248 {
249 	if (!soc || !soc->ops) {
250 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
251 				"%s: Invalid Instance:", __func__);
252 		QDF_BUG(0);
253 		return QDF_STATUS_E_FAILURE;
254 	}
255 
256 	if (!soc->ops->cmn_drv_ops ||
257 	    !soc->ops->cmn_drv_ops->txrx_pdev_attach)
258 		return QDF_STATUS_E_FAILURE;
259 
260 	return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, htc_pdev, osdev,
261 						       pdev_id);
262 }
263 
264 /**
265  * cdp_pdev_post_attach() - attach the data SW state
266  * @soc: datapath soc handle
267  * @pdev_id: the data physical device id being removed
268  *
269  * This function is used when the WLAN driver is being loaded to
270  * attach the host data component within the driver.
271  *
272  * Return: 0 for success or error code
273  */
274 static inline int cdp_pdev_post_attach(ol_txrx_soc_handle soc, uint8_t pdev_id)
275 {
276 	if (!soc || !soc->ops) {
277 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
278 				"%s: Invalid Instance:", __func__);
279 		QDF_BUG(0);
280 		return 0;
281 	}
282 
283 	if (!soc->ops->cmn_drv_ops ||
284 	    !soc->ops->cmn_drv_ops->txrx_pdev_post_attach)
285 		return 0;
286 
287 	return soc->ops->cmn_drv_ops->txrx_pdev_post_attach(soc, pdev_id);
288 }
289 
290 /**
291  * cdp_pdev_pre_detach() - detach the data SW state
292  * @soc: datapath soc handle
293  * @pdev_id: the data physical device id being removed
294  * @force: delete the pdev (and its vdevs and peers) even if
295  * there are outstanding references by the target to the vdevs
296  * and peers within the pdev
297  *
298  * This function is used when the WLAN driver is being removed to
299  * detach the host data component within the driver.
300  *
301  * Return: None
302  */
303 static inline void
304 cdp_pdev_pre_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
305 {
306 	if (!soc || !soc->ops) {
307 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
308 				"%s: Invalid Instance:", __func__);
309 		QDF_BUG(0);
310 		return;
311 	}
312 
313 	if (!soc->ops->cmn_drv_ops ||
314 	    !soc->ops->cmn_drv_ops->txrx_pdev_pre_detach)
315 		return;
316 
317 	soc->ops->cmn_drv_ops->txrx_pdev_pre_detach(soc, pdev_id, force);
318 }
319 
320 static inline QDF_STATUS
321 cdp_pdev_detach(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
322 {
323 	if (!soc || !soc->ops) {
324 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
325 				"%s: Invalid Instance:", __func__);
326 		QDF_BUG(0);
327 		return QDF_STATUS_E_FAILURE;
328 	}
329 
330 	if (!soc->ops->cmn_drv_ops ||
331 	    !soc->ops->cmn_drv_ops->txrx_pdev_detach)
332 		return QDF_STATUS_E_FAILURE;
333 
334 	return soc->ops->cmn_drv_ops->txrx_pdev_detach(soc, pdev_id, force);
335 }
336 
337 static inline void
338 cdp_pdev_deinit(ol_txrx_soc_handle soc, uint8_t pdev_id, int force)
339 {
340 	if (!soc || !soc->ops) {
341 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
342 			  "%s: Invalid Instance:", __func__);
343 		QDF_BUG(0);
344 		return;
345 	}
346 
347 	if (!soc->ops->cmn_drv_ops ||
348 	    !soc->ops->cmn_drv_ops->txrx_pdev_deinit)
349 		return;
350 
351 	soc->ops->cmn_drv_ops->txrx_pdev_deinit(soc, pdev_id, force);
352 }
353 
354 static inline QDF_STATUS cdp_peer_create
355 	(ol_txrx_soc_handle soc, uint8_t vdev_id,
356 	uint8_t *peer_mac_addr)
357 {
358 	if (!soc || !soc->ops) {
359 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
360 				"%s: Invalid Instance:", __func__);
361 		QDF_BUG(0);
362 		return QDF_STATUS_E_FAILURE;
363 	}
364 
365 	if (!soc->ops->cmn_drv_ops ||
366 	    !soc->ops->cmn_drv_ops->txrx_peer_create)
367 		return QDF_STATUS_E_FAILURE;
368 
369 	return soc->ops->cmn_drv_ops->txrx_peer_create(soc, vdev_id,
370 			peer_mac_addr);
371 }
372 
373 static inline void cdp_peer_setup
374 	(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac)
375 {
376 	if (!soc || !soc->ops) {
377 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
378 				"%s: Invalid Instance:", __func__);
379 		QDF_BUG(0);
380 		return;
381 	}
382 
383 	if (!soc->ops->cmn_drv_ops ||
384 	    !soc->ops->cmn_drv_ops->txrx_peer_setup)
385 		return;
386 
387 	soc->ops->cmn_drv_ops->txrx_peer_setup(soc, vdev_id,
388 			peer_mac);
389 }
390 
391 /*
392  * cdp_cp_peer_del_response - Call the peer delete response handler
393  * @soc: Datapath SOC handle
394  * @vdev_id: id of virtual device object
395  * @peer_mac_addr: Mac address of the peer
396  *
397  * Return: void
398  */
399 static inline QDF_STATUS cdp_cp_peer_del_response
400 	(ol_txrx_soc_handle soc,
401 	 uint8_t vdev_id,
402 	 uint8_t *peer_mac_addr)
403 {
404 	if (!soc || !soc->ops) {
405 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
406 			  "%s: Invalid Instance:", __func__);
407 		QDF_BUG(0);
408 		return QDF_STATUS_E_FAILURE;
409 	}
410 
411 	if (!soc->ops->cmn_drv_ops ||
412 	    !soc->ops->cmn_drv_ops->txrx_cp_peer_del_response)
413 		return QDF_STATUS_E_FAILURE;
414 
415 	return soc->ops->cmn_drv_ops->txrx_cp_peer_del_response(soc,
416 								vdev_id,
417 								peer_mac_addr);
418 }
419 /**
420  * cdp_peer_get_ast_info_by_soc() - search the soc AST hash table
421  *                                  and return ast entry information
422  *                                  of first ast entry found in the
423  *                                  table with given mac address
424  *
425  * @soc - data path soc handle
426  * @ast_mac_addr - AST entry mac address
427  * @ast_entry_info - ast entry information
428  *
429  * return - true if ast entry found with ast_mac_addr
430  *          false if ast entry not found
431  */
432 static inline bool cdp_peer_get_ast_info_by_soc
433 	(ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
434 	 struct cdp_ast_entry_info *ast_entry_info)
435 {
436 	if (!soc || !soc->ops) {
437 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
438 				"%s: Invalid Instance:", __func__);
439 		QDF_BUG(0);
440 		return false;
441 	}
442 
443 	if (!soc->ops->cmn_drv_ops ||
444 	    !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc)
445 		return false;
446 
447 	return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_soc
448 					(soc, ast_mac_addr,
449 					 ast_entry_info);
450 }
451 
452 /**
453  * cdp_peer_get_ast_info_by_pdev() - search the soc AST hash table
454  *                                   and return ast entry information
455  *                                   if mac address and pdev_id matches
456  *
457  * @soc - data path soc handle
458  * @ast_mac_addr - AST entry mac address
459  * @pdev_id - pdev_id
460  * @ast_entry_info - ast entry information
461  *
462  * return - true if ast entry found with ast_mac_addr
463  *          false if ast entry not found
464  */
465 static inline bool cdp_peer_get_ast_info_by_pdev
466 	(ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
467 	 uint8_t pdev_id,
468 	 struct cdp_ast_entry_info *ast_entry_info)
469 {
470 	if (!soc || !soc->ops) {
471 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
472 			  "%s: Invalid Instance:", __func__);
473 		QDF_BUG(0);
474 		return false;
475 	}
476 
477 	if (!soc->ops->cmn_drv_ops ||
478 	    !soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev)
479 		return false;
480 
481 	return soc->ops->cmn_drv_ops->txrx_peer_get_ast_info_by_pdev
482 					(soc,
483 					 ast_mac_addr,
484 					 pdev_id,
485 					 ast_entry_info);
486 }
487 
488 /**
489  * cdp_peer_ast_delete_by_soc() - delete the ast entry from soc AST hash table
490  *                                with given mac address
491  *
492  * @soc - data path soc handle
493  * @ast_mac_addr - AST entry mac address
494  * @callback - callback function to called on ast delete response from FW
495  * @cookie - argument to be passed to callback
496  *
497  * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
498  *          is sent
499  *          QDF_STATUS_E_INVAL false if ast entry not found
500  */
501 static inline QDF_STATUS cdp_peer_ast_delete_by_soc
502 	(ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
503 	 txrx_ast_free_cb callback,
504 	 void *cookie)
505 {
506 	if (!soc || !soc->ops) {
507 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
508 			  "%s: Invalid Instance:", __func__);
509 		QDF_BUG(0);
510 		return QDF_STATUS_E_INVAL;
511 	}
512 
513 	if (!soc->ops->cmn_drv_ops ||
514 	    !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc)
515 		return QDF_STATUS_E_INVAL;
516 
517 	return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_soc
518 							(soc,
519 							 ast_mac_addr,
520 							 callback,
521 							 cookie);
522 }
523 
524 /**
525  * cdp_peer_ast_delete_by_pdev() - delete the ast entry from soc AST hash table
526  *                                 if mac address and pdev_id matches
527  *
528  * @soc - data path soc handle
529  * @ast_mac_addr - AST entry mac address
530  * @pdev_id - pdev id
531  * @callback - callback function to called on ast delete response from FW
532  * @cookie - argument to be passed to callback
533  *
534  * return - QDF_STATUS_SUCCESS if ast entry found with ast_mac_addr and delete
535  *          is sent
536  *          QDF_STATUS_E_INVAL false if ast entry not found
537  */
538 static inline QDF_STATUS cdp_peer_ast_delete_by_pdev
539 	(ol_txrx_soc_handle soc, uint8_t *ast_mac_addr,
540 	 uint8_t pdev_id, txrx_ast_free_cb callback,
541 	 void *cookie)
542 {
543 	if (!soc || !soc->ops) {
544 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
545 			  "%s: Invalid Instance:", __func__);
546 		QDF_BUG(0);
547 		return QDF_STATUS_E_INVAL;
548 	}
549 
550 	if (!soc->ops->cmn_drv_ops ||
551 	    !soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev)
552 		return QDF_STATUS_E_INVAL;
553 
554 	return soc->ops->cmn_drv_ops->txrx_peer_ast_delete_by_pdev
555 					(soc,
556 					 ast_mac_addr,
557 					 pdev_id,
558 					 callback,
559 					 cookie);
560 }
561 
562 static inline int cdp_peer_add_ast
563 	(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
564 	uint8_t *mac_addr,
565 	enum cdp_txrx_ast_entry_type type, uint32_t flags)
566 {
567 	if (!soc || !soc->ops) {
568 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
569 				"%s: Invalid Instance:", __func__);
570 		QDF_BUG(0);
571 		return 0;
572 	}
573 
574 	if (!soc->ops->cmn_drv_ops ||
575 	    !soc->ops->cmn_drv_ops->txrx_peer_add_ast)
576 		return 0;
577 
578 	return soc->ops->cmn_drv_ops->txrx_peer_add_ast(soc,
579 							vdev_id,
580 							peer_mac,
581 							mac_addr,
582 							type,
583 							flags);
584 }
585 
586 static inline QDF_STATUS cdp_peer_reset_ast
587 	(ol_txrx_soc_handle soc, uint8_t *wds_macaddr, uint8_t *peer_macaddr,
588 	 uint8_t vdev_id)
589 {
590 
591 	if (!soc || !soc->ops) {
592 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
593 				"%s: Invalid Instance:", __func__);
594 		QDF_BUG(0);
595 		return QDF_STATUS_E_FAILURE;
596 	}
597 	if (!soc->ops->cmn_drv_ops ||
598 	    !soc->ops->cmn_drv_ops->txrx_peer_reset_ast)
599 		return QDF_STATUS_E_FAILURE;
600 
601 	return soc->ops->cmn_drv_ops->txrx_peer_reset_ast(soc, wds_macaddr,
602 						   peer_macaddr, vdev_id);
603 }
604 
605 static inline QDF_STATUS cdp_peer_reset_ast_table
606 	(ol_txrx_soc_handle soc, uint8_t vdev_id)
607 {
608 	if (!soc || !soc->ops) {
609 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
610 				"%s: Invalid Instance:", __func__);
611 		QDF_BUG(0);
612 		return QDF_STATUS_E_FAILURE;
613 	}
614 
615 	if (!soc->ops->cmn_drv_ops ||
616 	    !soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table)
617 		return QDF_STATUS_E_FAILURE;
618 
619 	return soc->ops->cmn_drv_ops->txrx_peer_reset_ast_table(soc, vdev_id);
620 }
621 
622 static inline void cdp_peer_flush_ast_table
623 	(ol_txrx_soc_handle soc)
624 {
625 	if (!soc || !soc->ops) {
626 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
627 				"%s: Invalid Instance:", __func__);
628 		QDF_BUG(0);
629 		return;
630 	}
631 
632 	if (!soc->ops->cmn_drv_ops ||
633 	    !soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table)
634 		return;
635 
636 	soc->ops->cmn_drv_ops->txrx_peer_flush_ast_table(soc);
637 }
638 
639 static inline int cdp_peer_update_ast
640 	(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
641 	 uint8_t *wds_macaddr, uint32_t flags)
642 {
643 	if (!soc || !soc->ops) {
644 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
645 				"%s: Invalid Instance:", __func__);
646 		QDF_BUG(0);
647 		return 0;
648 	}
649 
650 	if (!soc->ops->cmn_drv_ops ||
651 	    !soc->ops->cmn_drv_ops->txrx_peer_update_ast)
652 		return 0;
653 
654 
655 	return soc->ops->cmn_drv_ops->txrx_peer_update_ast(soc,
656 							vdev_id,
657 							peer_mac,
658 							wds_macaddr,
659 							flags);
660 }
661 
662 static inline void cdp_peer_teardown
663 	(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac)
664 {
665 	if (!soc || !soc->ops) {
666 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
667 				"%s: Invalid Instance:", __func__);
668 		QDF_BUG(0);
669 		return;
670 	}
671 
672 	if (!soc->ops->cmn_drv_ops ||
673 	    !soc->ops->cmn_drv_ops->txrx_peer_teardown)
674 		return;
675 
676 	soc->ops->cmn_drv_ops->txrx_peer_teardown(soc, vdev_id, peer_mac);
677 }
678 
679 static inline void
680 cdp_peer_delete(ol_txrx_soc_handle soc, uint8_t vdev_id,
681 		uint8_t *peer_mac, uint32_t bitmap)
682 {
683 	if (!soc || !soc->ops) {
684 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
685 				"%s: Invalid Instance:", __func__);
686 		QDF_BUG(0);
687 		return;
688 	}
689 
690 	if (!soc->ops->cmn_drv_ops ||
691 	    !soc->ops->cmn_drv_ops->txrx_peer_delete)
692 		return;
693 
694 	soc->ops->cmn_drv_ops->txrx_peer_delete(soc, vdev_id, peer_mac, bitmap);
695 }
696 
697 /**
698  * cdp_peer_detach_sync() - peer detach sync callback
699  * @soc: datapath soc handle
700  * @vdev_id: virtual device/interface id
701  * @peer_mac: peer mac address
702  * @peer_unmap_sync: peer unmap sync cb.
703  * @bitmap: bitmap indicating special handling of request.
704  *
705  * Return: None
706  */
707 static inline void
708 cdp_peer_delete_sync(ol_txrx_soc_handle soc, uint8_t vdev_id, uint8_t *peer_mac,
709 		     QDF_STATUS(*delete_cb)(
710 				uint8_t vdev_id,
711 				uint32_t peerid_cnt,
712 				uint16_t *peerid_list),
713 		     uint32_t bitmap)
714 {
715 	if (!soc || !soc->ops) {
716 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
717 			  "%s: Invalid Instance:", __func__);
718 		QDF_BUG(0);
719 		return;
720 	}
721 
722 	if (!soc->ops->cmn_drv_ops ||
723 	    !soc->ops->cmn_drv_ops->txrx_peer_delete_sync)
724 		return;
725 
726 	soc->ops->cmn_drv_ops->txrx_peer_delete_sync(soc, vdev_id, peer_mac,
727 						     delete_cb,
728 						     bitmap);
729 }
730 
731 static inline int
732 cdp_set_monitor_mode(ol_txrx_soc_handle soc, uint8_t vdev_id,
733 		     uint8_t smart_monitor)
734 {
735 	if (!soc || !soc->ops) {
736 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
737 				"%s: Invalid Instance:", __func__);
738 		QDF_BUG(0);
739 		return 0;
740 	}
741 
742 	if (!soc->ops->cmn_drv_ops ||
743 	    !soc->ops->cmn_drv_ops->txrx_set_monitor_mode)
744 		return 0;
745 
746 	return soc->ops->cmn_drv_ops->txrx_set_monitor_mode(soc, vdev_id,
747 					smart_monitor);
748 }
749 
750 static inline QDF_STATUS
751 cdp_set_curchan(ol_txrx_soc_handle soc,
752 	uint8_t pdev_id,
753 	uint32_t chan_mhz)
754 {
755 	if (!soc || !soc->ops) {
756 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
757 				"%s: Invalid Instance:", __func__);
758 		QDF_BUG(0);
759 		return QDF_STATUS_E_FAILURE;
760 	}
761 
762 	if (!soc->ops->cmn_drv_ops ||
763 	    !soc->ops->cmn_drv_ops->txrx_set_curchan)
764 		return QDF_STATUS_E_FAILURE;
765 
766 	return soc->ops->cmn_drv_ops->txrx_set_curchan(soc, pdev_id, chan_mhz);
767 }
768 
769 static inline QDF_STATUS
770 cdp_set_privacy_filters(ol_txrx_soc_handle soc, uint8_t vdev_id,
771 			void *filter, uint32_t num)
772 {
773 	if (!soc || !soc->ops) {
774 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
775 				"%s: Invalid Instance:", __func__);
776 		QDF_BUG(0);
777 		return QDF_STATUS_E_FAILURE;
778 	}
779 
780 	if (!soc->ops->cmn_drv_ops ||
781 	    !soc->ops->cmn_drv_ops->txrx_set_privacy_filters)
782 		return QDF_STATUS_E_FAILURE;
783 
784 	return soc->ops->cmn_drv_ops->txrx_set_privacy_filters(soc, vdev_id,
785 			filter, num);
786 }
787 
788 static inline int
789 cdp_set_monitor_filter(ol_txrx_soc_handle soc, uint8_t pdev_id,
790 		       struct cdp_monitor_filter *filter_val)
791 {
792 	if (soc->ops->mon_ops->txrx_set_advance_monitor_filter)
793 		return soc->ops->mon_ops->txrx_set_advance_monitor_filter(soc,
794 								pdev_id,
795 								filter_val);
796 	return 0;
797 }
798 
799 
800 /******************************************************************************
801  * Data Interface (B Interface)
802  *****************************************************************************/
803 static inline void
804 cdp_vdev_register(ol_txrx_soc_handle soc, uint8_t vdev_id,
805 		  ol_osif_vdev_handle osif_vdev,
806 		  struct ol_txrx_ops *txrx_ops)
807 {
808 	if (!soc || !soc->ops) {
809 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
810 				"%s: Invalid Instance:", __func__);
811 		QDF_BUG(0);
812 		return;
813 	}
814 
815 	if (!soc->ops->cmn_drv_ops ||
816 	    !soc->ops->cmn_drv_ops->txrx_vdev_register)
817 		return;
818 
819 	soc->ops->cmn_drv_ops->txrx_vdev_register(soc, vdev_id,
820 			osif_vdev, txrx_ops);
821 }
822 
823 static inline int
824 cdp_mgmt_send(ol_txrx_soc_handle soc, uint8_t vdev_id,
825 	      qdf_nbuf_t tx_mgmt_frm,	uint8_t type)
826 {
827 	if (!soc || !soc->ops) {
828 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
829 				"%s: Invalid Instance:", __func__);
830 		QDF_BUG(0);
831 		return 0;
832 	}
833 
834 	if (!soc->ops->cmn_drv_ops ||
835 	    !soc->ops->cmn_drv_ops->txrx_mgmt_send)
836 		return 0;
837 
838 	return soc->ops->cmn_drv_ops->txrx_mgmt_send(soc, vdev_id,
839 			tx_mgmt_frm, type);
840 }
841 
842 static inline int
843 cdp_mgmt_send_ext(ol_txrx_soc_handle soc, uint8_t vdev_id,
844 		  qdf_nbuf_t tx_mgmt_frm, uint8_t type,
845 		  uint8_t use_6mbps, uint16_t chanfreq)
846 {
847 	if (!soc || !soc->ops) {
848 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
849 				"%s: Invalid Instance:", __func__);
850 		QDF_BUG(0);
851 		return 0;
852 	}
853 
854 	if (!soc->ops->cmn_drv_ops ||
855 	    !soc->ops->cmn_drv_ops->txrx_mgmt_send_ext)
856 		return 0;
857 
858 	return soc->ops->cmn_drv_ops->txrx_mgmt_send_ext
859 			(soc, vdev_id, tx_mgmt_frm, type, use_6mbps, chanfreq);
860 }
861 
862 
863 static inline QDF_STATUS
864 cdp_mgmt_tx_cb_set(ol_txrx_soc_handle soc, uint8_t pdev_id,
865 		   uint8_t type, ol_txrx_mgmt_tx_cb download_cb,
866 		   ol_txrx_mgmt_tx_cb ota_ack_cb, void *ctxt)
867 {
868 	if (!soc || !soc->ops) {
869 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
870 				"%s: Invalid Instance:", __func__);
871 		QDF_BUG(0);
872 		return QDF_STATUS_E_FAILURE;
873 	}
874 
875 	if (!soc->ops->cmn_drv_ops ||
876 	    !soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set)
877 		return QDF_STATUS_E_FAILURE;
878 
879 	return soc->ops->cmn_drv_ops->txrx_mgmt_tx_cb_set
880 			(soc, pdev_id, type, download_cb, ota_ack_cb, ctxt);
881 }
882 
883 /**
884  * cdp_peer_unmap_sync_cb_set() - set peer unmap sync callback
885  * @soc: datapath soc handle
886  * @pdev_id: physical device instance id
887  * @peer_unmap_sync: peer unmap sync callback
888  *
889  * Return: None
890  */
891 static inline void
892 cdp_peer_unmap_sync_cb_set(ol_txrx_soc_handle soc,
893 			   uint8_t pdev_id,
894 			   QDF_STATUS(*unmap_resp_cb)(
895 					uint8_t vdev_id,
896 					uint32_t peerid_cnt,
897 					uint16_t *peerid_list))
898 {
899 	if (!soc || !soc->ops) {
900 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
901 			  "%s: Invalid Instance:", __func__);
902 		QDF_BUG(0);
903 		return;
904 	}
905 
906 	if (!soc->ops->cmn_drv_ops ||
907 	    !soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set)
908 		return;
909 
910 	soc->ops->cmn_drv_ops->txrx_peer_unmap_sync_cb_set(soc, pdev_id,
911 							   unmap_resp_cb);
912 }
913 
914 /*
915  * cdp_data_tx_cb_set(): set the callback for non standard tx
916  * @soc - datapath soc handle
917  * @vdev_id - virtual device/interface id
918  * @callback - callback function
919  * @ctxt: callback context
920  *
921  */
922 static inline void
923 cdp_data_tx_cb_set(ol_txrx_soc_handle soc, uint8_t vdev_id,
924 		   ol_txrx_data_tx_cb callback, void *ctxt)
925 {
926 	if (!soc || !soc->ops) {
927 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
928 				"%s: Invalid Instance:", __func__);
929 		QDF_BUG(0);
930 		return;
931 	}
932 
933 	if (!soc->ops->cmn_drv_ops ||
934 	    !soc->ops->cmn_drv_ops->txrx_data_tx_cb_set)
935 		return;
936 
937 	soc->ops->cmn_drv_ops->txrx_data_tx_cb_set(soc, vdev_id,
938 						   callback, ctxt);
939 }
940 
941 /******************************************************************************
942  * Statistics and Debugging Interface (C Interface)
943  *****************************************************************************/
944 /**
945  * External Device physical address types
946  *
947  * Currently, both MAC and IPA uController use the same size addresses
948  * and descriptors are exchanged between these two depending on the mode.
949  *
950  * Rationale: qdf_dma_addr_t is the type used internally on the host for DMA
951  *            operations. However, external device physical address sizes
952  *            may be different from host-specific physical address sizes.
953  *            This calls for the following definitions for target devices
954  *            (MAC, IPA uc).
955  */
956 #if HTT_PADDR64
957 typedef uint64_t target_paddr_t;
958 #else
959 typedef uint32_t target_paddr_t;
960 #endif /*HTT_PADDR64 */
961 
962 static inline int
963 cdp_aggr_cfg(ol_txrx_soc_handle soc, uint8_t vdev_id,
964 	     int max_subfrms_ampdu,
965 	     int max_subfrms_amsdu)
966 {
967 	if (!soc || !soc->ops) {
968 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
969 				"%s: Invalid Instance:", __func__);
970 		QDF_BUG(0);
971 		return 0;
972 	}
973 
974 	if (!soc->ops->cmn_drv_ops ||
975 	    !soc->ops->cmn_drv_ops->txrx_aggr_cfg)
976 		return 0;
977 
978 	return soc->ops->cmn_drv_ops->txrx_aggr_cfg(soc, vdev_id,
979 			max_subfrms_ampdu, max_subfrms_amsdu);
980 }
981 
982 static inline int
983 cdp_fw_stats_get(ol_txrx_soc_handle soc, uint8_t vdev_id,
984 		 struct ol_txrx_stats_req *req, bool per_vdev,
985 		 bool response_expected)
986 {
987 	if (!soc || !soc->ops) {
988 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
989 				"%s: Invalid Instance:", __func__);
990 		QDF_BUG(0);
991 		return 0;
992 	}
993 
994 	if (!soc->ops->cmn_drv_ops ||
995 	    !soc->ops->cmn_drv_ops->txrx_fw_stats_get)
996 		return 0;
997 
998 	return soc->ops->cmn_drv_ops->txrx_fw_stats_get(soc, vdev_id, req,
999 			per_vdev, response_expected);
1000 }
1001 
1002 static inline int
1003 cdp_debug(ol_txrx_soc_handle soc, uint8_t vdev_id, int debug_specs)
1004 {
1005 	if (!soc || !soc->ops) {
1006 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1007 				"%s: Invalid Instance:", __func__);
1008 		QDF_BUG(0);
1009 		return 0;
1010 	}
1011 
1012 	if (!soc->ops->cmn_drv_ops ||
1013 	    !soc->ops->cmn_drv_ops->txrx_debug)
1014 		return 0;
1015 
1016 	return soc->ops->cmn_drv_ops->txrx_debug(soc, vdev_id, debug_specs);
1017 }
1018 
1019 static inline QDF_STATUS
1020 cdp_fw_stats_cfg(ol_txrx_soc_handle soc,
1021 		 uint8_t vdev_id, uint8_t cfg_stats_type, uint32_t cfg_val)
1022 {
1023 	if (!soc || !soc->ops) {
1024 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1025 				"%s: Invalid Instance:", __func__);
1026 		QDF_BUG(0);
1027 		return QDF_STATUS_E_FAILURE;
1028 	}
1029 
1030 	if (!soc->ops->cmn_drv_ops ||
1031 	    !soc->ops->cmn_drv_ops->txrx_fw_stats_cfg)
1032 		return QDF_STATUS_E_FAILURE;
1033 
1034 	return soc->ops->cmn_drv_ops->txrx_fw_stats_cfg(soc, vdev_id,
1035 						 cfg_stats_type, cfg_val);
1036 }
1037 
1038 static inline void cdp_print_level_set(ol_txrx_soc_handle soc, unsigned level)
1039 {
1040 	if (!soc || !soc->ops) {
1041 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1042 				"%s: Invalid Instance:", __func__);
1043 		QDF_BUG(0);
1044 		return;
1045 	}
1046 
1047 	if (!soc->ops->cmn_drv_ops ||
1048 	    !soc->ops->cmn_drv_ops->txrx_print_level_set)
1049 		return;
1050 
1051 	soc->ops->cmn_drv_ops->txrx_print_level_set(level);
1052 }
1053 
1054 /*
1055  * cdp_get_vdev_mac_addr() – Detach txrx peer
1056  * @soc_hdl: Datapath soc handle
1057  * @vdev_id: virtual device/interface id
1058  *
1059  * Return: MAC address on success, NULL on failure.
1060  *
1061  */
1062 static inline uint8_t *
1063 cdp_get_vdev_mac_addr(ol_txrx_soc_handle soc, uint8_t vdev_id)
1064 {
1065 	if (!soc || !soc->ops) {
1066 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1067 				"%s: Invalid Instance:", __func__);
1068 		QDF_BUG(0);
1069 		return NULL;
1070 	}
1071 
1072 	if (!soc->ops->cmn_drv_ops ||
1073 	    !soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr)
1074 		return NULL;
1075 
1076 	return soc->ops->cmn_drv_ops->txrx_get_vdev_mac_addr(soc, vdev_id);
1077 
1078 }
1079 
1080 /**
1081  * cdp_get_os_rx_handles_from_vdev() - Return os rx handles for a vdev
1082  * @soc: ol_txrx_soc_handle handle
1083  * @vdev_id: vdev id for which os rx handles are needed
1084  * @stack_fn_p: pointer to stack function pointer
1085  * @osif_handle_p: pointer to ol_osif_vdev_handle
1086  *
1087  * Return: void
1088  */
1089 static inline
1090 void cdp_get_os_rx_handles_from_vdev(ol_txrx_soc_handle soc,
1091 				     uint8_t vdev_id,
1092 				     ol_txrx_rx_fp *stack_fn_p,
1093 				     ol_osif_vdev_handle *osif_handle_p)
1094 {
1095 	if (!soc || !soc->ops) {
1096 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1097 			  "%s: Invalid Instance:", __func__);
1098 		QDF_BUG(0);
1099 		return;
1100 	}
1101 
1102 	if (!soc->ops->cmn_drv_ops ||
1103 	    !soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev)
1104 		return;
1105 
1106 	soc->ops->cmn_drv_ops->txrx_get_os_rx_handles_from_vdev(soc, vdev_id,
1107 								stack_fn_p,
1108 								osif_handle_p);
1109 }
1110 
1111 /**
1112  * cdp_get_ctrl_pdev_from_vdev() - Return control pdev of vdev
1113  * @soc: datapath soc handle
1114  * @vdev_id: virtual device/interface id
1115  *
1116  * Return: Handle to control pdev
1117  */
1118 static inline struct cdp_cfg *
1119 cdp_get_ctrl_pdev_from_vdev(ol_txrx_soc_handle soc, uint8_t vdev_id)
1120 {
1121 	if (!soc || !soc->ops) {
1122 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1123 				"%s: Invalid Instance:", __func__);
1124 		QDF_BUG(0);
1125 		return NULL;
1126 	}
1127 
1128 	if (!soc->ops->cmn_drv_ops ||
1129 	    !soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev)
1130 		return NULL;
1131 
1132 	return soc->ops->cmn_drv_ops->txrx_get_ctrl_pdev_from_vdev(soc,
1133 								   vdev_id);
1134 }
1135 
1136 /*
1137  * cdp_get_mon_vdev_from_pdev() - Get vdev handle of monitor mode
1138  * @soc: datapath soc handle
1139  * @pdev_id: physical device instance id
1140  *
1141  * Return: virtual interface id
1142  */
1143 static inline uint8_t
1144 cdp_get_mon_vdev_from_pdev(ol_txrx_soc_handle soc, uint8_t pdev_id)
1145 {
1146 	if (!soc || !soc->ops) {
1147 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1148 			  "%s: Invalid Instance:", __func__);
1149 		QDF_BUG(0);
1150 		return -EINVAL;
1151 	}
1152 
1153 	if (!soc->ops->cmn_drv_ops ||
1154 	    !soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev)
1155 		return -EINVAL;
1156 
1157 	return soc->ops->cmn_drv_ops->txrx_get_mon_vdev_from_pdev(soc, pdev_id);
1158 }
1159 
1160 static inline void
1161 cdp_soc_detach(ol_txrx_soc_handle soc)
1162 {
1163 	if (!soc || !soc->ops) {
1164 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1165 				"%s: Invalid Instance:", __func__);
1166 		QDF_BUG(0);
1167 		return;
1168 	}
1169 
1170 	if (!soc->ops->cmn_drv_ops ||
1171 	    !soc->ops->cmn_drv_ops->txrx_soc_detach)
1172 		return;
1173 
1174 	soc->ops->cmn_drv_ops->txrx_soc_detach(soc);
1175 }
1176 
1177 /**
1178  * cdp_soc_init() - Initialize txrx SOC
1179  * @soc: ol_txrx_soc_handle handle
1180  * @devid: Device ID
1181  * @hif_handle: Opaque HIF handle
1182  * @psoc: Opaque Objmgr handle
1183  * @htc_handle: Opaque HTC handle
1184  * @qdf_dev: QDF device
1185  * @dp_ol_if_ops: Offload Operations
1186  *
1187  * Return: DP SOC handle on success, NULL on failure
1188  */
1189 static inline ol_txrx_soc_handle
1190 cdp_soc_init(ol_txrx_soc_handle soc, u_int16_t devid,
1191 	     void *hif_handle,
1192 	     struct cdp_ctrl_objmgr_psoc *psoc,
1193 	     HTC_HANDLE htc_handle, qdf_device_t qdf_dev,
1194 	     struct ol_if_ops *dp_ol_if_ops)
1195 {
1196 	if (!soc || !soc->ops) {
1197 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1198 			  "%s: Invalid Instance:", __func__);
1199 		QDF_BUG(0);
1200 		return NULL;
1201 	}
1202 
1203 	if (!soc->ops->cmn_drv_ops ||
1204 	    !soc->ops->cmn_drv_ops->txrx_soc_init)
1205 		return NULL;
1206 
1207 	return soc->ops->cmn_drv_ops->txrx_soc_init(soc, psoc,
1208 						    hif_handle,
1209 						    htc_handle, qdf_dev,
1210 						    dp_ol_if_ops, devid);
1211 }
1212 
1213 /**
1214  * cdp_soc_deinit() - Deinitialize txrx SOC
1215  * @soc: Opaque DP SOC handle
1216  *
1217  * Return: None
1218  */
1219 static inline void
1220 cdp_soc_deinit(ol_txrx_soc_handle soc)
1221 {
1222 	if (!soc || !soc->ops) {
1223 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1224 			  "%s: Invalid Instance:", __func__);
1225 		QDF_BUG(0);
1226 		return;
1227 	}
1228 
1229 	if (!soc->ops->cmn_drv_ops ||
1230 	    !soc->ops->cmn_drv_ops->txrx_soc_deinit)
1231 		return;
1232 
1233 	soc->ops->cmn_drv_ops->txrx_soc_deinit(soc);
1234 }
1235 
1236 /**
1237  * cdp_tso_soc_attach() - TSO attach function
1238  * @soc: ol_txrx_soc_handle handle
1239  *
1240  * Reserve TSO descriptor buffers
1241  *
1242  * Return: QDF_STATUS_SUCCESS on Success or
1243  * QDF_STATUS_E_FAILURE on failure
1244  */
1245 static inline QDF_STATUS
1246 cdp_tso_soc_attach(ol_txrx_soc_handle soc)
1247 {
1248 	if (!soc || !soc->ops) {
1249 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1250 			  "%s: Invalid Instance:", __func__);
1251 		QDF_BUG(0);
1252 		return 0;
1253 	}
1254 
1255 	if (!soc->ops->cmn_drv_ops ||
1256 	    !soc->ops->cmn_drv_ops->txrx_tso_soc_attach)
1257 		return 0;
1258 
1259 	return soc->ops->cmn_drv_ops->txrx_tso_soc_attach(soc);
1260 }
1261 
1262 /**
1263  * cdp_tso_soc_detach() - TSO detach function
1264  * @soc: ol_txrx_soc_handle handle
1265  *
1266  * Release TSO descriptor buffers
1267  *
1268  * Return: QDF_STATUS_SUCCESS on Success or
1269  * QDF_STATUS_E_FAILURE on failure
1270  */
1271 static inline QDF_STATUS
1272 cdp_tso_soc_detach(ol_txrx_soc_handle soc)
1273 {
1274 	if (!soc || !soc->ops) {
1275 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1276 			  "%s: Invalid Instance:", __func__);
1277 		QDF_BUG(0);
1278 		return 0;
1279 	}
1280 
1281 	if (!soc->ops->cmn_drv_ops ||
1282 	    !soc->ops->cmn_drv_ops->txrx_tso_soc_detach)
1283 		return 0;
1284 
1285 	return soc->ops->cmn_drv_ops->txrx_tso_soc_detach(soc);
1286 }
1287 
1288 /**
1289  * cdp_addba_resp_tx_completion() - Indicate addba response tx
1290  * completion to dp to change tid state.
1291  * @soc: soc handle
1292  * @peer_mac: mac address of peer handle
1293  * @vdev_id: id of vdev handle
1294  * @tid: tid
1295  * @status: Tx completion status
1296  *
1297  * Return: success/failure of tid update
1298  */
1299 static inline int cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc,
1300 					       uint8_t *peer_mac,
1301 					       uint16_t vdev_id,
1302 					       uint8_t tid, int status)
1303 {
1304 	if (!soc || !soc->ops) {
1305 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1306 			  "%s: Invalid Instance:", __func__);
1307 		QDF_BUG(0);
1308 		return 0;
1309 	}
1310 
1311 	if (!soc->ops->cmn_drv_ops ||
1312 	    !soc->ops->cmn_drv_ops->addba_resp_tx_completion)
1313 		return 0;
1314 
1315 	return soc->ops->cmn_drv_ops->addba_resp_tx_completion(soc, peer_mac,
1316 					vdev_id, tid, status);
1317 }
1318 
1319 static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc,
1320 	uint8_t *peer_mac, uint16_t vdev_id, uint8_t dialogtoken, uint16_t tid,
1321 	uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum)
1322 {
1323 	if (!soc || !soc->ops) {
1324 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1325 				"%s: Invalid Instance:", __func__);
1326 		QDF_BUG(0);
1327 		return 0;
1328 	}
1329 
1330 	if (!soc->ops->cmn_drv_ops ||
1331 	    !soc->ops->cmn_drv_ops->addba_requestprocess)
1332 		return 0;
1333 
1334 	return soc->ops->cmn_drv_ops->addba_requestprocess(soc, peer_mac,
1335 			vdev_id, dialogtoken, tid, batimeout, buffersize,
1336 			startseqnum);
1337 }
1338 
1339 static inline QDF_STATUS
1340 cdp_addba_responsesetup(ol_txrx_soc_handle soc,
1341 			uint8_t *peer_mac, uint16_t vdev_id,
1342 			uint8_t tid, uint8_t *dialogtoken,
1343 			uint16_t *statuscode, uint16_t *buffersize,
1344 			uint16_t *batimeout)
1345 {
1346 	if (!soc || !soc->ops) {
1347 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1348 				"%s: Invalid Instance:", __func__);
1349 		QDF_BUG(0);
1350 		return QDF_STATUS_E_FAILURE;
1351 	}
1352 
1353 	if (!soc->ops->cmn_drv_ops ||
1354 	    !soc->ops->cmn_drv_ops->addba_responsesetup)
1355 		return QDF_STATUS_E_FAILURE;
1356 
1357 	return soc->ops->cmn_drv_ops->addba_responsesetup(soc, peer_mac,
1358 			vdev_id, tid, dialogtoken, statuscode, buffersize,
1359 			batimeout);
1360 }
1361 
1362 static inline int cdp_delba_process(ol_txrx_soc_handle soc, uint8_t *peer_mac,
1363 				    uint16_t vdev_id, int tid,
1364 				    uint16_t reasoncode)
1365 {
1366 	if (!soc || !soc->ops) {
1367 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1368 				"%s: Invalid Instance:", __func__);
1369 		QDF_BUG(0);
1370 		return 0;
1371 	}
1372 
1373 	if (!soc->ops->cmn_drv_ops ||
1374 	    !soc->ops->cmn_drv_ops->delba_process)
1375 		return 0;
1376 
1377 	return soc->ops->cmn_drv_ops->delba_process(soc, peer_mac,
1378 						vdev_id, tid, reasoncode);
1379 }
1380 
1381 /**
1382  * cdp_delba_tx_completion() - Handle delba tx completion
1383  * to update stats and retry transmission if failed.
1384  * @soc: soc handle
1385  * @peer_mac: peer mac address
1386  * @vdev_id: id of vdev handle
1387  * @tid: Tid number
1388  * @status: Tx completion status
1389  *
1390  * Return: 0 on Success, 1 on failure
1391  */
1392 
1393 static inline int cdp_delba_tx_completion(ol_txrx_soc_handle soc,
1394 					  uint8_t *peer_mac,
1395 					  uint16_t vdev_id,
1396 					  uint8_t tid, int status)
1397 {
1398 	if (!soc || !soc->ops) {
1399 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1400 			  "%s: Invalid Instance:", __func__);
1401 		QDF_BUG(0);
1402 		return 0;
1403 	}
1404 
1405 	if (!soc->ops->cmn_drv_ops ||
1406 	    !soc->ops->cmn_drv_ops->delba_tx_completion)
1407 		return 0;
1408 
1409 	return soc->ops->cmn_drv_ops->delba_tx_completion(soc, peer_mac,
1410 							  vdev_id,
1411 							  tid, status);
1412 }
1413 
1414 static inline QDF_STATUS
1415 cdp_set_addbaresponse(ol_txrx_soc_handle soc,
1416 		      uint8_t *peer_mac, uint16_t vdev_id, int tid,
1417 		      uint16_t statuscode)
1418 {
1419 	if (!soc || !soc->ops) {
1420 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1421 				"%s: Invalid Instance:", __func__);
1422 		QDF_BUG(0);
1423 		return QDF_STATUS_E_FAILURE;
1424 	}
1425 
1426 	if (!soc->ops->cmn_drv_ops ||
1427 	    !soc->ops->cmn_drv_ops->set_addba_response)
1428 		return QDF_STATUS_E_FAILURE;
1429 
1430 	return soc->ops->cmn_drv_ops->set_addba_response(soc, peer_mac, vdev_id,
1431 						  tid, statuscode);
1432 }
1433 
1434 /**
1435  * cdp_set_vdev_dscp_tid_map(): function to set DSCP-tid map in the vap
1436  * @soc : soc handle
1437  * @vdev_id: id of vdev handle
1438  * @map_id: id of the tid map
1439  *
1440  * Return: QDF_STATUS
1441  */
1442 static inline QDF_STATUS
1443 cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc,
1444 			  uint8_t vdev_id, uint8_t map_id)
1445 {
1446 	if (!soc || !soc->ops) {
1447 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1448 				"%s: Invalid Instance:", __func__);
1449 		QDF_BUG(0);
1450 		return QDF_STATUS_E_FAILURE;
1451 	}
1452 
1453 	if (!soc->ops->cmn_drv_ops ||
1454 	    !soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map)
1455 		return QDF_STATUS_E_FAILURE;
1456 
1457 	return soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map(soc, vdev_id,
1458 				map_id);
1459 }
1460 
1461 #ifdef QCA_MULTIPASS_SUPPORT
1462 /**
1463  * cdp_set_vlan_groupkey(): function to set vlan ID - group key map in the vap
1464  * @soc : soc handle
1465  * @vdev_id: id of vdev handle
1466  * @vlan_id: vlan id
1467  * @group_key: corresponding group key to vlan ID
1468  *
1469  * Return: void
1470  */
1471 static inline
1472 QDF_STATUS cdp_set_vlan_groupkey(ol_txrx_soc_handle soc, uint8_t vdev_id,
1473 				 uint16_t vlan_id, uint16_t group_key)
1474 {
1475 	if (!soc || !soc->ops) {
1476 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1477 			  "%s: Invalid Instance:", __func__);
1478 		QDF_BUG(0);
1479 		return 0;
1480 	}
1481 
1482 	if (!soc->ops->cmn_drv_ops ||
1483 	    !soc->ops->cmn_drv_ops->set_vlan_groupkey)
1484 		return 0;
1485 
1486 	return soc->ops->cmn_drv_ops->set_vlan_groupkey(soc, vdev_id, vlan_id,
1487 							group_key);
1488 }
1489 #endif
1490 
1491 /**
1492  * cdp_ath_get_total_per(): function to get hw retries
1493  * @soc : soc handle
1494  * @pdev_id: id of pdev handle
1495  *
1496  * Return: get hw retries
1497  */
1498 static inline
1499 int cdp_ath_get_total_per(ol_txrx_soc_handle soc, uint8_t pdev_id)
1500 {
1501 	if (!soc || !soc->ops) {
1502 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1503 			  "%s: Invalid Instance:", __func__);
1504 		QDF_BUG(0);
1505 		return 0;
1506 	}
1507 
1508 	if (!soc->ops->cmn_drv_ops ||
1509 	    !soc->ops->cmn_drv_ops->txrx_get_total_per)
1510 		return 0;
1511 
1512 	return soc->ops->cmn_drv_ops->txrx_get_total_per(soc, pdev_id);
1513 }
1514 
1515 /**
1516  * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map
1517  * @pdev_id: id of pdev handle
1518  * @map_id: id of the tid map
1519  * @tos: index value in map that needs to be changed
1520  * @tid: tid value passed by user
1521  *
1522  * Return: void
1523  */
1524 static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc,
1525 		uint8_t pdev_id, uint8_t map_id, uint8_t tos, uint8_t tid)
1526 {
1527 	if (!soc || !soc->ops) {
1528 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1529 				"%s: Invalid Instance:", __func__);
1530 		QDF_BUG(0);
1531 		return;
1532 	}
1533 
1534 	if (!soc->ops->cmn_drv_ops ||
1535 	    !soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map)
1536 		return;
1537 
1538 	soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map(soc, pdev_id,
1539 			map_id, tos, tid);
1540 }
1541 
1542 /**
1543  * cdp_flush_cache_rx_queue() - flush cache rx queue frame
1544  *
1545  * Return: None
1546  */
1547 static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc)
1548 {
1549 	if (!soc || !soc->ops) {
1550 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1551 				"%s: Invalid Instance:", __func__);
1552 		QDF_BUG(0);
1553 		return;
1554 	}
1555 
1556 	if (!soc->ops->cmn_drv_ops ||
1557 	    !soc->ops->cmn_drv_ops->flush_cache_rx_queue)
1558 		return;
1559 	soc->ops->cmn_drv_ops->flush_cache_rx_queue();
1560 }
1561 
1562 /**
1563  * cdp_txrx_stats_request(): function to map to host and firmware statistics
1564  * @soc: soc handle
1565  * @vdev_id: virtual device ID
1566  * @req: stats request container
1567  *
1568  * return: status
1569  */
1570 static inline
1571 int cdp_txrx_stats_request(ol_txrx_soc_handle soc, uint8_t vdev_id,
1572 			   struct cdp_txrx_stats_req *req)
1573 {
1574 	if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) {
1575 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1576 				"%s: Invalid Instance:", __func__);
1577 		QDF_ASSERT(0);
1578 		return 0;
1579 	}
1580 
1581 	if (soc->ops->cmn_drv_ops->txrx_stats_request)
1582 		return soc->ops->cmn_drv_ops->txrx_stats_request(soc, vdev_id,
1583 								 req);
1584 
1585 	return 0;
1586 }
1587 
1588 /**
1589  * cdp_txrx_intr_attach(): function to attach and configure interrupt
1590  * @soc: soc handle
1591  */
1592 static inline QDF_STATUS cdp_txrx_intr_attach(ol_txrx_soc_handle soc)
1593 {
1594 	if (!soc || !soc->ops) {
1595 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1596 				"%s: Invalid Instance:", __func__);
1597 		QDF_BUG(0);
1598 		return 0;
1599 	}
1600 
1601 	if (!soc->ops->cmn_drv_ops ||
1602 	    !soc->ops->cmn_drv_ops->txrx_intr_attach)
1603 		return 0;
1604 
1605 	return soc->ops->cmn_drv_ops->txrx_intr_attach(soc);
1606 }
1607 
1608 /**
1609  * cdp_txrx_intr_detach(): function to detach interrupt
1610  * @soc: soc handle
1611  */
1612 static inline void cdp_txrx_intr_detach(ol_txrx_soc_handle soc)
1613 {
1614 	if (!soc || !soc->ops) {
1615 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1616 				"%s: Invalid Instance:", __func__);
1617 		QDF_BUG(0);
1618 		return;
1619 	}
1620 
1621 	if (!soc->ops->cmn_drv_ops ||
1622 	    !soc->ops->cmn_drv_ops->txrx_intr_detach)
1623 		return;
1624 
1625 	soc->ops->cmn_drv_ops->txrx_intr_detach(soc);
1626 }
1627 
1628 /**
1629  * cdp_display_stats(): function to map to dump stats
1630  * @soc: soc handle
1631  * @value: statistics option
1632  */
1633 static inline QDF_STATUS
1634 cdp_display_stats(ol_txrx_soc_handle soc, uint16_t value,
1635 		  enum qdf_stats_verbosity_level level)
1636 {
1637 	if (!soc || !soc->ops) {
1638 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1639 				"%s: Invalid Instance:", __func__);
1640 		QDF_BUG(0);
1641 		return 0;
1642 	}
1643 
1644 	if (!soc->ops->cmn_drv_ops ||
1645 	    !soc->ops->cmn_drv_ops->display_stats)
1646 		return 0;
1647 
1648 	return soc->ops->cmn_drv_ops->display_stats(soc, value, level);
1649 }
1650 
1651 
1652 /**
1653   * cdp_set_pn_check(): function to set pn check
1654   * @soc: soc handle
1655   * @vdev_id: id of virtual device
1656   * @peer_mac: mac address of peer
1657   * @sec_type: security type
1658   * @rx_pn: receive pn
1659   */
1660 static inline int cdp_set_pn_check(ol_txrx_soc_handle soc,
1661 		uint8_t vdev_id, uint8_t *peer_mac,
1662 		enum cdp_sec_type sec_type,  uint32_t *rx_pn)
1663 {
1664 	if (!soc || !soc->ops) {
1665 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1666 				"%s: Invalid Instance:", __func__);
1667 		QDF_BUG(0);
1668 		return 0;
1669 	}
1670 
1671 	if (!soc->ops->cmn_drv_ops ||
1672 	    !soc->ops->cmn_drv_ops->set_pn_check)
1673 		return 0;
1674 
1675 	soc->ops->cmn_drv_ops->set_pn_check(soc, vdev_id, peer_mac,
1676 			sec_type, rx_pn);
1677 	return 0;
1678 }
1679 
1680 static inline QDF_STATUS
1681 cdp_set_key(ol_txrx_soc_handle soc,
1682 	    uint8_t vdev_id,
1683 	    uint8_t *mac,
1684 	    bool is_unicast, uint32_t *key)
1685 {
1686 	if (!soc || !soc->ops) {
1687 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1688 			  "%s: Invalid Instance:", __func__);
1689 		QDF_BUG(0);
1690 		return QDF_STATUS_E_FAILURE;
1691 	}
1692 
1693 	if (!soc->ops->ctrl_ops ||
1694 	    !soc->ops->ctrl_ops->set_key)
1695 		return QDF_STATUS_E_FAILURE;
1696 
1697 	return soc->ops->ctrl_ops->set_key(soc, vdev_id, mac,
1698 			is_unicast, key);
1699 }
1700 
1701 /**
1702  * cdp_update_config_parameters(): function to propagate configuration
1703  *                                 parameters to datapath
1704  * @soc: opaque soc handle
1705  * @cfg: configuration handle
1706  *
1707  * Return: status: 0 - Success, non-zero: Failure
1708  */
1709 static inline
1710 QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc,
1711 	struct cdp_config_params *cfg)
1712 {
1713 	struct cdp_soc *psoc = (struct cdp_soc *)soc;
1714 
1715 	if (!soc || !soc->ops) {
1716 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1717 				"%s: Invalid Instance:", __func__);
1718 		QDF_BUG(0);
1719 		return 0;
1720 	}
1721 
1722 	if (!soc->ops->cmn_drv_ops ||
1723 	    !soc->ops->cmn_drv_ops->update_config_parameters)
1724 		return QDF_STATUS_SUCCESS;
1725 
1726 	return soc->ops->cmn_drv_ops->update_config_parameters(psoc,
1727 								cfg);
1728 }
1729 
1730 /**
1731  * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev
1732  * @soc: opaque soc handle
1733  * @pdev_id: id of data path pdev handle
1734  *
1735  * Return: opaque dp handle
1736  */
1737 static inline void *
1738 cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id)
1739 {
1740 	if (!soc || !soc->ops) {
1741 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1742 				"%s: Invalid Instance:", __func__);
1743 		QDF_BUG(0);
1744 		return 0;
1745 	}
1746 
1747 	if (soc->ops->cmn_drv_ops->get_dp_txrx_handle)
1748 		return soc->ops->cmn_drv_ops->get_dp_txrx_handle(soc, pdev_id);
1749 
1750 	return 0;
1751 }
1752 
1753 /**
1754  * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev
1755  * @soc: opaque soc handle
1756  * @pdev_id: id of data path pdev handle
1757  * @dp_hdl: opaque pointer for dp_txrx_handle
1758  *
1759  * Return: void
1760  */
1761 static inline void
1762 cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id,
1763 			    void *dp_hdl)
1764 {
1765 	if (!soc || !soc->ops) {
1766 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1767 				"%s: Invalid Instance:", __func__);
1768 		QDF_BUG(0);
1769 		return;
1770 	}
1771 
1772 	if (!soc->ops->cmn_drv_ops ||
1773 			!soc->ops->cmn_drv_ops->set_dp_txrx_handle)
1774 		return;
1775 
1776 	soc->ops->cmn_drv_ops->set_dp_txrx_handle(soc, pdev_id, dp_hdl);
1777 }
1778 
1779 /**
1780  * cdp_vdev_get_dp_ext_txrx_handle() - get extended dp handle from vdev
1781  * @soc: opaque soc handle
1782  * @vdev_id: vdev id
1783  *
1784  * Return: opaque dp handle
1785  */
1786 static inline void *
1787 cdp_vdev_get_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id)
1788 {
1789 	if (!soc || !soc->ops) {
1790 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1791 			  "%s: Invalid Instance:", __func__);
1792 		QDF_BUG(0);
1793 		return 0;
1794 	}
1795 
1796 	if (soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle)
1797 		return soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle(
1798 							soc, vdev_id);
1799 
1800 	return 0;
1801 }
1802 
1803 /**
1804  * cdp_vdev_set_dp_ext_txrx_handle() - set extended dp handle in vdev
1805  * @soc: opaque soc handle
1806  * @vdev_id: vdev id
1807  * @size: size of the advance dp handle
1808  *
1809  * Return: QDF_STATUS
1810  */
1811 static inline QDF_STATUS
1812 cdp_vdev_set_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id,
1813 				uint16_t size)
1814 {
1815 	if (!soc || !soc->ops) {
1816 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1817 			  "%s: Invalid Instance:", __func__);
1818 		QDF_BUG(0);
1819 		return QDF_STATUS_E_FAILURE;
1820 	}
1821 
1822 	if (!soc->ops->cmn_drv_ops ||
1823 	    !soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle)
1824 		return QDF_STATUS_E_FAILURE;
1825 
1826 	return soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle(soc,
1827 								  vdev_id,
1828 								  size);
1829 }
1830 
1831 /*
1832  * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc
1833  * @soc: opaque soc handle
1834  *
1835  * Return: opaque extended dp handle
1836  */
1837 static inline void *
1838 cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc)
1839 {
1840 	if (!soc || !soc->ops) {
1841 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1842 				"%s: Invalid Instance:", __func__);
1843 		QDF_BUG(0);
1844 		return NULL;
1845 	}
1846 
1847 	if (soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle)
1848 		return soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle(
1849 				(struct cdp_soc *) soc);
1850 
1851 	return NULL;
1852 }
1853 
1854 /**
1855  * cdp_soc_set_dp_txrx_handle() - set advanced dp handle in soc
1856  * @soc: opaque soc handle
1857  * @dp_hdl: opaque pointer for dp_txrx_handle
1858  *
1859  * Return: void
1860  */
1861 static inline void
1862 cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle)
1863 {
1864 	if (!soc || !soc->ops) {
1865 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1866 				"%s: Invalid Instance:", __func__);
1867 		QDF_BUG(0);
1868 		return;
1869 	}
1870 
1871 	if (!soc->ops->cmn_drv_ops ||
1872 			!soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle)
1873 		return;
1874 
1875 	soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle((struct cdp_soc *)soc,
1876 			dp_handle);
1877 }
1878 
1879 /**
1880  * cdp_soc_handle_mode_change() - Update pdev_id to lmac_id mapping
1881  * @soc: opaque soc handle
1882  * @pdev_id: id of data path pdev handle
1883  * @lmac_id: lmac id
1884  * Return: QDF_STATUS
1885  */
1886 static inline QDF_STATUS
1887 cdp_soc_handle_mode_change(ol_txrx_soc_handle soc, uint8_t pdev_id,
1888 			   uint32_t lmac_id)
1889 {
1890 	if (!soc || !soc->ops) {
1891 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1892 			  "%s: Invalid Instance:", __func__);
1893 		QDF_BUG(0);
1894 		return QDF_STATUS_E_FAILURE;
1895 	}
1896 
1897 	if (!soc->ops->cmn_drv_ops ||
1898 	    !soc->ops->cmn_drv_ops->map_pdev_to_lmac)
1899 		return QDF_STATUS_E_FAILURE;
1900 
1901 	return soc->ops->cmn_drv_ops->handle_mode_change(soc, pdev_id,
1902 							 lmac_id);
1903 }
1904 
1905 /**
1906  * cdp_soc_map_pdev_to_lmac() - Save pdev_id to lmac_id mapping
1907  * @soc: opaque soc handle
1908  * @pdev_id: id of data path pdev handle
1909  * @lmac_id: lmac id
1910  * Return: QDF_STATUS
1911  */
1912 static inline QDF_STATUS
1913 cdp_soc_map_pdev_to_lmac(ol_txrx_soc_handle soc, uint8_t pdev_id,
1914 			 uint32_t lmac_id)
1915 {
1916 	if (!soc || !soc->ops) {
1917 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1918 			  "%s: Invalid Instance:", __func__);
1919 		QDF_BUG(0);
1920 		return QDF_STATUS_E_FAILURE;
1921 	}
1922 
1923 	if (!soc->ops->cmn_drv_ops ||
1924 	    !soc->ops->cmn_drv_ops->map_pdev_to_lmac)
1925 		return QDF_STATUS_E_FAILURE;
1926 
1927 	return soc->ops->cmn_drv_ops->map_pdev_to_lmac(soc, pdev_id,
1928 			lmac_id);
1929 }
1930 
1931 /**
1932  * cdp_txrx_set_pdev_status_down() - set pdev down/up status
1933  * @soc: soc opaque handle
1934  * @pdev_id: id of data path pdev handle
1935  * @is_pdev_down: pdev down/up status
1936  *
1937  * return: QDF_STATUS
1938  */
1939 static inline QDF_STATUS
1940 cdp_txrx_set_pdev_status_down(ol_txrx_soc_handle soc,
1941 			      uint8_t pdev_id,
1942 			      bool is_pdev_down)
1943 {
1944 	if (!soc || !soc->ops) {
1945 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1946 			  "%s: Invalid Instance:", __func__);
1947 		QDF_BUG(0);
1948 		return QDF_STATUS_E_FAILURE;
1949 	}
1950 
1951 	if (!soc->ops->cmn_drv_ops ||
1952 	    !soc->ops->cmn_drv_ops->set_pdev_status_down)
1953 		return QDF_STATUS_E_FAILURE;
1954 
1955 	return soc->ops->cmn_drv_ops->set_pdev_status_down(soc, pdev_id,
1956 						    is_pdev_down);
1957 }
1958 
1959 /**
1960  * cdp_tx_send() - enqueue frame for transmission
1961  * @soc: soc opaque handle
1962  * @vdev_id: id of VAP device
1963  * @nbuf: nbuf to be enqueued
1964  *
1965  * This API is used by Extended Datapath modules to enqueue frame for
1966  * transmission
1967  *
1968  * Return: void
1969  */
1970 static inline void
1971 cdp_tx_send(ol_txrx_soc_handle soc, uint8_t vdev_id, qdf_nbuf_t nbuf)
1972 {
1973 	if (!soc || !soc->ops) {
1974 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1975 				"%s: Invalid Instance:", __func__);
1976 		QDF_BUG(0);
1977 		return;
1978 	}
1979 
1980 	if (!soc->ops->cmn_drv_ops ||
1981 			!soc->ops->cmn_drv_ops->tx_send)
1982 		return;
1983 
1984 	soc->ops->cmn_drv_ops->tx_send(soc, vdev_id, nbuf);
1985 }
1986 
1987 /**
1988  * cdp_set_pdev_pcp_tid_map() - set pdev pcp-tid-map
1989  * @soc: opaque soc handle
1990  * @pdev_id: id of data path pdev handle
1991  * @pcp: pcp value
1992  * @tid: tid value
1993  *
1994  * This API is used to configure the pcp-to-tid mapping for a pdev.
1995  *
1996  * Return: QDF_STATUS_SUCCESS if value set successfully
1997  *          QDF_STATUS_E_INVAL false if error
1998  */
1999 static inline
2000 QDF_STATUS cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc,
2001 				    uint8_t pdev_id,
2002 				    uint32_t pcp, uint32_t tid)
2003 {
2004 	if (!soc || !soc->ops) {
2005 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2006 			  "%s: Invalid Instance", __func__);
2007 		return QDF_STATUS_E_INVAL;
2008 	}
2009 
2010 	if (!soc->ops->cmn_drv_ops ||
2011 	    !soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map)
2012 		return QDF_STATUS_E_INVAL;
2013 
2014 	return soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map(soc, pdev_id,
2015 							   pcp, tid);
2016 }
2017 
2018 /**
2019  * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id
2020  * @soc: opaque soc handle
2021  * @pdev_id: id of data path pdev handle
2022  * @peer_id: data path peer id
2023  * @peer_mac: peer_mac
2024  *
2025  * Return: QDF_STATUS
2026  */
2027 static inline
2028 QDF_STATUS cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc,
2029 					 uint32_t peer_id, uint8_t *peer_mac)
2030 {
2031 	if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id)
2032 		return soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id(
2033 				soc, peer_id, peer_mac);
2034 
2035 	return QDF_STATUS_E_INVAL;
2036 }
2037 
2038 /**
2039  * cdp_vdev_tx_lock() - acquire lock
2040  * @soc: opaque soc handle
2041  * @vdev: data path vdev handle
2042  *
2043  * Return: void
2044  */
2045 static inline
2046 void cdp_vdev_tx_lock(ol_txrx_soc_handle soc,
2047 		      uint8_t vdev_id)
2048 {
2049 	if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock)
2050 		soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(soc, vdev_id);
2051 }
2052 
2053 /**
2054  * cdp_vdev_tx_unlock() - release lock
2055  * @soc: opaque soc handle
2056  * @vdev_id: id of data path vdev handle
2057  *
2058  * Return: void
2059  */
2060 static inline
2061 void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc,
2062 			uint8_t vdev_id)
2063 {
2064 	if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock)
2065 		soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(soc, vdev_id);
2066 }
2067 
2068 /**
2069  * cdp_ath_getstats() - get updated athstats
2070  * @soc: opaque soc handle
2071  * @id: vdev_id/pdev_id based on type
2072  * @stats: cdp network device stats structure
2073  * @type: device type pdev/vdev
2074  *
2075  * Return: QDF_STATUS
2076  */
2077 static inline QDF_STATUS
2078 cdp_ath_getstats(ol_txrx_soc_handle soc,
2079 		 uint8_t id, struct cdp_dev_stats *stats,
2080 		 uint8_t type)
2081 {
2082 	if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats)
2083 		return soc->ops->cmn_drv_ops->txrx_ath_getstats(soc, id,
2084 								stats, type);
2085 
2086 	return QDF_STATUS_E_FAILURE;
2087 }
2088 
2089 /**
2090  * cdp_set_gid_flag() - set groupid flag
2091  * @soc: opaque soc handle
2092  * @pdev_id: id of data path pdev handle
2093  * @mem_status: member status from grp management frame
2094  * @user_position: user position from grp management frame
2095  *
2096  * Return: QDF_STATUS
2097  */
2098 static inline QDF_STATUS
2099 cdp_set_gid_flag(ol_txrx_soc_handle soc,
2100 		 uint8_t pdev_id, u_int8_t *mem_status,
2101 		 u_int8_t *user_position)
2102 {
2103 	if (soc->ops->cmn_drv_ops->txrx_set_gid_flag)
2104 		return soc->ops->cmn_drv_ops->txrx_set_gid_flag(soc, pdev_id,
2105 							 mem_status,
2106 							 user_position);
2107 	return QDF_STATUS_E_FAILURE;
2108 }
2109 
2110 /**
2111  * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version
2112  * @soc: opaque soc handle
2113  * @pdev_id: id of data path pdev handle
2114  *
2115  */
2116 static inline
2117 uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc,
2118 					    uint8_t pdev_id)
2119 {
2120 	if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version)
2121 		return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(soc, pdev_id);
2122 	return 0;
2123 }
2124 
2125 /**
2126  * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev
2127  * @soc: opaque soc handle
2128  * @vdev_id: id of vdev device
2129  * @force: number of frame in SW queue
2130  * Return: void
2131  */
2132 static inline
2133 void cdp_if_mgmt_drain(ol_txrx_soc_handle soc,
2134 		uint8_t vdev_id, int force)
2135 {
2136 	if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain)
2137 		soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(soc, vdev_id, force);
2138 }
2139 
2140 /* cdp_peer_map_attach() - CDP API to allocate PEER map memory
2141  * @soc: opaque soc handle
2142  * @max_peers: number of peers created in FW
2143  * @max_ast_index: max number of AST index supported in FW
2144  * @peer_map_unmap_v2: flag indicates HTT peer map v2 is enabled in FW
2145  *
2146  *
2147  * Return: QDF_STATUS
2148  */
2149 static inline QDF_STATUS
2150 cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers,
2151 		    uint32_t max_ast_index, bool peer_map_unmap_v2)
2152 {
2153 	if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2154 	    soc->ops->cmn_drv_ops->txrx_peer_map_attach)
2155 		return soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc,
2156 							max_peers,
2157 							max_ast_index,
2158 							peer_map_unmap_v2);
2159 
2160 	return QDF_STATUS_SUCCESS;
2161 }
2162 
2163 /* cdp_txrx_classify_and_update() - To classify the packet and update stats
2164  * @soc: opaque soc handle
2165  * @vdev: opaque dp vdev handle
2166  * @skb: data
2167  * @dir: rx or tx packet
2168  * @nbuf_classify: packet classification object
2169  *
2170  * Return: 1 on success else return 0
2171  */
2172 static inline int
2173 cdp_txrx_classify_and_update(ol_txrx_soc_handle soc,
2174 			     uint8_t vdev_id, qdf_nbuf_t skb,
2175 			     enum txrx_direction dir,
2176 			     struct ol_txrx_nbuf_classify *nbuf_class)
2177 {
2178 	if (!soc || !soc->ops) {
2179 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2180 			  "%s: Invalid Instance", __func__);
2181 		QDF_BUG(0);
2182 		return 0;
2183 	}
2184 
2185 	if (!soc->ops->cmn_drv_ops ||
2186 	    !soc->ops->cmn_drv_ops->txrx_classify_update)
2187 		return 0;
2188 
2189 	return soc->ops->cmn_drv_ops->txrx_classify_update(soc, vdev_id,
2190 							   skb,
2191 							   dir, nbuf_class);
2192 }
2193 
2194 /**
2195  * cdp_get_dp_capabilities() - get DP capabilities
2196  * @soc: opaque soc handle
2197  * @dp_cap: enum of DP capabilities
2198  *
2199  * Return: bool
2200  */
2201 static inline bool
2202 cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps)
2203 {
2204 	if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2205 	    soc->ops->cmn_drv_ops->get_dp_capabilities)
2206 		return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps);
2207 	return false;
2208 }
2209 
2210 #ifdef RECEIVE_OFFLOAD
2211 /**
2212  * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer
2213  * @soc - data path soc handle
2214  * @pdev - device instance pointer
2215  *
2216  * register rx offload flush callback function pointer
2217  *
2218  * return none
2219  */
2220 static inline void cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc,
2221 						  void (rx_ol_flush_cb)(void *))
2222 {
2223 	if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
2224 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
2225 			  "%s invalid instance", __func__);
2226 		return;
2227 	}
2228 
2229 	if (soc->ops->rx_offld_ops->register_rx_offld_flush_cb)
2230 		return soc->ops->rx_offld_ops->register_rx_offld_flush_cb(
2231 								rx_ol_flush_cb);
2232 }
2233 
2234 /**
2235  * cdp_deregister_rx_offld_flush_cb() - deregister Rx offld flush cb function
2236  * @soc - data path soc handle
2237  *
2238  * deregister rx offload flush callback function pointer
2239  *
2240  * return none
2241  */
2242 static inline void cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc)
2243 {
2244 	if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
2245 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
2246 			  "%s invalid instance", __func__);
2247 		return;
2248 	}
2249 
2250 	if (soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb)
2251 		return soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb();
2252 }
2253 #endif /* RECEIVE_OFFLOAD */
2254 
2255 /**
2256  * @cdp_set_ba_timeout() - set ba aging timeout per AC
2257  *
2258  * @soc - pointer to the soc
2259  * @value - timeout value in millisec
2260  * @ac - Access category
2261  *
2262  * @return - void
2263  */
2264 static inline void cdp_set_ba_timeout(ol_txrx_soc_handle soc,
2265 				      uint8_t ac, uint32_t value)
2266 {
2267 	if (!soc || !soc->ops) {
2268 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2269 			  "%s: Invalid Instance", __func__);
2270 		QDF_BUG(0);
2271 		return;
2272 	}
2273 
2274 	if (!soc->ops->cmn_drv_ops ||
2275 	    !soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout)
2276 		return;
2277 
2278 	soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout(soc, ac, value);
2279 }
2280 
2281 /**
2282  * @cdp_get_ba_timeout() - return ba aging timeout per AC
2283  *
2284  * @soc - pointer to the soc
2285  * @ac - access category
2286  * @value - timeout value in millisec
2287  *
2288  * @return - void
2289  */
2290 static inline void cdp_get_ba_timeout(ol_txrx_soc_handle soc,
2291 				      uint8_t ac, uint32_t *value)
2292 {
2293 	if (!soc || !soc->ops) {
2294 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2295 			  "%s: Invalid Instance", __func__);
2296 		QDF_BUG(0);
2297 		return;
2298 	}
2299 
2300 	if (!soc->ops->cmn_drv_ops ||
2301 	    !soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout)
2302 		return;
2303 
2304 	soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout(soc, ac, value);
2305 }
2306 
2307 /**
2308  * cdp_cfg_get() - get cfg for dp enum
2309  *
2310  * @soc: pointer to the soc
2311  * @cfg: cfg enum
2312  *
2313  * Return - cfg value
2314  */
2315 static inline uint32_t cdp_cfg_get(ol_txrx_soc_handle soc, enum cdp_dp_cfg cfg)
2316 {
2317 	if (!soc || !soc->ops) {
2318 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2319 			  "%s: Invalid Instance", __func__);
2320 		return 0;
2321 	}
2322 
2323 	if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_cfg)
2324 		return 0;
2325 
2326 	return soc->ops->cmn_drv_ops->txrx_get_cfg(soc, cfg);
2327 }
2328 
2329 /**
2330  * cdp_soc_set_rate_stats_ctx() - set rate stats context in soc
2331  * @soc: opaque soc handle
2332  * @ctx: rate stats context
2333  *
2334  * Return: void
2335  */
2336 static inline void
2337 cdp_soc_set_rate_stats_ctx(ol_txrx_soc_handle soc,
2338 			   void *ctx)
2339 {
2340 	if (!soc || !soc->ops) {
2341 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2342 			  "%s: Invalid Instance:", __func__);
2343 		QDF_BUG(0);
2344 		return;
2345 	}
2346 
2347 	if (!soc->ops->cmn_drv_ops ||
2348 	    !soc->ops->cmn_drv_ops->set_rate_stats_ctx)
2349 		return;
2350 
2351 	soc->ops->cmn_drv_ops->set_rate_stats_ctx((struct cdp_soc_t *)soc,
2352 						  ctx);
2353 }
2354 
2355 /**
2356  * cdp_soc_get_rate_stats_ctx() - get rate stats context in soc
2357  * @soc: opaque soc handle
2358  *
2359  * Return: void
2360  */
2361 static inline void*
2362 cdp_soc_get_rate_stats_ctx(ol_txrx_soc_handle soc)
2363 {
2364 	if (!soc || !soc->ops) {
2365 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2366 			  "%s: Invalid Instance:", __func__);
2367 		QDF_BUG(0);
2368 		return NULL;
2369 	}
2370 
2371 	if (!soc->ops->cmn_drv_ops ||
2372 	    !soc->ops->cmn_drv_ops->get_rate_stats_ctx)
2373 		return NULL;
2374 
2375 	return soc->ops->cmn_drv_ops->get_rate_stats_ctx(soc);
2376 }
2377 
2378 /**
2379  * cdp_peer_flush_rate_stats() - flush peer rate statistics
2380  * @soc: opaque soc handle
2381  * @pdev_id: id of pdev handle
2382  * @buf: stats buffer
2383  */
2384 static inline void
2385 cdp_peer_flush_rate_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
2386 			  void *buf)
2387 {
2388 	if (!soc || !soc->ops) {
2389 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2390 			  "%s: Invalid Instance:", __func__);
2391 		QDF_BUG(0);
2392 		return;
2393 	}
2394 
2395 	if (!soc->ops->cmn_drv_ops ||
2396 	    !soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats)
2397 		return;
2398 
2399 	soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats(soc, pdev_id, buf);
2400 }
2401 
2402 /**
2403  * cdp_flush_rate_stats_request() - request flush rate statistics
2404  * @soc: opaque soc handle
2405  * @pdev_id: id of pdev handle
2406  */
2407 static inline QDF_STATUS
2408 cdp_flush_rate_stats_request(struct cdp_soc_t *soc, uint8_t pdev_id)
2409 {
2410 	if (!soc || !soc->ops) {
2411 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2412 			  "%s: Invalid Instance:", __func__);
2413 		QDF_BUG(0);
2414 		return QDF_STATUS_E_FAILURE;
2415 	}
2416 
2417 	if (!soc->ops->cmn_drv_ops ||
2418 	    !soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request)
2419 		return QDF_STATUS_E_FAILURE;
2420 
2421 	return soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request(soc,
2422 								    pdev_id);
2423 }
2424 
2425 /**
2426  * cdp_set_vdev_pcp_tid_map() - set vdev pcp-tid-map
2427  * @soc: opaque soc handle
2428  * @vdev: id of data path vdev handle
2429  * @pcp: pcp value
2430  * @tid: tid value
2431  *
2432  * This API is used to configure the pcp-to-tid mapping for a pdev.
2433  *
2434  * Return: QDF_STATUS_SUCCESS if value set successfully
2435  *          QDF_STATUS_E_INVAL false if error
2436  */
2437 static inline
2438 QDF_STATUS cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc,
2439 				    uint8_t vdev_id,
2440 				    uint8_t pcp, uint8_t tid)
2441 {
2442 	if (!soc || !soc->ops) {
2443 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2444 			  "%s: Invalid Instance", __func__);
2445 		return QDF_STATUS_E_INVAL;
2446 	}
2447 
2448 	if (!soc->ops->cmn_drv_ops ||
2449 	    !soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map)
2450 		return QDF_STATUS_E_INVAL;
2451 
2452 	return soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map(soc, vdev_id,
2453 							   pcp, tid);
2454 }
2455 
2456 /**
2457  * cdp_tx_send_exc() - Transmit a frame on a given vdev in exception path
2458  *
2459  * @soc: opaque soc handle
2460  * @vdev_id: vdev id
2461  * @nbuf: skb
2462  * @tx_exc_metadata: Handle that holds exception path meta data
2463  *
2464  * Return: NULL on success
2465  *         nbuf when it fails to send
2466  */
2467 static inline qdf_nbuf_t
2468 cdp_tx_send_exc(ol_txrx_soc_handle soc,
2469 		uint8_t vdev_id,
2470 		qdf_nbuf_t nbuf,
2471 		struct cdp_tx_exception_metadata *tx_exc_metadata)
2472 {
2473 	if (!soc || !soc->ops) {
2474 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2475 			  "%s: Invalid Instance", __func__);
2476 		QDF_BUG(0);
2477 		return 0;
2478 	}
2479 
2480 	if (!soc->ops->cmn_drv_ops ||
2481 	    !soc->ops->cmn_drv_ops->tx_send_exc)
2482 		return 0;
2483 
2484 	return soc->ops->cmn_drv_ops->tx_send_exc
2485 			(soc, vdev_id, nbuf, tx_exc_metadata);
2486 }
2487 
2488 /**
2489  * cdp_vdev_get_peer_mac_list(): function to get peer mac list of vdev
2490  * @soc: Datapath soc handle
2491  * @vdev_id: vdev id
2492  * @newmac: Table of the clients mac
2493  * @mac_cnt: No. of MACs required
2494  *
2495  * return: no of clients
2496  */
2497 static inline uint16_t
2498 cdp_vdev_get_peer_mac_list(ol_txrx_soc_handle soc,
2499 			   uint8_t vdev_id,
2500 			   uint8_t newmac[][QDF_MAC_ADDR_SIZE],
2501 			   uint16_t mac_cnt)
2502 {
2503 	if (!soc || !soc->ops) {
2504 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2505 			  "%s: Invalid Instance", __func__);
2506 		QDF_BUG(0);
2507 		return 0;
2508 	}
2509 
2510 	if (!soc->ops->cmn_drv_ops ||
2511 	    !soc->ops->cmn_drv_ops->get_peer_mac_list)
2512 		return 0;
2513 
2514 	return soc->ops->cmn_drv_ops->get_peer_mac_list
2515 			(soc, vdev_id, newmac, mac_cnt);
2516 }
2517 
2518 #endif /* _CDP_TXRX_CMN_H_ */
2519