xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_cmn.h (revision 6d768494e5ce14eb1603a695c86739d12ecc6ec2)
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_init() - Initialize txrx SOC
1215  * @soc: ol_txrx_soc_handle handle
1216  * @devid: Device ID
1217  * @hif_handle: Opaque HIF handle
1218  * @psoc: Opaque Objmgr handle
1219  * @htc_handle: Opaque HTC handle
1220  * @qdf_dev: QDF device
1221  * @dp_ol_if_ops: Offload Operations
1222  *
1223  * Return: DP SOC handle on success, NULL on failure
1224  */
1225 static inline QDF_STATUS
1226 cdp_pdev_init(ol_txrx_soc_handle soc,
1227 	      HTC_HANDLE htc_handle, qdf_device_t qdf_dev,
1228 	      uint8_t pdev_id)
1229 {
1230 	if (!soc || !soc->ops) {
1231 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1232 			  "%s: Invalid Instance:", __func__);
1233 		QDF_BUG(0);
1234 		return 0;
1235 	}
1236 
1237 	if (!soc->ops->cmn_drv_ops ||
1238 	    !soc->ops->cmn_drv_ops->txrx_pdev_init)
1239 		return 0;
1240 
1241 	return soc->ops->cmn_drv_ops->txrx_pdev_init(soc,
1242 						     htc_handle, qdf_dev,
1243 						     pdev_id);
1244 }
1245 
1246 /**
1247  * cdp_soc_deinit() - Deinitialize txrx SOC
1248  * @soc: Opaque DP SOC handle
1249  *
1250  * Return: None
1251  */
1252 static inline void
1253 cdp_soc_deinit(ol_txrx_soc_handle soc)
1254 {
1255 	if (!soc || !soc->ops) {
1256 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1257 			  "%s: Invalid Instance:", __func__);
1258 		QDF_BUG(0);
1259 		return;
1260 	}
1261 
1262 	if (!soc->ops->cmn_drv_ops ||
1263 	    !soc->ops->cmn_drv_ops->txrx_soc_deinit)
1264 		return;
1265 
1266 	soc->ops->cmn_drv_ops->txrx_soc_deinit(soc);
1267 }
1268 
1269 /**
1270  * cdp_tso_soc_attach() - TSO attach function
1271  * @soc: ol_txrx_soc_handle handle
1272  *
1273  * Reserve TSO descriptor buffers
1274  *
1275  * Return: QDF_STATUS_SUCCESS on Success or
1276  * QDF_STATUS_E_FAILURE on failure
1277  */
1278 static inline QDF_STATUS
1279 cdp_tso_soc_attach(ol_txrx_soc_handle soc)
1280 {
1281 	if (!soc || !soc->ops) {
1282 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1283 			  "%s: Invalid Instance:", __func__);
1284 		QDF_BUG(0);
1285 		return 0;
1286 	}
1287 
1288 	if (!soc->ops->cmn_drv_ops ||
1289 	    !soc->ops->cmn_drv_ops->txrx_tso_soc_attach)
1290 		return 0;
1291 
1292 	return soc->ops->cmn_drv_ops->txrx_tso_soc_attach(soc);
1293 }
1294 
1295 /**
1296  * cdp_tso_soc_detach() - TSO detach function
1297  * @soc: ol_txrx_soc_handle handle
1298  *
1299  * Release TSO descriptor buffers
1300  *
1301  * Return: QDF_STATUS_SUCCESS on Success or
1302  * QDF_STATUS_E_FAILURE on failure
1303  */
1304 static inline QDF_STATUS
1305 cdp_tso_soc_detach(ol_txrx_soc_handle soc)
1306 {
1307 	if (!soc || !soc->ops) {
1308 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1309 			  "%s: Invalid Instance:", __func__);
1310 		QDF_BUG(0);
1311 		return 0;
1312 	}
1313 
1314 	if (!soc->ops->cmn_drv_ops ||
1315 	    !soc->ops->cmn_drv_ops->txrx_tso_soc_detach)
1316 		return 0;
1317 
1318 	return soc->ops->cmn_drv_ops->txrx_tso_soc_detach(soc);
1319 }
1320 
1321 /**
1322  * cdp_addba_resp_tx_completion() - Indicate addba response tx
1323  * completion to dp to change tid state.
1324  * @soc: soc handle
1325  * @peer_mac: mac address of peer handle
1326  * @vdev_id: id of vdev handle
1327  * @tid: tid
1328  * @status: Tx completion status
1329  *
1330  * Return: success/failure of tid update
1331  */
1332 static inline int cdp_addba_resp_tx_completion(ol_txrx_soc_handle soc,
1333 					       uint8_t *peer_mac,
1334 					       uint16_t vdev_id,
1335 					       uint8_t tid, int status)
1336 {
1337 	if (!soc || !soc->ops) {
1338 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1339 			  "%s: Invalid Instance:", __func__);
1340 		QDF_BUG(0);
1341 		return 0;
1342 	}
1343 
1344 	if (!soc->ops->cmn_drv_ops ||
1345 	    !soc->ops->cmn_drv_ops->addba_resp_tx_completion)
1346 		return 0;
1347 
1348 	return soc->ops->cmn_drv_ops->addba_resp_tx_completion(soc, peer_mac,
1349 					vdev_id, tid, status);
1350 }
1351 
1352 static inline int cdp_addba_requestprocess(ol_txrx_soc_handle soc,
1353 	uint8_t *peer_mac, uint16_t vdev_id, uint8_t dialogtoken, uint16_t tid,
1354 	uint16_t batimeout, uint16_t buffersize, uint16_t startseqnum)
1355 {
1356 	if (!soc || !soc->ops) {
1357 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1358 				"%s: Invalid Instance:", __func__);
1359 		QDF_BUG(0);
1360 		return 0;
1361 	}
1362 
1363 	if (!soc->ops->cmn_drv_ops ||
1364 	    !soc->ops->cmn_drv_ops->addba_requestprocess)
1365 		return 0;
1366 
1367 	return soc->ops->cmn_drv_ops->addba_requestprocess(soc, peer_mac,
1368 			vdev_id, dialogtoken, tid, batimeout, buffersize,
1369 			startseqnum);
1370 }
1371 
1372 static inline QDF_STATUS
1373 cdp_addba_responsesetup(ol_txrx_soc_handle soc,
1374 			uint8_t *peer_mac, uint16_t vdev_id,
1375 			uint8_t tid, uint8_t *dialogtoken,
1376 			uint16_t *statuscode, uint16_t *buffersize,
1377 			uint16_t *batimeout)
1378 {
1379 	if (!soc || !soc->ops) {
1380 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1381 				"%s: Invalid Instance:", __func__);
1382 		QDF_BUG(0);
1383 		return QDF_STATUS_E_FAILURE;
1384 	}
1385 
1386 	if (!soc->ops->cmn_drv_ops ||
1387 	    !soc->ops->cmn_drv_ops->addba_responsesetup)
1388 		return QDF_STATUS_E_FAILURE;
1389 
1390 	return soc->ops->cmn_drv_ops->addba_responsesetup(soc, peer_mac,
1391 			vdev_id, tid, dialogtoken, statuscode, buffersize,
1392 			batimeout);
1393 }
1394 
1395 static inline int cdp_delba_process(ol_txrx_soc_handle soc, uint8_t *peer_mac,
1396 				    uint16_t vdev_id, int tid,
1397 				    uint16_t reasoncode)
1398 {
1399 	if (!soc || !soc->ops) {
1400 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1401 				"%s: Invalid Instance:", __func__);
1402 		QDF_BUG(0);
1403 		return 0;
1404 	}
1405 
1406 	if (!soc->ops->cmn_drv_ops ||
1407 	    !soc->ops->cmn_drv_ops->delba_process)
1408 		return 0;
1409 
1410 	return soc->ops->cmn_drv_ops->delba_process(soc, peer_mac,
1411 						vdev_id, tid, reasoncode);
1412 }
1413 
1414 /**
1415  * cdp_delba_tx_completion() - Handle delba tx completion
1416  * to update stats and retry transmission if failed.
1417  * @soc: soc handle
1418  * @peer_mac: peer mac address
1419  * @vdev_id: id of vdev handle
1420  * @tid: Tid number
1421  * @status: Tx completion status
1422  *
1423  * Return: 0 on Success, 1 on failure
1424  */
1425 
1426 static inline int cdp_delba_tx_completion(ol_txrx_soc_handle soc,
1427 					  uint8_t *peer_mac,
1428 					  uint16_t vdev_id,
1429 					  uint8_t tid, int status)
1430 {
1431 	if (!soc || !soc->ops) {
1432 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1433 			  "%s: Invalid Instance:", __func__);
1434 		QDF_BUG(0);
1435 		return 0;
1436 	}
1437 
1438 	if (!soc->ops->cmn_drv_ops ||
1439 	    !soc->ops->cmn_drv_ops->delba_tx_completion)
1440 		return 0;
1441 
1442 	return soc->ops->cmn_drv_ops->delba_tx_completion(soc, peer_mac,
1443 							  vdev_id,
1444 							  tid, status);
1445 }
1446 
1447 static inline QDF_STATUS
1448 cdp_set_addbaresponse(ol_txrx_soc_handle soc,
1449 		      uint8_t *peer_mac, uint16_t vdev_id, int tid,
1450 		      uint16_t statuscode)
1451 {
1452 	if (!soc || !soc->ops) {
1453 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1454 				"%s: Invalid Instance:", __func__);
1455 		QDF_BUG(0);
1456 		return QDF_STATUS_E_FAILURE;
1457 	}
1458 
1459 	if (!soc->ops->cmn_drv_ops ||
1460 	    !soc->ops->cmn_drv_ops->set_addba_response)
1461 		return QDF_STATUS_E_FAILURE;
1462 
1463 	return soc->ops->cmn_drv_ops->set_addba_response(soc, peer_mac, vdev_id,
1464 						  tid, statuscode);
1465 }
1466 
1467 /**
1468  * cdp_set_vdev_dscp_tid_map(): function to set DSCP-tid map in the vap
1469  * @soc : soc handle
1470  * @vdev_id: id of vdev handle
1471  * @map_id: id of the tid map
1472  *
1473  * Return: QDF_STATUS
1474  */
1475 static inline QDF_STATUS
1476 cdp_set_vdev_dscp_tid_map(ol_txrx_soc_handle soc,
1477 			  uint8_t vdev_id, uint8_t map_id)
1478 {
1479 	if (!soc || !soc->ops) {
1480 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1481 				"%s: Invalid Instance:", __func__);
1482 		QDF_BUG(0);
1483 		return QDF_STATUS_E_FAILURE;
1484 	}
1485 
1486 	if (!soc->ops->cmn_drv_ops ||
1487 	    !soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map)
1488 		return QDF_STATUS_E_FAILURE;
1489 
1490 	return soc->ops->cmn_drv_ops->set_vdev_dscp_tid_map(soc, vdev_id,
1491 				map_id);
1492 }
1493 
1494 #ifdef QCA_MULTIPASS_SUPPORT
1495 /**
1496  * cdp_set_vlan_groupkey(): function to set vlan ID - group key map in the vap
1497  * @soc : soc handle
1498  * @vdev_id: id of vdev handle
1499  * @vlan_id: vlan id
1500  * @group_key: corresponding group key to vlan ID
1501  *
1502  * Return: void
1503  */
1504 static inline
1505 QDF_STATUS cdp_set_vlan_groupkey(ol_txrx_soc_handle soc, uint8_t vdev_id,
1506 				 uint16_t vlan_id, uint16_t group_key)
1507 {
1508 	if (!soc || !soc->ops) {
1509 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1510 			  "%s: Invalid Instance:", __func__);
1511 		QDF_BUG(0);
1512 		return 0;
1513 	}
1514 
1515 	if (!soc->ops->cmn_drv_ops ||
1516 	    !soc->ops->cmn_drv_ops->set_vlan_groupkey)
1517 		return 0;
1518 
1519 	return soc->ops->cmn_drv_ops->set_vlan_groupkey(soc, vdev_id, vlan_id,
1520 							group_key);
1521 }
1522 #endif
1523 
1524 /**
1525  * cdp_ath_get_total_per(): function to get hw retries
1526  * @soc : soc handle
1527  * @pdev_id: id of pdev handle
1528  *
1529  * Return: get hw retries
1530  */
1531 static inline
1532 int cdp_ath_get_total_per(ol_txrx_soc_handle soc, uint8_t pdev_id)
1533 {
1534 	if (!soc || !soc->ops) {
1535 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1536 			  "%s: Invalid Instance:", __func__);
1537 		QDF_BUG(0);
1538 		return 0;
1539 	}
1540 
1541 	if (!soc->ops->cmn_drv_ops ||
1542 	    !soc->ops->cmn_drv_ops->txrx_get_total_per)
1543 		return 0;
1544 
1545 	return soc->ops->cmn_drv_ops->txrx_get_total_per(soc, pdev_id);
1546 }
1547 
1548 /**
1549  * cdp_set_pdev_dscp_tid_map(): function to change tid values in DSCP-tid map
1550  * @pdev_id: id of pdev handle
1551  * @map_id: id of the tid map
1552  * @tos: index value in map that needs to be changed
1553  * @tid: tid value passed by user
1554  *
1555  * Return: void
1556  */
1557 static inline void cdp_set_pdev_dscp_tid_map(ol_txrx_soc_handle soc,
1558 		uint8_t pdev_id, uint8_t map_id, uint8_t tos, uint8_t tid)
1559 {
1560 	if (!soc || !soc->ops) {
1561 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1562 				"%s: Invalid Instance:", __func__);
1563 		QDF_BUG(0);
1564 		return;
1565 	}
1566 
1567 	if (!soc->ops->cmn_drv_ops ||
1568 	    !soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map)
1569 		return;
1570 
1571 	soc->ops->cmn_drv_ops->set_pdev_dscp_tid_map(soc, pdev_id,
1572 			map_id, tos, tid);
1573 }
1574 
1575 /**
1576  * cdp_flush_cache_rx_queue() - flush cache rx queue frame
1577  *
1578  * Return: None
1579  */
1580 static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc)
1581 {
1582 	if (!soc || !soc->ops) {
1583 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1584 				"%s: Invalid Instance:", __func__);
1585 		QDF_BUG(0);
1586 		return;
1587 	}
1588 
1589 	if (!soc->ops->cmn_drv_ops ||
1590 	    !soc->ops->cmn_drv_ops->flush_cache_rx_queue)
1591 		return;
1592 	soc->ops->cmn_drv_ops->flush_cache_rx_queue();
1593 }
1594 
1595 /**
1596  * cdp_txrx_stats_request(): function to map to host and firmware statistics
1597  * @soc: soc handle
1598  * @vdev_id: virtual device ID
1599  * @req: stats request container
1600  *
1601  * return: status
1602  */
1603 static inline
1604 int cdp_txrx_stats_request(ol_txrx_soc_handle soc, uint8_t vdev_id,
1605 			   struct cdp_txrx_stats_req *req)
1606 {
1607 	if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) {
1608 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1609 				"%s: Invalid Instance:", __func__);
1610 		QDF_ASSERT(0);
1611 		return 0;
1612 	}
1613 
1614 	if (soc->ops->cmn_drv_ops->txrx_stats_request)
1615 		return soc->ops->cmn_drv_ops->txrx_stats_request(soc, vdev_id,
1616 								 req);
1617 
1618 	return 0;
1619 }
1620 
1621 /**
1622  * cdp_txrx_intr_attach(): function to attach and configure interrupt
1623  * @soc: soc handle
1624  */
1625 static inline QDF_STATUS cdp_txrx_intr_attach(ol_txrx_soc_handle soc)
1626 {
1627 	if (!soc || !soc->ops) {
1628 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1629 				"%s: Invalid Instance:", __func__);
1630 		QDF_BUG(0);
1631 		return 0;
1632 	}
1633 
1634 	if (!soc->ops->cmn_drv_ops ||
1635 	    !soc->ops->cmn_drv_ops->txrx_intr_attach)
1636 		return 0;
1637 
1638 	return soc->ops->cmn_drv_ops->txrx_intr_attach(soc);
1639 }
1640 
1641 /**
1642  * cdp_txrx_intr_detach(): function to detach interrupt
1643  * @soc: soc handle
1644  */
1645 static inline void cdp_txrx_intr_detach(ol_txrx_soc_handle soc)
1646 {
1647 	if (!soc || !soc->ops) {
1648 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1649 				"%s: Invalid Instance:", __func__);
1650 		QDF_BUG(0);
1651 		return;
1652 	}
1653 
1654 	if (!soc->ops->cmn_drv_ops ||
1655 	    !soc->ops->cmn_drv_ops->txrx_intr_detach)
1656 		return;
1657 
1658 	soc->ops->cmn_drv_ops->txrx_intr_detach(soc);
1659 }
1660 
1661 /**
1662  * cdp_display_stats(): function to map to dump stats
1663  * @soc: soc handle
1664  * @value: statistics option
1665  */
1666 static inline QDF_STATUS
1667 cdp_display_stats(ol_txrx_soc_handle soc, uint16_t value,
1668 		  enum qdf_stats_verbosity_level level)
1669 {
1670 	if (!soc || !soc->ops) {
1671 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1672 				"%s: Invalid Instance:", __func__);
1673 		QDF_BUG(0);
1674 		return 0;
1675 	}
1676 
1677 	if (!soc->ops->cmn_drv_ops ||
1678 	    !soc->ops->cmn_drv_ops->display_stats)
1679 		return 0;
1680 
1681 	return soc->ops->cmn_drv_ops->display_stats(soc, value, level);
1682 }
1683 
1684 
1685 /**
1686   * cdp_set_pn_check(): function to set pn check
1687   * @soc: soc handle
1688   * @vdev_id: id of virtual device
1689   * @peer_mac: mac address of peer
1690   * @sec_type: security type
1691   * @rx_pn: receive pn
1692   */
1693 static inline int cdp_set_pn_check(ol_txrx_soc_handle soc,
1694 		uint8_t vdev_id, uint8_t *peer_mac,
1695 		enum cdp_sec_type sec_type,  uint32_t *rx_pn)
1696 {
1697 	if (!soc || !soc->ops) {
1698 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1699 				"%s: Invalid Instance:", __func__);
1700 		QDF_BUG(0);
1701 		return 0;
1702 	}
1703 
1704 	if (!soc->ops->cmn_drv_ops ||
1705 	    !soc->ops->cmn_drv_ops->set_pn_check)
1706 		return 0;
1707 
1708 	soc->ops->cmn_drv_ops->set_pn_check(soc, vdev_id, peer_mac,
1709 			sec_type, rx_pn);
1710 	return 0;
1711 }
1712 
1713 /**
1714  * cdp_set_key_sec_type(): function to set sec mode of key
1715  * @soc: soc handle
1716  * @vdev_id: id of virtual device
1717  * @peer_mac: mac address of peer
1718  * @sec_type: security type
1719  * #is_unicast: ucast or mcast
1720  */
1721 static inline int cdp_set_key_sec_type(ol_txrx_soc_handle soc,
1722 				       uint8_t vdev_id,
1723 				       uint8_t *peer_mac,
1724 				       enum cdp_sec_type sec_type,
1725 				       bool is_unicast)
1726 {
1727 	if (!soc || !soc->ops) {
1728 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1729 			  "%s: Invalid Instance:", __func__);
1730 		QDF_BUG(0);
1731 		return 0;
1732 	}
1733 
1734 	if (!soc->ops->cmn_drv_ops ||
1735 	    !soc->ops->cmn_drv_ops->set_key_sec_type)
1736 		return 0;
1737 
1738 	soc->ops->cmn_drv_ops->set_key_sec_type(soc, vdev_id,
1739 			peer_mac, sec_type, is_unicast);
1740 	return 0;
1741 }
1742 
1743 static inline QDF_STATUS
1744 cdp_set_key(ol_txrx_soc_handle soc,
1745 	    uint8_t vdev_id,
1746 	    uint8_t *mac,
1747 	    bool is_unicast, uint32_t *key)
1748 {
1749 	if (!soc || !soc->ops) {
1750 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1751 			  "%s: Invalid Instance:", __func__);
1752 		QDF_BUG(0);
1753 		return QDF_STATUS_E_FAILURE;
1754 	}
1755 
1756 	if (!soc->ops->ctrl_ops ||
1757 	    !soc->ops->ctrl_ops->set_key)
1758 		return QDF_STATUS_E_FAILURE;
1759 
1760 	return soc->ops->ctrl_ops->set_key(soc, vdev_id, mac,
1761 			is_unicast, key);
1762 }
1763 
1764 /**
1765  * cdp_update_config_parameters(): function to propagate configuration
1766  *                                 parameters to datapath
1767  * @soc: opaque soc handle
1768  * @cfg: configuration handle
1769  *
1770  * Return: status: 0 - Success, non-zero: Failure
1771  */
1772 static inline
1773 QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc,
1774 	struct cdp_config_params *cfg)
1775 {
1776 	struct cdp_soc *psoc = (struct cdp_soc *)soc;
1777 
1778 	if (!soc || !soc->ops) {
1779 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1780 				"%s: Invalid Instance:", __func__);
1781 		QDF_BUG(0);
1782 		return 0;
1783 	}
1784 
1785 	if (!soc->ops->cmn_drv_ops ||
1786 	    !soc->ops->cmn_drv_ops->update_config_parameters)
1787 		return QDF_STATUS_SUCCESS;
1788 
1789 	return soc->ops->cmn_drv_ops->update_config_parameters(psoc,
1790 								cfg);
1791 }
1792 
1793 /**
1794  * cdp_pdev_get_dp_txrx_handle() - get advanced dp handle from pdev
1795  * @soc: opaque soc handle
1796  * @pdev_id: id of data path pdev handle
1797  *
1798  * Return: opaque dp handle
1799  */
1800 static inline void *
1801 cdp_pdev_get_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id)
1802 {
1803 	if (!soc || !soc->ops) {
1804 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1805 				"%s: Invalid Instance:", __func__);
1806 		QDF_BUG(0);
1807 		return 0;
1808 	}
1809 
1810 	if (soc->ops->cmn_drv_ops->get_dp_txrx_handle)
1811 		return soc->ops->cmn_drv_ops->get_dp_txrx_handle(soc, pdev_id);
1812 
1813 	return 0;
1814 }
1815 
1816 /**
1817  * cdp_pdev_set_dp_txrx_handle() - set advanced dp handle in pdev
1818  * @soc: opaque soc handle
1819  * @pdev_id: id of data path pdev handle
1820  * @dp_hdl: opaque pointer for dp_txrx_handle
1821  *
1822  * Return: void
1823  */
1824 static inline void
1825 cdp_pdev_set_dp_txrx_handle(ol_txrx_soc_handle soc, uint8_t pdev_id,
1826 			    void *dp_hdl)
1827 {
1828 	if (!soc || !soc->ops) {
1829 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1830 				"%s: Invalid Instance:", __func__);
1831 		QDF_BUG(0);
1832 		return;
1833 	}
1834 
1835 	if (!soc->ops->cmn_drv_ops ||
1836 			!soc->ops->cmn_drv_ops->set_dp_txrx_handle)
1837 		return;
1838 
1839 	soc->ops->cmn_drv_ops->set_dp_txrx_handle(soc, pdev_id, dp_hdl);
1840 }
1841 
1842 /**
1843  * cdp_vdev_get_dp_ext_txrx_handle() - get extended dp handle from vdev
1844  * @soc: opaque soc handle
1845  * @vdev_id: vdev id
1846  *
1847  * Return: opaque dp handle
1848  */
1849 static inline void *
1850 cdp_vdev_get_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id)
1851 {
1852 	if (!soc || !soc->ops) {
1853 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1854 			  "%s: Invalid Instance:", __func__);
1855 		QDF_BUG(0);
1856 		return 0;
1857 	}
1858 
1859 	if (soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle)
1860 		return soc->ops->cmn_drv_ops->get_vdev_dp_ext_txrx_handle(
1861 							soc, vdev_id);
1862 
1863 	return 0;
1864 }
1865 
1866 /**
1867  * cdp_vdev_set_dp_ext_txrx_handle() - set extended dp handle in vdev
1868  * @soc: opaque soc handle
1869  * @vdev_id: vdev id
1870  * @size: size of the advance dp handle
1871  *
1872  * Return: QDF_STATUS
1873  */
1874 static inline QDF_STATUS
1875 cdp_vdev_set_dp_ext_txrx_handle(ol_txrx_soc_handle soc, uint8_t vdev_id,
1876 				uint16_t size)
1877 {
1878 	if (!soc || !soc->ops) {
1879 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1880 			  "%s: Invalid Instance:", __func__);
1881 		QDF_BUG(0);
1882 		return QDF_STATUS_E_FAILURE;
1883 	}
1884 
1885 	if (!soc->ops->cmn_drv_ops ||
1886 	    !soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle)
1887 		return QDF_STATUS_E_FAILURE;
1888 
1889 	return soc->ops->cmn_drv_ops->set_vdev_dp_ext_txrx_handle(soc,
1890 								  vdev_id,
1891 								  size);
1892 }
1893 
1894 /*
1895  * cdp_soc_get_dp_txrx_handle() - get extended dp handle from soc
1896  * @soc: opaque soc handle
1897  *
1898  * Return: opaque extended dp handle
1899  */
1900 static inline void *
1901 cdp_soc_get_dp_txrx_handle(ol_txrx_soc_handle soc)
1902 {
1903 	if (!soc || !soc->ops) {
1904 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1905 				"%s: Invalid Instance:", __func__);
1906 		QDF_BUG(0);
1907 		return NULL;
1908 	}
1909 
1910 	if (soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle)
1911 		return soc->ops->cmn_drv_ops->get_soc_dp_txrx_handle(
1912 				(struct cdp_soc *) soc);
1913 
1914 	return NULL;
1915 }
1916 
1917 /**
1918  * cdp_soc_set_dp_txrx_handle() - set advanced dp handle in soc
1919  * @soc: opaque soc handle
1920  * @dp_hdl: opaque pointer for dp_txrx_handle
1921  *
1922  * Return: void
1923  */
1924 static inline void
1925 cdp_soc_set_dp_txrx_handle(ol_txrx_soc_handle soc, void *dp_handle)
1926 {
1927 	if (!soc || !soc->ops) {
1928 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1929 				"%s: Invalid Instance:", __func__);
1930 		QDF_BUG(0);
1931 		return;
1932 	}
1933 
1934 	if (!soc->ops->cmn_drv_ops ||
1935 			!soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle)
1936 		return;
1937 
1938 	soc->ops->cmn_drv_ops->set_soc_dp_txrx_handle((struct cdp_soc *)soc,
1939 			dp_handle);
1940 }
1941 
1942 /**
1943  * cdp_soc_handle_mode_change() - Update pdev_id to lmac_id mapping
1944  * @soc: opaque soc handle
1945  * @pdev_id: id of data path pdev handle
1946  * @lmac_id: lmac id
1947  * Return: QDF_STATUS
1948  */
1949 static inline QDF_STATUS
1950 cdp_soc_handle_mode_change(ol_txrx_soc_handle soc, uint8_t pdev_id,
1951 			   uint32_t lmac_id)
1952 {
1953 	if (!soc || !soc->ops) {
1954 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1955 			  "%s: Invalid Instance:", __func__);
1956 		QDF_BUG(0);
1957 		return QDF_STATUS_E_FAILURE;
1958 	}
1959 
1960 	if (!soc->ops->cmn_drv_ops ||
1961 	    !soc->ops->cmn_drv_ops->handle_mode_change)
1962 		return QDF_STATUS_E_FAILURE;
1963 
1964 	return soc->ops->cmn_drv_ops->handle_mode_change(soc, pdev_id,
1965 							 lmac_id);
1966 }
1967 
1968 /**
1969  * cdp_soc_map_pdev_to_lmac() - Save pdev_id to lmac_id mapping
1970  * @soc: opaque soc handle
1971  * @pdev_id: id of data path pdev handle
1972  * @lmac_id: lmac id
1973  * Return: QDF_STATUS
1974  */
1975 static inline QDF_STATUS
1976 cdp_soc_map_pdev_to_lmac(ol_txrx_soc_handle soc, uint8_t pdev_id,
1977 			 uint32_t lmac_id)
1978 {
1979 	if (!soc || !soc->ops) {
1980 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
1981 			  "%s: Invalid Instance:", __func__);
1982 		QDF_BUG(0);
1983 		return QDF_STATUS_E_FAILURE;
1984 	}
1985 
1986 	if (!soc->ops->cmn_drv_ops ||
1987 	    !soc->ops->cmn_drv_ops->map_pdev_to_lmac)
1988 		return QDF_STATUS_E_FAILURE;
1989 
1990 	return soc->ops->cmn_drv_ops->map_pdev_to_lmac(soc, pdev_id,
1991 			lmac_id);
1992 }
1993 
1994 /**
1995  * cdp_txrx_set_pdev_status_down() - set pdev down/up status
1996  * @soc: soc opaque handle
1997  * @pdev_id: id of data path pdev handle
1998  * @is_pdev_down: pdev down/up status
1999  *
2000  * return: QDF_STATUS
2001  */
2002 static inline QDF_STATUS
2003 cdp_txrx_set_pdev_status_down(ol_txrx_soc_handle soc,
2004 			      uint8_t pdev_id,
2005 			      bool is_pdev_down)
2006 {
2007 	if (!soc || !soc->ops) {
2008 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2009 			  "%s: Invalid Instance:", __func__);
2010 		QDF_BUG(0);
2011 		return QDF_STATUS_E_FAILURE;
2012 	}
2013 
2014 	if (!soc->ops->cmn_drv_ops ||
2015 	    !soc->ops->cmn_drv_ops->set_pdev_status_down)
2016 		return QDF_STATUS_E_FAILURE;
2017 
2018 	return soc->ops->cmn_drv_ops->set_pdev_status_down(soc, pdev_id,
2019 						    is_pdev_down);
2020 }
2021 
2022 /**
2023  * cdp_tx_send() - enqueue frame for transmission
2024  * @soc: soc opaque handle
2025  * @vdev_id: id of VAP device
2026  * @nbuf: nbuf to be enqueued
2027  *
2028  * This API is used by Extended Datapath modules to enqueue frame for
2029  * transmission
2030  *
2031  * Return: void
2032  */
2033 static inline void
2034 cdp_tx_send(ol_txrx_soc_handle soc, uint8_t vdev_id, qdf_nbuf_t nbuf)
2035 {
2036 	if (!soc || !soc->ops) {
2037 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2038 				"%s: Invalid Instance:", __func__);
2039 		QDF_BUG(0);
2040 		return;
2041 	}
2042 
2043 	if (!soc->ops->cmn_drv_ops ||
2044 			!soc->ops->cmn_drv_ops->tx_send)
2045 		return;
2046 
2047 	soc->ops->cmn_drv_ops->tx_send(soc, vdev_id, nbuf);
2048 }
2049 
2050 /**
2051  * cdp_set_pdev_pcp_tid_map() - set pdev pcp-tid-map
2052  * @soc: opaque soc handle
2053  * @pdev_id: id of data path pdev handle
2054  * @pcp: pcp value
2055  * @tid: tid value
2056  *
2057  * This API is used to configure the pcp-to-tid mapping for a pdev.
2058  *
2059  * Return: QDF_STATUS_SUCCESS if value set successfully
2060  *          QDF_STATUS_E_INVAL false if error
2061  */
2062 static inline
2063 QDF_STATUS cdp_set_pdev_pcp_tid_map(ol_txrx_soc_handle soc,
2064 				    uint8_t pdev_id,
2065 				    uint32_t pcp, uint32_t tid)
2066 {
2067 	if (!soc || !soc->ops) {
2068 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2069 			  "%s: Invalid Instance", __func__);
2070 		return QDF_STATUS_E_INVAL;
2071 	}
2072 
2073 	if (!soc->ops->cmn_drv_ops ||
2074 	    !soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map)
2075 		return QDF_STATUS_E_INVAL;
2076 
2077 	return soc->ops->cmn_drv_ops->set_pdev_pcp_tid_map(soc, pdev_id,
2078 							   pcp, tid);
2079 }
2080 
2081 /**
2082  * cdp_get_peer_mac_from_peer_id() - get peer mac addr from peer id
2083  * @soc: opaque soc handle
2084  * @pdev_id: id of data path pdev handle
2085  * @peer_id: data path peer id
2086  * @peer_mac: peer_mac
2087  *
2088  * Return: QDF_STATUS
2089  */
2090 static inline
2091 QDF_STATUS cdp_get_peer_mac_from_peer_id(ol_txrx_soc_handle soc,
2092 					 uint32_t peer_id, uint8_t *peer_mac)
2093 {
2094 	if (soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id)
2095 		return soc->ops->cmn_drv_ops->txrx_get_peer_mac_from_peer_id(
2096 				soc, peer_id, peer_mac);
2097 
2098 	return QDF_STATUS_E_INVAL;
2099 }
2100 
2101 /**
2102  * cdp_vdev_tx_lock() - acquire lock
2103  * @soc: opaque soc handle
2104  * @vdev: data path vdev handle
2105  *
2106  * Return: void
2107  */
2108 static inline
2109 void cdp_vdev_tx_lock(ol_txrx_soc_handle soc,
2110 		      uint8_t vdev_id)
2111 {
2112 	if (soc->ops->cmn_drv_ops->txrx_vdev_tx_lock)
2113 		soc->ops->cmn_drv_ops->txrx_vdev_tx_lock(soc, vdev_id);
2114 }
2115 
2116 /**
2117  * cdp_vdev_tx_unlock() - release lock
2118  * @soc: opaque soc handle
2119  * @vdev_id: id of data path vdev handle
2120  *
2121  * Return: void
2122  */
2123 static inline
2124 void cdp_vdev_tx_unlock(ol_txrx_soc_handle soc,
2125 			uint8_t vdev_id)
2126 {
2127 	if (soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock)
2128 		soc->ops->cmn_drv_ops->txrx_vdev_tx_unlock(soc, vdev_id);
2129 }
2130 
2131 /**
2132  * cdp_ath_getstats() - get updated athstats
2133  * @soc: opaque soc handle
2134  * @id: vdev_id/pdev_id based on type
2135  * @stats: cdp network device stats structure
2136  * @type: device type pdev/vdev
2137  *
2138  * Return: QDF_STATUS
2139  */
2140 static inline QDF_STATUS
2141 cdp_ath_getstats(ol_txrx_soc_handle soc,
2142 		 uint8_t id, struct cdp_dev_stats *stats,
2143 		 uint8_t type)
2144 {
2145 	if (soc && soc->ops && soc->ops->cmn_drv_ops->txrx_ath_getstats)
2146 		return soc->ops->cmn_drv_ops->txrx_ath_getstats(soc, id,
2147 								stats, type);
2148 
2149 	return QDF_STATUS_E_FAILURE;
2150 }
2151 
2152 /**
2153  * cdp_set_gid_flag() - set groupid flag
2154  * @soc: opaque soc handle
2155  * @pdev_id: id of data path pdev handle
2156  * @mem_status: member status from grp management frame
2157  * @user_position: user position from grp management frame
2158  *
2159  * Return: QDF_STATUS
2160  */
2161 static inline QDF_STATUS
2162 cdp_set_gid_flag(ol_txrx_soc_handle soc,
2163 		 uint8_t pdev_id, u_int8_t *mem_status,
2164 		 u_int8_t *user_position)
2165 {
2166 	if (soc->ops->cmn_drv_ops->txrx_set_gid_flag)
2167 		return soc->ops->cmn_drv_ops->txrx_set_gid_flag(soc, pdev_id,
2168 							 mem_status,
2169 							 user_position);
2170 	return QDF_STATUS_E_FAILURE;
2171 }
2172 
2173 /**
2174  * cdp_fw_supported_enh_stats_version() - returns the fw enhanced stats version
2175  * @soc: opaque soc handle
2176  * @pdev_id: id of data path pdev handle
2177  *
2178  */
2179 static inline
2180 uint32_t cdp_fw_supported_enh_stats_version(ol_txrx_soc_handle soc,
2181 					    uint8_t pdev_id)
2182 {
2183 	if (soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version)
2184 		return soc->ops->cmn_drv_ops->txrx_fw_supported_enh_stats_version(soc, pdev_id);
2185 	return 0;
2186 }
2187 
2188 /**
2189  * cdp_get_pdev_id_frm_pdev() - return pdev_id from pdev
2190  * @soc: opaque soc handle
2191  * @vdev_id: id of vdev device
2192  * @force: number of frame in SW queue
2193  * Return: void
2194  */
2195 static inline
2196 void cdp_if_mgmt_drain(ol_txrx_soc_handle soc,
2197 		uint8_t vdev_id, int force)
2198 {
2199 	if (soc->ops->cmn_drv_ops->txrx_if_mgmt_drain)
2200 		soc->ops->cmn_drv_ops->txrx_if_mgmt_drain(soc, vdev_id, force);
2201 }
2202 
2203 /* cdp_peer_map_attach() - CDP API to allocate PEER map memory
2204  * @soc: opaque soc handle
2205  * @max_peers: number of peers created in FW
2206  * @max_ast_index: max number of AST index supported in FW
2207  * @peer_map_unmap_v2: flag indicates HTT peer map v2 is enabled in FW
2208  *
2209  *
2210  * Return: QDF_STATUS
2211  */
2212 static inline QDF_STATUS
2213 cdp_peer_map_attach(ol_txrx_soc_handle soc, uint32_t max_peers,
2214 		    uint32_t max_ast_index, bool peer_map_unmap_v2)
2215 {
2216 	if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2217 	    soc->ops->cmn_drv_ops->txrx_peer_map_attach)
2218 		return soc->ops->cmn_drv_ops->txrx_peer_map_attach(soc,
2219 							max_peers,
2220 							max_ast_index,
2221 							peer_map_unmap_v2);
2222 
2223 	return QDF_STATUS_SUCCESS;
2224 }
2225 
2226 /* cdp_soc_set_param() - CDP API to set soc parameters
2227  * @soc: opaque soc handle
2228  * @param: parameter type
2229  * @value: parameter value
2230  *
2231  *
2232  * Return: QDF_STATUS
2233  */
2234 static inline QDF_STATUS
2235 cdp_soc_set_param(ol_txrx_soc_handle soc, enum cdp_soc_param_t param,
2236 		  uint32_t value)
2237 {
2238 	if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2239 	    soc->ops->cmn_drv_ops->set_soc_param)
2240 		return soc->ops->cmn_drv_ops->set_soc_param(soc, param,
2241 							value);
2242 
2243 	return QDF_STATUS_SUCCESS;
2244 }
2245 
2246 /* cdp_txrx_classify_and_update() - To classify the packet and update stats
2247  * @soc: opaque soc handle
2248  * @vdev: opaque dp vdev handle
2249  * @skb: data
2250  * @dir: rx or tx packet
2251  * @nbuf_classify: packet classification object
2252  *
2253  * Return: 1 on success else return 0
2254  */
2255 static inline int
2256 cdp_txrx_classify_and_update(ol_txrx_soc_handle soc,
2257 			     uint8_t vdev_id, qdf_nbuf_t skb,
2258 			     enum txrx_direction dir,
2259 			     struct ol_txrx_nbuf_classify *nbuf_class)
2260 {
2261 	if (!soc || !soc->ops) {
2262 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2263 			  "%s: Invalid Instance", __func__);
2264 		QDF_BUG(0);
2265 		return 0;
2266 	}
2267 
2268 	if (!soc->ops->cmn_drv_ops ||
2269 	    !soc->ops->cmn_drv_ops->txrx_classify_update)
2270 		return 0;
2271 
2272 	return soc->ops->cmn_drv_ops->txrx_classify_update(soc, vdev_id,
2273 							   skb,
2274 							   dir, nbuf_class);
2275 }
2276 
2277 /**
2278  * cdp_get_dp_capabilities() - get DP capabilities
2279  * @soc: opaque soc handle
2280  * @dp_cap: enum of DP capabilities
2281  *
2282  * Return: bool
2283  */
2284 static inline bool
2285 cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps)
2286 {
2287 	if (soc && soc->ops && soc->ops->cmn_drv_ops &&
2288 	    soc->ops->cmn_drv_ops->get_dp_capabilities)
2289 		return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps);
2290 	return false;
2291 }
2292 
2293 #ifdef RECEIVE_OFFLOAD
2294 /**
2295  * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer
2296  * @soc - data path soc handle
2297  * @pdev - device instance pointer
2298  *
2299  * register rx offload flush callback function pointer
2300  *
2301  * return none
2302  */
2303 static inline void cdp_register_rx_offld_flush_cb(ol_txrx_soc_handle soc,
2304 						  void (rx_ol_flush_cb)(void *))
2305 {
2306 	if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
2307 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
2308 			  "%s invalid instance", __func__);
2309 		return;
2310 	}
2311 
2312 	if (soc->ops->rx_offld_ops->register_rx_offld_flush_cb)
2313 		return soc->ops->rx_offld_ops->register_rx_offld_flush_cb(
2314 								rx_ol_flush_cb);
2315 }
2316 
2317 /**
2318  * cdp_deregister_rx_offld_flush_cb() - deregister Rx offld flush cb function
2319  * @soc - data path soc handle
2320  *
2321  * deregister rx offload flush callback function pointer
2322  *
2323  * return none
2324  */
2325 static inline void cdp_deregister_rx_offld_flush_cb(ol_txrx_soc_handle soc)
2326 {
2327 	if (!soc || !soc->ops || !soc->ops->rx_offld_ops) {
2328 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
2329 			  "%s invalid instance", __func__);
2330 		return;
2331 	}
2332 
2333 	if (soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb)
2334 		return soc->ops->rx_offld_ops->deregister_rx_offld_flush_cb();
2335 }
2336 #endif /* RECEIVE_OFFLOAD */
2337 
2338 /**
2339  * @cdp_set_ba_timeout() - set ba aging timeout per AC
2340  *
2341  * @soc - pointer to the soc
2342  * @value - timeout value in millisec
2343  * @ac - Access category
2344  *
2345  * @return - void
2346  */
2347 static inline void cdp_set_ba_timeout(ol_txrx_soc_handle soc,
2348 				      uint8_t ac, uint32_t value)
2349 {
2350 	if (!soc || !soc->ops) {
2351 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2352 			  "%s: Invalid Instance", __func__);
2353 		QDF_BUG(0);
2354 		return;
2355 	}
2356 
2357 	if (!soc->ops->cmn_drv_ops ||
2358 	    !soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout)
2359 		return;
2360 
2361 	soc->ops->cmn_drv_ops->txrx_set_ba_aging_timeout(soc, ac, value);
2362 }
2363 
2364 /**
2365  * @cdp_get_ba_timeout() - return ba aging timeout per AC
2366  *
2367  * @soc - pointer to the soc
2368  * @ac - access category
2369  * @value - timeout value in millisec
2370  *
2371  * @return - void
2372  */
2373 static inline void cdp_get_ba_timeout(ol_txrx_soc_handle soc,
2374 				      uint8_t ac, uint32_t *value)
2375 {
2376 	if (!soc || !soc->ops) {
2377 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2378 			  "%s: Invalid Instance", __func__);
2379 		QDF_BUG(0);
2380 		return;
2381 	}
2382 
2383 	if (!soc->ops->cmn_drv_ops ||
2384 	    !soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout)
2385 		return;
2386 
2387 	soc->ops->cmn_drv_ops->txrx_get_ba_aging_timeout(soc, ac, value);
2388 }
2389 
2390 /**
2391  * cdp_cfg_get() - get cfg for dp enum
2392  *
2393  * @soc: pointer to the soc
2394  * @cfg: cfg enum
2395  *
2396  * Return - cfg value
2397  */
2398 static inline uint32_t cdp_cfg_get(ol_txrx_soc_handle soc, enum cdp_dp_cfg cfg)
2399 {
2400 	if (!soc || !soc->ops) {
2401 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2402 			  "%s: Invalid Instance", __func__);
2403 		return 0;
2404 	}
2405 
2406 	if (!soc->ops->cmn_drv_ops || !soc->ops->cmn_drv_ops->txrx_get_cfg)
2407 		return 0;
2408 
2409 	return soc->ops->cmn_drv_ops->txrx_get_cfg(soc, cfg);
2410 }
2411 
2412 /**
2413  * cdp_soc_set_rate_stats_ctx() - set rate stats context in soc
2414  * @soc: opaque soc handle
2415  * @ctx: rate stats context
2416  *
2417  * Return: void
2418  */
2419 static inline void
2420 cdp_soc_set_rate_stats_ctx(ol_txrx_soc_handle soc,
2421 			   void *ctx)
2422 {
2423 	if (!soc || !soc->ops) {
2424 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2425 			  "%s: Invalid Instance:", __func__);
2426 		QDF_BUG(0);
2427 		return;
2428 	}
2429 
2430 	if (!soc->ops->cmn_drv_ops ||
2431 	    !soc->ops->cmn_drv_ops->set_rate_stats_ctx)
2432 		return;
2433 
2434 	soc->ops->cmn_drv_ops->set_rate_stats_ctx((struct cdp_soc_t *)soc,
2435 						  ctx);
2436 }
2437 
2438 /**
2439  * cdp_soc_get_rate_stats_ctx() - get rate stats context in soc
2440  * @soc: opaque soc handle
2441  *
2442  * Return: void
2443  */
2444 static inline void*
2445 cdp_soc_get_rate_stats_ctx(ol_txrx_soc_handle soc)
2446 {
2447 	if (!soc || !soc->ops) {
2448 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2449 			  "%s: Invalid Instance:", __func__);
2450 		QDF_BUG(0);
2451 		return NULL;
2452 	}
2453 
2454 	if (!soc->ops->cmn_drv_ops ||
2455 	    !soc->ops->cmn_drv_ops->get_rate_stats_ctx)
2456 		return NULL;
2457 
2458 	return soc->ops->cmn_drv_ops->get_rate_stats_ctx(soc);
2459 }
2460 
2461 /**
2462  * cdp_peer_flush_rate_stats() - flush peer rate statistics
2463  * @soc: opaque soc handle
2464  * @pdev_id: id of pdev handle
2465  * @buf: stats buffer
2466  */
2467 static inline void
2468 cdp_peer_flush_rate_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
2469 			  void *buf)
2470 {
2471 	if (!soc || !soc->ops) {
2472 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2473 			  "%s: Invalid Instance:", __func__);
2474 		QDF_BUG(0);
2475 		return;
2476 	}
2477 
2478 	if (!soc->ops->cmn_drv_ops ||
2479 	    !soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats)
2480 		return;
2481 
2482 	soc->ops->cmn_drv_ops->txrx_peer_flush_rate_stats(soc, pdev_id, buf);
2483 }
2484 
2485 /**
2486  * cdp_flush_rate_stats_request() - request flush rate statistics
2487  * @soc: opaque soc handle
2488  * @pdev_id: id of pdev handle
2489  */
2490 static inline QDF_STATUS
2491 cdp_flush_rate_stats_request(struct cdp_soc_t *soc, uint8_t pdev_id)
2492 {
2493 	if (!soc || !soc->ops) {
2494 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2495 			  "%s: Invalid Instance:", __func__);
2496 		QDF_BUG(0);
2497 		return QDF_STATUS_E_FAILURE;
2498 	}
2499 
2500 	if (!soc->ops->cmn_drv_ops ||
2501 	    !soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request)
2502 		return QDF_STATUS_E_FAILURE;
2503 
2504 	return soc->ops->cmn_drv_ops->txrx_flush_rate_stats_request(soc,
2505 								    pdev_id);
2506 }
2507 
2508 /**
2509  * cdp_set_vdev_pcp_tid_map() - set vdev pcp-tid-map
2510  * @soc: opaque soc handle
2511  * @vdev: id of data path vdev handle
2512  * @pcp: pcp value
2513  * @tid: tid value
2514  *
2515  * This API is used to configure the pcp-to-tid mapping for a pdev.
2516  *
2517  * Return: QDF_STATUS_SUCCESS if value set successfully
2518  *          QDF_STATUS_E_INVAL false if error
2519  */
2520 static inline
2521 QDF_STATUS cdp_set_vdev_pcp_tid_map(ol_txrx_soc_handle soc,
2522 				    uint8_t vdev_id,
2523 				    uint8_t pcp, uint8_t tid)
2524 {
2525 	if (!soc || !soc->ops) {
2526 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2527 			  "%s: Invalid Instance", __func__);
2528 		return QDF_STATUS_E_INVAL;
2529 	}
2530 
2531 	if (!soc->ops->cmn_drv_ops ||
2532 	    !soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map)
2533 		return QDF_STATUS_E_INVAL;
2534 
2535 	return soc->ops->cmn_drv_ops->set_vdev_pcp_tid_map(soc, vdev_id,
2536 							   pcp, tid);
2537 }
2538 
2539 /**
2540  * cdp_tx_send_exc() - Transmit a frame on a given vdev in exception path
2541  *
2542  * @soc: opaque soc handle
2543  * @vdev_id: vdev id
2544  * @nbuf: skb
2545  * @tx_exc_metadata: Handle that holds exception path meta data
2546  *
2547  * Return: NULL on success
2548  *         nbuf when it fails to send
2549  */
2550 static inline qdf_nbuf_t
2551 cdp_tx_send_exc(ol_txrx_soc_handle soc,
2552 		uint8_t vdev_id,
2553 		qdf_nbuf_t nbuf,
2554 		struct cdp_tx_exception_metadata *tx_exc_metadata)
2555 {
2556 	if (!soc || !soc->ops) {
2557 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2558 			  "%s: Invalid Instance", __func__);
2559 		QDF_BUG(0);
2560 		return 0;
2561 	}
2562 
2563 	if (!soc->ops->cmn_drv_ops ||
2564 	    !soc->ops->cmn_drv_ops->tx_send_exc)
2565 		return 0;
2566 
2567 	return soc->ops->cmn_drv_ops->tx_send_exc
2568 			(soc, vdev_id, nbuf, tx_exc_metadata);
2569 }
2570 
2571 /**
2572  * cdp_vdev_get_peer_mac_list(): function to get peer mac list of vdev
2573  * @soc: Datapath soc handle
2574  * @vdev_id: vdev id
2575  * @newmac: Table of the clients mac
2576  * @mac_cnt: No. of MACs required
2577  *
2578  * return: no of clients
2579  */
2580 static inline uint16_t
2581 cdp_vdev_get_peer_mac_list(ol_txrx_soc_handle soc,
2582 			   uint8_t vdev_id,
2583 			   uint8_t newmac[][QDF_MAC_ADDR_SIZE],
2584 			   uint16_t mac_cnt)
2585 {
2586 	if (!soc || !soc->ops) {
2587 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2588 			  "%s: Invalid Instance", __func__);
2589 		QDF_BUG(0);
2590 		return 0;
2591 	}
2592 
2593 	if (!soc->ops->cmn_drv_ops ||
2594 	    !soc->ops->cmn_drv_ops->get_peer_mac_list)
2595 		return 0;
2596 
2597 	return soc->ops->cmn_drv_ops->get_peer_mac_list
2598 			(soc, vdev_id, newmac, mac_cnt);
2599 }
2600 
2601 /*
2602  * cdp_soc_config_full_mon_mode () - Configure Full monitor mode
2603  *
2604  *@soc: dp soc handle
2605  *@val: value to be configured val should be 0 or 1
2606  *
2607  * This API is used to enable/disable support for Full monitor mode feature
2608  *
2609  * Return: QDF_STATUS_SUCCESS if value set successfully
2610  *         QDF_STATUS_E_INVAL false if error
2611  */
2612 static inline QDF_STATUS
2613 cdp_soc_config_full_mon_mode(ol_txrx_soc_handle soc, uint8_t val)
2614 {
2615 	if (!soc || !soc->ops) {
2616 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
2617 			  "%s: Invalid Instance", __func__);
2618 		return QDF_STATUS_E_INVAL;
2619 	}
2620 
2621 	if (!soc->ops->mon_ops ||
2622 	    !soc->ops->mon_ops->config_full_mon_mode)
2623 		return QDF_STATUS_E_INVAL;
2624 
2625 	return soc->ops->mon_ops->config_full_mon_mode(soc, val);
2626 }
2627 
2628 #endif /* _CDP_TXRX_CMN_H_ */
2629