xref: /wlan-driver/qca-wifi-host-cmn/dp/wifi3.0/monitor/2.0/dp_mon_filter_2.0.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 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 "htt.h"
25 #include "htc_api.h"
26 #include "htc.h"
27 #include "htc_packet.h"
28 #include "dp_mon_filter.h"
29 #include <dp_mon_2.0.h>
30 #include <dp_rx_mon_2.0.h>
31 #include <dp_mon_filter_2.0.h>
32 #include <dp_be.h>
33 #ifdef QCA_SUPPORT_LITE_MONITOR
34 #include "dp_lite_mon.h"
35 #endif
36 
37 #define HTT_MSG_BUF_SIZE(msg_bytes) \
38    ((msg_bytes) + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING)
39 
dp_mon_filter_dealloc_2_0(struct dp_pdev * pdev)40 void dp_mon_filter_dealloc_2_0(struct dp_pdev *pdev)
41 {
42 	enum dp_mon_filter_mode mode;
43 	struct dp_mon_filter_be **mon_filter = NULL;
44 	struct dp_mon_pdev *mon_pdev = NULL;
45 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
46 
47 	if (!pdev) {
48 		dp_mon_filter_err("Pdev context is null");
49 		return;
50 	}
51 
52 	mon_pdev = pdev->monitor_pdev;
53 	if (!mon_pdev) {
54 		dp_mon_filter_err("Monitor pdev context is null");
55 		return;
56 	}
57 
58 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
59 	mon_filter = mon_pdev_be->filter_be;
60 	if (!mon_filter) {
61 		dp_mon_filter_err("Found NULL memory for the Monitor filter");
62 		return;
63 	}
64 
65 	for (mode = 0; mode < DP_MON_FILTER_MAX_MODE; mode++) {
66 		if (!mon_filter[mode])
67 			continue;
68 
69 		qdf_mem_free(mon_filter[mode]);
70 		mon_filter[mode] = NULL;
71 	}
72 
73 	qdf_mem_free(mon_filter);
74 	mon_pdev_be->filter_be = NULL;
75 }
76 
dp_mon_filter_alloc_2_0(struct dp_pdev * pdev)77 QDF_STATUS dp_mon_filter_alloc_2_0(struct dp_pdev *pdev)
78 {
79 	struct dp_mon_filter_be **mon_filter = NULL;
80 	enum dp_mon_filter_mode mode;
81 	struct dp_mon_pdev *mon_pdev = NULL;
82 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
83 
84 	if (!pdev) {
85 		dp_mon_filter_err("pdev Context is null");
86 		return QDF_STATUS_E_FAILURE;
87 	}
88 
89 	mon_pdev = pdev->monitor_pdev;
90 	if (!mon_pdev) {
91 		dp_mon_filter_err("Monitor pdev context is null");
92 		return QDF_STATUS_E_FAILURE;
93 	}
94 
95 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
96 
97 	mon_filter = (struct dp_mon_filter_be **)qdf_mem_malloc(
98 			(sizeof(struct dp_mon_filter_be *) *
99 			 DP_MON_FILTER_MAX_MODE));
100 	if (!mon_filter) {
101 		dp_mon_filter_err("Monitor filter mem allocation failed");
102 		return QDF_STATUS_E_NOMEM;
103 	}
104 
105 	qdf_mem_zero(mon_filter,
106 		     sizeof(struct dp_mon_filter_be *) * DP_MON_FILTER_MAX_MODE);
107 
108 	for (mode = 0; mode < DP_MON_FILTER_MAX_MODE; mode++) {
109 		mon_filter[mode] = qdf_mem_malloc(sizeof(struct dp_mon_filter_be) *
110 						  DP_MON_FILTER_SRNG_TYPE_MAX);
111 		mon_pdev_be->filter_be = mon_filter;
112 		if (!mon_filter[mode])
113 			goto fail;
114 	}
115 
116 	return QDF_STATUS_SUCCESS;
117 fail:
118 	dp_mon_filter_dealloc(mon_pdev);
119 	return QDF_STATUS_E_FAILURE;
120 }
121 
dp_rx_mon_packet_length_set(uint32_t * msg_word,struct htt_rx_ring_tlv_filter * tlv_filter)122 void dp_rx_mon_packet_length_set(uint32_t *msg_word,
123 				 struct htt_rx_ring_tlv_filter *tlv_filter)
124 {
125 	if (!msg_word || !tlv_filter)
126 		return;
127 
128 	HTT_RX_RING_SELECTION_CFG_CONFIG_LENGTH_MGMT_SET(*msg_word,
129 							 tlv_filter->mgmt_dma_length);
130 	HTT_RX_RING_SELECTION_CFG_CONFIG_LENGTH_CTRL_SET(*msg_word,
131 							 tlv_filter->ctrl_dma_length);
132 	HTT_RX_RING_SELECTION_CFG_CONFIG_LENGTH_DATA_SET(*msg_word,
133 							 tlv_filter->data_dma_length);
134 }
135 
dp_rx_mon_enable_set(uint32_t * msg_word,struct htt_rx_ring_tlv_filter * tlv_filter)136 void dp_rx_mon_enable_set(uint32_t *msg_word,
137 			  struct htt_rx_ring_tlv_filter *tlv_filter)
138 {
139 	if (!msg_word || !tlv_filter)
140 		return;
141 
142 	HTT_RX_RING_SELECTION_CFG_RX_MON_GLOBAL_EN_SET(*msg_word,
143 						       tlv_filter->enable);
144 }
145 
dp_rx_mon_enable_mpdu_logging(uint32_t * msg_word,struct htt_rx_ring_tlv_filter * tlv_filter)146 void dp_rx_mon_enable_mpdu_logging(uint32_t *msg_word,
147 				   struct htt_rx_ring_tlv_filter *tlv_filter)
148 {
149 	if (!msg_word || !tlv_filter)
150 		return;
151 
152 	if (tlv_filter->mgmt_dma_length) {
153 		HTT_RX_RING_SELECTION_CFG_PKT_TYPE_ENABLE_MSDU_MPDU_LOGGING_SET(*msg_word, 1);
154 		HTT_RX_RING_SELECTION_CFG_DMA_MPDU_MGMT_SET(*msg_word, tlv_filter->mgmt_mpdu_log);
155 	}
156 
157 	if (tlv_filter->ctrl_dma_length) {
158 		HTT_RX_RING_SELECTION_CFG_PKT_TYPE_ENABLE_MSDU_MPDU_LOGGING_SET(*msg_word, 2);
159 		HTT_RX_RING_SELECTION_CFG_DMA_MPDU_CTRL_SET(*msg_word, tlv_filter->ctrl_mpdu_log);
160 	}
161 
162 	if (tlv_filter->data_dma_length) {
163 		HTT_RX_RING_SELECTION_CFG_PKT_TYPE_ENABLE_MSDU_MPDU_LOGGING_SET(*msg_word, 4);
164 		HTT_RX_RING_SELECTION_CFG_DMA_MPDU_DATA_SET(*msg_word, tlv_filter->data_mpdu_log);
165 	}
166 }
167 
168 void
dp_rx_mon_word_mask_subscribe(struct dp_soc * soc,uint32_t * msg_word,int pdev_id,struct htt_rx_ring_tlv_filter * tlv_filter)169 dp_rx_mon_word_mask_subscribe(struct dp_soc *soc,
170 			      uint32_t *msg_word, int pdev_id,
171 			      struct htt_rx_ring_tlv_filter *tlv_filter)
172 {
173 	struct dp_pdev *pdev;
174 	struct dp_mon_pdev *mon_pdev;
175 
176 	if (!msg_word || !tlv_filter)
177 		return;
178 
179 	if (!tlv_filter->enable)
180 		return;
181 
182 	pdev = soc->pdev_list[pdev_id];
183 	mon_pdev = pdev->monitor_pdev;
184 
185 	if (mon_pdev->rx_pktlog_mode != DP_RX_PKTLOG_DISABLED)
186 		return;
187 
188 	HTT_RX_RING_SELECTION_CFG_WORD_MASK_COMPACTION_ENABLE_SET(*msg_word, 1);
189 
190 	/* word 14 */
191 	msg_word += 3;
192 	*msg_word = 0;
193 
194 	HTT_RX_RING_SELECTION_CFG_RX_MPDU_START_WORD_MASK_SET(
195 				*msg_word,
196 				RX_MON_MPDU_START_WMASK);
197 
198 	HTT_RX_RING_SELECTION_CFG_RX_MPDU_END_WORD_MASK_SET(
199 				*msg_word,
200 				RX_MON_MPDU_END_WMASK);
201 
202 	/* word 15 */
203 	msg_word++;
204 	*msg_word = 0;
205 	HTT_RX_RING_SELECTION_CFG_RX_MSDU_END_WORD_MASK_SET(
206 				*msg_word,
207 				RX_MON_MSDU_END_WMASK);
208 
209 	/* word 16 */
210 	msg_word++;
211 	/* word 17 */
212 	msg_word++;
213 	*msg_word = 0;
214 	HTT_RX_RING_SELECTION_CFG_RX_MPDU_START_WORD_MASK_V2_SET(
215 				*msg_word,
216 				RX_MON_MPDU_START_WMASK_V2);
217 
218 	HTT_RX_RING_SELECTION_CFG_RX_MPDU_END_WORD_MASK_V2_SET(
219 				*msg_word,
220 				RX_MON_MPDU_END_WMASK_V2);
221 
222 	/* word 18 */
223 	msg_word++;
224 	*msg_word = 0;
225 	HTT_RX_RING_SELECTION_CFG_RX_MSDU_END_WORD_MASK_V2_SET(
226 				*msg_word,
227 				RX_MON_MSDU_END_WMASK);
228 	/* word 19 */
229 	msg_word++;
230 	*msg_word = 0;
231 	HTT_RX_RING_SELECTION_CFG_RX_PPDU_END_USR_STATS_WORD_MASK_V2_SET(
232 				*msg_word,
233 				RX_MON_PPDU_END_USR_STATS_WMASK);
234 }
235 
236 void
dp_rx_mon_pkt_tlv_offset_subscribe(uint32_t * msg_word,struct htt_rx_ring_tlv_filter * tlv_filter)237 dp_rx_mon_pkt_tlv_offset_subscribe(uint32_t *msg_word,
238 				   struct htt_rx_ring_tlv_filter *tlv_filter)
239 {
240 	if (!msg_word || !tlv_filter)
241 		return;
242 
243 	/* word 16 */
244 	*msg_word = 0;
245 	if (tlv_filter->rx_pkt_tlv_offset) {
246 		HTT_RX_RING_SELECTION_CFG_ENABLE_RX_PKT_TLV_OFFSET_SET(*msg_word, 1);
247 		HTT_RX_RING_SELECTION_CFG_RX_PKT_TLV_OFFSET_SET(*msg_word,
248 								tlv_filter->rx_pkt_tlv_offset);
249 	}
250 
251 }
252 
253 void
dp_rx_mon_enable_fpmo(uint32_t * msg_word,struct htt_rx_ring_tlv_filter * tlv_filter)254 dp_rx_mon_enable_fpmo(uint32_t *msg_word,
255 		      struct htt_rx_ring_tlv_filter *tlv_filter)
256 {
257 	if (!msg_word || !tlv_filter)
258 		return;
259 
260 	if (tlv_filter->enable_fpmo) {
261 		/* TYPE: MGMT */
262 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
263 			FPMO, MGMT, 0000,
264 			(tlv_filter->fpmo_mgmt_filter &
265 			FILTER_MGMT_ASSOC_REQ) ? 1 : 0);
266 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
267 			FPMO, MGMT, 0001,
268 			(tlv_filter->fpmo_mgmt_filter &
269 			FILTER_MGMT_ASSOC_RES) ? 1 : 0);
270 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
271 			FPMO, MGMT, 0010,
272 			(tlv_filter->fpmo_mgmt_filter &
273 			FILTER_MGMT_REASSOC_REQ) ? 1 : 0);
274 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
275 			FPMO, MGMT, 0011,
276 			(tlv_filter->fpmo_mgmt_filter &
277 			FILTER_MGMT_REASSOC_RES) ? 1 : 0);
278 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
279 			FPMO, MGMT, 0100,
280 			(tlv_filter->fpmo_mgmt_filter &
281 			FILTER_MGMT_PROBE_REQ) ? 1 : 0);
282 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
283 			FPMO, MGMT, 0101,
284 			(tlv_filter->fpmo_mgmt_filter &
285 			FILTER_MGMT_PROBE_RES) ? 1 : 0);
286 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
287 			FPMO, MGMT, 0110,
288 			(tlv_filter->fpmo_mgmt_filter &
289 			FILTER_MGMT_TIM_ADVT) ? 1 : 0);
290 		/* reserved */
291 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
292 			FPMO, MGMT, 0111,
293 			(tlv_filter->fpmo_mgmt_filter &
294 			FILTER_MGMT_RESERVED_7) ? 1 : 0);
295 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
296 			FPMO, MGMT, 1000,
297 			(tlv_filter->fpmo_mgmt_filter &
298 			FILTER_MGMT_BEACON) ? 1 : 0);
299 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
300 			FPMO, MGMT, 1001,
301 			(tlv_filter->fpmo_mgmt_filter &
302 			FILTER_MGMT_ATIM) ? 1 : 0);
303 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
304 			FPMO, MGMT, 1010,
305 			(tlv_filter->fpmo_mgmt_filter &
306 			FILTER_MGMT_DISASSOC) ? 1 : 0);
307 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
308 			FPMO, MGMT, 1011,
309 			(tlv_filter->fpmo_mgmt_filter &
310 			FILTER_MGMT_AUTH) ? 1 : 0);
311 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
312 			FPMO, MGMT, 1100,
313 			(tlv_filter->fpmo_mgmt_filter &
314 			FILTER_MGMT_DEAUTH) ? 1 : 0);
315 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
316 			FPMO, MGMT, 1101,
317 			(tlv_filter->fpmo_mgmt_filter &
318 			FILTER_MGMT_ACTION) ? 1 : 0);
319 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
320 			FPMO, MGMT, 1110,
321 			(tlv_filter->fpmo_mgmt_filter &
322 			FILTER_MGMT_ACT_NO_ACK) ? 1 : 0);
323 		/* reserved*/
324 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
325 			FPMO, MGMT, 1111,
326 			(tlv_filter->fpmo_mgmt_filter &
327 			FILTER_MGMT_RESERVED_15) ? 1 : 0);
328 
329 		/* TYPE: CTRL */
330 		/* reserved */
331 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
332 			FPMO, CTRL, 0000,
333 			(tlv_filter->fpmo_ctrl_filter &
334 			FILTER_CTRL_RESERVED_1) ? 1 : 0);
335 		/* reserved */
336 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
337 			FPMO, CTRL, 0001,
338 			(tlv_filter->fpmo_ctrl_filter &
339 			FILTER_CTRL_RESERVED_2) ? 1 : 0);
340 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
341 			FPMO, CTRL, 0010,
342 			(tlv_filter->fpmo_ctrl_filter &
343 			FILTER_CTRL_TRIGGER) ? 1 : 0);
344 		/* reserved */
345 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
346 			FPMO, CTRL, 0011,
347 			(tlv_filter->fpmo_ctrl_filter &
348 			FILTER_CTRL_RESERVED_4) ? 1 : 0);
349 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
350 			FPMO, CTRL, 0100,
351 			(tlv_filter->fpmo_ctrl_filter &
352 			FILTER_CTRL_BF_REP_POLL) ? 1 : 0);
353 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
354 			FPMO, CTRL, 0101,
355 			(tlv_filter->fpmo_ctrl_filter &
356 			FILTER_CTRL_VHT_NDP) ? 1 : 0);
357 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
358 			FPMO, CTRL, 0110,
359 			(tlv_filter->fpmo_ctrl_filter &
360 			FILTER_CTRL_FRAME_EXT) ? 1 : 0);
361 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
362 			FPMO, CTRL, 0111,
363 			(tlv_filter->fpmo_ctrl_filter &
364 			FILTER_CTRL_CTRLWRAP) ? 1 : 0);
365 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
366 			FPMO, CTRL, 1000,
367 			(tlv_filter->fpmo_ctrl_filter &
368 			FILTER_CTRL_BA_REQ) ? 1 : 0);
369 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
370 			FPMO, CTRL, 1001,
371 			(tlv_filter->fpmo_ctrl_filter &
372 			FILTER_CTRL_BA) ? 1 : 0);
373 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
374 			FPMO, CTRL, 1010,
375 			(tlv_filter->fpmo_ctrl_filter &
376 			FILTER_CTRL_PSPOLL) ? 1 : 0);
377 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
378 			FPMO, CTRL, 1011,
379 			(tlv_filter->fpmo_ctrl_filter &
380 			FILTER_CTRL_RTS) ? 1 : 0);
381 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
382 			FPMO, CTRL, 1100,
383 			(tlv_filter->fpmo_ctrl_filter &
384 			FILTER_CTRL_CTS) ? 1 : 0);
385 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
386 			FPMO, CTRL, 1101,
387 			(tlv_filter->fpmo_ctrl_filter &
388 			FILTER_CTRL_ACK) ? 1 : 0);
389 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
390 			FPMO, CTRL, 1110,
391 			(tlv_filter->fpmo_ctrl_filter &
392 			FILTER_CTRL_CFEND) ? 1 : 0);
393 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG0,
394 			FPMO, CTRL, 1111,
395 			(tlv_filter->fpmo_ctrl_filter &
396 			FILTER_CTRL_CFEND_CFACK) ? 1 : 0);
397 
398 		/* word 21 */
399 		msg_word++;
400 		*msg_word = 0;
401 
402 		/* TYPE: DATA */
403 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
404 			FPMO, DATA, MCAST,
405 			(tlv_filter->fpmo_data_filter &
406 			FILTER_DATA_MCAST) ? 1 : 0);
407 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
408 			FPMO, DATA, UCAST,
409 			(tlv_filter->fpmo_data_filter &
410 			FILTER_DATA_UCAST) ? 1 : 0);
411 		htt_rx_ring_pkt_enable_subtype_set(*msg_word, FLAG1,
412 			FPMO, DATA, NULL,
413 			(tlv_filter->fpmo_data_filter &
414 			FILTER_DATA_NULL) ? 1 : 0);
415 
416 	} else {
417 		/* clear word 21 if fpmo is disabled
418 		 * word 20 is already cleared by caller
419 		 */
420 
421 		/* word 21 */
422 		msg_word++;
423 		*msg_word = 0;
424 	}
425 }
426 
427 #ifdef WLAN_PKT_CAPTURE_TX_2_0
428 static void
htt_tx_tlv_filter_mask_set_in0(uint32_t * msg_word,struct htt_tx_ring_tlv_filter * htt_tlv_filter)429 htt_tx_tlv_filter_mask_set_in0(uint32_t *msg_word,
430 			       struct htt_tx_ring_tlv_filter *htt_tlv_filter)
431 {
432 	struct dp_tx_mon_downstream_tlv_config *tlv = &htt_tlv_filter->dtlvs;
433 
434 	if (tlv->tx_fes_setup)
435 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
436 							 TX_FES_SETUP,
437 							 tlv->tx_fes_setup);
438 
439 	if (tlv->tx_peer_entry)
440 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
441 							 TX_PEER_ENTRY,
442 							 tlv->tx_peer_entry);
443 
444 	if (tlv->tx_queue_extension)
445 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
446 							 TX_QUEUE_EXTENSION,
447 							 tlv->tx_queue_extension);
448 
449 	if (tlv->tx_last_mpdu_end)
450 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
451 							 TX_LAST_MPDU_END,
452 							 tlv->tx_last_mpdu_end);
453 
454 	if (tlv->tx_last_mpdu_fetched)
455 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
456 							 TX_LAST_MPDU_FETCHED,
457 							 tlv->tx_last_mpdu_fetched);
458 
459 	if (tlv->tx_data_sync)
460 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
461 							 TX_DATA_SYNC,
462 							 tlv->tx_data_sync);
463 
464 	if (tlv->pcu_ppdu_setup_init)
465 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
466 							 PCU_PPDU_SETUP_INIT,
467 							 tlv->pcu_ppdu_setup_init);
468 
469 	if (tlv->fw2s_mon)
470 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
471 							 FW2SW_MON,
472 							 tlv->fw2s_mon);
473 
474 	if (tlv->tx_loopback_setup)
475 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
476 							 TX_LOOPBACK_SETUP,
477 							 tlv->tx_loopback_setup);
478 
479 	if (tlv->sch_critical_tlv_ref)
480 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
481 							 SCH_CRITICAL_TLV_REFERENCE,
482 							 tlv->sch_critical_tlv_ref);
483 
484 	if (tlv->ndp_preamble_done)
485 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
486 							 NDP_PREAMBLE_DONE,
487 							 tlv->ndp_preamble_done);
488 
489 	if (tlv->tx_raw_frame_setup)
490 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
491 							 TX_RAW_OR_NATIVE_FRAME_SETUP,
492 							 tlv->tx_raw_frame_setup);
493 
494 	if (tlv->txpcu_user_setup)
495 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
496 							 TXPCU_USER_SETUP,
497 							 tlv->txpcu_user_setup);
498 
499 	if (tlv->rxpcu_setup)
500 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
501 							 RXPCU_SETUP,
502 							 tlv->rxpcu_setup);
503 
504 	if (tlv->rxpcu_setup_complete)
505 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
506 							 RXPCU_SETUP_COMPLETE,
507 							 tlv->rxpcu_setup_complete);
508 
509 	if (tlv->coex_tx_req)
510 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
511 							 COEX_TX_REQ,
512 							 tlv->coex_tx_req);
513 
514 	if (tlv->rxpcu_user_setup)
515 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
516 							 RXPCU_USER_SETUP,
517 							 tlv->rxpcu_user_setup);
518 
519 	if (tlv->rxpcu_user_setup_ext)
520 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
521 							 RXPCU_USER_SETUP_EXT,
522 							 tlv->rxpcu_user_setup_ext);
523 
524 	if (tlv->wur_data)
525 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
526 							 TX_WUR_DATA,
527 							 tlv->wur_data);
528 
529 	if (tlv->tqm_mpdu_global_start)
530 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
531 							 TQM_MPDU_GLOBAL_START,
532 							 tlv->tqm_mpdu_global_start);
533 
534 	if (tlv->tx_fes_setup_complete)
535 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
536 							 TX_FES_SETUP_COMPLETE,
537 							 tlv->tx_fes_setup_complete);
538 
539 	if (tlv->scheduler_end)
540 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
541 							 SCHEDULER_END,
542 							 tlv->scheduler_end);
543 
544 	if (tlv->sch_wait_instr_tx_path)
545 		htt_tx_monitor_tlv_filter_in0_enable_set(*msg_word,
546 							 SCH_WAIT_INSTR_TX_PATH,
547 							 tlv->sch_wait_instr_tx_path);
548 }
549 
550 static void
htt_tx_tlv_filter_mask_set_in1(uint32_t * msg_word,struct htt_tx_ring_tlv_filter * htt_tlv_filter)551 htt_tx_tlv_filter_mask_set_in1(uint32_t *msg_word,
552 			       struct htt_tx_ring_tlv_filter *htt_tlv_filter)
553 {
554 	struct dp_tx_mon_upstream_tlv_config *tlv = &htt_tlv_filter->utlvs;
555 
556 	if (tlv->rx_response_required_info)
557 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
558 							 RX_RESPONSE_REQUIRED_INFO,
559 							 tlv->rx_response_required_info);
560 
561 	if (tlv->response_start_status)
562 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
563 							 RESPONSE_START_STATUS,
564 							 tlv->response_start_status);
565 
566 	if (tlv->response_end_status)
567 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
568 							 RESPONSE_END_STATUS,
569 							 tlv->response_end_status);
570 
571 	if (tlv->tx_fes_status_start)
572 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
573 							 TX_FES_STATUS_START,
574 							 tlv->tx_fes_status_start);
575 
576 	if (tlv->tx_fes_status_end)
577 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
578 							 TX_FES_STATUS_END,
579 							 tlv->tx_fes_status_end);
580 
581 	if (tlv->tx_fes_status_start_ppdu)
582 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
583 							 TX_FES_STATUS_START_PPDU,
584 							 tlv->tx_fes_status_start_ppdu);
585 
586 	if (tlv->tx_fes_status_user_ppdu)
587 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
588 							 TX_FES_STATUS_USER_PPDU,
589 							 tlv->tx_fes_status_user_ppdu);
590 
591 	if (tlv->tx_fes_status_ack_or_ba)
592 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
593 							 TX_FES_STATUS_ACK_OR_BA,
594 							 tlv->tx_fes_status_ack_or_ba);
595 
596 	if (tlv->tx_fes_status_1k_ba)
597 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
598 							 TX_FES_STATUS_1K_BA,
599 							 tlv->tx_fes_status_1k_ba);
600 
601 	if (tlv->tx_fes_status_start_prot)
602 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
603 							 TX_FES_STATUS_START_PROT,
604 							 tlv->tx_fes_status_start_prot);
605 
606 	if (tlv->tx_fes_status_prot)
607 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
608 							 TX_FES_STATUS_PROT,
609 							 tlv->tx_fes_status_prot);
610 
611 	if (tlv->tx_fes_status_user_response)
612 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
613 							 TX_FES_STATUS_USER_RESPONSE,
614 							 tlv->tx_fes_status_user_response);
615 
616 	if (tlv->rx_frame_bitmap_ack)
617 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
618 							 RX_FRAME_BITMAP_ACK,
619 							 tlv->rx_frame_bitmap_ack);
620 
621 	if (tlv->rx_frame_1k_bitmap_ack)
622 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
623 							 RX_FRAME_1K_BITMAP_ACK,
624 							 tlv->rx_frame_1k_bitmap_ack);
625 
626 	if (tlv->coex_tx_status)
627 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
628 							 COEX_TX_STATUS,
629 							 tlv->coex_tx_status);
630 
631 	if (tlv->received_response_info)
632 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
633 							 RECEIVED_RESPONSE_INFO,
634 							 tlv->received_response_info);
635 
636 	if (tlv->received_response_info_p2)
637 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
638 							 RECEIVED_RESPONSE_INFO_PART2,
639 							 tlv->received_response_info_p2);
640 
641 	if (tlv->ofdma_trigger_details)
642 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
643 							 OFDMA_TRIGGER_DETAILS,
644 							 tlv->ofdma_trigger_details);
645 
646 	if (tlv->received_trigger_info)
647 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
648 							 RECEIVED_TRIGGER_INFO,
649 							 tlv->received_trigger_info);
650 
651 	if (tlv->pdg_tx_request)
652 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
653 							 PDG_TX_REQUEST,
654 							 tlv->pdg_tx_request);
655 
656 	if (tlv->pdg_response)
657 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
658 							 PDG_RESPONSE,
659 							 tlv->pdg_response);
660 
661 	if (tlv->pdg_trig_response)
662 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
663 							 PDG_TRIG_RESPONSE,
664 							 tlv->pdg_trig_response);
665 
666 	if (tlv->trigger_response_tx_done)
667 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
668 							 TRIGGER_RESPONSE_TX_DONE,
669 							 tlv->trigger_response_tx_done);
670 
671 	if (tlv->prot_tx_end)
672 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
673 							 PROT_TX_END,
674 							 tlv->prot_tx_end);
675 
676 	if (tlv->ppdu_tx_end)
677 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
678 							 PPDU_TX_END,
679 							 tlv->ppdu_tx_end);
680 
681 	if (tlv->r2r_status_end)
682 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
683 							 R2R_STATUS_END,
684 							 tlv->r2r_status_end);
685 
686 	if (tlv->flush_req)
687 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
688 							 FLUSH_REQ,
689 							 tlv->flush_req);
690 
691 	if (tlv->mactx_phy_desc)
692 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
693 							 MACTX_PHY_DESC,
694 							 tlv->mactx_phy_desc);
695 
696 	if (tlv->mactx_user_desc_cmn)
697 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
698 							 MACTX_USER_DESC_COMMON,
699 							 tlv->mactx_user_desc_cmn);
700 
701 	if (tlv->mactx_user_desc_per_usr)
702 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
703 							 MACTX_USER_DESC_PER_USER,
704 							 tlv->mactx_user_desc_per_usr);
705 
706 	if (tlv->l_sig_a)
707 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
708 							 L_SIG_A,
709 							 tlv->l_sig_a);
710 
711 	if (tlv->l_sig_b)
712 		htt_tx_monitor_tlv_filter_in1_enable_set(*msg_word,
713 							 L_SIG_B,
714 							 tlv->l_sig_b);
715 }
716 
717 static void
htt_tx_tlv_filter_mask_set_in2(uint32_t * msg_word,struct htt_tx_ring_tlv_filter * htt_tlv_filter)718 htt_tx_tlv_filter_mask_set_in2(uint32_t *msg_word,
719 			       struct htt_tx_ring_tlv_filter *htt_tlv_filter)
720 {
721 	struct dp_tx_mon_upstream_tlv_config *tlv = &htt_tlv_filter->utlvs;
722 
723 	if (tlv->ht_sig)
724 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
725 							 HT_SIG,
726 							 tlv->ht_sig);
727 
728 	if (tlv->vht_sig_a)
729 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
730 							 VHT_SIG_A,
731 							 tlv->vht_sig_a);
732 
733 	if (tlv->vht_sig_b_su20)
734 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
735 							 VHT_SIG_B_SU20,
736 							 tlv->vht_sig_b_su20);
737 
738 	if (tlv->vht_sig_b_su40)
739 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
740 							 VHT_SIG_B_SU40,
741 							 tlv->vht_sig_b_su40);
742 
743 	if (tlv->vht_sig_b_su80)
744 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
745 							 VHT_SIG_B_SU80,
746 							 tlv->vht_sig_b_su80);
747 
748 	if (tlv->vht_sig_b_su160)
749 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
750 							 VHT_SIG_B_SU160,
751 							 tlv->vht_sig_b_su160);
752 
753 	if (tlv->vht_sig_b_mu20)
754 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
755 							 VHT_SIG_B_MU20,
756 							 tlv->vht_sig_b_mu20);
757 
758 	if (tlv->vht_sig_b_mu40)
759 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
760 							 VHT_SIG_B_MU40,
761 							 tlv->vht_sig_b_mu40);
762 
763 	if (tlv->vht_sig_b_mu80)
764 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
765 							 VHT_SIG_B_MU80,
766 							 tlv->vht_sig_b_mu80);
767 
768 	if (tlv->vht_sig_b_mu160)
769 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
770 							 VHT_SIG_B_MU160,
771 							 tlv->vht_sig_b_mu160);
772 
773 	if (tlv->tx_service)
774 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
775 							 TX_SERVICE,
776 							 tlv->tx_service);
777 
778 	if (tlv->he_sig_a_su)
779 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
780 							 HE_SIG_A_SU,
781 							 tlv->he_sig_a_su);
782 
783 	if (tlv->he_sig_a_mu_dl)
784 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
785 							 HE_SIG_A_MU_DL,
786 							 tlv->he_sig_a_mu_dl);
787 
788 	if (tlv->he_sig_a_mu_ul)
789 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
790 							 HE_SIG_A_MU_UL,
791 							 tlv->he_sig_a_mu_ul);
792 
793 	if (tlv->he_sig_b1_mu)
794 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
795 							 HE_SIG_B1_MU,
796 							 tlv->he_sig_b1_mu);
797 
798 	if (tlv->he_sig_b2_mu)
799 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
800 							 HE_SIG_B2_MU,
801 							 tlv->he_sig_b2_mu);
802 
803 	if (tlv->he_sig_b2_ofdma)
804 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
805 							 HE_SIG_B2_OFDMA,
806 							 tlv->he_sig_b2_ofdma);
807 
808 	if (tlv->u_sig_eht_su_mu)
809 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
810 							 U_SIG_EHT_SU_MU,
811 							 tlv->u_sig_eht_su_mu);
812 
813 	if (tlv->u_sig_eht_su)
814 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
815 							 U_SIG_EHT_SU,
816 							 tlv->u_sig_eht_su);
817 
818 	if (tlv->u_sig_eht_tb)
819 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
820 							 U_SIG_EHT_TB,
821 							 tlv->u_sig_eht_tb);
822 
823 	if (tlv->eht_sig_usr_su)
824 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
825 							 EHT_SIG_USR_SU,
826 							 tlv->eht_sig_usr_su);
827 
828 	if (tlv->eht_sig_usr_mu_mimo)
829 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
830 							 EHT_SIG_USR_MU_MIMO,
831 							 tlv->eht_sig_usr_mu_mimo);
832 
833 	if (tlv->eht_sig_usr_ofdma)
834 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
835 							 EHT_SIG_USR_OFDMA,
836 							 tlv->eht_sig_usr_ofdma);
837 
838 	if (tlv->phytx_ppdu_header_info_request)
839 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
840 							 PHYTX_PPDU_HEADER_INFO_REQUEST,
841 							 tlv->phytx_ppdu_header_info_request);
842 
843 	if (tlv->tqm_update_tx_mpdu_count)
844 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
845 							 TQM_UPDATE_TX_MPDU_COUNT,
846 							 tlv->tqm_update_tx_mpdu_count);
847 
848 	if (tlv->tqm_acked_mpdu)
849 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
850 							 TQM_ACKED_MPDU,
851 							 tlv->tqm_acked_mpdu);
852 
853 	if (tlv->tqm_acked_1k_mpdu)
854 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
855 							 TQM_ACKED_1K_MPDU,
856 							 tlv->tqm_acked_1k_mpdu);
857 
858 	if (tlv->txpcu_buf_status)
859 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
860 							 TXPCU_BUFFER_STATUS,
861 							 tlv->txpcu_buf_status);
862 
863 	if (tlv->txpcu_user_buf_status)
864 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
865 							 TXPCU_USER_BUFFER_STATUS,
866 							 tlv->txpcu_user_buf_status);
867 
868 	if (tlv->txdma_stop_request)
869 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
870 							 TXDMA_STOP_REQUEST,
871 							 tlv->txdma_stop_request);
872 
873 	if (tlv->expected_response)
874 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
875 							 EXPECTED_RESPONSE,
876 							 tlv->expected_response);
877 
878 	if (tlv->tx_mpdu_count_transfer_end)
879 		htt_tx_monitor_tlv_filter_in2_enable_set(*msg_word,
880 							 TX_MPDU_COUNT_TRANSFER_END,
881 							 tlv->tx_mpdu_count_transfer_end);
882 }
883 
884 static void
htt_tx_tlv_filter_mask_set_in3(uint32_t * msg_word,struct htt_tx_ring_tlv_filter * htt_tlv_filter)885 htt_tx_tlv_filter_mask_set_in3(uint32_t *msg_word,
886 			       struct htt_tx_ring_tlv_filter *htt_tlv_filter)
887 {
888 	struct dp_tx_mon_upstream_tlv_config *tlv = &htt_tlv_filter->utlvs;
889 
890 	if (tlv->rx_trig_info)
891 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
892 							 RX_TRIG_INFO,
893 							 tlv->rx_trig_info);
894 
895 	if (tlv->rxpcu_tx_setup_clear)
896 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
897 							 RXPCU_TX_SETUP_CLEAR,
898 							 tlv->rxpcu_tx_setup_clear);
899 
900 	if (tlv->rx_frame_bitmap_req)
901 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
902 							 RX_FRAME_BITMAP_REQ,
903 							 tlv->rx_frame_bitmap_req);
904 
905 	if (tlv->rx_phy_sleep)
906 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
907 							 RX_PHY_SLEEP,
908 							 tlv->rx_phy_sleep);
909 
910 	if (tlv->txpcu_preamble_done)
911 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
912 							 TXPCU_PREAMBLE_DONE,
913 							 tlv->txpcu_preamble_done);
914 
915 	if (tlv->txpcu_phytx_debug32)
916 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
917 							 TXPCU_PHYTX_DEBUG32,
918 							 tlv->txpcu_phytx_debug32);
919 
920 	if (tlv->txpcu_phytx_other_transmit_info32)
921 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
922 							 TXPCU_PHYTX_OTHER_TRANSMIT_INFO32,
923 							 tlv->txpcu_phytx_other_transmit_info32);
924 
925 	if (tlv->rx_ppdu_noack_report)
926 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
927 							 RX_PPDU_NO_ACK_REPORT,
928 							 tlv->rx_ppdu_noack_report);
929 
930 	if (tlv->rx_ppdu_ack_report)
931 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
932 							 RX_PPDU_ACK_REPORT,
933 							 tlv->rx_ppdu_ack_report);
934 
935 	if (tlv->coex_rx_status)
936 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
937 							 COEX_RX_STATUS,
938 							 tlv->coex_rx_status);
939 
940 	if (tlv->rx_start_param)
941 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
942 							 RX_START_PARAM,
943 							 tlv->rx_start_param);
944 
945 	if (tlv->tx_cbf_info)
946 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
947 							 TX_CBF_INFO,
948 							 tlv->tx_cbf_info);
949 
950 	if (tlv->rxpcu_early_rx_indication)
951 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
952 							 RXPCU_EARLY_RX_INDICATION,
953 							 tlv->rxpcu_early_rx_indication);
954 
955 	if (tlv->received_response_user_7_0)
956 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
957 							 RECEIVED_RESPONSE_USER_7_0,
958 							 tlv->received_response_user_7_0);
959 
960 	if (tlv->received_response_user_15_8)
961 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
962 							 RECEIVED_RESPONSE_USER_15_8,
963 							 tlv->received_response_user_15_8);
964 
965 	if (tlv->received_response_user_23_16)
966 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
967 							 RECEIVED_RESPONSE_USER_23_16,
968 							 tlv->received_response_user_23_16);
969 
970 	if (tlv->received_response_user_31_24)
971 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
972 							 RECEIVED_RESPONSE_USER_31_24,
973 							 tlv->received_response_user_31_24);
974 
975 	if (tlv->received_response_user_36_32)
976 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
977 							 RECEIVED_RESPONSE_USER_36_32,
978 							 tlv->received_response_user_36_32);
979 
980 	if (tlv->rx_pm_info)
981 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
982 							 RX_PM_INFO,
983 							 tlv->rx_pm_info);
984 
985 	if (tlv->rx_preamble)
986 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
987 							 RX_PREAMBLE,
988 							 tlv->rx_preamble);
989 
990 	if (tlv->others)
991 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
992 							 OTHERS,
993 							 tlv->others);
994 
995 	if (tlv->mactx_pre_phy_desc)
996 		htt_tx_monitor_tlv_filter_in3_enable_set(*msg_word,
997 							 MACTX_PRE_PHY_DESC,
998 							 tlv->mactx_pre_phy_desc);
999 }
1000 #endif
1001 
1002 #ifdef WLAN_PKT_CAPTURE_TX_2_0
1003 /*
1004  * dp_htt_h2t_send_complete_free_netbuf() - Free completed buffer
1005  * @soc:	SOC handl
1006  * @status:	Completion status
1007  * @netbuf:	HTT buffer
1008  */
1009 static void
dp_htt_h2t_send_complete_free_netbuf(void * soc,A_STATUS status,qdf_nbuf_t netbuf)1010 dp_htt_h2t_send_complete_free_netbuf(
1011 	void *soc, A_STATUS status, qdf_nbuf_t netbuf)
1012 {
1013 	qdf_nbuf_free(netbuf);
1014 }
1015 
1016 /*
1017  * htt_h2t_tx_ring_cfg() - Send SRNG packet and TLV filter
1018  * config message to target
1019  * @htt_soc:	HTT SOC handle
1020  * @pdev_id:	WIN- PDEV Id, MCL- mac id
1021  * @hal_srng:	Opaque HAL SRNG pointer
1022  * @hal_ring_type:	SRNG ring type
1023  * @ring_buf_size:	SRNG buffer size
1024  * @htt_tlv_filter:	Rx SRNG TLV and filter setting
1025  * Return: 0 on success; error code on failure
1026  */
1027 static
htt_h2t_tx_ring_cfg(struct htt_soc * htt_soc,int pdev_id,hal_ring_handle_t hal_ring_hdl,int hal_ring_type,int ring_buf_size,struct htt_tx_ring_tlv_filter * htt_tlv_filter)1028 int htt_h2t_tx_ring_cfg(struct htt_soc *htt_soc, int pdev_id,
1029 			hal_ring_handle_t hal_ring_hdl,
1030 			int hal_ring_type, int ring_buf_size,
1031 			struct htt_tx_ring_tlv_filter *htt_tlv_filter)
1032 {
1033 	struct htt_soc *soc = (struct htt_soc *)htt_soc;
1034 	struct dp_htt_htc_pkt *pkt;
1035 	qdf_nbuf_t htt_msg;
1036 	uint32_t *msg_word;
1037 	struct hal_srng_params srng_params;
1038 	uint32_t htt_ring_id;
1039 	uint8_t *htt_logger_bufp;
1040 	int target_pdev_id;
1041 	QDF_STATUS status;
1042 
1043 	htt_msg = qdf_nbuf_alloc(soc->osdev,
1044 				 HTT_MSG_BUF_SIZE(HTT_TX_MONITOR_CFG_SZ),
1045 
1046 	/* reserve room for the HTC header */
1047 	HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, 4, TRUE);
1048 	if (!htt_msg)
1049 		goto fail0;
1050 
1051 	hal_get_srng_params(soc->hal_soc, hal_ring_hdl, &srng_params);
1052 
1053 	switch (hal_ring_type) {
1054 	case TX_MONITOR_BUF:
1055 		htt_ring_id = HTT_TX_MON_HOST2MON_BUF_RING;
1056 		break;
1057 	case TX_MONITOR_DST:
1058 		htt_ring_id = HTT_TX_MON_MON2HOST_DEST_RING;
1059 		break;
1060 	default:
1061 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
1062 			  "%s: Ring currently not supported", __func__);
1063 		goto fail1;
1064 	}
1065 
1066 	/*
1067 	 * Set the length of the message.
1068 	 * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added
1069 	 * separately during the below call to qdf_nbuf_push_head.
1070 	 * The contribution from the HTC header is added separately inside HTC.
1071 	 */
1072 	if (qdf_nbuf_put_tail(htt_msg, HTT_TX_MONITOR_CFG_SZ) == NULL) {
1073 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
1074 			  "%s: Failed to expand head for TX Ring Cfg msg",
1075 			  __func__);
1076 		goto fail1; /* failure */
1077 	}
1078 
1079 	msg_word = (uint32_t *)qdf_nbuf_data(htt_msg);
1080 
1081 	/* rewind beyond alignment pad to get to the HTC header reserved area */
1082 	qdf_nbuf_push_head(htt_msg, HTC_HDR_ALIGNMENT_PADDING);
1083 
1084 	/* word 0 */
1085 	htt_logger_bufp = (uint8_t *)msg_word;
1086 	*msg_word = 0;
1087 	HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_TX_MONITOR_CFG);
1088 
1089 	/*
1090 	 * pdev_id is indexed from 0 whereas mac_id is indexed from 1
1091 	 * SW_TO_SW and SW_TO_HW rings are unaffected by this
1092 	 */
1093 	target_pdev_id =
1094 	dp_get_target_pdev_id_for_host_pdev_id(soc->dp_soc, pdev_id);
1095 
1096 	HTT_TX_MONITOR_CFG_PDEV_ID_SET(*msg_word,
1097 				       target_pdev_id);
1098 
1099 	HTT_TX_MONITOR_CFG_RING_ID_SET(*msg_word, htt_ring_id);
1100 
1101 	HTT_TX_MONITOR_CFG_STATUS_TLV_SET(*msg_word,
1102 		!!(srng_params.flags & HAL_SRNG_MSI_SWAP));
1103 
1104 	HTT_TX_MONITOR_CFG_TX_MON_GLOBAL_EN_SET(*msg_word,
1105 						htt_tlv_filter->enable);
1106 
1107 	/* word 1 */
1108 	msg_word++;
1109 	*msg_word = 0;
1110 	HTT_TX_MONITOR_CFG_RING_BUFFER_SIZE_SET(*msg_word,
1111 						ring_buf_size);
1112 
1113 	if (htt_tlv_filter->mgmt_filter)
1114 		htt_tx_ring_pkt_type_set(*msg_word, ENABLE_FLAGS,
1115 					 MGMT, 1);
1116 
1117 	if (htt_tlv_filter->ctrl_filter)
1118 		htt_tx_ring_pkt_type_set(*msg_word, ENABLE_FLAGS,
1119 					 CTRL, 1);
1120 
1121 	if (htt_tlv_filter->data_filter)
1122 		htt_tx_ring_pkt_type_set(*msg_word, ENABLE_FLAGS,
1123 					 DATA, 1);
1124 
1125 	if (htt_tlv_filter->mgmt_dma_length)
1126 		HTT_TX_MONITOR_CFG_CONFIG_LENGTH_MGMT_SET(*msg_word,
1127 							  htt_tlv_filter->mgmt_dma_length);
1128 
1129 	if (htt_tlv_filter->ctrl_dma_length)
1130 		HTT_TX_MONITOR_CFG_CONFIG_LENGTH_CTRL_SET(*msg_word,
1131 							  htt_tlv_filter->ctrl_dma_length);
1132 
1133 	if (htt_tlv_filter->data_dma_length)
1134 		HTT_TX_MONITOR_CFG_CONFIG_LENGTH_DATA_SET(*msg_word,
1135 							  htt_tlv_filter->data_dma_length);
1136 
1137 	/* word 2*/
1138 	msg_word++;
1139 	*msg_word = 0;
1140 	if (htt_tlv_filter->mgmt_filter)
1141 		HTT_TX_MONITOR_CFG_PKT_TYPE_ENABLE_FLAGS_SET(*msg_word, 1);
1142 
1143 	if (htt_tlv_filter->ctrl_filter)
1144 		HTT_TX_MONITOR_CFG_PKT_TYPE_ENABLE_FLAGS_SET(*msg_word, 2);
1145 
1146 	if (htt_tlv_filter->data_filter)
1147 		HTT_TX_MONITOR_CFG_PKT_TYPE_ENABLE_FLAGS_SET(*msg_word, 4);
1148 
1149 	if (htt_tlv_filter->mgmt_mpdu_start)
1150 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MPDU_START_MGMT_SET(*msg_word, 1);
1151 
1152 	if (htt_tlv_filter->ctrl_mpdu_start)
1153 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MPDU_START_CTRL_SET(*msg_word, 1);
1154 
1155 	if (htt_tlv_filter->data_mpdu_start)
1156 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MPDU_START_DATA_SET(*msg_word, 1);
1157 
1158 	if (htt_tlv_filter->mgmt_msdu_start)
1159 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MSDU_START_MGMT_SET(*msg_word, 1);
1160 
1161 	if (htt_tlv_filter->ctrl_msdu_start)
1162 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MSDU_START_CTRL_SET(*msg_word, 1);
1163 
1164 	if (htt_tlv_filter->data_msdu_start)
1165 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MSDU_START_DATA_SET(*msg_word, 1);
1166 
1167 	if (htt_tlv_filter->mgmt_mpdu_end)
1168 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MPDU_END_MGMT_SET(*msg_word, 1);
1169 
1170 	if (htt_tlv_filter->ctrl_mpdu_end)
1171 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MPDU_END_CTRL_SET(*msg_word, 1);
1172 
1173 	if (htt_tlv_filter->data_mpdu_end)
1174 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MPDU_END_DATA_SET(*msg_word, 1);
1175 
1176 	if (htt_tlv_filter->mgmt_msdu_end)
1177 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MSDU_END_MGMT_SET(*msg_word, 1);
1178 
1179 	if (htt_tlv_filter->ctrl_msdu_end)
1180 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MSDU_END_CTRL_SET(*msg_word, 1);
1181 
1182 	if (htt_tlv_filter->data_msdu_end)
1183 		HTT_TX_MONITOR_CFG_FILTER_IN_TX_MSDU_END_DATA_SET(*msg_word, 1);
1184 
1185 	if (htt_tlv_filter->compaction_enable)
1186 		HTT_TX_MONITOR_CFG_WORD_MASK_COMPACTION_ENABLE_SET(*msg_word,
1187 								   1);
1188 
1189 	/* word 3 */
1190 	msg_word++;
1191 	*msg_word = 0;
1192 
1193 	htt_tx_tlv_filter_mask_set_in0(msg_word, htt_tlv_filter);
1194 
1195 	/* word 4 */
1196 	msg_word++;
1197 	*msg_word = 0;
1198 
1199 	htt_tx_tlv_filter_mask_set_in1(msg_word, htt_tlv_filter);
1200 
1201 	/* word 5 */
1202 	msg_word++;
1203 	*msg_word = 0;
1204 
1205 	htt_tx_tlv_filter_mask_set_in2(msg_word, htt_tlv_filter);
1206 
1207 	/* word 6 */
1208 	msg_word++;
1209 	*msg_word = 0;
1210 
1211 	htt_tx_tlv_filter_mask_set_in3(msg_word, htt_tlv_filter);
1212 
1213 	/* word 7 */
1214 	msg_word++;
1215 	*msg_word = 0;
1216 	if (htt_tlv_filter->wmask.tx_fes_setup)
1217 		HTT_TX_MONITOR_CFG_TX_FES_SETUP_WORD_MASK_SET(*msg_word,
1218 					htt_tlv_filter->wmask.tx_fes_setup);
1219 
1220 	if (htt_tlv_filter->wmask.tx_peer_entry)
1221 		HTT_TX_MONITOR_CFG_TX_PEER_ENTRY_WORD_MASK_SET(*msg_word,
1222 					htt_tlv_filter->wmask.tx_peer_entry);
1223 
1224 	if (htt_tlv_filter->wmask.tx_queue_ext)
1225 		HTT_TX_MONITOR_CFG_TX_QUEUE_EXT_WORD_MASK_SET(*msg_word,
1226 					htt_tlv_filter->wmask.tx_queue_ext);
1227 
1228 	if (htt_tlv_filter->wmask.tx_msdu_start)
1229 		HTT_TX_MONITOR_CFG_TX_MSDU_START_WORD_MASK_SET(*msg_word,
1230 					htt_tlv_filter->wmask.tx_msdu_start);
1231 
1232 	/* word 8 */
1233 	msg_word++;
1234 	*msg_word = 0;
1235 	if (htt_tlv_filter->wmask.pcu_ppdu_setup_init)
1236 		HTT_TX_MONITOR_CFG_PCU_PPDU_SETUP_WORD_MASK_SET(*msg_word,
1237 					htt_tlv_filter->wmask.pcu_ppdu_setup_init);
1238 
1239 	/* word 9 */
1240 	msg_word++;
1241 	*msg_word = 0;
1242 
1243 	if (htt_tlv_filter->wmask.tx_mpdu_start)
1244 		HTT_TX_MONITOR_CFG_TX_MPDU_START_WORD_MASK_SET(*msg_word,
1245 					htt_tlv_filter->wmask.tx_mpdu_start);
1246 
1247 	if (htt_tlv_filter->wmask.rxpcu_user_setup)
1248 		HTT_TX_MONITOR_CFG_RXPCU_USER_SETUP_WORD_MASK_SET(*msg_word,
1249 					htt_tlv_filter->wmask.rxpcu_user_setup);
1250 
1251 	htt_tx_ring_pkt_type_set(*msg_word, ENABLE_MSDU_OR_MPDU_LOGGING,
1252 				 MGMT,
1253 				 htt_tlv_filter->mgmt_mpdu_log);
1254 
1255 	htt_tx_ring_pkt_type_set(*msg_word, ENABLE_MSDU_OR_MPDU_LOGGING,
1256 				 CTRL,
1257 				 htt_tlv_filter->ctrl_mpdu_log);
1258 
1259 	htt_tx_ring_pkt_type_set(*msg_word, ENABLE_MSDU_OR_MPDU_LOGGING,
1260 				 DATA,
1261 				 htt_tlv_filter->data_mpdu_log);
1262 
1263 	HTT_TX_MONITOR_CFG_DMA_MPDU_MGMT_SET(*msg_word,
1264 					     htt_tlv_filter->mgmt_mpdu_log);
1265 	HTT_TX_MONITOR_CFG_DMA_MPDU_CTRL_SET(*msg_word,
1266 					     htt_tlv_filter->ctrl_mpdu_log);
1267 	HTT_TX_MONITOR_CFG_DMA_MPDU_DATA_SET(*msg_word,
1268 					     htt_tlv_filter->data_mpdu_log);
1269 
1270 	/* word 10 */
1271 	msg_word++;
1272 	*msg_word = 0;
1273 
1274 	if (htt_tlv_filter->wmask.tx_queue_ext)
1275 		HTT_TX_MONITOR_CFG_TX_QUEUE_EXT_V2_WORD_MASK_SET(*msg_word,
1276 				htt_tlv_filter->wmask.tx_queue_ext);
1277 
1278 	if (htt_tlv_filter->wmask.tx_peer_entry)
1279 		HTT_TX_MONITOR_CFG_TX_PEER_ENTRY_V2_WORD_MASK_SET(*msg_word,
1280 				htt_tlv_filter->wmask.tx_peer_entry);
1281 
1282 	/* word 11 */
1283 	msg_word++;
1284 	*msg_word = 0;
1285 
1286 	if (htt_tlv_filter->wmask.tx_fes_status_end)
1287 		HTT_TX_MONITOR_CFG_FES_STATUS_END_WORD_MASK_SET(*msg_word,
1288 				htt_tlv_filter->wmask.tx_fes_status_end);
1289 
1290 	if (htt_tlv_filter->wmask.response_end_status)
1291 		HTT_TX_MONITOR_CFG_RESPONSE_END_STATUS_WORD_MASK_SET(*msg_word,
1292 				htt_tlv_filter->wmask.response_end_status);
1293 
1294 	/* word 12 */
1295 	msg_word++;
1296 	*msg_word = 0;
1297 
1298 	if (htt_tlv_filter->wmask.tx_fes_status_prot)
1299 		HTT_TX_MONITOR_CFG_FES_STATUS_PROT_WORD_MASK_SET(*msg_word,
1300 				htt_tlv_filter->wmask.tx_fes_status_prot);
1301 
1302 	pkt = htt_htc_pkt_alloc(soc);
1303 	if (!pkt)
1304 		goto fail1;
1305 
1306 	pkt->soc_ctxt = NULL; /* not used during send-done callback */
1307 
1308 	SET_HTC_PACKET_INFO_TX(
1309 		&pkt->htc_pkt,
1310 		dp_htt_h2t_send_complete_free_netbuf,
1311 		qdf_nbuf_data(htt_msg),
1312 		qdf_nbuf_len(htt_msg),
1313 		soc->htc_endpoint,
1314 		HTC_TX_PACKET_TAG_RUNTIME_PUT); /* tag for no FW response msg */
1315 
1316 	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, htt_msg);
1317 	status = DP_HTT_SEND_HTC_PKT(soc, pkt,
1318 				     HTT_H2T_MSG_TYPE_TX_MONITOR_CFG,
1319 				     htt_logger_bufp);
1320 
1321 	if (status != QDF_STATUS_SUCCESS) {
1322 		qdf_nbuf_free(htt_msg);
1323 		htt_htc_pkt_free(soc, pkt);
1324 	}
1325 
1326 	return status;
1327 
1328 fail1:
1329 	qdf_nbuf_free(htt_msg);
1330 fail0:
1331 	return QDF_STATUS_E_FAILURE;
1332 }
1333 #endif
1334 
1335 #ifdef QCA_ENHANCED_STATS_SUPPORT
dp_mon_filter_setup_enhanced_stats_2_0(struct dp_pdev * pdev)1336 void dp_mon_filter_setup_enhanced_stats_2_0(struct dp_pdev *pdev)
1337 {
1338 	struct dp_mon_filter_be filter = {0};
1339 	enum dp_mon_filter_mode mode = DP_MON_FILTER_ENHACHED_STATS_MODE;
1340 	enum dp_mon_filter_srng_type srng_type =
1341 				DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
1342 	struct dp_mon_filter *rx_tlv_filter;
1343 	struct dp_mon_pdev *mon_pdev;
1344 	struct dp_mon_pdev_be *mon_pdev_be;
1345 
1346 	if (!pdev) {
1347 		dp_mon_filter_err("pdev Context is null");
1348 		return;
1349 	}
1350 
1351 	mon_pdev = pdev->monitor_pdev;
1352 	mon_pdev_be =
1353 		dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
1354 
1355 	rx_tlv_filter = &filter.rx_tlv_filter;
1356 	dp_mon_filter_set_status_cmn(mon_pdev, rx_tlv_filter);
1357 	/* Setup the filter */
1358 	rx_tlv_filter->tlv_filter.ppdu_end_user_stats_ext = 0;
1359 	rx_tlv_filter->tlv_filter.enable_mo = 0;
1360 	rx_tlv_filter->tlv_filter.mo_mgmt_filter = 0;
1361 	rx_tlv_filter->tlv_filter.mo_ctrl_filter = 0;
1362 	rx_tlv_filter->tlv_filter.mo_data_filter = 0;
1363 	rx_tlv_filter->tlv_filter.ppdu_start_user_info = 1;
1364 	/* Enabled the filter */
1365 	rx_tlv_filter->valid = true;
1366 
1367 	dp_mon_filter_show_rx_filter_be(mode, &filter);
1368 
1369 	mon_pdev_be->filter_be[mode][srng_type] = filter;
1370 }
1371 
dp_mon_filter_reset_enhanced_stats_2_0(struct dp_pdev * pdev)1372 void dp_mon_filter_reset_enhanced_stats_2_0(struct dp_pdev *pdev)
1373 {
1374 	struct dp_mon_filter_be filter = {0};
1375 	enum dp_mon_filter_mode mode = DP_MON_FILTER_ENHACHED_STATS_MODE;
1376 	enum dp_mon_filter_srng_type srng_type =
1377 				DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
1378 	struct dp_mon_pdev *mon_pdev;
1379 	struct dp_mon_pdev_be *mon_pdev_be;
1380 
1381 	if (!pdev) {
1382 		dp_mon_filter_err("pdev Context is null");
1383 		return;
1384 	}
1385 
1386 	mon_pdev = pdev->monitor_pdev;
1387 	mon_pdev_be =
1388 		dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
1389 
1390 	mon_pdev_be->filter_be[mode][srng_type] = filter;
1391 }
1392 #endif /* QCA_ENHANCED_STATS_SUPPORT */
1393 
1394 #ifdef QCA_UNDECODED_METADATA_SUPPORT
1395 void
dp_mon_filter_setup_undecoded_metadata_capture_2_0(struct dp_pdev * pdev)1396 dp_mon_filter_setup_undecoded_metadata_capture_2_0(struct dp_pdev *pdev)
1397 {
1398 }
1399 
1400 void
dp_mon_filter_reset_undecoded_metadata_capture_2_0(struct dp_pdev * pdev)1401 dp_mon_filter_reset_undecoded_metadata_capture_2_0(struct dp_pdev *pdev)
1402 {
1403 }
1404 #endif
1405 
1406 #ifdef WLAN_PKT_CAPTURE_TX_2_0
dp_tx_mon_filter_set_downstream_tlvs(struct htt_tx_ring_tlv_filter * filter)1407 static void dp_tx_mon_filter_set_downstream_tlvs(struct htt_tx_ring_tlv_filter *filter)
1408 {
1409 	filter->dtlvs.tx_fes_setup = 1;
1410 	filter->dtlvs.pcu_ppdu_setup_init = 1;
1411 	filter->dtlvs.tx_peer_entry = 1;
1412 	filter->dtlvs.tx_queue_extension = 1;
1413 	filter->dtlvs.fw2s_mon = 1;
1414 }
1415 
1416 static void
dp_tx_mon_filter_set_upstream_tlvs(struct htt_tx_ring_tlv_filter * filter)1417 dp_tx_mon_filter_set_upstream_tlvs(struct htt_tx_ring_tlv_filter *filter)
1418 {
1419 	filter->utlvs.tx_fes_status_end = 1;
1420 	filter->utlvs.rx_response_required_info = 1;
1421 	filter->utlvs.response_end_status = 1;
1422 	filter->utlvs.tx_fes_status_start = 1;
1423 	filter->utlvs.tx_fes_status_start_prot = 1;
1424 	filter->utlvs.tx_fes_status_prot = 1;
1425 	filter->utlvs.tx_fes_status_start_ppdu = 1;
1426 	filter->utlvs.tx_fes_status_user_ppdu = 1;
1427 	filter->utlvs.coex_tx_status = 1;
1428 	filter->utlvs.rx_frame_bitmap_ack = 1;
1429 	filter->utlvs.rx_frame_1k_bitmap_ack = 1;
1430 	filter->utlvs.he_sig_a_su = 1;
1431 	filter->utlvs.he_sig_a_mu_dl = 1;
1432 	filter->utlvs.he_sig_b1_mu = 1;
1433 	filter->utlvs.he_sig_b2_mu = 1;
1434 	filter->utlvs.he_sig_b2_ofdma = 1;
1435 	filter->utlvs.l_sig_b = 1;
1436 	filter->utlvs.l_sig_a = 1;
1437 	filter->utlvs.ht_sig = 1;
1438 	filter->utlvs.vht_sig_a = 1;
1439 	filter->utlvs.mactx_phy_desc = 1;
1440 	filter->utlvs.mactx_user_desc_cmn = 1;
1441 	filter->utlvs.mactx_user_desc_per_usr = 1;
1442 
1443 	/* enable u_sig and eht flag */
1444 	filter->utlvs.u_sig_eht_su_mu = 1;
1445 	filter->utlvs.u_sig_eht_su = 1;
1446 	filter->utlvs.u_sig_eht_tb = 1;
1447 	filter->utlvs.eht_sig_usr_su = 1;
1448 	filter->utlvs.eht_sig_usr_mu_mimo = 1;
1449 	filter->utlvs.eht_sig_usr_ofdma = 1;
1450 }
1451 
1452 static void
dp_tx_mon_filter_set_all(struct dp_mon_pdev_be * mon_pdev_be,struct htt_tx_ring_tlv_filter * filter)1453 dp_tx_mon_filter_set_all(struct dp_mon_pdev_be *mon_pdev_be,
1454 			 struct htt_tx_ring_tlv_filter *filter)
1455 {
1456 	qdf_mem_zero(&filter->dtlvs,
1457 		     sizeof(filter->dtlvs));
1458 	qdf_mem_zero(&filter->utlvs,
1459 		     sizeof(filter->utlvs));
1460 	qdf_mem_zero(&filter->wmask,
1461 		     sizeof(filter->wmask));
1462 
1463 	dp_tx_mon_filter_set_downstream_tlvs(filter);
1464 	dp_tx_mon_filter_set_upstream_tlvs(filter);
1465 
1466 	filter->mgmt_filter = 0x1;
1467 	filter->data_filter = 0x1;
1468 	filter->ctrl_filter = 0x1;
1469 
1470 	filter->mgmt_mpdu_end = 1;
1471 	filter->mgmt_msdu_end = 1;
1472 	filter->mgmt_msdu_start = 1;
1473 	filter->mgmt_mpdu_start = 1;
1474 	filter->ctrl_mpdu_end = 1;
1475 	filter->ctrl_msdu_end = 1;
1476 	filter->ctrl_msdu_start = 1;
1477 	filter->ctrl_mpdu_start = 1;
1478 	filter->data_mpdu_end = 1;
1479 	filter->data_msdu_end = 1;
1480 	filter->data_msdu_start = 1;
1481 	filter->data_mpdu_start = 1;
1482 	filter->mgmt_mpdu_log = 1;
1483 	filter->ctrl_mpdu_log = 1;
1484 	filter->data_mpdu_log = 1;
1485 
1486 	filter->mgmt_dma_length = mon_pdev_be->tx_mon_filter_length;
1487 	filter->ctrl_dma_length = mon_pdev_be->tx_mon_filter_length;
1488 	filter->data_dma_length = mon_pdev_be->tx_mon_filter_length;
1489 }
1490 
1491 static
dp_tx_mon_filter_set_word_mask(struct dp_pdev * pdev,struct htt_tx_ring_tlv_filter * filter)1492 void dp_tx_mon_filter_set_word_mask(struct dp_pdev *pdev,
1493 				    struct htt_tx_ring_tlv_filter *filter)
1494 {
1495 	hal_txmon_word_mask_config_t word_mask = {0};
1496 	bool status = false;
1497 
1498 	status = hal_txmon_get_word_mask(pdev->soc->hal_soc, &word_mask);
1499 
1500 	if (status) {
1501 		filter->wmask.pcu_ppdu_setup_init =
1502 			word_mask.pcu_ppdu_setup_init;
1503 		filter->wmask.tx_peer_entry = word_mask.tx_peer_entry;
1504 		filter->wmask.tx_queue_ext = word_mask.tx_queue_ext;
1505 		filter->wmask.tx_fes_status_end = word_mask.tx_fes_status_end;
1506 		filter->wmask.response_end_status =
1507 			word_mask.response_end_status;
1508 		filter->wmask.tx_fes_status_prot = word_mask.tx_fes_status_prot;
1509 		filter->wmask.tx_fes_setup = word_mask.tx_fes_setup;
1510 		filter->wmask.tx_msdu_start = word_mask.tx_msdu_start;
1511 		filter->wmask.tx_mpdu_start = word_mask.tx_mpdu_start;
1512 		filter->wmask.rxpcu_user_setup = word_mask.rxpcu_user_setup;
1513 
1514 		filter->compaction_enable = word_mask.compaction_enable;
1515 	} else {
1516 		filter->wmask.pcu_ppdu_setup_init = 0xFFFFFFFF;
1517 		filter->wmask.tx_peer_entry = 0xFFFF;
1518 		filter->wmask.tx_queue_ext = 0xFFFF;
1519 		filter->wmask.tx_fes_status_end = 0xFFFF;
1520 		filter->wmask.response_end_status = 0xFFFF;
1521 		filter->wmask.tx_fes_status_prot = 0xFFFF;
1522 		filter->wmask.tx_fes_setup = 0xFF;
1523 		filter->wmask.tx_msdu_start = 0xFF;
1524 		filter->wmask.tx_mpdu_start = 0xFF;
1525 		filter->wmask.rxpcu_user_setup = 0xFF;
1526 
1527 		/* compaction is disable */
1528 		filter->compaction_enable = 0;
1529 	}
1530 }
1531 
dp_mon_filter_setup_tx_mon_mode_2_0(struct dp_pdev * pdev)1532 void dp_mon_filter_setup_tx_mon_mode_2_0(struct dp_pdev *pdev)
1533 {
1534 	struct dp_mon_filter_be filter = {0};
1535 	struct dp_soc *soc = NULL;
1536 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
1537 	enum dp_mon_filter_srng_type srng_type =
1538 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
1539 	struct dp_mon_pdev *mon_pdev = NULL;
1540 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
1541 
1542 	if (!pdev) {
1543 		dp_mon_filter_err("pdev Context is null");
1544 		return;
1545 	}
1546 
1547 	soc = pdev->soc;
1548 	if (!soc) {
1549 		dp_mon_filter_err("Soc Context is null");
1550 		return;
1551 	}
1552 
1553 	mon_pdev = pdev->monitor_pdev;
1554 	if (!mon_pdev) {
1555 		dp_mon_filter_err("Monitor pdev context is null");
1556 		return;
1557 	}
1558 
1559 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
1560 
1561 	filter.tx_valid = !!mon_pdev_be->tx_mon_mode;
1562 	dp_tx_mon_filter_set_all(mon_pdev_be, &filter.tx_tlv_filter);
1563 	dp_tx_mon_filter_set_word_mask(pdev, &filter.tx_tlv_filter);
1564 	dp_mon_filter_show_tx_filter_be(mode, &filter);
1565 	mon_pdev_be->filter_be[mode][srng_type] = filter;
1566 }
1567 
dp_mon_filter_reset_tx_mon_mode_2_0(struct dp_pdev * pdev)1568 void dp_mon_filter_reset_tx_mon_mode_2_0(struct dp_pdev *pdev)
1569 {
1570 	struct dp_mon_filter_be filter = {0};
1571 	struct dp_soc *soc = NULL;
1572 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
1573 	enum dp_mon_filter_srng_type srng_type =
1574 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
1575 	struct dp_mon_pdev *mon_pdev;
1576 	struct dp_mon_soc *mon_soc;
1577 	struct dp_mon_pdev_be *mon_pdev_be;
1578 	struct dp_mon_soc_be *mon_soc_be = NULL;
1579 
1580 	if (!pdev) {
1581 		dp_mon_filter_err("pdev Context is null");
1582 		return;
1583 	}
1584 
1585 	soc = pdev->soc;
1586 	if (!soc) {
1587 		dp_mon_filter_err("Soc Context is null");
1588 		return;
1589 	}
1590 
1591 	mon_pdev = pdev->monitor_pdev;
1592 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
1593 	mon_soc = soc->monitor_soc;
1594 	mon_soc_be = dp_get_be_mon_soc_from_dp_mon_soc(mon_soc);
1595 	mon_soc_be->tx_mon_ring_fill_level = DP_MON_RING_FILL_LEVEL_DEFAULT;
1596 	mon_soc_be->rx_mon_ring_fill_level = DP_MON_RING_FILL_LEVEL_DEFAULT;
1597 
1598 	mon_pdev_be->filter_be[mode][srng_type] = filter;
1599 }
1600 #endif
1601 
dp_mon_filter_set_mon_2_0(struct dp_mon_pdev * mon_pdev,struct dp_mon_filter * filter)1602 static void dp_mon_filter_set_mon_2_0(struct dp_mon_pdev *mon_pdev,
1603 				      struct dp_mon_filter *filter)
1604 {
1605 	filter->tlv_filter.mpdu_start = 1;
1606 	filter->tlv_filter.msdu_start = 1;
1607 	filter->tlv_filter.packet = 1;
1608 	filter->tlv_filter.packet_header = 1;
1609 	filter->tlv_filter.header_per_msdu = 1;
1610 	filter->tlv_filter.rx_hdr_length = RX_HDR_DMA_LENGTH_64B;
1611 	filter->tlv_filter.msdu_end = 1;
1612 	filter->tlv_filter.mpdu_end = 1;
1613 	filter->tlv_filter.attention = 0;
1614 	filter->tlv_filter.ppdu_start = 1;
1615 	filter->tlv_filter.ppdu_end = 1;
1616 	filter->tlv_filter.ppdu_end_user_stats = 1;
1617 	filter->tlv_filter.ppdu_end_user_stats_ext = 1;
1618 	filter->tlv_filter.ppdu_end_status_done = 1;
1619 	filter->tlv_filter.ppdu_start_user_info = 1;
1620 	filter->tlv_filter.enable_fp =
1621 		(mon_pdev->mon_filter_mode & MON_FILTER_PASS) ? 1 : 0;
1622 	filter->tlv_filter.enable_mo =
1623 		(mon_pdev->mon_filter_mode & MON_FILTER_OTHER) ? 1 : 0;
1624 	filter->tlv_filter.fp_mgmt_filter = mon_pdev->fp_mgmt_filter;
1625 	filter->tlv_filter.fp_ctrl_filter = mon_pdev->fp_ctrl_filter;
1626 	filter->tlv_filter.fp_data_filter = mon_pdev->fp_data_filter;
1627 	filter->tlv_filter.mo_mgmt_filter = mon_pdev->mo_mgmt_filter;
1628 	filter->tlv_filter.mo_ctrl_filter = mon_pdev->mo_ctrl_filter;
1629 	filter->tlv_filter.mo_data_filter = mon_pdev->mo_data_filter;
1630 	filter->tlv_filter.enable_md = 0;
1631 	filter->tlv_filter.enable_fpmo = 0;
1632 	filter->tlv_filter.offset_valid = false;
1633 	filter->tlv_filter.mgmt_dma_length = DEFAULT_DMA_LENGTH;
1634 	filter->tlv_filter.data_dma_length = DEFAULT_DMA_LENGTH;
1635 	filter->tlv_filter.ctrl_dma_length = DEFAULT_DMA_LENGTH;
1636 	 /* compute offset size in QWORDS */
1637 	filter->tlv_filter.rx_pkt_tlv_offset = DP_RX_MON_PACKET_OFFSET / 8;
1638 	filter->tlv_filter.mgmt_mpdu_log = DP_MON_MSDU_LOGGING;
1639 	filter->tlv_filter.ctrl_mpdu_log = DP_MON_MSDU_LOGGING;
1640 	filter->tlv_filter.data_mpdu_log = DP_MON_MSDU_LOGGING;
1641 
1642 	if (mon_pdev->mon_filter_mode & MON_FILTER_OTHER) {
1643 		filter->tlv_filter.enable_mo = 1;
1644 		filter->tlv_filter.mo_mgmt_filter = FILTER_MGMT_ALL;
1645 		filter->tlv_filter.mo_ctrl_filter = FILTER_CTRL_ALL;
1646 		filter->tlv_filter.mo_data_filter = FILTER_DATA_ALL;
1647 	} else {
1648 		filter->tlv_filter.enable_mo = 0;
1649 	}
1650 }
1651 
dp_mon_filter_setup_rx_mon_mode_2_0(struct dp_pdev * pdev)1652 void dp_mon_filter_setup_rx_mon_mode_2_0(struct dp_pdev *pdev)
1653 {
1654 	struct dp_mon_filter_be filter = {0};
1655 	struct dp_mon_filter *rx_tlv_filter;
1656 	struct dp_soc *soc;
1657 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
1658 	enum dp_mon_filter_srng_type srng_type =
1659 				DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
1660 	struct dp_mon_pdev *mon_pdev;
1661 	struct dp_mon_pdev_be *mon_pdev_be;
1662 
1663 	if (!pdev) {
1664 		dp_mon_filter_err("pdev Context is null");
1665 		return;
1666 	}
1667 
1668 	soc = pdev->soc;
1669 	if (!soc) {
1670 		dp_mon_filter_err("Soc Context is null");
1671 		return;
1672 	}
1673 
1674 	mon_pdev = pdev->monitor_pdev;
1675 	if (!mon_pdev) {
1676 		dp_mon_filter_err("mon_pdev Context is null");
1677 		return;
1678 	}
1679 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
1680 
1681 	rx_tlv_filter = &filter.rx_tlv_filter;
1682 	rx_tlv_filter->valid = true;
1683 
1684 	dp_mon_filter_set_mon_2_0(mon_pdev, rx_tlv_filter);
1685 	dp_mon_filter_show_rx_filter_be(mode, &filter);
1686 
1687 	/* Store the above filter */
1688 	mon_pdev_be->filter_be[mode][srng_type] = filter;
1689 }
1690 
dp_mon_filter_reset_rx_mon_mode_2_0(struct dp_pdev * pdev)1691 void dp_mon_filter_reset_rx_mon_mode_2_0(struct dp_pdev *pdev)
1692 {
1693 	struct dp_mon_filter_be filter = {0};
1694 	struct dp_mon_filter *rx_tlv_filter;
1695 	struct dp_soc *soc = NULL;
1696 
1697 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
1698 	enum dp_mon_filter_srng_type srng_type =
1699 		DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
1700 	struct dp_mon_pdev *mon_pdev;
1701 	struct dp_mon_pdev_be *mon_pdev_be;
1702 
1703 	if (!pdev) {
1704 		dp_mon_filter_err("pdev Context is null");
1705 		return;
1706 	}
1707 
1708 	soc = pdev->soc;
1709 	if (!soc) {
1710 		dp_mon_filter_err("Soc Context is null");
1711 		return;
1712 	}
1713 
1714 	mon_pdev = pdev->monitor_pdev;
1715 	if (!mon_pdev) {
1716 		dp_mon_filter_err("mon_pdev Context is null");
1717 		return;
1718 	}
1719 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
1720 
1721 	rx_tlv_filter = &filter.rx_tlv_filter;
1722 	rx_tlv_filter->valid = true;
1723 
1724 	qdf_mem_zero(&(filter), sizeof(struct dp_mon_filter));
1725 	/* Store the above filter */
1726 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
1727 	mon_pdev_be->filter_be[mode][srng_type] = filter;
1728 }
1729 
dp_rx_mon_filter_show_filter(struct dp_mon_filter_be * filter)1730 static void dp_rx_mon_filter_show_filter(struct dp_mon_filter_be *filter)
1731 {
1732 	struct htt_rx_ring_tlv_filter *rx_tlv_filter =
1733 		&filter->rx_tlv_filter.tlv_filter;
1734 
1735 	DP_MON_FILTER_PRINT("Enable: %d", rx_tlv_filter->enable);
1736 	DP_MON_FILTER_PRINT("mpdu_start: %d", rx_tlv_filter->mpdu_start);
1737 	DP_MON_FILTER_PRINT("msdu_start: %d", rx_tlv_filter->msdu_start);
1738 	DP_MON_FILTER_PRINT("packet: %d", rx_tlv_filter->packet);
1739 	DP_MON_FILTER_PRINT("msdu_end: %d", rx_tlv_filter->msdu_end);
1740 	DP_MON_FILTER_PRINT("mpdu_end: %d", rx_tlv_filter->mpdu_end);
1741 	DP_MON_FILTER_PRINT("packet_header: %d",
1742 			    rx_tlv_filter->packet_header);
1743 	DP_MON_FILTER_PRINT("attention: %d", rx_tlv_filter->attention);
1744 	DP_MON_FILTER_PRINT("ppdu_start: %d", rx_tlv_filter->ppdu_start);
1745 	DP_MON_FILTER_PRINT("ppdu_end: %d", rx_tlv_filter->ppdu_end);
1746 	DP_MON_FILTER_PRINT("ppdu_end_user_stats: %d",
1747 			    rx_tlv_filter->ppdu_end_user_stats);
1748 	DP_MON_FILTER_PRINT("ppdu_end_user_stats_ext: %d",
1749 			    rx_tlv_filter->ppdu_end_user_stats_ext);
1750 	DP_MON_FILTER_PRINT("ppdu_end_status_done: %d",
1751 			    rx_tlv_filter->ppdu_end_status_done);
1752 	DP_MON_FILTER_PRINT("ppdu_start_user_info: %d",
1753 			    rx_tlv_filter->ppdu_start_user_info);
1754 	DP_MON_FILTER_PRINT("header_per_msdu: %d",
1755 			    rx_tlv_filter->header_per_msdu);
1756 	DP_MON_FILTER_PRINT("enable_fp: %d", rx_tlv_filter->enable_fp);
1757 	DP_MON_FILTER_PRINT("enable_md: %d", rx_tlv_filter->enable_md);
1758 	DP_MON_FILTER_PRINT("enable_mo: %d", rx_tlv_filter->enable_mo);
1759 	DP_MON_FILTER_PRINT("enable_fpmo: %d", rx_tlv_filter->enable_fpmo);
1760 	DP_MON_FILTER_PRINT("fp_mgmt_filter: 0x%x",
1761 			    rx_tlv_filter->fp_mgmt_filter);
1762 	DP_MON_FILTER_PRINT("mo_mgmt_filter: 0x%x",
1763 			    rx_tlv_filter->mo_mgmt_filter);
1764 	DP_MON_FILTER_PRINT("fp_ctrl_filter: 0x%x",
1765 			    rx_tlv_filter->fp_ctrl_filter);
1766 	DP_MON_FILTER_PRINT("mo_ctrl_filter: 0x%x",
1767 			    rx_tlv_filter->mo_ctrl_filter);
1768 	DP_MON_FILTER_PRINT("fp_data_filter: 0x%x",
1769 			    rx_tlv_filter->fp_data_filter);
1770 	DP_MON_FILTER_PRINT("mo_data_filter: 0x%x",
1771 			    rx_tlv_filter->mo_data_filter);
1772 	DP_MON_FILTER_PRINT("md_data_filter: 0x%x",
1773 			    rx_tlv_filter->md_data_filter);
1774 	DP_MON_FILTER_PRINT("md_mgmt_filter: 0x%x",
1775 			    rx_tlv_filter->md_mgmt_filter);
1776 	DP_MON_FILTER_PRINT("md_ctrl_filter: 0x%x",
1777 			    rx_tlv_filter->md_ctrl_filter);
1778 	DP_MON_FILTER_PRINT("fpmo_data_filter: 0x%x",
1779 			    rx_tlv_filter->fpmo_data_filter);
1780 	DP_MON_FILTER_PRINT("fpmo_mgmt_filter: 0x%x",
1781 			    rx_tlv_filter->fpmo_mgmt_filter);
1782 	DP_MON_FILTER_PRINT("fpmo_ctrl_filter: 0x%x",
1783 			    rx_tlv_filter->fpmo_ctrl_filter);
1784 	DP_MON_FILTER_PRINT("mgmt_dma_length: %d",
1785 			    rx_tlv_filter->mgmt_dma_length);
1786 	DP_MON_FILTER_PRINT("ctrl_dma_length: %d",
1787 			    rx_tlv_filter->ctrl_dma_length);
1788 	DP_MON_FILTER_PRINT("data_dma_length: %d",
1789 			    rx_tlv_filter->data_dma_length);
1790 	DP_MON_FILTER_PRINT("rx_mpdu_start_wmask: 0x%x",
1791 			    rx_tlv_filter->rx_mpdu_start_wmask);
1792 	DP_MON_FILTER_PRINT("rx_msdu_end_wmask: 0x%x",
1793 			    rx_tlv_filter->rx_msdu_end_wmask);
1794 	DP_MON_FILTER_PRINT("rx_hdr_length: %d",
1795 			    rx_tlv_filter->rx_hdr_length);
1796 	DP_MON_FILTER_PRINT("mgmt_mpdu_log: 0x%x",
1797 			    rx_tlv_filter->mgmt_mpdu_log);
1798 	DP_MON_FILTER_PRINT("data_mpdu_log: 0x%x",
1799 			    rx_tlv_filter->data_mpdu_log);
1800 	DP_MON_FILTER_PRINT("ctrl_mpdu_log: 0x%x",
1801 			    rx_tlv_filter->ctrl_mpdu_log);
1802 	DP_MON_FILTER_PRINT("mgmt_dma_length: 0x%x",
1803 			    rx_tlv_filter->mgmt_dma_length);
1804 	DP_MON_FILTER_PRINT("data_dma_length: 0x%x",
1805 			    rx_tlv_filter->data_dma_length);
1806 	DP_MON_FILTER_PRINT("ctrl_dma_length: 0x%x",
1807 			    rx_tlv_filter->ctrl_dma_length);
1808 }
1809 
1810 #ifdef WLAN_PKT_CAPTURE_TX_2_0
dp_tx_mon_filter_show_filter(struct dp_mon_filter_be * filter)1811 static void dp_tx_mon_filter_show_filter(struct dp_mon_filter_be *filter)
1812 {
1813 	struct htt_tx_ring_tlv_filter *tlv_filter = &filter->tx_tlv_filter;
1814 
1815 	DP_MON_FILTER_PRINT("TX Monitor Filter configuration:");
1816 	DP_MON_FILTER_PRINT("Enable: %d", tlv_filter->enable);
1817 	DP_MON_FILTER_PRINT("mgmt_filter: %d", tlv_filter->mgmt_filter);
1818 	DP_MON_FILTER_PRINT("data_filter: %d", tlv_filter->data_filter);
1819 	DP_MON_FILTER_PRINT("ctrl_filter: %d", tlv_filter->ctrl_filter);
1820 	DP_MON_FILTER_PRINT("mgmt_dma_length: %d", tlv_filter->mgmt_dma_length);
1821 	DP_MON_FILTER_PRINT("ctrl_dma_length: %d", tlv_filter->ctrl_dma_length);
1822 	DP_MON_FILTER_PRINT("data_dma_length: %d", tlv_filter->data_dma_length);
1823 	DP_MON_FILTER_PRINT("mgmt_mpdu_end: %d", tlv_filter->mgmt_mpdu_end);
1824 	DP_MON_FILTER_PRINT("mgmt_msdu_end: %d", tlv_filter->mgmt_msdu_end);
1825 	DP_MON_FILTER_PRINT("mgmt_mpdu_start: %d", tlv_filter->mgmt_mpdu_start);
1826 	DP_MON_FILTER_PRINT("mgmt_msdu_start: %d", tlv_filter->mgmt_msdu_start);
1827 	DP_MON_FILTER_PRINT("ctrl_mpdu_end: %d", tlv_filter->ctrl_mpdu_end);
1828 	DP_MON_FILTER_PRINT("ctrl_msdu_end: %d", tlv_filter->ctrl_msdu_end);
1829 	DP_MON_FILTER_PRINT("ctrl_mpdu_start: %d", tlv_filter->ctrl_mpdu_start);
1830 	DP_MON_FILTER_PRINT("ctrl_msdu_start: %d", tlv_filter->ctrl_msdu_start);
1831 	DP_MON_FILTER_PRINT("data_mpdu_end: %d", tlv_filter->data_mpdu_end);
1832 	DP_MON_FILTER_PRINT("data_msdu_end: %d", tlv_filter->data_msdu_end);
1833 	DP_MON_FILTER_PRINT("data_mpdu_start: %d", tlv_filter->data_mpdu_start);
1834 	DP_MON_FILTER_PRINT("data_msdu_start: %d", tlv_filter->data_msdu_start);
1835 	DP_MON_FILTER_PRINT("mgmt_mpdu_log: %d", tlv_filter->mgmt_mpdu_log);
1836 	DP_MON_FILTER_PRINT("ctrl_mpdu_log: %d", tlv_filter->ctrl_mpdu_log);
1837 	DP_MON_FILTER_PRINT("data_mpdu_log: %d", tlv_filter->data_mpdu_log);
1838 
1839 	/* Downstream TLVs */
1840 	DP_MON_FILTER_PRINT("Downstream TLVs");
1841 	DP_MON_FILTER_PRINT("tx_fes_setup: %d", tlv_filter->dtlvs.tx_fes_setup);
1842 	DP_MON_FILTER_PRINT("tx_peer_entry: %d",
1843 			    tlv_filter->dtlvs.tx_peer_entry);
1844 	DP_MON_FILTER_PRINT("tx_queue_extension: %d",
1845 			    tlv_filter->dtlvs.tx_queue_extension);
1846 	DP_MON_FILTER_PRINT("tx_last_mpdu_fetched: %d",
1847 			    tlv_filter->dtlvs.tx_last_mpdu_fetched);
1848 	DP_MON_FILTER_PRINT("tx_data_sync: %d", tlv_filter->dtlvs.tx_data_sync);
1849 	DP_MON_FILTER_PRINT("pcu_ppdu_setup_init: %d",
1850 			    tlv_filter->dtlvs.pcu_ppdu_setup_init);
1851 	DP_MON_FILTER_PRINT("fw2s_mon: %d", tlv_filter->dtlvs.fw2s_mon);
1852 	DP_MON_FILTER_PRINT("tx_loopback_setup: %d",
1853 			    tlv_filter->dtlvs.tx_loopback_setup);
1854 	DP_MON_FILTER_PRINT("sch_critical_tlv_ref: %d",
1855 			    tlv_filter->dtlvs.sch_critical_tlv_ref);
1856 	DP_MON_FILTER_PRINT("ndp_preamble_done: %d",
1857 			    tlv_filter->dtlvs.ndp_preamble_done);
1858 	DP_MON_FILTER_PRINT("tx_raw_frame_setup: %d",
1859 			    tlv_filter->dtlvs.tx_raw_frame_setup);
1860 	DP_MON_FILTER_PRINT("txpcu_user_setup: %d",
1861 			    tlv_filter->dtlvs.txpcu_user_setup);
1862 	DP_MON_FILTER_PRINT("rxpcu_setup: %d", tlv_filter->dtlvs.rxpcu_setup);
1863 	DP_MON_FILTER_PRINT("rxpcu_setup_complete: %d",
1864 			    tlv_filter->dtlvs.rxpcu_setup_complete);
1865 	DP_MON_FILTER_PRINT("coex_tx_req: %d", tlv_filter->dtlvs.coex_tx_req);
1866 	DP_MON_FILTER_PRINT("rxpcu_user_setup: %d",
1867 			    tlv_filter->dtlvs.rxpcu_user_setup);
1868 	DP_MON_FILTER_PRINT("rxpcu_user_setup_ext: %d",
1869 			    tlv_filter->dtlvs.rxpcu_user_setup_ext);
1870 	DP_MON_FILTER_PRINT("wur_data: %d", tlv_filter->dtlvs.wur_data);
1871 	DP_MON_FILTER_PRINT("tqm_mpdu_global_start: %d",
1872 			    tlv_filter->dtlvs.tqm_mpdu_global_start);
1873 	DP_MON_FILTER_PRINT("tx_fes_setup_complete: %d",
1874 			    tlv_filter->dtlvs.tx_fes_setup_complete);
1875 	DP_MON_FILTER_PRINT("scheduler_end: %d",
1876 			    tlv_filter->dtlvs.scheduler_end);
1877 	DP_MON_FILTER_PRINT("sch_wait_instr_tx_path: %d",
1878 			    tlv_filter->dtlvs.sch_wait_instr_tx_path);
1879 
1880 	/* Upstream TLVs */
1881 	DP_MON_FILTER_PRINT("Upstream TLVs");
1882 	DP_MON_FILTER_PRINT("rx_response_required_info: %d",
1883 			    tlv_filter->utlvs.rx_response_required_info);
1884 	DP_MON_FILTER_PRINT("response_start_status: %d",
1885 			    tlv_filter->utlvs.response_start_status);
1886 	DP_MON_FILTER_PRINT("response_end_status: %d",
1887 			    tlv_filter->utlvs.response_end_status);
1888 	DP_MON_FILTER_PRINT("tx_fes_status_start: %d",
1889 			    tlv_filter->utlvs.tx_fes_status_start);
1890 	DP_MON_FILTER_PRINT("tx_fes_status_end: %d",
1891 			    tlv_filter->utlvs.tx_fes_status_end);
1892 	DP_MON_FILTER_PRINT("tx_fes_status_start_ppdu: %d",
1893 			    tlv_filter->utlvs.tx_fes_status_start_ppdu);
1894 	DP_MON_FILTER_PRINT("tx_fes_status_user_ppdu: %d",
1895 			    tlv_filter->utlvs.tx_fes_status_user_ppdu);
1896 	DP_MON_FILTER_PRINT("tx_fes_status_ack_or_ba: %d",
1897 			    tlv_filter->utlvs.tx_fes_status_ack_or_ba);
1898 	DP_MON_FILTER_PRINT("tx_fes_status_1k_ba: %d",
1899 			    tlv_filter->utlvs.tx_fes_status_1k_ba);
1900 	DP_MON_FILTER_PRINT("tx_fes_status_start_prot: %d",
1901 			    tlv_filter->utlvs.tx_fes_status_start_prot);
1902 	DP_MON_FILTER_PRINT("tx_fes_status_prot: %d",
1903 			    tlv_filter->utlvs.tx_fes_status_prot);
1904 	DP_MON_FILTER_PRINT("tx_fes_status_user_response: %d",
1905 			    tlv_filter->utlvs.tx_fes_status_user_response);
1906 	DP_MON_FILTER_PRINT("rx_frame_bitmap_ack: %d",
1907 			    tlv_filter->utlvs.rx_frame_bitmap_ack);
1908 	DP_MON_FILTER_PRINT("rx_frame_1k_bitmap_ack: %d",
1909 			    tlv_filter->utlvs.rx_frame_1k_bitmap_ack);
1910 	DP_MON_FILTER_PRINT("coex_tx_status: %d",
1911 			    tlv_filter->utlvs.coex_tx_status);
1912 	DP_MON_FILTER_PRINT("received_response_info: %d",
1913 			    tlv_filter->utlvs.received_response_info);
1914 	DP_MON_FILTER_PRINT("received_response_info_p2: %d",
1915 			    tlv_filter->utlvs.received_response_info_p2);
1916 	DP_MON_FILTER_PRINT("ofdma_trigger_details: %d",
1917 			    tlv_filter->utlvs.ofdma_trigger_details);
1918 	DP_MON_FILTER_PRINT("received_trigger_info: %d",
1919 			    tlv_filter->utlvs.received_trigger_info);
1920 	DP_MON_FILTER_PRINT("pdg_tx_request: %d",
1921 			    tlv_filter->utlvs.pdg_tx_request);
1922 	DP_MON_FILTER_PRINT("pdg_response: %d",
1923 			    tlv_filter->utlvs.pdg_response);
1924 	DP_MON_FILTER_PRINT("pdg_trig_response: %d",
1925 			    tlv_filter->utlvs.pdg_trig_response);
1926 	DP_MON_FILTER_PRINT("trigger_response_tx_done: %d",
1927 			    tlv_filter->utlvs.trigger_response_tx_done);
1928 	DP_MON_FILTER_PRINT("prot_tx_end: %d", tlv_filter->utlvs.prot_tx_end);
1929 	DP_MON_FILTER_PRINT("ppdu_tx_end: %d", tlv_filter->utlvs.ppdu_tx_end);
1930 	DP_MON_FILTER_PRINT("r2r_status_end: %d",
1931 			    tlv_filter->utlvs.r2r_status_end);
1932 	DP_MON_FILTER_PRINT("flush_req: %d", tlv_filter->utlvs.flush_req);
1933 	DP_MON_FILTER_PRINT("mactx_phy_desc: %d",
1934 			    tlv_filter->utlvs.mactx_phy_desc);
1935 	DP_MON_FILTER_PRINT("mactx_user_desc_cmn: %d",
1936 			    tlv_filter->utlvs.mactx_user_desc_cmn);
1937 	DP_MON_FILTER_PRINT("mactx_user_desc_per_usr: %d",
1938 			    tlv_filter->utlvs.mactx_user_desc_per_usr);
1939 
1940 	DP_MON_FILTER_PRINT("tqm_acked_1k_mpdu: %d",
1941 			    tlv_filter->utlvs.tqm_acked_1k_mpdu);
1942 	DP_MON_FILTER_PRINT("tqm_acked_mpdu: %d",
1943 			    tlv_filter->utlvs.tqm_acked_mpdu);
1944 	DP_MON_FILTER_PRINT("tqm_update_tx_mpdu_count: %d",
1945 			    tlv_filter->utlvs.tqm_update_tx_mpdu_count);
1946 	DP_MON_FILTER_PRINT("phytx_ppdu_header_info_request: %d",
1947 			    tlv_filter->utlvs.phytx_ppdu_header_info_request);
1948 	DP_MON_FILTER_PRINT("u_sig_eht_su_mu: %d",
1949 			    tlv_filter->utlvs.u_sig_eht_su_mu);
1950 	DP_MON_FILTER_PRINT("u_sig_eht_su: %d", tlv_filter->utlvs.u_sig_eht_su);
1951 	DP_MON_FILTER_PRINT("u_sig_eht_tb: %d", tlv_filter->utlvs.u_sig_eht_tb);
1952 	DP_MON_FILTER_PRINT("eht_sig_usr_su: %d",
1953 			    tlv_filter->utlvs.eht_sig_usr_su);
1954 	DP_MON_FILTER_PRINT("eht_sig_usr_mu_mimo: %d",
1955 			    tlv_filter->utlvs.eht_sig_usr_mu_mimo);
1956 	DP_MON_FILTER_PRINT("eht_sig_usr_ofdma: %d",
1957 			    tlv_filter->utlvs.eht_sig_usr_ofdma);
1958 	DP_MON_FILTER_PRINT("he_sig_a_su: %d",
1959 			    tlv_filter->utlvs.he_sig_a_su);
1960 	DP_MON_FILTER_PRINT("he_sig_a_mu_dl: %d",
1961 			    tlv_filter->utlvs.he_sig_a_mu_dl);
1962 	DP_MON_FILTER_PRINT("he_sig_a_mu_ul: %d",
1963 			    tlv_filter->utlvs.he_sig_a_mu_ul);
1964 	DP_MON_FILTER_PRINT("he_sig_b1_mu: %d",
1965 			    tlv_filter->utlvs.he_sig_b1_mu);
1966 	DP_MON_FILTER_PRINT("he_sig_b2_mu: %d",
1967 			    tlv_filter->utlvs.he_sig_b2_mu);
1968 	DP_MON_FILTER_PRINT("he_sig_b2_ofdma: %d",
1969 			    tlv_filter->utlvs.he_sig_b2_ofdma);
1970 	DP_MON_FILTER_PRINT("vht_sig_b_mu160: %d",
1971 			    tlv_filter->utlvs.vht_sig_b_mu160);
1972 	DP_MON_FILTER_PRINT("vht_sig_b_mu80: %d",
1973 			    tlv_filter->utlvs.vht_sig_b_mu80);
1974 	DP_MON_FILTER_PRINT("vht_sig_b_mu40: %d",
1975 			    tlv_filter->utlvs.vht_sig_b_mu40);
1976 	DP_MON_FILTER_PRINT("vht_sig_b_mu20: %d",
1977 			    tlv_filter->utlvs.vht_sig_b_mu20);
1978 	DP_MON_FILTER_PRINT("vht_sig_b_su160: %d",
1979 			    tlv_filter->utlvs.vht_sig_b_su160);
1980 	DP_MON_FILTER_PRINT("vht_sig_b_su80: %d",
1981 			    tlv_filter->utlvs.vht_sig_b_su80);
1982 	DP_MON_FILTER_PRINT("vht_sig_b_su40: %d",
1983 			    tlv_filter->utlvs.vht_sig_b_su40);
1984 	DP_MON_FILTER_PRINT("vht_sig_b_su20: %d",
1985 			    tlv_filter->utlvs.vht_sig_b_su20);
1986 	DP_MON_FILTER_PRINT("vht_sig_a: %d", tlv_filter->utlvs.vht_sig_a);
1987 	DP_MON_FILTER_PRINT("ht_sig: %d", tlv_filter->utlvs.ht_sig);
1988 	DP_MON_FILTER_PRINT("l_sig_b: %d", tlv_filter->utlvs.l_sig_b);
1989 	DP_MON_FILTER_PRINT("l_sig_a: %d", tlv_filter->utlvs.l_sig_a);
1990 	DP_MON_FILTER_PRINT("tx_service: %d", tlv_filter->utlvs.tx_service);
1991 
1992 	DP_MON_FILTER_PRINT("txpcu_buf_status: %d",
1993 			    tlv_filter->utlvs.txpcu_buf_status);
1994 	DP_MON_FILTER_PRINT("txpcu_user_buf_status: %d",
1995 			    tlv_filter->utlvs.txpcu_user_buf_status);
1996 	DP_MON_FILTER_PRINT("txdma_stop_request: %d",
1997 			    tlv_filter->utlvs.txdma_stop_request);
1998 	DP_MON_FILTER_PRINT("expected_response: %d",
1999 			    tlv_filter->utlvs.expected_response);
2000 	DP_MON_FILTER_PRINT("tx_mpdu_count_transfer_end: %d",
2001 			    tlv_filter->utlvs.tx_mpdu_count_transfer_end);
2002 	DP_MON_FILTER_PRINT("rx_trig_info: %d",
2003 			    tlv_filter->utlvs.rx_trig_info);
2004 	DP_MON_FILTER_PRINT("rxpcu_tx_setup_clear: %d",
2005 			    tlv_filter->utlvs.rxpcu_tx_setup_clear);
2006 	DP_MON_FILTER_PRINT("rx_frame_bitmap_req: %d",
2007 			    tlv_filter->utlvs.rx_frame_bitmap_req);
2008 	DP_MON_FILTER_PRINT("rx_phy_sleep: %d",
2009 			    tlv_filter->utlvs.rx_phy_sleep);
2010 	DP_MON_FILTER_PRINT("txpcu_preamble_done: %d",
2011 			    tlv_filter->utlvs.txpcu_preamble_done);
2012 	DP_MON_FILTER_PRINT("txpcu_phytx_debug32: %d",
2013 			    tlv_filter->utlvs.txpcu_phytx_debug32);
2014 	DP_MON_FILTER_PRINT("txpcu_phytx_other_transmit_info32: %d",
2015 			    tlv_filter->utlvs.txpcu_phytx_other_transmit_info32);
2016 	DP_MON_FILTER_PRINT("rx_ppdu_noack_report: %d",
2017 			    tlv_filter->utlvs.rx_ppdu_noack_report);
2018 	DP_MON_FILTER_PRINT("rx_ppdu_ack_report: %d",
2019 			    tlv_filter->utlvs.rx_ppdu_ack_report);
2020 	DP_MON_FILTER_PRINT("coex_rx_status: %d",
2021 			    tlv_filter->utlvs.coex_rx_status);
2022 	DP_MON_FILTER_PRINT("rx_start_param: %d",
2023 			    tlv_filter->utlvs.rx_start_param);
2024 	DP_MON_FILTER_PRINT("tx_cbf_info: %d",
2025 			    tlv_filter->utlvs.tx_cbf_info);
2026 	DP_MON_FILTER_PRINT("rxpcu_early_rx_indication: %d",
2027 			    tlv_filter->utlvs.rxpcu_early_rx_indication);
2028 	DP_MON_FILTER_PRINT("received_response_user_7_0: %d",
2029 			    tlv_filter->utlvs.received_response_user_7_0);
2030 	DP_MON_FILTER_PRINT("received_response_user_15_8: %d",
2031 			    tlv_filter->utlvs.received_response_user_15_8);
2032 	DP_MON_FILTER_PRINT("received_response_user_23_16: %d",
2033 			    tlv_filter->utlvs.received_response_user_23_16);
2034 	DP_MON_FILTER_PRINT("received_response_user_31_24: %d",
2035 			    tlv_filter->utlvs.received_response_user_31_24);
2036 	DP_MON_FILTER_PRINT("received_response_user_36_32: %d",
2037 			    tlv_filter->utlvs.received_response_user_36_32);
2038 	DP_MON_FILTER_PRINT("rx_pm_info: %d",
2039 			    tlv_filter->utlvs.rx_pm_info);
2040 	DP_MON_FILTER_PRINT("rx_preamble: %d",
2041 			    tlv_filter->utlvs.rx_preamble);
2042 	DP_MON_FILTER_PRINT("others: %d",
2043 			    tlv_filter->utlvs.others);
2044 	DP_MON_FILTER_PRINT("mactx_pre_phy_desc: %d",
2045 			    tlv_filter->utlvs.mactx_pre_phy_desc);
2046 
2047 	/* Word mask subscription */
2048 	DP_MON_FILTER_PRINT("wmask tx_fes_setup: %d",
2049 			    tlv_filter->wmask.tx_fes_setup);
2050 	DP_MON_FILTER_PRINT("wmask tx_peer_entry: %d",
2051 			    tlv_filter->wmask.tx_peer_entry);
2052 	DP_MON_FILTER_PRINT("wmask tx_queue_ext: %d",
2053 			    tlv_filter->wmask.tx_queue_ext);
2054 	DP_MON_FILTER_PRINT("wmask tx_msdu_start: %d",
2055 			    tlv_filter->wmask.tx_msdu_start);
2056 	DP_MON_FILTER_PRINT("wmask tx_mpdu_start: %d",
2057 			    tlv_filter->wmask.tx_mpdu_start);
2058 	DP_MON_FILTER_PRINT("wmask pcu_ppdu_setup_init: %d",
2059 			    tlv_filter->wmask.pcu_ppdu_setup_init);
2060 	DP_MON_FILTER_PRINT("wmask rxpcu_user_setup: %d",
2061 			    tlv_filter->wmask.rxpcu_user_setup);
2062 }
2063 
dp_mon_filter_show_tx_filter_be(enum dp_mon_filter_mode mode,struct dp_mon_filter_be * filter)2064 void dp_mon_filter_show_tx_filter_be(enum dp_mon_filter_mode mode,
2065 				     struct dp_mon_filter_be *filter)
2066 {
2067 	DP_MON_FILTER_PRINT("TX MON RING TLV FILTER CONFIG:");
2068 	DP_MON_FILTER_PRINT("[Mode %d]: Valid: %d", mode, filter->tx_valid);
2069 
2070 	if (filter->tx_valid)
2071 		dp_tx_mon_filter_show_filter(filter);
2072 }
2073 
2074 #endif
2075 
dp_mon_filter_show_rx_filter_be(enum dp_mon_filter_mode mode,struct dp_mon_filter_be * filter)2076 void dp_mon_filter_show_rx_filter_be(enum dp_mon_filter_mode mode,
2077 				     struct dp_mon_filter_be *filter)
2078 {
2079 	DP_MON_FILTER_PRINT("RX MON RING TLV FILTER CONFIG:");
2080 	DP_MON_FILTER_PRINT("[Mode %d]: Valid: %d",
2081 			    mode, filter->rx_tlv_filter.valid);
2082 
2083 	if (filter->rx_tlv_filter.valid)
2084 		dp_rx_mon_filter_show_filter(filter);
2085 }
2086 
2087 #ifdef WDI_EVENT_ENABLE
dp_mon_filter_setup_rx_pkt_log_full_2_0(struct dp_pdev * pdev)2088 void dp_mon_filter_setup_rx_pkt_log_full_2_0(struct dp_pdev *pdev)
2089 {
2090 	struct dp_mon_filter_be filter = {0};
2091 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_FULL_MODE;
2092 	enum dp_mon_filter_srng_type srng_type =
2093 		DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
2094 	struct dp_mon_pdev *mon_pdev = NULL;
2095 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
2096 	struct htt_rx_ring_tlv_filter *rx_tlv_filter =
2097 		&filter.rx_tlv_filter.tlv_filter;
2098 
2099 	if (!pdev) {
2100 		dp_mon_filter_err("pdev Context is null");
2101 		return;
2102 	}
2103 
2104 	mon_pdev = pdev->monitor_pdev;
2105 	if (!mon_pdev) {
2106 		dp_mon_filter_err("Monitor pdev context is null");
2107 		return;
2108 	}
2109 
2110 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2111 
2112 	/* Enabled the filter */
2113 	filter.rx_tlv_filter.valid = true;
2114 	dp_mon_filter_set_status_cmn(&mon_pdev_be->mon_pdev,
2115 				     &filter.rx_tlv_filter);
2116 
2117 	/* Setup the filter */
2118 	rx_tlv_filter->packet_header = 1;
2119 	rx_tlv_filter->msdu_start = 1;
2120 	rx_tlv_filter->msdu_end = 1;
2121 	rx_tlv_filter->mpdu_end = 1;
2122 
2123 	dp_mon_filter_show_rx_filter_be(mode, &filter);
2124 	mon_pdev_be->filter_be[mode][srng_type] = filter;
2125 }
2126 
dp_mon_filter_reset_rx_pkt_log_full_2_0(struct dp_pdev * pdev)2127 void dp_mon_filter_reset_rx_pkt_log_full_2_0(struct dp_pdev *pdev)
2128 {
2129 	struct dp_mon_filter_be filter = {0};
2130 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_FULL_MODE;
2131 	enum dp_mon_filter_srng_type srng_type =
2132 		DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
2133 	struct dp_mon_pdev *mon_pdev = NULL;
2134 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
2135 
2136 	if (!pdev) {
2137 		dp_mon_filter_err("pdev Context is null");
2138 		return;
2139 	}
2140 
2141 	mon_pdev = pdev->monitor_pdev;
2142 	if (!mon_pdev) {
2143 		dp_mon_filter_err("Monitor pdev context is null");
2144 		return;
2145 	}
2146 
2147 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2148 
2149 	mon_pdev_be->filter_be[mode][srng_type] = filter;
2150 }
2151 
dp_mon_filter_setup_rx_pkt_log_lite_2_0(struct dp_pdev * pdev)2152 void dp_mon_filter_setup_rx_pkt_log_lite_2_0(struct dp_pdev *pdev)
2153 {
2154 	struct dp_mon_filter_be filter = {0};
2155 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_LITE_MODE;
2156 	enum dp_mon_filter_srng_type srng_type =
2157 		DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
2158 	struct dp_mon_pdev *mon_pdev = NULL;
2159 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
2160 
2161 	if (!pdev) {
2162 		dp_mon_filter_err("pdev Context is null");
2163 		return;
2164 	}
2165 
2166 	mon_pdev = pdev->monitor_pdev;
2167 	if (!mon_pdev) {
2168 		dp_mon_filter_err("Monitor pdev context is null");
2169 		return;
2170 	}
2171 
2172 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2173 
2174 	/* Enabled the filter */
2175 	filter.rx_tlv_filter.valid = true;
2176 	dp_mon_filter_set_status_cmn(&mon_pdev_be->mon_pdev,
2177 				     &filter.rx_tlv_filter);
2178 
2179 	dp_mon_filter_show_rx_filter_be(mode, &filter);
2180 	mon_pdev_be->filter_be[mode][srng_type] = filter;
2181 }
2182 
dp_mon_filter_reset_rx_pkt_log_lite_2_0(struct dp_pdev * pdev)2183 void dp_mon_filter_reset_rx_pkt_log_lite_2_0(struct dp_pdev *pdev)
2184 {
2185 	struct dp_mon_filter_be filter = {0};
2186 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_LITE_MODE;
2187 	enum dp_mon_filter_srng_type srng_type =
2188 		DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
2189 	struct dp_mon_pdev *mon_pdev = NULL;
2190 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
2191 
2192 	if (!pdev) {
2193 		dp_mon_filter_err("pdev Context is null");
2194 		return;
2195 	}
2196 
2197 	mon_pdev = pdev->monitor_pdev;
2198 	if (!mon_pdev) {
2199 		dp_mon_filter_err("Monitor pdev context is null");
2200 		return;
2201 	}
2202 
2203 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2204 
2205 	mon_pdev_be->filter_be[mode][srng_type] = filter;
2206 }
2207 
2208 #ifdef QCA_MONITOR_PKT_SUPPORT
2209 static void
dp_mon_filter_set_reset_rx_pkt_log_cbf_dest_2_0(struct dp_pdev_be * pdev_be,struct dp_mon_filter_be * filter)2210 dp_mon_filter_set_reset_rx_pkt_log_cbf_dest_2_0(struct dp_pdev_be *pdev_be,
2211 						struct dp_mon_filter_be *filter)
2212 {
2213 	struct dp_soc *soc = pdev_be->pdev.soc;
2214 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_CBF_MODE;
2215 	enum dp_mon_filter_srng_type srng_type;
2216 	struct dp_mon_pdev *mon_pdev = pdev_be->pdev.monitor_pdev;
2217 	struct dp_mon_pdev_be *mon_pdev_be =
2218 			dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2219 	struct htt_rx_ring_tlv_filter *rx_tlv_filter =
2220 		&filter->rx_tlv_filter.tlv_filter;
2221 
2222 	srng_type = ((soc->wlan_cfg_ctx->rxdma1_enable) ?
2223 		     DP_MON_FILTER_SRNG_TYPE_RXDMA_MON_BUF :
2224 		     DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF);
2225 
2226 	/*set the filter */
2227 	if (filter->rx_tlv_filter.valid) {
2228 		dp_mon_filter_set_cbf_cmn(&pdev_be->pdev,
2229 					  &filter->rx_tlv_filter);
2230 
2231 		rx_tlv_filter->attention = 0;
2232 		dp_mon_filter_show_rx_filter_be(mode, filter);
2233 		mon_pdev_be->filter_be[mode][srng_type] = *filter;
2234 	} else /* reset the filter */
2235 		mon_pdev_be->filter_be[mode][srng_type] = *filter;
2236 }
2237 #else
2238 static void
dp_mon_filter_set_reset_rx_pkt_log_cbf_dest_2_0(struct dp_pdev_be * pdev,struct dp_mon_filter_be * filter)2239 dp_mon_filter_set_reset_rx_pkt_log_cbf_dest_2_0(struct dp_pdev_be *pdev,
2240 						struct dp_mon_filter_be *filter)
2241 {
2242 }
2243 #endif
2244 
dp_mon_filter_setup_rx_pkt_log_cbf_2_0(struct dp_pdev * pdev)2245 void dp_mon_filter_setup_rx_pkt_log_cbf_2_0(struct dp_pdev *pdev)
2246 {
2247 	struct dp_mon_filter_be filter = {0};
2248 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_CBF_MODE;
2249 	enum dp_mon_filter_srng_type srng_type =
2250 		DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
2251 	struct dp_mon_pdev *mon_pdev = NULL;
2252 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
2253 	struct dp_pdev_be *pdev_be = NULL;
2254 
2255 	if (!pdev) {
2256 		dp_mon_filter_err("pdev Context is null");
2257 		return;
2258 	}
2259 
2260 	mon_pdev = pdev->monitor_pdev;
2261 	if (!mon_pdev) {
2262 		dp_mon_filter_err("Monitor pdev context is null");
2263 		return;
2264 	}
2265 
2266 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2267 
2268 	pdev_be = dp_get_be_pdev_from_dp_pdev(pdev);
2269 
2270 	/* Enabled the filter */
2271 	filter.rx_tlv_filter.valid = true;
2272 
2273 	dp_mon_filter_set_status_cbf(pdev, &filter.rx_tlv_filter);
2274 	dp_mon_filter_show_rx_filter_be(mode, &filter);
2275 	mon_pdev_be->filter_be[mode][srng_type] = filter;
2276 
2277 	/* Clear the filter as the same filter will be used to set the
2278 	 * monitor status ring
2279 	 */
2280 	qdf_mem_zero(&filter, sizeof(struct dp_mon_filter_be));
2281 
2282 	filter.rx_tlv_filter.valid = true;
2283 	dp_mon_filter_set_reset_rx_pkt_log_cbf_dest_2_0(pdev_be, &filter);
2284 }
2285 
dp_mon_filter_reset_rx_pktlog_cbf_2_0(struct dp_pdev * pdev)2286 void dp_mon_filter_reset_rx_pktlog_cbf_2_0(struct dp_pdev *pdev)
2287 {
2288 	struct dp_mon_filter_be filter = {0};
2289 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_CBF_MODE;
2290 	enum dp_mon_filter_srng_type srng_type =
2291 		DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF;
2292 	struct dp_mon_pdev *mon_pdev = NULL;
2293 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
2294 	struct dp_pdev_be *pdev_be = NULL;
2295 
2296 	if (!pdev) {
2297 		QDF_TRACE(QDF_MODULE_ID_MON_FILTER, QDF_TRACE_LEVEL_ERROR,
2298 			  FL("pdev Context is null"));
2299 		return;
2300 	}
2301 
2302 	mon_pdev = pdev->monitor_pdev;
2303 	if (!mon_pdev) {
2304 		dp_mon_filter_err("Monitor pdev context is null");
2305 		return;
2306 	}
2307 
2308 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2309 
2310 	pdev_be = dp_get_be_pdev_from_dp_pdev(pdev);
2311 
2312 	/* Enabled the filter */
2313 	filter.rx_tlv_filter.valid = true;
2314 
2315 	dp_mon_filter_set_reset_rx_pkt_log_cbf_dest_2_0(pdev_be, &filter);
2316 
2317 	srng_type = DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
2318 	mon_pdev_be->filter_be[mode][srng_type] = filter;
2319 }
2320 
2321 #if defined(BE_PKTLOG_SUPPORT) && \
2322 defined(WLAN_PKT_CAPTURE_TX_2_0)
dp_mon_filter_setup_pktlog_hybrid_2_0(struct dp_pdev * pdev)2323 void dp_mon_filter_setup_pktlog_hybrid_2_0(struct dp_pdev *pdev)
2324 {
2325 	struct dp_mon_filter_be filter = {0};
2326 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_HYBRID_MODE;
2327 	enum dp_mon_filter_srng_type srng_type =
2328 		DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
2329 	struct htt_tx_ring_tlv_filter *tlv_filter = &filter.tx_tlv_filter;
2330 	struct dp_mon_pdev *mon_pdev = NULL;
2331 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
2332 
2333 	if (!pdev) {
2334 		dp_mon_filter_err("pdev Context is null");
2335 		return;
2336 	}
2337 
2338 	mon_pdev = pdev->monitor_pdev;
2339 	if (!mon_pdev) {
2340 		dp_mon_filter_err("Monitor pdev context is null");
2341 		return;
2342 	}
2343 
2344 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2345 
2346 	/* Enabled the filter */
2347 	filter.tx_valid = true;
2348 
2349 	/* Setup the filter */
2350 	tlv_filter->utlvs.tx_fes_status_start = 1;
2351 	tlv_filter->utlvs.tx_fes_status_start_prot = 1;
2352 	tlv_filter->utlvs.tx_fes_status_prot = 1;
2353 	tlv_filter->utlvs.tx_fes_status_start_ppdu = 1;
2354 	tlv_filter->utlvs.tx_fes_status_user_ppdu = 1;
2355 	tlv_filter->utlvs.tx_fes_status_ack_or_ba = 1;
2356 	tlv_filter->utlvs.tx_fes_status_1k_ba = 1;
2357 	tlv_filter->utlvs.tx_fes_status_user_response = 1;
2358 	tlv_filter->utlvs.tx_fes_status_end = 1;
2359 	tlv_filter->utlvs.response_start_status = 1;
2360 	tlv_filter->utlvs.received_response_info = 1;
2361 	tlv_filter->utlvs.received_response_info_p2 = 1;
2362 	tlv_filter->utlvs.response_end_status = 1;
2363 
2364 	tlv_filter->mgmt_filter = 0x1;
2365 	tlv_filter->data_filter = 0x1;
2366 	tlv_filter->ctrl_filter = 0x1;
2367 
2368 	tlv_filter->mgmt_mpdu_end = 1;
2369 	tlv_filter->mgmt_msdu_end = 1;
2370 	tlv_filter->mgmt_msdu_start = 1;
2371 	tlv_filter->mgmt_mpdu_start = 1;
2372 	tlv_filter->ctrl_mpdu_end = 1;
2373 	tlv_filter->ctrl_msdu_end = 1;
2374 	tlv_filter->ctrl_msdu_start = 1;
2375 	tlv_filter->ctrl_mpdu_start = 1;
2376 	tlv_filter->data_mpdu_end = 1;
2377 	tlv_filter->data_msdu_end = 1;
2378 	tlv_filter->data_msdu_start = 1;
2379 	tlv_filter->data_mpdu_start = 1;
2380 	tlv_filter->mgmt_mpdu_log = 1;
2381 	tlv_filter->ctrl_mpdu_log = 1;
2382 	tlv_filter->data_mpdu_log = 1;
2383 
2384 	tlv_filter->mgmt_dma_length = mon_pdev_be->tx_mon_filter_length;
2385 	tlv_filter->ctrl_dma_length = mon_pdev_be->tx_mon_filter_length;
2386 	tlv_filter->data_dma_length = mon_pdev_be->tx_mon_filter_length;
2387 	dp_mon_filter_show_tx_filter_be(mode, &filter);
2388 	mon_pdev_be->filter_be[mode][srng_type] = filter;
2389 }
2390 
dp_mon_filter_reset_pktlog_hybrid_2_0(struct dp_pdev * pdev)2391 void dp_mon_filter_reset_pktlog_hybrid_2_0(struct dp_pdev *pdev)
2392 {
2393 	struct dp_mon_filter_be filter = {0};
2394 	enum dp_mon_filter_mode mode = DP_MON_FILTER_PKT_LOG_HYBRID_MODE;
2395 	enum dp_mon_filter_srng_type srng_type =
2396 		DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
2397 	struct dp_mon_pdev *mon_pdev = NULL;
2398 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
2399 
2400 	if (!pdev) {
2401 		dp_mon_filter_err("pdev Context is null");
2402 		return;
2403 	}
2404 
2405 	mon_pdev = pdev->monitor_pdev;
2406 	if (!mon_pdev) {
2407 		dp_mon_filter_err("Monitor pdev context is null");
2408 		return;
2409 	}
2410 
2411 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2412 
2413 	mon_pdev_be->filter_be[mode][srng_type] = filter;
2414 }
2415 #endif
2416 #endif /* WDI_EVENT_ENABLE */
2417 
2418 /**
2419  * dp_rx_mon_filter_h2t_setup() - Setup the filter for the Target setup
2420  * @soc: DP soc handle
2421  * @pdev: DP pdev handle
2422  * @srng_type: The srng type for which filter will be set
2423  * @filter: tlv filter
2424  */
2425 static void
dp_rx_mon_filter_h2t_setup(struct dp_soc * soc,struct dp_pdev * pdev,enum dp_mon_filter_srng_type srng_type,struct dp_mon_filter * filter)2426 dp_rx_mon_filter_h2t_setup(struct dp_soc *soc, struct dp_pdev *pdev,
2427 			   enum dp_mon_filter_srng_type srng_type,
2428 			   struct dp_mon_filter *filter)
2429 {
2430 	int32_t current_mode = 0;
2431 	struct htt_rx_ring_tlv_filter *tlv_filter = &filter->tlv_filter;
2432 	struct htt_rx_ring_tlv_filter *src_tlv_filter;
2433 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
2434 	struct dp_mon_pdev_be *mon_pdev_be =
2435 		dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2436 	struct dp_mon_filter_be *mon_filter;
2437 	uint32_t src_filter = 0, dst_filter = 0;
2438 
2439 	/*
2440 	 * Loop through all the modes.
2441 	 */
2442 	for (current_mode = 0; current_mode < DP_MON_FILTER_MAX_MODE;
2443 	     current_mode++) {
2444 		mon_filter =
2445 			&mon_pdev_be->filter_be[current_mode][srng_type];
2446 		src_tlv_filter = &mon_filter->rx_tlv_filter.tlv_filter;
2447 
2448 		/*
2449 		 * Check if the correct mode is enabled or not.
2450 		 */
2451 		if (!mon_filter->rx_tlv_filter.valid)
2452 			continue;
2453 
2454 		filter->valid = true;
2455 
2456 		/*
2457 		 * Set the super bit fields
2458 		 */
2459 		src_filter =
2460 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2461 					  FILTER_TLV);
2462 		dst_filter = DP_MON_FILTER_GET(tlv_filter, FILTER_TLV);
2463 		dst_filter |= src_filter;
2464 		DP_MON_FILTER_SET(tlv_filter, FILTER_TLV, dst_filter);
2465 
2466 		/*
2467 		 * Set the filter management filter.
2468 		 */
2469 		src_filter =
2470 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2471 					  FILTER_FP_MGMT);
2472 		dst_filter = DP_MON_FILTER_GET(tlv_filter, FILTER_FP_MGMT);
2473 		dst_filter |= src_filter;
2474 		DP_MON_FILTER_SET(tlv_filter, FILTER_FP_MGMT, dst_filter);
2475 
2476 		/*
2477 		 * Set the monitor other management filter.
2478 		 */
2479 		src_filter =
2480 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2481 					  FILTER_MO_MGMT);
2482 		dst_filter = DP_MON_FILTER_GET(tlv_filter, FILTER_MO_MGMT);
2483 		dst_filter |= src_filter;
2484 		DP_MON_FILTER_SET(tlv_filter, FILTER_MO_MGMT, dst_filter);
2485 
2486 		/*
2487 		 * Set the filter pass control filter.
2488 		 */
2489 		src_filter =
2490 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2491 					  FILTER_FP_CTRL);
2492 		dst_filter = DP_MON_FILTER_GET(tlv_filter, FILTER_FP_CTRL);
2493 		dst_filter |= src_filter;
2494 		DP_MON_FILTER_SET(tlv_filter, FILTER_FP_CTRL, dst_filter);
2495 
2496 		/*
2497 		 * Set the monitor other control filter.
2498 		 */
2499 		src_filter =
2500 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2501 					  FILTER_MO_CTRL);
2502 		dst_filter = DP_MON_FILTER_GET(tlv_filter, FILTER_MO_CTRL);
2503 		dst_filter |= src_filter;
2504 		DP_MON_FILTER_SET(tlv_filter, FILTER_MO_CTRL, dst_filter);
2505 
2506 		/*
2507 		 * Set the filter pass data filter.
2508 		 */
2509 		src_filter =
2510 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2511 					  FILTER_FP_DATA);
2512 		dst_filter = DP_MON_FILTER_GET(tlv_filter,
2513 					       FILTER_FP_DATA);
2514 		dst_filter |= src_filter;
2515 		DP_MON_FILTER_SET(tlv_filter, FILTER_FP_DATA, dst_filter);
2516 
2517 		/*
2518 		 * Set the monitor other data filter.
2519 		 */
2520 		src_filter =
2521 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2522 					  FILTER_MO_DATA);
2523 		dst_filter = DP_MON_FILTER_GET(tlv_filter, FILTER_MO_DATA);
2524 		dst_filter |= src_filter;
2525 		DP_MON_FILTER_SET(tlv_filter, FILTER_MO_DATA, dst_filter);
2526 
2527 		/*
2528 		 * Set the monitor direct data filter.
2529 		 */
2530 		src_filter =
2531 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2532 					  FILTER_MD_DATA);
2533 		dst_filter = DP_MON_FILTER_GET(tlv_filter,
2534 					       FILTER_MD_DATA);
2535 		dst_filter |= src_filter;
2536 		DP_MON_FILTER_SET(tlv_filter,
2537 				  FILTER_MD_DATA, dst_filter);
2538 
2539 		/*
2540 		 * Set the monitor direct management filter.
2541 		 */
2542 		src_filter =
2543 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2544 					  FILTER_MD_MGMT);
2545 		dst_filter = DP_MON_FILTER_GET(tlv_filter, FILTER_MD_MGMT);
2546 		dst_filter |= src_filter;
2547 		DP_MON_FILTER_SET(tlv_filter, FILTER_MD_MGMT, dst_filter);
2548 
2549 		/*
2550 		 * Set the monitor direct management filter.
2551 		 */
2552 		src_filter =
2553 			DP_MON_FILTER_GET(&mon_filter->rx_tlv_filter.tlv_filter,
2554 					  FILTER_MD_CTRL);
2555 		dst_filter = DP_MON_FILTER_GET(tlv_filter, FILTER_MD_CTRL);
2556 		dst_filter |= src_filter;
2557 		DP_MON_FILTER_SET(tlv_filter, FILTER_MD_CTRL, dst_filter);
2558 
2559 		/*
2560 		 * set the dma length for type mgmt
2561 		 */
2562 		if (src_tlv_filter->mgmt_dma_length &&
2563 		    !tlv_filter->mgmt_dma_length)
2564 			tlv_filter->mgmt_dma_length =
2565 				src_tlv_filter->mgmt_dma_length;
2566 
2567 		/*
2568 		 * set the dma length for type ctrl
2569 		 */
2570 		if (src_tlv_filter->ctrl_dma_length &&
2571 		    !tlv_filter->ctrl_dma_length)
2572 			tlv_filter->ctrl_dma_length =
2573 				src_tlv_filter->ctrl_dma_length;
2574 
2575 		/*
2576 		 * set the dma length for type data
2577 		 */
2578 		if (src_tlv_filter->data_dma_length &&
2579 		    !tlv_filter->data_dma_length)
2580 			tlv_filter->data_dma_length =
2581 				src_tlv_filter->data_dma_length;
2582 
2583 		/*
2584 		 * set mpdu logging for type mgmt
2585 		 */
2586 		if (src_tlv_filter->mgmt_mpdu_log &&
2587 		    !tlv_filter->mgmt_mpdu_log)
2588 			tlv_filter->mgmt_mpdu_log =
2589 				src_tlv_filter->mgmt_mpdu_log;
2590 
2591 		/*
2592 		 * set mpdu logging for type ctrl
2593 		 */
2594 		if (src_tlv_filter->ctrl_mpdu_log &&
2595 		    !tlv_filter->ctrl_mpdu_log)
2596 			tlv_filter->ctrl_mpdu_log =
2597 				src_tlv_filter->ctrl_mpdu_log;
2598 
2599 		/*
2600 		 * set mpdu logging for type data
2601 		 */
2602 		if (src_tlv_filter->data_mpdu_log &&
2603 		    !tlv_filter->data_mpdu_log)
2604 			tlv_filter->data_mpdu_log =
2605 				src_tlv_filter->data_mpdu_log;
2606 
2607 		/*
2608 		 * set hdr tlv length
2609 		 */
2610 		if (src_tlv_filter->rx_hdr_length &&
2611 		    !tlv_filter->rx_hdr_length)
2612 			tlv_filter->rx_hdr_length =
2613 				src_tlv_filter->rx_hdr_length;
2614 
2615 		if (src_tlv_filter->rx_pkt_tlv_offset &&
2616 		    !tlv_filter->rx_pkt_tlv_offset)
2617 			tlv_filter->rx_pkt_tlv_offset =
2618 				src_tlv_filter->rx_pkt_tlv_offset;
2619 
2620 		/*
2621 		 * set fpmo filter settings
2622 		 */
2623 		if (src_tlv_filter->enable_fpmo &&
2624 		    !tlv_filter->enable_fpmo) {
2625 			tlv_filter->enable_fpmo =
2626 				src_tlv_filter->enable_fpmo;
2627 			tlv_filter->fpmo_data_filter =
2628 				src_tlv_filter->fpmo_data_filter;
2629 			tlv_filter->fpmo_mgmt_filter =
2630 				src_tlv_filter->fpmo_mgmt_filter;
2631 			tlv_filter->fpmo_ctrl_filter =
2632 				src_tlv_filter->fpmo_ctrl_filter;
2633 		}
2634 
2635 		dp_mon_filter_show_rx_filter_be(current_mode, mon_filter);
2636 	}
2637 }
2638 
2639 #ifdef WLAN_PKT_CAPTURE_TX_2_0
2640 static
dp_tx_mon_downstream_tlv_set(struct htt_tx_ring_tlv_filter * dst_filter,struct htt_tx_ring_tlv_filter * src_filter)2641 void dp_tx_mon_downstream_tlv_set(struct htt_tx_ring_tlv_filter *dst_filter,
2642 				  struct htt_tx_ring_tlv_filter *src_filter)
2643 {
2644 	dst_filter->dtlvs.tx_fes_setup |=
2645 		src_filter->dtlvs.tx_fes_setup;
2646 	dst_filter->dtlvs.tx_peer_entry |=
2647 		src_filter->dtlvs.tx_peer_entry;
2648 	dst_filter->dtlvs.tx_queue_extension |=
2649 		src_filter->dtlvs.tx_queue_extension;
2650 	dst_filter->dtlvs.tx_last_mpdu_end |=
2651 		src_filter->dtlvs.tx_last_mpdu_end;
2652 	dst_filter->dtlvs.tx_last_mpdu_fetched |=
2653 		src_filter->dtlvs.tx_last_mpdu_fetched;
2654 	dst_filter->dtlvs.tx_data_sync |=
2655 		src_filter->dtlvs.tx_data_sync;
2656 	dst_filter->dtlvs.pcu_ppdu_setup_init |=
2657 		src_filter->dtlvs.pcu_ppdu_setup_init;
2658 	dst_filter->dtlvs.fw2s_mon |=
2659 		src_filter->dtlvs.fw2s_mon;
2660 	dst_filter->dtlvs.tx_loopback_setup |=
2661 		src_filter->dtlvs.tx_loopback_setup;
2662 	dst_filter->dtlvs.sch_critical_tlv_ref |=
2663 		src_filter->dtlvs.sch_critical_tlv_ref;
2664 	dst_filter->dtlvs.ndp_preamble_done |=
2665 		src_filter->dtlvs.ndp_preamble_done;
2666 	dst_filter->dtlvs.tx_raw_frame_setup |=
2667 		src_filter->dtlvs.tx_raw_frame_setup;
2668 	dst_filter->dtlvs.txpcu_user_setup |=
2669 		src_filter->dtlvs.txpcu_user_setup;
2670 	dst_filter->dtlvs.rxpcu_setup |=
2671 		src_filter->dtlvs.rxpcu_setup;
2672 	dst_filter->dtlvs.rxpcu_setup_complete |=
2673 		src_filter->dtlvs.rxpcu_setup_complete;
2674 	dst_filter->dtlvs.coex_tx_req |=
2675 		src_filter->dtlvs.coex_tx_req;
2676 	dst_filter->dtlvs.rxpcu_user_setup |=
2677 		src_filter->dtlvs.rxpcu_user_setup;
2678 	dst_filter->dtlvs.rxpcu_user_setup_ext |=
2679 		src_filter->dtlvs.rxpcu_user_setup_ext;
2680 	dst_filter->dtlvs.wur_data |= src_filter->dtlvs.wur_data;
2681 	dst_filter->dtlvs.tqm_mpdu_global_start |=
2682 		src_filter->dtlvs.tqm_mpdu_global_start;
2683 	dst_filter->dtlvs.tx_fes_setup_complete |=
2684 		src_filter->dtlvs.tx_fes_setup_complete;
2685 	dst_filter->dtlvs.scheduler_end |= src_filter->dtlvs.scheduler_end;
2686 	dst_filter->dtlvs.sch_wait_instr_tx_path |=
2687 		src_filter->dtlvs.sch_wait_instr_tx_path;
2688 }
2689 
2690 static
dp_tx_mon_upstream_tlv_set(struct htt_tx_ring_tlv_filter * dst_filter,struct htt_tx_ring_tlv_filter * src_filter)2691 void dp_tx_mon_upstream_tlv_set(struct htt_tx_ring_tlv_filter *dst_filter,
2692 				struct htt_tx_ring_tlv_filter *src_filter)
2693 {
2694 	dst_filter->utlvs.rx_response_required_info |=
2695 		src_filter->utlvs.rx_response_required_info;
2696 	dst_filter->utlvs.response_start_status |=
2697 		src_filter->utlvs.response_start_status;
2698 	dst_filter->utlvs.response_end_status |=
2699 		src_filter->utlvs.response_end_status;
2700 	dst_filter->utlvs.tx_fes_status_start |=
2701 		src_filter->utlvs.tx_fes_status_start;
2702 	dst_filter->utlvs.tx_fes_status_end |=
2703 		src_filter->utlvs.tx_fes_status_end;
2704 	dst_filter->utlvs.tx_fes_status_start_ppdu |=
2705 		src_filter->utlvs.tx_fes_status_start_ppdu;
2706 	dst_filter->utlvs.tx_fes_status_user_ppdu |=
2707 		src_filter->utlvs.tx_fes_status_user_ppdu;
2708 	dst_filter->utlvs.tx_fes_status_ack_or_ba |=
2709 		src_filter->utlvs.tx_fes_status_ack_or_ba;
2710 	dst_filter->utlvs.tx_fes_status_1k_ba |=
2711 		src_filter->utlvs.tx_fes_status_1k_ba;
2712 	dst_filter->utlvs.tx_fes_status_start_prot |=
2713 		src_filter->utlvs.tx_fes_status_start_prot;
2714 	dst_filter->utlvs.tx_fes_status_prot |=
2715 		src_filter->utlvs.tx_fes_status_prot;
2716 	dst_filter->utlvs.tx_fes_status_user_response |=
2717 		src_filter->utlvs.tx_fes_status_user_response;
2718 	dst_filter->utlvs.rx_frame_bitmap_ack |=
2719 		src_filter->utlvs.rx_frame_bitmap_ack;
2720 	dst_filter->utlvs.rx_frame_1k_bitmap_ack |=
2721 		src_filter->utlvs.rx_frame_1k_bitmap_ack;
2722 	dst_filter->utlvs.coex_tx_status |=
2723 		src_filter->utlvs.coex_tx_status;
2724 	dst_filter->utlvs.received_response_info |=
2725 		src_filter->utlvs.received_response_info;
2726 	dst_filter->utlvs.received_response_info_p2 |=
2727 		src_filter->utlvs.received_response_info_p2;
2728 	dst_filter->utlvs.ofdma_trigger_details |=
2729 		src_filter->utlvs.ofdma_trigger_details;
2730 	dst_filter->utlvs.received_trigger_info |=
2731 		src_filter->utlvs.received_trigger_info;
2732 	dst_filter->utlvs.pdg_tx_request |=
2733 		src_filter->utlvs.pdg_tx_request;
2734 	dst_filter->utlvs.pdg_response |=
2735 		src_filter->utlvs.pdg_response;
2736 	dst_filter->utlvs.pdg_trig_response |=
2737 		src_filter->utlvs.pdg_trig_response;
2738 	dst_filter->utlvs.trigger_response_tx_done |=
2739 		src_filter->utlvs.trigger_response_tx_done;
2740 	dst_filter->utlvs.prot_tx_end |=
2741 		src_filter->utlvs.prot_tx_end;
2742 	dst_filter->utlvs.ppdu_tx_end |=
2743 		src_filter->utlvs.ppdu_tx_end;
2744 	dst_filter->utlvs.r2r_status_end |=
2745 		src_filter->utlvs.r2r_status_end;
2746 	dst_filter->utlvs.flush_req |=
2747 		src_filter->utlvs.flush_req;
2748 	dst_filter->utlvs.mactx_phy_desc |=
2749 		src_filter->utlvs.mactx_phy_desc;
2750 	dst_filter->utlvs.mactx_user_desc_cmn |=
2751 		src_filter->utlvs.mactx_user_desc_cmn;
2752 	dst_filter->utlvs.mactx_user_desc_per_usr |=
2753 		src_filter->utlvs.mactx_user_desc_per_usr;
2754 
2755 	dst_filter->utlvs.tqm_acked_1k_mpdu |=
2756 		src_filter->utlvs.tqm_acked_1k_mpdu;
2757 	dst_filter->utlvs.tqm_acked_mpdu |=
2758 		src_filter->utlvs.tqm_acked_mpdu;
2759 	dst_filter->utlvs.tqm_update_tx_mpdu_count |=
2760 		src_filter->utlvs.tqm_update_tx_mpdu_count;
2761 	dst_filter->utlvs.phytx_ppdu_header_info_request |=
2762 		src_filter->utlvs.phytx_ppdu_header_info_request;
2763 	dst_filter->utlvs.u_sig_eht_su_mu |=
2764 		src_filter->utlvs.u_sig_eht_su_mu;
2765 	dst_filter->utlvs.u_sig_eht_su |=
2766 		src_filter->utlvs.u_sig_eht_su;
2767 	dst_filter->utlvs.u_sig_eht_tb |=
2768 		src_filter->utlvs.u_sig_eht_tb;
2769 	dst_filter->utlvs.eht_sig_usr_su |=
2770 		src_filter->utlvs.eht_sig_usr_su;
2771 	dst_filter->utlvs.eht_sig_usr_mu_mimo |=
2772 		src_filter->utlvs.eht_sig_usr_mu_mimo;
2773 	dst_filter->utlvs.eht_sig_usr_ofdma |=
2774 		src_filter->utlvs.eht_sig_usr_ofdma;
2775 	dst_filter->utlvs.he_sig_a_su |=
2776 		src_filter->utlvs.he_sig_a_su;
2777 	dst_filter->utlvs.he_sig_a_mu_dl |=
2778 		src_filter->utlvs.he_sig_a_mu_dl;
2779 	dst_filter->utlvs.he_sig_a_mu_ul |=
2780 		src_filter->utlvs.he_sig_a_mu_ul;
2781 	dst_filter->utlvs.he_sig_b1_mu |=
2782 		src_filter->utlvs.he_sig_b1_mu;
2783 	dst_filter->utlvs.he_sig_b2_mu |=
2784 		src_filter->utlvs.he_sig_b2_mu;
2785 	dst_filter->utlvs.he_sig_b2_ofdma |=
2786 		src_filter->utlvs.he_sig_b2_ofdma;
2787 	dst_filter->utlvs.vht_sig_b_mu160 |=
2788 		src_filter->utlvs.vht_sig_b_mu160;
2789 	dst_filter->utlvs.vht_sig_b_mu80 |=
2790 		src_filter->utlvs.vht_sig_b_mu80;
2791 	dst_filter->utlvs.vht_sig_b_mu40 |=
2792 		src_filter->utlvs.vht_sig_b_mu40;
2793 	dst_filter->utlvs.vht_sig_b_mu20 |=
2794 		src_filter->utlvs.vht_sig_b_mu20;
2795 	dst_filter->utlvs.vht_sig_b_su160 |=
2796 		src_filter->utlvs.vht_sig_b_su160;
2797 	dst_filter->utlvs.vht_sig_b_su80 |=
2798 		src_filter->utlvs.vht_sig_b_su80;
2799 	dst_filter->utlvs.vht_sig_b_su40 |=
2800 		src_filter->utlvs.vht_sig_b_su40;
2801 	dst_filter->utlvs.vht_sig_b_su20 |=
2802 		src_filter->utlvs.vht_sig_b_su20;
2803 	dst_filter->utlvs.vht_sig_a |=
2804 		src_filter->utlvs.vht_sig_a;
2805 	dst_filter->utlvs.ht_sig |=
2806 		src_filter->utlvs.ht_sig;
2807 	dst_filter->utlvs.l_sig_b |=
2808 		src_filter->utlvs.l_sig_b;
2809 	dst_filter->utlvs.l_sig_a |=
2810 		src_filter->utlvs.l_sig_a;
2811 	dst_filter->utlvs.tx_service |=
2812 		src_filter->utlvs.tx_service;
2813 
2814 	dst_filter->utlvs.txpcu_buf_status |=
2815 		src_filter->utlvs.txpcu_buf_status;
2816 	dst_filter->utlvs.txpcu_user_buf_status |=
2817 		src_filter->utlvs.txpcu_user_buf_status;
2818 	dst_filter->utlvs.txdma_stop_request |=
2819 		src_filter->utlvs.txdma_stop_request;
2820 	dst_filter->utlvs.expected_response |=
2821 		src_filter->utlvs.expected_response;
2822 	dst_filter->utlvs.tx_mpdu_count_transfer_end |=
2823 		src_filter->utlvs.tx_mpdu_count_transfer_end;
2824 	dst_filter->utlvs.rx_trig_info |=
2825 		src_filter->utlvs.rx_trig_info;
2826 	dst_filter->utlvs.rxpcu_tx_setup_clear |=
2827 		src_filter->utlvs.rxpcu_tx_setup_clear;
2828 	dst_filter->utlvs.rx_frame_bitmap_req |=
2829 		src_filter->utlvs.rx_frame_bitmap_req;
2830 	dst_filter->utlvs.rx_phy_sleep |=
2831 		src_filter->utlvs.rx_phy_sleep;
2832 	dst_filter->utlvs.txpcu_preamble_done |=
2833 		src_filter->utlvs.txpcu_preamble_done;
2834 	dst_filter->utlvs.txpcu_phytx_debug32 |=
2835 		src_filter->utlvs.txpcu_phytx_debug32;
2836 	dst_filter->utlvs.txpcu_phytx_other_transmit_info32 |=
2837 		src_filter->utlvs.txpcu_phytx_other_transmit_info32;
2838 	dst_filter->utlvs.rx_ppdu_noack_report |=
2839 		src_filter->utlvs.rx_ppdu_noack_report;
2840 	dst_filter->utlvs.rx_ppdu_ack_report |=
2841 		src_filter->utlvs.rx_ppdu_ack_report;
2842 	dst_filter->utlvs.coex_rx_status |=
2843 		src_filter->utlvs.coex_rx_status;
2844 	dst_filter->utlvs.rx_start_param |=
2845 		src_filter->utlvs.rx_start_param;
2846 	dst_filter->utlvs.tx_cbf_info |=
2847 		src_filter->utlvs.tx_cbf_info;
2848 	dst_filter->utlvs.rxpcu_early_rx_indication |=
2849 		src_filter->utlvs.rxpcu_early_rx_indication;
2850 	dst_filter->utlvs.received_response_user_7_0 |=
2851 		src_filter->utlvs.received_response_user_7_0;
2852 	dst_filter->utlvs.received_response_user_15_8 |=
2853 		src_filter->utlvs.received_response_user_15_8;
2854 	dst_filter->utlvs.received_response_user_23_16 |=
2855 		src_filter->utlvs.received_response_user_23_16;
2856 	dst_filter->utlvs.received_response_user_31_24 |=
2857 		src_filter->utlvs.received_response_user_31_24;
2858 	dst_filter->utlvs.received_response_user_36_32 |=
2859 		src_filter->utlvs.received_response_user_36_32;
2860 	dst_filter->utlvs.rx_pm_info |=
2861 		src_filter->utlvs.rx_pm_info;
2862 	dst_filter->utlvs.rx_preamble |=
2863 		src_filter->utlvs.rx_preamble;
2864 	dst_filter->utlvs.others |=
2865 		src_filter->utlvs.others;
2866 	dst_filter->utlvs.mactx_pre_phy_desc |=
2867 		src_filter->utlvs.mactx_pre_phy_desc;
2868 }
2869 
2870 static
dp_tx_mon_wordmask_config_set(struct htt_tx_ring_tlv_filter * dst_filter,struct htt_tx_ring_tlv_filter * src_filter)2871 void dp_tx_mon_wordmask_config_set(struct htt_tx_ring_tlv_filter *dst_filter,
2872 				   struct htt_tx_ring_tlv_filter *src_filter)
2873 {
2874 	dst_filter->wmask.pcu_ppdu_setup_init |=
2875 		src_filter->wmask.pcu_ppdu_setup_init;
2876 	dst_filter->wmask.tx_peer_entry |=
2877 		src_filter->wmask.tx_peer_entry;
2878 	dst_filter->wmask.tx_queue_ext |=
2879 		src_filter->wmask.tx_queue_ext;
2880 	dst_filter->wmask.tx_fes_status_end |=
2881 		src_filter->wmask.tx_fes_status_end;
2882 	dst_filter->wmask.response_end_status |=
2883 		src_filter->wmask.response_end_status;
2884 	dst_filter->wmask.tx_fes_status_prot |=
2885 		src_filter->wmask.tx_fes_status_prot;
2886 	dst_filter->wmask.tx_fes_setup |=
2887 		src_filter->wmask.tx_fes_setup;
2888 	dst_filter->wmask.tx_msdu_start |=
2889 		src_filter->wmask.tx_msdu_start;
2890 	dst_filter->wmask.tx_mpdu_start |=
2891 		src_filter->wmask.tx_mpdu_start;
2892 	dst_filter->wmask.rxpcu_user_setup |=
2893 		src_filter->wmask.rxpcu_user_setup;
2894 	dst_filter->compaction_enable |=
2895 		src_filter->compaction_enable;
2896 }
2897 
2898 /**
2899  * dp_tx_mon_filter_h2t_setup() - Setup the filter
2900  * @soc: DP soc handle
2901  * @pdev: DP pdev handle
2902  * @srng_type: The srng type for which filter will be set
2903  * @filter: tlv filter
2904  */
2905 static
dp_tx_mon_filter_h2t_setup(struct dp_soc * soc,struct dp_pdev * pdev,enum dp_mon_filter_srng_type srng_type,struct dp_mon_filter_be * filter)2906 void dp_tx_mon_filter_h2t_setup(struct dp_soc *soc, struct dp_pdev *pdev,
2907 				enum dp_mon_filter_srng_type srng_type,
2908 				struct dp_mon_filter_be *filter)
2909 {
2910 	int32_t current_mode = 0;
2911 	struct htt_tx_ring_tlv_filter *dst_filter = &filter->tx_tlv_filter;
2912 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
2913 	struct dp_mon_pdev_be *mon_pdev_be =
2914 		dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
2915 
2916 	/*
2917 	 * Loop through all the modes.
2918 	 */
2919 	for (current_mode = 0; current_mode < DP_MON_FILTER_MAX_MODE;
2920 	     current_mode++) {
2921 		struct dp_mon_filter_be *mon_filter =
2922 			&mon_pdev_be->filter_be[current_mode][srng_type];
2923 		struct htt_tx_ring_tlv_filter *src_filter =
2924 			&mon_filter->tx_tlv_filter;
2925 
2926 		/*
2927 		 * Check if the correct mode is enabled or not.
2928 		 */
2929 		if (!mon_filter->tx_valid)
2930 			continue;
2931 
2932 		dst_filter->enable = 1;
2933 
2934 		dp_tx_mon_downstream_tlv_set(dst_filter, src_filter);
2935 		dp_tx_mon_upstream_tlv_set(dst_filter, src_filter);
2936 		dp_tx_mon_wordmask_config_set(dst_filter, src_filter);
2937 
2938 		dst_filter->mgmt_filter |= src_filter->mgmt_filter;
2939 		dst_filter->data_filter |= src_filter->data_filter;
2940 		dst_filter->ctrl_filter |= src_filter->ctrl_filter;
2941 		dst_filter->mgmt_dma_length |= src_filter->mgmt_dma_length;
2942 		dst_filter->ctrl_dma_length |= src_filter->ctrl_dma_length;
2943 		dst_filter->data_dma_length |= src_filter->data_dma_length;
2944 		dst_filter->mgmt_mpdu_end |= src_filter->mgmt_mpdu_end;
2945 		dst_filter->mgmt_msdu_end |= src_filter->mgmt_msdu_end;
2946 		dst_filter->mgmt_msdu_start |= src_filter->mgmt_msdu_start;
2947 		dst_filter->mgmt_mpdu_start |= src_filter->mgmt_mpdu_start;
2948 		dst_filter->ctrl_mpdu_end |= src_filter->mgmt_mpdu_end;
2949 		dst_filter->ctrl_msdu_end |= src_filter->mgmt_msdu_end;
2950 		dst_filter->ctrl_msdu_start |= src_filter->mgmt_msdu_start;
2951 		dst_filter->ctrl_mpdu_start |= src_filter->mgmt_mpdu_start;
2952 		dst_filter->data_mpdu_end |= src_filter->mgmt_mpdu_end;
2953 		dst_filter->data_msdu_end |= src_filter->mgmt_msdu_end;
2954 		dst_filter->data_msdu_start |= src_filter->mgmt_msdu_start;
2955 		dst_filter->data_mpdu_start |= src_filter->mgmt_mpdu_start;
2956 		dst_filter->mgmt_mpdu_log |= src_filter->mgmt_mpdu_log;
2957 		dst_filter->ctrl_mpdu_log |= src_filter->ctrl_mpdu_log;
2958 		dst_filter->data_mpdu_log |= src_filter->data_mpdu_log;
2959 	}
2960 	DP_MON_FILTER_PRINT("TXMON FINAL FILTER CONFIG:");
2961 	dp_tx_mon_filter_show_filter(filter);
2962 }
2963 
2964 static QDF_STATUS
dp_tx_mon_ht2_ring_cfg(struct dp_soc * soc,struct dp_pdev * pdev,enum dp_mon_filter_srng_type srng_type,struct htt_tx_ring_tlv_filter * tlv_filter)2965 dp_tx_mon_ht2_ring_cfg(struct dp_soc *soc,
2966 		       struct dp_pdev *pdev,
2967 		       enum dp_mon_filter_srng_type srng_type,
2968 		       struct htt_tx_ring_tlv_filter *tlv_filter)
2969 {
2970 	int mac_id;
2971 	int max_mac_rings = wlan_cfg_get_num_mac_rings(pdev->wlan_cfg_ctx);
2972 	QDF_STATUS status = QDF_STATUS_SUCCESS;
2973 	struct dp_mon_soc *mon_soc = soc->monitor_soc;
2974 	struct dp_mon_soc_be *mon_soc_be = dp_get_be_mon_soc_from_dp_mon_soc(mon_soc);
2975 
2976 	dp_mon_filter_info("%pK: srng type %d Max_mac_rings %d ",
2977 			   soc, srng_type, max_mac_rings);
2978 
2979 	for (mac_id = 0; mac_id < max_mac_rings; mac_id++) {
2980 		int mac_for_pdev =
2981 			dp_get_mac_id_for_pdev(mac_id, pdev->pdev_id);
2982 		int lmac_id = dp_get_lmac_id_for_pdev_id(soc, mac_id, pdev->pdev_id);
2983 		int hal_ring_type, ring_buf_size;
2984 		hal_ring_handle_t hal_ring_hdl;
2985 
2986 		hal_ring_hdl =
2987 			mon_soc_be->tx_mon_dst_ring[lmac_id].hal_srng;
2988 		hal_ring_type = TX_MONITOR_DST;
2989 		ring_buf_size = 2048;
2990 
2991 		status = htt_h2t_tx_ring_cfg(soc->htt_handle, mac_for_pdev,
2992 					     hal_ring_hdl, hal_ring_type,
2993 					     ring_buf_size,
2994 					     tlv_filter);
2995 		if (status != QDF_STATUS_SUCCESS)
2996 			return status;
2997 	}
2998 
2999 	return status;
3000 }
3001 
dp_tx_mon_filter_update_2_0(struct dp_pdev * pdev)3002 QDF_STATUS dp_tx_mon_filter_update_2_0(struct dp_pdev *pdev)
3003 {
3004 	struct dp_soc *soc;
3005 	struct dp_mon_filter_be filter = {0};
3006 	enum dp_mon_filter_srng_type srng_type =
3007 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
3008 
3009 	if (!pdev) {
3010 		dp_mon_filter_err("pdev Context is null");
3011 		return QDF_STATUS_E_FAILURE;
3012 	}
3013 
3014 	soc = pdev->soc;
3015 	if (!soc) {
3016 		dp_mon_filter_err("soc Context is null");
3017 		return QDF_STATUS_E_FAILURE;
3018 	}
3019 
3020 	dp_tx_mon_filter_h2t_setup(soc, pdev, srng_type, &filter);
3021 	dp_tx_mon_ht2_ring_cfg(soc, pdev, srng_type,
3022 			       &filter.tx_tlv_filter);
3023 
3024 	return QDF_STATUS_SUCCESS;
3025 }
3026 #endif
3027 
dp_rx_mon_filter_update_2_0(struct dp_pdev * pdev)3028 QDF_STATUS dp_rx_mon_filter_update_2_0(struct dp_pdev *pdev)
3029 {
3030 	struct dp_soc *soc;
3031 	struct dp_mon_filter_be filter = {0};
3032 	struct htt_rx_ring_tlv_filter *rx_tlv_filter;
3033 	enum dp_mon_filter_srng_type srng_type =
3034 		DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
3035 
3036 	if (!pdev) {
3037 		dp_mon_filter_err("pdev Context is null");
3038 		return QDF_STATUS_E_FAILURE;
3039 	}
3040 	soc = pdev->soc;
3041 
3042 	rx_tlv_filter = &filter.rx_tlv_filter.tlv_filter;
3043 	dp_rx_mon_filter_h2t_setup(soc, pdev, srng_type, &filter.rx_tlv_filter);
3044 	if (filter.rx_tlv_filter.valid)
3045 		rx_tlv_filter->enable = 1;
3046 	else
3047 		rx_tlv_filter->enable = 0;
3048 
3049 	dp_mon_ht2_rx_ring_cfg(soc, pdev, srng_type,
3050 			       &filter.rx_tlv_filter.tlv_filter);
3051 	return QDF_STATUS_SUCCESS;
3052 }
3053 
3054 #ifdef QCA_SUPPORT_LITE_MONITOR
3055 void
dp_mon_filter_reset_rx_lite_mon(struct dp_mon_pdev_be * be_mon_pdev)3056 dp_mon_filter_reset_rx_lite_mon(struct dp_mon_pdev_be *be_mon_pdev)
3057 {
3058 	struct dp_mon_filter_be filter = {0};
3059 	enum dp_mon_filter_mode filter_mode =
3060 				DP_MON_FILTER_LITE_MON_MODE;
3061 	enum dp_mon_filter_srng_type srng_type =
3062 				DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
3063 	struct dp_lite_mon_rx_config *config = NULL;
3064 
3065 	be_mon_pdev->filter_be[filter_mode][srng_type] = filter;
3066 	config = be_mon_pdev->lite_mon_rx_config;
3067 	if (config)
3068 		config->fp_type_subtype_filter_all = false;
3069 }
3070 
3071 void
dp_mon_filter_setup_rx_lite_mon(struct dp_mon_pdev_be * be_mon_pdev)3072 dp_mon_filter_setup_rx_lite_mon(struct dp_mon_pdev_be *be_mon_pdev)
3073 {
3074 	struct dp_mon_filter_be filter = {0};
3075 	struct dp_mon_filter *rx_tlv_filter;
3076 	enum dp_mon_filter_mode filter_mode =
3077 				DP_MON_FILTER_LITE_MON_MODE;
3078 	enum dp_mon_filter_srng_type srng_type =
3079 				DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
3080 	struct dp_lite_mon_rx_config *config = NULL;
3081 	uint16_t max_custom_len = 0;
3082 	uint16_t mgmt_len = 0;
3083 	uint16_t ctrl_len = 0;
3084 	uint16_t data_len = 0;
3085 
3086 	config = be_mon_pdev->lite_mon_rx_config;
3087 	if (!config)
3088 		return;
3089 
3090 	rx_tlv_filter = &filter.rx_tlv_filter;
3091 	rx_tlv_filter->valid = true;
3092 	/* configure fp filters if enabled */
3093 	if (config->rx_config.fp_enabled) {
3094 		rx_tlv_filter->tlv_filter.enable_fp = 1;
3095 		rx_tlv_filter->tlv_filter.fp_mgmt_filter =
3096 			config->rx_config.mgmt_filter[DP_MON_FRM_FILTER_MODE_FP];
3097 		rx_tlv_filter->tlv_filter.fp_ctrl_filter =
3098 			config->rx_config.ctrl_filter[DP_MON_FRM_FILTER_MODE_FP];
3099 		rx_tlv_filter->tlv_filter.fp_data_filter =
3100 			config->rx_config.data_filter[DP_MON_FRM_FILTER_MODE_FP];
3101 		if ((config->rx_config.mgmt_filter[DP_MON_FRM_FILTER_MODE_FP] ==
3102 		     CDP_LITE_MON_FILTER_ALL) &&
3103 		    (config->rx_config.ctrl_filter[DP_MON_FRM_FILTER_MODE_FP] ==
3104 		     CDP_LITE_MON_FILTER_ALL) &&
3105 		    (config->rx_config.data_filter[DP_MON_FRM_FILTER_MODE_FP] ==
3106 		     CDP_LITE_MON_FILTER_ALL))
3107 			config->fp_type_subtype_filter_all = true;
3108 	}
3109 
3110 	/* configure md filters if enabled */
3111 	if (config->rx_config.md_enabled) {
3112 		rx_tlv_filter->tlv_filter.enable_md = 1;
3113 		rx_tlv_filter->tlv_filter.md_mgmt_filter =
3114 			config->rx_config.mgmt_filter[DP_MON_FRM_FILTER_MODE_MD];
3115 		rx_tlv_filter->tlv_filter.md_ctrl_filter =
3116 			config->rx_config.ctrl_filter[DP_MON_FRM_FILTER_MODE_MD];
3117 		rx_tlv_filter->tlv_filter.md_data_filter =
3118 			config->rx_config.data_filter[DP_MON_FRM_FILTER_MODE_MD];
3119 	}
3120 
3121 	/* configure mo filters if enabled */
3122 	if (config->rx_config.mo_enabled) {
3123 		rx_tlv_filter->tlv_filter.enable_mo = 1;
3124 		rx_tlv_filter->tlv_filter.mo_mgmt_filter =
3125 			config->rx_config.mgmt_filter[DP_MON_FRM_FILTER_MODE_MO];
3126 		rx_tlv_filter->tlv_filter.mo_ctrl_filter =
3127 			config->rx_config.ctrl_filter[DP_MON_FRM_FILTER_MODE_MO];
3128 		rx_tlv_filter->tlv_filter.mo_data_filter =
3129 			config->rx_config.data_filter[DP_MON_FRM_FILTER_MODE_MO];
3130 	}
3131 
3132 	/* configure fpmo filters if enabled */
3133 	if (config->rx_config.fpmo_enabled) {
3134 		rx_tlv_filter->tlv_filter.enable_fpmo = 1;
3135 		rx_tlv_filter->tlv_filter.fpmo_mgmt_filter =
3136 			config->rx_config.mgmt_filter[DP_MON_FRM_FILTER_MODE_FP_MO];
3137 		rx_tlv_filter->tlv_filter.fpmo_ctrl_filter =
3138 			config->rx_config.ctrl_filter[DP_MON_FRM_FILTER_MODE_FP_MO];
3139 		rx_tlv_filter->tlv_filter.fpmo_data_filter =
3140 			config->rx_config.data_filter[DP_MON_FRM_FILTER_MODE_FP_MO];
3141 	}
3142 
3143 	mgmt_len = config->rx_config.len[WLAN_FC0_TYPE_MGMT];
3144 	ctrl_len = config->rx_config.len[WLAN_FC0_TYPE_CTRL];
3145 	data_len = config->rx_config.len[WLAN_FC0_TYPE_DATA];
3146 	/* if full len is configured for any of the types, subscribe
3147 	 * for full dma length else set it to min dma length(fw sets
3148 	 * full length by default) to avoid unnecessary dma since we
3149 	 * do not have hw support to control rx pkt tlvs per type. To
3150 	 * get custom len pkt we make use of rx hdr tlv instead.
3151 	 */
3152 	if (dp_lite_mon_is_full_len_configured(mgmt_len,
3153 					       ctrl_len,
3154 					       data_len)) {
3155 		rx_tlv_filter->tlv_filter.packet = 1;
3156 		/* get offset size in QWORDS */
3157 		rx_tlv_filter->tlv_filter.rx_pkt_tlv_offset =
3158 				DP_GET_NUM_QWORDS(DP_RX_MON_PACKET_OFFSET);
3159 		if (mgmt_len == CDP_LITE_MON_LEN_FULL)
3160 			rx_tlv_filter->tlv_filter.mgmt_dma_length =
3161 							DEFAULT_DMA_LENGTH;
3162 		else
3163 			rx_tlv_filter->tlv_filter.mgmt_dma_length =
3164 							DMA_LENGTH_64B;
3165 
3166 		if (ctrl_len == CDP_LITE_MON_LEN_FULL)
3167 			rx_tlv_filter->tlv_filter.ctrl_dma_length =
3168 							DEFAULT_DMA_LENGTH;
3169 		else
3170 			rx_tlv_filter->tlv_filter.ctrl_dma_length =
3171 							DMA_LENGTH_64B;
3172 
3173 		if (data_len == CDP_LITE_MON_LEN_FULL)
3174 			rx_tlv_filter->tlv_filter.data_dma_length =
3175 							DEFAULT_DMA_LENGTH;
3176 		else
3177 			rx_tlv_filter->tlv_filter.data_dma_length =
3178 							DMA_LENGTH_64B;
3179 	} else  {
3180 		/* if full len not configured set to min len */
3181 		rx_tlv_filter->tlv_filter.mgmt_dma_length = DMA_LENGTH_64B;
3182 		rx_tlv_filter->tlv_filter.ctrl_dma_length = DMA_LENGTH_64B;
3183 		rx_tlv_filter->tlv_filter.data_dma_length = DMA_LENGTH_64B;
3184 	}
3185 
3186 	rx_tlv_filter->tlv_filter.packet_header = 1;
3187 	/* set rx hdr tlv len, default len is 128B */
3188 	max_custom_len = dp_lite_mon_get_max_custom_len(mgmt_len, ctrl_len,
3189 							data_len);
3190 	if (max_custom_len == CDP_LITE_MON_LEN_64B)
3191 		rx_tlv_filter->tlv_filter.rx_hdr_length =
3192 						RX_HDR_DMA_LENGTH_64B;
3193 	else if (max_custom_len == CDP_LITE_MON_LEN_128B)
3194 		rx_tlv_filter->tlv_filter.rx_hdr_length =
3195 						RX_HDR_DMA_LENGTH_128B;
3196 	else if (max_custom_len == CDP_LITE_MON_LEN_256B)
3197 		rx_tlv_filter->tlv_filter.rx_hdr_length =
3198 						RX_HDR_DMA_LENGTH_256B;
3199 
3200 	if ((config->rx_config.level == CDP_LITE_MON_LEVEL_MSDU) ||
3201 	    dp_lite_mon_is_full_len_configured(mgmt_len, ctrl_len, data_len)) {
3202 		rx_tlv_filter->tlv_filter.header_per_msdu = 1;
3203 		rx_tlv_filter->tlv_filter.msdu_end = 1;
3204 	}
3205 
3206 	rx_tlv_filter->tlv_filter.ppdu_start = 1;
3207 	rx_tlv_filter->tlv_filter.ppdu_end = 1;
3208 	rx_tlv_filter->tlv_filter.mpdu_start = 1;
3209 	rx_tlv_filter->tlv_filter.mpdu_end = 1;
3210 
3211 	rx_tlv_filter->tlv_filter.ppdu_end_user_stats = 1;
3212 	rx_tlv_filter->tlv_filter.ppdu_end_user_stats_ext = 1;
3213 	rx_tlv_filter->tlv_filter.ppdu_end_status_done = 1;
3214 	rx_tlv_filter->tlv_filter.ppdu_start_user_info = 1;
3215 
3216 	dp_mon_filter_show_rx_filter_be(filter_mode, &filter);
3217 	be_mon_pdev->filter_be[filter_mode][srng_type] = filter;
3218 }
3219 
3220 #ifdef WLAN_PKT_CAPTURE_TX_2_0
tx_lite_mon_set_len(uint16_t len)3221 uint8_t tx_lite_mon_set_len(uint16_t len)
3222 {
3223 	switch (len) {
3224 	case CDP_LITE_MON_LEN_64B:
3225 		return DMA_LENGTH_64B;
3226 	case CDP_LITE_MON_LEN_128B:
3227 		return DMA_LENGTH_128B;
3228 	case CDP_LITE_MON_LEN_256B:
3229 		return DMA_LENGTH_256B;
3230 	case CDP_LITE_MON_LEN_FULL:
3231 		return DEFAULT_DMA_LENGTH;
3232 	default:
3233 		dp_mon_filter_err("Invalid length %d, Using minimal length of 64B",
3234 				  len);
3235 		return DMA_LENGTH_64B;
3236 	}
3237 }
3238 
3239 void
dp_mon_filter_reset_tx_lite_mon(struct dp_mon_pdev_be * be_mon_pdev)3240 dp_mon_filter_reset_tx_lite_mon(struct dp_mon_pdev_be *be_mon_pdev)
3241 {
3242 	struct dp_mon_filter_be filter = {0};
3243 	enum dp_mon_filter_mode filter_mode =
3244 				DP_MON_FILTER_LITE_MON_MODE;
3245 	enum dp_mon_filter_srng_type srng_type =
3246 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
3247 	struct dp_lite_mon_tx_config *config = NULL;
3248 
3249 	be_mon_pdev->filter_be[filter_mode][srng_type] = filter;
3250 	config = be_mon_pdev->lite_mon_tx_config;
3251 	if (!config)
3252 		return;
3253 	config->subtype_filtering = false;
3254 	config->sw_peer_filtering = false;
3255 
3256 }
3257 
3258 void
dp_mon_filter_setup_tx_lite_mon(struct dp_pdev * pdev)3259 dp_mon_filter_setup_tx_lite_mon(struct dp_pdev *pdev)
3260 {
3261 	struct dp_mon_pdev *mon_pdev = NULL;
3262 	struct dp_mon_pdev_be *be_mon_pdev = NULL;
3263 	struct dp_mon_filter_be filter = {0};
3264 	enum dp_mon_filter_mode mode = DP_MON_FILTER_LITE_MON_MODE;
3265 	enum dp_mon_filter_srng_type srng_type =
3266 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
3267 	struct htt_tx_ring_tlv_filter *tx_tlv_filter = &filter.tx_tlv_filter;
3268 	struct dp_lite_mon_tx_config *config = NULL;
3269 
3270 	if (!pdev) {
3271 		dp_mon_filter_err("Pdev context is null");
3272 		return;
3273 	}
3274 
3275 	mon_pdev = pdev->monitor_pdev;
3276 	if (!mon_pdev) {
3277 		dp_mon_filter_err("Monitor pdev context is null");
3278 		return;
3279 	}
3280 
3281 	be_mon_pdev = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
3282 
3283 	config = be_mon_pdev->lite_mon_tx_config;
3284 	if (!config)
3285 		return;
3286 
3287 	/* tx monitor supports only filter pass mode */
3288 	if (config->tx_config.md_enabled || config->tx_config.mo_enabled ||
3289 	    config->tx_config.fpmo_enabled) {
3290 		dp_mon_filter_err("md mo and fpmo are invalid filter configuration for Tx");
3291 		return;
3292 	}
3293 
3294 	/* Enable tx monitor filter */
3295 	filter.tx_valid = true;
3296 	tx_tlv_filter->enable = 1;
3297 
3298 	dp_tx_mon_filter_set_downstream_tlvs(tx_tlv_filter);
3299 	dp_tx_mon_filter_set_upstream_tlvs(tx_tlv_filter);
3300 	dp_tx_mon_filter_set_word_mask(pdev, tx_tlv_filter);
3301 
3302 	/* configure mgmt filters */
3303 	if (config->tx_config.mgmt_filter[DP_MON_FRM_FILTER_MODE_FP]) {
3304 		tx_tlv_filter->mgmt_filter = 1;
3305 		tx_tlv_filter->mgmt_dma_length =
3306 			tx_lite_mon_set_len(config->tx_config.len[WLAN_FC0_TYPE_MGMT]);
3307 		if ((config->tx_config.level == CDP_LITE_MON_LEVEL_MPDU) ||
3308 		    (config->tx_config.level == CDP_LITE_MON_LEVEL_PPDU))
3309 			tx_tlv_filter->mgmt_mpdu_log = 1;
3310 		if (config->tx_config.mgmt_filter[DP_MON_FRM_FILTER_MODE_FP] !=
3311 		    CDP_LITE_MON_FILTER_ALL)
3312 			config->subtype_filtering = true;
3313 	}
3314 
3315 	/* configure ctrl filters */
3316 	if (config->tx_config.ctrl_filter[DP_MON_FRM_FILTER_MODE_FP]) {
3317 		tx_tlv_filter->ctrl_filter = 1;
3318 		tx_tlv_filter->ctrl_dma_length =
3319 			tx_lite_mon_set_len(config->tx_config.len[WLAN_FC0_TYPE_CTRL]);
3320 		if ((config->tx_config.level == CDP_LITE_MON_LEVEL_MPDU) ||
3321 		    (config->tx_config.level == CDP_LITE_MON_LEVEL_PPDU))
3322 			tx_tlv_filter->ctrl_mpdu_log = 1;
3323 	}
3324 	/* Since ctrl frames are generated in host, we need to do subtype
3325 	 * filtering even though ctrl filters are not enabled
3326 	 */
3327 	if (config->tx_config.ctrl_filter[DP_MON_FRM_FILTER_MODE_FP] !=
3328 	    CDP_LITE_MON_FILTER_ALL)
3329 		config->subtype_filtering = true;
3330 	/* configure data filters */
3331 	if (config->tx_config.data_filter[DP_MON_FRM_FILTER_MODE_FP]) {
3332 		tx_tlv_filter->data_filter = 1;
3333 		tx_tlv_filter->data_dma_length =
3334 			tx_lite_mon_set_len(config->tx_config.len[WLAN_FC0_TYPE_DATA]);
3335 		if ((config->tx_config.level == CDP_LITE_MON_LEVEL_MPDU) ||
3336 		    (config->tx_config.level == CDP_LITE_MON_LEVEL_PPDU))
3337 			tx_tlv_filter->data_mpdu_log = 1;
3338 		if (config->tx_config.data_filter[DP_MON_FRM_FILTER_MODE_FP] !=
3339 		    CDP_LITE_MON_FILTER_ALL)
3340 			config->subtype_filtering = true;
3341 	}
3342 
3343 	dp_mon_filter_show_tx_filter_be(mode, &filter);
3344 	be_mon_pdev->filter_be[mode][srng_type] = filter;
3345 }
3346 #endif /* WLAN_PKT_CAPTURE_TX_2_0 */
3347 #endif /* QCA_SUPPORT_LITE_MONITOR */
3348 
3349 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
3350 /**
3351  * dp_cfr_filter_2_0() - Configure HOST monitor destination ring for CFR
3352  *
3353  * @soc_hdl: Datapath soc handle
3354  * @pdev_id: id of data path pdev handle
3355  * @enable: Enable/Disable CFR
3356  * @filter_val: Flag to select Filter for monitor mode
3357  * @cfr_enable_monitor_mode: Flag to be enabled when scan radio is brought up
3358  * in special vap mode
3359  *
3360  * Return: void
3361  */
dp_cfr_filter_2_0(struct cdp_soc_t * soc_hdl,uint8_t pdev_id,bool enable,struct cdp_monitor_filter * filter_val,bool cfr_enable_monitor_mode)3362 static void dp_cfr_filter_2_0(struct cdp_soc_t *soc_hdl,
3363 			      uint8_t pdev_id,
3364 			      bool enable,
3365 			      struct cdp_monitor_filter *filter_val,
3366 			      bool cfr_enable_monitor_mode)
3367 {
3368 	struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
3369 	struct dp_pdev *pdev = NULL;
3370 	struct htt_rx_ring_tlv_filter *htt_tlv_filter;
3371 	struct dp_mon_pdev *mon_pdev;
3372 	struct dp_mon_filter_be filter = {0};
3373 	enum dp_mon_filter_srng_type srng_type =
3374 		DP_MON_FILTER_SRNG_TYPE_RXMON_DEST;
3375 
3376 	pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
3377 	if (!pdev) {
3378 		dp_mon_err("pdev is NULL");
3379 		return;
3380 	}
3381 
3382 	mon_pdev = pdev->monitor_pdev;
3383 
3384 	if (mon_pdev->mvdev) {
3385 		if (enable && cfr_enable_monitor_mode)
3386 			pdev->cfr_rcc_mode = true;
3387 		else
3388 			pdev->cfr_rcc_mode = false;
3389 		return;
3390 	}
3391 
3392 	soc = pdev->soc;
3393 	pdev->cfr_rcc_mode = false;
3394 
3395 	/* Get default tlv settings */
3396 	htt_tlv_filter = &filter.rx_tlv_filter.tlv_filter;
3397 	dp_rx_mon_filter_h2t_setup(soc, pdev, srng_type, &filter.rx_tlv_filter);
3398 
3399 	if (filter.rx_tlv_filter.valid)
3400 		htt_tlv_filter->enable = 1;
3401 	else
3402 		htt_tlv_filter->enable = 0;
3403 
3404 	dp_mon_info("enable : %d, mode: 0x%x", enable, filter_val->mode);
3405 
3406 	if (enable) {
3407 		pdev->cfr_rcc_mode = true;
3408 		htt_tlv_filter->ppdu_start = 1;
3409 		htt_tlv_filter->ppdu_end = 1;
3410 		htt_tlv_filter->ppdu_end_user_stats = 1;
3411 		htt_tlv_filter->ppdu_end_user_stats_ext = 1;
3412 		htt_tlv_filter->ppdu_end_status_done = 1;
3413 		htt_tlv_filter->mpdu_start = 1;
3414 		htt_tlv_filter->offset_valid = false;
3415 
3416 		htt_tlv_filter->enable_fp =
3417 			(filter_val->mode & MON_FILTER_PASS) ? 1 : 0;
3418 		htt_tlv_filter->enable_md = 0;
3419 		htt_tlv_filter->enable_mo =
3420 			(filter_val->mode & MON_FILTER_OTHER) ? 1 : 0;
3421 		htt_tlv_filter->fp_mgmt_filter = filter_val->fp_mgmt;
3422 		htt_tlv_filter->fp_ctrl_filter = filter_val->fp_ctrl;
3423 		htt_tlv_filter->fp_data_filter = filter_val->fp_data;
3424 		htt_tlv_filter->mo_mgmt_filter = filter_val->mo_mgmt;
3425 		htt_tlv_filter->mo_ctrl_filter = filter_val->mo_ctrl;
3426 		htt_tlv_filter->mo_data_filter = filter_val->mo_data;
3427 	}
3428 
3429 	dp_mon_ht2_rx_ring_cfg(soc, pdev, srng_type,
3430 			       &filter.rx_tlv_filter.tlv_filter);
3431 }
3432 
dp_cfr_filter_register_2_0(struct cdp_ops * ops)3433 void dp_cfr_filter_register_2_0(struct cdp_ops *ops)
3434 {
3435 	ops->mon_ops->txrx_cfr_filter = dp_cfr_filter_2_0;
3436 }
3437 
3438 #if defined(WLAN_FEATURE_LOCAL_PKT_CAPTURE) && \
3439 defined(WLAN_PKT_CAPTURE_TX_2_0)
dp_mon_filter_setup_local_pkt_capture_tx(struct dp_pdev * pdev)3440 void dp_mon_filter_setup_local_pkt_capture_tx(struct dp_pdev *pdev)
3441 {
3442 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
3443 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
3444 	enum dp_mon_filter_srng_type srng_type =
3445 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
3446 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
3447 	struct dp_mon_filter_be filter = {0};
3448 	struct htt_tx_ring_tlv_filter *tx_tlv_filter = &filter.tx_tlv_filter;
3449 	struct dp_pdev_tx_monitor_be *tx_mon_be;
3450 
3451 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
3452 	tx_mon_be = &mon_pdev_be->tx_monitor_be;
3453 	tx_mon_be->mode = TX_MON_BE_FULL_CAPTURE;
3454 	mon_pdev_be->tx_mon_mode = 1;
3455 	mon_pdev_be->tx_mon_filter_length = DMA_LENGTH_256B;
3456 
3457 	filter.tx_valid = true;
3458 	tx_tlv_filter->enable = 1;
3459 	dp_tx_mon_filter_set_downstream_tlvs(tx_tlv_filter);
3460 	dp_tx_mon_filter_set_upstream_tlvs(tx_tlv_filter);
3461 	dp_tx_mon_filter_set_word_mask(pdev, tx_tlv_filter);
3462 
3463 	if (mon_pdev->fp_mgmt_filter) {
3464 		tx_tlv_filter->mgmt_filter = FILTER_MGMT_ALL;
3465 		tx_tlv_filter->mgmt_mpdu_end = 1;
3466 		tx_tlv_filter->mgmt_msdu_end = 1;
3467 		tx_tlv_filter->mgmt_msdu_start = 1;
3468 		tx_tlv_filter->mgmt_mpdu_start = 1;
3469 		tx_tlv_filter->mgmt_mpdu_log = 1;
3470 		tx_tlv_filter->mgmt_dma_length = DMA_LENGTH_256B;
3471 	}
3472 
3473 	if (mon_pdev->fp_ctrl_filter) {
3474 		tx_tlv_filter->ctrl_filter = FILTER_CTRL_ALL;
3475 		tx_tlv_filter->ctrl_mpdu_end = 1;
3476 		tx_tlv_filter->ctrl_msdu_end = 1;
3477 		tx_tlv_filter->ctrl_msdu_start = 1;
3478 		tx_tlv_filter->ctrl_mpdu_start = 1;
3479 		tx_tlv_filter->ctrl_mpdu_log = 1;
3480 		tx_tlv_filter->ctrl_dma_length = DMA_LENGTH_256B;
3481 	}
3482 
3483 	if (mon_pdev->fp_data_filter) {
3484 		tx_tlv_filter->data_filter = FILTER_DATA_ALL;
3485 		tx_tlv_filter->data_mpdu_end = 1;
3486 		tx_tlv_filter->data_msdu_end = 1;
3487 		tx_tlv_filter->data_msdu_start = 1;
3488 		tx_tlv_filter->data_mpdu_start = 1;
3489 		tx_tlv_filter->data_mpdu_log = 1;
3490 		tx_tlv_filter->data_dma_length = DMA_LENGTH_256B;
3491 	}
3492 
3493 	dp_mon_filter_show_tx_filter_be(mode, &filter);
3494 	mon_pdev_be->filter_be[mode][srng_type] = filter;
3495 }
3496 
dp_mon_filter_reset_local_pkt_capture_tx(struct dp_pdev * pdev)3497 void dp_mon_filter_reset_local_pkt_capture_tx(struct dp_pdev *pdev)
3498 {
3499 	struct dp_mon_pdev *mon_pdev = pdev->monitor_pdev;
3500 	enum dp_mon_filter_mode mode = DP_MON_FILTER_MONITOR_MODE;
3501 	struct dp_mon_filter_be filter = {0};
3502 	enum dp_mon_filter_srng_type srng_type =
3503 				DP_MON_FILTER_SRNG_TYPE_TXMON_DEST;
3504 	struct dp_mon_pdev_be *mon_pdev_be = NULL;
3505 	struct dp_pdev_tx_monitor_be *tx_mon_be;
3506 
3507 	mon_pdev_be = dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
3508 
3509 	tx_mon_be = &mon_pdev_be->tx_monitor_be;
3510 	tx_mon_be->mode = TX_MON_BE_DISABLE;
3511 	mon_pdev_be->tx_mon_mode = 0;
3512 	filter.tx_valid = true;
3513 	mon_pdev_be->filter_be[mode][srng_type] = filter;
3514 }
3515 #endif /* WLAN_FEATURE_LOCAL_PKT_CAPTURE && WLAN_PKT_CAPTURE_TX_2_0 */
3516 #endif
3517