xref: /wlan-dirver/qca-wifi-host-cmn/dp/wifi3.0/monitor/1.0/dp_mon_filter_1.0.c (revision 70a19e16789e308182f63b15c75decec7bf0b342)
1 /*
2  * Copyright (c) 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 #include <hal_api.h>
19 #include <wlan_cfg.h>
20 #include "dp_types.h"
21 #include "dp_internal.h"
22 #include "dp_htt.h"
23 #include "dp_mon.h"
24 #include "dp_mon_filter.h"
25 
26 #include <dp_mon_1.0.h>
27 #include <dp_rx_mon_1.0.h>
28 #include <dp_mon_filter_1.0.h>
29 
30 #if defined(QCA_MCOPY_SUPPORT) || defined(ATH_SUPPORT_NAC_RSSI) \
31 	|| defined(ATH_SUPPORT_NAC) || defined(WLAN_RX_PKT_CAPTURE_ENH)
32 /**
33  * dp_mon_filter_check_co_exist() - Check the co-existing of the
34  * enabled modes.
35  * @pdev: DP pdev handle
36  *
37  * Return: QDF_STATUS
38  */
39 static QDF_STATUS dp_mon_filter_check_co_exist(struct dp_pdev *pdev)
40 {
41 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
42 	/*
43 	 * Check if the Rx Enhanced capture mode, monitor mode,
44 	 * smart_monitor_mode and mcopy mode can co-exist together.
45 	 */
46 	if ((mon_pdev->rx_enh_capture_mode != CDP_RX_ENH_CAPTURE_DISABLED) &&
47 	    ((mon_pdev->neighbour_peers_added && mon_pdev->mvdev) ||
48 		 mon_pdev->mcopy_mode)) {
49 		dp_mon_filter_err("%pK:Rx Capture mode can't exist with modes:\n"
50 				  "Smart Monitor Mode:%d\n"
51 				  "M_Copy Mode:%d", pdev->soc,
52 				  mon_pdev->neighbour_peers_added,
53 				  mon_pdev->mcopy_mode);
54 		return QDF_STATUS_E_FAILURE;
55 	}
56 
57 	/*
58 	 * Check if the monitor mode cannot co-exist with any other mode.
59 	 */
60 	if ((mon_pdev->mvdev && mon_pdev->monitor_configured) &&
61 	    (mon_pdev->mcopy_mode || mon_pdev->neighbour_peers_added)) {
62 		dp_mon_filter_err("%pK: Monitor mode can't exist with modes\n"
63 				  "M_Copy Mode:%d\n"
64 				  "Smart Monitor Mode:%d",
65 				  pdev->soc, mon_pdev->mcopy_mode,
66 				  mon_pdev->neighbour_peers_added);
67 		return QDF_STATUS_E_FAILURE;
68 	}
69 
70 	/*
71 	 * Check if the smart monitor mode can co-exist with any other mode
72 	 */
73 	if (mon_pdev->neighbour_peers_added &&
74 	    ((mon_pdev->mcopy_mode) || mon_pdev->monitor_configured)) {
75 		dp_mon_filter_err("%pk: Smart Monitor mode can't exist with modes\n"
76 				  "M_Copy Mode:%d\n"
77 				  "Monitor Mode:%d",
78 				  pdev->soc, mon_pdev->mcopy_mode,
79 			      mon_pdev->monitor_configured);
80 		return QDF_STATUS_E_FAILURE;
81 	}
82 
83 	/*
84 	 * Check if the m_copy, monitor mode and the smart_monitor_mode
85 	 * can co-exist together.
86 	 */
87 	if (mon_pdev->mcopy_mode &&
88 	    (mon_pdev->mvdev || mon_pdev->neighbour_peers_added)) {
89 		dp_mon_filter_err("%pK: mcopy mode can't exist with modes\n"
90 				  "Monitor Mode:%pK\n"
91 				  "Smart Monitor Mode:%d",
92 				  pdev->soc, mon_pdev->mvdev,
93 				  mon_pdev->neighbour_peers_added);
94 		return QDF_STATUS_E_FAILURE;
95 	}
96 
97 	/*
98 	 * Check if the Rx packet log lite or full can co-exist with
99 	 * the enable modes.
100 	 */
101 	if ((mon_pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) &&
102 	    !mon_pdev->rx_pktlog_cbf &&
103 	    (mon_pdev->mvdev || mon_pdev->monitor_configured)) {
104 		dp_mon_filter_err("%pK: Rx pktlog full/lite can't exist with modes\n"
105 				  "Monitor Mode:%d", pdev->soc,
106 				  mon_pdev->monitor_configured);
107 		return QDF_STATUS_E_FAILURE;
108 	}
109 	return QDF_STATUS_SUCCESS;
110 }
111 #else
112 static QDF_STATUS dp_mon_filter_check_co_exist(struct dp_pdev *pdev)
113 {
114 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
115 	/*
116 	 * Check if the Rx packet log lite or full can co-exist with
117 	 * the enable modes.
118 	 */
119 	if ((mon_pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED) &&
120 	    (mon_pdev->mvdev || mon_pdev->monitor_configured)) {
121 		 dp_mon_filter_err("%pK: Rx pktlog full/lite can't exist with modes\n"
122 				   "Monitor Mode:%d", pdev->soc,
123 				   mon_pdev->monitor_configured);
124 		return QDF_STATUS_E_FAILURE;
125 	}
126 
127 	return QDF_STATUS_SUCCESS;
128 }
129 #endif
130 
131 #ifdef QCA_ENHANCED_STATS_SUPPORT
132 void dp_mon_filter_setup_enhanced_stats_1_0(struct dp_pdev *pdev)
133 {
134 	struct dp_mon_filter filter = {0};
135 	enum dp_mon_filter_mode mode = DP_MON_FILTER_ENHACHED_STATS_MODE;
136 	enum dp_mon_filter_srng_type srng_type =
137 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
138 	struct dp_mon_pdev *mon_pdev;
139 
140 	if (!pdev) {
141 		dp_mon_filter_err("pdev Context is null");
142 		return;
143 	}
144 
145 	/* Enabled the filter */
146 	filter.valid = true;
147 
148 	mon_pdev = pdev->monitor_pdev;
149 	dp_mon_filter_set_status_cmn(mon_pdev, &filter);
150 
151 	filter.tlv_filter.enable_mo = 0;
152 	filter.tlv_filter.mo_mgmt_filter = 0;
153 	filter.tlv_filter.mo_ctrl_filter = 0;
154 	filter.tlv_filter.mo_data_filter = 0;
155 
156 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
157 	mon_pdev->filter[mode][srng_type] = filter;
158 }
159 
160 /**
161  * dp_mon_filter_reset_enhanced_stats() - Reset the enhanced stats filter
162  * @pdev: DP pdev handle
163  */
164 void dp_mon_filter_reset_enhanced_stats_1_0(struct dp_pdev *pdev)
165 {
166 	struct dp_mon_filter filter = {0};
167 	enum dp_mon_filter_mode mode = DP_MON_FILTER_ENHACHED_STATS_MODE;
168 	enum dp_mon_filter_srng_type srng_type =
169 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
170 	struct dp_mon_pdev *mon_pdev;
171 
172 	if (!pdev) {
173 		dp_mon_filter_err("pdev Context is null");
174 		return;
175 	}
176 
177 	mon_pdev = pdev->monitor_pdev;
178 	mon_pdev->filter[mode][srng_type] = filter;
179 }
180 #endif /* QCA_ENHANCED_STATS_SUPPORT */
181 
182 #ifdef QCA_UNDECODED_METADATA_SUPPORT
183 /**
184  * mon_filter_setup_undecoded_metadata_capture() - Setup undecoded frame
185  * capture phyrx aborted frame filter setup
186  * @pdev: DP pdev handle
187  */
188 void dp_mon_filter_setup_undecoded_metadata_capture_1_0(struct dp_pdev *pdev)
189 {
190 	struct dp_mon_filter filter = {0};
191 	enum dp_mon_filter_mode mode =
192 				DP_MON_FILTER_UNDECODED_METADATA_CAPTURE_MODE;
193 	enum dp_mon_filter_srng_type srng_type =
194 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
195 	struct dp_mon_pdev *mon_pdev;
196 
197 	if (!pdev) {
198 		dp_mon_filter_err("pdev Context is null");
199 		return;
200 	}
201 
202 	/* Enabled the filter */
203 	mon_pdev = pdev->monitor_pdev;
204 	if (mon_pdev->monitor_configured ||
205 	    mon_pdev->scan_spcl_vap_configured) {
206 		filter = mon_pdev->filter[DP_MON_FILTER_MONITOR_MODE][srng_type];
207 	} else if (mon_pdev->neighbour_peers_added) {
208 		filter = mon_pdev->filter[DP_MON_FILTER_SMART_MONITOR_MODE][srng_type];
209 	} else {
210 		dp_mon_filter_set_status_cmn(mon_pdev, &filter);
211 		filter.valid = true;
212 	}
213 
214 	/* Setup the filter to subscribe to FP PHY status tlv */
215 	filter.tlv_filter.fp_phy_err = 1;
216 	filter.tlv_filter.fp_phy_err_buf_src = SW2RXDMA_BUF_SOURCE_RING;
217 	filter.tlv_filter.fp_phy_err_buf_dest = RXDMA2SW_RING;
218 	filter.tlv_filter.phy_err_mask = mon_pdev->phyrx_error_mask;
219 	filter.tlv_filter.phy_err_mask_cont = mon_pdev->phyrx_error_mask_cont;
220 
221 	filter.tlv_filter.phy_err_filter_valid = 1;
222 
223 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
224 	mon_pdev->filter[mode][srng_type] = filter;
225 }
226 
227 /**
228  * mon_filter_reset_undecoded_metadata_capture() - Reset undecoded frame
229  * capture phyrx aborted frame filter
230  * @pdev: DP pdev handle
231  */
232 void dp_mon_filter_reset_undecoded_metadata_capture_1_0(struct dp_pdev *pdev)
233 {
234 	struct dp_mon_filter filter = {0};
235 	enum dp_mon_filter_mode mode =
236 				DP_MON_FILTER_UNDECODED_METADATA_CAPTURE_MODE;
237 	enum dp_mon_filter_srng_type srng_type =
238 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
239 	struct dp_mon_pdev *mon_pdev;
240 
241 	if (!pdev) {
242 		dp_mon_filter_err("pdev Context is null");
243 		return;
244 	}
245 	mon_pdev = pdev->monitor_pdev;
246 
247 	filter = mon_pdev->filter[mode][srng_type];
248 
249 	/* Reset the phy error and phy error mask */
250 	filter.tlv_filter.fp_phy_err = 0;
251 	filter.tlv_filter.fp_phy_err_buf_src = NO_BUFFER_RING;
252 	filter.tlv_filter.fp_phy_err_buf_dest = RXDMA_RELEASING_RING;
253 
254 	filter.tlv_filter.phy_err_mask = 0;
255 	filter.tlv_filter.phy_err_mask_cont = 0;
256 	mon_pdev->phyrx_error_mask = 0;
257 	mon_pdev->phyrx_error_mask_cont = 0;
258 
259 	filter.tlv_filter.phy_err_filter_valid = 1;
260 
261 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
262 	mon_pdev->filter[mode][srng_type] = filter;
263 }
264 #endif /* QCA_UNDECODED_METADATA_SUPPORT */
265 
266 #ifdef QCA_MCOPY_SUPPORT
267 #ifdef QCA_MONITOR_PKT_SUPPORT
268 static void dp_mon_filter_set_reset_mcopy_dest(struct dp_pdev *pdev,
269 					       struct dp_mon_filter *pfilter)
270 {
271 	struct dp_soc *soc = pdev->soc;
272 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
273 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MCOPY_MODE;
274 	enum dp_mon_filter_srng_type srng_type;
275 
276 	srng_type = ((soc->wlan_cfg_ctx->rxdma1_enable) ?
277 			DP_MON_FILTER_SRNG_TYPE_RXDMA_MON_BUF :
278 			DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF);
279 
280 	/* Set the filter */
281 	if (pfilter->valid) {
282 		dp_mon_filter_set_mon_cmn(mon_pdev, pfilter);
283 
284 		pfilter->tlv_filter.fp_data_filter = 0;
285 		pfilter->tlv_filter.mo_data_filter = 0;
286 
287 		dp_mon_filter_show_filter(mon_pdev, mode, pfilter);
288 		mon_pdev->filter[mode][srng_type] = *pfilter;
289 	} else /* Reset the filter */
290 		mon_pdev->filter[mode][srng_type] = *pfilter;
291 }
292 #else
293 static void dp_mon_filter_set_reset_mcopy_dest(struct dp_pdev *pdev,
294 					       struct dp_mon_filter *pfilter)
295 {
296 }
297 #endif
298 
299 void dp_mon_filter_setup_mcopy_mode_1_0(struct dp_pdev *pdev)
300 {
301 	struct dp_mon_filter filter = {0};
302 	struct dp_soc *soc = NULL;
303 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MCOPY_MODE;
304 	enum dp_mon_filter_srng_type srng_type =
305 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
306 	struct dp_mon_pdev *mon_pdev;
307 
308 	if (!pdev) {
309 		dp_mon_filter_err("pdev Context is null");
310 		return;
311 	}
312 
313 	soc = pdev->soc;
314 	if (!soc) {
315 		dp_mon_filter_err("Soc Context is null");
316 		return;
317 	}
318 
319 	mon_pdev = pdev->monitor_pdev;
320 	if (!mon_pdev) {
321 		dp_mon_filter_err("monitor pdev Context is null");
322 		return;
323 	}
324 	/* Enabled the filter */
325 	filter.valid = true;
326 	dp_mon_filter_set_reset_mcopy_dest(pdev, &filter);
327 
328 	/* Clear the filter as the same filter will be used to set the
329 	 * monitor status ring
330 	 */
331 	qdf_mem_zero(&(filter), sizeof(struct dp_mon_filter));
332 
333 	/* Enabled the filter */
334 	filter.valid = true;
335 	dp_mon_filter_set_status_cmn(mon_pdev, &filter);
336 
337 	/* Setup the filter */
338 	filter.tlv_filter.enable_mo = 1;
339 	filter.tlv_filter.packet_header = 1;
340 	filter.tlv_filter.mpdu_end = 1;
341 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
342 
343 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
344 	mon_pdev->filter[mode][srng_type] = filter;
345 }
346 
347 void dp_mon_filter_reset_mcopy_mode_1_0(struct dp_pdev *pdev)
348 {
349 	struct dp_mon_filter filter = {0};
350 	struct dp_soc *soc = NULL;
351 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MCOPY_MODE;
352 	enum dp_mon_filter_srng_type srng_type =
353 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
354 	struct dp_mon_pdev *mon_pdev;
355 
356 	if (!pdev) {
357 		dp_mon_filter_err("pdev Context is null");
358 		return;
359 	}
360 
361 	soc = pdev->soc;
362 	if (!soc) {
363 		dp_mon_filter_err("Soc Context is null");
364 		return;
365 	}
366 
367 	mon_pdev = pdev->monitor_pdev;
368 	dp_mon_filter_set_reset_mcopy_dest(pdev, &filter);
369 
370 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
371 	mon_pdev->filter[mode][srng_type] = filter;
372 }
373 #endif
374 
375 #if defined(ATH_SUPPORT_NAC_RSSI) || defined(ATH_SUPPORT_NAC)
376 /**
377  * dp_mon_filter_setup_smart_monitor() - Setup the smart monitor mode filter
378  * @pdev: DP pdev handle
379  */
380 void dp_mon_filter_setup_smart_monitor_1_0(struct dp_pdev *pdev)
381 {
382 	struct dp_mon_filter filter = {0};
383 	struct dp_soc *soc = NULL;
384 	struct dp_mon_soc *mon_soc;
385 
386 	enum dp_mon_filter_mode mode = DP_MON_FILTER_SMART_MONITOR_MODE;
387 	enum dp_mon_filter_srng_type srng_type =
388 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
389 	struct dp_mon_pdev *mon_pdev;
390 
391 	if (!pdev) {
392 		dp_mon_filter_err("pdev Context is null");
393 		return;
394 	}
395 
396 	soc = pdev->soc;
397 	if (!soc) {
398 		dp_mon_filter_err("Soc Context is null");
399 		return;
400 	}
401 
402 	mon_soc = soc->monitor_soc;
403 	mon_pdev = pdev->monitor_pdev;
404 
405 	/* Enabled the filter */
406 	filter.valid = true;
407 	dp_mon_filter_set_status_cmn(mon_pdev, &filter);
408 
409 	filter.tlv_filter.enable_mo = 0;
410 	filter.tlv_filter.mo_mgmt_filter = 0;
411 	filter.tlv_filter.mo_ctrl_filter = 0;
412 	filter.tlv_filter.mo_data_filter = 0;
413 
414 	if (mon_soc->hw_nac_monitor_support) {
415 		filter.tlv_filter.enable_md = 1;
416 		filter.tlv_filter.packet_header = 1;
417 		filter.tlv_filter.md_data_filter = FILTER_DATA_ALL;
418 	}
419 
420 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
421 	mon_pdev->filter[mode][srng_type] = filter;
422 }
423 
424 void dp_mon_filter_reset_smart_monitor_1_0(struct dp_pdev *pdev)
425 {
426 	struct dp_mon_filter filter = {0};
427 	enum dp_mon_filter_mode mode = DP_MON_FILTER_SMART_MONITOR_MODE;
428 	enum dp_mon_filter_srng_type srng_type =
429 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
430 	struct dp_mon_pdev *mon_pdev;
431 
432 	if (!pdev) {
433 		dp_mon_filter_err("pdev Context is null");
434 		return;
435 	}
436 
437 	mon_pdev = pdev->monitor_pdev;
438 	mon_pdev->filter[mode][srng_type] = filter;
439 }
440 #endif /* ATH_SUPPORT_NAC_RSSI || ATH_SUPPORT_NAC */
441 
442 #ifdef WLAN_RX_PKT_CAPTURE_ENH
443 #ifdef QCA_MONITOR_PKT_SUPPORT
444 static
445 void dp_mon_filter_set_reset_rx_enh_capture_dest(struct dp_pdev *pdev,
446 						 struct dp_mon_filter *pfilter)
447 {
448 	struct dp_soc *soc = pdev->soc;
449 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
450 	enum dp_mon_filter_mode mode = DP_MON_FILTER_RX_CAPTURE_MODE;
451 	enum dp_mon_filter_srng_type srng_type;
452 
453 	srng_type = ((soc->wlan_cfg_ctx->rxdma1_enable) ?
454 			DP_MON_FILTER_SRNG_TYPE_RXDMA_MON_BUF :
455 			DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF);
456 
457 	/* Set the filter */
458 	if (pfilter->valid) {
459 		dp_mon_filter_set_mon_cmn(mon_pdev, pfilter);
460 
461 		pfilter->tlv_filter.fp_mgmt_filter = 0;
462 		pfilter->tlv_filter.fp_ctrl_filter = 0;
463 		pfilter->tlv_filter.fp_data_filter = 0;
464 		pfilter->tlv_filter.mo_mgmt_filter = 0;
465 		pfilter->tlv_filter.mo_ctrl_filter = 0;
466 		pfilter->tlv_filter.mo_data_filter = 0;
467 
468 		dp_mon_filter_show_filter(mon_pdev, mode, pfilter);
469 		pdev->monitor_pdev->filter[mode][srng_type] = *pfilter;
470 	} else /* Reset the filter */
471 		pdev->monitor_pdev->filter[mode][srng_type] = *pfilter;
472 }
473 #else
474 static
475 void dp_mon_filter_set_reset_rx_enh_capture_dest(struct dp_pdev *pdev,
476 						 struct dp_mon_filter *pfilter)
477 {
478 }
479 #endif
480 
481 void dp_mon_filter_setup_rx_enh_capture_1_0(struct dp_pdev *pdev)
482 {
483 	struct dp_mon_filter filter = {0};
484 	struct dp_soc *soc = NULL;
485 	enum dp_mon_filter_mode mode = DP_MON_FILTER_RX_CAPTURE_MODE;
486 	enum dp_mon_filter_srng_type srng_type =
487 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
488 	struct dp_mon_pdev *mon_pdev;
489 
490 	if (!pdev) {
491 		dp_mon_filter_err("pdev Context is null");
492 		return;
493 	}
494 
495 	soc = pdev->soc;
496 	if (!soc) {
497 		dp_mon_filter_err("Soc Context is null");
498 		return;
499 	}
500 
501 	mon_pdev = pdev->monitor_pdev;
502 
503 	/* Enabled the filter */
504 	filter.valid = true;
505 	dp_mon_filter_set_reset_rx_enh_capture_dest(pdev, &filter);
506 
507 	/* Clear the filter as the same filter will be used to set the
508 	 * monitor status ring
509 	 */
510 	qdf_mem_zero(&(filter), sizeof(struct dp_mon_filter));
511 
512 	/* Enabled the filter */
513 	filter.valid = true;
514 	dp_mon_filter_set_status_cmn(mon_pdev, &filter);
515 
516 	/* Setup the filter */
517 	filter.tlv_filter.mpdu_end = 1;
518 	filter.tlv_filter.enable_mo = 1;
519 	filter.tlv_filter.packet_header = 1;
520 
521 	if (mon_pdev->rx_enh_capture_mode == CDP_RX_ENH_CAPTURE_MPDU) {
522 		filter.tlv_filter.header_per_msdu = 0;
523 		filter.tlv_filter.enable_mo = 0;
524 	} else if (mon_pdev->rx_enh_capture_mode ==
525 			CDP_RX_ENH_CAPTURE_MPDU_MSDU) {
526 		bool is_rx_mon_proto_flow_tag_enabled =
527 		wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(soc->wlan_cfg_ctx);
528 		filter.tlv_filter.header_per_msdu = 1;
529 		filter.tlv_filter.enable_mo = 0;
530 		if (mon_pdev->is_rx_enh_capture_trailer_enabled ||
531 		    is_rx_mon_proto_flow_tag_enabled)
532 			filter.tlv_filter.msdu_end = 1;
533 	}
534 
535 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
536 
537 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
538 	mon_pdev->filter[mode][srng_type] = filter;
539 }
540 
541 void dp_mon_filter_reset_rx_enh_capture_1_0(struct dp_pdev *pdev)
542 {
543 	struct dp_mon_filter filter = {0};
544 	struct dp_soc *soc = NULL;
545 	enum dp_mon_filter_mode mode = DP_MON_FILTER_RX_CAPTURE_MODE;
546 	enum dp_mon_filter_srng_type srng_type =
547 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
548 	struct dp_mon_pdev *mon_pdev;
549 
550 	if (!pdev) {
551 		dp_mon_filter_err("pdev Context is null");
552 		return;
553 	}
554 
555 	soc = pdev->soc;
556 	if (!soc) {
557 		dp_mon_filter_err("Soc Context is null");
558 		return;
559 	}
560 
561 	mon_pdev = pdev->monitor_pdev;
562 	dp_mon_filter_set_reset_rx_enh_capture_dest(pdev, &filter);
563 
564 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
565 	mon_pdev->filter[mode][srng_type] = filter;
566 }
567 #endif /* WLAN_RX_PKT_CAPTURE_ENH */
568 
569 #ifdef QCA_MONITOR_PKT_SUPPORT
570 static void dp_mon_filter_set_reset_mon_dest(struct dp_pdev *pdev,
571 					     struct dp_mon_filter *pfilter)
572 {
573 	struct dp_soc *soc = pdev->soc;
574 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
575 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
576 	enum dp_mon_filter_srng_type srng_type;
577 
578 	srng_type = ((soc->wlan_cfg_ctx->rxdma1_enable) ?
579 			DP_MON_FILTER_SRNG_TYPE_RXDMA_MON_BUF :
580 			DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF);
581 
582 	/* set the filter */
583 	if (pfilter->valid) {
584 		dp_mon_filter_set_mon_cmn(mon_pdev, pfilter);
585 
586 		dp_mon_filter_show_filter(mon_pdev, mode, pfilter);
587 		mon_pdev->filter[mode][srng_type] = *pfilter;
588 	} else /* reset the filter */
589 		mon_pdev->filter[mode][srng_type] = *pfilter;
590 }
591 #else
592 static void dp_mon_filter_set_reset_mon_dest(struct dp_pdev *pdev,
593 					     struct dp_mon_filter *pfilter)
594 {
595 }
596 #endif
597 
598 void dp_mon_filter_setup_mon_mode_1_0(struct dp_pdev *pdev)
599 {
600 	struct dp_mon_filter filter = {0};
601 	struct dp_soc *soc = NULL;
602 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
603 	enum dp_mon_filter_srng_type srng_type =
604 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
605 	struct dp_mon_pdev *mon_pdev;
606 
607 	if (!pdev) {
608 		dp_mon_filter_err("pdev Context is null");
609 		return;
610 	}
611 
612 	soc = pdev->soc;
613 	if (!soc) {
614 		dp_mon_filter_err("Soc Context is null");
615 		return;
616 	}
617 
618 	mon_pdev = pdev->monitor_pdev;
619 	filter.valid = true;
620 	dp_mon_filter_set_reset_mon_dest(pdev, &filter);
621 
622 	/* Clear the filter as the same filter will be used to set the
623 	 * monitor status ring
624 	 */
625 	qdf_mem_zero(&(filter), sizeof(struct dp_mon_filter));
626 
627 	/* Enabled the filter */
628 	filter.valid = true;
629 	dp_mon_filter_set_status_cmn(mon_pdev, &filter);
630 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
631 
632 	/* Store the above filter */
633 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
634 	mon_pdev->filter[mode][srng_type] = filter;
635 }
636 
637 void dp_mon_filter_reset_mon_mode_1_0(struct dp_pdev *pdev)
638 {
639 	struct dp_mon_filter filter = {0};
640 	struct dp_soc *soc = NULL;
641 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
642 	enum dp_mon_filter_srng_type srng_type =
643 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
644 	struct dp_mon_pdev *mon_pdev;
645 
646 	if (!pdev) {
647 		dp_mon_filter_err("pdev Context is null");
648 		return;
649 	}
650 
651 	soc = pdev->soc;
652 	if (!soc) {
653 		dp_mon_filter_err("Soc Context is null");
654 		return;
655 	}
656 
657 	mon_pdev = pdev->monitor_pdev;
658 	dp_mon_filter_set_reset_mon_dest(pdev, &filter);
659 
660 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
661 	mon_pdev->filter[mode][srng_type] = filter;
662 }
663 
664 static void dp_mon_set_reset_mon_filter(struct dp_mon_filter *filter, bool val)
665 {
666 	if (val) {
667 		dp_mon_filter_debug("Set monitor filter settings");
668 		filter->tlv_filter.enable_mon_mac_filter = 1;
669 		filter->tlv_filter.enable_md = 1;
670 		filter->tlv_filter.md_mgmt_filter = FILTER_MGMT_ALL;
671 		filter->tlv_filter.md_ctrl_filter = FILTER_CTRL_ALL;
672 		filter->tlv_filter.md_data_filter = 0;
673 	} else {
674 		dp_mon_filter_debug("Reset monitor filter settings");
675 		filter->tlv_filter.enable_mon_mac_filter = 0;
676 		filter->tlv_filter.enable_md = 0;
677 		filter->tlv_filter.md_mgmt_filter = 0;
678 		filter->tlv_filter.md_ctrl_filter = 0;
679 		filter->tlv_filter.md_data_filter = 0;
680 	}
681 }
682 
683 /**
684  * dp_mon_set_reset_mon_mac_filter_1_0() - Set/Reset monitor buffer and status
685  * filter
686  * @pdev: DP pdev handle
687  * @val: Set or reset the filter
688  *
689  * Return: void
690  */
691 void dp_mon_set_reset_mon_mac_filter_1_0(struct dp_pdev *pdev, bool val)
692 {
693 	struct dp_mon_filter filter = {0};
694 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
695 	enum dp_mon_filter_srng_type srng_type =
696 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
697 	struct dp_mon_pdev *mon_pdev;
698 
699 	if (!pdev) {
700 		dp_mon_filter_err("pdev Context is null");
701 		return;
702 	}
703 
704 	mon_pdev = pdev->monitor_pdev;
705 
706 	/* Set monitor buffer filter */
707 	dp_mon_filter_debug("Updating monitor buffer filter");
708 	filter.valid = true;
709 	dp_mon_set_reset_mon_filter(&filter, val);
710 	dp_mon_filter_set_reset_mon_dest(pdev, &filter);
711 
712 	/* Set status cmn filter */
713 	dp_mon_filter_debug("Updating monitor status cmn filter");
714 	qdf_mem_zero(&(filter), sizeof(struct dp_mon_filter));
715 	filter.valid = true;
716 	dp_mon_filter_set_status_cmn(mon_pdev, &filter);
717 	dp_mon_set_reset_mon_filter(&filter, val);
718 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
719 
720 	/* Store the above filter */
721 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
722 	mon_pdev->filter[mode][srng_type] = filter;
723 }
724 
725 #ifdef WDI_EVENT_ENABLE
726 void dp_mon_filter_setup_rx_pkt_log_full_1_0(struct dp_pdev *pdev)
727 {
728 	struct dp_mon_filter filter = {0};
729 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_FULL_MODE;
730 	enum dp_mon_filter_srng_type srng_type =
731 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
732 	struct dp_mon_pdev *mon_pdev;
733 
734 	if (!pdev) {
735 		dp_mon_filter_err("pdev Context is null");
736 		return;
737 	}
738 
739 	mon_pdev = pdev->monitor_pdev;
740 	/* Enabled the filter */
741 	filter.valid = true;
742 	dp_mon_filter_set_status_cmn(mon_pdev, &filter);
743 
744 	/* Setup the filter */
745 	filter.tlv_filter.packet_header = 1;
746 	filter.tlv_filter.msdu_start = 1;
747 	filter.tlv_filter.msdu_end = 1;
748 	filter.tlv_filter.mpdu_end = 1;
749 	filter.tlv_filter.attention = 1;
750 
751 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
752 	mon_pdev->filter[mode][srng_type] = filter;
753 }
754 
755 void dp_mon_filter_reset_rx_pkt_log_full_1_0(struct dp_pdev *pdev)
756 {
757 	struct dp_mon_filter filter = {0};
758 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_FULL_MODE;
759 	enum dp_mon_filter_srng_type srng_type =
760 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
761 	struct dp_mon_pdev *mon_pdev;
762 
763 	if (!pdev) {
764 		dp_mon_filter_err("pdev Context is null");
765 		return;
766 	}
767 
768 	mon_pdev = pdev->monitor_pdev;
769 	mon_pdev->filter[mode][srng_type] = filter;
770 }
771 
772 void dp_mon_filter_setup_rx_pkt_log_lite_1_0(struct dp_pdev *pdev)
773 {
774 	struct dp_mon_filter filter = {0};
775 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_LITE_MODE;
776 	enum dp_mon_filter_srng_type srng_type =
777 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
778 	struct dp_mon_pdev *mon_pdev;
779 
780 	if (!pdev) {
781 		dp_mon_filter_err("pdev Context is null");
782 		return;
783 	}
784 
785 	mon_pdev = pdev->monitor_pdev;
786 	/* Enabled the filter */
787 	filter.valid = true;
788 	dp_mon_filter_set_status_cmn(mon_pdev, &filter);
789 
790 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
791 	mon_pdev->filter[mode][srng_type] = filter;
792 }
793 
794 void dp_mon_filter_reset_rx_pkt_log_lite_1_0(struct dp_pdev *pdev)
795 {
796 	struct dp_mon_filter filter = {0};
797 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_LITE_MODE;
798 	enum dp_mon_filter_srng_type srng_type =
799 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
800 	struct dp_mon_pdev *mon_pdev;
801 
802 	if (!pdev) {
803 		dp_mon_filter_err("pdev Context is null");
804 		return;
805 	}
806 
807 	mon_pdev = pdev->monitor_pdev;
808 
809 	mon_pdev->filter[mode][srng_type] = filter;
810 }
811 
812 #ifdef QCA_MONITOR_PKT_SUPPORT
813 static
814 void dp_mon_filter_set_reset_rx_pkt_log_cbf_dest(struct dp_pdev *pdev,
815 						 struct dp_mon_filter *pfilter)
816 {
817 	struct dp_soc *soc = pdev->soc;
818 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
819 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_CBF_MODE;
820 	enum dp_mon_filter_srng_type srng_type;
821 
822 	srng_type = ((soc->wlan_cfg_ctx->rxdma1_enable) ?
823 			DP_MON_FILTER_SRNG_TYPE_RXDMA_MON_BUF :
824 			DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF);
825 
826 	/*set the filter */
827 	if (pfilter->valid) {
828 		dp_mon_filter_set_cbf_cmn(pdev, pfilter);
829 
830 		dp_mon_filter_show_filter(mon_pdev, mode, pfilter);
831 		mon_pdev->filter[mode][srng_type] = *pfilter;
832 	} else /* reset the filter */
833 		mon_pdev->filter[mode][srng_type] = *pfilter;
834 }
835 #else
836 static
837 void dp_mon_filter_set_reset_rx_pkt_log_cbf_dest(struct dp_pdev *pdev,
838 						 struct dp_mon_filter *pfilter)
839 {
840 }
841 #endif
842 
843 void dp_mon_filter_setup_rx_pkt_log_cbf_1_0(struct dp_pdev *pdev)
844 {
845 	struct dp_mon_filter filter = {0};
846 	struct dp_soc *soc = NULL;
847 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_CBF_MODE;
848 	enum dp_mon_filter_srng_type srng_type =
849 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
850 	struct dp_mon_pdev *mon_pdev = NULL;
851 
852 	if (!pdev) {
853 		dp_mon_filter_err("pdev Context is null");
854 		return;
855 	}
856 
857 	mon_pdev = pdev->monitor_pdev;
858 	soc = pdev->soc;
859 	if (!soc) {
860 		dp_mon_filter_err("Soc Context is null");
861 		return;
862 	}
863 
864 	/* Enabled the filter */
865 	filter.valid = true;
866 	dp_mon_filter_set_status_cbf(pdev, &filter);
867 	dp_mon_filter_show_filter(mon_pdev, mode, &filter);
868 	mon_pdev->filter[mode][srng_type] = filter;
869 
870 	/* Clear the filter as the same filter will be used to set the
871 	 * monitor status ring
872 	 */
873 	qdf_mem_zero(&(filter), sizeof(struct dp_mon_filter));
874 
875 	filter.valid = true;
876 	dp_mon_filter_set_reset_rx_pkt_log_cbf_dest(pdev, &filter);
877 }
878 
879 void dp_mon_filter_reset_rx_pktlog_cbf_1_0(struct dp_pdev *pdev)
880 {
881 	struct dp_mon_filter filter = {0};
882 	struct dp_soc *soc = NULL;
883 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_CBF_MODE;
884 	enum dp_mon_filter_srng_type srng_type =
885 				DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF;
886 	struct dp_mon_pdev *mon_pdev = NULL;
887 
888 	if (!pdev) {
889 		QDF_TRACE(QDF_MODULE_ID_MON_FILTER, QDF_TRACE_LEVEL_ERROR,
890 			  FL("pdev Context is null"));
891 		return;
892 	}
893 
894 	mon_pdev = pdev->monitor_pdev;
895 	soc = pdev->soc;
896 	if (!soc) {
897 		QDF_TRACE(QDF_MODULE_ID_MON_FILTER, QDF_TRACE_LEVEL_ERROR,
898 			  FL("Soc Context is null"));
899 		return;
900 	}
901 
902 	dp_mon_filter_set_reset_rx_pkt_log_cbf_dest(pdev, &filter);
903 
904 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS;
905 	mon_pdev->filter[mode][srng_type] = filter;
906 }
907 #endif /* WDI_EVENT_ENABLE */
908 
909 #ifdef WLAN_DP_RESET_MON_BUF_RING_FILTER
910 /**
911  * dp_mon_should_reset_buf_ring_filter() - Reset the monitor buf ring filter
912  * @pdev: DP PDEV handle
913  *
914  * WIN has targets which does not support monitor mode, but still do the
915  * monitor mode init/deinit, only the rxdma1_enable flag will be set to 0.
916  * MCL need to do the monitor buffer ring filter reset always, but this is
917  * not needed for WIN targets where rxdma1 is not enabled (the indicator
918  * that monitor mode is not enabled.
919  * This function is used as WAR till WIN cleans up the monitor mode
920  * function for targets where monitor mode is not enabled.
921  *
922  * Returns: true
923  */
924 static inline bool dp_mon_should_reset_buf_ring_filter(struct dp_pdev *pdev)
925 {
926 	return (pdev->monitor_pdev->mvdev) ? true : false;
927 }
928 #else
929 static inline bool dp_mon_should_reset_buf_ring_filter(struct dp_pdev *pdev)
930 {
931 	return false;
932 }
933 #endif
934 
935 #ifdef QCA_MONITOR_PKT_SUPPORT
936 static QDF_STATUS dp_mon_filter_dest_update(struct dp_pdev *pdev,
937 					    struct dp_mon_filter *pfilter,
938 					    bool *pmon_mode_set)
939 {
940 	struct dp_soc *soc = pdev->soc;
941 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
942 	enum dp_mon_filter_srng_type srng_type;
943 	QDF_STATUS status = QDF_STATUS_SUCCESS;
944 
945 	srng_type = ((soc->wlan_cfg_ctx->rxdma1_enable) ?
946 			DP_MON_FILTER_SRNG_TYPE_RXDMA_MON_BUF :
947 			DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF);
948 
949 	dp_mon_filter_h2t_setup(soc, pdev, srng_type, pfilter);
950 
951 	*pmon_mode_set = pfilter->valid;
952 	if (dp_mon_should_reset_buf_ring_filter(pdev) || *pmon_mode_set) {
953 		status = dp_mon_ht2_rx_ring_cfg(soc, pdev,
954 						srng_type,
955 						&pfilter->tlv_filter);
956 	} else {
957 		/*
958 		 * For WIN case the monitor buffer ring is used and it does need
959 		 * reset when monitor mode gets enabled/disabled.
960 		 */
961 		if (soc->wlan_cfg_ctx->rxdma1_enable) {
962 			if (mon_pdev->monitor_configured || *pmon_mode_set) {
963 				status = dp_mon_ht2_rx_ring_cfg(soc, pdev,
964 								srng_type,
965 								&pfilter->tlv_filter);
966 			}
967 		}
968 	}
969 
970 	return status;
971 }
972 
973 static void dp_mon_filter_dest_reset(struct dp_pdev *pdev)
974 {
975 	struct dp_soc *soc = pdev->soc;
976 	enum dp_mon_filter_srng_type srng_type;
977 
978 	srng_type = ((soc->wlan_cfg_ctx->rxdma1_enable) ?
979 			DP_MON_FILTER_SRNG_TYPE_RXDMA_MON_BUF :
980 			DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF);
981 
982 	dp_mon_filter_reset_mon_srng(soc, pdev, srng_type);
983 }
984 #else
985 static QDF_STATUS dp_mon_filter_dest_update(struct dp_pdev *pdev,
986 					    struct dp_mon_filter *pfilter,
987 					    bool *pmon_mode_set)
988 {
989 	return QDF_STATUS_SUCCESS;
990 }
991 
992 static void dp_mon_filter_dest_reset(struct dp_pdev *pdev)
993 {
994 }
995 #endif
996 
997 QDF_STATUS dp_mon_filter_update_1_0(struct dp_pdev *pdev)
998 {
999 	struct dp_soc *soc;
1000 	bool mon_mode_set = false;
1001 	struct dp_mon_filter filter = {0};
1002 	QDF_STATUS status = QDF_STATUS_SUCCESS;
1003 
1004 	if (!pdev) {
1005 		dp_mon_filter_err("pdev Context is null");
1006 		return QDF_STATUS_E_FAILURE;
1007 	}
1008 
1009 	soc = pdev->soc;
1010 	if (!soc) {
1011 		dp_mon_filter_err("Soc Context is null");
1012 		return QDF_STATUS_E_FAILURE;
1013 	}
1014 
1015 	status = dp_mon_filter_check_co_exist(pdev);
1016 	if (status != QDF_STATUS_SUCCESS)
1017 		return status;
1018 
1019 	/*
1020 	 * Setup the filters for the monitor destination ring.
1021 	 */
1022 	status = dp_mon_filter_dest_update(pdev, &filter,
1023 					   &mon_mode_set);
1024 
1025 	if (status != QDF_STATUS_SUCCESS) {
1026 		dp_mon_filter_err("%pK: Monitor destination ring filter setting failed",
1027 				  soc);
1028 		return QDF_STATUS_E_FAILURE;
1029 	}
1030 
1031 	/*
1032 	 * Setup the filters for the status ring.
1033 	 */
1034 	qdf_mem_zero(&(filter), sizeof(filter));
1035 	dp_mon_filter_h2t_setup(soc, pdev,
1036 				DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS,
1037 				&filter);
1038 
1039 	/*
1040 	 * Reset the monitor filters if the all the modes for the status rings
1041 	 * are disabled. This is done to prevent the HW backpressure from the
1042 	 * monitor destination ring in case the status ring filters
1043 	 * are not enabled.
1044 	 */
1045 	if (!filter.valid && mon_mode_set)
1046 		dp_mon_filter_dest_reset(pdev);
1047 
1048 	if (dp_mon_ht2_rx_ring_cfg(soc, pdev,
1049 				   DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS,
1050 				   &filter.tlv_filter) != QDF_STATUS_SUCCESS) {
1051 		dp_mon_filter_err("%pK: Monitor status ring filter setting failed",
1052 				  soc);
1053 		dp_mon_filter_dest_reset(pdev);
1054 		return QDF_STATUS_E_FAILURE;
1055 	}
1056 
1057 	return status;
1058 }
1059 
1060 #ifdef QCA_MAC_FILTER_FW_SUPPORT
1061 void dp_mon_mac_filter_set(uint32_t *msg_word,
1062 			   struct htt_rx_ring_tlv_filter *tlv_filter)
1063 {
1064 	if (!msg_word || !tlv_filter)
1065 		return;
1066 
1067 	if (tlv_filter->enable_mon_mac_filter > 0)
1068 		HTT_RX_RING_SELECTION_CFG_RXPCU_FILTER_SET(*msg_word, 1);
1069 	else
1070 		HTT_RX_RING_SELECTION_CFG_RXPCU_FILTER_SET(*msg_word, 0);
1071 }
1072 #endif
1073 
1074 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
1075 /*
1076  * dp_cfr_filter_1_0() -  Configure HOST RX monitor status ring for CFR
1077  *
1078  * @soc_hdl: Datapath soc handle
1079  * @pdev_id: id of data path pdev handle
1080  * @enable: Enable/Disable CFR
1081  * @filter_val: Flag to select Filter for monitor mode
1082  * @cfr_enable_monitor_mode: Flag to be enabled when scan radio is brought up
1083  * in special vap mode
1084  *
1085  * Return: void
1086  */
1087 static void dp_cfr_filter_1_0(struct cdp_soc_t *soc_hdl,
1088 			      uint8_t pdev_id,
1089 			      bool enable,
1090 			      struct cdp_monitor_filter *filter_val,
1091 			      bool cfr_enable_monitor_mode)
1092 {
1093 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
1094 	struct dp_pdev *pdev = NULL;
1095 	struct htt_rx_ring_tlv_filter htt_tlv_filter = {0};
1096 	int max_mac_rings;
1097 	uint8_t mac_id = 0;
1098 	struct dp_mon_pdev *mon_pdev;
1099 
1100 	pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
1101 	if (!pdev) {
1102 		dp_mon_err("pdev is NULL");
1103 		return;
1104 	}
1105 
1106 	mon_pdev = pdev->monitor_pdev;
1107 
1108 	if (mon_pdev->mvdev) {
1109 		if (enable && cfr_enable_monitor_mode)
1110 			pdev->cfr_rcc_mode = true;
1111 		else
1112 			pdev->cfr_rcc_mode = false;
1113 		return;
1114 	}
1115 
1116 	soc = pdev->soc;
1117 	pdev->cfr_rcc_mode = false;
1118 	max_mac_rings = wlan_cfg_get_num_mac_rings(pdev->wlan_cfg_ctx);
1119 	dp_update_num_mac_rings_for_dbs(soc, &max_mac_rings);
1120 
1121 	dp_mon_debug("Max_mac_rings %d", max_mac_rings);
1122 	dp_mon_info("enable : %d, mode: 0x%x", enable, filter_val->mode);
1123 
1124 	if (enable) {
1125 		pdev->cfr_rcc_mode = true;
1126 
1127 		htt_tlv_filter.ppdu_start = 1;
1128 		htt_tlv_filter.ppdu_end = 1;
1129 		htt_tlv_filter.ppdu_end_user_stats = 1;
1130 		htt_tlv_filter.ppdu_end_user_stats_ext = 1;
1131 		htt_tlv_filter.ppdu_end_status_done = 1;
1132 		htt_tlv_filter.mpdu_start = 1;
1133 		htt_tlv_filter.offset_valid = false;
1134 
1135 		htt_tlv_filter.enable_fp =
1136 			(filter_val->mode & MON_FILTER_PASS) ? 1 : 0;
1137 		htt_tlv_filter.enable_md = 0;
1138 		htt_tlv_filter.enable_mo =
1139 			(filter_val->mode & MON_FILTER_OTHER) ? 1 : 0;
1140 		htt_tlv_filter.fp_mgmt_filter = filter_val->fp_mgmt;
1141 		htt_tlv_filter.fp_ctrl_filter = filter_val->fp_ctrl;
1142 		htt_tlv_filter.fp_data_filter = filter_val->fp_data;
1143 		htt_tlv_filter.mo_mgmt_filter = filter_val->mo_mgmt;
1144 		htt_tlv_filter.mo_ctrl_filter = filter_val->mo_ctrl;
1145 		htt_tlv_filter.mo_data_filter = filter_val->mo_data;
1146 	}
1147 
1148 	for (mac_id = 0;
1149 	     mac_id  < soc->wlan_cfg_ctx->num_rxdma_status_rings_per_pdev;
1150 	     mac_id++) {
1151 		int mac_for_pdev =
1152 			dp_get_mac_id_for_pdev(mac_id, pdev->pdev_id);
1153 
1154 		htt_h2t_rx_ring_cfg(soc->htt_handle,
1155 				    mac_for_pdev,
1156 				    soc->rxdma_mon_status_ring[mac_id].hal_srng,
1157 				    RXDMA_MONITOR_STATUS,
1158 				    RX_MON_STATUS_BUF_SIZE,
1159 				    &htt_tlv_filter);
1160 	}
1161 }
1162 
1163 void dp_cfr_filter_register_1_0(struct cdp_ops *ops)
1164 {
1165 	ops->cfr_ops->txrx_cfr_filter = dp_cfr_filter_1_0;
1166 }
1167 #endif
1168