cdp_txrx_cfg.h 7.5 KB

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