cdp_txrx_ipa.h 19 KB

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