cdp_txrx_cfg.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /*
  2. * Copyright (c) 2016-2019,2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * DOC: cdp_txrx_cfg.h
  21. * Define the host data path configuration API functions
  22. */
  23. #ifndef _CDP_TXRX_CFG_H_
  24. #define _CDP_TXRX_CFG_H_
  25. #include "cdp_txrx_handle.h"
  26. #include <cdp_txrx_cmn.h>
  27. /**
  28. * cdp_cfg_set_rx_fwd_disabled() - enable/disable rx forwarding
  29. * @soc: data path soc handle
  30. * @cfg_pdev: data path device instance
  31. * @disable_rx_fwd: enable or disable rx forwarding
  32. *
  33. * enable/disable rx forwarding
  34. *
  35. * return NONE
  36. */
  37. static inline void
  38. cdp_cfg_set_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev,
  39. uint8_t disable_rx_fwd)
  40. {
  41. if (!soc || !soc->ops) {
  42. dp_cdp_debug("invalid instance");
  43. QDF_BUG(0);
  44. return;
  45. }
  46. if (!soc->ops->cfg_ops ||
  47. !soc->ops->cfg_ops->set_cfg_rx_fwd_disabled)
  48. return;
  49. soc->ops->cfg_ops->set_cfg_rx_fwd_disabled(cfg_pdev,
  50. disable_rx_fwd);
  51. }
  52. /**
  53. * cdp_cfg_set_packet_log_enabled() - enable/disable packet log
  54. * @soc: data path soc handle
  55. * @cfg_pdev: data path device instance
  56. * @val: enable or disable packet log
  57. *
  58. * packet log enable or disable
  59. *
  60. * return NONE
  61. */
  62. static inline void
  63. cdp_cfg_set_packet_log_enabled(ol_txrx_soc_handle soc,
  64. struct cdp_cfg *cfg_pdev, uint8_t val)
  65. {
  66. if (!soc || !soc->ops) {
  67. dp_cdp_debug("invalid instance");
  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. dp_cdp_debug("invalid instance");
  93. QDF_BUG(0);
  94. return NULL;
  95. }
  96. if (!soc->ops->cfg_ops ||
  97. !soc->ops->cfg_ops->cfg_attach)
  98. return NULL;
  99. return soc->ops->cfg_ops->cfg_attach(osdev, cfg_param);
  100. }
  101. /**
  102. * cdp_cfg_vdev_rx_set_intrabss_fwd() - enable/disable intra bass forwarding
  103. * @soc: data path soc handle
  104. * @vdev_id: virtual interface id
  105. * @val: enable or disable intra bss forwarding
  106. *
  107. * ap isolate, do not forward intra bss traffic
  108. *
  109. * return NONE
  110. */
  111. static inline void
  112. cdp_cfg_vdev_rx_set_intrabss_fwd(ol_txrx_soc_handle soc,
  113. uint8_t vdev_id, bool val)
  114. {
  115. if (!soc || !soc->ops) {
  116. dp_cdp_debug("invalid instance");
  117. QDF_BUG(0);
  118. return;
  119. }
  120. if (!soc->ops->cfg_ops ||
  121. !soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd)
  122. return;
  123. soc->ops->cfg_ops->vdev_rx_set_intrabss_fwd(soc, vdev_id, val);
  124. }
  125. /**
  126. * cdp_cfg_is_rx_fwd_disabled() - get vdev rx forward
  127. * @soc: data path soc handle
  128. * @vdev: virtual interface instance
  129. *
  130. * Return rx forward feature enable status
  131. *
  132. * return 1 enabled
  133. * 0 disabled
  134. */
  135. static inline uint8_t
  136. cdp_cfg_is_rx_fwd_disabled(ol_txrx_soc_handle soc, struct cdp_vdev *vdev)
  137. {
  138. if (!soc || !soc->ops) {
  139. dp_cdp_debug("invalid instance");
  140. QDF_BUG(0);
  141. return 0;
  142. }
  143. if (!soc->ops->cfg_ops ||
  144. !soc->ops->cfg_ops->is_rx_fwd_disabled)
  145. return 0;
  146. return soc->ops->cfg_ops->is_rx_fwd_disabled(vdev);
  147. }
  148. /**
  149. * cdp_cfg_tx_set_is_mgmt_over_wmi_enabled() - mgmt tx over wmi enable/disable
  150. * @soc: data path soc handle
  151. * @value: feature enable or disable
  152. *
  153. * Enable or disable management packet TX over WMI feature
  154. *
  155. * return None
  156. */
  157. static inline void
  158. cdp_cfg_tx_set_is_mgmt_over_wmi_enabled(ol_txrx_soc_handle soc,
  159. uint8_t value)
  160. {
  161. if (!soc || !soc->ops) {
  162. dp_cdp_debug("invalid instance");
  163. QDF_BUG(0);
  164. return;
  165. }
  166. if (!soc->ops->cfg_ops ||
  167. !soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled)
  168. return;
  169. soc->ops->cfg_ops->tx_set_is_mgmt_over_wmi_enabled(value);
  170. }
  171. /**
  172. * cdp_cfg_is_high_latency() - query data path is in high or low latency
  173. * @soc: data path soc handle
  174. * @cfg_pdev: data path device instance
  175. *
  176. * query data path is in high or low latency
  177. *
  178. * return 1 high latency data path, usb or sdio
  179. * 0 low latency data path
  180. */
  181. static inline int
  182. cdp_cfg_is_high_latency(ol_txrx_soc_handle soc, struct cdp_cfg *cfg_pdev)
  183. {
  184. if (!soc || !soc->ops) {
  185. dp_cdp_debug("invalid instance");
  186. QDF_BUG(0);
  187. return 0;
  188. }
  189. if (!soc->ops->cfg_ops ||
  190. !soc->ops->cfg_ops->is_high_latency)
  191. return 0;
  192. return soc->ops->cfg_ops->is_high_latency(cfg_pdev);
  193. }
  194. /**
  195. * cdp_cfg_set_flow_control_parameters() - set flow control params
  196. * @soc: data path soc handle
  197. * @cfg_pdev: dp config module instance
  198. * @param: parameters should set
  199. *
  200. * set flow control params
  201. *
  202. * return None
  203. */
  204. static inline void
  205. cdp_cfg_set_flow_control_parameters(ol_txrx_soc_handle soc,
  206. struct cdp_cfg *cfg_pdev, void *param)
  207. {
  208. if (!soc || !soc->ops) {
  209. dp_cdp_debug("invalid instance");
  210. QDF_BUG(0);
  211. return;
  212. }
  213. if (!soc->ops->cfg_ops ||
  214. !soc->ops->cfg_ops->set_flow_control_parameters)
  215. return;
  216. soc->ops->cfg_ops->set_flow_control_parameters(cfg_pdev,
  217. param);
  218. }
  219. /**
  220. * cdp_cfg_set_flow_steering - Set Rx flow steering config based on CFG ini
  221. * config.
  222. * @soc: data path soc handle
  223. * @cfg_pdev: handle to the physical device
  224. * @val: 0 - disable, 1 - enable
  225. *
  226. * Return: None
  227. */
  228. static inline void cdp_cfg_set_flow_steering(ol_txrx_soc_handle soc,
  229. struct cdp_cfg *cfg_pdev, uint8_t val)
  230. {
  231. if (!soc || !soc->ops) {
  232. dp_cdp_debug("invalid instance");
  233. QDF_BUG(0);
  234. return;
  235. }
  236. if (!soc->ops->cfg_ops ||
  237. !soc->ops->cfg_ops->set_flow_steering)
  238. return;
  239. soc->ops->cfg_ops->set_flow_steering(cfg_pdev, val);
  240. }
  241. static inline void cdp_cfg_get_max_peer_id(ol_txrx_soc_handle soc,
  242. struct cdp_cfg *cfg_pdev)
  243. {
  244. }
  245. /**
  246. * cdp_cfg_set_ptp_rx_opt_enabled() - enable/disable ptp rx timestamping
  247. * @soc: data path soc handle
  248. * @cfg_pdev: data path device instance
  249. * @val: enable or disable packet log
  250. *
  251. * ptp rx timestamping enable or disable
  252. *
  253. * return NONE
  254. */
  255. static inline void
  256. cdp_cfg_set_ptp_rx_opt_enabled(ol_txrx_soc_handle soc,
  257. struct cdp_cfg *cfg_pdev, uint8_t val)
  258. {
  259. if (!soc || !soc->ops) {
  260. dp_cdp_debug("invalid instance");
  261. QDF_BUG(0);
  262. return;
  263. }
  264. if (!soc->ops->cfg_ops ||
  265. !soc->ops->cfg_ops->set_ptp_rx_opt_enabled)
  266. return;
  267. soc->ops->cfg_ops->set_ptp_rx_opt_enabled(cfg_pdev, val);
  268. }
  269. /**
  270. * cdp_cfg_set_new_htt_msg_format() - set htt h2t msg feature
  271. * @soc: datapath soc handle
  272. * @val: enable or disable new htt h2t msg feature
  273. *
  274. * Enable whether htt h2t message length includes htc header length
  275. *
  276. * return NONE
  277. */
  278. static inline void
  279. cdp_cfg_set_new_htt_msg_format(ol_txrx_soc_handle soc,
  280. uint8_t val)
  281. {
  282. if (!soc || !soc->ops) {
  283. dp_cdp_debug("invalid instance");
  284. return;
  285. }
  286. if (!soc->ops->cfg_ops ||
  287. !soc->ops->cfg_ops->set_new_htt_msg_format)
  288. return;
  289. soc->ops->cfg_ops->set_new_htt_msg_format(val);
  290. }
  291. /**
  292. * cdp_cfg_set_peer_unmap_conf_support() - set peer unmap conf feature
  293. * @soc: datapath soc handle
  294. * @val: enable or disable peer unmap conf feature
  295. *
  296. * Set if peer unmap confirmation feature is supported by both FW and in INI
  297. *
  298. * return NONE
  299. */
  300. static inline void
  301. cdp_cfg_set_peer_unmap_conf_support(ol_txrx_soc_handle soc, bool val)
  302. {
  303. if (!soc || !soc->ops) {
  304. dp_cdp_debug("invalid instance");
  305. QDF_BUG(0);
  306. return;
  307. }
  308. if (!soc->ops->cfg_ops ||
  309. !soc->ops->cfg_ops->set_peer_unmap_conf_support)
  310. return;
  311. soc->ops->cfg_ops->set_peer_unmap_conf_support(val);
  312. }
  313. /**
  314. * cdp_cfg_get_peer_unmap_conf_support() - check peer unmap conf feature
  315. * @soc: datapath soc handle
  316. *
  317. * Check if peer unmap confirmation feature is enabled
  318. *
  319. * return true is peer unmap confirmation feature is enabled else false
  320. */
  321. static inline bool
  322. cdp_cfg_get_peer_unmap_conf_support(ol_txrx_soc_handle soc)
  323. {
  324. if (!soc || !soc->ops) {
  325. dp_cdp_debug("invalid instance");
  326. QDF_BUG(0);
  327. return false;
  328. }
  329. if (!soc->ops->cfg_ops ||
  330. !soc->ops->cfg_ops->get_peer_unmap_conf_support)
  331. return false;
  332. return soc->ops->cfg_ops->get_peer_unmap_conf_support();
  333. }
  334. static inline void
  335. cdp_cfg_set_tx_compl_tsf64(ol_txrx_soc_handle soc,
  336. uint8_t val)
  337. {
  338. if (!soc || !soc->ops) {
  339. dp_debug("invalid instance");
  340. return;
  341. }
  342. if (!soc->ops->cfg_ops ||
  343. !soc->ops->cfg_ops->set_tx_compl_tsf64)
  344. return;
  345. soc->ops->cfg_ops->set_tx_compl_tsf64(val);
  346. }
  347. static inline bool
  348. cdp_cfg_get_tx_compl_tsf64(ol_txrx_soc_handle soc)
  349. {
  350. if (!soc || !soc->ops) {
  351. dp_debug("invalid instance");
  352. return false;
  353. }
  354. if (!soc->ops->cfg_ops ||
  355. !soc->ops->cfg_ops->get_tx_compl_tsf64)
  356. return false;
  357. return soc->ops->cfg_ops->get_tx_compl_tsf64();
  358. }
  359. #endif /* _CDP_TXRX_CFG_H_ */