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