blob: 711185f28b424457655d71670686ab9c57b3ed31 [file] [log] [blame]
Aniruddha Paulf9d2c0f2019-10-22 14:28:37 +05301/*
2 * Copyright (c) 2020 The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#ifndef _DP_MON_FILTER_H_
20#define _DP_MON_FILTER_H_
21
22/**
23 * Accessor Macros to access the software
24 * defined HTT filter htt_rx_ring_tlv_filter.
25 */
26#define DP_MON_FILTER_TLV_OFFSET 0x00000000
27#define DP_MON_FILTER_TLV_MASK 0xffffffff
28#define DP_MON_FILTER_TLV_LSB 0
29
30#define DP_MON_FILTER_FP_MGMT_OFFSET 0x00000004
31#define DP_MON_FILTER_FP_MGMT_MASK 0x0000ffff
32#define DP_MON_FILTER_FP_MGMT_LSB 0
33
34#define DP_MON_FILTER_MO_MGMT_OFFSET 0x00000004
35#define DP_MON_FILTER_MO_MGMT_MASK 0xffff0000
36#define DP_MON_FILTER_MO_MGMT_LSB 16
37
38#define DP_MON_FILTER_FP_CTRL_OFFSET 0x00000008
39#define DP_MON_FILTER_FP_CTRL_MASK 0x0000ffff
40#define DP_MON_FILTER_FP_CTRL_LSB 0
41
42#define DP_MON_FILTER_MO_CTRL_OFFSET 0x00000008
43#define DP_MON_FILTER_MO_CTRL_MASK 0xffff0000
44#define DP_MON_FILTER_MO_CTRL_LSB 16
45
46#define DP_MON_FILTER_FP_DATA_OFFSET 0x0000000c
47#define DP_MON_FILTER_FP_DATA_MASK 0x0000ffff
48#define DP_MON_FILTER_FP_DATA_LSB 0
49
50#define DP_MON_FILTER_MO_DATA_OFFSET 0x0000000c
51#define DP_MON_FILTER_MO_DATA_MASK 0xffff0000
52#define DP_MON_FILTER_MO_DATA_LSB 16
53
54#define DP_MON_FILTER_MD_DATA_OFFSET 0x00000010
55#define DP_MON_FILTER_MD_DATA_MASK 0x0000ffff
56#define DP_MON_FILTER_MD_DATA_LSB 0
57
58#define DP_MON_FILTER_MD_MGMT_OFFSET 0x00000010
59#define DP_MON_FILTER_MD_MGMT_MASK 0xffff0000
60#define DP_MON_FILTER_MD_MGMT_LSB 16
61
62#define DP_MON_FILTER_MD_CTRL_OFFSET 0x00000014
63#define DP_MON_FILTER_MD_CTRL_MASK 0x0000ffff
64#define DP_MON_FILTER_MD_CTRL_LSB 0
65
66#define DP_MON_FILTER_GET(src, field) \
67 ((*((uint32_t *)((uint8_t *)(src) + DP_MON_ ## field ## _OFFSET)) & \
68 (DP_MON_ ## field ## _MASK)) >> DP_MON_ ## field ## _LSB) \
69
70#define DP_MON_FILTER_SET(dst, field, value) \
71do { \
72 uint32_t *val = \
73 ((uint32_t *)((uint8_t *)(dst) + DP_MON_ ## field ## _OFFSET)); \
74 *val &= ~(DP_MON_ ## field ## _MASK); \
75 *val |= ((value) << DP_MON_ ## field ## _LSB); \
76} while (0)
77
78#define DP_MON_FILTER_PRINT(fmt, args ...) \
79 QDF_TRACE(QDF_MODULE_ID_MON_FILTER, QDF_TRACE_LEVEL_DEBUG, \
80 fmt, ## args)
81/**
82 * struct dp_mon_filter - Monitor TLV filter
83 * @valid: enable/disable TLV filter
84 * @tlv_filter: Rx ring TLV filter
85 */
86struct dp_mon_filter {
87 bool valid;
88 struct htt_rx_ring_tlv_filter tlv_filter;
89};
90
91/**
92 * enum dp_mon_filter_mode - Different modes for SRNG filters
93 * @DP_MON_FILTER_ENHACHED_STATS_MODE: PPDU enhanced stats mode
94 * @DP_MON_FILTER_SMART_MONITOR_MODE: Smart monitor mode
95 * @DP_MON_FILTER_MCOPY_MODE: AM copy mode
96 * @DP_MON_FILTER_MONITOR_MODE: Monitor mode
97 * @DP_MON_FILTER_RX_CAPTURE_MODE: Rx Capture mode
98 * @DP_MON_FILTER_PKT_LOG_FULL_MODE: Packet log full mode
99 * @DP_MON_FILTER_PKT_LOG_LITE_MODE: Packet log lite mode
100 */
101enum dp_mon_filter_mode {
102#ifdef FEATURE_PERPKT_INFO
103 DP_MON_FILTER_ENHACHED_STATS_MODE,
104 DP_MON_FILTER_MCOPY_MODE,
105#endif /* FEATURE_PERPKT_INFO */
106#if defined(ATH_SUPPORT_NAC_RSSI) || defined(ATH_SUPPORT_NAC)
107 DP_MON_FILTER_SMART_MONITOR_MODE,
108#endif /* ATH_SUPPORT_NAC_RSSI || ATH_SUPPORT_NAC */
109 DP_MON_FILTER_MONITOR_MODE,
110#ifdef WLAN_RX_PKT_CAPTURE_ENH
111 DP_MON_FILTER_RX_CAPTURE_MODE,
112#endif /* WLAN_RX_PKT_CAPTURE_ENH */
113
114#ifdef WDI_EVENT_ENABLE
115 DP_MON_FILTER_PKT_LOG_FULL_MODE,
116 DP_MON_FILTER_PKT_LOG_LITE_MODE,
117#endif /* WDI_EVENT_ENABLE */
118 DP_MON_FILTER_MAX_MODE
119};
120
121/**
122 * enum dp_mon_filter_srng_type - Srng types dynamic mode filter
123 * settings.
124 * @DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF: RXDMA srng type
125 * @DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS: RxDMA monitor status srng
126 * @DP_MON_FILTER_SRNG_TYPE_RXDMA_MON_BUF: RxDMA destination srng
127 * @DP_MON_FILTER_SRNG_TYPE_MAX: Srng max type
128 */
129enum dp_mon_filter_srng_type {
130 DP_MON_FILTER_SRNG_TYPE_RXDMA_BUF,
131 DP_MON_FILTER_SRNG_TYPE_RXDMA_MONITOR_STATUS,
132 DP_MON_FILTER_SRNG_TYPE_RXDMA_MON_BUF,
133 DP_MON_FILTER_SRNG_TYPE_MAX
134};
135
136/**
137 * enum dp_mon_filter_action - Action for storing the filters
138 * into the radio structure.
139 * @DP_MON_FILTER_CLEAR - Clears the filter for a mode
140 * @DP_MON_FILTER_SET - Set the filtes for a mode
141 */
142enum dp_mon_filter_action {
143 DP_MON_FILTER_CLEAR,
144 DP_MON_FILTER_SET,
145};
146
147#ifdef FEATURE_PERPKT_INFO
148/**
149 * dp_mon_filter_setup_enhanced_stats() - Setup the enhanced stats filter
150 * @pdev: DP pdev handle
151 */
152void dp_mon_filter_setup_enhanced_stats(struct dp_pdev *pdev);
153
154/***
155 * dp_mon_filter_reset_enhanced_stats() - Reset the enhanced stats filter
156 * @pdev: DP pdev handle
157 */
158void dp_mon_filter_reset_enhanced_stats(struct dp_pdev *pdev);
159
160/**
161 * dp_mon_filter_setup_mcopy_mode() - Setup the m_copy mode filter
162 * @pdev: DP pdev handle
163 */
164void dp_mon_filter_setup_mcopy_mode(struct dp_pdev *pdev);
165
166/**
167 * dp_mon_filter_reset_mcopy_mode() - Reset the m_copy mode filter
168 * @pdev: DP pdev handle
169 */
170void dp_mon_filter_reset_mcopy_mode(struct dp_pdev *pdev);
171#endif /* FEATURE_PERPKT_INFO */
172
173#if defined(ATH_SUPPORT_NAC_RSSI) || defined(ATH_SUPPORT_NAC)
174/**
175 * dp_mon_filter_setup_smart_monitor() - Setup the smart monitor mode filter
176 * @pdev: DP pdev handle
177 */
178void dp_mon_filter_setup_smart_monitor(struct dp_pdev *pdev);
179
180/**
181 * dp_mon_filter_reset_smart_monitor() - Reset the smart monitor mode filter
182 * @pdev: DP pdev handle
183 */
184void dp_mon_filter_reset_smart_monitor(struct dp_pdev *pdev);
185#endif /* ATH_SUPPORT_NAC_RSSI || ATH_SUPPORT_NAC */
186
187#ifdef WLAN_RX_PKT_CAPTURE_ENH
188/**
189 * dp_mon_filter_setup_rx_enh_capture() - Setup the Rx capture mode filters
190 * @pdev: DP pdev handle
191 */
192void dp_mon_filter_setup_rx_enh_capture(struct dp_pdev *pdev);
193
194/**
195 * dp_mon_filter_reset_rx_enh_capture() - Reset the Rx capture mode filters
196 * @pdev: DP pdev handle
197 */
198void dp_mon_filter_reset_rx_enh_capture(struct dp_pdev *pdev);
199#endif /* WLAN_RX_PKT_CAPTURE_ENH */
200
201/**
202 * dp_mon_filter_setup_mon_mode() - Setup the Rx monitor mode filter
203 * @pdev: DP pdev handle
204 */
205void dp_mon_filter_setup_mon_mode(struct dp_pdev *pdev);
206
207/**
208 * dp_mon_filter_reset_mon_mode() - Reset the Rx monitor mode filter
209 * @pdev: DP pdev handle
210 */
211void dp_mon_filter_reset_mon_mode(struct dp_pdev *pdev);
212
213#ifdef WDI_EVENT_ENABLE
214/**
215 * dp_mon_filter_setup_rx_pkt_log_full() - Setup the Rx pktlog full mode filter
216 * @pdev: DP pdev handle
217 */
218void dp_mon_filter_setup_rx_pkt_log_full(struct dp_pdev *pdev);
219
220/**
221 * dp_mon_filter_reset_rx_pkt_log_full() - Reset the Rx pktlog full mode filter
222 * @pdev: DP pdev handle
223 */
224void dp_mon_filter_reset_rx_pkt_log_full(struct dp_pdev *pdev);
225
226/**
227 * dp_mon_filter_setup_rx_pkt_log_lite() - Setup the Rx pktlog lite mode filter
228 * in the radio object.
229 * @pdev: DP pdev handle
230 */
231void dp_mon_filter_setup_rx_pkt_log_lite(struct dp_pdev *pdev);
232
233/**
234 * dp_mon_filter_reset_rx_pkt_log_lite() - Reset the Rx pktlog lite mode filter
235 * @pdev: DP pdev handle
236 */
237void dp_mon_filter_reset_rx_pkt_log_lite(struct dp_pdev *pdev);
238#endif /* WDI_EVENT_ENABLE */
239
240/**
241 * dp_mon_filter_update() - Setup the monitor filter setting for a srng
242 * type
243 * @pdev: DP pdev handle
244 *
245 * Return: QDF_STATUS
246 */
247QDF_STATUS dp_mon_filter_update(struct dp_pdev *pdev);
248
249/**
250 * dp_mon_filter_dealloc() - Deallocate the filter objects to be stored in
251 * the radio object.
252 * @pdev: DP pdev handle
253 */
254void dp_mon_filter_dealloc(struct dp_pdev *pdev);
255
256/**
257 * dp_mon_filter_alloc() - Allocate the filter objects to be stored in
258 * the radio object.
259 * @pdev: DP pdev handle
260 */
261struct dp_mon_filter **dp_mon_filter_alloc(struct dp_pdev *pdev);
262#endif /* #ifndef _DP_MON_FILTER_H_ */