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 #ifndef _DP_MON_FILTER_2_0_H_
19 #define _DP_MON_FILTER_2_0_H_
20
21 #include <dp_htt.h>
22
23 #define DEFAULT_DMA_LENGTH 7
24 #define DMA_LENGTH_64B 1
25 #define DMA_LENGTH_128B 2
26 #define DMA_LENGTH_256B 4
27
28 /* fwd declarations */
29 struct dp_mon_pdev_be;
30
31 /**
32 * dp_rx_mon_enable_set() - Setup rx monitor feature
33 * @msg_word: msg word
34 * @tlv_filter: rx ring filter configuration
35 */
36 void
37 dp_rx_mon_enable_set(uint32_t *msg_word,
38 struct htt_rx_ring_tlv_filter *tlv_filter);
39
40 /**
41 * dp_rx_mon_packet_length_set() - Setup rx monitor per packet type length
42 * @msg_word: msg word
43 * @tlv_filter: rx ring filter configuration
44 */
45 void
46 dp_rx_mon_packet_length_set(uint32_t *msg_word,
47 struct htt_rx_ring_tlv_filter *tlv_filter);
48
49 /**
50 * dp_rx_mon_word_mask_subscribe() - Setup rx monitor word mask subscription
51 * @soc: soc handle
52 * @msg_word: msg word
53 * @pdev_id: id of dp pdev handle
54 * @tlv_filter: rx ring filter configuration
55 */
56 void
57 dp_rx_mon_word_mask_subscribe(struct dp_soc *soc,
58 uint32_t *msg_word, int pdev_id,
59 struct htt_rx_ring_tlv_filter *tlv_filter);
60
61 /**
62 * dp_rx_mon_pkt_tlv_offset_subscribe() - Setup rx monitor packet tlv offset
63 * @msg_word: msg word
64 * @tlv_filter: rx ring filter configuration
65 */
66 void
67 dp_rx_mon_pkt_tlv_offset_subscribe(uint32_t *msg_word,
68 struct htt_rx_ring_tlv_filter *tlv_filter);
69
70 /**
71 * dp_rx_mon_enable_mpdu_logging() - Setup rx monitor per packet mpdu logging
72 * @msg_word: msg word
73 * @tlv_filter: rx ring filter configuration
74 */
75 void
76 dp_rx_mon_enable_mpdu_logging(uint32_t *msg_word,
77 struct htt_rx_ring_tlv_filter *tlv_filter);
78
79 /**
80 * dp_rx_mon_enable_fpmo() - Setup rx monitor fpmo mode type/subtype filters
81 * @msg_word: msg word
82 * @tlv_filter: rx ring filter configuration
83 */
84 void
85 dp_rx_mon_enable_fpmo(uint32_t *msg_word,
86 struct htt_rx_ring_tlv_filter *tlv_filter);
87
88 #ifdef QCA_ENHANCED_STATS_SUPPORT
89 /**
90 * dp_mon_filter_setup_enhanced_stats_2_0() - Setup the enhanced stats filter
91 * @pdev: DP pdev handle
92 */
93 void dp_mon_filter_setup_enhanced_stats_2_0(struct dp_pdev *pdev);
94
95 /**
96 * dp_mon_filter_reset_enhanced_stats_2_0() - Reset the enhanced stats filter
97 * @pdev: DP pdev handle
98 */
99 void dp_mon_filter_reset_enhanced_stats_2_0(struct dp_pdev *pdev);
100 #else
101 static inline void
dp_mon_filter_setup_enhanced_stats_2_0(struct dp_pdev * pdev)102 dp_mon_filter_setup_enhanced_stats_2_0(struct dp_pdev *pdev)
103 {
104 }
105
106 static inline void
dp_mon_filter_reset_enhanced_stats_2_0(struct dp_pdev * pdev)107 dp_mon_filter_reset_enhanced_stats_2_0(struct dp_pdev *pdev)
108 {
109 }
110 #endif
111
112 #ifdef QCA_UNDECODED_METADATA_SUPPORT
113 /**
114 * dp_mon_filter_setup_undecoded_metadata_capture_2_0() - Setup the filter
115 * for undecoded metadata capture
116 * @pdev: DP pdev handle
117 */
118 void dp_mon_filter_setup_undecoded_metadata_capture_2_0(struct dp_pdev *pdev);
119
120 /**
121 * dp_mon_filter_reset_undecoded_metadata_capture_2_0() - Reset the filter
122 * for undecoded metadata capture
123 * @pdev: DP pdev handle
124 */
125 void dp_mon_filter_reset_undecoded_metadata_capture_2_0(struct dp_pdev *pdev);
126 #else
127 static inline void
dp_mon_filter_setup_undecoded_metadata_capture_2_0(struct dp_pdev * pdev)128 dp_mon_filter_setup_undecoded_metadata_capture_2_0(struct dp_pdev *pdev)
129 {
130 }
131
132 static inline void
dp_mon_filter_reset_undecoded_metadata_capture_2_0(struct dp_pdev * pdev)133 dp_mon_filter_reset_undecoded_metadata_capture_2_0(struct dp_pdev *pdev)
134 {
135 }
136 #endif
137
138 /**
139 * dp_mon_filter_setup_rx_mon_mode_2_0() - Setup the Rx monitor mode filter
140 * @pdev: DP pdev handle
141 */
142 void dp_mon_filter_setup_rx_mon_mode_2_0(struct dp_pdev *pdev);
143
144 /**
145 * dp_mon_filter_reset_rx_mon_mode_2_0() - Reset the Rx monitor mode filter
146 * @pdev: DP pdev handle
147 */
148 void dp_mon_filter_reset_rx_mon_mode_2_0(struct dp_pdev *pdev);
149
150 #ifdef WLAN_PKT_CAPTURE_TX_2_0
151 /**
152 * dp_mon_filter_setup_tx_mon_mode_2_0() - Setup the Tx monitor mode filter
153 * @pdev: DP pdev handle
154 */
155 void dp_mon_filter_setup_tx_mon_mode_2_0(struct dp_pdev *pdev);
156
157 /**
158 * dp_mon_filter_reset_tx_mon_mode_2_0() - Reset the Tx monitor mode filter
159 * @pdev: DP pdev handle
160 */
161 void dp_mon_filter_reset_tx_mon_mode_2_0(struct dp_pdev *pdev);
162 #else
163 static inline void
dp_mon_filter_setup_tx_mon_mode_2_0(struct dp_pdev * pdev)164 dp_mon_filter_setup_tx_mon_mode_2_0(struct dp_pdev *pdev)
165 {
166 }
167
168 static inline void
dp_mon_filter_reset_tx_mon_mode_2_0(struct dp_pdev * pdev)169 dp_mon_filter_reset_tx_mon_mode_2_0(struct dp_pdev *pdev)
170 {
171 }
172
173 #endif
174
175 #ifdef WDI_EVENT_ENABLE
176 /**
177 * dp_mon_filter_setup_rx_pkt_log_full_2_0() - Setup the Rx pktlog full mode
178 * filter
179 * @pdev: DP pdev handle
180 */
181 void dp_mon_filter_setup_rx_pkt_log_full_2_0(struct dp_pdev *pdev);
182
183 /**
184 * dp_mon_filter_reset_rx_pkt_log_full_2_0() - Reset pktlog full mode filter
185 * @pdev: DP pdev handle
186 */
187 void dp_mon_filter_reset_rx_pkt_log_full_2_0(struct dp_pdev *pdev);
188
189 /**
190 * dp_mon_filter_setup_rx_pkt_log_lite_2_0() - Setup the Rx pktlog lite mode
191 * filter in the radio object.
192 * @pdev: DP pdev handle
193 */
194 void dp_mon_filter_setup_rx_pkt_log_lite_2_0(struct dp_pdev *pdev);
195
196 /**
197 * dp_mon_filter_reset_rx_pkt_log_lite_2_0() - Reset the Rx pktlog lite mode
198 * filter in the radio object.
199 * @pdev: DP pdev handle
200 */
201 void dp_mon_filter_reset_rx_pkt_log_lite_2_0(struct dp_pdev *pdev);
202
203 /**
204 * dp_mon_filter_setup_rx_pkt_log_cbf_2_0() - Setup the Rx pktlog cbf mode
205 * filter in the radio object.
206 * @pdev: DP pdev handle
207 */
208 void dp_mon_filter_setup_rx_pkt_log_cbf_2_0(struct dp_pdev *pdev);
209
210 /**
211 * dp_mon_filter_reset_rx_pktlog_cbf_2_0() - Reset the Rx pktlog cbf mode filter
212 * @pdev: DP pdev handle
213 */
214 void dp_mon_filter_reset_rx_pktlog_cbf_2_0(struct dp_pdev *pdev);
215
216 /**
217 * dp_mon_filter_setup_pktlog_hybrid_2_0() - Setup the pktlog hybrid mode filter
218 * @pdev: DP pdev handle
219 */
220 void dp_mon_filter_setup_pktlog_hybrid_2_0(struct dp_pdev *pdev);
221
222 /**
223 * dp_mon_filter_reset_pktlog_hybrid_2_0() - Reset pktlog hybrid mode filter
224 * @pdev: DP pdev handle
225 */
226 void dp_mon_filter_reset_pktlog_hybrid_2_0(struct dp_pdev *pdev);
227 #else
228 static inline void
dp_mon_filter_setup_rx_pkt_log_full_2_0(struct dp_pdev * pdev)229 dp_mon_filter_setup_rx_pkt_log_full_2_0(struct dp_pdev *pdev)
230 {
231 }
232
233 static inline void
dp_mon_filter_reset_rx_pkt_log_full_2_0(struct dp_pdev * pdev)234 dp_mon_filter_reset_rx_pkt_log_full_2_0(struct dp_pdev *pdev)
235 {
236 }
237
238 static inline void
dp_mon_filter_setup_rx_pkt_log_lite_2_0(struct dp_pdev * pdev)239 dp_mon_filter_setup_rx_pkt_log_lite_2_0(struct dp_pdev *pdev)
240 {
241 }
242
243 static inline void
dp_mon_filter_reset_rx_pkt_log_lite_2_0(struct dp_pdev * pdev)244 dp_mon_filter_reset_rx_pkt_log_lite_2_0(struct dp_pdev *pdev)
245 {
246 }
247
248 static inline void
dp_mon_filter_setup_rx_pkt_log_cbf_2_0(struct dp_pdev * pdev)249 dp_mon_filter_setup_rx_pkt_log_cbf_2_0(struct dp_pdev *pdev)
250 {
251 }
252
253 static inline void
dp_mon_filter_reset_rx_pktlog_cbf_2_0(struct dp_pdev * pdev)254 dp_mon_filter_reset_rx_pktlog_cbf_2_0(struct dp_pdev *pdev)
255 {
256 }
257
258 static inline void
dp_mon_filter_setup_pktlog_hybrid_2_0(struct dp_pdev * pdev)259 dp_mon_filter_setup_pktlog_hybrid_2_0(struct dp_pdev *pdev)
260 {
261 }
262
263 static inline void
dp_mon_filter_reset_pktlog_hybrid_2_0(struct dp_pdev * pdev)264 dp_mon_filter_reset_pktlog_hybrid_2_0(struct dp_pdev *pdev)
265 {
266 }
267 #endif
268
269 /**
270 * dp_tx_mon_filter_update_2_0() - Update monitor filter configuration
271 * @pdev: physical device handle
272 *
273 * Return: non-zero for failure, zero for success
274 */
275 QDF_STATUS dp_tx_mon_filter_update_2_0(struct dp_pdev *pdev);
276
277 /**
278 * dp_rx_mon_filter_update_2_0() - Update monitor filter configuration
279 * @pdev: physical device handle
280 *
281 * Return: non-zero for failure, zero for success
282 */
283 QDF_STATUS dp_rx_mon_filter_update_2_0(struct dp_pdev *pdev);
284
285 /**
286 * dp_mon_filter_dealloc_2_0() - free tx monitor filter memory
287 * @pdev: physical device handle
288 *
289 * Return: non-zero for failure, zero for success
290 */
291 void dp_mon_filter_dealloc_2_0(struct dp_pdev *pdev);
292
293 /**
294 * dp_mon_filter_alloc_2_0() - tx monitor filter allocation
295 * @pdev: physical device handle
296 *
297 * Return: non-zero for failure, zero for success
298 */
299 QDF_STATUS dp_mon_filter_alloc_2_0(struct dp_pdev *pdev);
300
301 #ifdef QCA_SUPPORT_LITE_MONITOR
302 void dp_mon_filter_reset_rx_lite_mon(struct dp_mon_pdev_be *be_mon_pdev);
303
304 void dp_mon_filter_setup_rx_lite_mon(struct dp_mon_pdev_be *be_mon_pdev);
305 #endif
306
307 #if defined(QCA_SUPPORT_LITE_MONITOR) && \
308 defined(WLAN_PKT_CAPTURE_TX_2_0)
309 /**
310 * dp_mon_filter_reset_tx_lite_mon() - Reset tx lite monitor filter
311 * @be_mon_pdev: physical mon device handle
312 *
313 * Return: Null
314 */
315 void dp_mon_filter_reset_tx_lite_mon(struct dp_mon_pdev_be *be_mon_pdev);
316
317 /**
318 * dp_mon_filter_setup_tx_lite_mon() - Setup tx lite monitor filter
319 * @pdev: physical device handle
320 *
321 * Return: Null
322 */
323 void dp_mon_filter_setup_tx_lite_mon(struct dp_pdev *pdev);
324 #else
325 static inline void
dp_mon_filter_reset_tx_lite_mon(struct dp_mon_pdev_be * be_mon_pdev)326 dp_mon_filter_reset_tx_lite_mon(struct dp_mon_pdev_be *be_mon_pdev)
327 {
328 }
329
330 static inline void
dp_mon_filter_setup_tx_lite_mon(struct dp_pdev * pdev)331 dp_mon_filter_setup_tx_lite_mon(struct dp_pdev *pdev)
332 {
333 }
334 #endif
335
336 #ifdef WLAN_FEATURE_LOCAL_PKT_CAPTURE
337 /**
338 * dp_mon_filter_setup_local_pkt_capture_tx() - Setup local packet capture
339 * tx monitor filter
340 * @pdev: physical device handle
341 *
342 * Return: void
343 */
344 void dp_mon_filter_setup_local_pkt_capture_tx(struct dp_pdev *pdev);
345
346 /**
347 * dp_mon_filter_reset_local_pkt_capture_tx() - Reset local packet capture
348 * tx monitor filter
349 * @pdev: physical device handle
350 *
351 * Return: void
352 */
353 void dp_mon_filter_reset_local_pkt_capture_tx(struct dp_pdev *pdev);
354 #endif
355 #endif /* _DP_MON_FILTER_2_0_H_ */
356