cdp_txrx_cfg.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. /*
  2. * Copyright (c) 2016-2019,2021 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. #include <cdp_txrx_cmn.h>
  26. /**
  27. * 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
  35. */
  36. static inline void
  37. cdp_cfg_set_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev,
  38. uint8_t disable_rx_fwd)
  39. {
  40. if (!soc || !soc->ops) {
  41. dp_cdp_debug("invalid instance");
  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. dp_cdp_debug("invalid instance");
  67. QDF_BUG(0);
  68. return;
  69. }
  70. if (!soc->ops->cfg_ops ||
  71. !soc->ops->cfg_ops->set_cfg_packet_log_enabled)
  72. return;
  73. soc->ops->cfg_ops->set_cfg_packet_log_enabled(cfg_pdev,
  74. val);
  75. }
  76. /**
  77. * cdp_cfg_attach() - attach config module
  78. * @soc - data path soc handle
  79. * @osdev - os instance
  80. * @cfg_param - configuration parameter should be propagated
  81. *
  82. * Allocate configuration module instance, and propagate configuration values
  83. *
  84. * return soc configuration module instance
  85. */
  86. static inline struct cdp_cfg
  87. *cdp_cfg_attach(ol_txrx_soc_handle soc,
  88. qdf_device_t osdev, void *cfg_param)
  89. {
  90. if (!soc || !soc->ops) {
  91. dp_cdp_debug("invalid instance");
  92. QDF_BUG(0);
  93. return NULL;
  94. }
  95. if (!soc->ops->cfg_ops ||
  96. !soc->ops->cfg_ops->cfg_attach)
  97. return NULL;
  98. return soc->ops->cfg_ops->cfg_attach(osdev, cfg_param);
  99. }
  100. /**
  101. * cdp_cfg_vdev_rx_set_intrabss_fwd() - enable/disable intra bass forwarding
  102. * @soc - data path soc handle
  103. * @vdev_id - virtual interface id
  104. * @val - enable or disable intra bss forwarding
  105. *
  106. * ap isolate, do not forward intra bss traffic
  107. *
  108. * return NONE
  109. */
  110. static inline void
  111. cdp_cfg_vdev_rx_set_intrabss_fwd(ol_txrx_soc_handle soc,
  112. uint8_t vdev_id, bool val)
  113. {
  114. if (!soc || !soc->ops) {
  115. dp_cdp_debug("invalid instance");
  116. QDF_BUG(0);
  117. return;
  118. }
  119. if (!soc->ops->cfg_ops ||
  120. !soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd)
  121. return;
  122. soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd(soc, vdev_id, 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) {
  138. dp_cdp_debug("invalid instance");
  139. QDF_BUG(0);
  140. return 0;
  141. }
  142. if (!soc->ops->cfg_ops ||
  143. !soc->ops->cfg_ops->is_rx_fwd_disabled)
  144. return 0;
  145. return soc->ops->cfg_ops->is_rx_fwd_disabled(vdev);
  146. }
  147. /**
  148. * cdp_cfg_tx_set_is_mgmt_over_wmi_enabled() - mgmt tx over wmi enable/disable
  149. * @soc - data path soc handle
  150. * @value - feature enable or disable
  151. *
  152. * Enable or disable management packet TX over WMI feature
  153. *
  154. * return None
  155. */
  156. static inline void
  157. cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(ol_txrx_soc_handle soc,
  158. uint8_t value)
  159. {
  160. if (!soc || !soc->ops) {
  161. dp_cdp_debug("invalid instance");
  162. QDF_BUG(0);
  163. return;
  164. }
  165. if (!soc->ops->cfg_ops ||
  166. !soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled)
  167. return;
  168. soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled(value);
  169. }
  170. /**
  171. * cdp_cfg_is_high_latency() - query data path is in high or low latency
  172. * @soc - data path soc handle
  173. * @pdev - data path device instance
  174. *
  175. * query data path is in high or low latency
  176. *
  177. * return 1 high latency data path, usb or sdio
  178. * 0 low latency data path
  179. */
  180. static inline int
  181. cdp_cfg_is_high_latency(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev)
  182. {
  183. if (!soc || !soc->ops) {
  184. dp_cdp_debug("invalid instance");
  185. QDF_BUG(0);
  186. return 0;
  187. }
  188. if (!soc->ops->cfg_ops ||
  189. !soc->ops->cfg_ops->is_high_latency)
  190. return 0;
  191. return soc->ops->cfg_ops->is_high_latency(cfg_pdev);
  192. }
  193. /**
  194. * cdp_cfg_set_flow_control_parameters() - set flow control params
  195. * @soc - data path soc handle
  196. * @cfg - dp config module instance
  197. * @param - parameters should set
  198. *
  199. * set flow control params
  200. *
  201. * return None
  202. */
  203. static inline void
  204. cdp_cfg_set_flow_control_parameters(ol_txrx_soc_handle soc,
  205. struct cdp_cfg *cfg_pdev, void *param)
  206. {
  207. if (!soc || !soc->ops) {
  208. dp_cdp_debug("invalid instance");
  209. QDF_BUG(0);
  210. return;
  211. }
  212. if (!soc->ops->cfg_ops ||
  213. !soc->ops->cfg_ops->set_flow_control_parameters)
  214. return;
  215. soc->ops->cfg_ops->set_flow_control_parameters(cfg_pdev,
  216. param);
  217. }
  218. /**
  219. * cdp_cfg_set_flow_steering - Set Rx flow steering config based on CFG ini
  220. * config.
  221. *
  222. * @pdev - handle to the physical device
  223. * @val - 0 - disable, 1 - enable
  224. *
  225. * Return: None
  226. */
  227. static inline void cdp_cfg_set_flow_steering(ol_txrx_soc_handle soc,
  228. struct cdp_cfg *cfg_pdev, uint8_t val)
  229. {
  230. if (!soc || !soc->ops) {
  231. dp_cdp_debug("invalid instance");
  232. QDF_BUG(0);
  233. return;
  234. }
  235. if (!soc->ops->cfg_ops ||
  236. !soc->ops->cfg_ops->set_flow_steering)
  237. return;
  238. soc->ops->cfg_ops->set_flow_steering(cfg_pdev, val);
  239. }
  240. static inline void cdp_cfg_get_max_peer_id(ol_txrx_soc_handle soc,
  241. struct cdp_cfg *cfg_pdev)
  242. {
  243. }
  244. /**
  245. * cdp_cfg_set_ptp_rx_opt_enabled() - enable/disable ptp rx timestamping
  246. * @soc - data path soc handle
  247. * @pdev - data path device instance
  248. * @val - enable or disable packet log
  249. *
  250. * ptp rx timestamping enable or disable
  251. *
  252. * return NONE
  253. */
  254. static inline void
  255. cdp_cfg_set_ptp_rx_opt_enabled(ol_txrx_soc_handle soc,
  256. struct cdp_cfg *cfg_pdev, uint8_t val)
  257. {
  258. if (!soc || !soc->ops) {
  259. dp_cdp_debug("invalid instance");
  260. QDF_BUG(0);
  261. return;
  262. }
  263. if (!soc->ops->cfg_ops ||
  264. !soc->ops->cfg_ops->set_ptp_rx_opt_enabled)
  265. return;
  266. soc->ops->cfg_ops->set_ptp_rx_opt_enabled(cfg_pdev, val);
  267. }
  268. /**
  269. * cdp_cfg_set_new_htt_msg_format() - set htt h2t msg feature
  270. * @soc - datapath soc handle
  271. * @val - enable or disable new htt h2t msg feature
  272. *
  273. * Enable whether htt h2t message length includes htc header length
  274. *
  275. * return NONE
  276. */
  277. static inline void
  278. cdp_cfg_set_new_htt_msg_format(ol_txrx_soc_handle soc,
  279. uint8_t val)
  280. {
  281. if (!soc || !soc->ops) {
  282. dp_cdp_debug("invalid instance");
  283. return;
  284. }
  285. if (!soc->ops->cfg_ops ||
  286. !soc->ops->cfg_ops->set_new_htt_msg_format)
  287. return;
  288. soc->ops->cfg_ops->set_new_htt_msg_format(val);
  289. }
  290. /**
  291. * cdp_cfg_set_peer_unmap_conf_support() - set peer unmap conf feature
  292. * @soc - datapath soc handle
  293. * @val - enable or disable peer unmap conf feature
  294. *
  295. * Set if peer unmap confirmation feature is supported by both FW and in INI
  296. *
  297. * return NONE
  298. */
  299. static inline void
  300. cdp_cfg_set_peer_unmap_conf_support(ol_txrx_soc_handle soc, bool val)
  301. {
  302. if (!soc || !soc->ops) {
  303. dp_cdp_debug("invalid instance");
  304. QDF_BUG(0);
  305. return;
  306. }
  307. if (!soc->ops->cfg_ops ||
  308. !soc->ops->cfg_ops->set_peer_unmap_conf_support)
  309. return;
  310. soc->ops->cfg_ops->set_peer_unmap_conf_support(val);
  311. }
  312. /**
  313. * cdp_cfg_get_peer_unmap_conf_support() - check peer unmap conf feature
  314. * @soc - datapath soc handle
  315. *
  316. * Check if peer unmap confirmation feature is enabled
  317. *
  318. * return true is peer unmap confirmation feature is enabled else false
  319. */
  320. static inline bool
  321. cdp_cfg_get_peer_unmap_conf_support(ol_txrx_soc_handle soc)
  322. {
  323. if (!soc || !soc->ops) {
  324. dp_cdp_debug("invalid instance");
  325. QDF_BUG(0);
  326. return false;
  327. }
  328. if (!soc->ops->cfg_ops ||
  329. !soc->ops->cfg_ops->get_peer_unmap_conf_support)
  330. return false;
  331. return soc->ops->cfg_ops->get_peer_unmap_conf_support();
  332. }
  333. static inline void
  334. cdp_cfg_set_tx_compl_tsf64(ol_txrx_soc_handle soc,
  335. uint8_t val)
  336. {
  337. if (!soc || !soc->ops) {
  338. dp_debug("invalid instance");
  339. return;
  340. }
  341. if (!soc->ops->cfg_ops ||
  342. !soc->ops->cfg_ops->set_tx_compl_tsf64)
  343. return;
  344. soc->ops->cfg_ops->set_tx_compl_tsf64(val);
  345. }
  346. static inline bool
  347. cdp_cfg_get_tx_compl_tsf64(ol_txrx_soc_handle soc)
  348. {
  349. if (!soc || !soc->ops) {
  350. dp_debug("invalid instance");
  351. return false;
  352. }
  353. if (!soc->ops->cfg_ops ||
  354. !soc->ops->cfg_ops->get_tx_compl_tsf64)
  355. return false;
  356. return soc->ops->cfg_ops->get_tx_compl_tsf64();
  357. }
  358. #endif /* _CDP_TXRX_CFG_H_ */