cdp_txrx_ipa.h 17 KB

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