cdp_txrx_cfg.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /**
  27. * @file cdp_txrx_cfg.h
  28. * @brief Define the host data path configuration API functions
  29. */
  30. #ifndef _CDP_TXRX_CFG_H_
  31. #define _CDP_TXRX_CFG_H_
  32. #include "cdp_txrx_handle.h"
  33. /**
  34. * cdp_cfg_set_rx_fwd_disabled() - enable/disable rx forwarding
  35. * @soc - data path soc handle
  36. * @pdev - data path device instance
  37. * @disable_rx_fwd - enable or disable rx forwarding
  38. *
  39. * enable/disable rx forwarding
  40. *
  41. * return NONE
  42. */
  43. static inline void
  44. cdp_cfg_set_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev,
  45. uint8_t disable_rx_fwd)
  46. {
  47. if (!soc || !soc->ops) {
  48. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  49. "%s invalid instance", __func__);
  50. QDF_BUG(0);
  51. return;
  52. }
  53. if (!soc->ops->cfg_ops ||
  54. !soc->ops->cfg_ops->set_cfg_rx_fwd_disabled)
  55. return;
  56. soc->ops->cfg_ops->set_cfg_rx_fwd_disabled(cfg_pdev,
  57. disable_rx_fwd);
  58. }
  59. /**
  60. * cdp_cfg_set_packet_log_enabled() - enable/disable packet log
  61. * @soc - data path soc handle
  62. * @pdev - data path device instance
  63. * @val - enable or disable packet log
  64. *
  65. * packet log enable or disable
  66. *
  67. * return NONE
  68. */
  69. static inline void
  70. cdp_cfg_set_packet_log_enabled(ol_txrx_soc_handle soc,
  71. struct cdp_cfg *cfg_pdev, uint8_t val)
  72. {
  73. if (!soc || !soc->ops) {
  74. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  75. "%s invalid instance", __func__);
  76. QDF_BUG(0);
  77. return;
  78. }
  79. if (!soc->ops->cfg_ops ||
  80. !soc->ops->cfg_ops->set_cfg_packet_log_enabled)
  81. return;
  82. soc->ops->cfg_ops->set_cfg_packet_log_enabled(cfg_pdev,
  83. val);
  84. }
  85. /**
  86. * cdp_cfg_attach() - attach config module
  87. * @soc - data path soc handle
  88. * @osdev - os instance
  89. * @cfg_param - configuration parameter should be propagated
  90. *
  91. * Allocate configuration module instance, and propagate configuration values
  92. *
  93. * return soc configuration module instance
  94. */
  95. static inline struct cdp_cfg
  96. *cdp_cfg_attach(ol_txrx_soc_handle soc,
  97. qdf_device_t osdev, void *cfg_param)
  98. {
  99. if (!soc || !soc->ops) {
  100. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  101. "%s invalid instance", __func__);
  102. QDF_BUG(0);
  103. return NULL;
  104. }
  105. if (!soc->ops->cfg_ops ||
  106. !soc->ops->cfg_ops->cfg_attach)
  107. return NULL;
  108. return soc->ops->cfg_ops->cfg_attach(osdev, cfg_param);
  109. }
  110. /**
  111. * cdp_cfg_vdev_rx_set_intrabss_fwd() - enable/disable intra bass forwarding
  112. * @soc - data path soc handle
  113. * @vdev - virtual interface instance
  114. * @val - enable or disable intra bss forwarding
  115. *
  116. * ap isolate, do not forward intra bss traffic
  117. *
  118. * return NONE
  119. */
  120. static inline void
  121. cdp_cfg_vdev_rx_set_intrabss_fwd(ol_txrx_soc_handle soc,
  122. struct cdp_vdev *vdev, bool val)
  123. {
  124. if (!soc || !soc->ops) {
  125. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  126. "%s invalid instance", __func__);
  127. QDF_BUG(0);
  128. return;
  129. }
  130. if (!soc->ops->cfg_ops ||
  131. !soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd)
  132. return;
  133. soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd(vdev, val);
  134. }
  135. /**
  136. * cdp_cfg_is_rx_fwd_disabled() - get vdev rx forward
  137. * @soc - data path soc handle
  138. * @vdev - virtual interface instance
  139. *
  140. * Return rx forward feature enable status
  141. *
  142. * return 1 enabled
  143. * 0 disabled
  144. */
  145. static inline uint8_t
  146. cdp_cfg_is_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  147. {
  148. if (!soc || !soc->ops) {
  149. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  150. "%s invalid instance", __func__);
  151. QDF_BUG(0);
  152. return 0;
  153. }
  154. if (!soc->ops->cfg_ops ||
  155. !soc->ops->cfg_ops->is_rx_fwd_disabled)
  156. return 0;
  157. return soc->ops->cfg_ops->is_rx_fwd_disabled(vdev);
  158. }
  159. /**
  160. * cdp_cfg_tx_set_is_mgmt_over_wmi_enabled() - mgmt tx over wmi enable/disable
  161. * @soc - data path soc handle
  162. * @value - feature enable or disable
  163. *
  164. * Enable or disable management packet TX over WMI feature
  165. *
  166. * return None
  167. */
  168. static inline void
  169. cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(ol_txrx_soc_handle soc,
  170. uint8_t value)
  171. {
  172. if (!soc || !soc->ops) {
  173. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  174. "%s invalid instance", __func__);
  175. QDF_BUG(0);
  176. return;
  177. }
  178. if (!soc->ops->cfg_ops ||
  179. !soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled)
  180. return;
  181. soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled(value);
  182. }
  183. /**
  184. * cdp_cfg_is_high_latency() - query data path is in high or low latency
  185. * @soc - data path soc handle
  186. * @pdev - data path device instance
  187. *
  188. * query data path is in high or low latency
  189. *
  190. * return 1 high latency data path, usb or sdio
  191. * 0 low latency data path
  192. */
  193. static inline int
  194. cdp_cfg_is_high_latency(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev)
  195. {
  196. if (!soc || !soc->ops) {
  197. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  198. "%s invalid instance", __func__);
  199. QDF_BUG(0);
  200. return 0;
  201. }
  202. if (!soc->ops->cfg_ops ||
  203. !soc->ops->cfg_ops->is_high_latency)
  204. return 0;
  205. return soc->ops->cfg_ops->is_high_latency(cfg_pdev);
  206. }
  207. /**
  208. * cdp_cfg_set_flow_control_parameters() - set flow control params
  209. * @soc - data path soc handle
  210. * @cfg - dp config module instance
  211. * @param - parameters should set
  212. *
  213. * set flow control params
  214. *
  215. * return None
  216. */
  217. static inline void
  218. cdp_cfg_set_flow_control_parameters(ol_txrx_soc_handle soc,
  219. struct cdp_cfg *cfg_pdev, void *param)
  220. {
  221. if (!soc || !soc->ops) {
  222. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  223. "%s invalid instance", __func__);
  224. QDF_BUG(0);
  225. return;
  226. }
  227. if (!soc->ops->cfg_ops ||
  228. !soc->ops->cfg_ops->set_flow_control_parameters)
  229. return;
  230. soc->ops->cfg_ops->set_flow_control_parameters(cfg_pdev,
  231. param);
  232. }
  233. /**
  234. * cdp_cfg_set_flow_steering - Set Rx flow steering config based on CFG ini
  235. * config.
  236. *
  237. * @pdev - handle to the physical device
  238. * @val - 0 - disable, 1 - enable
  239. *
  240. * Return: None
  241. */
  242. static inline void cdp_cfg_set_flow_steering(ol_txrx_soc_handle soc,
  243. struct cdp_cfg *cfg_pdev, uint8_t val)
  244. {
  245. if (!soc || !soc->ops) {
  246. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  247. "%s invalid instance", __func__);
  248. QDF_BUG(0);
  249. return;
  250. }
  251. if (!soc->ops->cfg_ops ||
  252. !soc->ops->cfg_ops->set_flow_steering)
  253. return;
  254. soc->ops->cfg_ops->set_flow_steering(cfg_pdev, val);
  255. }
  256. static inline void cdp_cfg_get_max_peer_id(ol_txrx_soc_handle soc,
  257. struct cdp_cfg *cfg_pdev)
  258. {
  259. }
  260. /**
  261. * cdp_cfg_set_ptp_rx_opt_enabled() - enable/disable ptp rx timestamping
  262. * @soc - data path soc handle
  263. * @pdev - data path device instance
  264. * @val - enable or disable packet log
  265. *
  266. * ptp rx timestamping enable or disable
  267. *
  268. * return NONE
  269. */
  270. static inline void
  271. cdp_cfg_set_ptp_rx_opt_enabled(ol_txrx_soc_handle soc,
  272. struct cdp_cfg *cfg_pdev, uint8_t val)
  273. {
  274. if (!soc || !soc->ops) {
  275. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  276. "%s invalid instance", __func__);
  277. QDF_BUG(0);
  278. return;
  279. }
  280. if (!soc->ops->cfg_ops ||
  281. !soc->ops->cfg_ops->set_ptp_rx_opt_enabled)
  282. return;
  283. soc->ops->cfg_ops->set_ptp_rx_opt_enabled(cfg_pdev, val);
  284. }
  285. #endif /* _CDP_TXRX_CFG_H_ */