xref: /wlan-dirver/qca-wifi-host-cmn/dp/wifi3.0/monitor/dp_rx_mon.h (revision ccf6794c7efeda37a9772e5eb4d4dab2ab5af07a)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _DP_RX_MON_H_
20 #define _DP_RX_MON_H_
21 
22 #define dp_rx_mon_status_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_RX_MON_STATUS, params)
23 #define dp_rx_mon_status_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_RX_MON_STATUS, params)
24 #define dp_rx_mon_status_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_RX_MON_STATUS, params)
25 #define dp_rx_mon_status_info(params...) \
26 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX_MON_STATUS, ## params)
27 #define dp_rx_mon_status_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_RX_MON_STATUS, params)
28 
29 #define dp_rx_mon_dest_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_RX_MON_DEST, params)
30 #define dp_rx_mon_dest_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_RX_MON_DEST, params)
31 #define dp_rx_mon_dest_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_RX_MON_DEST, params)
32 #define dp_rx_mon_dest_info(params...) \
33 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX_MON_DEST, ## params)
34 #define dp_rx_mon_dest_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_RX_MON_DEST, params)
35 
36 /* The maximum buffer length allocated for radiotap for monitor status buffer */
37 #define MAX_MONITOR_HEADER (512)
38 
39 /**
40  * enum dp_mon_reap_status - monitor status ring ppdu status
41  *
42  * @DP_MON_STATUS_NO_DMA - DMA not done for status ring entry
43  * @DP_MON_STATUS_MATCH - status and dest ppdu id mathes
44  * @DP_MON_STATUS_LAG - status ppdu id is lagging
45  * @DP_MON_STATUS_LEAD - status ppdu id is leading
46  * @DP_MON_STATUS_REPLENISH - status ring entry is NULL
47  */
48 enum dp_mon_reap_status {
49 	DP_MON_STATUS_NO_DMA,
50 	DP_MON_STATUS_MATCH,
51 	DP_MON_STATUS_LAG,
52 	DP_MON_STATUS_LEAD,
53 	DP_MON_STATUS_REPLENISH
54 };
55 
56 /*
57  * dp_rx_mon_status_process() - Process monitor status ring and
58  *			TLV in status ring.
59  *
60  * @soc: core txrx main context
61  * @int_ctx: interrupt context
62  * @mac_id: mac_id which is one of 3 mac_ids
63  * @quota: No. of ring entry that can be serviced in one shot.
64 
65  * Return: uint32_t: No. of ring entry that is processed.
66  */
67 uint32_t
68 dp_rx_mon_status_process(struct dp_soc *soc, struct dp_intr *int_ctx,
69 			 uint32_t mac_id, uint32_t quota);
70 
71 /*
72  * dp_rx_populate_cbf_hdr - Send CBF frame with htt header
73  * @soc: Datapath soc handle
74  * @mac_id: Datapath mac id
75  * @event: WDI event
76  * @mpdu: mpdu buffer
77  * @msdu_timesstamp: time stamp
78  *
79  * Return: QDF_STATUS
80  */
81 QDF_STATUS dp_rx_populate_cbf_hdr(struct dp_soc *soc,
82 				  uint32_t mac_id, uint32_t event,
83 				  qdf_nbuf_t data, uint32_t msdu_timestamp);
84 
85 /**
86  * dp_rx_mon_handle_status_buf_done () - Handle DMA not done case for
87  * monitor status ring
88  *
89  * @pdev: DP pdev handle
90  * @mon_status_srng: Monitor status SRNG
91  *
92  * Return: enum dp_mon_reap_status
93  */
94 enum dp_mon_reap_status
95 dp_rx_mon_handle_status_buf_done(struct dp_pdev *pdev,
96 				 void *mon_status_srng);
97 
98 #ifdef QCA_SUPPORT_FULL_MON
99 
100 /**
101  * dp_full_mon_attach() - Full monitor mode attach
102  * This API initilises full monitor mode resources
103  *
104  * @pdev: dp pdev object
105  *
106  * Return: void
107  *
108  */
109 void dp_full_mon_attach(struct dp_pdev *pdev);
110 
111 /**
112  * dp_full_mon_detach() - Full monitor mode attach
113  * This API deinitilises full monitor mode resources
114  *
115  * @pdev: dp pdev object
116  *
117  * Return: void
118  *
119  */
120 void dp_full_mon_detach(struct dp_pdev *pdev);
121 
122 /**
123  * dp_rx_mon_process ()- API to process monitor destination ring for
124  * full monitor mode
125  *
126  * @soc: dp soc handle
127  * @int_ctx: interrupt context
128  * @mac_id: lmac id
129  * @quota: No. of ring entry that can be serviced in one shot.
130  */
131 
132 uint32_t dp_rx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
133 			   uint32_t mac_id, uint32_t quota);
134 
135 #else
136 /**
137  * dp_full_mon_attach() - attach full monitor mode resources
138  * @pdev: Datapath PDEV handle
139  *
140  * Return: void
141  */
142 static inline void dp_full_mon_attach(struct dp_pdev *pdev)
143 {
144 }
145 
146 /**
147  * dp_full_mon_detach() - detach full monitor mode resources
148  * @pdev: Datapath PDEV handle
149  *
150  * Return: void
151  *
152  */
153 static inline void dp_full_mon_detach(struct dp_pdev *pdev)
154 {
155 }
156 #endif
157 
158 /**
159  * dp_mon_link_free() - free monitor link desc pool
160  * @pdev: core txrx pdev context
161  *
162  * This function will release DP link desc pool for monitor mode from
163  * main device context.
164  *
165  * Return: QDF_STATUS_SUCCESS: success
166  *         QDF_STATUS_E_RESOURCES: Error return
167  */
168 QDF_STATUS dp_mon_link_free(struct dp_pdev *pdev);
169 
170 
171 /**
172  * dp_mon_process() - Main monitor mode processing roution.
173  * @soc: core txrx main context
174  * @int_ctx: interrupt context
175  * @mac_id: mac_id which is one of 3 mac_ids
176  * @quota: No. of status ring entry that can be serviced in one shot.
177  *
178  * This call monitor status ring process then monitor
179  * destination ring process.
180  * Called from the bottom half (tasklet/NET_RX_SOFTIRQ)
181  *
182  * Return: uint32_t: No. of ring entry that is processed.
183  */
184 uint32_t dp_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
185 			uint32_t mac_id, uint32_t quota);
186 
187 QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id,
188 	qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu);
189 /*
190  * dp_rx_mon_deliver_non_std() - deliver frames for non standard path
191  * @soc: core txrx main contex
192  * @mac_id: MAC ID
193  *
194  * This function delivers the radio tap and dummy MSDU
195  * into user layer application for preamble only PPDU.
196  *
197  * Return: Operation status
198  */
199 QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc, uint32_t mac_id);
200 
201 #ifndef REMOVE_MON_DBG_STATS
202 /*
203  * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count
204  * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
205  * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
206  *
207  * Update status ring PPDU start and end count. Keep track TLV state on
208  * PPDU start and end to find out if start and end is matching. Keep
209  * track missing PPDU start and end count. Keep track matching PPDU
210  * start and end count.
211  *
212  * Return: None
213  */
214 static inline void
215 dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
216 				struct cdp_pdev_mon_stats *rx_mon_stats)
217 {
218 	if (ppdu_info->rx_state ==
219 		HAL_RX_MON_PPDU_START) {
220 		rx_mon_stats->status_ppdu_start++;
221 		if (rx_mon_stats->status_ppdu_state
222 			!= CDP_MON_PPDU_END)
223 			rx_mon_stats->status_ppdu_end_mis++;
224 		rx_mon_stats->status_ppdu_state
225 			= CDP_MON_PPDU_START;
226 		ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET;
227 	} else if (ppdu_info->rx_state ==
228 		HAL_RX_MON_PPDU_END) {
229 		rx_mon_stats->status_ppdu_end++;
230 		if (rx_mon_stats->status_ppdu_state
231 			!= CDP_MON_PPDU_START)
232 			rx_mon_stats->status_ppdu_start_mis++;
233 		else
234 			rx_mon_stats->status_ppdu_compl++;
235 		rx_mon_stats->status_ppdu_state
236 			= CDP_MON_PPDU_END;
237 		ppdu_info->rx_state = HAL_RX_MON_PPDU_RESET;
238 	}
239 }
240 
241 /*
242  * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats
243  * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
244  * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
245  *
246  * Return: None
247  */
248 static inline void
249 dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
250 			      struct cdp_pdev_mon_stats *rx_mon_stats)
251 {
252 	ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
253 	rx_mon_stats->status_ppdu_state
254 		= CDP_MON_PPDU_END;
255 }
256 
257 #else
258 static inline void
259 dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
260 				struct cdp_pdev_mon_stats *rx_mon_stats)
261 {
262 }
263 
264 static inline void
265 dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
266 			      struct cdp_pdev_mon_stats *rx_mon_stats)
267 {
268 }
269 
270 #endif
271 
272 #ifdef QCA_ENHANCED_STATS_SUPPORT
273 void
274 dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
275 			     struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
276 
277 /*
278  * dp_rx_populate_su_evm_details() - Populate su evm info
279  * @ppdu_info: ppdu info structure from ppdu ring
280  * @cdp_rx_ppdu: rx ppdu indication structure
281  */
282 void
283 dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info,
284 			      struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
285 
286 /**
287 * dp_rx_handle_ppdu_stats() - Allocate and deliver ppdu stats to cdp layer
288 * @soc: core txrx main context
289 * @pdev: pdev strcuture
290 * @ppdu_info: structure for rx ppdu ring
291 *
292 * Return: none
293 */
294 void
295 dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
296 			struct hal_rx_ppdu_info *ppdu_info);
297 #else
298 static inline void
299 dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
300 			     struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
301 {
302 }
303 
304 static inline void
305 dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info,
306 			      struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
307 {
308 }
309 
310 static inline void
311 dp_rx_populate_cdp_indication_ppdu_user(struct dp_pdev *pdev,
312 					struct hal_rx_ppdu_info *ppdu_info,
313 					struct cdp_rx_indication_ppdu
314 					*cdp_rx_ppdu)
315 {
316 }
317 
318 static inline void
319 dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev,
320 				   struct hal_rx_ppdu_info *ppdu_info,
321 				   struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
322 {
323 }
324 
325 static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
326 					   struct cdp_rx_indication_ppdu *ppdu,
327 					   uint32_t user)
328 {
329 }
330 
331 static inline void
332 dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
333 			struct hal_rx_ppdu_info *ppdu_info)
334 {
335 }
336 #endif /* QCA_ENHANCED_STATS_SUPPORT */
337 
338 #ifdef QCA_MCOPY_SUPPORT
339 /**
340  * dp_rx_handle_mcopy_mode() - Allocate and deliver first MSDU payload
341  * @soc: core txrx main context
342  * @pdev: pdev structure
343  * @ppdu_info: structure for rx ppdu ring
344  * @nbuf: QDF nbuf
345  * @fcs_ok_mpdu_cnt: fcs passsed mpdu index
346  * @deliver_frame: flag to deliver wdi event
347  *
348  * Return: QDF_STATUS_SUCCESS - If nbuf to be freed by caller
349  *         QDF_STATUS_E_ALREADY - If nbuf not to be freed by caller
350  */
351 QDF_STATUS
352 dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
353 			struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf,
354 			uint8_t fcs_ok_mpdu_cnt, bool deliver_frame);
355 
356 /**
357  * dp_rx_mcopy_handle_last_mpdu() - cache and delive last MPDU header in a
358  * status buffer if MPDU end tlv is received in different buffer
359  * @soc: core txrx main context
360  * @pdev: pdev structure
361  * @ppdu_info: structure for rx ppdu ring
362  * @status_nbuf: QDF nbuf
363  *
364  * Return: void
365  */
366 void
367 dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev,
368 			     struct hal_rx_ppdu_info *ppdu_info,
369 			     qdf_nbuf_t status_nbuf);
370 
371 /**
372  * dp_rx_mcopy_process_ppdu_info() - update mcopy ppdu info
373  * @ppdu_info: structure for rx ppdu ring
374  * @tlv_status: processed TLV status
375  *
376  * Return: void
377  */
378 void
379 dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev,
380 			      struct hal_rx_ppdu_info *ppdu_info,
381 			      uint32_t tlv_status);
382 
383 void
384 dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
385 			 struct hal_rx_ppdu_info *ppdu_info,
386 			 uint32_t tlv_status,
387 			 qdf_nbuf_t status_nbuf);
388 #else
389 static inline QDF_STATUS
390 dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
391 			struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf,
392 			uint8_t fcs_ok_cnt, bool deliver_frame)
393 {
394 	return QDF_STATUS_SUCCESS;
395 }
396 
397 static inline void
398 dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev,
399 			     struct hal_rx_ppdu_info *ppdu_info,
400 			     qdf_nbuf_t status_nbuf)
401 {
402 }
403 
404 static inline void
405 dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev,
406 			      struct hal_rx_ppdu_info *ppdu_info,
407 			      uint32_t tlv_status)
408 {
409 }
410 
411 static inline void
412 dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
413 			 struct hal_rx_ppdu_info *ppdu_info,
414 			 uint32_t tlv_status,
415 			 qdf_nbuf_t status_nbuf)
416 {
417 }
418 #endif /* QCA_MCOPY_SUPPORT */
419 
420 /**
421  * dp_rx_handle_smart_mesh_mode() - Deliver header for smart mesh
422  * @soc: Datapath SOC handle
423  * @pdev: Datapath PDEV handle
424  * @ppdu_info: Structure for rx ppdu info
425  * @nbuf: Qdf nbuf abstraction for linux skb
426  *
427  * Return: 0 on success, 1 on failure
428  */
429 int
430 dp_rx_handle_smart_mesh_mode(struct dp_soc *soc, struct dp_pdev *pdev,
431 			      struct hal_rx_ppdu_info *ppdu_info,
432 			      qdf_nbuf_t nbuf);
433 /*
434  * dp_rx_nbuf_prepare() - prepare RX nbuf
435  * @soc: core txrx main context
436  * @pdev: core txrx pdev context
437  *
438  * This function alloc & map nbuf for RX dma usage, retry it if failed
439  * until retry times reaches max threshold or succeeded.
440  *
441  * Return: qdf_nbuf_t pointer if succeeded, NULL if failed.
442  */
443 qdf_nbuf_t
444 dp_rx_nbuf_prepare(struct dp_soc *soc, struct dp_pdev *pdev);
445 
446 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
447 
448 /*
449  * dp_rx_mon_handle_cfr_mu_info() - Gather macaddr and ast_index of peer(s) in
450  * the PPDU received, this will be used for correlation of CFR data captured
451  * for an UL-MU-PPDU
452  * @pdev: pdev ctx
453  * @ppdu_info: pointer to ppdu info structure populated from ppdu status TLVs
454  * @cdp_rx_ppdu: Rx PPDU indication structure
455  *
456  * Return: none
457  */
458 void
459 dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev,
460 			     struct hal_rx_ppdu_info *ppdu_info,
461 			     struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
462 
463 /*
464  * dp_rx_mon_populate_cfr_ppdu_info() - Populate cdp ppdu info from hal ppdu
465  * info
466  * @pdev: pdev ctx
467  * @ppdu_info: ppdu info structure from ppdu ring
468  * @cdp_rx_ppdu : Rx PPDU indication structure
469  *
470  * Return: none
471  */
472 void
473 dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev,
474 				 struct hal_rx_ppdu_info *ppdu_info,
475 				 struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
476 
477 /**
478  * dp_cfr_rcc_mode_status() - Return status of cfr rcc mode
479  * @pdev: pdev ctx
480  *
481  * Return: True or False
482  */
483 bool
484 dp_cfr_rcc_mode_status(struct dp_pdev *pdev);
485 
486 /*
487  * dp_rx_mon_populate_cfr_info() - Populate cdp ppdu info from hal cfr info
488  * @pdev: pdev ctx
489  * @ppdu_info: ppdu info structure from ppdu ring
490  * @cdp_rx_ppdu: Rx PPDU indication structure
491  *
492  * Return: none
493  */
494 void
495 dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev,
496 			    struct hal_rx_ppdu_info *ppdu_info,
497 			    struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
498 
499 /**
500  * dp_update_cfr_dbg_stats() - Increment RCC debug statistics
501  * @pdev: pdev structure
502  * @ppdu_info: structure for rx ppdu ring
503  *
504  * Return: none
505  */
506 void
507 dp_update_cfr_dbg_stats(struct dp_pdev *pdev,
508 			struct hal_rx_ppdu_info *ppdu_info);
509 
510 /*
511  * dp_rx_handle_cfr() - Gather cfr info from hal ppdu info
512  * @soc: core txrx main context
513  * @pdev: pdev ctx
514  * @ppdu_info: ppdu info structure from ppdu ring
515  *
516  * Return: none
517  */
518 void
519 dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev,
520 		 struct hal_rx_ppdu_info *ppdu_info);
521 
522 /**
523  * dp_rx_populate_cfr_non_assoc_sta() - Populate cfr ppdu info for PPDUs from
524  * non-associated stations
525  * @pdev: pdev ctx
526  * @ppdu_info: ppdu info structure from ppdu ring
527  * @cdp_rx_ppdu: Rx PPDU indication structure
528  *
529  * Return: none
530  */
531 void
532 dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev,
533 				 struct hal_rx_ppdu_info *ppdu_info,
534 				 struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
535 
536 #else
537 static inline void
538 dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev,
539 			     struct hal_rx_ppdu_info *ppdu_info,
540 			     struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
541 {
542 }
543 
544 static inline void
545 dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev,
546 				 struct hal_rx_ppdu_info *ppdu_info,
547 				 struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
548 {
549 }
550 
551 static inline void
552 dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev,
553 			    struct hal_rx_ppdu_info *ppdu_info,
554 			    struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
555 {
556 }
557 
558 static inline void
559 dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev,
560 		 struct hal_rx_ppdu_info *ppdu_info)
561 {
562 }
563 
564 static inline void
565 dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev,
566 				 struct hal_rx_ppdu_info *ppdu_info,
567 				 struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
568 {
569 }
570 
571 static inline void
572 dp_update_cfr_dbg_stats(struct dp_pdev *pdev,
573 			struct hal_rx_ppdu_info *ppdu_info)
574 {
575 }
576 
577 static inline bool
578 dp_cfr_rcc_mode_status(struct dp_pdev *pdev)
579 {
580 	return false;
581 }
582 #endif /* WLAN_CFR_ENABLE && WLAN_ENH_CFR_ENABLE */
583 
584 /*
585  * dp_rx_mon_deliver(): function to deliver packets to stack
586  * @soc: DP soc
587  * @mac_id: MAC ID
588  * @head_msdu: head of msdu list
589  * @tail_msdu: tail of msdu list
590  *
591  * Return: status: 0 - Success, non-zero: Failure
592  */
593 QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc,
594 			     uint32_t mac_id,
595 			     qdf_nbuf_t head_msdu,
596 			     qdf_nbuf_t tail_msdu);
597 
598 /**
599 * dp_rx_mon_deliver_non_std()
600 * @soc: core txrx main contex
601 * @mac_id: MAC ID
602 *
603 * This function delivers the radio tap and dummy MSDU
604 * into user layer application for preamble only PPDU.
605 *
606 * Return: QDF_STATUS
607 */
608 QDF_STATUS dp_rx_mon_deliver_non_std(struct dp_soc *soc,
609 				     uint32_t mac_id);
610 
611 #ifdef DP_RX_MON_MEM_FRAG
612 #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
613 	defined(WLAN_SUPPORT_RX_FLOW_TAG)
614 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc,
615 					     qdf_nbuf_t nbuf);
616 #else
617 static inline
618 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc,
619 					     qdf_nbuf_t nbuf)
620 {
621 }
622 #endif
623 #else
624 static inline
625 void dp_rx_mon_update_pf_tag_to_buf_headroom(struct dp_soc *soc,
626 					     qdf_nbuf_t nbuf)
627 {
628 }
629 #endif
630 
631 qdf_nbuf_t dp_rx_mon_restitch_mpdu(struct dp_soc *soc, uint32_t mac_id,
632 				   qdf_nbuf_t head_msdu, qdf_nbuf_t tail_msdu,
633 				   struct cdp_mon_status *rs);
634 
635 #ifdef DP_RX_MON_MEM_FRAG
636 /**
637  * dp_rx_mon_get_nbuf_80211_hdr() - Get 80211 hdr from nbuf
638  * @nbuf: qdf_nbuf_t
639  *
640  * This function must be called after moving radiotap header.
641  *
642  * Return: Ptr pointing to 80211 header or NULL.
643  */
644 static inline
645 qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf)
646 {
647 	/* Return NULL if nr_frag is Zero */
648 	if (!qdf_nbuf_get_nr_frags(nbuf))
649 		return NULL;
650 
651 	return qdf_nbuf_get_frag_addr(nbuf, 0);
652 }
653 #else
654 static inline
655 qdf_frag_t dp_rx_mon_get_nbuf_80211_hdr(qdf_nbuf_t nbuf)
656 {
657 	return qdf_nbuf_data(nbuf);
658 }
659 #endif
660 
661 /*
662  * dp_rx_mon_process_dest_pktlog(): function to log packet contents to
663  * pktlog buffer and send to pktlog module
664  * @soc: DP soc
665  * @mac_id: MAC ID
666  * @mpdu: MPDU buf
667  * Return: status: 0 - Success, non-zero: Failure
668  */
669 QDF_STATUS dp_rx_mon_process_dest_pktlog(struct dp_soc *soc,
670 					 uint32_t mac_id,
671 					 qdf_nbuf_t mpdu);
672 
673 #ifdef WLAN_TX_PKT_CAPTURE_ENH
674 void
675 dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev,
676 		     qdf_nbuf_t mon_mpdu);
677 #else
678 static inline void
679 dp_handle_tx_capture(struct dp_soc *soc, struct dp_pdev *pdev,
680 		     qdf_nbuf_t mon_mpdu)
681 {
682 }
683 #endif
684 
685 /**
686  * dp_rx_get_mon_desc_pool() - Return monitor descriptor pool
687  *			       based on target
688  * @soc: soc handle
689  * @mac_id: mac id number
690  * @pdev_id: pdev id number
691  *
692  * Return: descriptor pool address
693  */
694 static inline
695 struct rx_desc_pool *dp_rx_get_mon_desc_pool(struct dp_soc *soc,
696 					     uint8_t mac_id,
697 					     uint8_t pdev_id)
698 {
699 	if (soc->wlan_cfg_ctx->rxdma1_enable)
700 		return &soc->rx_desc_mon[mac_id];
701 
702 	return &soc->rx_desc_buf[pdev_id];
703 }
704 
705 /**
706  * dp_rx_process_peer_based_pktlog() - Process Rx pktlog if peer based
707  *                                     filtering enabled
708  * @soc: core txrx main context
709  * @ppdu_info: Structure for rx ppdu info
710  * @status_nbuf: Qdf nbuf abstraction for linux skb
711  * @pdev_id: mac_id/pdev_id correspondinggly for MCL and WIN
712  *
713  * Return: none
714  */
715 void
716 dp_rx_process_peer_based_pktlog(struct dp_soc *soc,
717 				struct hal_rx_ppdu_info *ppdu_info,
718 				qdf_nbuf_t status_nbuf, uint32_t pdev_id);
719 #endif /* _DP_RX_MON_H_ */
720