wlan_ipa_ucfg_api.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. /*
  2. * Copyright (c) 2018 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, void *cb);
  138. /**
  139. * ucfg_ipa_reg_send_to_nw_cb() - Register cb to send IPA Rx packet to network
  140. * @pdev: pdev obj
  141. * @cb: callback
  142. *
  143. * Return: None
  144. */
  145. void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev, void *cb);
  146. /**
  147. * ucfg_ipa_set_mcc_mode() - Set MCC mode
  148. * @pdev: pdev obj
  149. * @mcc_mode: 0=MCC/1=SCC
  150. *
  151. * Return: void
  152. */
  153. void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode);
  154. /**
  155. * ucfg_ipa_set_dfs_cac_tx() - Set DFS cac tx block
  156. * @pdev: pdev obj
  157. * @tx_block: dfs cac tx block
  158. *
  159. * Return: void
  160. */
  161. void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block);
  162. /**
  163. * ucfg_ipa_set_ap_ibss_fwd() - Set AP intra bss forward
  164. * @pdev: pdev obj
  165. * @intra_bss: enable or disable ap intra bss forward
  166. *
  167. * Return: void
  168. */
  169. void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, bool intra_bss);
  170. /**
  171. * ucfg_ipa_uc_force_pipe_shutdown() - Force shutdown IPA pipe
  172. * @pdev: pdev obj
  173. *
  174. * Return: void
  175. */
  176. void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev);
  177. /**
  178. * ucfg_ipa_flush() - flush IPA exception path SKB's
  179. * @pdev: pdev obj
  180. *
  181. * Return: None
  182. */
  183. void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev);
  184. /**
  185. * ucfg_ipa_suspend() - Suspend IPA
  186. * @pdev: pdev obj
  187. *
  188. * Return: QDF STATUS
  189. */
  190. QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev);
  191. /**
  192. * ucfg_ipa_resume() - Resume IPA
  193. * @pdev: pdev obj
  194. *
  195. * Return: QDF STATUS
  196. */
  197. QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev);
  198. /**
  199. * ucfg_ipa_uc_ol_init() - Initialize IPA uC offload
  200. * @pdev: pdev obj
  201. * @osdev: OS dev
  202. *
  203. * Return: QDF STATUS
  204. */
  205. QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
  206. qdf_device_t osdev);
  207. /**
  208. * ucfg_ipa_uc_ol_deinit() - Deinitialize IPA uC offload
  209. * @pdev: pdev obj
  210. *
  211. * Return: QDF STATUS
  212. */
  213. QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev);
  214. /**
  215. * ucfg_ipa_send_mcc_scc_msg() - Send IPA WLAN_SWITCH_TO_MCC/SCC message
  216. * @mcc_mode: 0=MCC/1=SCC
  217. *
  218. * Return: QDF STATUS
  219. */
  220. QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
  221. bool mcc_mode);
  222. /**
  223. * ucfg_ipa_wlan_evt() - IPA event handler
  224. * @pdev: pdev obj
  225. * @net_dev: Interface net device
  226. * @device_mode: Net interface device mode
  227. * @sta_id: station id for the event
  228. * @session_id: session id for the event
  229. * @type: event enum of type ipa_wlan_event
  230. * @mac_address: MAC address associated with the event
  231. *
  232. * Return: QDF_STATUS
  233. */
  234. QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
  235. qdf_netdev_t net_dev, uint8_t device_mode,
  236. uint8_t sta_id, uint8_t session_id,
  237. enum wlan_ipa_wlan_event ipa_event_type,
  238. uint8_t *mac_addr);
  239. /**
  240. * ucfg_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC
  241. * @map: Map / unmap operation
  242. * @num_buf: Number of buffers in array
  243. * @buf_arr: Buffer array of DMA mem mapping info
  244. *
  245. * Return: Status of map operation
  246. */
  247. int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
  248. /**
  249. * ucfg_ipa_is_fw_wdi_activated - Is FW WDI activated?
  250. * @pdev: pdev obj
  251. *
  252. * Return: true if FW WDI activated, false otherwise
  253. */
  254. bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev);
  255. /**
  256. * ucfg_ipa_uc_disconnect_ap() - send ap disconnect event
  257. * @pdev: pdev obj
  258. * @net_dev: Interface net device
  259. *
  260. * Send disconnect ap event to IPA driver during SSR
  261. *
  262. * Return: QDF_STATUS
  263. */
  264. QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
  265. qdf_netdev_t net_dev);
  266. /**
  267. * ucfg_ipa_cleanup_dev_iface() - Clean up net dev IPA interface
  268. * @pdev: pdev obj
  269. * @net_dev: Interface net device
  270. *
  271. *
  272. * Return: None
  273. */
  274. void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
  275. qdf_netdev_t net_dev);
  276. /**
  277. * ucfg_ipa_uc_ssr_cleanup() - Handle IPA cleanup for SSR
  278. * @pdev: pdev obj
  279. *
  280. * From hostside do cleanup such as deregister IPA interafces
  281. * and send disconnect events so that it will be sync after SSR
  282. *
  283. * Return: None
  284. */
  285. void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev);
  286. /**
  287. * ucfg_ipa_fw_rejuvenate_send_msg() - Send msg to IPA driver in FW rejuvenate
  288. * @pdev: pdev obj
  289. *
  290. * Return: None
  291. */
  292. void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev);
  293. /**
  294. * ucfg_ipa_component_config_update() - update IPA component config
  295. * @psoc: pointer to psoc object
  296. *
  297. * Return: None
  298. */
  299. void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc);
  300. /**
  301. * ucfg_get_ipa_tx_buf_count() - get IPA tx buffer count
  302. *
  303. * Return: IPA tx buffer count
  304. */
  305. uint32_t ucfg_ipa_get_tx_buf_count(void);
  306. #else
  307. static inline bool ucfg_ipa_is_present(void)
  308. {
  309. return false;
  310. }
  311. static inline void ucfg_ipa_update_config(struct wlan_ipa_config *config)
  312. {
  313. }
  314. static inline bool ucfg_ipa_is_enabled(void)
  315. {
  316. return false;
  317. }
  318. static inline bool ucfg_ipa_uc_is_enabled(void)
  319. {
  320. return false;
  321. }
  322. static inline
  323. QDF_STATUS ucfg_ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc,
  324. void *dp_soc)
  325. {
  326. return QDF_STATUS_SUCCESS;
  327. }
  328. static inline
  329. QDF_STATUS ucfg_ipa_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
  330. void *txrx_handle)
  331. {
  332. return QDF_STATUS_SUCCESS;
  333. }
  334. static inline
  335. QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev,
  336. uint64_t tx_packets, uint64_t rx_packets)
  337. {
  338. return QDF_STATUS_SUCCESS;
  339. }
  340. static inline
  341. void ucfg_ipa_uc_info(struct wlan_objmgr_pdev *pdev)
  342. {
  343. }
  344. static inline
  345. void ucfg_ipa_uc_stat(struct wlan_objmgr_pdev *pdev)
  346. {
  347. }
  348. static inline
  349. void ucfg_ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev)
  350. {
  351. }
  352. static inline
  353. void ucfg_ipa_dump_info(struct wlan_objmgr_pdev *pdev)
  354. {
  355. }
  356. static inline
  357. void ucfg_ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
  358. uint8_t reason)
  359. {
  360. }
  361. static inline
  362. void ucfg_ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
  363. uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff)
  364. {
  365. }
  366. static inline
  367. void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev, void *cb)
  368. {
  369. }
  370. static inline
  371. void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev, void *cb)
  372. {
  373. }
  374. static inline
  375. void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
  376. {
  377. }
  378. static inline
  379. void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block)
  380. {
  381. }
  382. static inline
  383. void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, bool intra_bss)
  384. {
  385. }
  386. static inline
  387. void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev)
  388. {
  389. }
  390. static inline
  391. void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev)
  392. {
  393. }
  394. static inline
  395. QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev)
  396. {
  397. return QDF_STATUS_SUCCESS;
  398. }
  399. static inline
  400. QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev)
  401. {
  402. return QDF_STATUS_SUCCESS;
  403. }
  404. static inline
  405. QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
  406. qdf_device_t osdev)
  407. {
  408. return QDF_STATUS_SUCCESS;
  409. }
  410. static inline
  411. QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev)
  412. {
  413. return QDF_STATUS_SUCCESS;
  414. }
  415. static inline
  416. QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
  417. bool mcc_mode)
  418. {
  419. return QDF_STATUS_SUCCESS;
  420. }
  421. static inline
  422. QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
  423. qdf_netdev_t net_dev, uint8_t device_mode,
  424. uint8_t sta_id, uint8_t session_id,
  425. enum wlan_ipa_wlan_event ipa_event_type,
  426. uint8_t *mac_addr)
  427. {
  428. return QDF_STATUS_SUCCESS;
  429. }
  430. static inline
  431. int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
  432. {
  433. return 0;
  434. }
  435. static inline
  436. bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev)
  437. {
  438. return false;
  439. }
  440. static inline
  441. QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
  442. qdf_netdev_t net_dev)
  443. {
  444. return QDF_STATUS_SUCCESS;
  445. }
  446. static inline
  447. void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
  448. qdf_netdev_t net_dev)
  449. {
  450. }
  451. static inline
  452. void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev)
  453. {
  454. }
  455. static inline
  456. void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev)
  457. {
  458. }
  459. static inline
  460. void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc)
  461. {
  462. }
  463. static inline
  464. uint32_t ucfg_ipa_get_tx_buf_count(void)
  465. {
  466. return 0;
  467. }
  468. #endif /* IPA_OFFLOAD */
  469. #endif /* _WLAN_IPA_UCFG_API_H_ */