wlan_ipa_ucfg_api.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. /*
  2. * Copyright (c) 2018-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. * DOC: Declare public API related to the wlan ipa called by north bound
  20. */
  21. #ifndef _WLAN_IPA_UCFG_API_H_
  22. #define _WLAN_IPA_UCFG_API_H_
  23. #include "wlan_ipa_public_struct.h"
  24. #include "wlan_ipa_obj_mgmt_api.h"
  25. #include "wlan_objmgr_pdev_obj.h"
  26. #include "qdf_types.h"
  27. #include "wlan_ipa_main.h"
  28. #ifdef IPA_OFFLOAD
  29. /**
  30. * ucfg_ipa_is_present() - get IPA hw status
  31. *
  32. * ipa_uc_reg_rdyCB is not directly designed to check
  33. * ipa hw status. This is an undocumented function which
  34. * has confirmed with IPA team.
  35. *
  36. * Return: true - ipa hw present
  37. * false - ipa hw not present
  38. */
  39. bool ucfg_ipa_is_present(void);
  40. /**
  41. * ucfg_ipa_is_enabled() - get IPA enable status
  42. *
  43. * Return: true - ipa is enabled
  44. * false - ipa is not enabled
  45. */
  46. bool ucfg_ipa_is_enabled(void);
  47. /**
  48. * ucfg_ipa_uc_is_enabled() - get IPA uC enable status
  49. *
  50. * Return: true - ipa uC is enabled
  51. * false - ipa uC is not enabled
  52. */
  53. bool ucfg_ipa_uc_is_enabled(void);
  54. /**
  55. * ucfg_ipa_set_dp_handle() - register DP handle
  56. * @psoc: psoc handle
  57. * @dp_soc: data path soc handle
  58. *
  59. * Return: None
  60. */
  61. void ucfg_ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc,
  62. void *dp_soc);
  63. /**
  64. * ucfg_ipa_set_txrx_handle() - register pdev txrx handler
  65. * @psoc: psoc handle
  66. * @psoc: psoc obj
  67. * @txrx_handle: data path pdev txrx handle
  68. *
  69. * Return: None
  70. */
  71. void ucfg_ipa_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
  72. void *txrx_handle);
  73. /**
  74. * ucfg_ipa_set_perf_level() - Set IPA perf level
  75. * @pdev: pdev obj
  76. * @tx_packets: Number of packets transmitted in the last sample period
  77. * @rx_packets: Number of packets received in the last sample period
  78. *
  79. * Return: QDF_STATUS_SUCCESS on success
  80. */
  81. QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev,
  82. uint64_t tx_packets, uint64_t rx_packets);
  83. /**
  84. * ucfg_ipa_uc_info() - Print IPA uC resource and session information
  85. * @pdev: pdev obj
  86. *
  87. * Return: None
  88. */
  89. void ucfg_ipa_uc_info(struct wlan_objmgr_pdev *pdev);
  90. /**
  91. * ucfg_ipa_uc_stat() - Print IPA uC stats
  92. * @pdev: pdev obj
  93. *
  94. * Return: None
  95. */
  96. void ucfg_ipa_uc_stat(struct wlan_objmgr_pdev *pdev);
  97. /**
  98. * ucfg_ipa_uc_rt_debug_host_dump() - IPA rt debug host dump
  99. * @pdev: pdev obj
  100. *
  101. * Return: None
  102. */
  103. void ucfg_ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev);
  104. /**
  105. * ucfg_ipa_dump_info() - Dump IPA context information
  106. * @pdev: pdev obj
  107. *
  108. * Return: None
  109. */
  110. void ucfg_ipa_dump_info(struct wlan_objmgr_pdev *pdev);
  111. /**
  112. * ucfg_ipa_uc_stat_request() - Get IPA stats from IPA.
  113. * @pdev: pdev obj
  114. * @reason: STAT REQ Reason
  115. *
  116. * Return: None
  117. */
  118. void ucfg_ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
  119. uint8_t reason);
  120. /**
  121. * ucfg_ipa_uc_stat_query() - Query the IPA stats
  122. * @pdev: pdev obj
  123. * @ipa_tx_diff: tx packet count diff from previous tx packet count
  124. * @ipa_rx_diff: rx packet count diff from previous rx packet count
  125. *
  126. * Return: None
  127. */
  128. void ucfg_ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
  129. uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff);
  130. /**
  131. * ucfg_ipa_reg_sap_xmit_cb() - Register upper layer SAP cb to transmit
  132. * @pdev: pdev obj
  133. * @cb: callback
  134. *
  135. * Return: None
  136. */
  137. void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
  138. wlan_ipa_softap_xmit cb);
  139. /**
  140. * ucfg_ipa_reg_send_to_nw_cb() - Register cb to send IPA Rx packet to network
  141. * @pdev: pdev obj
  142. * @cb: callback
  143. *
  144. * Return: None
  145. */
  146. void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
  147. wlan_ipa_send_to_nw cb);
  148. /**
  149. * ucfg_ipa_set_mcc_mode() - Set MCC mode
  150. * @pdev: pdev obj
  151. * @mcc_mode: 0=MCC/1=SCC
  152. *
  153. * Return: void
  154. */
  155. void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode);
  156. /**
  157. * ucfg_ipa_set_dfs_cac_tx() - Set DFS cac tx block
  158. * @pdev: pdev obj
  159. * @tx_block: dfs cac tx block
  160. *
  161. * Return: void
  162. */
  163. void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block);
  164. /**
  165. * ucfg_ipa_set_ap_ibss_fwd() - Set AP intra bss forward
  166. * @pdev: pdev obj
  167. * @intra_bss: enable or disable ap intra bss forward
  168. *
  169. * Return: void
  170. */
  171. void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, bool intra_bss);
  172. /**
  173. * ucfg_ipa_uc_force_pipe_shutdown() - Force shutdown IPA pipe
  174. * @pdev: pdev obj
  175. *
  176. * Return: void
  177. */
  178. void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev);
  179. /**
  180. * ucfg_ipa_flush() - flush IPA exception path SKB's
  181. * @pdev: pdev obj
  182. *
  183. * Return: None
  184. */
  185. void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev);
  186. /**
  187. * ucfg_ipa_suspend() - Suspend IPA
  188. * @pdev: pdev obj
  189. *
  190. * Return: QDF STATUS
  191. */
  192. QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev);
  193. /**
  194. * ucfg_ipa_resume() - Resume IPA
  195. * @pdev: pdev obj
  196. *
  197. * Return: QDF STATUS
  198. */
  199. QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev);
  200. /**
  201. * ucfg_ipa_uc_ol_init() - Initialize IPA uC offload
  202. * @pdev: pdev obj
  203. * @osdev: OS dev
  204. *
  205. * Return: QDF STATUS
  206. */
  207. QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
  208. qdf_device_t osdev);
  209. /**
  210. * ucfg_ipa_uc_ol_deinit() - Deinitialize IPA uC offload
  211. * @pdev: pdev obj
  212. *
  213. * Return: QDF STATUS
  214. */
  215. QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev);
  216. /**
  217. * ucfg_ipa_send_mcc_scc_msg() - Send IPA WLAN_SWITCH_TO_MCC/SCC message
  218. * @mcc_mode: 0=MCC/1=SCC
  219. *
  220. * Return: QDF STATUS
  221. */
  222. QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
  223. bool mcc_mode);
  224. /**
  225. * ucfg_ipa_wlan_evt() - IPA event handler
  226. * @pdev: pdev obj
  227. * @net_dev: Interface net device
  228. * @device_mode: Net interface device mode
  229. * @session_id: session id for the event
  230. * @type: event enum of type ipa_wlan_event
  231. * @mac_address: MAC address associated with the event
  232. *
  233. * Return: QDF_STATUS
  234. */
  235. QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
  236. qdf_netdev_t net_dev, uint8_t device_mode,
  237. uint8_t session_id,
  238. enum wlan_ipa_wlan_event ipa_event_type,
  239. uint8_t *mac_addr);
  240. /**
  241. * ucfg_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC
  242. * @map: Map / unmap operation
  243. * @num_buf: Number of buffers in array
  244. * @buf_arr: Buffer array of DMA mem mapping info
  245. *
  246. * Return: Status of map operation
  247. */
  248. int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
  249. /**
  250. * ucfg_ipa_is_fw_wdi_activated - Is FW WDI activated?
  251. * @pdev: pdev obj
  252. *
  253. * Return: true if FW WDI activated, false otherwise
  254. */
  255. bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev);
  256. /**
  257. * ucfg_ipa_uc_disconnect_ap() - send ap disconnect event
  258. * @pdev: pdev obj
  259. * @net_dev: Interface net device
  260. *
  261. * Send disconnect ap event to IPA driver during SSR
  262. *
  263. * Return: QDF_STATUS
  264. */
  265. QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
  266. qdf_netdev_t net_dev);
  267. /**
  268. * ucfg_ipa_cleanup_dev_iface() - Clean up net dev IPA interface
  269. * @pdev: pdev obj
  270. * @net_dev: Interface net device
  271. *
  272. *
  273. * Return: None
  274. */
  275. void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
  276. qdf_netdev_t net_dev);
  277. /**
  278. * ucfg_ipa_uc_ssr_cleanup() - Handle IPA cleanup for SSR
  279. * @pdev: pdev obj
  280. *
  281. * From hostside do cleanup such as deregister IPA interafces
  282. * and send disconnect events so that it will be sync after SSR
  283. *
  284. * Return: None
  285. */
  286. void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev);
  287. /**
  288. * ucfg_ipa_fw_rejuvenate_send_msg() - Send msg to IPA driver in FW rejuvenate
  289. * @pdev: pdev obj
  290. *
  291. * Return: None
  292. */
  293. void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev);
  294. /**
  295. * ucfg_ipa_component_config_update() - update IPA component config
  296. * @psoc: pointer to psoc object
  297. *
  298. * Return: None
  299. */
  300. void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc);
  301. /**
  302. * ucfg_get_ipa_tx_buf_count() - get IPA tx buffer count
  303. *
  304. * Return: IPA tx buffer count
  305. */
  306. uint32_t ucfg_ipa_get_tx_buf_count(void);
  307. #else
  308. static inline bool ucfg_ipa_is_present(void)
  309. {
  310. return false;
  311. }
  312. static inline void ucfg_ipa_update_config(struct wlan_ipa_config *config)
  313. {
  314. }
  315. static inline bool ucfg_ipa_is_enabled(void)
  316. {
  317. return false;
  318. }
  319. static inline bool ucfg_ipa_uc_is_enabled(void)
  320. {
  321. return false;
  322. }
  323. static inline
  324. QDF_STATUS ucfg_ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc,
  325. void *dp_soc)
  326. {
  327. return QDF_STATUS_SUCCESS;
  328. }
  329. static inline
  330. QDF_STATUS ucfg_ipa_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
  331. void *txrx_handle)
  332. {
  333. return QDF_STATUS_SUCCESS;
  334. }
  335. static inline
  336. QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev,
  337. uint64_t tx_packets, uint64_t rx_packets)
  338. {
  339. return QDF_STATUS_SUCCESS;
  340. }
  341. static inline
  342. void ucfg_ipa_uc_info(struct wlan_objmgr_pdev *pdev)
  343. {
  344. }
  345. static inline
  346. void ucfg_ipa_uc_stat(struct wlan_objmgr_pdev *pdev)
  347. {
  348. }
  349. static inline
  350. void ucfg_ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev)
  351. {
  352. }
  353. static inline
  354. void ucfg_ipa_dump_info(struct wlan_objmgr_pdev *pdev)
  355. {
  356. }
  357. static inline
  358. void ucfg_ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
  359. uint8_t reason)
  360. {
  361. }
  362. static inline
  363. void ucfg_ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
  364. uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff)
  365. {
  366. }
  367. static inline
  368. void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
  369. wlan_ipa_softap_xmit cb)
  370. {
  371. }
  372. static inline
  373. void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
  374. wlan_ipa_send_to_nw cb)
  375. {
  376. }
  377. static inline
  378. void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
  379. {
  380. }
  381. static inline
  382. void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block)
  383. {
  384. }
  385. static inline
  386. void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, bool intra_bss)
  387. {
  388. }
  389. static inline
  390. void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev)
  391. {
  392. }
  393. static inline
  394. void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev)
  395. {
  396. }
  397. static inline
  398. QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev)
  399. {
  400. return QDF_STATUS_SUCCESS;
  401. }
  402. static inline
  403. QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev)
  404. {
  405. return QDF_STATUS_SUCCESS;
  406. }
  407. static inline
  408. QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
  409. qdf_device_t osdev)
  410. {
  411. return QDF_STATUS_SUCCESS;
  412. }
  413. static inline
  414. QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev)
  415. {
  416. return QDF_STATUS_SUCCESS;
  417. }
  418. static inline
  419. QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
  420. bool mcc_mode)
  421. {
  422. return QDF_STATUS_SUCCESS;
  423. }
  424. static inline
  425. QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
  426. qdf_netdev_t net_dev, uint8_t device_mode,
  427. uint8_t session_id,
  428. enum wlan_ipa_wlan_event ipa_event_type,
  429. uint8_t *mac_addr)
  430. {
  431. return QDF_STATUS_SUCCESS;
  432. }
  433. static inline
  434. int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
  435. {
  436. return 0;
  437. }
  438. static inline
  439. bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev)
  440. {
  441. return false;
  442. }
  443. static inline
  444. QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
  445. qdf_netdev_t net_dev)
  446. {
  447. return QDF_STATUS_SUCCESS;
  448. }
  449. static inline
  450. void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
  451. qdf_netdev_t net_dev)
  452. {
  453. }
  454. static inline
  455. void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev)
  456. {
  457. }
  458. static inline
  459. void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev)
  460. {
  461. }
  462. static inline
  463. void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc)
  464. {
  465. }
  466. static inline
  467. uint32_t ucfg_ipa_get_tx_buf_count(void)
  468. {
  469. return 0;
  470. }
  471. #endif /* IPA_OFFLOAD */
  472. #endif /* _WLAN_IPA_UCFG_API_H_ */