xref: /wlan-driver/qca-wifi-host-cmn/dp/wifi3.0/monitor/1.0/dp_mon_1.0.h (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 #ifndef _DP_MON_1_0_H_
19 #define _DP_MON_1_0_H_
20 
21 #ifdef WLAN_RX_PKT_CAPTURE_ENH
22 #include <dp_rx_mon_feature.h>
23 #endif
24 
25 #include <dp_rx_mon.h>
26 
27 void dp_flush_monitor_rings(struct dp_soc *soc);
28 
29 #if !defined(DISABLE_MON_CONFIG)
30 /**
31  * dp_mon_htt_srng_setup_1_0() - Prepare HTT messages for Monitor rings
32  * @soc: soc handle
33  * @pdev: physical device handle
34  * @mac_id: ring number
35  * @mac_for_pdev: mac_id
36  *
37  * Return: non-zero for failure, zero for success
38  */
39 QDF_STATUS dp_mon_htt_srng_setup_1_0(struct dp_soc *soc,
40 				     struct dp_pdev *pdev,
41 				     int mac_id,
42 				     int mac_for_pdev);
43 
44 /**
45  * dp_mon_rings_alloc_1_0() - DP monitor rings allocation
46  * @pdev: physical device handle
47  *
48  * Return: non-zero for failure, zero for success
49  */
50 QDF_STATUS dp_mon_rings_alloc_1_0(struct dp_pdev *pdev);
51 
52 /**
53  * dp_mon_rings_free_1_0() - DP monitor rings deallocation
54  * @pdev: physical device handle
55  *
56  * Return: non-zero for failure, zero for success
57  */
58 void dp_mon_rings_free_1_0(struct dp_pdev *pdev);
59 
60 /**
61  * dp_mon_rings_init_1_0() - DP monitor rings initialization
62  * @pdev: physical device handle
63  *
64  * Return: non-zero for failure, zero for success
65  */
66 QDF_STATUS dp_mon_rings_init_1_0(struct dp_pdev *pdev);
67 
68 /**
69  * dp_mon_rings_deinit_1_0() - DP monitor rings deinitialization
70  * @pdev: physical device handle
71  *
72  * Return: non-zero for failure, zero for success
73  */
74 void dp_mon_rings_deinit_1_0(struct dp_pdev *pdev);
75 #else
76 static inline
dp_mon_rings_deinit_1_0(struct dp_pdev * pdev)77 void dp_mon_rings_deinit_1_0(struct dp_pdev *pdev)
78 {
79 }
80 
81 static inline
dp_mon_rings_free_1_0(struct dp_pdev * pdev)82 void dp_mon_rings_free_1_0(struct dp_pdev *pdev)
83 {
84 }
85 
86 static inline
dp_mon_rings_init_1_0(struct dp_pdev * pdev)87 QDF_STATUS dp_mon_rings_init_1_0(struct dp_pdev *pdev)
88 {
89 	return QDF_STATUS_SUCCESS;
90 }
91 
92 static inline
dp_mon_rings_alloc_1_0(struct dp_pdev * pdev)93 QDF_STATUS dp_mon_rings_alloc_1_0(struct dp_pdev *pdev)
94 {
95 	return QDF_STATUS_SUCCESS;
96 }
97 
98 #endif
99 
100 /* MCL specific functions */
101 #if defined(DP_CON_MON)
102 
103 /*
104  * dp_service_mon_rings()- service monitor rings
105  * @soc: soc dp handle
106  * @quota: number of ring entry that can be serviced
107  *
108  * Return: None
109  *
110  */
111 void dp_service_mon_rings(struct  dp_soc *soc, uint32_t quota);
112 #endif
113 
114 /**
115  * dp_mon_drop_packets_for_mac() - Drop the mon status ring and
116  *  dest ring packets for a given mac. Packets in status ring and
117  *  dest ring are dropped independently.
118  * @pdev: DP pdev
119  * @mac_id: mac id
120  * @quota: max number of status ring entries that can be processed
121  * @force_flush: Force flush ring
122  *
123  * Return: work done
124  */
125 uint32_t dp_mon_drop_packets_for_mac(struct dp_pdev *pdev, uint32_t mac_id,
126 				     uint32_t quota, bool force_flush);
127 
128 /**
129  * struct dp_mon_soc_li - Extended DP mon soc for LI targets
130  * @mon_soc: dp_mon_soc structure
131  */
132 struct dp_mon_soc_li {
133 	struct dp_mon_soc mon_soc;
134 };
135 
136 /**
137  * struct dp_mon_pdev_li - Extended DP mon pdev for LI targets
138  * @mon_pdev: dp_mon_pdev structure
139  */
140 struct dp_mon_pdev_li {
141 	struct dp_mon_pdev mon_pdev;
142 };
143 
144 /**
145  * dp_mon_get_context_size_li() - get LI specific size for mon pdev/soc
146  * @context_type: context type for which the size is needed
147  *
148  * Return: size in bytes for the context_type
149  */
150 static inline
dp_mon_get_context_size_li(enum dp_context_type context_type)151 qdf_size_t dp_mon_get_context_size_li(enum dp_context_type context_type)
152 {
153 	switch (context_type) {
154 	case DP_CONTEXT_TYPE_MON_PDEV:
155 		return sizeof(struct dp_mon_pdev_li);
156 	case DP_CONTEXT_TYPE_MON_SOC:
157 		return sizeof(struct dp_mon_soc_li);
158 	default:
159 		return 0;
160 	}
161 }
162 #endif /* _DP_MON_1_0_H_ */
163