cdp_txrx_ipa.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. /*
  2. * Copyright (c) 2016-2020 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_deregister_op_cb() - deregister event handler function pointer
  148. * @soc - data path soc handle
  149. * @pdev_id - device instance id
  150. *
  151. * Deregister event handler function pointer from pdev
  152. *
  153. * return QDF_STATUS_SUCCESS
  154. */
  155. static inline
  156. void cdp_ipa_deregister_op_cb(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;
  162. }
  163. if (soc->ops->ipa_ops->ipa_deregister_op_cb)
  164. soc->ops->ipa_ops->ipa_deregister_op_cb(soc, pdev_id);
  165. }
  166. /**
  167. * cdp_ipa_get_stat() - get IPA data path stats from FW
  168. * @soc - data path soc handle
  169. * @pdev_id - device instance id
  170. *
  171. * get IPA data path stats from FW async
  172. *
  173. * return QDF_STATUS_SUCCESS
  174. */
  175. static inline QDF_STATUS
  176. cdp_ipa_get_stat(ol_txrx_soc_handle soc, uint8_t pdev_id)
  177. {
  178. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  179. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  180. "%s invalid instance", __func__);
  181. return QDF_STATUS_E_FAILURE;
  182. }
  183. if (soc->ops->ipa_ops->ipa_get_stat)
  184. return soc->ops->ipa_ops->ipa_get_stat(soc, pdev_id);
  185. return QDF_STATUS_SUCCESS;
  186. }
  187. /**
  188. * cdp_tx_send_ipa_data_frame() - send IPA data frame
  189. * @soc - data path soc handle
  190. * @vdev_id: vdev id
  191. * @skb: skb
  192. *
  193. * Return: skb/ NULL is for success
  194. */
  195. static inline qdf_nbuf_t cdp_ipa_tx_send_data_frame(ol_txrx_soc_handle soc,
  196. uint8_t vdev_id,
  197. qdf_nbuf_t skb)
  198. {
  199. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  200. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  201. "%s invalid instance", __func__);
  202. return skb;
  203. }
  204. if (soc->ops->ipa_ops->ipa_tx_data_frame)
  205. return soc->ops->ipa_ops->ipa_tx_data_frame(soc, vdev_id, skb);
  206. return skb;
  207. }
  208. /**
  209. * cdp_ipa_set_uc_tx_partition_base() - set tx packet partition base
  210. * @soc - data path soc handle
  211. * @cfg_pdev: physical device instance config
  212. * @value: partition base value
  213. *
  214. * Return: QDF_STATUS
  215. */
  216. static inline QDF_STATUS
  217. cdp_ipa_set_uc_tx_partition_base(ol_txrx_soc_handle soc,
  218. struct cdp_cfg *cfg_pdev, uint32_t value)
  219. {
  220. if (!soc || !soc->ops || !soc->ops->ipa_ops || !cfg_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_set_uc_tx_partition_base)
  226. soc->ops->ipa_ops->ipa_set_uc_tx_partition_base(cfg_pdev,
  227. value);
  228. return QDF_STATUS_SUCCESS;
  229. }
  230. #ifdef FEATURE_METERING
  231. /**
  232. * cdp_ipa_uc_get_share_stats() - get Tx/Rx byte stats from FW
  233. * @soc - data path soc handle
  234. * @pdev_id: physical device instance number
  235. * @value: reset stats
  236. *
  237. * Return: QDF_STATUS
  238. */
  239. static inline QDF_STATUS
  240. cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  241. uint8_t value)
  242. {
  243. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  244. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  245. "%s invalid instance", __func__);
  246. return QDF_STATUS_E_FAILURE;
  247. }
  248. if (soc->ops->ipa_ops->ipa_uc_get_share_stats)
  249. return soc->ops->ipa_ops->ipa_uc_get_share_stats(soc, pdev_id,
  250. value);
  251. return QDF_STATUS_SUCCESS;
  252. }
  253. /**
  254. * cdp_ipa_uc_set_quota() - set quota limit to FW
  255. * @soc - data path soc handle
  256. * @pdev_id: physical device instance number
  257. * @value: quota limit bytes
  258. *
  259. * Return: QDF_STATUS
  260. */
  261. static inline QDF_STATUS
  262. cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc, uint8_t pdev_id, uint64_t value)
  263. {
  264. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  265. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  266. "%s invalid instance", __func__);
  267. return QDF_STATUS_E_FAILURE;
  268. }
  269. if (soc->ops->ipa_ops->ipa_uc_set_quota)
  270. return soc->ops->ipa_ops->ipa_uc_set_quota(soc, pdev_id, value);
  271. return QDF_STATUS_SUCCESS;
  272. }
  273. #endif
  274. /**
  275. * cdp_ipa_enable_autonomy() - Enable autonomy RX data path
  276. * @soc: data path soc handle
  277. * @pdev_id: physical device instance number
  278. *
  279. * IPA Data path is enabled and resumed.
  280. * All autonomy data path elements are ready to deliver packet
  281. * All RX packet should routed to IPA_REO ring, then IPA can receive packet
  282. * from WLAN
  283. *
  284. * Return: QDF_STATUS
  285. */
  286. static inline QDF_STATUS
  287. cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
  288. {
  289. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  290. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  291. "%s invalid instance", __func__);
  292. return QDF_STATUS_E_FAILURE;
  293. }
  294. if (soc->ops->ipa_ops->ipa_enable_autonomy)
  295. return soc->ops->ipa_ops->ipa_enable_autonomy(soc, pdev_id);
  296. return QDF_STATUS_SUCCESS;
  297. }
  298. /**
  299. * cdp_ipa_disable_autonomy() - Disable autonomy RX data path
  300. * @soc: data path soc handle
  301. * @pdev_id: physical device instance number
  302. *
  303. * IPA Data path is enabled and resumed.
  304. * All autonomy datapath elements are ready to deliver packet
  305. * All RX packet should routed to IPA_REO ring, then IPA can receive packet
  306. * from WLAN
  307. *
  308. * Return: QDF_STATUS
  309. */
  310. static inline QDF_STATUS
  311. cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
  312. {
  313. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  314. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  315. "%s invalid instance", __func__);
  316. return QDF_STATUS_E_FAILURE;
  317. }
  318. if (soc->ops->ipa_ops->ipa_disable_autonomy)
  319. return soc->ops->ipa_ops->ipa_disable_autonomy(soc, pdev_id);
  320. return QDF_STATUS_SUCCESS;
  321. }
  322. #ifdef CONFIG_IPA_WDI_UNIFIED_API
  323. /**
  324. * cdp_ipa_setup() - Setup and connect IPA pipes
  325. * @soc: data path soc handle
  326. * @pdev_id: handle to the device instance number
  327. * @ipa_i2w_cb: IPA to WLAN callback
  328. * @ipa_w2i_cb: WLAN to IPA callback
  329. * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
  330. * @ipa_desc_size: IPA descriptor size
  331. * @ipa_priv: handle to the HTT instance
  332. * @is_rm_enabled: Is IPA RM enabled or not
  333. * @tx_pipe_handle: pointer to Tx pipe handle
  334. * @rx_pipe_handle: pointer to Rx pipe handle
  335. * @is_smmu_enabled: Is SMMU enabled or not
  336. * @sys_in: parameters to setup sys pipe in mcc mode
  337. * @over_gsi: Is IPA using GSI
  338. *
  339. * Return: QDF_STATUS
  340. */
  341. static inline QDF_STATUS
  342. cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
  343. void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
  344. uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
  345. uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle,
  346. bool is_smmu_enabled, qdf_ipa_sys_connect_params_t *sys_in,
  347. bool over_gsi)
  348. {
  349. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  350. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  351. "%s invalid instance", __func__);
  352. return QDF_STATUS_E_FAILURE;
  353. }
  354. if (soc->ops->ipa_ops->ipa_setup)
  355. return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
  356. ipa_w2i_cb,
  357. ipa_wdi_meter_notifier_cb,
  358. ipa_desc_size, ipa_priv,
  359. is_rm_enabled,
  360. tx_pipe_handle,
  361. rx_pipe_handle,
  362. is_smmu_enabled,
  363. sys_in, over_gsi);
  364. return QDF_STATUS_SUCCESS;
  365. }
  366. #else /* CONFIG_IPA_WDI_UNIFIED_API */
  367. /**
  368. * cdp_ipa_setup() - Setup and connect IPA pipes
  369. * @soc: data path soc handle
  370. * @pdev_id: handle to the device instance number
  371. * @ipa_i2w_cb: IPA to WLAN callback
  372. * @ipa_w2i_cb: WLAN to IPA callback
  373. * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
  374. * @ipa_desc_size: IPA descriptor size
  375. * @ipa_priv: handle to the HTT instance
  376. * @is_rm_enabled: Is IPA RM enabled or not
  377. * @tx_pipe_handle: pointer to Tx pipe handle
  378. * @rx_pipe_handle: pointer to Rx pipe handle
  379. *
  380. * Return: QDF_STATUS
  381. */
  382. static inline QDF_STATUS
  383. cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
  384. void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
  385. uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
  386. uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle)
  387. {
  388. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  389. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  390. "%s invalid instance", __func__);
  391. return QDF_STATUS_E_FAILURE;
  392. }
  393. if (soc->ops->ipa_ops->ipa_setup)
  394. return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
  395. ipa_w2i_cb,
  396. ipa_wdi_meter_notifier_cb,
  397. ipa_desc_size, ipa_priv,
  398. is_rm_enabled,
  399. tx_pipe_handle,
  400. rx_pipe_handle);
  401. return QDF_STATUS_SUCCESS;
  402. }
  403. #endif /* CONFIG_IPA_WDI_UNIFIED_API */
  404. /**
  405. * cdp_ipa_cleanup() - Disconnect IPA pipes
  406. * @soc: data path soc handle
  407. * @pdev_id: handle to the device instance number
  408. * @tx_pipe_handle: Tx pipe handle
  409. * @rx_pipe_handle: Rx pipe handle
  410. *
  411. * Return: QDF_STATUS
  412. */
  413. static inline QDF_STATUS
  414. cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint8_t pdev_id,
  415. uint32_t tx_pipe_handle, uint32_t rx_pipe_handle)
  416. {
  417. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  418. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  419. "%s invalid instance", __func__);
  420. return QDF_STATUS_E_FAILURE;
  421. }
  422. if (soc->ops->ipa_ops->ipa_cleanup)
  423. return soc->ops->ipa_ops->ipa_cleanup(soc, pdev_id,
  424. tx_pipe_handle,
  425. rx_pipe_handle);
  426. return QDF_STATUS_SUCCESS;
  427. }
  428. /**
  429. * cdp_ipa_setup_iface() - Setup IPA header and register interface
  430. * @soc: data path soc handle
  431. * @ifname: Interface name
  432. * @mac_addr: Interface MAC address
  433. * @prod_client: IPA prod client type
  434. * @cons_client: IPA cons client type
  435. * @session_id: Session ID
  436. * @is_ipv6_enabled: Is IPV6 enabled or not
  437. *
  438. * Return: QDF_STATUS
  439. */
  440. static inline QDF_STATUS
  441. cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr,
  442. qdf_ipa_client_type_t prod_client,
  443. qdf_ipa_client_type_t cons_client,
  444. uint8_t session_id, bool is_ipv6_enabled)
  445. {
  446. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  447. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  448. "%s invalid instance", __func__);
  449. return QDF_STATUS_E_FAILURE;
  450. }
  451. if (soc->ops->ipa_ops->ipa_setup_iface)
  452. return soc->ops->ipa_ops->ipa_setup_iface(ifname, mac_addr,
  453. prod_client,
  454. cons_client,
  455. session_id,
  456. is_ipv6_enabled);
  457. return QDF_STATUS_SUCCESS;
  458. }
  459. /**
  460. * cdp_ipa_cleanup_iface() - Cleanup IPA header and deregister interface
  461. * @soc: data path soc handle
  462. * @ifname: Interface name
  463. * @is_ipv6_enabled: Is IPV6 enabled or not
  464. *
  465. * Return: QDF_STATUS
  466. */
  467. static inline QDF_STATUS
  468. cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc, char *ifname,
  469. bool is_ipv6_enabled)
  470. {
  471. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  472. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  473. "%s invalid instance", __func__);
  474. return QDF_STATUS_E_FAILURE;
  475. }
  476. if (soc->ops->ipa_ops->ipa_cleanup_iface)
  477. return soc->ops->ipa_ops->ipa_cleanup_iface(ifname,
  478. is_ipv6_enabled);
  479. return QDF_STATUS_SUCCESS;
  480. }
  481. /**
  482. * cdp_ipa_uc_enable_pipes() - Enable and resume traffic on Tx/Rx pipes
  483. * @soc - data path soc handle
  484. * @pdev_id - device instance id
  485. *
  486. * Return: QDF_STATUS
  487. */
  488. static inline QDF_STATUS
  489. cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
  490. {
  491. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  492. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  493. "%s invalid instance", __func__);
  494. return QDF_STATUS_E_FAILURE;
  495. }
  496. if (soc->ops->ipa_ops->ipa_enable_pipes)
  497. return soc->ops->ipa_ops->ipa_enable_pipes(soc, pdev_id);
  498. return QDF_STATUS_SUCCESS;
  499. }
  500. /**
  501. * cdp_ipa_uc_disable_pipes() - Suspend traffic and disable Tx/Rx pipes
  502. * @soc: data path soc handle
  503. * @pdev_id - device instance id
  504. *
  505. * Return: QDF_STATUS
  506. */
  507. static inline QDF_STATUS
  508. cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
  509. {
  510. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  511. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  512. "%s invalid instance", __func__);
  513. return QDF_STATUS_E_FAILURE;
  514. }
  515. if (soc->ops->ipa_ops->ipa_disable_pipes)
  516. return soc->ops->ipa_ops->ipa_disable_pipes(soc, pdev_id);
  517. return QDF_STATUS_SUCCESS;
  518. }
  519. /**
  520. * cdp_ipa_set_perf_level() - Set IPA clock bandwidth based on data rates
  521. * @soc: data path soc handle
  522. * @client: WLAN Client ID
  523. * @max_supported_bw_mbps: Maximum bandwidth needed (in Mbps)
  524. *
  525. * Return: 0 on success, negative errno on error
  526. */
  527. static inline QDF_STATUS
  528. cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client,
  529. uint32_t max_supported_bw_mbps)
  530. {
  531. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  532. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  533. "%s invalid instance", __func__);
  534. return QDF_STATUS_E_FAILURE;
  535. }
  536. if (soc->ops->ipa_ops->ipa_set_perf_level)
  537. return soc->ops->ipa_ops->ipa_set_perf_level(client,
  538. max_supported_bw_mbps);
  539. return QDF_STATUS_SUCCESS;
  540. }
  541. /**
  542. * cdp_ipa_rx_intrabss_fwd() - Perform intra-bss fwd for IPA RX path
  543. *
  544. * @soc: data path soc handle
  545. * @vdev_id: vdev id
  546. * @nbuf: pointer to skb of ethernet packet received from IPA RX path
  547. * @fwd_success: pointer to indicate if skb succeeded in intra-bss TX
  548. *
  549. * This function performs intra-bss forwarding for WDI 3.0 IPA RX path.
  550. *
  551. * Return: true if packet is intra-bss fwd-ed and no need to pass to
  552. * network stack. false if packet needs to be passed to network stack.
  553. */
  554. static inline bool
  555. cdp_ipa_rx_intrabss_fwd(ol_txrx_soc_handle soc, uint8_t vdev_id,
  556. qdf_nbuf_t nbuf, bool *fwd_success)
  557. {
  558. if (!soc || !soc->ops || !soc->ops->ipa_ops || !fwd_success) {
  559. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  560. "%s invalid instance", __func__);
  561. return QDF_STATUS_E_FAILURE;
  562. }
  563. if (soc->ops->ipa_ops->ipa_rx_intrabss_fwd)
  564. return soc->ops->ipa_ops->ipa_rx_intrabss_fwd(soc, vdev_id,
  565. nbuf,
  566. fwd_success);
  567. /* Fall back to pass up to stack */
  568. return false;
  569. }
  570. /**
  571. * cdp_ipa_tx_buf_smmu_mapping() - Create SMMU mappings for Tx
  572. * buffers allocated to IPA
  573. * @soc: data path soc handle
  574. * @pdev_id: device instance id
  575. *
  576. * Create SMMU mappings for Tx buffers allocated to IPA
  577. *
  578. * return QDF_STATUS_SUCCESS
  579. */
  580. static inline QDF_STATUS
  581. cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
  582. {
  583. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  584. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  585. "%s invalid instance", __func__);
  586. return QDF_STATUS_E_FAILURE;
  587. }
  588. if (soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping)
  589. return soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping(soc, pdev_id);
  590. return QDF_STATUS_SUCCESS;
  591. }
  592. /**
  593. * cdp_ipa_tx_buf_smmu_unmapping() - Release SMMU mappings for Tx
  594. * buffers allocated to IPA
  595. * @soc: data path soc handle
  596. * @pdev_id: device instance id
  597. *
  598. * Release SMMU mappings for Tx buffers allocated to IPA
  599. *
  600. * return QDF_STATUS_SUCCESS
  601. */
  602. static inline QDF_STATUS
  603. cdp_ipa_tx_buf_smmu_unmapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
  604. {
  605. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  606. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  607. "%s invalid instance", __func__);
  608. return QDF_STATUS_E_FAILURE;
  609. }
  610. if (soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping)
  611. return soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping(soc,
  612. pdev_id);
  613. return QDF_STATUS_SUCCESS;
  614. }
  615. #endif /* IPA_OFFLOAD */
  616. #endif /* _CDP_TXRX_IPA_H_ */