cdp_txrx_ipa.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * @file cdp_txrx_ipa.h
  21. * @brief Define the host data path IP Acceleraor API functions
  22. */
  23. #ifndef _CDP_TXRX_IPA_H_
  24. #define _CDP_TXRX_IPA_H_
  25. #ifdef IPA_OFFLOAD
  26. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
  27. defined(CONFIG_IPA_WDI_UNIFIED_API)
  28. #include <qdf_ipa_wdi3.h>
  29. #else
  30. #include <qdf_ipa.h>
  31. #endif
  32. #include <cdp_txrx_cmn.h>
  33. #include "cdp_txrx_handle.h"
  34. /**
  35. * cdp_ipa_get_resource() - Get allocated WLAN resources for IPA data path
  36. * @soc - data path soc handle
  37. * @pdev_id - device instance id
  38. *
  39. * Get allocated WLAN resources for IPA data path
  40. *
  41. * return QDF_STATUS_SUCCESS
  42. */
  43. static inline QDF_STATUS
  44. cdp_ipa_get_resource(ol_txrx_soc_handle soc, uint8_t pdev_id)
  45. {
  46. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  47. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  48. "%s invalid instance", __func__);
  49. return QDF_STATUS_E_FAILURE;
  50. }
  51. if (soc->ops->ipa_ops->ipa_get_resource)
  52. return soc->ops->ipa_ops->ipa_get_resource(soc, pdev_id);
  53. return QDF_STATUS_SUCCESS;
  54. }
  55. /**
  56. * cdp_ipa_set_doorbell_paddr() - give IPA db paddr to FW
  57. * @soc - data path soc handle
  58. * @pdev_id - device instance id
  59. *
  60. * give IPA db paddr to FW
  61. *
  62. * return QDF_STATUS_SUCCESS
  63. */
  64. static inline QDF_STATUS
  65. cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, uint8_t pdev_id)
  66. {
  67. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  68. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  69. "%s invalid instance", __func__);
  70. return QDF_STATUS_E_FAILURE;
  71. }
  72. if (soc->ops->ipa_ops->ipa_set_doorbell_paddr)
  73. return soc->ops->ipa_ops->ipa_set_doorbell_paddr(soc, pdev_id);
  74. return QDF_STATUS_SUCCESS;
  75. }
  76. /**
  77. * cdp_ipa_iounmap_doorbell_vaddr() - unmap IPA RX db vaddr
  78. * @soc - data path soc handle
  79. * @pdev_id - device instance id
  80. *
  81. * Unmap IPA RX db vaddr
  82. *
  83. * return QDF_STATUS_SUCCESS
  84. */
  85. static inline QDF_STATUS
  86. cdp_ipa_iounmap_doorbell_vaddr(ol_txrx_soc_handle soc, uint8_t pdev_id)
  87. {
  88. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  89. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  90. "%s invalid instance", __func__);
  91. return QDF_STATUS_E_FAILURE;
  92. }
  93. if (soc->ops->ipa_ops->ipa_iounmap_doorbell_vaddr)
  94. return soc->ops->ipa_ops->ipa_iounmap_doorbell_vaddr(
  95. soc, pdev_id);
  96. return QDF_STATUS_SUCCESS;
  97. }
  98. /**
  99. * cdp_ipa_set_active() - activate/de-ctivate IPA offload path
  100. * @soc - data path soc handle
  101. * @pdev_id - device instance id
  102. * @uc_active - activate or de-activate
  103. * @is_tx - toggle tx or rx data path
  104. *
  105. * activate/de-ctivate IPA offload path
  106. *
  107. * return QDF_STATUS_SUCCESS
  108. */
  109. static inline QDF_STATUS
  110. cdp_ipa_set_active(ol_txrx_soc_handle soc, uint8_t pdev_id, bool uc_active,
  111. bool is_tx)
  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_set_active)
  119. return soc->ops->ipa_ops->ipa_set_active(soc, pdev_id,
  120. uc_active, is_tx);
  121. return QDF_STATUS_SUCCESS;
  122. }
  123. /**
  124. * cdp_ipa_op_response() - event handler from FW
  125. * @soc - data path soc handle
  126. * @pdev_id - device instance id
  127. * @op_msg - event contents from firmware
  128. *
  129. * event handler from FW
  130. *
  131. * return QDF_STATUS_SUCCESS
  132. */
  133. static inline QDF_STATUS
  134. cdp_ipa_op_response(ol_txrx_soc_handle soc, uint8_t pdev_id, uint8_t *op_msg)
  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_op_response)
  142. return soc->ops->ipa_ops->ipa_op_response(soc, pdev_id, op_msg);
  143. return QDF_STATUS_SUCCESS;
  144. }
  145. /**
  146. * cdp_ipa_register_op_cb() - register event handler function pointer
  147. * @soc - data path soc handle
  148. * @pdev_id - device instance id
  149. * @op_cb - event handler callback function pointer
  150. * @usr_ctxt - user context to registered
  151. *
  152. * register event handler function pointer
  153. *
  154. * return QDF_STATUS_SUCCESS
  155. */
  156. static inline QDF_STATUS
  157. cdp_ipa_register_op_cb(ol_txrx_soc_handle soc, uint8_t pdev_id,
  158. ipa_uc_op_cb_type op_cb, void *usr_ctxt)
  159. {
  160. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  161. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  162. "%s invalid instance", __func__);
  163. return QDF_STATUS_E_FAILURE;
  164. }
  165. if (soc->ops->ipa_ops->ipa_register_op_cb)
  166. return soc->ops->ipa_ops->ipa_register_op_cb(soc, pdev_id,
  167. op_cb, usr_ctxt);
  168. return QDF_STATUS_SUCCESS;
  169. }
  170. /**
  171. * cdp_ipa_deregister_op_cb() - deregister event handler function pointer
  172. * @soc - data path soc handle
  173. * @pdev_id - device instance id
  174. *
  175. * Deregister event handler function pointer from pdev
  176. *
  177. * return QDF_STATUS_SUCCESS
  178. */
  179. static inline
  180. void cdp_ipa_deregister_op_cb(ol_txrx_soc_handle soc, uint8_t pdev_id)
  181. {
  182. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  183. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  184. "%s invalid instance", __func__);
  185. return;
  186. }
  187. if (soc->ops->ipa_ops->ipa_deregister_op_cb)
  188. soc->ops->ipa_ops->ipa_deregister_op_cb(soc, pdev_id);
  189. }
  190. /**
  191. * cdp_ipa_get_stat() - get IPA data path stats from FW
  192. * @soc - data path soc handle
  193. * @pdev_id - device instance id
  194. *
  195. * get IPA data path stats from FW async
  196. *
  197. * return QDF_STATUS_SUCCESS
  198. */
  199. static inline QDF_STATUS
  200. cdp_ipa_get_stat(ol_txrx_soc_handle soc, uint8_t pdev_id)
  201. {
  202. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  203. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  204. "%s invalid instance", __func__);
  205. return QDF_STATUS_E_FAILURE;
  206. }
  207. if (soc->ops->ipa_ops->ipa_get_stat)
  208. return soc->ops->ipa_ops->ipa_get_stat(soc, pdev_id);
  209. return QDF_STATUS_SUCCESS;
  210. }
  211. /**
  212. * cdp_tx_send_ipa_data_frame() - send IPA data frame
  213. * @soc - data path soc handle
  214. * @vdev_id: vdev id
  215. * @skb: skb
  216. *
  217. * Return: skb/ NULL is for success
  218. */
  219. static inline qdf_nbuf_t cdp_ipa_tx_send_data_frame(ol_txrx_soc_handle soc,
  220. uint8_t vdev_id,
  221. qdf_nbuf_t skb)
  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 skb;
  227. }
  228. if (soc->ops->ipa_ops->ipa_tx_data_frame)
  229. return soc->ops->ipa_ops->ipa_tx_data_frame(soc, vdev_id, skb);
  230. return skb;
  231. }
  232. /**
  233. * cdp_ipa_set_uc_tx_partition_base() - set tx packet partition base
  234. * @soc - data path soc handle
  235. * @cfg_pdev: physical device instance config
  236. * @value: partition base value
  237. *
  238. * Return: QDF_STATUS
  239. */
  240. static inline QDF_STATUS
  241. cdp_ipa_set_uc_tx_partition_base(ol_txrx_soc_handle soc,
  242. struct cdp_cfg *cfg_pdev, uint32_t value)
  243. {
  244. if (!soc || !soc->ops || !soc->ops->ipa_ops || !cfg_pdev) {
  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_set_uc_tx_partition_base)
  250. soc->ops->ipa_ops->ipa_set_uc_tx_partition_base(cfg_pdev,
  251. value);
  252. return QDF_STATUS_SUCCESS;
  253. }
  254. #ifdef FEATURE_METERING
  255. /**
  256. * cdp_ipa_uc_get_share_stats() - get Tx/Rx byte stats from FW
  257. * @soc - data path soc handle
  258. * @pdev_id: physical device instance number
  259. * @value: reset stats
  260. *
  261. * Return: QDF_STATUS
  262. */
  263. static inline QDF_STATUS
  264. cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  265. uint8_t value)
  266. {
  267. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  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_uc_get_share_stats)
  273. return soc->ops->ipa_ops->ipa_uc_get_share_stats(soc, pdev_id,
  274. value);
  275. return QDF_STATUS_SUCCESS;
  276. }
  277. /**
  278. * cdp_ipa_uc_set_quota() - set quota limit to FW
  279. * @soc - data path soc handle
  280. * @pdev_id: physical device instance number
  281. * @value: quota limit bytes
  282. *
  283. * Return: QDF_STATUS
  284. */
  285. static inline QDF_STATUS
  286. cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc, uint8_t pdev_id, uint64_t value)
  287. {
  288. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  289. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  290. "%s invalid instance", __func__);
  291. return QDF_STATUS_E_FAILURE;
  292. }
  293. if (soc->ops->ipa_ops->ipa_uc_set_quota)
  294. return soc->ops->ipa_ops->ipa_uc_set_quota(soc, pdev_id, value);
  295. return QDF_STATUS_SUCCESS;
  296. }
  297. #endif
  298. /**
  299. * cdp_ipa_enable_autonomy() - Enable 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 data path 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_enable_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_enable_autonomy)
  319. return soc->ops->ipa_ops->ipa_enable_autonomy(soc, pdev_id);
  320. return QDF_STATUS_SUCCESS;
  321. }
  322. /**
  323. * cdp_ipa_disable_autonomy() - Disable autonomy RX data path
  324. * @soc: data path soc handle
  325. * @pdev_id: physical device instance number
  326. *
  327. * IPA Data path is enabled and resumed.
  328. * All autonomy datapath elements are ready to deliver packet
  329. * All RX packet should routed to IPA_REO ring, then IPA can receive packet
  330. * from WLAN
  331. *
  332. * Return: QDF_STATUS
  333. */
  334. static inline QDF_STATUS
  335. cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
  336. {
  337. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  338. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  339. "%s invalid instance", __func__);
  340. return QDF_STATUS_E_FAILURE;
  341. }
  342. if (soc->ops->ipa_ops->ipa_disable_autonomy)
  343. return soc->ops->ipa_ops->ipa_disable_autonomy(soc, pdev_id);
  344. return QDF_STATUS_SUCCESS;
  345. }
  346. #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
  347. defined(CONFIG_IPA_WDI_UNIFIED_API)
  348. /**
  349. * cdp_ipa_setup() - Setup and connect IPA pipes
  350. * @soc: data path soc handle
  351. * @pdev_id: handle to the device instance number
  352. * @ipa_i2w_cb: IPA to WLAN callback
  353. * @ipa_w2i_cb: WLAN to IPA callback
  354. * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
  355. * @ipa_desc_size: IPA descriptor size
  356. * @ipa_priv: handle to the HTT instance
  357. * @is_rm_enabled: Is IPA RM enabled or not
  358. * @tx_pipe_handle: pointer to Tx pipe handle
  359. * @rx_pipe_handle: pointer to Rx pipe handle
  360. * @is_smmu_enabled: Is SMMU enabled or not
  361. * @sys_in: parameters to setup sys pipe in mcc mode
  362. * @over_gsi: Is IPA using GSI
  363. * @hdl: IPA handle
  364. *
  365. * Return: QDF_STATUS
  366. */
  367. static inline QDF_STATUS
  368. cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
  369. void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
  370. uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
  371. uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle,
  372. bool is_smmu_enabled, qdf_ipa_sys_connect_params_t *sys_in,
  373. bool over_gsi, qdf_ipa_wdi_hdl_t hdl)
  374. {
  375. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  376. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  377. "%s invalid instance", __func__);
  378. return QDF_STATUS_E_FAILURE;
  379. }
  380. if (soc->ops->ipa_ops->ipa_setup)
  381. return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
  382. ipa_w2i_cb,
  383. ipa_wdi_meter_notifier_cb,
  384. ipa_desc_size, ipa_priv,
  385. is_rm_enabled,
  386. tx_pipe_handle,
  387. rx_pipe_handle,
  388. is_smmu_enabled,
  389. sys_in, over_gsi, hdl);
  390. return QDF_STATUS_SUCCESS;
  391. }
  392. #else /* CONFIG_IPA_WDI_UNIFIED_API */
  393. /**
  394. * cdp_ipa_setup() - Setup and connect IPA pipes
  395. * @soc: data path soc handle
  396. * @pdev_id: handle to the device instance number
  397. * @ipa_i2w_cb: IPA to WLAN callback
  398. * @ipa_w2i_cb: WLAN to IPA callback
  399. * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
  400. * @ipa_desc_size: IPA descriptor size
  401. * @ipa_priv: handle to the HTT instance
  402. * @is_rm_enabled: Is IPA RM enabled or not
  403. * @tx_pipe_handle: pointer to Tx pipe handle
  404. * @rx_pipe_handle: pointer to Rx pipe handle
  405. *
  406. * Return: QDF_STATUS
  407. */
  408. static inline QDF_STATUS
  409. cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
  410. void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
  411. uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
  412. uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle)
  413. {
  414. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  415. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  416. "%s invalid instance", __func__);
  417. return QDF_STATUS_E_FAILURE;
  418. }
  419. if (soc->ops->ipa_ops->ipa_setup)
  420. return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
  421. ipa_w2i_cb,
  422. ipa_wdi_meter_notifier_cb,
  423. ipa_desc_size, ipa_priv,
  424. is_rm_enabled,
  425. tx_pipe_handle,
  426. rx_pipe_handle);
  427. return QDF_STATUS_SUCCESS;
  428. }
  429. #endif /* CONFIG_IPA_WDI_UNIFIED_API */
  430. /**
  431. * cdp_ipa_cleanup() - Disconnect IPA pipes
  432. * @soc: data path soc handle
  433. * @pdev_id: handle to the device instance number
  434. * @tx_pipe_handle: Tx pipe handle
  435. * @rx_pipe_handle: Rx pipe handle
  436. * @hdl: IPA handle
  437. *
  438. * Return: QDF_STATUS
  439. */
  440. static inline QDF_STATUS
  441. cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint8_t pdev_id,
  442. uint32_t tx_pipe_handle, uint32_t rx_pipe_handle,
  443. qdf_ipa_wdi_hdl_t hdl)
  444. {
  445. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  446. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  447. "%s invalid instance", __func__);
  448. return QDF_STATUS_E_FAILURE;
  449. }
  450. if (soc->ops->ipa_ops->ipa_cleanup)
  451. return soc->ops->ipa_ops->ipa_cleanup(soc, pdev_id,
  452. tx_pipe_handle,
  453. rx_pipe_handle, hdl);
  454. return QDF_STATUS_SUCCESS;
  455. }
  456. /**
  457. * cdp_ipa_setup_iface() - Setup IPA header and register interface
  458. * @soc: data path soc handle
  459. * @ifname: Interface name
  460. * @mac_addr: Interface MAC address
  461. * @prod_client: IPA prod client type
  462. * @cons_client: IPA cons client type
  463. * @session_id: Session ID
  464. * @is_ipv6_enabled: Is IPV6 enabled or not
  465. * @hdl: IPA handle
  466. *
  467. * Return: QDF_STATUS
  468. */
  469. static inline QDF_STATUS
  470. cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr,
  471. qdf_ipa_client_type_t prod_client,
  472. qdf_ipa_client_type_t cons_client,
  473. uint8_t session_id, bool is_ipv6_enabled,
  474. qdf_ipa_wdi_hdl_t hdl)
  475. {
  476. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  477. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  478. "%s invalid instance", __func__);
  479. return QDF_STATUS_E_FAILURE;
  480. }
  481. if (soc->ops->ipa_ops->ipa_setup_iface)
  482. return soc->ops->ipa_ops->ipa_setup_iface(ifname, mac_addr,
  483. prod_client,
  484. cons_client,
  485. session_id,
  486. is_ipv6_enabled,
  487. hdl);
  488. return QDF_STATUS_SUCCESS;
  489. }
  490. /**
  491. * cdp_ipa_cleanup_iface() - Cleanup IPA header and deregister interface
  492. * @soc: data path soc handle
  493. * @ifname: Interface name
  494. * @is_ipv6_enabled: Is IPV6 enabled or not
  495. * @hdl: IPA handle
  496. *
  497. * Return: QDF_STATUS
  498. */
  499. static inline QDF_STATUS
  500. cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc, char *ifname,
  501. bool is_ipv6_enabled, qdf_ipa_wdi_hdl_t hdl)
  502. {
  503. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  504. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  505. "%s invalid instance", __func__);
  506. return QDF_STATUS_E_FAILURE;
  507. }
  508. if (soc->ops->ipa_ops->ipa_cleanup_iface)
  509. return soc->ops->ipa_ops->ipa_cleanup_iface(ifname,
  510. is_ipv6_enabled,
  511. hdl);
  512. return QDF_STATUS_SUCCESS;
  513. }
  514. /**
  515. * cdp_ipa_uc_enable_pipes() - Enable and resume traffic on Tx/Rx pipes
  516. * @soc - data path soc handle
  517. * @pdev_id - device instance id
  518. * @hdl: IPA handle
  519. *
  520. * Return: QDF_STATUS
  521. */
  522. static inline QDF_STATUS
  523. cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id,
  524. qdf_ipa_wdi_hdl_t hdl)
  525. {
  526. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  527. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  528. "%s invalid instance", __func__);
  529. return QDF_STATUS_E_FAILURE;
  530. }
  531. if (soc->ops->ipa_ops->ipa_enable_pipes)
  532. return soc->ops->ipa_ops->ipa_enable_pipes(soc, pdev_id, hdl);
  533. return QDF_STATUS_SUCCESS;
  534. }
  535. /**
  536. * cdp_ipa_uc_disable_pipes() - Suspend traffic and disable Tx/Rx pipes
  537. * @soc: data path soc handle
  538. * @pdev_id - device instance id
  539. * @hdl: IPA handle
  540. *
  541. * Return: QDF_STATUS
  542. */
  543. static inline QDF_STATUS
  544. cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id,
  545. qdf_ipa_wdi_hdl_t hdl)
  546. {
  547. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  548. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  549. "%s invalid instance", __func__);
  550. return QDF_STATUS_E_FAILURE;
  551. }
  552. if (soc->ops->ipa_ops->ipa_disable_pipes)
  553. return soc->ops->ipa_ops->ipa_disable_pipes(soc, pdev_id, hdl);
  554. return QDF_STATUS_SUCCESS;
  555. }
  556. /**
  557. * cdp_ipa_set_perf_level() - Set IPA clock bandwidth based on data rates
  558. * @soc: data path soc handle
  559. * @client: WLAN Client ID
  560. * @max_supported_bw_mbps: Maximum bandwidth needed (in Mbps)
  561. * @hdl: IPA handle
  562. *
  563. * Return: 0 on success, negative errno on error
  564. */
  565. static inline QDF_STATUS
  566. cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client,
  567. uint32_t max_supported_bw_mbps, qdf_ipa_wdi_hdl_t hdl)
  568. {
  569. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  570. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  571. "%s invalid instance", __func__);
  572. return QDF_STATUS_E_FAILURE;
  573. }
  574. if (soc->ops->ipa_ops->ipa_set_perf_level)
  575. return soc->ops->ipa_ops->ipa_set_perf_level(client,
  576. max_supported_bw_mbps, hdl);
  577. return QDF_STATUS_SUCCESS;
  578. }
  579. /**
  580. * cdp_ipa_rx_intrabss_fwd() - Perform intra-bss fwd for IPA RX path
  581. *
  582. * @soc: data path soc handle
  583. * @vdev_id: vdev id
  584. * @nbuf: pointer to skb of ethernet packet received from IPA RX path
  585. * @fwd_success: pointer to indicate if skb succeeded in intra-bss TX
  586. *
  587. * This function performs intra-bss forwarding for WDI 3.0 IPA RX path.
  588. *
  589. * Return: true if packet is intra-bss fwd-ed and no need to pass to
  590. * network stack. false if packet needs to be passed to network stack.
  591. */
  592. static inline bool
  593. cdp_ipa_rx_intrabss_fwd(ol_txrx_soc_handle soc, uint8_t vdev_id,
  594. qdf_nbuf_t nbuf, bool *fwd_success)
  595. {
  596. if (!soc || !soc->ops || !soc->ops->ipa_ops || !fwd_success) {
  597. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  598. "%s invalid instance", __func__);
  599. return QDF_STATUS_E_FAILURE;
  600. }
  601. if (soc->ops->ipa_ops->ipa_rx_intrabss_fwd)
  602. return soc->ops->ipa_ops->ipa_rx_intrabss_fwd(soc, vdev_id,
  603. nbuf,
  604. fwd_success);
  605. /* Fall back to pass up to stack */
  606. return false;
  607. }
  608. /**
  609. * cdp_ipa_tx_buf_smmu_mapping() - Create SMMU mappings for Tx
  610. * buffers allocated to IPA
  611. * @soc: data path soc handle
  612. * @pdev_id: device instance id
  613. *
  614. * Create SMMU mappings for Tx buffers allocated to IPA
  615. *
  616. * return QDF_STATUS_SUCCESS
  617. */
  618. static inline QDF_STATUS
  619. cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
  620. {
  621. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  622. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  623. "%s invalid instance", __func__);
  624. return QDF_STATUS_E_FAILURE;
  625. }
  626. if (soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping)
  627. return soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping(soc, pdev_id);
  628. return QDF_STATUS_SUCCESS;
  629. }
  630. /**
  631. * cdp_ipa_tx_buf_smmu_unmapping() - Release SMMU mappings for Tx
  632. * buffers allocated to IPA
  633. * @soc: data path soc handle
  634. * @pdev_id: device instance id
  635. *
  636. * Release SMMU mappings for Tx buffers allocated to IPA
  637. *
  638. * return QDF_STATUS_SUCCESS
  639. */
  640. static inline QDF_STATUS
  641. cdp_ipa_tx_buf_smmu_unmapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
  642. {
  643. if (!soc || !soc->ops || !soc->ops->ipa_ops) {
  644. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
  645. "%s invalid instance", __func__);
  646. return QDF_STATUS_E_FAILURE;
  647. }
  648. if (soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping)
  649. return soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping(soc,
  650. pdev_id);
  651. return QDF_STATUS_SUCCESS;
  652. }
  653. #endif /* IPA_OFFLOAD */
  654. #endif /* _CDP_TXRX_IPA_H_ */