cdp_txrx_cfg.h 8.1 KB

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