xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_cfg.h (revision 1e1def755013f8d953fce9b9cbe4d8836497c0d6)
1 /*
2  * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27 /**
28  * @file cdp_txrx_cfg.h
29  * @brief Define the host data path configuration API functions
30  */
31 #ifndef _CDP_TXRX_CFG_H_
32 #define _CDP_TXRX_CFG_H_
33 #include "cdp_txrx_handle.h"
34 /**
35  * cdp_cfg_set_rx_fwd_disabled() - enable/disable rx forwarding
36  * @soc - data path soc handle
37  * @pdev - data path device instance
38  * @disable_rx_fwd - enable or disable rx forwarding
39  *
40  * enable/disable rx forwarding
41  *
42  * return NONE
43  */
44 static inline void
45 cdp_cfg_set_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev,
46 		uint8_t disable_rx_fwd)
47 {
48 	if (!soc || !soc->ops) {
49 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
50 			"%s invalid instance", __func__);
51 		QDF_BUG(0);
52 		return;
53 	}
54 
55 	if (!soc->ops->cfg_ops ||
56 	    !soc->ops->cfg_ops->set_cfg_rx_fwd_disabled)
57 		return;
58 
59 	soc->ops->cfg_ops->set_cfg_rx_fwd_disabled(cfg_pdev,
60 			disable_rx_fwd);
61 }
62 
63 /**
64  * cdp_cfg_set_packet_log_enabled() - enable/disable packet log
65  * @soc - data path soc handle
66  * @pdev - data path device instance
67  * @val - enable or disable packet log
68  *
69  * packet log enable or disable
70  *
71  * return NONE
72  */
73 static inline void
74 cdp_cfg_set_packet_log_enabled(ol_txrx_soc_handle soc,
75 		struct cdp_cfg *cfg_pdev, uint8_t val)
76 {
77 	if (!soc || !soc->ops) {
78 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
79 			"%s invalid instance", __func__);
80 		QDF_BUG(0);
81 		return;
82 	}
83 
84 	if (!soc->ops->cfg_ops ||
85 	    !soc->ops->cfg_ops->set_cfg_packet_log_enabled)
86 		return;
87 
88 	soc->ops->cfg_ops->set_cfg_packet_log_enabled(cfg_pdev,
89 				val);
90 }
91 
92 /**
93  * cdp_cfg_attach() - attach config module
94  * @soc - data path soc handle
95  * @osdev - os instance
96  * @cfg_param - configuration parameter should be propagated
97  *
98  * Allocate configuration module instance, and propagate configuration values
99  *
100  * return soc configuration module instance
101  */
102 static inline struct cdp_cfg
103 *cdp_cfg_attach(ol_txrx_soc_handle soc,
104 		qdf_device_t osdev, void *cfg_param)
105 {
106 	if (!soc || !soc->ops) {
107 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
108 			"%s invalid instance", __func__);
109 		QDF_BUG(0);
110 		return NULL;
111 	}
112 
113 	if (!soc->ops->cfg_ops ||
114 	    !soc->ops->cfg_ops->cfg_attach)
115 		return NULL;
116 
117 	return soc->ops->cfg_ops->cfg_attach(osdev, cfg_param);
118 }
119 
120 /**
121  * cdp_cfg_vdev_rx_set_intrabss_fwd() - enable/disable intra bass forwarding
122  * @soc - data path soc handle
123  * @vdev - virtual interface instance
124  * @val - enable or disable intra bss forwarding
125  *
126  * ap isolate, do not forward intra bss traffic
127  *
128  * return NONE
129  */
130 static inline void
131 cdp_cfg_vdev_rx_set_intrabss_fwd(ol_txrx_soc_handle soc,
132 		struct cdp_vdev *vdev, bool val)
133 {
134 	if (!soc || !soc->ops) {
135 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
136 			"%s invalid instance", __func__);
137 		QDF_BUG(0);
138 		return;
139 	}
140 
141 	if (!soc->ops->cfg_ops ||
142 	    !soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd)
143 		return;
144 
145 	soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd(vdev, val);
146 }
147 
148 /**
149  * cdp_cfg_is_rx_fwd_disabled() - get vdev rx forward
150  * @soc - data path soc handle
151  * @vdev - virtual interface instance
152  *
153  * Return rx forward feature enable status
154  *
155  * return 1 enabled
156  *        0 disabled
157  */
158 static inline uint8_t
159 cdp_cfg_is_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
160 {
161 	if (!soc || !soc->ops) {
162 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
163 			"%s invalid instance", __func__);
164 		QDF_BUG(0);
165 		return 0;
166 	}
167 
168 	if (!soc->ops->cfg_ops ||
169 	    !soc->ops->cfg_ops->is_rx_fwd_disabled)
170 		return 0;
171 
172 	return soc->ops->cfg_ops->is_rx_fwd_disabled(vdev);
173 
174 }
175 
176 /**
177  * cdp_cfg_tx_set_is_mgmt_over_wmi_enabled() - mgmt tx over wmi enable/disable
178  * @soc - data path soc handle
179  * @value - feature enable or disable
180  *
181  * Enable or disable management packet TX over WMI feature
182  *
183  * return None
184  */
185 static inline void
186 cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(ol_txrx_soc_handle soc,
187 		uint8_t value)
188 {
189 	if (!soc || !soc->ops) {
190 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
191 			"%s invalid instance", __func__);
192 		QDF_BUG(0);
193 		return;
194 	}
195 
196 	if (!soc->ops->cfg_ops ||
197 	    !soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled)
198 		return;
199 
200 	soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled(value);
201 }
202 
203 /**
204  * cdp_cfg_is_high_latency() - query data path is in high or low latency
205  * @soc - data path soc handle
206  * @pdev - data path device instance
207  *
208  * query data path is in high or low latency
209  *
210  * return 1 high latency data path, usb or sdio
211  *        0 low latency data path
212  */
213 static inline int
214 cdp_cfg_is_high_latency(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev)
215 {
216 	if (!soc || !soc->ops) {
217 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
218 			"%s invalid instance", __func__);
219 		QDF_BUG(0);
220 		return 0;
221 	}
222 
223 	if (!soc->ops->cfg_ops ||
224 	    !soc->ops->cfg_ops->is_high_latency)
225 		return 0;
226 
227 	return soc->ops->cfg_ops->is_high_latency(cfg_pdev);
228 }
229 
230 /**
231  * cdp_cfg_set_flow_control_parameters() - set flow control params
232  * @soc - data path soc handle
233  * @cfg - dp config module instance
234  * @param - parameters should set
235  *
236  * set flow control params
237  *
238  * return None
239  */
240 static inline void
241 cdp_cfg_set_flow_control_parameters(ol_txrx_soc_handle soc,
242 		struct cdp_cfg *cfg_pdev, void *param)
243 {
244 	if (!soc || !soc->ops) {
245 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
246 			"%s invalid instance", __func__);
247 		QDF_BUG(0);
248 		return;
249 	}
250 
251 	if (!soc->ops->cfg_ops ||
252 	    !soc->ops->cfg_ops->set_flow_control_parameters)
253 		return;
254 
255 	soc->ops->cfg_ops->set_flow_control_parameters(cfg_pdev,
256 						       param);
257 }
258 
259 /**
260  * cdp_cfg_set_flow_steering - Set Rx flow steering config based on CFG ini
261  *			config.
262  *
263  * @pdev - handle to the physical device
264  * @val - 0 - disable, 1 - enable
265  *
266  * Return: None
267  */
268 static inline void cdp_cfg_set_flow_steering(ol_txrx_soc_handle soc,
269 		struct cdp_cfg *cfg_pdev, uint8_t val)
270 {
271 	if (!soc || !soc->ops) {
272 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
273 			"%s invalid instance", __func__);
274 		QDF_BUG(0);
275 		return;
276 	}
277 
278 	if (!soc->ops->cfg_ops ||
279 	    !soc->ops->cfg_ops->set_flow_steering)
280 		return;
281 
282 	soc->ops->cfg_ops->set_flow_steering(cfg_pdev, val);
283 }
284 
285 static inline void cdp_cfg_get_max_peer_id(ol_txrx_soc_handle soc,
286 		struct cdp_cfg *cfg_pdev)
287 {
288 }
289 
290 /**
291  * cdp_cfg_set_ptp_rx_opt_enabled() - enable/disable ptp rx timestamping
292  * @soc - data path soc handle
293  * @pdev - data path device instance
294  * @val - enable or disable packet log
295  *
296  * ptp rx timestamping enable or disable
297  *
298  * return NONE
299  */
300 static inline void
301 cdp_cfg_set_ptp_rx_opt_enabled(ol_txrx_soc_handle soc,
302 			       struct cdp_cfg *cfg_pdev, uint8_t val)
303 {
304 	if (!soc || !soc->ops) {
305 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
306 			  "%s invalid instance", __func__);
307 		QDF_BUG(0);
308 		return;
309 	}
310 
311 	if (!soc->ops->cfg_ops ||
312 	    !soc->ops->cfg_ops->set_ptp_rx_opt_enabled)
313 		return;
314 
315 	soc->ops->cfg_ops->set_ptp_rx_opt_enabled(cfg_pdev, val);
316 }
317 #endif /* _CDP_TXRX_CFG_H_ */
318