xref: /wlan-dirver/qca-wifi-host-cmn/dp/wifi3.0/monitor/dp_mon.h (revision 2888b71da71bce103343119fa1b31f4a0cee07c8)
1 /*
2  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #ifndef _DP_MON_H_
19 #define _DP_MON_H_
20 
21 #include "qdf_trace.h"
22 #include "dp_internal.h"
23 #include "dp_types.h"
24 #include "dp_htt.h"
25 
26 #include <dp_mon_filter.h>
27 #ifdef WLAN_TX_PKT_CAPTURE_ENH
28 #include "dp_tx_capture.h"
29 #endif
30 
31 #ifdef QCA_SUPPORT_LITE_MONITOR
32 #include "dp_lite_mon.h"
33 #endif
34 
35 #define DP_INTR_POLL_TIMER_MS	5
36 
37 #define MON_VDEV_TIMER_INIT 0x1
38 #define MON_VDEV_TIMER_RUNNING 0x2
39 
40 /* Budget to reap monitor status ring */
41 #define DP_MON_REAP_BUDGET 1024
42 #define MON_BUF_MIN_ENTRIES 64
43 
44 /* 40MHZ BW 2 20MHZ sub bands */
45 #define SUB40BW 2
46 /* 80MHZ BW 4 20MHZ sub bands */
47 #define SUB80BW 4
48 /* 160MHZ BW 8 20MHZ sub bands */
49 #define SUB160BW 8
50 /* 320MHZ BW 16 20MHZ sub bands */
51 #define SUB320BW 16
52 
53 #define RNG_ERR		"SRNG setup failed for"
54 #define dp_mon_info(params...) \
55 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_MON, ## params)
56 #define dp_mon_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_MON, params)
57 #define dp_mon_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_MON, params)
58 #define dp_mon_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_MON, params)
59 
60 #define dp_mon_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_MON, params)
61 #define dp_mon_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_MON, params)
62 #define dp_mon_info_rl(params...) \
63 	__QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_MON, ## params)
64 
65 #ifdef QCA_ENHANCED_STATS_SUPPORT
66 typedef struct dp_peer_extd_tx_stats dp_mon_peer_tx_stats;
67 typedef struct dp_peer_extd_rx_stats dp_mon_peer_rx_stats;
68 
69 #define DP_UPDATE_MON_STATS(_tgtobj, _srcobj) \
70 	DP_UPDATE_EXTD_STATS(_tgtobj, _srcobj)
71 #endif
72 
73 #ifndef WLAN_TX_PKT_CAPTURE_ENH
74 struct dp_pdev_tx_capture {
75 };
76 
77 struct dp_peer_tx_capture {
78 };
79 #endif
80 
81 #ifndef WLAN_TX_PKT_CAPTURE_ENH
82 static inline void
83 dp_process_ppdu_stats_update_failed_bitmap(struct dp_pdev *pdev,
84 					   void *data,
85 					   uint32_t ppdu_id,
86 					   uint32_t size)
87 {
88 }
89 #endif
90 
91 #ifdef DP_CON_MON_MSI_ENABLED
92 static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc)
93 {
94 	return false;
95 }
96 #else
97 static inline bool dp_is_monitor_mode_using_poll(struct dp_soc *soc)
98 {
99 	return true;
100 }
101 #endif
102 
103 /*
104  * dp_mon_soc_attach() - DP monitor soc attach
105  * @soc: Datapath SOC handle
106  *
107  * Return: QDF_STATUS_SUCCESS: Success
108  *         QDF_STATUS_E_NOMEM: Error
109  */
110 QDF_STATUS dp_mon_soc_attach(struct dp_soc *soc);
111 
112 /*
113  * dp_mon_soc_detach() - DP monitor soc detach
114  * @soc: Datapath SOC handle
115  *
116  * Return: QDF_STATUS_SUCCESS: Success
117  *         QDF_STATUS_E_FAILURE: Error
118  */
119 QDF_STATUS dp_mon_soc_detach(struct dp_soc *soc);
120 
121 /*
122  * dp_mon_soc_cfg_init() - DP monitor soc config init
123  * @soc: Datapath SOC handle
124  *
125  * Return: QDF_STATUS_SUCCESS: Success
126  *         QDF_STATUS_E_FAILURE: Error
127  */
128 QDF_STATUS dp_mon_soc_cfg_init(struct dp_soc *soc);
129 
130 /*
131  * dp_mon_pdev_attach() - DP monitor pdev attach
132  * @pdev: Datapath pdev handle
133  *
134  * Return: QDF_STATUS_SUCCESS: Success
135  *         QDF_STATUS_E_NOMEM: Error
136  */
137 QDF_STATUS dp_mon_pdev_attach(struct dp_pdev *pdev);
138 
139 /*
140  * dp_mon_pdev_detach() - DP monitor pdev detach
141  * @pdev: Datapath pdev handle
142  *
143  * Return: QDF_STATUS_SUCCESS: Success
144  *         QDF_STATUS_E_FAILURE: Error
145  */
146 QDF_STATUS dp_mon_pdev_detach(struct dp_pdev *pdev);
147 
148 /*
149  * dp_mon_pdev_init() - DP monitor pdev init
150  * @pdev: Datapath pdev handle
151  *
152  * Return: QDF_STATUS_SUCCESS: Success
153  *         QDF_STATUS_E_FAILURE: Error
154  */
155 QDF_STATUS dp_mon_pdev_init(struct dp_pdev *pdev);
156 
157 /*
158  * dp_mon_pdev_deinit() - DP monitor pdev deinit
159  * @pdev: Datapath pdev handle
160  *
161  * Return: QDF_STATUS_SUCCESS: Success
162  *         QDF_STATUS_E_FAILURE: Error
163  */
164 QDF_STATUS dp_mon_pdev_deinit(struct dp_pdev *pdev);
165 
166 /*
167  * dp_mon_vdev_attach() - DP monitor vdev attach
168  * @vdev: Datapath vdev handle
169  *
170  * Return: QDF_STATUS_SUCCESS: Success
171  *         QDF_STATUS_E_NOMEM: Error
172  */
173 QDF_STATUS dp_mon_vdev_attach(struct dp_vdev *vdev);
174 
175 /*
176  * dp_mon_vdev_detach() - DP monitor vdev detach
177  * @vdev: Datapath vdev handle
178  *
179  * Return: QDF_STATUS_SUCCESS: Success
180  *         QDF_STATUS_E_FAILURE: Error
181  */
182 QDF_STATUS dp_mon_vdev_detach(struct dp_vdev *vdev);
183 
184 /*
185  * dp_mon_peer_attach() - DP monitor peer attach
186  * @peer: Datapath peer handle
187  *
188  * Return: QDF_STATUS_SUCCESS: Success
189  *         QDF_STATUS_E_NOMEM: Error
190  */
191 #if defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(FEATURE_PERPKT_INFO)
192 QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer);
193 #else
194 static inline
195 QDF_STATUS dp_mon_peer_attach(struct dp_peer *peer)
196 {
197 	return QDF_STATUS_SUCCESS;
198 }
199 #endif
200 
201 /*
202  * dp_mon_peer_detach() - DP monitor peer detach
203  * @peer: Datapath peer handle
204  *
205  * Return: QDF_STATUS_SUCCESS: Success
206  *         QDF_STATUS_E_FAILURE: Error
207  */
208 QDF_STATUS dp_mon_peer_detach(struct dp_peer *peer);
209 
210 /*
211  * dp_mon_peer_get_peerstats_ctx() - Get peer stats context from monitor peer
212  * @peer: Datapath peer handle
213  *
214  * Return: peerstats_ctx
215  */
216 struct cdp_peer_rate_stats_ctx *dp_mon_peer_get_peerstats_ctx(struct
217 							      dp_peer *peer);
218 
219 #ifdef QCA_ENHANCED_STATS_SUPPORT
220 /*
221  * dp_mon_peer_reset_stats() - Reset monitor peer stats
222  * @peer: Datapath peer handle
223  *
224  * Return: none
225  */
226 void dp_mon_peer_reset_stats(struct dp_peer *peer);
227 
228 /*
229  * dp_mon_peer_get_stats() - Get monitor peer stats
230  *
231  * @peer: Datapath peer handle
232  * @arg: Pointer to stats struct
233  * @type: Update type
234  *
235  * Return: none
236  */
237 void dp_mon_peer_get_stats(struct dp_peer *peer, void *arg,
238 			   enum cdp_stat_update_type type);
239 
240 /*
241  * dp_mon_invalid_peer_update_pdev_stats() - Update pdev stats from
242  *					invalid monitor peer
243  * @pdev: Datapath pdev handle
244  *
245  * Return: none
246  */
247 void dp_mon_invalid_peer_update_pdev_stats(struct dp_pdev *pdev);
248 
249 /*
250  * dp_mon_peer_get_stats_param() - Get stats param value from monitor peer
251  * @peer: Datapath peer handle
252  * @type: Stats type requested
253  * @buf: Pointer to buffer for stats param
254  *
255  * Return: QDF_STATUS
256  */
257 QDF_STATUS dp_mon_peer_get_stats_param(struct dp_peer *peer,
258 				       enum cdp_peer_stats_type type,
259 				       cdp_peer_stats_param_t *buf);
260 #else
261 static inline void dp_mon_peer_reset_stats(struct dp_peer *peer)
262 {
263 }
264 
265 static inline
266 void dp_mon_peer_get_stats(struct dp_peer *peer, void *arg,
267 			   enum cdp_stat_update_type type)
268 {
269 }
270 
271 static inline void dp_mon_invalid_peer_update_pdev_stats(struct dp_pdev *pdev)
272 {
273 }
274 
275 static inline
276 QDF_STATUS dp_mon_peer_get_stats_param(struct dp_peer *peer,
277 				       enum cdp_peer_stats_type type,
278 				       cdp_peer_stats_param_t *buf)
279 {
280 	return QDF_STATUS_E_FAILURE;
281 }
282 #endif
283 
284 /*
285  * dp_mon_cdp_ops_register() - Register monitor cdp ops
286  * @soc: Datapath soc handle
287  *
288  */
289 void dp_mon_cdp_ops_register(struct dp_soc *soc);
290 
291 /*
292  * dp_mon_cdp_ops_deregister() - deregister monitor cdp ops
293  * @soc: Datapath soc handle
294  *
295  */
296 void dp_mon_cdp_ops_deregister(struct dp_soc *soc);
297 
298 /*
299  * dp_mon_intr_ops_deregister() - deregister monitor interrupt ops
300  * @soc: Datapath soc handle
301  *
302  */
303 void dp_mon_intr_ops_deregister(struct dp_soc *soc);
304 
305 /*
306  * dp_mon_feature_ops_deregister() - deregister monitor feature ops
307  * @soc: Datapath soc handle
308  *
309  */
310 void dp_mon_feature_ops_deregister(struct dp_soc *soc);
311 
312 /*
313  * dp_mon_ops_free() - free monitor ops
314  * @soc: Datapath soc handle
315  *
316  */
317 void dp_mon_ops_free(struct dp_soc *soc);
318 
319 /*
320  * dp_mon_ops_register() - Register monitor ops
321  * @soc: Datapath soc handle
322  *
323  */
324 void dp_mon_ops_register(struct dp_soc *soc);
325 
326 #ifndef DISABLE_MON_CONFIG
327 void dp_mon_register_intr_ops(struct dp_soc *soc);
328 #else
329 static inline void dp_mon_register_intr_ops(struct dp_soc *soc)
330 {}
331 #endif
332 
333 /*
334  * dp_mon_htt_srng_setup() - DP mon htt srng setup
335  * @soc: Datapath soc handle
336  * @pdev: Datapath pdev handle
337  * @mac_id: mac id
338  * @mac_for_pdev: mac id mapped pdev
339  *
340  * Return: QDF_STATUS_SUCCESS: Success
341  *         QDF_STATUS_E_FAILURE: Error
342  */
343 QDF_STATUS dp_mon_htt_srng_setup(struct dp_soc *soc,
344 				 struct dp_pdev *pdev,
345 				 int mac_id,
346 				 int mac_for_pdev);
347 
348 /*
349  * dp_config_debug_sniffer()- API to enable/disable debug sniffer
350  * @pdev: DP_PDEV handle
351  * @val: user provided value
352  *
353  * Return: 0 for success. nonzero for failure.
354  */
355 #if defined(QCA_MCOPY_SUPPORT) || defined(QCA_TX_CAPTURE_SUPPORT)
356 QDF_STATUS
357 dp_config_debug_sniffer(struct dp_pdev *pdev, int val);
358 #else
359 static inline QDF_STATUS
360 dp_config_debug_sniffer(struct dp_pdev *pdev, int val) {
361 	return QDF_STATUS_E_INVAL;
362 }
363 #endif /* QCA_MCOPY_SUPPORT || QCA_TX_CAPTURE_SUPPORT */
364 
365 /*
366  * dp_config_debug_sniffer()- API to enable/disable debug sniffer
367  * @pdev: DP_PDEV handle
368  * @val: user provided value
369  *
370  * Return: 0 for success. nonzero for failure.
371  */
372 #ifdef QCA_UNDECODED_METADATA_SUPPORT
373 QDF_STATUS
374 dp_mon_config_undecoded_metadata_capture(struct dp_pdev *pdev, int val);
375 #else
376 static inline QDF_STATUS
377 dp_mon_config_undecoded_metadata_capture(struct dp_pdev *pdev, int val) {
378 	return QDF_STATUS_E_INVAL;
379 }
380 #endif /* QCA_UNDECODED_METADATA_SUPPORT */
381 
382 /*
383  * dp_htt_ppdu_stats_attach() - attach resources for HTT PPDU stats processing
384  * @pdev: Datapath PDEV handle
385  *
386  * Return: QDF_STATUS_SUCCESS: Success
387  *         QDF_STATUS_E_NOMEM: Error
388  */
389 QDF_STATUS dp_htt_ppdu_stats_attach(struct dp_pdev *pdev);
390 
391 /*
392  * dp_htt_ppdu_stats_detach() - detach stats resources
393  * @pdev: Datapath PDEV handle
394  *
395  * Return: void
396  */
397 void dp_htt_ppdu_stats_detach(struct dp_pdev *pdev);
398 
399 /*
400  *dp_set_bpr_enable() - API to enable/disable bpr feature
401  *@pdev_handle: DP_PDEV handle.
402  *@val: Provided value.
403  *
404  *Return: 0 for success. nonzero for failure.
405  */
406 #ifdef QCA_SUPPORT_BPR
407 QDF_STATUS
408 dp_set_bpr_enable(struct dp_pdev *pdev, int val);
409 #endif
410 
411 #ifdef ATH_SUPPORT_NAC
412 int dp_set_filter_neigh_peers(struct dp_pdev *pdev,
413 				     bool val);
414 #endif /* ATH_SUPPORT_NAC */
415 
416 #ifdef WLAN_ATF_ENABLE
417 void dp_set_atf_stats_enable(struct dp_pdev *pdev, bool value);
418 #endif
419 
420 /**
421  * dp_set_bsscolor() - sets bsscolor for tx capture
422  * @pdev: Datapath PDEV handle
423  * @bsscolor: new bsscolor
424  */
425 void
426 dp_mon_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor);
427 
428 /**
429  * dp_pdev_get_filter_ucast_data() - get DP PDEV monitor ucast filter
430  * @soc : data path soc handle
431  * @pdev_id : pdev_id
432  * Return: true on ucast filter flag set
433  */
434 bool dp_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle);
435 
436 /**
437  * dp_pdev_get_filter_mcast_data() - get DP PDEV monitor mcast filter
438  * @pdev_handle: Datapath PDEV handle
439  * Return: true on mcast filter flag set
440  */
441 bool dp_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle);
442 
443 /**
444  * dp_pdev_get_filter_non_data() - get DP PDEV monitor non_data filter
445  * @pdev_handle: Datapath PDEV handle
446  * Return: true on non data filter flag set
447  */
448 bool dp_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle);
449 
450 /*
451  * dp_set_pktlog_wifi3() - attach txrx vdev
452  * @pdev: Datapath PDEV handle
453  * @event: which event's notifications are being subscribed to
454  * @enable: WDI event subscribe or not. (True or False)
455  *
456  * Return: Success, NULL on failure
457  */
458 #ifdef WDI_EVENT_ENABLE
459 int dp_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
460 			bool enable);
461 #endif
462 
463 /* MCL specific functions */
464 #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
465 /**
466  * dp_pktlogmod_exit() - API to cleanup pktlog info
467  * @pdev: Pdev handle
468  *
469  * Return: none
470  */
471 void dp_pktlogmod_exit(struct dp_pdev *pdev);
472 #else
473 static inline
474 void dp_pktlogmod_exit(struct dp_pdev *handle)
475 {
476 }
477 #endif
478 
479 #ifdef QCA_MONITOR_PKT_SUPPORT
480 /**
481  * dp_vdev_set_monitor_mode_buf_rings () - set monitor mode buf rings
482  *
483  * Allocate SW descriptor pool, buffers, link descriptor memory
484  * Initialize monitor related SRNGs
485  *
486  * @pdev: DP pdev object
487  *
488  * Return: QDF_STATUS
489  */
490 QDF_STATUS dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev);
491 
492 /**
493  * dp_vdev_set_monitor_mode_rings () - set monitor mode rings
494  *
495  * Allocate SW descriptor pool, buffers, link descriptor memory
496  * Initialize monitor related SRNGs
497  *
498  * @pdev: DP pdev object
499  *
500  * Return: QDF_STATUS
501  */
502 QDF_STATUS dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev,
503 					  uint8_t delayed_replenish);
504 
505 #else
506 static inline QDF_STATUS
507 dp_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev)
508 {
509 	return QDF_STATUS_SUCCESS;
510 }
511 
512 static inline QDF_STATUS
513 dp_vdev_set_monitor_mode_rings(struct dp_pdev *pdev,
514 			       uint8_t delayed_replenish)
515 {
516 	return QDF_STATUS_SUCCESS;
517 }
518 #endif
519 
520 #if defined(WDI_EVENT_ENABLE) &&\
521 	(defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
522 /*
523  * dp_ppdu_stats_ind_handler() - PPDU stats msg handler
524  * @htt_soc:	 HTT SOC handle
525  * @msg_word:    Pointer to payload
526  * @htt_t2h_msg: HTT msg nbuf
527  *
528  * Return: True if buffer should be freed by caller.
529  */
530 bool dp_ppdu_stats_ind_handler(struct htt_soc *soc,
531 			       uint32_t *msg_word,
532 			       qdf_nbuf_t htt_t2h_msg);
533 #endif
534 
535 #if defined(QCA_ENHANCED_STATS_SUPPORT) && \
536 	(!defined(WLAN_TX_PKT_CAPTURE_ENH) || defined(QCA_MONITOR_2_0_SUPPORT))
537 /**
538  * dp_ppdu_desc_deliver(): Function to deliver Tx PPDU status descriptor
539  * to upper layer
540  * @pdev: DP pdev handle
541  * @ppdu_info: per PPDU TLV descriptor
542  *
543  * return: void
544  */
545 void dp_ppdu_desc_deliver(struct dp_pdev *pdev, struct ppdu_info *ppdu_info);
546 #endif
547 
548 #ifdef QCA_RSSI_DB2DBM
549 /*
550  * dp_mon_pdev_params_rssi_dbm_conv() --> to set rssi in dbm converstion
551  *						params into monitor pdev.
552  *@cdp_soc: dp soc handle.
553  *@params: cdp_rssi_db2dbm_param_dp structure value.
554  *
555  * Return: QDF_STATUS_SUCCESS if value set successfully
556  *         QDF_STATUS_E_INVAL false if error
557  */
558 QDF_STATUS
559 dp_mon_pdev_params_rssi_dbm_conv(struct cdp_soc_t *cdp_soc,
560 				 struct cdp_rssi_db2dbm_param_dp *params);
561 #else
562 static inline QDF_STATUS
563 dp_mon_pdev_params_rssi_dbm_conv(struct cdp_soc_t *cdp_soc,
564 				 struct cdp_rssi_db2dbm_param_dp *params)
565 {
566 	return QDF_STATUS_E_INVAL;
567 }
568 #endif /* QCA_RSSI_DB2DBM */
569 
570 struct dp_mon_ops {
571 	QDF_STATUS (*mon_soc_cfg_init)(struct dp_soc *soc);
572 	QDF_STATUS (*mon_soc_attach)(struct dp_soc *soc);
573 	QDF_STATUS (*mon_soc_detach)(struct dp_soc *soc);
574 	QDF_STATUS (*mon_pdev_alloc)(struct dp_pdev *pdev);
575 	QDF_STATUS (*mon_soc_init)(struct dp_soc *soc);
576 	void (*mon_soc_deinit)(struct dp_soc *soc);
577 	void (*mon_pdev_free)(struct dp_pdev *pdev);
578 	QDF_STATUS (*mon_pdev_attach)(struct dp_pdev *pdev);
579 	QDF_STATUS (*mon_pdev_detach)(struct dp_pdev *pdev);
580 	QDF_STATUS (*mon_pdev_init)(struct dp_pdev *pdev);
581 	QDF_STATUS (*mon_pdev_deinit)(struct dp_pdev *pdev);
582 	QDF_STATUS (*mon_vdev_attach)(struct dp_vdev *vdev);
583 	QDF_STATUS (*mon_vdev_detach)(struct dp_vdev *vdev);
584 	QDF_STATUS (*mon_peer_attach)(struct dp_peer *peer);
585 	QDF_STATUS (*mon_peer_detach)(struct dp_peer *peer);
586 	struct cdp_peer_rate_stats_ctx *(*mon_peer_get_peerstats_ctx)(struct
587 								dp_peer *peer);
588 	void (*mon_peer_reset_stats)(struct dp_peer *peer);
589 	void (*mon_peer_get_stats)(struct dp_peer *peer, void *arg,
590 				   enum cdp_stat_update_type type);
591 	void (*mon_invalid_peer_update_pdev_stats)(struct dp_pdev *pdev);
592 	QDF_STATUS (*mon_peer_get_stats_param)(struct dp_peer *peer,
593 					       enum cdp_peer_stats_type type,
594 					       cdp_peer_stats_param_t *buf);
595 	QDF_STATUS (*mon_config_debug_sniffer)(struct dp_pdev *pdev, int val);
596 	void (*mon_flush_rings)(struct dp_soc *soc);
597 #if !defined(DISABLE_MON_CONFIG)
598 	QDF_STATUS (*mon_pdev_htt_srng_setup)(struct dp_soc *soc,
599 					      struct dp_pdev *pdev,
600 					      int mac_id,
601 					      int mac_for_pdev);
602 	QDF_STATUS (*mon_soc_htt_srng_setup)(struct dp_soc *soc);
603 #endif
604 #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
605 	uint32_t (*mon_drop_packets_for_mac)(struct dp_pdev *pdev,
606 					     uint32_t mac_id,
607 					     uint32_t quota);
608 #endif
609 #if defined(DP_CON_MON)
610 	void (*mon_service_rings)(struct  dp_soc *soc, uint32_t quota);
611 #endif
612 #ifndef DISABLE_MON_CONFIG
613 	uint32_t (*mon_rx_process)(struct dp_soc *soc,
614 				   struct dp_intr *int_ctx,
615 				   uint32_t mac_id,
616 				   uint32_t quota);
617 	uint32_t (*mon_tx_process)(struct dp_soc *soc,
618 				   struct dp_intr *int_ctx,
619 				   uint32_t mac_id,
620 				   uint32_t quota);
621 #endif
622 	void (*mon_peer_tx_init)(struct dp_pdev *pdev, struct dp_peer *peer);
623 	void (*mon_peer_tx_cleanup)(struct dp_vdev *vdev,
624 				    struct dp_peer *peer);
625 #ifdef WIFI_MONITOR_SUPPORT
626 	void (*mon_peer_tid_peer_id_update)(struct dp_peer *peer,
627 					    uint16_t peer_id);
628 	void (*mon_tx_ppdu_stats_attach)(struct dp_pdev *pdev);
629 	void (*mon_tx_ppdu_stats_detach)(struct dp_pdev *pdev);
630 	QDF_STATUS (*mon_tx_capture_debugfs_init)(struct dp_pdev *pdev);
631 	void (*mon_peer_tx_capture_filter_check)(struct dp_pdev *pdev,
632 						 struct dp_peer *peer);
633 	QDF_STATUS (*mon_tx_add_to_comp_queue)(struct dp_soc *soc,
634 					       struct dp_tx_desc_s *desc,
635 					       struct hal_tx_completion_status *ts,
636 					       uint16_t peer_id);
637 	QDF_STATUS (*mon_update_msdu_to_list)(struct dp_soc *soc,
638 					      struct dp_pdev *pdev,
639 					      struct dp_peer *peer,
640 					      struct hal_tx_completion_status *ts,
641 					      qdf_nbuf_t netbuf);
642 	QDF_STATUS
643 	(*mon_peer_tx_capture_get_stats)(struct dp_peer *peer,
644 					 struct cdp_peer_tx_capture_stats *sts);
645 	QDF_STATUS
646 	(*mon_pdev_tx_capture_get_stats)(struct dp_pdev *pdev,
647 					 struct cdp_pdev_tx_capture_stats *sts);
648 #endif
649 #if defined(WDI_EVENT_ENABLE) &&\
650 	(defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
651 	bool (*mon_ppdu_stats_ind_handler)(struct htt_soc *soc,
652 					   uint32_t *msg_word,
653 					   qdf_nbuf_t htt_t2h_msg);
654 #endif
655 	QDF_STATUS (*mon_htt_ppdu_stats_attach)(struct dp_pdev *pdev);
656 	void (*mon_htt_ppdu_stats_detach)(struct dp_pdev *pdev);
657 	void (*mon_print_pdev_rx_mon_stats)(struct dp_pdev *pdev);
658 
659 #ifdef WIFI_MONITOR_SUPPORT
660 	void (*mon_print_pdev_tx_capture_stats)(struct dp_pdev *pdev);
661 	QDF_STATUS (*mon_config_enh_tx_capture)(struct dp_pdev *pdev,
662 						uint8_t val);
663 	QDF_STATUS (*mon_tx_peer_filter)(struct dp_pdev *pdev_handle,
664 					 struct dp_peer *peer_handle,
665 					 uint8_t is_tx_pkt_cap_enable,
666 					 uint8_t *peer_mac);
667 #endif
668 #ifdef WLAN_RX_PKT_CAPTURE_ENH
669 	QDF_STATUS (*mon_config_enh_rx_capture)(struct dp_pdev *pdev,
670 						uint8_t val);
671 #endif
672 #ifdef QCA_SUPPORT_BPR
673 	QDF_STATUS (*mon_set_bpr_enable)(struct dp_pdev *pdev, int val);
674 #endif
675 #ifdef ATH_SUPPORT_NAC
676 	int (*mon_set_filter_neigh_peers)(struct dp_pdev *pdev, bool val);
677 #endif
678 #ifdef WLAN_ATF_ENABLE
679 	void (*mon_set_atf_stats_enable)(struct dp_pdev *pdev, bool value);
680 #endif
681 	void (*mon_set_bsscolor)(struct dp_pdev *pdev, uint8_t bsscolor);
682 	bool (*mon_pdev_get_filter_ucast_data)(struct cdp_pdev *pdev_handle);
683 	bool (*mon_pdev_get_filter_non_data)(struct cdp_pdev *pdev_handle);
684 	bool (*mon_pdev_get_filter_mcast_data)(struct cdp_pdev *pdev_handle);
685 #ifdef WDI_EVENT_ENABLE
686 	int (*mon_set_pktlog_wifi3)(struct dp_pdev *pdev, uint32_t event,
687 				    bool enable);
688 #endif
689 #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
690 	void (*mon_pktlogmod_exit)(struct dp_pdev *pdev);
691 #endif
692 	QDF_STATUS (*mon_vdev_set_monitor_mode_buf_rings)(struct dp_pdev *pdev);
693 	QDF_STATUS (*mon_vdev_set_monitor_mode_rings)(struct dp_pdev *pdev,
694 						      uint8_t delayed_replenish);
695 	void (*mon_neighbour_peers_detach)(struct dp_pdev *pdev);
696 #ifdef FEATURE_NAC_RSSI
697 	QDF_STATUS (*mon_filter_neighbour_peer)(struct dp_pdev *pdev,
698 						uint8_t *rx_pkt_hdr);
699 #endif
700 	void (*mon_vdev_timer_init)(struct dp_soc *soc);
701 	void (*mon_vdev_timer_start)(struct dp_soc *soc);
702 	bool (*mon_vdev_timer_stop)(struct dp_soc *soc);
703 	void (*mon_vdev_timer_deinit)(struct dp_soc *soc);
704 	void (*mon_reap_timer_init)(struct dp_soc *soc);
705 	bool (*mon_reap_timer_start)(struct dp_soc *soc,
706 				     enum cdp_mon_reap_source source);
707 	bool (*mon_reap_timer_stop)(struct dp_soc *soc,
708 				    enum cdp_mon_reap_source source);
709 	void (*mon_reap_timer_deinit)(struct dp_soc *soc);
710 #ifdef QCA_MCOPY_SUPPORT
711 	QDF_STATUS (*mon_mcopy_check_deliver)(struct dp_pdev *pdev,
712 					      uint16_t peer_id,
713 					      uint32_t ppdu_id,
714 					      uint8_t first_msdu);
715 #endif
716 	void (*mon_neighbour_peer_add_ast)(struct dp_pdev *pdev,
717 					   struct dp_peer *ta_peer,
718 					   uint8_t *mac_addr,
719 					   qdf_nbuf_t nbuf,
720 					   uint32_t flags);
721 #ifdef QCA_ENHANCED_STATS_SUPPORT
722 	void (*mon_filter_setup_enhanced_stats)(struct dp_pdev *pdev);
723 	void (*mon_filter_reset_enhanced_stats)(struct dp_pdev *pdev);
724 	void (*mon_tx_stats_update)(struct dp_mon_peer *mon_peer,
725 				    struct cdp_tx_completion_ppdu_user *ppdu);
726 	void (*mon_tx_enable_enhanced_stats)(struct dp_pdev *pdev);
727 	void (*mon_tx_disable_enhanced_stats)(struct dp_pdev *pdev);
728 	void (*mon_ppdu_desc_deliver)(struct dp_pdev *pdev,
729 				      struct ppdu_info *ppdu_info);
730 	bool (*mon_ppdu_stats_feat_enable_check)(struct dp_pdev *pdev);
731 	void (*mon_ppdu_desc_notify)(struct dp_pdev *pdev, qdf_nbuf_t nbuf);
732 #endif
733 #ifdef QCA_MCOPY_SUPPORT
734 	void (*mon_filter_setup_mcopy_mode)(struct dp_pdev *pdev);
735 	void (*mon_filter_reset_mcopy_mode)(struct dp_pdev *pdev);
736 #endif
737 #if defined(ATH_SUPPORT_NAC_RSSI) || defined(ATH_SUPPORT_NAC)
738 	void (*mon_filter_setup_smart_monitor)(struct dp_pdev *pdev);
739 	void (*mon_filter_reset_smart_monitor)(struct dp_pdev *pdev);
740 #endif
741 #ifdef WLAN_RX_PKT_CAPTURE_ENH
742 	void (*mon_filter_setup_rx_enh_capture)(struct dp_pdev *pdev);
743 	void (*mon_filter_reset_rx_enh_capture)(struct dp_pdev *pdev);
744 #endif
745 	void (*mon_filter_setup_rx_mon_mode)(struct dp_pdev *pdev);
746 	void (*mon_filter_reset_rx_mon_mode)(struct dp_pdev *pdev);
747 	void (*mon_filter_setup_tx_mon_mode)(struct dp_pdev *pdev);
748 	void (*mon_filter_reset_tx_mon_mode)(struct dp_pdev *pdev);
749 #ifdef WDI_EVENT_ENABLE
750 	void (*mon_filter_setup_rx_pkt_log_full)(struct dp_pdev *pdev);
751 	void (*mon_filter_reset_rx_pkt_log_full)(struct dp_pdev *pdev);
752 	void (*mon_filter_setup_rx_pkt_log_lite)(struct dp_pdev *pdev);
753 	void (*mon_filter_reset_rx_pkt_log_lite)(struct dp_pdev *pdev);
754 	void (*mon_filter_setup_rx_pkt_log_cbf)(struct dp_pdev *pdev);
755 	void (*mon_filter_reset_rx_pkt_log_cbf)(struct dp_pdev *pdev);
756 #ifdef BE_PKTLOG_SUPPORT
757 	void (*mon_filter_setup_pktlog_hybrid)(struct dp_pdev *pdev);
758 	void (*mon_filter_reset_pktlog_hybrid)(struct dp_pdev *pdev);
759 #endif
760 #endif
761 	QDF_STATUS (*rx_mon_filter_update)(struct dp_pdev *pdev);
762 	QDF_STATUS (*tx_mon_filter_update)(struct dp_pdev *pdev);
763 
764 	QDF_STATUS (*tx_mon_filter_alloc)(struct dp_pdev *pdev);
765 	void (*tx_mon_filter_dealloc)(struct dp_pdev *pdev);
766 	QDF_STATUS (*mon_rings_alloc)(struct dp_pdev *pdev);
767 	void (*mon_rings_free)(struct dp_pdev *pdev);
768 	QDF_STATUS (*mon_rings_init)(struct dp_pdev *pdev);
769 	void (*mon_rings_deinit)(struct dp_pdev *pdev);
770 
771 	QDF_STATUS (*rx_mon_buffers_alloc)(struct dp_pdev *pdev);
772 	void (*rx_mon_buffers_free)(struct dp_pdev *pdev);
773 	void (*rx_mon_desc_pool_init)(struct dp_pdev *pdev);
774 	void (*rx_mon_desc_pool_deinit)(struct dp_pdev *pdev);
775 	QDF_STATUS (*rx_mon_desc_pool_alloc)(struct dp_pdev *pdev);
776 	void (*rx_mon_desc_pool_free)(struct dp_pdev *pdev);
777 	void (*tx_mon_desc_pool_init)(struct dp_pdev *pdev);
778 	void (*tx_mon_desc_pool_deinit)(struct dp_pdev *pdev);
779 	QDF_STATUS (*tx_mon_desc_pool_alloc)(struct dp_pdev *pdev);
780 	void (*tx_mon_desc_pool_free)(struct dp_pdev *pdev);
781 	void (*rx_mon_enable)(uint32_t *msg_word,
782 			      struct htt_rx_ring_tlv_filter *tlv_filter);
783 	void (*rx_hdr_length_set)(uint32_t *msg_word,
784 				  struct htt_rx_ring_tlv_filter *tlv_filter);
785 	void (*rx_packet_length_set)(uint32_t *msg_word,
786 				     struct htt_rx_ring_tlv_filter *tlv_filter);
787 	void (*rx_wmask_subscribe)(uint32_t *msg_word,
788 				   struct htt_rx_ring_tlv_filter *tlv_filter);
789 	void (*rx_enable_mpdu_logging)(uint32_t *msg_word,
790 				       struct htt_rx_ring_tlv_filter *tlv_filter);
791 	void (*rx_enable_fpmo)(uint32_t *msg_word,
792 			       struct htt_rx_ring_tlv_filter *tlv_filter);
793 #ifndef DISABLE_MON_CONFIG
794 	void (*mon_register_intr_ops)(struct dp_soc *soc);
795 #endif
796 	void (*mon_register_feature_ops)(struct dp_soc *soc);
797 #ifdef QCA_ENHANCED_STATS_SUPPORT
798 	void (*mon_rx_stats_update)(struct dp_mon_peer *mon_peer,
799 				    struct cdp_rx_indication_ppdu *ppdu,
800 				    struct cdp_rx_stats_ppdu_user *ppdu_user);
801 	void (*mon_rx_populate_ppdu_usr_info)(struct mon_rx_user_status *rx_user_status,
802 					      struct cdp_rx_stats_ppdu_user *ppdu_user);
803 	void (*mon_rx_populate_ppdu_info)(struct hal_rx_ppdu_info *hal_ppdu_info,
804 					  struct cdp_rx_indication_ppdu *ppdu);
805 #endif
806 	QDF_STATUS (*rx_mon_refill_buf_ring)(struct dp_intr *int_ctx);
807 	QDF_STATUS (*tx_mon_refill_buf_ring)(struct dp_intr *int_ctx);
808 #ifdef QCA_UNDECODED_METADATA_SUPPORT
809 	QDF_STATUS (*mon_config_undecoded_metadata_capture)
810 	    (struct dp_pdev *pdev, int val);
811 	void (*mon_filter_setup_undecoded_metadata_capture)
812 	    (struct dp_pdev *pdev);
813 	void (*mon_filter_reset_undecoded_metadata_capture)
814 	    (struct dp_pdev *pdev);
815 #endif
816 	QDF_STATUS (*mon_pdev_ext_init)(struct dp_pdev *pdev);
817 	QDF_STATUS (*mon_pdev_ext_deinit)(struct dp_pdev *pdev);
818 	QDF_STATUS (*mon_lite_mon_alloc)(struct dp_pdev *pdev);
819 	void (*mon_lite_mon_dealloc)(struct dp_pdev *pdev);
820 	void (*mon_lite_mon_vdev_delete)(struct dp_pdev *pdev,
821 					 struct dp_vdev *vdev);
822 	void (*mon_lite_mon_disable_rx)(struct dp_pdev *pdev);
823 	/* Print advanced monitor stats */
824 	void (*mon_rx_print_advanced_stats)
825 		(struct dp_soc *soc, struct dp_pdev *pdev);
826 	QDF_STATUS (*mon_rx_ppdu_info_cache_create)(struct dp_pdev *pdev);
827 	void (*mon_rx_ppdu_info_cache_destroy)(struct dp_pdev *pdev);
828 };
829 
830 /**
831  * struct dp_mon_soc_stats - monitor stats
832  * @frag_alloc: Number of frags allocated
833  * @frag_free: Number of frags freed
834  */
835 struct dp_mon_soc_stats {
836 	uint32_t frag_alloc;
837 	uint32_t frag_free;
838 };
839 
840 struct dp_mon_soc {
841 	/* Holds all monitor related fields extracted from dp_soc */
842 	/* Holds pointer to monitor ops */
843 	/* monitor link descriptor pages */
844 	struct qdf_mem_multi_page_t mon_link_desc_pages[MAX_NUM_LMAC_HW];
845 
846 	/* total link descriptors for monitor mode for each radio */
847 	uint32_t total_mon_link_descs[MAX_NUM_LMAC_HW];
848 
849 	 /* Monitor Link descriptor memory banks */
850 	struct link_desc_bank
851 		mon_link_desc_banks[MAX_NUM_LMAC_HW][MAX_MON_LINK_DESC_BANKS];
852 	uint32_t num_mon_link_desc_banks[MAX_NUM_LMAC_HW];
853 	/* Smart monitor capability for HKv2 */
854 	uint8_t hw_nac_monitor_support;
855 
856 	/* Full monitor mode support */
857 	bool full_mon_mode;
858 
859 	/*interrupt timer*/
860 	qdf_timer_t mon_reap_timer;
861 	uint8_t reap_timer_init;
862 
863 	qdf_spinlock_t reap_timer_lock;
864 
865 	/* Bitmap to record trigger sources of the reap timer */
866 	qdf_bitmap(mon_reap_src_bitmap, CDP_MON_REAP_SOURCE_NUM);
867 
868 	qdf_timer_t mon_vdev_timer;
869 	uint8_t mon_vdev_timer_state;
870 
871 	struct dp_mon_ops *mon_ops;
872 	bool monitor_mode_v2;
873 #ifndef DISABLE_MON_CONFIG
874 	uint32_t (*mon_rx_process)(struct dp_soc *soc,
875 				   struct dp_intr *int_ctx,
876 				   uint32_t mac_id,
877 				   uint32_t quota);
878 #endif
879 
880 #ifdef WLAN_TX_PKT_CAPTURE_ENH
881 	struct dp_soc_tx_capture dp_soc_tx_capt;
882 #endif
883 	/* monitor stats */
884 	struct dp_mon_soc_stats stats;
885 };
886 
887 #ifdef WLAN_TELEMETRY_STATS_SUPPORT
888 #define MAX_CONSUMPTION_TIME 5 /* in sec */
889 struct dp_mon_peer_airtime_consumption {
890 	uint32_t consumption;
891 	struct {
892 		uint32_t avg_consumption_per_sec[MAX_CONSUMPTION_TIME];
893 		uint8_t idx;
894 	} avg_consumption;
895 };
896 #endif
897 
898 /**
899  * struct dp_mon_peer_stats - Monitor peer stats
900  */
901 struct dp_mon_peer_stats {
902 #ifdef QCA_ENHANCED_STATS_SUPPORT
903 	dp_mon_peer_tx_stats tx;
904 	dp_mon_peer_rx_stats rx;
905 #ifdef WLAN_TELEMETRY_STATS_SUPPORT
906 	struct dp_mon_peer_airtime_consumption airtime_consumption;
907 #endif
908 #endif
909 };
910 
911 struct dp_mon_peer {
912 #ifdef WLAN_TX_PKT_CAPTURE_ENH
913 	struct dp_peer_tx_capture tx_capture;
914 #endif
915 #ifdef FEATURE_PERPKT_INFO
916 	/* delayed ba ppdu stats handling */
917 	struct cdp_delayed_tx_completion_ppdu_user delayed_ba_ppdu_stats;
918 	/* delayed ba flag */
919 	bool last_delayed_ba;
920 	/* delayed ba ppdu id */
921 	uint32_t last_delayed_ba_ppduid;
922 #endif
923 	uint8_t tx_cap_enabled:1, /* Peer's tx-capture is enabled */
924 		rx_cap_enabled:1; /* Peer's rx-capture is enabled */
925 
926 	/* Peer level flag to check peer based pktlog enabled or
927 	 * disabled
928 	 */
929 	uint8_t peer_based_pktlog_filter;
930 
931 	/* Monitor peer stats */
932 	struct dp_mon_peer_stats stats;
933 
934 	/* peer extended statistics context */
935 	struct cdp_peer_rate_stats_ctx *peerstats_ctx;
936 };
937 
938 struct  dp_mon_pdev {
939 	/* monitor */
940 	bool monitor_configured;
941 
942 	struct dp_mon_filter **filter;	/* Monitor Filter pointer */
943 
944 	/* advance filter mode and type*/
945 	uint8_t mon_filter_mode;
946 	uint16_t fp_mgmt_filter;
947 	uint16_t fp_ctrl_filter;
948 	uint16_t fp_data_filter;
949 	uint16_t mo_mgmt_filter;
950 	uint16_t mo_ctrl_filter;
951 	uint16_t mo_data_filter;
952 	uint16_t md_data_filter;
953 
954 #ifdef WLAN_TX_PKT_CAPTURE_ENH
955 	struct dp_pdev_tx_capture tx_capture;
956 	bool stop_tx_capture_work_q_timer;
957 #endif
958 
959 	/* tx packet capture enhancement */
960 	enum cdp_tx_enh_capture_mode tx_capture_enabled;
961 	/* Stuck count on monitor destination ring MPDU process */
962 	uint32_t mon_dest_ring_stuck_cnt;
963 	/* monitor mode lock */
964 	qdf_spinlock_t mon_lock;
965 
966 	/* Monitor mode operation channel */
967 	int mon_chan_num;
968 
969 	/* Monitor mode operation frequency */
970 	qdf_freq_t mon_chan_freq;
971 
972 	/* Monitor mode band */
973 	enum reg_wifi_band mon_chan_band;
974 
975 	uint32_t mon_ppdu_status;
976 	/* monitor mode status/destination ring PPDU and MPDU count */
977 	struct cdp_pdev_mon_stats rx_mon_stats;
978 	/* Monitor mode interface and status storage */
979 	struct dp_vdev *mvdev;
980 	struct cdp_mon_status rx_mon_recv_status;
981 	/* to track duplicate link descriptor indications by HW for a WAR */
982 	uint64_t mon_last_linkdesc_paddr;
983 	/* to track duplicate buffer indications by HW for a WAR */
984 	uint32_t mon_last_buf_cookie;
985 
986 #ifdef QCA_SUPPORT_FULL_MON
987 	/* List to maintain all MPDUs for a PPDU in monitor mode */
988 	TAILQ_HEAD(, dp_mon_mpdu) mon_mpdu_q;
989 
990 	/* TODO: define per-user mpdu list
991 	 * struct dp_mon_mpdu_list mpdu_list[MAX_MU_USERS];
992 	 */
993 	struct hal_rx_mon_desc_info *mon_desc;
994 #endif
995 	/* Flag to hold on to monitor destination ring */
996 	bool hold_mon_dest_ring;
997 
998 	/* Flag to inidicate monitor rings are initialized */
999 	uint8_t pdev_mon_init;
1000 #ifndef REMOVE_PKT_LOG
1001 	bool pkt_log_init;
1002 	struct pktlog_dev_t *pl_dev; /* Pktlog pdev */
1003 #endif /* #ifndef REMOVE_PKT_LOG */
1004 
1005 	/* Smart Mesh */
1006 	bool filter_neighbour_peers;
1007 
1008 	/*flag to indicate neighbour_peers_list not empty */
1009 	bool neighbour_peers_added;
1010 	/* smart mesh mutex */
1011 	qdf_spinlock_t neighbour_peer_mutex;
1012 	/* Neighnour peer list */
1013 	TAILQ_HEAD(, dp_neighbour_peer) neighbour_peers_list;
1014 	/* Enhanced Stats is enabled */
1015 	bool enhanced_stats_en;
1016 	qdf_nbuf_queue_t rx_status_q;
1017 
1018 	/* 128 bytes mpdu header queue per user for ppdu */
1019 	qdf_nbuf_queue_t mpdu_q[MAX_MU_USERS];
1020 
1021 	/* is this a mpdu header TLV and not msdu header TLV */
1022 	bool is_mpdu_hdr[MAX_MU_USERS];
1023 
1024 	/* per user 128 bytes msdu header list for MPDU */
1025 	struct msdu_list msdu_list[MAX_MU_USERS];
1026 
1027 	/* RX enhanced capture mode */
1028 	uint8_t rx_enh_capture_mode;
1029 	/* Rx per peer enhanced capture mode */
1030 	bool rx_enh_capture_peer;
1031 	struct dp_vdev *rx_enh_monitor_vdev;
1032 	/* RX enhanced capture trailer enable/disable flag */
1033 	bool is_rx_enh_capture_trailer_enabled;
1034 #ifdef WLAN_RX_PKT_CAPTURE_ENH
1035 	/* RX per MPDU/PPDU information */
1036 	struct cdp_rx_indication_mpdu mpdu_ind;
1037 #endif
1038 
1039 	/* Packet log mode */
1040 	uint8_t rx_pktlog_mode;
1041 	/* Enable pktlog logging cbf */
1042 	bool rx_pktlog_cbf;
1043 
1044 #ifdef BE_PKTLOG_SUPPORT
1045 	/* Enable pktlog logging hybrid */
1046 	bool pktlog_hybrid_mode;
1047 #endif
1048 	bool tx_sniffer_enable;
1049 	/* mirror copy mode */
1050 	enum m_copy_mode mcopy_mode;
1051 	bool bpr_enable;
1052 	/* Pdev level flag to check peer based pktlog enabled or
1053 	 * disabled
1054 	 */
1055 	uint8_t dp_peer_based_pktlog;
1056 
1057 #ifdef WLAN_ATF_ENABLE
1058 	/* ATF stats enable */
1059 	bool dp_atf_stats_enable;
1060 #endif
1061 
1062 	/* Maintains first status buffer's paddr of a PPDU */
1063 	uint64_t status_buf_addr;
1064 	struct hal_rx_ppdu_info ppdu_info;
1065 
1066 	/* ppdu_id of last received HTT TX stats */
1067 	uint32_t last_ppdu_id;
1068 	struct {
1069 		uint8_t last_user;
1070 		qdf_nbuf_t buf;
1071 	} tx_ppdu_info;
1072 
1073 	struct {
1074 		uint32_t tx_ppdu_id;
1075 		uint16_t tx_peer_id;
1076 		uint32_t rx_ppdu_id;
1077 	} m_copy_id;
1078 
1079 	/* To check if PPDU Tx stats are enabled for Pktlog */
1080 	bool pktlog_ppdu_stats;
1081 
1082 #ifdef ATH_SUPPORT_NAC_RSSI
1083 	bool nac_rssi_filtering;
1084 #endif
1085 
1086 	/* ppdu_stats lock for queue concurrency between cores*/
1087 	qdf_spinlock_t ppdu_stats_lock;
1088 
1089 	/* list of ppdu tlvs */
1090 	TAILQ_HEAD(, ppdu_info) ppdu_info_list;
1091 	TAILQ_HEAD(, ppdu_info) sched_comp_ppdu_list;
1092 
1093 	uint32_t sched_comp_list_depth;
1094 	uint16_t delivered_sched_cmdid;
1095 	uint16_t last_sched_cmdid;
1096 	uint32_t tlv_count;
1097 	uint32_t list_depth;
1098 
1099 	struct {
1100 		qdf_nbuf_t last_nbuf; /*Ptr to mgmt last buf */
1101 		uint8_t *mgmt_buf; /* Ptr to mgmt. payload in HTT ppdu stats */
1102 		uint32_t mgmt_buf_len; /* Len of mgmt. payload in ppdu stats */
1103 		uint32_t ppdu_id;
1104 	} mgmtctrl_frm_info;
1105 	/* Context of cal client timer */
1106 	struct cdp_cal_client *cal_client_ctx;
1107 	uint32_t *ppdu_tlv_buf; /* Buffer to hold HTT ppdu stats TLVs*/
1108 
1109 	qdf_nbuf_t mcopy_status_nbuf;
1110 	bool is_dp_mon_pdev_initialized;
1111 	/* indicates if spcl vap is configured */
1112 	bool scan_spcl_vap_configured;
1113 	bool undecoded_metadata_capture;
1114 #ifdef QCA_UNDECODED_METADATA_SUPPORT
1115 	uint32_t phyrx_error_mask;
1116 	uint32_t phyrx_error_mask_cont;
1117 #endif
1118 #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
1119 	/* enable spcl vap stats reset on ch change */
1120 	bool reset_scan_spcl_vap_stats_enable;
1121 #endif
1122 	bool is_tlv_hdr_64_bit;
1123 
1124 	/* Invalid monitor peer to account for stats in mcopy mode */
1125 	struct dp_mon_peer *invalid_mon_peer;
1126 };
1127 
1128 struct  dp_mon_vdev {
1129 	/* callback to hand rx monitor 802.11 MPDU to the OS shim */
1130 	ol_txrx_rx_mon_fp osif_rx_mon;
1131 #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
1132 	struct cdp_scan_spcl_vap_stats *scan_spcl_vap_stats;
1133 #endif
1134 };
1135 
1136 #if defined(QCA_TX_CAPTURE_SUPPORT) || defined(QCA_ENHANCED_STATS_SUPPORT)
1137 void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf);
1138 #else
1139 static inline
1140 void dp_deliver_mgmt_frm(struct dp_pdev *pdev, qdf_nbuf_t nbuf)
1141 {
1142 }
1143 #endif
1144 
1145 #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
1146 	defined(WLAN_SUPPORT_RX_FLOW_TAG)
1147 /**
1148  * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
1149  *                                       mode and then tags appropriate packets
1150  * @soc: core txrx main context
1151  * @vdev: pdev on which packet is received
1152  * @msdu: QDF packet buffer on which the protocol tag should be set
1153  * @rx_desc: base address where the RX TLVs start
1154  * Return: void
1155  */
1156 void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
1157 					struct dp_pdev *dp_pdev,
1158 					qdf_nbuf_t msdu, void *rx_desc);
1159 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
1160 
1161 #if !defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) &&\
1162 	!defined(WLAN_SUPPORT_RX_FLOW_TAG)
1163 /**
1164  * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
1165  *                                       mode and then tags appropriate packets
1166  * @soc: core txrx main context
1167  * @vdev: pdev on which packet is received
1168  * @msdu: QDF packet buffer on which the protocol tag should be set
1169  * @rx_desc: base address where the RX TLVs start
1170  * Return: void
1171  */
1172 static inline
1173 void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
1174 					struct dp_pdev *dp_pdev,
1175 					qdf_nbuf_t msdu, void *rx_desc)
1176 {
1177 }
1178 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
1179 
1180 #ifndef WLAN_TX_PKT_CAPTURE_ENH
1181 /**
1182  * dp_peer_tid_queue_init() – Initialize ppdu stats queue per TID
1183  * @peer: Datapath peer
1184  *
1185  */
1186 static inline void dp_peer_tid_queue_init(struct dp_peer *peer)
1187 {
1188 }
1189 
1190 /**
1191  * dp_peer_tid_queue_cleanup() – remove ppdu stats queue per TID
1192  * @peer: Datapath peer
1193  *
1194  */
1195 static inline void dp_peer_tid_queue_cleanup(struct dp_peer *peer)
1196 {
1197 }
1198 
1199 /**
1200  * dp_peer_update_80211_hdr() – dp peer update 80211 hdr
1201  * @vdev: Datapath vdev
1202  * @peer: Datapath peer
1203  *
1204  */
1205 static inline void
1206 dp_peer_update_80211_hdr(struct dp_vdev *vdev, struct dp_peer *peer)
1207 {
1208 }
1209 
1210 /**
1211  * dp_get_peer_tx_capture_stats: to get peer tx capture stats
1212  * @peer: DP PEER handle
1213  * @stats: pointor to peer tx capture stats
1214  *
1215  * return: QDF_STATUS
1216  */
1217 static inline QDF_STATUS
1218 dp_get_peer_tx_capture_stats(struct dp_peer *peer,
1219 			     struct cdp_peer_tx_capture_stats *stats)
1220 {
1221 	return QDF_STATUS_E_FAILURE;
1222 }
1223 
1224 /**
1225  * dp_get_pdev_tx_capture_stats: to get pdev tx capture stats
1226  * @pdev: DP PDEV handle
1227  * @stats: pointor to pdev tx capture stats
1228  *
1229  * return: QDF_STATUS
1230  */
1231 static inline QDF_STATUS
1232 dp_get_pdev_tx_capture_stats(struct dp_pdev *pdev,
1233 			     struct cdp_pdev_tx_capture_stats *stats)
1234 {
1235 	return QDF_STATUS_E_FAILURE;
1236 }
1237 #endif
1238 
1239 #ifdef WLAN_TX_PKT_CAPTURE_ENH
1240 extern uint8_t
1241 dp_cpu_ring_map[DP_NSS_CPU_RING_MAP_MAX][WLAN_CFG_INT_NUM_CONTEXTS_MAX];
1242 #endif
1243 
1244 int
1245 dp_htt_get_ppdu_sniffer_ampdu_tlv_bitmap(uint32_t bitmap);
1246 
1247 #if (defined(DP_CON_MON) || defined(WDI_EVENT_ENABLE)) &&\
1248 	(!defined(REMOVE_PKT_LOG))
1249 void dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn);
1250 #else
1251 static inline void
1252 dp_pkt_log_init(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, void *scn)
1253 {
1254 }
1255 #endif
1256 
1257 #if defined(WDI_EVENT_ENABLE) && defined(QCA_ENHANCED_STATS_SUPPORT)
1258 QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev, struct dp_peer *peer);
1259 #else
1260 static inline QDF_STATUS dp_peer_stats_notify(struct dp_pdev *pdev,
1261 					      struct dp_peer *peer)
1262 {
1263 	return QDF_STATUS_SUCCESS;
1264 }
1265 #endif
1266 
1267 #if defined(FEATURE_PERPKT_INFO) && defined(WDI_EVENT_ENABLE)
1268 void dp_send_stats_event(struct dp_pdev *pdev, struct dp_peer *peer,
1269 			 uint16_t peer_id);
1270 #else
1271 static inline
1272 void dp_send_stats_event(struct dp_pdev *pdev, struct dp_peer *peer,
1273 			 uint16_t peer_id)
1274 {
1275 }
1276 #endif
1277 
1278 #ifndef WLAN_TX_PKT_CAPTURE_ENH
1279 /**
1280  * dp_tx_ppdu_stats_process - Deferred PPDU stats handler
1281  * @context: Opaque work context (PDEV)
1282  *
1283  * Return: none
1284  */
1285 static  inline void dp_tx_ppdu_stats_process(void *context)
1286 {
1287 }
1288 
1289 /*
1290  * dp_tx_capture_htt_frame_counter: increment counter for htt_frame_type
1291  * pdev: DP pdev handle
1292  * htt_frame_type: htt frame type received from fw
1293  *
1294  * return: void
1295  */
1296 static inline
1297 void dp_tx_capture_htt_frame_counter(struct dp_pdev *pdev,
1298 				     uint32_t htt_frame_type)
1299 {
1300 }
1301 
1302 #endif
1303 
1304 /**
1305  * dp_rx_cookie_2_mon_link_desc_va() - Converts cookie to a virtual address of
1306  *				   the MSDU Link Descriptor
1307  * @pdev: core txrx pdev context
1308  * @buf_info: buf_info includes cookie that used to lookup virtual address of
1309  * link descriptor. Normally this is just an index into a per pdev array.
1310  *
1311  * This is the VA of the link descriptor in monitor mode destination ring,
1312  * that HAL layer later uses to retrieve the list of MSDU's for a given MPDU.
1313  *
1314  * Return: void *: Virtual Address of the Rx descriptor
1315  */
1316 static inline
1317 void *dp_rx_cookie_2_mon_link_desc_va(struct dp_pdev *pdev,
1318 				      struct hal_buf_info *buf_info,
1319 				      int mac_id)
1320 {
1321 	void *link_desc_va;
1322 	struct qdf_mem_multi_page_t *pages;
1323 	uint16_t page_id = LINK_DESC_COOKIE_PAGE_ID(buf_info->sw_cookie);
1324 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
1325 
1326 	if (!mon_soc)
1327 		return NULL;
1328 
1329 	pages = &mon_soc->mon_link_desc_pages[mac_id];
1330 	if (!pages)
1331 		return NULL;
1332 
1333 	if (qdf_unlikely(page_id >= pages->num_pages))
1334 		return NULL;
1335 
1336 	link_desc_va = pages->dma_pages[page_id].page_v_addr_start +
1337 		(buf_info->paddr - pages->dma_pages[page_id].page_p_addr);
1338 
1339 	return link_desc_va;
1340 }
1341 
1342 /**
1343  * dp_soc_is_full_mon_enable () - Return if full monitor mode is enabled
1344  * @soc: DP soc handle
1345  *
1346  * Return: Full monitor mode status
1347  */
1348 static inline bool dp_soc_is_full_mon_enable(struct dp_pdev *pdev)
1349 {
1350 	return (pdev->soc->monitor_soc->full_mon_mode &&
1351 		pdev->monitor_pdev->monitor_configured) ? true : false;
1352 }
1353 
1354 /*
1355  * dp_monitor_is_enable_mcopy_mode() - check if mcopy mode is enabled
1356  * @pdev: point to dp pdev
1357  *
1358  * Return: true if mcopy mode is enabled
1359  */
1360 static inline bool dp_monitor_is_enable_mcopy_mode(struct dp_pdev *pdev)
1361 {
1362 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1363 		return false;
1364 
1365 	return pdev->monitor_pdev->mcopy_mode;
1366 }
1367 
1368 /*
1369  * dp_monitor_is_enable_tx_sniffer() - check if tx sniffer is enabled
1370  * @pdev: point to dp pdev
1371  *
1372  * Return: true if tx sniffer is enabled
1373  */
1374 static inline bool dp_monitor_is_enable_tx_sniffer(struct dp_pdev *pdev)
1375 {
1376 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1377 		return false;
1378 
1379 	return pdev->monitor_pdev->tx_sniffer_enable;
1380 }
1381 
1382 /*
1383  * dp_monitor_is_set_monitor_configured() - check if monitor configured is set
1384  * @pdev: point to dp pdev
1385  *
1386  * Return: true if monitor configured is set
1387  */
1388 static inline bool dp_monitor_is_configured(struct dp_pdev *pdev)
1389 {
1390 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1391 		return false;
1392 
1393 	return pdev->monitor_pdev->monitor_configured;
1394 }
1395 
1396 /*
1397  * dp_monitor_check_com_info_ppdu_id() - check if msdu ppdu_id matches with
1398  * com info ppdu_id
1399  * @pdev: point to dp pdev
1400  * @rx_desc: point to rx_desc
1401  *
1402  * Return: success if ppdu_id matches
1403  */
1404 static inline QDF_STATUS dp_monitor_check_com_info_ppdu_id(struct dp_pdev *pdev,
1405 							   void *rx_desc)
1406 {
1407 	struct cdp_mon_status *rs;
1408 	struct dp_mon_pdev *mon_pdev;
1409 	uint32_t msdu_ppdu_id = 0;
1410 
1411 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1412 		return QDF_STATUS_E_FAILURE;
1413 
1414 	mon_pdev = pdev->monitor_pdev;
1415 	if (qdf_likely(1 != mon_pdev->ppdu_info.rx_status.rxpcu_filter_pass))
1416 		return QDF_STATUS_E_FAILURE;
1417 
1418 	rs = &pdev->monitor_pdev->rx_mon_recv_status;
1419 	if (!rs || rs->cdp_rs_rxdma_err)
1420 		return QDF_STATUS_E_FAILURE;
1421 
1422 	msdu_ppdu_id = hal_rx_get_ppdu_id(pdev->soc->hal_soc, rx_desc);
1423 	if (msdu_ppdu_id != mon_pdev->ppdu_info.com_info.ppdu_id) {
1424 		QDF_TRACE(QDF_MODULE_ID_DP,
1425 			  QDF_TRACE_LEVEL_ERROR,
1426 			  "msdu_ppdu_id=%x,com_info.ppdu_id=%x",
1427 			  msdu_ppdu_id,
1428 			  mon_pdev->ppdu_info.com_info.ppdu_id);
1429 		return QDF_STATUS_E_FAILURE;
1430 	}
1431 
1432 	return QDF_STATUS_SUCCESS;
1433 }
1434 
1435 /*
1436  * dp_monitor_get_rx_status() - get rx status
1437  * @pdev: point to dp pdev
1438  *
1439  * Return: return rx status pointer
1440  */
1441 static inline struct mon_rx_status*
1442 dp_monitor_get_rx_status(struct dp_pdev *pdev)
1443 {
1444 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1445 		return NULL;
1446 
1447 	return &pdev->monitor_pdev->ppdu_info.rx_status;
1448 }
1449 
1450 /*
1451  * dp_monitor_is_chan_band_known() - check if monitor chan band known
1452  * @pdev: point to dp pdev
1453  *
1454  * Return: true if chan band known
1455  */
1456 static inline bool dp_monitor_is_chan_band_known(struct dp_pdev *pdev)
1457 {
1458 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1459 		return false;
1460 
1461 	if (pdev->monitor_pdev->mon_chan_band != REG_BAND_UNKNOWN)
1462 		return true;
1463 
1464 	return false;
1465 }
1466 
1467 /*
1468  * dp_monitor_get_chan_band() - get chan band
1469  * @pdev: point to dp pdev
1470  *
1471  * Return: wifi channel band
1472  */
1473 static inline enum reg_wifi_band
1474 dp_monitor_get_chan_band(struct dp_pdev *pdev)
1475 {
1476 	return pdev->monitor_pdev->mon_chan_band;
1477 }
1478 
1479 /*
1480  * dp_monitor_print_tx_stats() - print tx stats from monitor pdev
1481  * @pdev: point to dp pdev
1482  *
1483  */
1484 static inline void dp_monitor_print_tx_stats(struct dp_pdev *pdev)
1485 {
1486 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1487 		return;
1488 
1489 	DP_PRINT_STATS("ppdu info schedule completion list depth: %d",
1490 		       pdev->monitor_pdev->sched_comp_list_depth);
1491 	DP_PRINT_STATS("delivered sched cmdid: %d",
1492 		       pdev->monitor_pdev->delivered_sched_cmdid);
1493 	DP_PRINT_STATS("cur sched cmdid: %d",
1494 		       pdev->monitor_pdev->last_sched_cmdid);
1495 	DP_PRINT_STATS("ppdu info list depth: %d",
1496 		       pdev->monitor_pdev->list_depth);
1497 }
1498 
1499 /*
1500  * dp_monitor_set_chan_num() - set channel number
1501  * @pdev: point to dp pdev
1502  * @chan_num: channel number
1503  *
1504  */
1505 static inline void dp_monitor_set_chan_num(struct dp_pdev *pdev, int chan_num)
1506 {
1507 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1508 		return;
1509 
1510 	pdev->monitor_pdev->mon_chan_num = chan_num;
1511 }
1512 
1513 /*
1514  * dp_monitor_get_chan_num() - get channel number
1515  * @pdev: DP pdev handle
1516  *
1517  * Return: channel number
1518  */
1519 static inline int dp_monitor_get_chan_num(struct dp_pdev *pdev)
1520 {
1521 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1522 		return 0;
1523 
1524 	return pdev->monitor_pdev->mon_chan_num;
1525 }
1526 
1527 /*
1528  * dp_monitor_set_chan_freq() - set channel frequency
1529  * @pdev: point to dp pdev
1530  * @chan_freq: channel frequency
1531  *
1532  */
1533 static inline void
1534 dp_monitor_set_chan_freq(struct dp_pdev *pdev, qdf_freq_t chan_freq)
1535 {
1536 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1537 		return;
1538 
1539 	pdev->monitor_pdev->mon_chan_freq = chan_freq;
1540 }
1541 
1542 /*
1543  * dp_monitor_get_chan_freq() - get channel frequency
1544  * @pdev: DP pdev handle
1545  *
1546  * @Return: channel frequency
1547  */
1548 static inline qdf_freq_t
1549 dp_monitor_get_chan_freq(struct dp_pdev *pdev)
1550 {
1551 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1552 		return 0;
1553 
1554 	return pdev->monitor_pdev->mon_chan_freq;
1555 }
1556 
1557 /*
1558  * dp_monitor_set_chan_band() - set channel band
1559  * @pdev: point to dp pdev
1560  * @chan_band: channel band
1561  *
1562  */
1563 static inline void
1564 dp_monitor_set_chan_band(struct dp_pdev *pdev, enum reg_wifi_band chan_band)
1565 {
1566 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1567 		return;
1568 
1569 	pdev->monitor_pdev->mon_chan_band = chan_band;
1570 }
1571 
1572 /*
1573  * dp_monitor_get_mpdu_status() - get mpdu status
1574  * @pdev: point to dp pdev
1575  * @soc: point to dp soc
1576  * @rx_tlv_hdr: point to rx tlv header
1577  *
1578  */
1579 static inline void dp_monitor_get_mpdu_status(struct dp_pdev *pdev,
1580 					      struct dp_soc *soc,
1581 					      uint8_t *rx_tlv_hdr)
1582 {
1583 	struct dp_mon_pdev *mon_pdev;
1584 
1585 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
1586 		return;
1587 
1588 	mon_pdev = pdev->monitor_pdev;
1589 	hal_rx_mon_hw_desc_get_mpdu_status(soc->hal_soc, rx_tlv_hdr,
1590 					   &mon_pdev->ppdu_info.rx_status);
1591 }
1592 
1593 #ifdef FEATURE_NAC_RSSI
1594 /*
1595  * dp_monitor_drop_inv_peer_pkts() - drop invalid peer pkts
1596  * @vdev: point to dp vdev
1597  *
1598  * Return: success if sta mode and filter for neighbour peers enabled
1599  */
1600 static inline QDF_STATUS dp_monitor_drop_inv_peer_pkts(struct dp_vdev *vdev)
1601 {
1602 	struct dp_pdev *pdev = vdev->pdev;
1603 	struct dp_soc *soc = pdev->soc;
1604 
1605 	if (!soc->monitor_soc)
1606 		return QDF_STATUS_E_FAILURE;
1607 
1608 	if (!soc->monitor_soc->hw_nac_monitor_support &&
1609 	    pdev->monitor_pdev->filter_neighbour_peers &&
1610 	    vdev->opmode == wlan_op_mode_sta)
1611 		return QDF_STATUS_SUCCESS;
1612 
1613 	return QDF_STATUS_E_FAILURE;
1614 }
1615 #endif
1616 
1617 /*
1618  * dp_peer_ppdu_delayed_ba_init() - Initialize ppdu in peer
1619  * @peer: Datapath peer
1620  *
1621  * return: void
1622  */
1623 #ifdef FEATURE_PERPKT_INFO
1624 static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer)
1625 {
1626 	struct dp_mon_peer *mon_peer = peer->monitor_peer;
1627 
1628 	if (!mon_peer)
1629 		return;
1630 
1631 	qdf_mem_zero(&mon_peer->delayed_ba_ppdu_stats,
1632 		     sizeof(struct cdp_delayed_tx_completion_ppdu_user));
1633 	mon_peer->last_delayed_ba = false;
1634 	mon_peer->last_delayed_ba_ppduid = 0;
1635 }
1636 #else
1637 static inline void dp_peer_ppdu_delayed_ba_init(struct dp_peer *peer)
1638 {
1639 }
1640 #endif
1641 
1642 /*
1643  * dp_monitor_vdev_register_osif() - Register osif rx mon
1644  * @vdev: point to vdev
1645  * @txrx_ops: point to ol txrx ops
1646  *
1647  * Return: void
1648  */
1649 static inline void dp_monitor_vdev_register_osif(struct dp_vdev *vdev,
1650 						 struct ol_txrx_ops *txrx_ops)
1651 {
1652 	if (!vdev->monitor_vdev)
1653 		return;
1654 
1655 	vdev->monitor_vdev->osif_rx_mon = txrx_ops->rx.mon;
1656 }
1657 
1658 /*
1659  * dp_monitor_get_monitor_vdev_from_pdev() - Get monitor vdev
1660  * @pdev: point to pdev
1661  *
1662  * Return: pointer to vdev
1663  */
1664 static inline struct dp_vdev*
1665 dp_monitor_get_monitor_vdev_from_pdev(struct dp_pdev *pdev)
1666 {
1667 	if (!pdev || !pdev->monitor_pdev || !pdev->monitor_pdev->mvdev)
1668 		return NULL;
1669 
1670 	return pdev->monitor_pdev->mvdev;
1671 }
1672 
1673 /*
1674  * dp_monitor_is_vdev_timer_running() - Get vdev timer status
1675  * @soc: point to soc
1676  *
1677  * Return: true if timer running
1678  */
1679 static inline bool dp_monitor_is_vdev_timer_running(struct dp_soc *soc)
1680 {
1681 	if (qdf_unlikely(!soc || !soc->monitor_soc))
1682 		return false;
1683 
1684 	return !!(soc->monitor_soc->mon_vdev_timer_state &
1685 		  MON_VDEV_TIMER_RUNNING);
1686 }
1687 
1688 /*
1689  * dp_monitor_get_link_desc_pages() - Get link desc pages
1690  * @soc: point to soc
1691  * @mac_id: mac id
1692  *
1693  * Return: return point to link desc pages
1694  */
1695 static inline struct qdf_mem_multi_page_t*
1696 dp_monitor_get_link_desc_pages(struct dp_soc *soc, uint32_t mac_id)
1697 {
1698 	if (qdf_unlikely(!soc || !soc->monitor_soc))
1699 		return NULL;
1700 
1701 	return &soc->monitor_soc->mon_link_desc_pages[mac_id];
1702 }
1703 
1704 /*
1705  * dp_monitor_get_total_link_descs() - Get total link descs
1706  * @soc: point to soc
1707  * @mac_id: mac id
1708  *
1709  * Return: return point total link descs
1710  */
1711 static inline uint32_t *
1712 dp_monitor_get_total_link_descs(struct dp_soc *soc, uint32_t mac_id)
1713 {
1714 	return &soc->monitor_soc->total_mon_link_descs[mac_id];
1715 }
1716 
1717 /*
1718  * dp_monitor_pdev_attach() - Monitor pdev attach
1719  * @pdev: point to pdev
1720  *
1721  * Return: return QDF_STATUS
1722  */
1723 static inline QDF_STATUS dp_monitor_pdev_attach(struct dp_pdev *pdev)
1724 {
1725 	struct dp_mon_ops *monitor_ops;
1726 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
1727 
1728 	/*
1729 	 * mon_soc uninitialized modular support enabled
1730 	 * monitor related attach/detach/init/deinit
1731 	 * will be done while monitor insmod
1732 	 */
1733 	if (!mon_soc)
1734 		return QDF_STATUS_SUCCESS;
1735 
1736 	monitor_ops = mon_soc->mon_ops;
1737 	if (!monitor_ops || !monitor_ops->mon_pdev_attach) {
1738 		dp_mon_debug("callback not registered");
1739 		return QDF_STATUS_E_FAILURE;
1740 	}
1741 
1742 	return monitor_ops->mon_pdev_attach(pdev);
1743 }
1744 
1745 /*
1746  * dp_monitor_pdev_detach() - Monitor pdev detach
1747  * @pdev: point to pdev
1748  *
1749  * Return: return QDF_STATUS
1750  */
1751 static inline QDF_STATUS dp_monitor_pdev_detach(struct dp_pdev *pdev)
1752 {
1753 	struct dp_mon_ops *monitor_ops;
1754 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
1755 
1756 	/*
1757 	 * mon_soc uninitialized modular support enabled
1758 	 * monitor related attach/detach/init/deinit
1759 	 * will be done while monitor insmod
1760 	 */
1761 	if (!mon_soc)
1762 		return QDF_STATUS_SUCCESS;
1763 
1764 	monitor_ops = mon_soc->mon_ops;
1765 	if (!monitor_ops || !monitor_ops->mon_pdev_detach) {
1766 		dp_mon_debug("callback not registered");
1767 		return QDF_STATUS_E_FAILURE;
1768 	}
1769 
1770 	return monitor_ops->mon_pdev_detach(pdev);
1771 }
1772 
1773 /*
1774  * dp_monitor_vdev_attach() - Monitor vdev attach
1775  * @vdev: point to vdev
1776  *
1777  * Return: return QDF_STATUS
1778  */
1779 static inline QDF_STATUS dp_monitor_vdev_attach(struct dp_vdev *vdev)
1780 {
1781 	struct dp_mon_ops *monitor_ops;
1782 	struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
1783 
1784 	if (!mon_soc)
1785 		return QDF_STATUS_E_FAILURE;
1786 
1787 	monitor_ops = mon_soc->mon_ops;
1788 	if (!monitor_ops || !monitor_ops->mon_vdev_attach) {
1789 		dp_mon_debug("callback not registered");
1790 		return QDF_STATUS_E_FAILURE;
1791 	}
1792 
1793 	return monitor_ops->mon_vdev_attach(vdev);
1794 }
1795 
1796 /*
1797  * dp_monitor_vdev_detach() - Monitor vdev detach
1798  * @vdev: point to vdev
1799  *
1800  * Return: return QDF_STATUS
1801  */
1802 static inline QDF_STATUS dp_monitor_vdev_detach(struct dp_vdev *vdev)
1803 {
1804 	struct dp_mon_ops *monitor_ops;
1805 	struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
1806 
1807 	if (!mon_soc)
1808 		return QDF_STATUS_E_FAILURE;
1809 
1810 	monitor_ops = mon_soc->mon_ops;
1811 	if (!monitor_ops || !monitor_ops->mon_vdev_detach) {
1812 		dp_mon_debug("callback not registered");
1813 		return QDF_STATUS_E_FAILURE;
1814 	}
1815 
1816 	return monitor_ops->mon_vdev_detach(vdev);
1817 }
1818 
1819 /*
1820  * dp_monitor_peer_attach() - Monitor peer attach
1821  * @soc: point to soc
1822  * @peer: point to peer
1823  *
1824  * Return: return QDF_STATUS
1825  */
1826 static inline QDF_STATUS dp_monitor_peer_attach(struct dp_soc *soc,
1827 						struct dp_peer *peer)
1828 {
1829 	struct dp_mon_ops *monitor_ops;
1830 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
1831 
1832 	if (!mon_soc)
1833 		return QDF_STATUS_E_FAILURE;
1834 
1835 	monitor_ops = mon_soc->mon_ops;
1836 	if (!monitor_ops || !monitor_ops->mon_peer_attach) {
1837 		dp_mon_debug("callback not registered");
1838 		return QDF_STATUS_E_FAILURE;
1839 	}
1840 
1841 	return monitor_ops->mon_peer_attach(peer);
1842 }
1843 
1844 /*
1845  * dp_monitor_peer_detach() - Monitor peer detach
1846  * @soc: point to soc
1847  * @peer: point to peer
1848  *
1849  * Return: return QDF_STATUS
1850  */
1851 static inline QDF_STATUS dp_monitor_peer_detach(struct dp_soc *soc,
1852 						struct dp_peer *peer)
1853 {
1854 	struct dp_mon_ops *monitor_ops;
1855 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
1856 
1857 	if (!mon_soc)
1858 		return QDF_STATUS_E_FAILURE;
1859 
1860 	monitor_ops = mon_soc->mon_ops;
1861 	if (!monitor_ops || !monitor_ops->mon_peer_detach) {
1862 		dp_mon_debug("callback not registered");
1863 		return QDF_STATUS_E_FAILURE;
1864 	}
1865 
1866 	return monitor_ops->mon_peer_detach(peer);
1867 }
1868 
1869 /*
1870  * dp_monitor_peer_get_peerstats_ctx() - Get peerstats context from monitor peer
1871  * @soc: Datapath soc handle
1872  * @peer: Datapath peer handle
1873  *
1874  * Return: peer stats context
1875  */
1876 static inline struct cdp_peer_rate_stats_ctx*
1877 dp_monitor_peer_get_peerstats_ctx(struct dp_soc *soc, struct dp_peer *peer)
1878 {
1879 	struct dp_mon_ops *monitor_ops;
1880 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
1881 
1882 	if (!mon_soc)
1883 		return NULL;
1884 
1885 	monitor_ops = mon_soc->mon_ops;
1886 	if (!monitor_ops || !monitor_ops->mon_peer_get_peerstats_ctx) {
1887 		dp_mon_debug("callback not registered");
1888 		return NULL;
1889 	}
1890 
1891 	return monitor_ops->mon_peer_get_peerstats_ctx(peer);
1892 }
1893 
1894 /*
1895  * dp_monitor_peer_reset_stats() - Reset monitor peer stats
1896  * @soc: Datapath soc handle
1897  * @peer: Datapath peer handle
1898  *
1899  * Return: none
1900  */
1901 static inline void dp_monitor_peer_reset_stats(struct dp_soc *soc,
1902 					       struct dp_peer *peer)
1903 {
1904 	struct dp_mon_ops *monitor_ops;
1905 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
1906 
1907 	if (!mon_soc)
1908 		return;
1909 
1910 	monitor_ops = mon_soc->mon_ops;
1911 	if (!monitor_ops || !monitor_ops->mon_peer_reset_stats) {
1912 		dp_mon_debug("callback not registered");
1913 		return;
1914 	}
1915 
1916 	monitor_ops->mon_peer_reset_stats(peer);
1917 }
1918 
1919 /*
1920  * dp_monitor_peer_get_stats() - Get monitor peer stats
1921  * @soc: Datapath soc handle
1922  * @peer: Datapath peer handle
1923  * @arg: Pointer to stats struct
1924  * @type: Update type
1925  *
1926  * Return: none
1927  */
1928 static inline
1929 void dp_monitor_peer_get_stats(struct dp_soc *soc, struct dp_peer *peer,
1930 			       void *arg, enum cdp_stat_update_type type)
1931 {
1932 	struct dp_mon_ops *monitor_ops;
1933 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
1934 
1935 	if (!mon_soc)
1936 		return;
1937 
1938 	monitor_ops = mon_soc->mon_ops;
1939 	if (!monitor_ops || !monitor_ops->mon_peer_get_stats) {
1940 		dp_mon_debug("callback not registered");
1941 		return;
1942 	}
1943 
1944 	monitor_ops->mon_peer_get_stats(peer, arg, type);
1945 }
1946 
1947 /*
1948  * dp_monitor_invalid_peer_update_pdev_stats() - Update pdev stats from
1949  *						invalid monitor peer
1950  * @soc: Datapath soc handle
1951  * @pdev: Datapath pdev handle
1952  *
1953  * Return: none
1954  */
1955 static inline
1956 void dp_monitor_invalid_peer_update_pdev_stats(struct dp_soc *soc,
1957 					       struct dp_pdev *pdev)
1958 {
1959 	struct dp_mon_ops *monitor_ops;
1960 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
1961 
1962 	if (!mon_soc)
1963 		return;
1964 
1965 	monitor_ops = mon_soc->mon_ops;
1966 	if (!monitor_ops || !monitor_ops->mon_invalid_peer_update_pdev_stats) {
1967 		dp_mon_debug("callback not registered");
1968 		return;
1969 	}
1970 
1971 	monitor_ops->mon_invalid_peer_update_pdev_stats(pdev);
1972 }
1973 
1974 /*
1975  * dp_monitor_peer_get_stats_param() - Get stats param value from monitor peer
1976  * @soc: Datapath soc handle
1977  * @peer: Datapath peer handle
1978  * @type: Stats type requested
1979  * @buf: Pointer to buffer for stats param
1980  *
1981  * Return: QDF_STATUS
1982  */
1983 static inline QDF_STATUS
1984 dp_monitor_peer_get_stats_param(struct dp_soc *soc, struct dp_peer *peer,
1985 				enum cdp_peer_stats_type type,
1986 				cdp_peer_stats_param_t *buf)
1987 {
1988 	struct dp_mon_ops *monitor_ops;
1989 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
1990 
1991 	if (!mon_soc)
1992 		return QDF_STATUS_E_FAILURE;
1993 
1994 	monitor_ops = mon_soc->mon_ops;
1995 	if (!monitor_ops || !monitor_ops->mon_peer_get_stats_param) {
1996 		dp_mon_debug("callback not registered");
1997 		return QDF_STATUS_E_FAILURE;
1998 	}
1999 
2000 	return monitor_ops->mon_peer_get_stats_param(peer, type, buf);
2001 }
2002 
2003 /*
2004  * dp_monitor_pdev_init() - Monitor pdev init
2005  * @pdev: point to pdev
2006  *
2007  * Return: return QDF_STATUS
2008  */
2009 static inline QDF_STATUS dp_monitor_pdev_init(struct dp_pdev *pdev)
2010 {
2011 	struct dp_mon_ops *monitor_ops;
2012 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2013 
2014 	/*
2015 	 * mon_soc uninitialized when modular support enabled
2016 	 * monitor related attach/detach/init/deinit
2017 	 * will be done while monitor insmod
2018 	 */
2019 	if (!mon_soc)
2020 		return QDF_STATUS_SUCCESS;
2021 
2022 	monitor_ops = mon_soc->mon_ops;
2023 	if (!monitor_ops || !monitor_ops->mon_pdev_init) {
2024 		dp_mon_debug("callback not registered");
2025 		return QDF_STATUS_E_FAILURE;
2026 	}
2027 
2028 	return monitor_ops->mon_pdev_init(pdev);
2029 }
2030 
2031 /*
2032  * dp_monitor_pdev_deinit() - Monitor pdev deinit
2033  * @pdev: point to pdev
2034  *
2035  * Return: return QDF_STATUS
2036  */
2037 static inline QDF_STATUS dp_monitor_pdev_deinit(struct dp_pdev *pdev)
2038 {
2039 	struct dp_mon_ops *monitor_ops;
2040 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2041 
2042 	/*
2043 	 * mon_soc uninitialized modular when support enabled
2044 	 * monitor related attach/detach/init/deinit
2045 	 * will be done while monitor insmod
2046 	 */
2047 	if (!mon_soc)
2048 		return QDF_STATUS_SUCCESS;
2049 
2050 	monitor_ops = mon_soc->mon_ops;
2051 	if (!monitor_ops || !monitor_ops->mon_pdev_deinit) {
2052 		dp_mon_debug("callback not registered");
2053 		return QDF_STATUS_E_FAILURE;
2054 	}
2055 
2056 	return monitor_ops->mon_pdev_deinit(pdev);
2057 }
2058 
2059 /*
2060  * dp_monitor_soc_cfg_init() - Monitor sco cfg init
2061  * @soc: point to soc
2062  *
2063  * Return: return QDF_STATUS
2064  */
2065 static inline QDF_STATUS dp_monitor_soc_cfg_init(struct dp_soc *soc)
2066 {
2067 	struct dp_mon_ops *monitor_ops;
2068 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2069 
2070 	/*
2071 	 * this API is getting call from dp_soc_init,
2072 	 * mon_soc will be uninitialized when monitor support enabled
2073 	 * So returning QDF_STATUS_SUCCESS.
2074 	 * soc cfg init will be done while monitor insmod.
2075 	 */
2076 	if (!mon_soc)
2077 		return QDF_STATUS_SUCCESS;
2078 
2079 	monitor_ops = mon_soc->mon_ops;
2080 	if (!monitor_ops || !monitor_ops->mon_soc_cfg_init) {
2081 		dp_mon_debug("callback not registered");
2082 		return QDF_STATUS_E_FAILURE;
2083 	}
2084 
2085 	return monitor_ops->mon_soc_cfg_init(soc);
2086 }
2087 
2088 /*
2089  * dp_monitor_config_debug_sniffer() - Monitor config debug sniffer
2090  * @pdev: point to pdev
2091  * @val: val
2092  *
2093  * Return: return QDF_STATUS
2094  */
2095 static inline QDF_STATUS dp_monitor_config_debug_sniffer(struct dp_pdev *pdev,
2096 							 int val)
2097 {
2098 	struct dp_mon_ops *monitor_ops;
2099 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2100 
2101 	if (!mon_soc)
2102 		return QDF_STATUS_E_FAILURE;
2103 
2104 	monitor_ops = mon_soc->mon_ops;
2105 	if (!monitor_ops || !monitor_ops->mon_config_debug_sniffer) {
2106 		dp_mon_debug("callback not registered");
2107 		return QDF_STATUS_E_FAILURE;
2108 	}
2109 
2110 	return monitor_ops->mon_config_debug_sniffer(pdev, val);
2111 }
2112 
2113 /*
2114  * dp_monitor_flush_rings() - Flush monitor rings
2115  * @soc: point to soc
2116  *
2117  * Return: None
2118  */
2119 static inline void dp_monitor_flush_rings(struct dp_soc *soc)
2120 {
2121 	struct dp_mon_ops *monitor_ops;
2122 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2123 
2124 	if (!mon_soc) {
2125 		dp_mon_debug("monitor soc is NULL");
2126 		return;
2127 	}
2128 
2129 	monitor_ops = mon_soc->mon_ops;
2130 	if (!monitor_ops || !monitor_ops->mon_flush_rings) {
2131 		dp_mon_debug("callback not registered");
2132 		return;
2133 	}
2134 
2135 	return monitor_ops->mon_flush_rings(soc);
2136 }
2137 
2138 /*
2139  * dp_monitor_config_undecoded_metadata_capture() - Monitor config
2140  * undecoded metatdata capture
2141  * @pdev: point to pdev
2142  * @val: val
2143  *
2144  * Return: return QDF_STATUS
2145  */
2146 #ifdef QCA_UNDECODED_METADATA_SUPPORT
2147 static inline
2148 QDF_STATUS dp_monitor_config_undecoded_metadata_capture(struct dp_pdev *pdev,
2149 							int val)
2150 {
2151 	struct dp_mon_ops *monitor_ops;
2152 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2153 
2154 	if (!mon_soc)
2155 		return QDF_STATUS_E_FAILURE;
2156 
2157 	monitor_ops = mon_soc->mon_ops;
2158 	if (!monitor_ops ||
2159 	    !monitor_ops->mon_config_undecoded_metadata_capture) {
2160 		dp_mon_debug("callback not registered");
2161 		return QDF_STATUS_E_FAILURE;
2162 	}
2163 
2164 	return monitor_ops->mon_config_undecoded_metadata_capture(pdev, val);
2165 }
2166 
2167 static inline QDF_STATUS
2168 dp_monitor_config_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev,
2169 						      int mask, int mask_cont)
2170 {
2171 	struct dp_mon_ops *monitor_ops;
2172 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
2173 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2174 
2175 	if (!mon_soc)
2176 		return QDF_STATUS_E_FAILURE;
2177 
2178 	if (!mon_pdev)
2179 		return QDF_STATUS_E_FAILURE;
2180 
2181 	monitor_ops = mon_soc->mon_ops;
2182 	if (!monitor_ops ||
2183 	    !monitor_ops->mon_config_undecoded_metadata_capture) {
2184 		dp_mon_debug("callback not registered");
2185 		return QDF_STATUS_E_FAILURE;
2186 	}
2187 
2188 	if (!mon_pdev->undecoded_metadata_capture) {
2189 		qdf_info("mask:0x%x mask_cont:0x%x", mask, mask_cont);
2190 		return QDF_STATUS_SUCCESS;
2191 	}
2192 
2193 	mon_pdev->phyrx_error_mask = mask;
2194 	mon_pdev->phyrx_error_mask_cont = mask_cont;
2195 
2196 	return monitor_ops->mon_config_undecoded_metadata_capture(pdev, 1);
2197 }
2198 
2199 static inline QDF_STATUS
2200 dp_monitor_get_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev,
2201 						   int *mask, int *mask_cont)
2202 {
2203 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
2204 
2205 	if (!mon_pdev)
2206 		return QDF_STATUS_E_FAILURE;
2207 
2208 	*mask = mon_pdev->phyrx_error_mask;
2209 	*mask_cont = mon_pdev->phyrx_error_mask_cont;
2210 
2211 	return QDF_STATUS_SUCCESS;
2212 }
2213 #else
2214 static inline
2215 QDF_STATUS dp_monitor_config_undecoded_metadata_capture(struct dp_pdev *pdev,
2216 							int val)
2217 {
2218 	return QDF_STATUS_SUCCESS;
2219 }
2220 
2221 static inline QDF_STATUS
2222 dp_monitor_config_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev,
2223 						      int mask1, int mask2)
2224 {
2225 	return QDF_STATUS_SUCCESS;
2226 }
2227 
2228 static inline QDF_STATUS
2229 dp_monitor_get_undecoded_metadata_phyrx_error_mask(struct dp_pdev *pdev,
2230 						   int *mask, int *mask_cont)
2231 {
2232 	return QDF_STATUS_SUCCESS;
2233 }
2234 #endif /* QCA_UNDECODED_METADATA_SUPPORT */
2235 
2236 /*
2237  * dp_monitor_htt_srng_setup() - Setup htt srng
2238  * @soc: point to soc
2239  * @pdev: point to pdev
2240  * @mac_id: lmac id
2241  * @mac for pdev: pdev id
2242  *
2243  * Return: QDF_STATUS
2244  */
2245 #if !defined(DISABLE_MON_CONFIG)
2246 static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc,
2247 						   struct dp_pdev *pdev,
2248 						   int mac_id,
2249 						   int mac_for_pdev)
2250 {
2251 	struct dp_mon_ops *monitor_ops;
2252 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2253 
2254 	if (!mon_soc) {
2255 		dp_mon_debug("monitor soc is NULL");
2256 		return QDF_STATUS_SUCCESS;
2257 	}
2258 
2259 	monitor_ops = mon_soc->mon_ops;
2260 	if (!monitor_ops || !monitor_ops->mon_pdev_htt_srng_setup) {
2261 		dp_mon_debug("callback not registered");
2262 		return QDF_STATUS_E_FAILURE;
2263 	}
2264 
2265 	return monitor_ops->mon_pdev_htt_srng_setup(soc, pdev, mac_id,
2266 						    mac_for_pdev);
2267 }
2268 
2269 static inline QDF_STATUS dp_monitor_soc_htt_srng_setup(struct dp_soc *soc)
2270 {
2271 	struct dp_mon_ops *monitor_ops;
2272 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2273 
2274 	if (!mon_soc) {
2275 		dp_mon_debug("monitor soc is NULL");
2276 		return QDF_STATUS_SUCCESS;
2277 	}
2278 
2279 	monitor_ops = mon_soc->mon_ops;
2280 	if (!monitor_ops || !monitor_ops->mon_soc_htt_srng_setup) {
2281 		dp_mon_debug("callback not registered");
2282 		return QDF_STATUS_E_FAILURE;
2283 	}
2284 
2285 	return monitor_ops->mon_soc_htt_srng_setup(soc);
2286 }
2287 #else
2288 static inline QDF_STATUS dp_monitor_htt_srng_setup(struct dp_soc *soc,
2289 						   struct dp_pdev *pdev,
2290 						   int mac_id,
2291 						   int mac_for_pdev)
2292 {
2293 	return QDF_STATUS_SUCCESS;
2294 }
2295 #endif
2296 
2297 /*
2298  * dp_monitor_service_mon_rings() - service monitor rings
2299  * @soc: point to soc
2300  * @quota: reap budget
2301  *
2302  * Return: None
2303  */
2304 #if defined(DP_CON_MON)
2305 static inline
2306 void dp_monitor_service_mon_rings(struct dp_soc *soc, uint32_t quota)
2307 {
2308 	struct dp_mon_ops *monitor_ops;
2309 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2310 
2311 	if (!mon_soc) {
2312 		dp_mon_debug("monitor soc is NULL");
2313 		return;
2314 	}
2315 
2316 	monitor_ops = mon_soc->mon_ops;
2317 	if (!monitor_ops || !monitor_ops->mon_service_rings) {
2318 		dp_mon_debug("callback not registered");
2319 		return;
2320 	}
2321 
2322 	return monitor_ops->mon_service_rings(soc, quota);
2323 }
2324 #endif
2325 
2326 /*
2327  * dp_rx_monitor_process() - Process monitor
2328  * @soc: point to soc
2329  * @int_ctx: interrupt ctx
2330  * @mac_id: lma
2331  * @quota:
2332  *
2333  * Return: None
2334  */
2335 #ifndef DISABLE_MON_CONFIG
2336 static inline
2337 uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx,
2338 			       uint32_t mac_id, uint32_t quota)
2339 {
2340 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2341 
2342 	if (!mon_soc) {
2343 		dp_mon_debug("monitor soc is NULL");
2344 		return 0;
2345 	}
2346 
2347 	if (!mon_soc->mon_rx_process) {
2348 		dp_mon_debug("callback not registered");
2349 		return 0;
2350 	}
2351 
2352 	return mon_soc->mon_rx_process(soc, int_ctx, mac_id, quota);
2353 }
2354 
2355 static inline
2356 uint32_t dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
2357 			   uint32_t mac_id, uint32_t quota)
2358 {
2359 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2360 	struct dp_mon_ops *monitor_ops;
2361 
2362 	if (!mon_soc) {
2363 		dp_mon_debug("monitor soc is NULL");
2364 		return 0;
2365 	}
2366 
2367 	monitor_ops = mon_soc->mon_ops;
2368 	if (!monitor_ops || !monitor_ops->mon_tx_process) {
2369 		dp_mon_debug("callback not registered");
2370 		return 0;
2371 	}
2372 
2373 	return monitor_ops->mon_tx_process(soc, int_ctx, mac_id, quota);
2374 }
2375 
2376 static inline
2377 uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx)
2378 {
2379 	struct dp_soc *soc = int_ctx->soc;
2380 	struct dp_mon_ops *monitor_ops;
2381 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2382 
2383 	if (!mon_soc) {
2384 		dp_mon_debug("monitor soc is NULL");
2385 		return 0;
2386 	}
2387 
2388 	monitor_ops = mon_soc->mon_ops;
2389 	if (!monitor_ops || !monitor_ops->tx_mon_refill_buf_ring) {
2390 		dp_mon_debug("callback not registered");
2391 		return 0;
2392 	}
2393 
2394 	return monitor_ops->tx_mon_refill_buf_ring(int_ctx);
2395 }
2396 
2397 static inline
2398 uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx)
2399 {
2400 	struct dp_soc *soc = int_ctx->soc;
2401 	struct dp_mon_ops *monitor_ops;
2402 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2403 
2404 	if (!mon_soc) {
2405 		dp_mon_debug("monitor soc is NULL");
2406 		return 0;
2407 	}
2408 
2409 	monitor_ops = mon_soc->mon_ops;
2410 	if (!monitor_ops || !monitor_ops->rx_mon_refill_buf_ring) {
2411 		dp_mon_debug("callback not registered");
2412 		return 0;
2413 	}
2414 
2415 	return monitor_ops->rx_mon_refill_buf_ring(int_ctx);
2416 }
2417 #else
2418 static inline
2419 uint32_t dp_monitor_process(struct dp_soc *soc, struct dp_intr *int_ctx,
2420 			       uint32_t mac_id, uint32_t quota)
2421 {
2422 	return 0;
2423 }
2424 
2425 static inline uint32_t
2426 dp_tx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
2427 		  uint32_t mac_id, uint32_t quota)
2428 {
2429 	return 0;
2430 }
2431 
2432 static inline
2433 uint32_t dp_tx_mon_buf_refill(struct dp_intr *int_ctx)
2434 {
2435 	return 0;
2436 }
2437 
2438 static inline
2439 uint32_t dp_rx_mon_buf_refill(struct dp_intr *int_ctx)
2440 {
2441 	return 0;
2442 }
2443 #endif
2444 
2445 /*
2446  * dp_monitor_drop_packets_for_mac() - monitor_drop_packets_for_mac
2447  * @pdev: point to pdev
2448  * @mac_id:
2449  * @quota:
2450  *
2451  * Return:
2452  */
2453 #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
2454 static inline
2455 uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev,
2456 					 uint32_t mac_id, uint32_t quota)
2457 {
2458 	struct dp_mon_ops *monitor_ops;
2459 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2460 
2461 	if (!mon_soc) {
2462 		dp_mon_debug("monitor soc is NULL");
2463 		return 0;
2464 	}
2465 
2466 	monitor_ops = mon_soc->mon_ops;
2467 	if (!monitor_ops || !monitor_ops->mon_drop_packets_for_mac) {
2468 		dp_mon_debug("callback not registered");
2469 		return 0;
2470 	}
2471 
2472 	return monitor_ops->mon_drop_packets_for_mac(pdev,
2473 						     mac_id, quota);
2474 }
2475 #else
2476 static inline
2477 uint32_t dp_monitor_drop_packets_for_mac(struct dp_pdev *pdev,
2478 					 uint32_t mac_id, uint32_t quota)
2479 {
2480 	return 0;
2481 }
2482 #endif
2483 
2484 /*
2485  * dp_monitor_peer_tx_init() - peer tx init
2486  * @pdev: point to pdev
2487  * @peer: point to peer
2488  *
2489  * Return: None
2490  */
2491 static inline void dp_monitor_peer_tx_init(struct dp_pdev *pdev,
2492 					   struct dp_peer *peer)
2493 {
2494 	struct dp_mon_ops *monitor_ops;
2495 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2496 
2497 	if (!mon_soc) {
2498 		dp_mon_debug("monitor soc is NULL");
2499 		return;
2500 	}
2501 
2502 	monitor_ops = mon_soc->mon_ops;
2503 	if (!monitor_ops || !monitor_ops->mon_peer_tx_init) {
2504 		dp_mon_debug("callback not registered");
2505 		return;
2506 	}
2507 
2508 	return monitor_ops->mon_peer_tx_init(pdev, peer);
2509 }
2510 
2511 /*
2512  * dp_monitor_peer_tx_cleanup() - peer tx cleanup
2513  * @vdev: point to vdev
2514  * @peer: point to peer
2515  *
2516  * Return: None
2517  */
2518 static inline void dp_monitor_peer_tx_cleanup(struct dp_vdev *vdev,
2519 					      struct dp_peer *peer)
2520 {
2521 	struct dp_mon_ops *monitor_ops;
2522 	struct dp_mon_soc *mon_soc = vdev->pdev->soc->monitor_soc;
2523 
2524 	if (!mon_soc) {
2525 		dp_mon_debug("monitor soc is NULL");
2526 		return;
2527 	}
2528 
2529 	monitor_ops = mon_soc->mon_ops;
2530 	if (!monitor_ops || !monitor_ops->mon_peer_tx_cleanup) {
2531 		dp_mon_debug("callback not registered");
2532 		return;
2533 	}
2534 
2535 	return monitor_ops->mon_peer_tx_cleanup(vdev, peer);
2536 }
2537 
2538 #ifdef WIFI_MONITOR_SUPPORT
2539 /**
2540  * dp_monitor_peer_tid_peer_id_update() - peer tid update
2541  * @soc: point to soc
2542  * @peer: point to peer
2543  * @peer_id: peer id
2544  *
2545  * Return: None
2546  */
2547 static inline
2548 void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
2549 					struct dp_peer *peer,
2550 					uint16_t peer_id)
2551 {
2552 	struct dp_mon_ops *monitor_ops;
2553 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2554 
2555 	if (!mon_soc) {
2556 		dp_mon_debug("monitor soc is NULL");
2557 		return;
2558 	}
2559 
2560 	monitor_ops = mon_soc->mon_ops;
2561 	if (!monitor_ops || !monitor_ops->mon_peer_tid_peer_id_update) {
2562 		dp_mon_debug("callback not registered");
2563 		return;
2564 	}
2565 
2566 	return monitor_ops->mon_peer_tid_peer_id_update(peer, peer_id);
2567 }
2568 
2569 /*
2570  * dp_monitor_tx_ppdu_stats_attach() - Attach tx ppdu stats
2571  * @pdev: point to pdev
2572  *
2573  * Return: None
2574  */
2575 static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev)
2576 {
2577 	struct dp_mon_ops *monitor_ops;
2578 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2579 
2580 	if (!mon_soc) {
2581 		dp_mon_debug("monitor soc is NULL");
2582 		return;
2583 	}
2584 
2585 	monitor_ops = mon_soc->mon_ops;
2586 	if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_attach) {
2587 		dp_mon_debug("callback not registered");
2588 		return;
2589 	}
2590 
2591 	return monitor_ops->mon_tx_ppdu_stats_attach(pdev);
2592 }
2593 
2594 /*
2595  * dp_monitor_tx_ppdu_stats_detach() - Detach tx ppdu stats
2596  * @pdev: point to pdev
2597  *
2598  * Return: None
2599  */
2600 static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev)
2601 {
2602 	struct dp_mon_ops *monitor_ops;
2603 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2604 
2605 	if (!mon_soc) {
2606 		dp_mon_debug("monitor soc is NULL");
2607 		return;
2608 	}
2609 
2610 	monitor_ops = mon_soc->mon_ops;
2611 	if (!monitor_ops || !monitor_ops->mon_tx_ppdu_stats_detach) {
2612 		dp_mon_debug("callback not registered");
2613 		return;
2614 	}
2615 
2616 	return monitor_ops->mon_tx_ppdu_stats_detach(pdev);
2617 }
2618 
2619 /*
2620  * dp_monitor_tx_capture_debugfs_init() - Init tx capture debugfs
2621  * @pdev: point to pdev
2622  *
2623  * Return: QDF_STATUS_SUCCESS
2624  */
2625 static inline
2626 QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev)
2627 {
2628 	struct dp_mon_ops *monitor_ops;
2629 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2630 
2631 	if (!mon_soc) {
2632 		dp_mon_debug("monitor soc is NULL");
2633 		return QDF_STATUS_E_FAILURE;
2634 	}
2635 
2636 	monitor_ops = mon_soc->mon_ops;
2637 	if (!monitor_ops || !monitor_ops->mon_tx_capture_debugfs_init) {
2638 		dp_mon_debug("callback not registered");
2639 		return QDF_STATUS_E_FAILURE;
2640 	}
2641 
2642 	return monitor_ops->mon_tx_capture_debugfs_init(pdev);
2643 }
2644 
2645 /*
2646  * dp_monitor_peer_tx_capture_filter_check() - Check tx capture filter
2647  * @pdev: point to pdev
2648  * @peer: point to peer
2649  *
2650  * Return: None
2651  */
2652 static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev,
2653 							   struct dp_peer *peer)
2654 {
2655 	struct dp_mon_ops *monitor_ops;
2656 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2657 
2658 	if (!mon_soc) {
2659 		dp_mon_debug("monitor soc is NULL");
2660 		return;
2661 	}
2662 
2663 	monitor_ops = mon_soc->mon_ops;
2664 	if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_filter_check) {
2665 		dp_mon_debug("callback not registered");
2666 		return;
2667 	}
2668 
2669 	return monitor_ops->mon_peer_tx_capture_filter_check(pdev, peer);
2670 }
2671 
2672 /*
2673  * dp_monitor_tx_add_to_comp_queue() - add completion msdu to queue
2674  *
2675  * This API returns QDF_STATUS_SUCCESS in case where buffer is added
2676  * to txmonitor queue successfuly caller will not free the buffer in
2677  * this case. In other cases this API return QDF_STATUS_E_FAILURE and
2678  * caller frees the buffer
2679  *
2680  * @soc: point to soc
2681  * @desc: point to tx desc
2682  * @ts: Tx completion status from HAL/HTT descriptor
2683  * @peer id: DP peer id
2684  *
2685  * Return: QDF_STATUS
2686  *
2687  */
2688 static inline
2689 QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc,
2690 					   struct dp_tx_desc_s *desc,
2691 					   struct hal_tx_completion_status *ts,
2692 					   uint16_t peer_id)
2693 {
2694 	struct dp_mon_ops *monitor_ops;
2695 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2696 
2697 	if (!mon_soc) {
2698 		dp_mon_debug("monitor soc is NULL");
2699 		return QDF_STATUS_E_FAILURE;
2700 	}
2701 
2702 	monitor_ops = mon_soc->mon_ops;
2703 	if (!monitor_ops || !monitor_ops->mon_tx_add_to_comp_queue) {
2704 		dp_mon_debug("callback not registered");
2705 		return QDF_STATUS_E_FAILURE;
2706 	}
2707 
2708 	return monitor_ops->mon_tx_add_to_comp_queue(soc, desc, ts, peer_id);
2709 }
2710 
2711 static inline
2712 QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
2713 				       struct dp_pdev *pdev,
2714 				       struct dp_peer *peer,
2715 				       struct hal_tx_completion_status *ts,
2716 				       qdf_nbuf_t netbuf)
2717 {
2718 	struct dp_mon_ops *monitor_ops;
2719 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2720 
2721 	if (!mon_soc) {
2722 		dp_mon_debug("monitor soc is NULL");
2723 		return QDF_STATUS_SUCCESS;
2724 	}
2725 
2726 	monitor_ops = mon_soc->mon_ops;
2727 	if (!monitor_ops || !monitor_ops->mon_update_msdu_to_list) {
2728 		dp_mon_debug("callback not registered");
2729 		return QDF_STATUS_E_FAILURE;
2730 	}
2731 
2732 	return monitor_ops->mon_update_msdu_to_list(soc, pdev,
2733 						    peer, ts, netbuf);
2734 }
2735 
2736 /*
2737  * dp_monitor_peer_tx_capture_get_stats - to get Peer Tx Capture stats
2738  * @soc: DP SOC handle
2739  * @peer: DP PEER handle
2740  * @stats: Pointer Peer tx capture stats
2741  *
2742  * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS
2743  */
2744 static inline QDF_STATUS
2745 dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
2746 				     struct cdp_peer_tx_capture_stats *stats)
2747 {
2748 	struct dp_mon_ops *monitor_ops;
2749 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2750 
2751 	if (!mon_soc) {
2752 		dp_mon_debug("monitor soc is NULL");
2753 		return QDF_STATUS_E_FAILURE;
2754 	}
2755 
2756 	monitor_ops = mon_soc->mon_ops;
2757 	if (!monitor_ops || !monitor_ops->mon_peer_tx_capture_get_stats) {
2758 		dp_mon_debug("callback not registered");
2759 		return QDF_STATUS_E_FAILURE;
2760 	}
2761 
2762 	return monitor_ops->mon_peer_tx_capture_get_stats(peer, stats);
2763 }
2764 
2765 /*
2766  * dp_monitor_pdev_tx_capture_get_stats - to get pdev tx capture stats
2767  * @soc: DP SOC handle
2768  * @pdev: DP PDEV handle
2769  * @stats: Pointer to pdev tx capture stats
2770  *
2771  * Return: QDF_STATUS_E_FAILURE or QDF_STATUS_SUCCESS
2772  */
2773 static inline QDF_STATUS
2774 dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
2775 				     struct cdp_pdev_tx_capture_stats *stats)
2776 {
2777 	struct dp_mon_ops *monitor_ops;
2778 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2779 
2780 	if (!mon_soc) {
2781 		dp_mon_debug("monitor soc is NULL");
2782 		return QDF_STATUS_E_FAILURE;
2783 	}
2784 
2785 	monitor_ops = mon_soc->mon_ops;
2786 	if (!monitor_ops || !monitor_ops->mon_pdev_tx_capture_get_stats) {
2787 		dp_mon_debug("callback not registered");
2788 		return QDF_STATUS_E_FAILURE;
2789 	}
2790 
2791 	return monitor_ops->mon_pdev_tx_capture_get_stats(pdev, stats);
2792 }
2793 #else
2794 static inline
2795 void dp_monitor_peer_tid_peer_id_update(struct dp_soc *soc,
2796 					struct dp_peer *peer,
2797 					uint16_t peer_id)
2798 {
2799 }
2800 
2801 static inline void dp_monitor_tx_ppdu_stats_attach(struct dp_pdev *pdev)
2802 {
2803 }
2804 
2805 static inline void dp_monitor_tx_ppdu_stats_detach(struct dp_pdev *pdev)
2806 {
2807 }
2808 
2809 static inline
2810 QDF_STATUS dp_monitor_tx_capture_debugfs_init(struct dp_pdev *pdev)
2811 {
2812 	return QDF_STATUS_E_FAILURE;
2813 }
2814 
2815 static inline void dp_monitor_peer_tx_capture_filter_check(struct dp_pdev *pdev,
2816 							   struct dp_peer *peer)
2817 {
2818 }
2819 
2820 static inline
2821 QDF_STATUS dp_monitor_tx_add_to_comp_queue(struct dp_soc *soc,
2822 					   struct dp_tx_desc_s *desc,
2823 					   struct hal_tx_completion_status *ts,
2824 					   uint16_t peer_id)
2825 {
2826 	return QDF_STATUS_E_FAILURE;
2827 }
2828 
2829 static inline
2830 QDF_STATUS monitor_update_msdu_to_list(struct dp_soc *soc,
2831 				       struct dp_pdev *pdev,
2832 				       struct dp_peer *peer,
2833 				       struct hal_tx_completion_status *ts,
2834 				       qdf_nbuf_t netbuf)
2835 {
2836 	return QDF_STATUS_E_FAILURE;
2837 }
2838 
2839 static inline QDF_STATUS
2840 dp_monitor_peer_tx_capture_get_stats(struct dp_soc *soc, struct dp_peer *peer,
2841 				     struct cdp_peer_tx_capture_stats *stats)
2842 {
2843 	return QDF_STATUS_E_FAILURE;
2844 }
2845 
2846 static inline QDF_STATUS
2847 dp_monitor_pdev_tx_capture_get_stats(struct dp_soc *soc, struct dp_pdev *pdev,
2848 				     struct cdp_pdev_tx_capture_stats *stats)
2849 {
2850 	return QDF_STATUS_E_FAILURE;
2851 }
2852 #endif
2853 
2854 /*
2855  * dp_monitor_ppdu_stats_ind_handler() - PPDU stats msg handler
2856  * @htt_soc:     HTT SOC handle
2857  * @msg_word:    Pointer to payload
2858  * @htt_t2h_msg: HTT msg nbuf
2859  *
2860  * Return: True if buffer should be freed by caller.
2861  */
2862 #if defined(WDI_EVENT_ENABLE) &&\
2863 	(defined(QCA_ENHANCED_STATS_SUPPORT) || !defined(REMOVE_PKT_LOG))
2864 static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc,
2865 						     uint32_t *msg_word,
2866 						     qdf_nbuf_t htt_t2h_msg)
2867 {
2868 	struct dp_mon_ops *monitor_ops;
2869 	struct dp_mon_soc *mon_soc = soc->dp_soc->monitor_soc;
2870 
2871 	if (!mon_soc) {
2872 		dp_mon_debug("monitor soc is NULL");
2873 		return true;
2874 	}
2875 
2876 	monitor_ops = mon_soc->mon_ops;
2877 	if (!monitor_ops || !monitor_ops->mon_ppdu_stats_ind_handler) {
2878 		dp_mon_debug("callback not registered");
2879 		return true;
2880 	}
2881 
2882 	return monitor_ops->mon_ppdu_stats_ind_handler(soc, msg_word,
2883 						       htt_t2h_msg);
2884 }
2885 #else
2886 static inline bool dp_monitor_ppdu_stats_ind_handler(struct htt_soc *soc,
2887 						     uint32_t *msg_word,
2888 						     qdf_nbuf_t htt_t2h_msg)
2889 {
2890 	return true;
2891 }
2892 #endif
2893 
2894 /*
2895  * dp_monitor_htt_ppdu_stats_attach() - attach resources for HTT PPDU
2896  * stats processing
2897  * @pdev: Datapath PDEV handle
2898  *
2899  * Return: QDF_STATUS
2900  */
2901 static inline QDF_STATUS dp_monitor_htt_ppdu_stats_attach(struct dp_pdev *pdev)
2902 {
2903 	struct dp_mon_ops *monitor_ops;
2904 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2905 
2906 	if (!mon_soc) {
2907 		dp_mon_debug("monitor soc is NULL");
2908 		return QDF_STATUS_SUCCESS;
2909 	}
2910 
2911 	monitor_ops = mon_soc->mon_ops;
2912 	if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_attach) {
2913 		dp_mon_debug("callback not registered");
2914 		return QDF_STATUS_E_FAILURE;
2915 	}
2916 
2917 	return monitor_ops->mon_htt_ppdu_stats_attach(pdev);
2918 }
2919 
2920 /*
2921  * dp_monitor_htt_ppdu_stats_detach() - detach stats resources
2922  * @pdev: Datapath PDEV handle
2923  *
2924  * Return: void
2925  */
2926 static inline void dp_monitor_htt_ppdu_stats_detach(struct dp_pdev *pdev)
2927 {
2928 	struct dp_mon_ops *monitor_ops;
2929 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2930 
2931 	if (!mon_soc) {
2932 		dp_mon_debug("monitor soc is NULL");
2933 		return;
2934 	}
2935 
2936 	monitor_ops = mon_soc->mon_ops;
2937 	if (!monitor_ops || !monitor_ops->mon_htt_ppdu_stats_detach) {
2938 		dp_mon_debug("callback not registered");
2939 		return;
2940 	}
2941 
2942 	return monitor_ops->mon_htt_ppdu_stats_detach(pdev);
2943 }
2944 
2945 /*
2946  * dp_monitor_print_pdev_rx_mon_stats() - print rx mon stats
2947  * @pdev: Datapath PDEV handle
2948  *
2949  * Return: void
2950  */
2951 static inline void dp_monitor_print_pdev_rx_mon_stats(struct dp_pdev *pdev)
2952 {
2953 	struct dp_mon_ops *monitor_ops;
2954 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2955 
2956 	if (!mon_soc) {
2957 		dp_mon_debug("monitor soc is NULL");
2958 		return;
2959 	}
2960 
2961 	monitor_ops = mon_soc->mon_ops;
2962 	if (!monitor_ops || !monitor_ops->mon_print_pdev_rx_mon_stats) {
2963 		dp_mon_debug("callback not registered");
2964 		return;
2965 	}
2966 
2967 	return monitor_ops->mon_print_pdev_rx_mon_stats(pdev);
2968 }
2969 
2970 #ifdef WIFI_MONITOR_SUPPORT
2971 /*
2972  * dp_monitor_print_pdev_tx_capture_stats() - print tx capture stats
2973  * @pdev: Datapath PDEV handle
2974  *
2975  * Return: void
2976  */
2977 static inline void dp_monitor_print_pdev_tx_capture_stats(struct dp_pdev *pdev)
2978 {
2979 	struct dp_mon_ops *monitor_ops;
2980 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
2981 
2982 	if (!mon_soc) {
2983 		dp_mon_debug("monitor soc is NULL");
2984 		return;
2985 	}
2986 
2987 	monitor_ops = mon_soc->mon_ops;
2988 	if (!monitor_ops || !monitor_ops->mon_print_pdev_tx_capture_stats) {
2989 		dp_mon_debug("callback not registered");
2990 		return;
2991 	}
2992 
2993 	return monitor_ops->mon_print_pdev_tx_capture_stats(pdev);
2994 }
2995 
2996 /**
2997  * dp_monitor_config_enh_tx_capture() - configure tx capture
2998  * @pdev: Datapath PDEV handle
2999  * @val: mode
3000  *
3001  * Return: status
3002  */
3003 static inline QDF_STATUS dp_monitor_config_enh_tx_capture(struct dp_pdev *pdev,
3004 							  uint32_t val)
3005 {
3006 	struct dp_mon_ops *monitor_ops;
3007 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3008 
3009 	if (!mon_soc) {
3010 		dp_mon_debug("monitor soc is NULL");
3011 		return QDF_STATUS_E_FAILURE;
3012 	}
3013 
3014 	monitor_ops = mon_soc->mon_ops;
3015 	if (!monitor_ops || !monitor_ops->mon_config_enh_tx_capture) {
3016 		dp_mon_debug("callback not registered");
3017 		return QDF_STATUS_E_FAILURE;
3018 	}
3019 
3020 	return monitor_ops->mon_config_enh_tx_capture(pdev, val);
3021 }
3022 
3023 /**
3024  * dp_monitor_tx_peer_filter() -  add tx monitor peer filter
3025  * @pdev: Datapath PDEV handle
3026  * @peer: Datapath PEER handle
3027  * @is_tx_pkt_cap_enable: flag for tx capture enable/disable
3028  * @peer_mac: peer mac address
3029  *
3030  * Return: status
3031  */
3032 static inline QDF_STATUS dp_monitor_tx_peer_filter(struct dp_pdev *pdev,
3033 						   struct dp_peer *peer,
3034 						   uint8_t is_tx_pkt_cap_enable,
3035 						   uint8_t *peer_mac)
3036 {
3037 	struct dp_mon_ops *monitor_ops;
3038 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3039 
3040 	if (!mon_soc) {
3041 		qdf_err("monitor soc is NULL");
3042 		return QDF_STATUS_E_FAILURE;
3043 	}
3044 
3045 	monitor_ops = mon_soc->mon_ops;
3046 	if (!monitor_ops || !monitor_ops->mon_tx_peer_filter) {
3047 		qdf_err("callback not registered");
3048 		return QDF_STATUS_E_FAILURE;
3049 	}
3050 
3051 	return monitor_ops->mon_tx_peer_filter(pdev, peer, is_tx_pkt_cap_enable,
3052 					       peer_mac);
3053 }
3054 #endif
3055 
3056 #ifdef WLAN_RX_PKT_CAPTURE_ENH
3057 static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev,
3058 							  uint32_t val)
3059 {
3060 	struct dp_mon_ops *monitor_ops;
3061 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3062 
3063 	if (!mon_soc) {
3064 		dp_mon_debug("monitor soc is NULL");
3065 		return QDF_STATUS_E_FAILURE;
3066 	}
3067 
3068 	monitor_ops = mon_soc->mon_ops;
3069 	if (!monitor_ops || !monitor_ops->mon_config_enh_rx_capture) {
3070 		dp_mon_debug("callback not registered");
3071 		return QDF_STATUS_E_FAILURE;
3072 	}
3073 
3074 	return monitor_ops->mon_config_enh_rx_capture(pdev, val);
3075 }
3076 #else
3077 static inline QDF_STATUS dp_monitor_config_enh_rx_capture(struct dp_pdev *pdev,
3078 							  uint32_t val)
3079 {
3080 	return QDF_STATUS_E_INVAL;
3081 }
3082 #endif
3083 
3084 #ifdef QCA_SUPPORT_BPR
3085 static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev,
3086 						   uint32_t val)
3087 {
3088 	struct dp_mon_ops *monitor_ops;
3089 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3090 
3091 	if (!mon_soc) {
3092 		dp_mon_debug("monitor soc is NULL");
3093 		return QDF_STATUS_E_FAILURE;
3094 	}
3095 
3096 	monitor_ops = mon_soc->mon_ops;
3097 	if (!monitor_ops || !monitor_ops->mon_set_bpr_enable) {
3098 		dp_mon_debug("callback not registered");
3099 		return QDF_STATUS_E_FAILURE;
3100 	}
3101 
3102 	return monitor_ops->mon_set_bpr_enable(pdev, val);
3103 }
3104 #else
3105 static inline QDF_STATUS dp_monitor_set_bpr_enable(struct dp_pdev *pdev,
3106 						   uint32_t val)
3107 {
3108 	return QDF_STATUS_E_FAILURE;
3109 }
3110 #endif
3111 
3112 #ifdef ATH_SUPPORT_NAC
3113 static inline
3114 int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val)
3115 {
3116 	struct dp_mon_ops *monitor_ops;
3117 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3118 
3119 	if (!mon_soc) {
3120 		dp_mon_debug("monitor soc is NULL");
3121 		return 0;
3122 	}
3123 
3124 	monitor_ops = mon_soc->mon_ops;
3125 	if (!monitor_ops || !monitor_ops->mon_set_filter_neigh_peers) {
3126 		dp_mon_debug("callback not registered");
3127 		return 0;
3128 	}
3129 
3130 	return monitor_ops->mon_set_filter_neigh_peers(pdev, val);
3131 }
3132 #else
3133 static inline
3134 int dp_monitor_set_filter_neigh_peers(struct dp_pdev *pdev, bool val)
3135 {
3136 	return 0;
3137 }
3138 #endif
3139 
3140 #ifdef WLAN_ATF_ENABLE
3141 static inline
3142 void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value)
3143 {
3144 	struct dp_mon_ops *monitor_ops;
3145 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3146 
3147 	if (!mon_soc) {
3148 		dp_mon_debug("monitor soc is NULL");
3149 		return;
3150 	}
3151 
3152 	monitor_ops = mon_soc->mon_ops;
3153 	if (!monitor_ops || !monitor_ops->mon_set_atf_stats_enable) {
3154 		dp_mon_debug("callback not registered");
3155 		return;
3156 	}
3157 
3158 	return monitor_ops->mon_set_atf_stats_enable(pdev, value);
3159 }
3160 #else
3161 static inline
3162 void dp_monitor_set_atf_stats_enable(struct dp_pdev *pdev, bool value)
3163 {
3164 }
3165 #endif
3166 
3167 static inline
3168 void dp_monitor_set_bsscolor(struct dp_pdev *pdev, uint8_t bsscolor)
3169 {
3170 	struct dp_mon_ops *monitor_ops;
3171 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3172 
3173 	if (!mon_soc) {
3174 		dp_mon_debug("monitor soc is NULL");
3175 		return;
3176 	}
3177 
3178 	monitor_ops = mon_soc->mon_ops;
3179 	if (!monitor_ops || !monitor_ops->mon_set_bsscolor) {
3180 		dp_mon_debug("callback not registered");
3181 		return;
3182 	}
3183 
3184 	return monitor_ops->mon_set_bsscolor(pdev, bsscolor);
3185 }
3186 
3187 static inline
3188 bool dp_monitor_pdev_get_filter_mcast_data(struct cdp_pdev *pdev_handle)
3189 {
3190 	struct dp_mon_ops *monitor_ops;
3191 	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
3192 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3193 
3194 	if (!mon_soc) {
3195 		dp_mon_debug("monitor soc is NULL");
3196 		return false;
3197 	}
3198 
3199 	monitor_ops = mon_soc->mon_ops;
3200 	if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_mcast_data) {
3201 		dp_mon_debug("callback not registered");
3202 		return false;
3203 	}
3204 
3205 	return monitor_ops->mon_pdev_get_filter_mcast_data(pdev_handle);
3206 }
3207 
3208 static inline
3209 bool dp_monitor_pdev_get_filter_non_data(struct cdp_pdev *pdev_handle)
3210 {
3211 	struct dp_mon_ops *monitor_ops;
3212 	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
3213 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3214 
3215 	if (!mon_soc) {
3216 		dp_mon_debug("monitor soc is NULL");
3217 		return false;
3218 	}
3219 
3220 	monitor_ops = mon_soc->mon_ops;
3221 	if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_non_data) {
3222 		dp_mon_debug("callback not registered");
3223 		return false;
3224 	}
3225 
3226 	return monitor_ops->mon_pdev_get_filter_non_data(pdev_handle);
3227 }
3228 
3229 static inline
3230 bool dp_monitor_pdev_get_filter_ucast_data(struct cdp_pdev *pdev_handle)
3231 {
3232 	struct dp_mon_ops *monitor_ops;
3233 	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
3234 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3235 
3236 	if (!mon_soc) {
3237 		dp_mon_debug("monitor soc is NULL");
3238 		return false;
3239 	}
3240 
3241 	monitor_ops = mon_soc->mon_ops;
3242 	if (!monitor_ops || !monitor_ops->mon_pdev_get_filter_ucast_data) {
3243 		dp_mon_debug("callback not registered");
3244 		return false;
3245 	}
3246 
3247 	return monitor_ops->mon_pdev_get_filter_ucast_data(pdev_handle);
3248 }
3249 
3250 #ifdef WDI_EVENT_ENABLE
3251 static inline
3252 int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
3253 				bool enable)
3254 {
3255 	struct dp_mon_ops *monitor_ops;
3256 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3257 
3258 	if (!mon_soc) {
3259 		dp_mon_debug("monitor soc is NULL");
3260 		return 0;
3261 	}
3262 
3263 	monitor_ops = mon_soc->mon_ops;
3264 	if (!monitor_ops || !monitor_ops->mon_set_pktlog_wifi3) {
3265 		dp_mon_debug("callback not registered");
3266 		return 0;
3267 	}
3268 
3269 	return monitor_ops->mon_set_pktlog_wifi3(pdev, event, enable);
3270 }
3271 #else
3272 static inline
3273 int dp_monitor_set_pktlog_wifi3(struct dp_pdev *pdev, uint32_t event,
3274 				bool enable)
3275 {
3276 	return 0;
3277 }
3278 #endif
3279 
3280 #if defined(DP_CON_MON) && !defined(REMOVE_PKT_LOG)
3281 static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev)
3282 {
3283 	struct dp_mon_ops *monitor_ops;
3284 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3285 
3286 	if (!mon_soc) {
3287 		dp_mon_debug("monitor soc is NULL");
3288 		return;
3289 	}
3290 
3291 	monitor_ops = mon_soc->mon_ops;
3292 	if (!monitor_ops || !monitor_ops->mon_pktlogmod_exit) {
3293 		dp_mon_debug("callback not registered");
3294 		return;
3295 	}
3296 
3297 	return monitor_ops->mon_pktlogmod_exit(pdev);
3298 }
3299 #else
3300 static inline void dp_monitor_pktlogmod_exit(struct dp_pdev *pdev) {}
3301 #endif
3302 
3303 static inline
3304 QDF_STATUS dp_monitor_vdev_set_monitor_mode_buf_rings(struct dp_pdev *pdev)
3305 {
3306 	struct dp_mon_ops *monitor_ops;
3307 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3308 
3309 	if (!mon_soc) {
3310 		dp_mon_debug("monitor soc is NULL");
3311 		return QDF_STATUS_E_FAILURE;
3312 	}
3313 
3314 	monitor_ops = mon_soc->mon_ops;
3315 	if (!monitor_ops || !monitor_ops->mon_vdev_set_monitor_mode_buf_rings) {
3316 		dp_mon_debug("callback not registered");
3317 		return QDF_STATUS_E_FAILURE;
3318 	}
3319 
3320 	return monitor_ops->mon_vdev_set_monitor_mode_buf_rings(pdev);
3321 }
3322 
3323 static inline
3324 void dp_monitor_neighbour_peers_detach(struct dp_pdev *pdev)
3325 {
3326 	struct dp_mon_ops *monitor_ops;
3327 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3328 
3329 	if (!mon_soc) {
3330 		dp_mon_debug("monitor soc is NULL");
3331 		return;
3332 	}
3333 
3334 	monitor_ops = mon_soc->mon_ops;
3335 	if (!monitor_ops || !monitor_ops->mon_neighbour_peers_detach) {
3336 		dp_mon_debug("callback not registered");
3337 		return;
3338 	}
3339 
3340 	return monitor_ops->mon_neighbour_peers_detach(pdev);
3341 }
3342 
3343 #ifdef FEATURE_NAC_RSSI
3344 static inline QDF_STATUS dp_monitor_filter_neighbour_peer(struct dp_pdev *pdev,
3345 							  uint8_t *rx_pkt_hdr)
3346 {
3347 	struct dp_mon_ops *monitor_ops;
3348 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3349 
3350 	if (!mon_soc) {
3351 		dp_mon_debug("monitor soc is NULL");
3352 		return QDF_STATUS_E_FAILURE;
3353 	}
3354 
3355 	monitor_ops = mon_soc->mon_ops;
3356 	if (!monitor_ops || !monitor_ops->mon_filter_neighbour_peer) {
3357 		dp_mon_debug("callback not registered");
3358 		return QDF_STATUS_E_FAILURE;
3359 	}
3360 
3361 	return monitor_ops->mon_filter_neighbour_peer(pdev, rx_pkt_hdr);
3362 }
3363 #endif
3364 
3365 static inline
3366 void dp_monitor_reap_timer_init(struct dp_soc *soc)
3367 {
3368 	struct dp_mon_ops *monitor_ops;
3369 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3370 
3371 	if (!mon_soc) {
3372 		dp_mon_debug("monitor soc is NULL");
3373 		return;
3374 	}
3375 
3376 	monitor_ops = mon_soc->mon_ops;
3377 	if (!monitor_ops || !monitor_ops->mon_reap_timer_init) {
3378 		dp_mon_debug("callback not registered");
3379 		return;
3380 	}
3381 
3382 	monitor_ops->mon_reap_timer_init(soc);
3383 }
3384 
3385 static inline
3386 void dp_monitor_reap_timer_deinit(struct dp_soc *soc)
3387 {
3388 	struct dp_mon_ops *monitor_ops;
3389 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3390 
3391 	if (!mon_soc) {
3392 		dp_mon_debug("monitor soc is NULL");
3393 		return;
3394 	}
3395 
3396 	monitor_ops = mon_soc->mon_ops;
3397 	if (!monitor_ops || !monitor_ops->mon_reap_timer_deinit) {
3398 		dp_mon_debug("callback not registered");
3399 		return;
3400 	}
3401 
3402 	monitor_ops->mon_reap_timer_deinit(soc);
3403 }
3404 
3405 /**
3406  * dp_monitor_reap_timer_start() - start reap timer of monitor status ring
3407  * @soc: point to soc
3408  * @source: trigger source
3409  *
3410  * Return: true if timer-start is performed, false otherwise.
3411  */
3412 static inline bool
3413 dp_monitor_reap_timer_start(struct dp_soc *soc,
3414 			    enum cdp_mon_reap_source source)
3415 {
3416 	struct dp_mon_ops *monitor_ops;
3417 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3418 
3419 	if (!mon_soc) {
3420 		dp_mon_debug("monitor soc is NULL");
3421 		return false;
3422 	}
3423 
3424 	monitor_ops = mon_soc->mon_ops;
3425 	if (!monitor_ops || !monitor_ops->mon_reap_timer_start) {
3426 		dp_mon_debug("callback not registered");
3427 		return false;
3428 	}
3429 
3430 	return monitor_ops->mon_reap_timer_start(soc, source);
3431 }
3432 
3433 /**
3434  * dp_monitor_reap_timer_stop() - stop reap timer of monitor status ring
3435  * @soc: point to soc
3436  * @source: trigger source
3437  *
3438  * Return: true if timer-stop is performed, false otherwise.
3439  */
3440 static inline bool
3441 dp_monitor_reap_timer_stop(struct dp_soc *soc,
3442 			   enum cdp_mon_reap_source source)
3443 {
3444 	struct dp_mon_ops *monitor_ops;
3445 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3446 
3447 	if (!mon_soc) {
3448 		dp_mon_debug("monitor soc is NULL");
3449 		return false;
3450 	}
3451 
3452 	monitor_ops = mon_soc->mon_ops;
3453 	if (!monitor_ops || !monitor_ops->mon_reap_timer_stop) {
3454 		dp_mon_debug("callback not registered");
3455 		return false;
3456 	}
3457 
3458 	return monitor_ops->mon_reap_timer_stop(soc, source);
3459 }
3460 
3461 static inline
3462 void dp_monitor_vdev_timer_init(struct dp_soc *soc)
3463 {
3464 	struct dp_mon_ops *monitor_ops;
3465 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3466 
3467 	if (!mon_soc) {
3468 		dp_mon_debug("monitor soc is NULL");
3469 		return;
3470 	}
3471 
3472 	monitor_ops = mon_soc->mon_ops;
3473 	if (!monitor_ops || !monitor_ops->mon_vdev_timer_init) {
3474 		dp_mon_debug("callback not registered");
3475 		return;
3476 	}
3477 
3478 	monitor_ops->mon_vdev_timer_init(soc);
3479 }
3480 
3481 static inline
3482 void dp_monitor_vdev_timer_deinit(struct dp_soc *soc)
3483 {
3484 	struct dp_mon_ops *monitor_ops;
3485 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3486 
3487 	if (!mon_soc) {
3488 		dp_mon_debug("monitor soc is NULL");
3489 		return;
3490 	}
3491 
3492 	monitor_ops = mon_soc->mon_ops;
3493 	if (!monitor_ops || !monitor_ops->mon_vdev_timer_deinit) {
3494 		dp_mon_debug("callback not registered");
3495 		return;
3496 	}
3497 
3498 	monitor_ops->mon_vdev_timer_deinit(soc);
3499 }
3500 
3501 static inline
3502 void dp_monitor_vdev_timer_start(struct dp_soc *soc)
3503 {
3504 	struct dp_mon_ops *monitor_ops;
3505 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3506 
3507 	if (!mon_soc) {
3508 		dp_mon_debug("monitor soc is NULL");
3509 		return;
3510 	}
3511 
3512 	monitor_ops = mon_soc->mon_ops;
3513 	if (!monitor_ops || !monitor_ops->mon_vdev_timer_start) {
3514 		dp_mon_debug("callback not registered");
3515 		return;
3516 	}
3517 
3518 	monitor_ops->mon_vdev_timer_start(soc);
3519 }
3520 
3521 static inline
3522 bool dp_monitor_vdev_timer_stop(struct dp_soc *soc)
3523 {
3524 	struct dp_mon_ops *monitor_ops;
3525 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3526 
3527 	if (!mon_soc) {
3528 		dp_mon_debug("monitor soc is NULL");
3529 		return false;
3530 	}
3531 
3532 	monitor_ops = mon_soc->mon_ops;
3533 	if (!monitor_ops || !monitor_ops->mon_vdev_timer_stop) {
3534 		dp_mon_debug("callback not registered");
3535 		return false;
3536 	}
3537 
3538 	return monitor_ops->mon_vdev_timer_stop(soc);
3539 }
3540 
3541 #ifdef QCA_MCOPY_SUPPORT
3542 static inline
3543 QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev,
3544 					  uint16_t peer_id, uint32_t ppdu_id,
3545 					  uint8_t first_msdu)
3546 {
3547 	struct dp_mon_ops *monitor_ops;
3548 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3549 
3550 	if (!mon_soc) {
3551 		dp_mon_debug("monitor soc is NULL");
3552 		return QDF_STATUS_E_FAILURE;
3553 	}
3554 
3555 	monitor_ops = mon_soc->mon_ops;
3556 	if (!monitor_ops || !monitor_ops->mon_mcopy_check_deliver) {
3557 		dp_mon_debug("callback not registered");
3558 		return QDF_STATUS_E_FAILURE;
3559 	}
3560 
3561 	return monitor_ops->mon_mcopy_check_deliver(pdev, peer_id,
3562 						    ppdu_id, first_msdu);
3563 }
3564 #else
3565 static inline
3566 QDF_STATUS dp_monitor_mcopy_check_deliver(struct dp_pdev *pdev,
3567 					  uint16_t peer_id, uint32_t ppdu_id,
3568 					  uint8_t first_msdu)
3569 {
3570 	return QDF_STATUS_SUCCESS;
3571 }
3572 #endif
3573 
3574 /*
3575  * dp_monitor_neighbour_peer_add_ast() - Add ast entry
3576  * @pdev: point to dp pdev
3577  * @ta_peer: point to peer
3578  * @mac_addr: mac address
3579  * @nbuf: point to nbuf
3580  * @flags: flags
3581  *
3582  * Return: void
3583  */
3584 static inline void
3585 dp_monitor_neighbour_peer_add_ast(struct dp_pdev *pdev,
3586 				  struct dp_peer *ta_peer,
3587 				  uint8_t *mac_addr,
3588 				  qdf_nbuf_t nbuf,
3589 				  uint32_t flags)
3590 {
3591 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
3592 	struct dp_mon_ops *monitor_ops;
3593 
3594 	if (!mon_soc) {
3595 		dp_mon_debug("monitor soc is NULL");
3596 		return;
3597 	}
3598 
3599 	monitor_ops = mon_soc->mon_ops;
3600 	if (!monitor_ops || !monitor_ops->mon_neighbour_peer_add_ast) {
3601 		dp_mon_debug("callback not registered");
3602 		return;
3603 	}
3604 
3605 	return monitor_ops->mon_neighbour_peer_add_ast(pdev, ta_peer, mac_addr,
3606 						       nbuf, flags);
3607 }
3608 
3609 /*
3610  * dp_monitor_vdev_delete() - delete monitor vdev
3611  * @soc: point to dp soc
3612  * @vdev: point to dp vdev
3613  *
3614  * Return: void
3615  */
3616 static inline void dp_monitor_vdev_delete(struct dp_soc *soc,
3617 					  struct dp_vdev *vdev)
3618 {
3619 	if (soc->intr_mode == DP_INTR_POLL) {
3620 		qdf_timer_sync_cancel(&soc->int_timer);
3621 		dp_monitor_flush_rings(soc);
3622 	} else if (soc->intr_mode == DP_INTR_MSI) {
3623 		if (dp_monitor_vdev_timer_stop(soc))
3624 			dp_monitor_flush_rings(soc);
3625 	}
3626 
3627 	dp_monitor_vdev_detach(vdev);
3628 }
3629 
3630 #ifdef DP_POWER_SAVE
3631 /*
3632  * dp_monitor_reap_timer_suspend() - Stop monitor reap timer
3633  * and reap any pending frames in ring
3634  * @pdev: point to dp pdev
3635  *
3636  * Return: void
3637  */
3638 static inline void
3639 dp_monitor_reap_timer_suspend(struct dp_soc *soc)
3640 {
3641 	if (dp_monitor_reap_timer_stop(soc, CDP_MON_REAP_SOURCE_ANY))
3642 		dp_monitor_service_mon_rings(soc, DP_MON_REAP_BUDGET);
3643 }
3644 
3645 #endif
3646 
3647 /*
3648  * dp_monitor_neighbour_peer_list_remove() - remove neighbour peer list
3649  * @pdev: point to dp pdev
3650  * @vdev: point to dp vdev
3651  * @peer: point to dp_neighbour_peer
3652  *
3653  * Return: void
3654  */
3655 static inline
3656 void dp_monitor_neighbour_peer_list_remove(struct dp_pdev *pdev,
3657 					   struct dp_vdev *vdev,
3658 					   struct dp_neighbour_peer *peer)
3659 {
3660 	struct dp_mon_pdev *mon_pdev;
3661 	struct dp_neighbour_peer *temp_peer = NULL;
3662 
3663 	if (qdf_unlikely(!pdev || !pdev->monitor_pdev))
3664 		return;
3665 
3666 	mon_pdev = pdev->monitor_pdev;
3667 	qdf_spin_lock_bh(&mon_pdev->neighbour_peer_mutex);
3668 	if (!pdev->soc->monitor_soc->hw_nac_monitor_support) {
3669 		TAILQ_FOREACH(peer, &mon_pdev->neighbour_peers_list,
3670 			      neighbour_peer_list_elem) {
3671 				QDF_ASSERT(peer->vdev != vdev);
3672 			}
3673 	} else {
3674 		TAILQ_FOREACH_SAFE(peer, &mon_pdev->neighbour_peers_list,
3675 				   neighbour_peer_list_elem, temp_peer) {
3676 			if (peer->vdev == vdev) {
3677 				TAILQ_REMOVE(&mon_pdev->neighbour_peers_list,
3678 					     peer,
3679 					     neighbour_peer_list_elem);
3680 				qdf_mem_free(peer);
3681 			}
3682 		}
3683 	}
3684 	qdf_spin_unlock_bh(&mon_pdev->neighbour_peer_mutex);
3685 }
3686 
3687 static inline
3688 void dp_monitor_pdev_set_mon_vdev(struct dp_vdev *vdev)
3689 {
3690 	if (!vdev->pdev->monitor_pdev)
3691 		return;
3692 
3693 	vdev->pdev->monitor_pdev->mvdev = vdev;
3694 }
3695 
3696 static inline
3697 void dp_monitor_pdev_config_scan_spcl_vap(struct dp_pdev *pdev, bool val)
3698 {
3699 	if (!pdev || !pdev->monitor_pdev)
3700 		return;
3701 
3702 	pdev->monitor_pdev->scan_spcl_vap_configured = val;
3703 }
3704 
3705 #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
3706 static inline
3707 void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
3708 						      bool val)
3709 {
3710 	if (!pdev || !pdev->monitor_pdev)
3711 		return;
3712 
3713 	pdev->monitor_pdev->reset_scan_spcl_vap_stats_enable = val;
3714 }
3715 #else
3716 static inline
3717 void dp_monitor_pdev_reset_scan_spcl_vap_stats_enable(struct dp_pdev *pdev,
3718 						      bool val)
3719 {
3720 }
3721 #endif
3722 
3723 static inline void
3724 dp_mon_rx_wmask_subscribe(struct dp_soc *soc, uint32_t *msg_word,
3725 			  struct htt_rx_ring_tlv_filter *tlv_filter)
3726 {
3727 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3728 	struct dp_mon_ops *monitor_ops;
3729 
3730 	if (!mon_soc) {
3731 		dp_mon_debug("mon soc is NULL");
3732 		return;
3733 
3734 	}
3735 
3736 	monitor_ops = mon_soc->mon_ops;
3737 	if (!monitor_ops || !monitor_ops->rx_wmask_subscribe) {
3738 		dp_mon_debug("callback not registered");
3739 		return;
3740 	}
3741 
3742 	monitor_ops->rx_wmask_subscribe(msg_word, tlv_filter);
3743 }
3744 
3745 static inline void
3746 dp_mon_rx_enable_mpdu_logging(struct dp_soc *soc, uint32_t *msg_word,
3747 			      struct htt_rx_ring_tlv_filter *tlv_filter)
3748 {
3749 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3750 	struct dp_mon_ops *monitor_ops;
3751 
3752 	if (!mon_soc) {
3753 		dp_mon_debug("mon soc is NULL");
3754 		return;
3755 
3756 	}
3757 
3758 	monitor_ops = mon_soc->mon_ops;
3759 	if (!monitor_ops || !monitor_ops->rx_enable_mpdu_logging) {
3760 		dp_mon_debug("callback not registered");
3761 		return;
3762 	}
3763 
3764 	monitor_ops->rx_enable_mpdu_logging(msg_word, tlv_filter);
3765 }
3766 
3767 /*
3768  * dp_mon_rx_enable_fpmo() - set fpmo filters
3769  * @soc: dp soc handle
3770  * @msg_word: msg word
3771  * @tlv_filter: rx fing filter config
3772  *
3773  * Return: void
3774  */
3775 static inline void
3776 dp_mon_rx_enable_fpmo(struct dp_soc *soc, uint32_t *msg_word,
3777 		      struct htt_rx_ring_tlv_filter *tlv_filter)
3778 {
3779 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3780 	struct dp_mon_ops *monitor_ops;
3781 
3782 	if (!mon_soc) {
3783 		dp_mon_debug("mon soc is NULL");
3784 		return;
3785 	}
3786 
3787 	monitor_ops = mon_soc->mon_ops;
3788 	if (!monitor_ops || !monitor_ops->rx_enable_fpmo) {
3789 		dp_mon_debug("callback not registered");
3790 		return;
3791 	}
3792 
3793 	monitor_ops->rx_enable_fpmo(msg_word, tlv_filter);
3794 }
3795 
3796 /*
3797  * dp_mon_rx_hdr_length_set() - set rx hdr tlv length
3798  * @soc: dp soc handle
3799  * @msg_word: msg word
3800  * @tlv_filter: rx fing filter config
3801  *
3802  * Return: void
3803  */
3804 static inline void
3805 dp_mon_rx_hdr_length_set(struct dp_soc *soc, uint32_t *msg_word,
3806 			 struct htt_rx_ring_tlv_filter *tlv_filter)
3807 {
3808 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3809 	struct dp_mon_ops *monitor_ops;
3810 
3811 	if (!mon_soc) {
3812 		dp_mon_debug("mon soc is NULL");
3813 		return;
3814 	}
3815 
3816 	monitor_ops = mon_soc->mon_ops;
3817 	if (!monitor_ops || !monitor_ops->rx_hdr_length_set) {
3818 		dp_mon_debug("callback not registered");
3819 		return;
3820 	}
3821 
3822 	monitor_ops->rx_hdr_length_set(msg_word, tlv_filter);
3823 }
3824 
3825 static inline void
3826 dp_mon_rx_packet_length_set(struct dp_soc *soc, uint32_t *msg_word,
3827 			    struct htt_rx_ring_tlv_filter *tlv_filter)
3828 {
3829 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3830 	struct dp_mon_ops *monitor_ops;
3831 
3832 	if (!mon_soc) {
3833 		dp_mon_debug("mon soc is NULL");
3834 		return;
3835 
3836 	}
3837 
3838 	monitor_ops = mon_soc->mon_ops;
3839 	if (!monitor_ops || !monitor_ops->rx_packet_length_set) {
3840 		dp_mon_debug("callback not registered");
3841 		return;
3842 	}
3843 
3844 	monitor_ops->rx_packet_length_set(msg_word, tlv_filter);
3845 }
3846 
3847 static inline void
3848 dp_rx_mon_enable(struct dp_soc *soc, uint32_t *msg_word,
3849 		 struct htt_rx_ring_tlv_filter *tlv_filter)
3850 {
3851 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
3852 	struct dp_mon_ops *monitor_ops;
3853 
3854 	if (!mon_soc) {
3855 		dp_mon_debug("mon soc is NULL");
3856 		return;
3857 	}
3858 
3859 	monitor_ops = mon_soc->mon_ops;
3860 	if (!monitor_ops || !monitor_ops->rx_mon_enable) {
3861 		dp_mon_debug("callback not registered");
3862 		return;
3863 	}
3864 
3865 	monitor_ops->rx_mon_enable(msg_word, tlv_filter);
3866 }
3867 
3868 #ifdef QCA_ENHANCED_STATS_SUPPORT
3869 QDF_STATUS dp_peer_qos_stats_notify(struct dp_pdev *dp_pdev,
3870 				    struct cdp_rx_stats_ppdu_user *ppdu_user);
3871 #endif
3872 
3873 /*
3874  * dp_print_pdev_rx_mon_stats() - print rx mon stats
3875  * @pdev: device object
3876  *
3877  * Return: void
3878  */
3879 void
3880 dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev);
3881 
3882 /**
3883  * dp_mcopy_check_deliver() - mcopy check deliver
3884  * @pdev: DP pdev handle
3885  * @peer_id: peer id
3886  * @ppdu_id: ppdu
3887  * @first_msdu: flag to indicate first msdu of ppdu
3888  * Return: 0 on success, not 0 on failure
3889  */
3890 QDF_STATUS dp_mcopy_check_deliver(struct dp_pdev *pdev,
3891 				  uint16_t peer_id,
3892 				  uint32_t ppdu_id,
3893 				  uint8_t first_msdu);
3894 
3895 /**
3896  * dp_pdev_set_advance_monitor_filter() - Set DP PDEV monitor filter
3897  * @soc: soc handle
3898  * @pdev_id: id of Datapath PDEV handle
3899  * @filter_val: Flag to select Filter for monitor mode
3900  * Return: 0 on success, not 0 on failure
3901  */
3902 #ifdef QCA_ADVANCE_MON_FILTER_SUPPORT
3903 QDF_STATUS
3904 dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
3905 				   struct cdp_monitor_filter *filter_val);
3906 #else
3907 static inline QDF_STATUS
3908 dp_pdev_set_advance_monitor_filter(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
3909 				   struct cdp_monitor_filter *filter_val)
3910 {
3911 	return QDF_STATUS_E_INVAL;
3912 }
3913 #endif /* QCA_ADVANCE_MON_FILTER_SUPPORT */
3914 
3915 /**
3916  * dp_deliver_tx_mgmt() - Deliver mgmt frame for tx capture
3917  * @cdp_soc : data path soc handle
3918  * @pdev_id : pdev_id
3919  * @nbuf: Management frame buffer
3920  */
3921 QDF_STATUS
3922 dp_deliver_tx_mgmt(struct cdp_soc_t *cdp_soc, uint8_t pdev_id, qdf_nbuf_t nbuf);
3923 
3924 /**
3925  * dp_filter_neighbour_peer() - API to filter neighbour peer
3926  * @pdev : DP pdev handle
3927  * @rx_pkt_hdr : packet header
3928  *
3929  * return: QDF_STATUS_SUCCESS on success
3930  *	   QDF_STATUS_E_FAILURE on failure
3931  */
3932 #ifdef FEATURE_NAC_RSSI
3933 QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev,
3934 				    uint8_t *rx_pkt_hdr);
3935 #else
3936 static inline
3937 QDF_STATUS dp_filter_neighbour_peer(struct dp_pdev *pdev,
3938 				    uint8_t *rx_pkt_hdr)
3939 {
3940 	return QDF_STATUS_SUCCESS;
3941 }
3942 #endif /* FEATURE_NAC_RSSI */
3943 
3944 /*
3945  * dp_neighbour_peers_detach() - Detach neighbour peers(nac clients)
3946  * @pdev: device object
3947  *
3948  * Return: void
3949  */
3950 void dp_neighbour_peers_detach(struct dp_pdev *pdev);
3951 
3952 /**
3953  * dp_reset_monitor_mode() - Disable monitor mode
3954  * @soc_hdl: Datapath soc handle
3955  * @pdev_id: id of datapath PDEV handle
3956  * @smart_monitor: smart monitor flag
3957  *
3958  * Return: QDF_STATUS
3959  */
3960 QDF_STATUS dp_reset_monitor_mode(struct cdp_soc_t *soc_hdl,
3961 				 uint8_t pdev_id,
3962 				 uint8_t smart_monitor);
3963 
3964 static inline
3965 struct dp_mon_ops *dp_mon_ops_get(struct dp_soc *soc)
3966 {
3967 	if (soc && soc->monitor_soc)
3968 		return soc->monitor_soc->mon_ops;
3969 
3970 	return NULL;
3971 }
3972 
3973 static inline
3974 struct cdp_mon_ops *dp_mon_cdp_ops_get(struct dp_soc *soc)
3975 {
3976 	struct cdp_ops *ops = soc->cdp_soc.ops;
3977 
3978 	return ops->mon_ops;
3979 }
3980 
3981 /**
3982  * dp_monitor_soc_init() - Monitor SOC init
3983  * @soc: DP soc handle
3984  *
3985  * Return: void
3986  */
3987 static inline void dp_monitor_soc_init(struct dp_soc *soc)
3988 {
3989 	struct dp_mon_ops *mon_ops;
3990 
3991 	mon_ops = dp_mon_ops_get(soc);
3992 
3993 	if (mon_ops && mon_ops->mon_soc_init)
3994 		mon_ops->mon_soc_init(soc);
3995 }
3996 
3997 /**
3998  * dp_monitor_soc_deinit() - Monitor SOC deinit
3999  * @soc: DP soc handle
4000  *
4001  * Return: void
4002  */
4003 static inline void dp_monitor_soc_deinit(struct dp_soc *soc)
4004 {
4005 	struct dp_mon_ops *mon_ops;
4006 
4007 	mon_ops = dp_mon_ops_get(soc);
4008 
4009 	if (mon_ops && mon_ops->mon_soc_deinit)
4010 		mon_ops->mon_soc_deinit(soc);
4011 }
4012 
4013 /**
4014  * dp_ppdu_desc_user_stats_update(): Function to update TX user stats
4015  * @pdev: DP pdev handle
4016  * @ppdu_info: per PPDU TLV descriptor
4017  *
4018  * return: void
4019  */
4020 #ifdef QCA_ENHANCED_STATS_SUPPORT
4021 void
4022 dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev,
4023 			       struct ppdu_info *ppdu_info);
4024 #else
4025 static inline void
4026 dp_ppdu_desc_user_stats_update(struct dp_pdev *pdev,
4027 			       struct ppdu_info *ppdu_info)
4028 {
4029 }
4030 #endif /* QCA_ENHANCED_STATS_SUPPORT */
4031 
4032 /**
4033  * dp_mon_ops_register_1_0(): register legacy monitor ops
4034  * @mon_soc: monitor soc handle
4035  *
4036  * return: void
4037  */
4038 void dp_mon_ops_register_1_0(struct dp_mon_soc *mon_soc);
4039 
4040 /**
4041  * dp_mon_cdp_ops_register_1_0(): register legacy monitor cdp ops
4042  * @ops: cdp ops handle
4043  *
4044  * return: void
4045  */
4046 void dp_mon_cdp_ops_register_1_0(struct cdp_ops *ops);
4047 
4048 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
4049 /**
4050  * dp_cfr_filter_register_1_0(): register cfr filter setting API
4051  * @ops: cdp ops handle
4052  *
4053  * return: void
4054  */
4055 void dp_cfr_filter_register_1_0(struct cdp_ops *ops);
4056 #endif
4057 
4058 #ifdef QCA_MONITOR_2_0_SUPPORT
4059 /**
4060  * dp_mon_ops_register_2_0(): register monitor ops
4061  * @mon_soc: monitor soc handle
4062  *
4063  * return: void
4064  */
4065 void dp_mon_ops_register_2_0(struct dp_mon_soc *mon_soc);
4066 
4067 /**
4068  * dp_mon_cdp_ops_register_2_0(): register monitor cdp ops
4069  * @ops: cdp ops handle
4070  *
4071  * return: void
4072  */
4073 void dp_mon_cdp_ops_register_2_0(struct cdp_ops *ops);
4074 
4075 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
4076 /**
4077  * dp_cfr_filter_register_2_0(): register cfr filter setting API
4078  * @ops: cdp ops handle
4079  *
4080  * return: void
4081  */
4082 void dp_cfr_filter_register_2_0(struct cdp_ops *ops);
4083 #endif
4084 #endif /* QCA_MONITOR_2_0_SUPPORT */
4085 
4086 /**
4087  * dp_mon_register_feature_ops(): Register mon feature ops
4088  * @soc: Datapath soc context
4089  *
4090  * return: void
4091  */
4092 static inline
4093 void dp_mon_register_feature_ops(struct dp_soc *soc)
4094 {
4095 	struct dp_mon_ops *mon_ops = NULL;
4096 
4097 	mon_ops = dp_mon_ops_get(soc);
4098 	if (!mon_ops) {
4099 		dp_mon_err("Monitor ops is NULL");
4100 		return;
4101 	}
4102 	if (mon_ops->mon_register_feature_ops)
4103 		mon_ops->mon_register_feature_ops(soc);
4104 }
4105 
4106 /**
4107  * dp_pdev_get_rx_mon_stats(): Get pdev Rx monitor stats
4108  * @soc_hdl: soc handle
4109  * @pdev_id: id of pdev handle
4110  * @stats: User allocated stats buffer
4111  *
4112  * return: status success/failure
4113  */
4114 QDF_STATUS dp_pdev_get_rx_mon_stats(struct cdp_soc_t *soc_hdl, uint8_t pdev_id,
4115 				    struct cdp_pdev_mon_stats *stats);
4116 
4117 /*
4118  * dp_enable_mon_reap_timer() - enable/disable reap timer
4119  * @soc_hdl: Datapath soc handle
4120  * @source: trigger source of the timer
4121  * @enable: Enable/Disable reap timer of monitor status ring
4122  *
4123  * Return: true if a timer-start/stop is performed, false otherwise.
4124  */
4125 bool dp_enable_mon_reap_timer(struct cdp_soc_t *soc_hdl,
4126 			      enum cdp_mon_reap_source source, bool enable);
4127 
4128 /*
4129  * dp_monitor_lite_mon_disable_rx() - disables rx lite mon
4130  * @pdev: dp pdev
4131  *
4132  * Return: void
4133  */
4134 static inline void
4135 dp_monitor_lite_mon_disable_rx(struct dp_pdev *pdev)
4136 {
4137 	struct dp_mon_ops *monitor_ops;
4138 	struct dp_mon_soc *mon_soc = pdev->soc->monitor_soc;
4139 
4140 	if (!mon_soc) {
4141 		dp_mon_debug("monitor soc is NULL");
4142 		return;
4143 }
4144 
4145 	monitor_ops = mon_soc->mon_ops;
4146 	if (!monitor_ops ||
4147 	    !monitor_ops->mon_lite_mon_disable_rx) {
4148 		dp_mon_debug("callback not registered");
4149 		return;
4150 }
4151 
4152 	return monitor_ops->mon_lite_mon_disable_rx(pdev);
4153 }
4154 
4155 #ifndef QCA_SUPPORT_LITE_MONITOR
4156 static inline void
4157 dp_lite_mon_disable_rx(struct dp_pdev *pdev)
4158 {
4159 }
4160 
4161 static inline void
4162 dp_lite_mon_disable_tx(struct dp_pdev *pdev)
4163 {
4164 }
4165 
4166 static inline int
4167 dp_lite_mon_is_level_msdu(struct dp_mon_pdev *mon_pdev)
4168 {
4169 	return 0;
4170 }
4171 
4172 static inline int
4173 dp_lite_mon_is_rx_enabled(struct dp_mon_pdev *mon_pdev)
4174 {
4175 	return 0;
4176 }
4177 
4178 static inline int
4179 dp_lite_mon_is_tx_enabled(struct dp_mon_pdev *mon_pdev)
4180 {
4181 	return 0;
4182 }
4183 
4184 static inline QDF_STATUS
4185 dp_lite_mon_alloc(struct dp_pdev *pdev)
4186 {
4187 	return QDF_STATUS_SUCCESS;
4188 }
4189 
4190 static inline void
4191 dp_lite_mon_dealloc(struct dp_pdev *pdev)
4192 {
4193 }
4194 
4195 static inline void
4196 dp_lite_mon_vdev_delete(struct dp_pdev *pdev, struct dp_vdev *vdev)
4197 {
4198 }
4199 
4200 static inline int
4201 dp_lite_mon_config_nac_peer(struct cdp_soc_t *soc_hdl,
4202 			    uint8_t vdev_id,
4203 			    uint32_t cmd, uint8_t *macaddr)
4204 {
4205 	return 0;
4206 }
4207 
4208 static inline QDF_STATUS
4209 dp_lite_mon_config_nac_rssi_peer(struct cdp_soc_t *soc_hdl,
4210 				 uint8_t vdev_id,
4211 				 enum cdp_nac_param_cmd cmd,
4212 				 char *bssid, char *macaddr,
4213 				 uint8_t chan_num)
4214 {
4215 	return QDF_STATUS_E_FAILURE;
4216 }
4217 
4218 static inline QDF_STATUS
4219 dp_lite_mon_get_nac_peer_rssi(struct cdp_soc_t *soc_hdl,
4220 			      uint8_t vdev_id, char *macaddr,
4221 			      uint8_t *rssi)
4222 {
4223 	return QDF_STATUS_E_FAILURE;
4224 }
4225 
4226 static inline QDF_STATUS
4227 dp_lite_mon_rx_mpdu_process(struct dp_pdev *pdev,
4228 			    struct hal_rx_ppdu_info *ppdu_info,
4229 			    qdf_nbuf_t mon_mpdu, uint16_t mpdu_id,
4230 			    uint8_t user)
4231 {
4232 	return QDF_STATUS_E_FAILURE;
4233 }
4234 #endif
4235 
4236 #ifdef WLAN_TELEMETRY_STATS_SUPPORT
4237 static inline
4238 void dp_monitor_peer_telemetry_stats(struct dp_peer *peer,
4239 				     struct cdp_peer_telemetry_stats *stats)
4240 {
4241 	struct dp_mon_peer_stats *mon_peer_stats = NULL;
4242 	uint8_t idx = 0;
4243 	uint32_t consumption = 0;
4244 
4245 	if (qdf_unlikely(!peer->monitor_peer))
4246 		return;
4247 
4248 	mon_peer_stats = &peer->monitor_peer->stats;
4249 	for (idx = 0; idx < MAX_CONSUMPTION_TIME; idx++)
4250 		consumption +=
4251 			mon_peer_stats->airtime_consumption.avg_consumption.avg_consumption_per_sec[idx];
4252 	/* consumption is in micro seconds, convert it to seconds and
4253 	 * then calculate %age per 5 sec
4254 	 */
4255 	stats->airtime_consumption = ((consumption * 100) / (MAX_CONSUMPTION_TIME * 1000000));
4256 	stats->tx_mpdu_retried = mon_peer_stats->tx.retries;
4257 	stats->tx_mpdu_total = mon_peer_stats->tx.tx_mpdus_tried;
4258 	stats->rx_mpdu_retried = mon_peer_stats->rx.mpdu_retry_cnt;
4259 	stats->rx_mpdu_total = mon_peer_stats->rx.rx_mpdus;
4260 	stats->snr = CDP_SNR_OUT(mon_peer_stats->rx.avg_snr);
4261 }
4262 #endif
4263 
4264 /**
4265 <<<<<<< HEAD
4266  * dp_monitor_is_tx_cap_enabled() - get tx-cature enabled/disabled
4267  * @peer: DP peer handle
4268  *
4269  * Return: true if tx-capture is enabled
4270  */
4271 static inline bool dp_monitor_is_tx_cap_enabled(struct dp_peer *peer)
4272 {
4273 	return peer->monitor_peer ? peer->monitor_peer->tx_cap_enabled : 0;
4274 }
4275 
4276 /**
4277  * dp_monitor_is_rx_cap_enabled() - get rx-cature enabled/disabled
4278  * @peer: DP peer handle
4279  *
4280  * Return: true if rx-capture is enabled
4281  */
4282 static inline bool dp_monitor_is_rx_cap_enabled(struct dp_peer *peer)
4283 {
4284 	return peer->monitor_peer ? peer->monitor_peer->rx_cap_enabled : 0;
4285 }
4286 
4287 #if !(!defined(DISABLE_MON_CONFIG) && defined(QCA_MONITOR_2_0_SUPPORT))
4288 /**
4289  * dp_mon_get_context_size_be() - get BE specific size for mon pdev/soc
4290  * @arch_ops: arch ops pointer
4291  *
4292  * Return: size in bytes for the context_type
4293  */
4294 static inline
4295 qdf_size_t dp_mon_get_context_size_be(enum dp_context_type context_type)
4296 {
4297 	switch (context_type) {
4298 	case DP_CONTEXT_TYPE_MON_SOC:
4299 		return sizeof(struct dp_mon_soc);
4300 	case DP_CONTEXT_TYPE_MON_PDEV:
4301 		return sizeof(struct dp_mon_pdev);
4302 	default:
4303 		return 0;
4304 	}
4305 }
4306 #endif
4307 
4308 /*
4309  * dp_mon_rx_print_advanced_stats () - print advanced monitor stats
4310  *
4311  * @soc: DP soc handle
4312  * @pdev: DP pdev handle
4313  *
4314  * Return: void
4315  */
4316 static inline void
4317 dp_mon_rx_print_advanced_stats(struct dp_soc *soc,
4318 			       struct dp_pdev *pdev)
4319 {
4320 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
4321 	struct dp_mon_ops *monitor_ops;
4322 
4323 	if (!mon_soc) {
4324 		dp_mon_debug("mon soc is NULL");
4325 		return;
4326 	}
4327 
4328 	monitor_ops = mon_soc->mon_ops;
4329 	if (!monitor_ops ||
4330 	    !monitor_ops->mon_rx_print_advanced_stats) {
4331 		dp_mon_debug("callback not registered");
4332 		return;
4333 	}
4334 	return monitor_ops->mon_rx_print_advanced_stats(soc, pdev);
4335 }
4336 #endif /* _DP_MON_H_ */
4337