cdp_txrx_ipa.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. /*
  2. * Copyright (c) 2016-2018 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_ipa.h
  28. * @brief Define the host data path IP Acceleraor API functions
  29. */
  30. #ifndef _CDP_TXRX_IPA_H_
  31. #define _CDP_TXRX_IPA_H_
  32. #ifdef IPA_OFFLOAD
  33. #ifdef CONFIG_IPA_WDI_UNIFIED_API
  34. #include <qdf_ipa_wdi3.h>
  35. #else
  36. #include <qdf_ipa.h>
  37. #endif
  38. #include <cdp_txrx_cmn.h>
  39. #include "cdp_txrx_handle.h"
  40. /**
  41. * cdp_ipa_get_resource() - Get allocated WLAN resources for IPA data path
  42. * @soc - data path soc handle
  43. * @pdev - device instance pointer
  44. *
  45. * Get allocated WLAN resources for IPA data path
  46. *
  47. * return QDF_STATUS_SUCCESS
  48. */
  49. static inline QDF_STATUS
  50. cdp_ipa_get_resource(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  51. {
  52. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  53. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  54. "%s invalid instance", __func__);
  55. return QDF_STATUS_E_FAILURE;
  56. }
  57. if (soc->ops->ipa_ops->ipa_get_resource)
  58. return soc->ops->ipa_ops->ipa_get_resource(pdev);
  59. return QDF_STATUS_SUCCESS;
  60. }
  61. /**
  62. * cdp_ipa_set_doorbell_paddr() - give IPA db paddr to FW
  63. * @soc - data path soc handle
  64. * @pdev - device instance pointer
  65. *
  66. * give IPA db paddr to FW
  67. *
  68. * return QDF_STATUS_SUCCESS
  69. */
  70. static inline QDF_STATUS
  71. cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  72. {
  73. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  74. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  75. "%s invalid instance", __func__);
  76. return QDF_STATUS_E_FAILURE;
  77. }
  78. if (soc->ops->ipa_ops->ipa_set_doorbell_paddr)
  79. return soc->ops->ipa_ops->ipa_set_doorbell_paddr(pdev);
  80. return QDF_STATUS_SUCCESS;
  81. }
  82. /**
  83. * cdp_ipa_set_active() - activate/de-ctivate IPA offload path
  84. * @soc - data path soc handle
  85. * @pdev - device instance pointer
  86. * @uc_active - activate or de-activate
  87. * @is_tx - toggle tx or rx data path
  88. *
  89. * activate/de-ctivate IPA offload path
  90. *
  91. * return QDF_STATUS_SUCCESS
  92. */
  93. static inline QDF_STATUS
  94. cdp_ipa_set_active(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  95. bool uc_active, bool is_tx)
  96. {
  97. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  98. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  99. "%s invalid instance", __func__);
  100. return QDF_STATUS_E_FAILURE;
  101. }
  102. if (soc->ops->ipa_ops->ipa_set_active)
  103. return soc->ops->ipa_ops->ipa_set_active(pdev, uc_active,
  104. is_tx);
  105. return QDF_STATUS_SUCCESS;
  106. }
  107. /**
  108. * cdp_ipa_op_response() - event handler from FW
  109. * @soc - data path soc handle
  110. * @pdev - device instance pointer
  111. * @op_msg - event contents from firmware
  112. *
  113. * event handler from FW
  114. *
  115. * return QDF_STATUS_SUCCESS
  116. */
  117. static inline QDF_STATUS
  118. cdp_ipa_op_response(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  119. uint8_t *op_msg)
  120. {
  121. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  122. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  123. "%s invalid instance", __func__);
  124. return QDF_STATUS_E_FAILURE;
  125. }
  126. if (soc->ops->ipa_ops->ipa_op_response)
  127. return soc->ops->ipa_ops->ipa_op_response(pdev, op_msg);
  128. return QDF_STATUS_SUCCESS;
  129. }
  130. /**
  131. * cdp_ipa_register_op_cb() - register event handler function pointer
  132. * @soc - data path soc handle
  133. * @pdev - device instance pointer
  134. * @op_cb - event handler callback function pointer
  135. * @usr_ctxt - user context to registered
  136. *
  137. * register event handler function pointer
  138. *
  139. * return QDF_STATUS_SUCCESS
  140. */
  141. static inline QDF_STATUS
  142. cdp_ipa_register_op_cb(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  143. ipa_uc_op_cb_type op_cb, void *usr_ctxt)
  144. {
  145. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  146. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  147. "%s invalid instance", __func__);
  148. return QDF_STATUS_E_FAILURE;
  149. }
  150. if (soc->ops->ipa_ops->ipa_register_op_cb)
  151. return soc->ops->ipa_ops->ipa_register_op_cb(pdev, op_cb,
  152. usr_ctxt);
  153. return QDF_STATUS_SUCCESS;
  154. }
  155. /**
  156. * cdp_ipa_get_stat() - get IPA data path stats from FW
  157. * @soc - data path soc handle
  158. * @pdev - device instance pointer
  159. *
  160. * get IPA data path stats from FW async
  161. *
  162. * return QDF_STATUS_SUCCESS
  163. */
  164. static inline QDF_STATUS
  165. cdp_ipa_get_stat(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  166. {
  167. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  168. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  169. "%s invalid instance", __func__);
  170. return QDF_STATUS_E_FAILURE;
  171. }
  172. if (soc->ops->ipa_ops->ipa_get_stat)
  173. return soc->ops->ipa_ops->ipa_get_stat(pdev);
  174. return QDF_STATUS_SUCCESS;
  175. }
  176. /**
  177. * cdp_tx_send_ipa_data_frame() - send IPA data frame
  178. * @vdev: vdev
  179. * @skb: skb
  180. *
  181. * Return: skb/ NULL is for success
  182. */
  183. static inline qdf_nbuf_t cdp_ipa_tx_send_data_frame(ol_txrx_soc_handle soc,
  184. struct cdp_vdev *vdev, qdf_nbuf_t skb)
  185. {
  186. if (!soc || !soc->ops || !soc->ops->ipa_ops || !vdev) {
  187. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  188. "%s invalid instance", __func__);
  189. return skb;
  190. }
  191. if (soc->ops->ipa_ops->ipa_tx_data_frame)
  192. return soc->ops->ipa_ops->ipa_tx_data_frame(vdev, skb);
  193. return skb;
  194. }
  195. /**
  196. * cdp_ipa_set_uc_tx_partition_base() - set tx packet partition base
  197. * @pdev: physical device instance
  198. * @value: partition base value
  199. *
  200. * Return: QDF_STATUS
  201. */
  202. static inline QDF_STATUS
  203. cdp_ipa_set_uc_tx_partition_base(ol_txrx_soc_handle soc,
  204. struct cdp_cfg *cfg_pdev, uint32_t value)
  205. {
  206. if (!soc || !soc->ops || !soc->ops->ipa_ops || !cfg_pdev) {
  207. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  208. "%s invalid instance", __func__);
  209. return QDF_STATUS_E_FAILURE;
  210. }
  211. if (soc->ops->ipa_ops->ipa_set_uc_tx_partition_base)
  212. soc->ops->ipa_ops->ipa_set_uc_tx_partition_base(cfg_pdev,
  213. value);
  214. return QDF_STATUS_SUCCESS;
  215. }
  216. #ifdef FEATURE_METERING
  217. /**
  218. * cdp_ipa_uc_get_share_stats() - get Tx/Rx byte stats from FW
  219. * @pdev: physical device instance
  220. * @value: reset stats
  221. *
  222. * Return: QDF_STATUS
  223. */
  224. static inline QDF_STATUS
  225. cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc,
  226. struct cdp_pdev *pdev, uint8_t value)
  227. {
  228. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  229. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  230. "%s invalid instance", __func__);
  231. return QDF_STATUS_E_FAILURE;
  232. }
  233. if (soc->ops->ipa_ops->ipa_uc_get_share_stats)
  234. return soc->ops->ipa_ops->ipa_uc_get_share_stats(pdev,
  235. value);
  236. return QDF_STATUS_SUCCESS;
  237. }
  238. /**
  239. * cdp_ipa_uc_set_quota() - set quota limit to FW
  240. * @pdev: physical device instance
  241. * @value: quota limit bytes
  242. *
  243. * Return: QDF_STATUS
  244. */
  245. static inline QDF_STATUS
  246. cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc,
  247. struct cdp_pdev *pdev, uint64_t value)
  248. {
  249. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  250. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  251. "%s invalid instance", __func__);
  252. return QDF_STATUS_E_FAILURE;
  253. }
  254. if (soc->ops->ipa_ops->ipa_uc_set_quota)
  255. return soc->ops->ipa_ops->ipa_uc_set_quota(pdev,
  256. value);
  257. return QDF_STATUS_SUCCESS;
  258. }
  259. #endif
  260. /**
  261. * cdp_ipa_enable_autonomy() - Enable autonomy RX data path
  262. * @soc: data path soc handle
  263. * @pdev: handle to the device instance
  264. *
  265. * IPA Data path is enabled and resumed.
  266. * All autonomy data path elements are ready to deliver packet
  267. * All RX packet should routed to IPA_REO ring, then IPA can receive packet
  268. * from WLAN
  269. *
  270. * Return: QDF_STATUS
  271. */
  272. static inline QDF_STATUS
  273. cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  274. {
  275. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  276. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  277. "%s invalid instance", __func__);
  278. return QDF_STATUS_E_FAILURE;
  279. }
  280. if (soc->ops->ipa_ops->ipa_enable_autonomy)
  281. return soc->ops->ipa_ops->ipa_enable_autonomy(pdev);
  282. return QDF_STATUS_SUCCESS;
  283. }
  284. /**
  285. * cdp_ipa_disable_autonomy() - Disable autonomy RX data path
  286. * @soc: data path soc handle
  287. * @pdev: handle to the device instance
  288. *
  289. * IPA Data path is enabled and resumed.
  290. * All autonomy datapath elements are ready to deliver packet
  291. * All RX packet should routed to IPA_REO ring, then IPA can receive packet
  292. * from WLAN
  293. *
  294. * Return: QDF_STATUS
  295. */
  296. static inline QDF_STATUS
  297. cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  298. {
  299. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  300. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  301. "%s invalid instance", __func__);
  302. return QDF_STATUS_E_FAILURE;
  303. }
  304. if (soc->ops->ipa_ops->ipa_enable_autonomy)
  305. return soc->ops->ipa_ops->ipa_disable_autonomy(pdev);
  306. return QDF_STATUS_SUCCESS;
  307. }
  308. #ifdef CONFIG_IPA_WDI_UNIFIED_API
  309. /**
  310. * cdp_ipa_setup() - Setup and connect IPA pipes
  311. * @soc: data path soc handle
  312. * @pdev: handle to the device instance
  313. * @ipa_i2w_cb: IPA to WLAN callback
  314. * @ipa_w2i_cb: WLAN to IPA callback
  315. * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
  316. * @ipa_desc_size: IPA descriptor size
  317. * @ipa_priv: handle to the HTT instance
  318. * @is_rm_enabled: Is IPA RM enabled or not
  319. * @tx_pipe_handle: pointer to Tx pipe handle
  320. * @rx_pipe_handle: pointer to Rx pipe handle
  321. * @is_smmu_enabled: Is SMMU enabled or not
  322. * @sys_in: parameters to setup sys pipe in mcc mode
  323. *
  324. * Return: QDF_STATUS
  325. */
  326. static inline QDF_STATUS
  327. cdp_ipa_setup(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, void *ipa_i2w_cb,
  328. void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
  329. uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
  330. uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle,
  331. bool is_smmu_enabled, qdf_ipa_sys_connect_params_t *sys_in)
  332. {
  333. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  334. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  335. "%s invalid instance", __func__);
  336. return QDF_STATUS_E_FAILURE;
  337. }
  338. if (soc->ops->ipa_ops->ipa_setup)
  339. return soc->ops->ipa_ops->ipa_setup(pdev, ipa_i2w_cb,
  340. ipa_w2i_cb,
  341. ipa_wdi_meter_notifier_cb,
  342. ipa_desc_size, ipa_priv,
  343. is_rm_enabled,
  344. tx_pipe_handle,
  345. rx_pipe_handle,
  346. is_smmu_enabled,
  347. sys_in);
  348. return QDF_STATUS_SUCCESS;
  349. }
  350. #else /* CONFIG_IPA_WDI_UNIFIED_API */
  351. /**
  352. * cdp_ipa_setup() - Setup and connect IPA pipes
  353. * @soc: data path soc handle
  354. * @pdev: handle to the device instance
  355. * @ipa_i2w_cb: IPA to WLAN callback
  356. * @ipa_w2i_cb: WLAN to IPA callback
  357. * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
  358. * @ipa_desc_size: IPA descriptor size
  359. * @ipa_priv: handle to the HTT instance
  360. * @is_rm_enabled: Is IPA RM enabled or not
  361. * @tx_pipe_handle: pointer to Tx pipe handle
  362. * @rx_pipe_handle: pointer to Rx pipe handle
  363. *
  364. * Return: QDF_STATUS
  365. */
  366. static inline QDF_STATUS
  367. cdp_ipa_setup(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, void *ipa_i2w_cb,
  368. void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
  369. uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
  370. uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle)
  371. {
  372. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  373. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  374. "%s invalid instance", __func__);
  375. return QDF_STATUS_E_FAILURE;
  376. }
  377. if (soc->ops->ipa_ops->ipa_setup)
  378. return soc->ops->ipa_ops->ipa_setup(pdev, ipa_i2w_cb,
  379. ipa_w2i_cb,
  380. ipa_wdi_meter_notifier_cb,
  381. ipa_desc_size, ipa_priv,
  382. is_rm_enabled,
  383. tx_pipe_handle,
  384. rx_pipe_handle);
  385. return QDF_STATUS_SUCCESS;
  386. }
  387. #endif /* CONFIG_IPA_WDI_UNIFIED_API */
  388. /**
  389. * cdp_ipa_cleanup() - Disconnect IPA pipes
  390. * @soc: data path soc handle
  391. * @tx_pipe_handle: Tx pipe handle
  392. * @rx_pipe_handle: Rx pipe handle
  393. *
  394. * Return: QDF_STATUS
  395. */
  396. static inline QDF_STATUS
  397. cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint32_t tx_pipe_handle,
  398. uint32_t rx_pipe_handle)
  399. {
  400. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  401. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  402. "%s invalid instance", __func__);
  403. return QDF_STATUS_E_FAILURE;
  404. }
  405. if (soc->ops->ipa_ops->ipa_cleanup)
  406. return soc->ops->ipa_ops->ipa_cleanup(tx_pipe_handle,
  407. rx_pipe_handle);
  408. return QDF_STATUS_SUCCESS;
  409. }
  410. /**
  411. * cdp_ipa_setup_iface() - Setup IPA header and register interface
  412. * @soc: data path soc handle
  413. * @ifname: Interface name
  414. * @mac_addr: Interface MAC address
  415. * @prod_client: IPA prod client type
  416. * @cons_client: IPA cons client type
  417. * @session_id: Session ID
  418. * @is_ipv6_enabled: Is IPV6 enabled or not
  419. *
  420. * Return: QDF_STATUS
  421. */
  422. static inline QDF_STATUS
  423. cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr,
  424. qdf_ipa_client_type_t prod_client,
  425. qdf_ipa_client_type_t cons_client,
  426. uint8_t session_id, bool is_ipv6_enabled)
  427. {
  428. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  429. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  430. "%s invalid instance", __func__);
  431. return QDF_STATUS_E_FAILURE;
  432. }
  433. if (soc->ops->ipa_ops->ipa_setup_iface)
  434. return soc->ops->ipa_ops->ipa_setup_iface(ifname, mac_addr,
  435. prod_client,
  436. cons_client,
  437. session_id,
  438. is_ipv6_enabled);
  439. return QDF_STATUS_SUCCESS;
  440. }
  441. /**
  442. * cdp_ipa_cleanup_iface() - Cleanup IPA header and deregister interface
  443. * @soc: data path soc handle
  444. * @ifname: Interface name
  445. * @is_ipv6_enabled: Is IPV6 enabled or not
  446. *
  447. * Return: QDF_STATUS
  448. */
  449. static inline QDF_STATUS
  450. cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc, char *ifname,
  451. bool is_ipv6_enabled)
  452. {
  453. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  454. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  455. "%s invalid instance", __func__);
  456. return QDF_STATUS_E_FAILURE;
  457. }
  458. if (soc->ops->ipa_ops->ipa_cleanup_iface)
  459. return soc->ops->ipa_ops->ipa_cleanup_iface(ifname,
  460. is_ipv6_enabled);
  461. return QDF_STATUS_SUCCESS;
  462. }
  463. /**
  464. * cdp_ipa_uc_enable_pipes() - Enable and resume traffic on Tx/Rx pipes
  465. * @soc: data path soc handle
  466. * @pdev: handle to the device instance
  467. *
  468. * Return: QDF_STATUS
  469. */
  470. static inline QDF_STATUS
  471. cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  472. {
  473. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  474. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  475. "%s invalid instance", __func__);
  476. return QDF_STATUS_E_FAILURE;
  477. }
  478. if (soc->ops->ipa_ops->ipa_enable_pipes)
  479. return soc->ops->ipa_ops->ipa_enable_pipes(pdev);
  480. return QDF_STATUS_SUCCESS;
  481. }
  482. /**
  483. * cdp_ipa_uc_disable_pipes() - Suspend traffic and disable Tx/Rx pipes
  484. * @soc: data path soc handle
  485. * @pdev: handle to the device instance
  486. *
  487. * Return: QDF_STATUS
  488. */
  489. static inline QDF_STATUS
  490. cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  491. {
  492. if (!soc || !soc->ops || !soc->ops->ipa_ops || !pdev) {
  493. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  494. "%s invalid instance", __func__);
  495. return QDF_STATUS_E_FAILURE;
  496. }
  497. if (soc->ops->ipa_ops->ipa_disable_pipes)
  498. return soc->ops->ipa_ops->ipa_disable_pipes(pdev);
  499. return QDF_STATUS_SUCCESS;
  500. }
  501. /**
  502. * cdp_ipa_set_perf_level() - Set IPA clock bandwidth based on data rates
  503. * @soc: data path soc handle
  504. * @client: WLAN Client ID
  505. * @max_supported_bw_mbps: Maximum bandwidth needed (in Mbps)
  506. *
  507. * Return: 0 on success, negative errno on error
  508. */
  509. static inline QDF_STATUS
  510. cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client,
  511. uint32_t max_supported_bw_mbps)
  512. {
  513. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  514. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  515. "%s invalid instance", __func__);
  516. return QDF_STATUS_E_FAILURE;
  517. }
  518. if (soc->ops->ipa_ops->ipa_set_perf_level)
  519. return soc->ops->ipa_ops->ipa_set_perf_level(client,
  520. max_supported_bw_mbps);
  521. return QDF_STATUS_SUCCESS;
  522. }
  523. #endif /* IPA_OFFLOAD */
  524. #endif /* _CDP_TXRX_IPA_H_ */