cdp_txrx_ipa.h 17 KB

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