blob: 4c88b815d30fd12aaf97043943db00c987d9627e [file] [log] [blame]
Dhanashri Atre9c222b12016-03-22 13:26:13 -07001/*
Jiani Liu7067cd42019-05-09 11:17:51 +08002 * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
Dhanashri Atre9c222b12016-03-22 13:26:13 -07003 *
Dhanashri Atre9c222b12016-03-22 13:26:13 -07004 * 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
Yun Parkb0044b42017-04-03 08:46:07 -070019/**
Dhanashri Atre9c222b12016-03-22 13:26:13 -070020 * @file cdp_txrx_cfg.h
21 * @brief Define the host data path configuration API functions
22 */
23#ifndef _CDP_TXRX_CFG_H_
24#define _CDP_TXRX_CFG_H_
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080025#include "cdp_txrx_handle.h"
Dhanashri Atre9c222b12016-03-22 13:26:13 -070026/**
Leo Changdb6358c2016-09-27 17:00:52 -070027 * cdp_cfg_set_rx_fwd_disabled() - enable/disable rx forwarding
28 * @soc - data path soc handle
29 * @pdev - data path device instance
30 * @disable_rx_fwd - enable or disable rx forwarding
31 *
32 * enable/disable rx forwarding
33 *
34 * return NONE
Dhanashri Atre9c222b12016-03-22 13:26:13 -070035 */
Leo Changdb6358c2016-09-27 17:00:52 -070036static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080037cdp_cfg_set_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev,
Leo Changdb6358c2016-09-27 17:00:52 -070038 uint8_t disable_rx_fwd)
39{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070040 if (!soc || !soc->ops) {
41 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -070042 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070043 QDF_BUG(0);
Leo Changdb6358c2016-09-27 17:00:52 -070044 return;
45 }
Dhanashri Atre9c222b12016-03-22 13:26:13 -070046
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070047 if (!soc->ops->cfg_ops ||
48 !soc->ops->cfg_ops->set_cfg_rx_fwd_disabled)
49 return;
50
51 soc->ops->cfg_ops->set_cfg_rx_fwd_disabled(cfg_pdev,
Leo Changdb6358c2016-09-27 17:00:52 -070052 disable_rx_fwd);
53}
Dhanashri Atre9c222b12016-03-22 13:26:13 -070054
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080055/**
Leo Changdb6358c2016-09-27 17:00:52 -070056 * cdp_cfg_set_packet_log_enabled() - enable/disable packet log
57 * @soc - data path soc handle
58 * @pdev - data path device instance
59 * @val - enable or disable packet log
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080060 *
Leo Changdb6358c2016-09-27 17:00:52 -070061 * packet log enable or disable
62 *
63 * return NONE
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080064 */
Leo Changdb6358c2016-09-27 17:00:52 -070065static inline void
66cdp_cfg_set_packet_log_enabled(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080067 struct cdp_cfg *cfg_pdev, uint8_t val)
Leo Changdb6358c2016-09-27 17:00:52 -070068{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070069 if (!soc || !soc->ops) {
70 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -070071 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070072 QDF_BUG(0);
Leo Changdb6358c2016-09-27 17:00:52 -070073 return;
74 }
75
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070076 if (!soc->ops->cfg_ops ||
77 !soc->ops->cfg_ops->set_cfg_packet_log_enabled)
78 return;
79
80 soc->ops->cfg_ops->set_cfg_packet_log_enabled(cfg_pdev,
Leo Changdb6358c2016-09-27 17:00:52 -070081 val);
82}
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080083
84/**
Leo Changdb6358c2016-09-27 17:00:52 -070085 * cdp_cfg_attach() - attach config module
86 * @soc - data path soc handle
87 * @osdev - os instance
88 * @cfg_param - configuration parameter should be propagated
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080089 *
Leo Changdb6358c2016-09-27 17:00:52 -070090 * Allocate configuration module instance, and propagate configuration values
91 *
92 * return soc configuration module instance
Manjunathappa Prakash5f45de52016-03-07 11:25:38 -080093 */
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -080094static inline struct cdp_cfg
Leo Changdb6358c2016-09-27 17:00:52 -070095*cdp_cfg_attach(ol_txrx_soc_handle soc,
96 qdf_device_t osdev, void *cfg_param)
97{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -070098 if (!soc || !soc->ops) {
99 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -0700100 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700101 QDF_BUG(0);
Leo Changdb6358c2016-09-27 17:00:52 -0700102 return NULL;
103 }
104
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700105 if (!soc->ops->cfg_ops ||
106 !soc->ops->cfg_ops->cfg_attach)
107 return NULL;
Leo Changdb6358c2016-09-27 17:00:52 -0700108
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700109 return soc->ops->cfg_ops->cfg_attach(osdev, cfg_param);
Leo Changdb6358c2016-09-27 17:00:52 -0700110}
111
112/**
113 * cdp_cfg_vdev_rx_set_intrabss_fwd() - enable/disable intra bass forwarding
114 * @soc - data path soc handle
Vevek Venkatesan27e7bb42019-09-16 23:54:13 +0530115 * @vdev_id - virtual interface id
Leo Changdb6358c2016-09-27 17:00:52 -0700116 * @val - enable or disable intra bss forwarding
117 *
118 * ap isolate, do not forward intra bss traffic
119 *
120 * return NONE
121 */
122static inline void
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800123cdp_cfg_vdev_rx_set_intrabss_fwd(ol_txrx_soc_handle soc,
Vevek Venkatesan27e7bb42019-09-16 23:54:13 +0530124 uint8_t vdev_id, bool val)
Leo Changdb6358c2016-09-27 17:00:52 -0700125{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700126 if (!soc || !soc->ops) {
127 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -0700128 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700129 QDF_BUG(0);
Leo Changdb6358c2016-09-27 17:00:52 -0700130 return;
131 }
132
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700133 if (!soc->ops->cfg_ops ||
134 !soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd)
135 return;
136
Vevek Venkatesan27e7bb42019-09-16 23:54:13 +0530137 soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd(soc, vdev_id, val);
Leo Changdb6358c2016-09-27 17:00:52 -0700138}
139
140/**
141 * cdp_cfg_is_rx_fwd_disabled() - get vdev rx forward
142 * @soc - data path soc handle
143 * @vdev - virtual interface instance
144 *
145 * Return rx forward feature enable status
146 *
147 * return 1 enabled
148 * 0 disabled
149 */
150static inline uint8_t
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800151cdp_cfg_is_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
Leo Changdb6358c2016-09-27 17:00:52 -0700152{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700153 if (!soc || !soc->ops) {
154 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -0700155 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700156 QDF_BUG(0);
Leo Changdb6358c2016-09-27 17:00:52 -0700157 return 0;
158 }
159
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700160 if (!soc->ops->cfg_ops ||
161 !soc->ops->cfg_ops->is_rx_fwd_disabled)
162 return 0;
163
164 return soc->ops->cfg_ops->is_rx_fwd_disabled(vdev);
165
Leo Changdb6358c2016-09-27 17:00:52 -0700166}
167
168/**
169 * cdp_cfg_tx_set_is_mgmt_over_wmi_enabled() - mgmt tx over wmi enable/disable
170 * @soc - data path soc handle
171 * @value - feature enable or disable
172 *
173 * Enable or disable management packet TX over WMI feature
174 *
175 * return None
176 */
177static inline void
178cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(ol_txrx_soc_handle soc,
179 uint8_t value)
180{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700181 if (!soc || !soc->ops) {
182 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -0700183 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700184 QDF_BUG(0);
Leo Changdb6358c2016-09-27 17:00:52 -0700185 return;
186 }
187
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700188 if (!soc->ops->cfg_ops ||
189 !soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled)
190 return;
191
192 soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled(value);
Leo Changdb6358c2016-09-27 17:00:52 -0700193}
194
195/**
196 * cdp_cfg_is_high_latency() - query data path is in high or low latency
197 * @soc - data path soc handle
198 * @pdev - data path device instance
199 *
200 * query data path is in high or low latency
201 *
202 * return 1 high latency data path, usb or sdio
203 * 0 low latency data path
204 */
205static inline int
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800206cdp_cfg_is_high_latency(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev)
Leo Changdb6358c2016-09-27 17:00:52 -0700207{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700208 if (!soc || !soc->ops) {
209 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -0700210 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700211 QDF_BUG(0);
Leo Changdb6358c2016-09-27 17:00:52 -0700212 return 0;
213 }
214
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700215 if (!soc->ops->cfg_ops ||
216 !soc->ops->cfg_ops->is_high_latency)
217 return 0;
Leo Changdb6358c2016-09-27 17:00:52 -0700218
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700219 return soc->ops->cfg_ops->is_high_latency(cfg_pdev);
Leo Changdb6358c2016-09-27 17:00:52 -0700220}
221
222/**
223 * cdp_cfg_set_flow_control_parameters() - set flow control params
224 * @soc - data path soc handle
225 * @cfg - dp config module instance
226 * @param - parameters should set
227 *
228 * set flow control params
229 *
230 * return None
231 */
232static inline void
233cdp_cfg_set_flow_control_parameters(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800234 struct cdp_cfg *cfg_pdev, void *param)
Leo Changdb6358c2016-09-27 17:00:52 -0700235{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700236 if (!soc || !soc->ops) {
237 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -0700238 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700239 QDF_BUG(0);
Leo Changdb6358c2016-09-27 17:00:52 -0700240 return;
241 }
242
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700243 if (!soc->ops->cfg_ops ||
244 !soc->ops->cfg_ops->set_flow_control_parameters)
245 return;
Leo Changdb6358c2016-09-27 17:00:52 -0700246
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700247 soc->ops->cfg_ops->set_flow_control_parameters(cfg_pdev,
248 param);
Leo Changdb6358c2016-09-27 17:00:52 -0700249}
250
251/**
252 * cdp_cfg_set_flow_steering - Set Rx flow steering config based on CFG ini
253 * config.
254 *
255 * @pdev - handle to the physical device
256 * @val - 0 - disable, 1 - enable
257 *
258 * Return: None
259 */
260static inline void cdp_cfg_set_flow_steering(ol_txrx_soc_handle soc,
Venkata Sharath Chandra Manchalaf2a125a2016-11-28 18:10:11 -0800261 struct cdp_cfg *cfg_pdev, uint8_t val)
Leo Changdb6358c2016-09-27 17:00:52 -0700262{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700263 if (!soc || !soc->ops) {
264 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Leo Changdb6358c2016-09-27 17:00:52 -0700265 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700266 QDF_BUG(0);
Leo Changdb6358c2016-09-27 17:00:52 -0700267 return;
268 }
269
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700270 if (!soc->ops->cfg_ops ||
271 !soc->ops->cfg_ops->set_flow_steering)
272 return;
Leo Changdb6358c2016-09-27 17:00:52 -0700273
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700274 soc->ops->cfg_ops->set_flow_steering(cfg_pdev, val);
Leo Changdb6358c2016-09-27 17:00:52 -0700275}
Pamidipati, Vijay6b0d2a82017-06-09 04:46:32 +0530276
277static inline void cdp_cfg_get_max_peer_id(ol_txrx_soc_handle soc,
278 struct cdp_cfg *cfg_pdev)
279{
280}
Yu Wanga3f76c52017-08-10 16:58:13 +0800281
282/**
283 * cdp_cfg_set_ptp_rx_opt_enabled() - enable/disable ptp rx timestamping
284 * @soc - data path soc handle
285 * @pdev - data path device instance
286 * @val - enable or disable packet log
287 *
288 * ptp rx timestamping enable or disable
289 *
290 * return NONE
291 */
292static inline void
293cdp_cfg_set_ptp_rx_opt_enabled(ol_txrx_soc_handle soc,
294 struct cdp_cfg *cfg_pdev, uint8_t val)
295{
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700296 if (!soc || !soc->ops) {
297 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
Yu Wanga3f76c52017-08-10 16:58:13 +0800298 "%s invalid instance", __func__);
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700299 QDF_BUG(0);
Yu Wanga3f76c52017-08-10 16:58:13 +0800300 return;
301 }
302
Venkata Sharath Chandra Manchalaaa62ae72017-10-20 00:00:54 -0700303 if (!soc->ops->cfg_ops ||
304 !soc->ops->cfg_ops->set_ptp_rx_opt_enabled)
305 return;
306
307 soc->ops->cfg_ops->set_ptp_rx_opt_enabled(cfg_pdev, val);
Yu Wanga3f76c52017-08-10 16:58:13 +0800308}
jitiphile65cc2d2018-11-05 14:31:21 +0530309
310/**
311 * cdp_cfg_set_new_htt_msg_format() - set htt h2t msg feature
312 * @soc - datapath soc handle
313 * @val - enable or disable new htt h2t msg feature
314 *
315 * Enable whether htt h2t message length includes htc header length
316 *
317 * return NONE
318 */
319static inline void
320cdp_cfg_set_new_htt_msg_format(ol_txrx_soc_handle soc,
321 uint8_t val)
322{
323 if (!soc || !soc->ops) {
324 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
325 "%s invalid instance", __func__);
326 return;
327 }
328
329 if (!soc->ops->cfg_ops ||
330 !soc->ops->cfg_ops->set_new_htt_msg_format)
331 return;
332
333 soc->ops->cfg_ops->set_new_htt_msg_format(val);
334}
335
Alok Kumar2e254c52018-11-28 17:26:53 +0530336/**
337 * cdp_cfg_set_peer_unmap_conf_support() - set peer unmap conf feature
338 * @soc - datapath soc handle
339 * @val - enable or disable peer unmap conf feature
340 *
341 * Set if peer unmap confirmation feature is supported by both FW and in INI
342 *
343 * return NONE
344 */
345static inline void
346cdp_cfg_set_peer_unmap_conf_support(ol_txrx_soc_handle soc, bool val)
347{
348 if (!soc || !soc->ops) {
349 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
350 "%s invalid instance", __func__);
351 QDF_BUG(0);
352 return;
353 }
354
355 if (!soc->ops->cfg_ops ||
356 !soc->ops->cfg_ops->set_peer_unmap_conf_support)
357 return;
358
359 soc->ops->cfg_ops->set_peer_unmap_conf_support(val);
360}
361
362/**
363 * cdp_cfg_get_peer_unmap_conf_support() - check peer unmap conf feature
364 * @soc - datapath soc handle
365 *
366 * Check if peer unmap confirmation feature is enabled
367 *
368 * return true is peer unmap confirmation feature is enabled else false
369 */
370static inline bool
371cdp_cfg_get_peer_unmap_conf_support(ol_txrx_soc_handle soc)
372{
373 if (!soc || !soc->ops) {
374 QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
375 "%s invalid instance", __func__);
376 QDF_BUG(0);
377 return false;
378 }
379
380 if (!soc->ops->cfg_ops ||
381 !soc->ops->cfg_ops->get_peer_unmap_conf_support)
382 return false;
383
384 return soc->ops->cfg_ops->get_peer_unmap_conf_support();
385}
386
Jiani Liu7067cd42019-05-09 11:17:51 +0800387static inline void
388cdp_cfg_set_tx_compl_tsf64(ol_txrx_soc_handle soc,
389 uint8_t val)
390{
391 if (!soc || !soc->ops) {
392 dp_debug("invalid instance");
393 return;
394 }
395
396 if (!soc->ops->cfg_ops ||
397 !soc->ops->cfg_ops->set_tx_compl_tsf64)
398 return;
399
400 soc->ops->cfg_ops->set_tx_compl_tsf64(val);
401}
402
403static inline bool
404cdp_cfg_get_tx_compl_tsf64(ol_txrx_soc_handle soc)
405{
406 if (!soc || !soc->ops) {
407 dp_debug("invalid instance");
408 return false;
409 }
410
411 if (!soc->ops->cfg_ops ||
412 !soc->ops->cfg_ops->get_tx_compl_tsf64)
413 return false;
414
415 return soc->ops->cfg_ops->get_tx_compl_tsf64();
416}
417
Dhanashri Atre9c222b12016-03-22 13:26:13 -0700418#endif /* _CDP_TXRX_CFG_H_ */