wlan_ipa_ucfg_api.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  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. * @sta_id: station id for the event
  230. * @session_id: session id for the event
  231. * @type: event enum of type ipa_wlan_event
  232. * @mac_address: MAC address associated with the event
  233. *
  234. * Return: QDF_STATUS
  235. */
  236. QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
  237. qdf_netdev_t net_dev, uint8_t device_mode,
  238. uint8_t sta_id, uint8_t session_id,
  239. enum wlan_ipa_wlan_event ipa_event_type,
  240. uint8_t *mac_addr);
  241. /**
  242. * ucfg_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC
  243. * @map: Map / unmap operation
  244. * @num_buf: Number of buffers in array
  245. * @buf_arr: Buffer array of DMA mem mapping info
  246. *
  247. * Return: Status of map operation
  248. */
  249. int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
  250. /**
  251. * ucfg_ipa_is_fw_wdi_activated - Is FW WDI activated?
  252. * @pdev: pdev obj
  253. *
  254. * Return: true if FW WDI activated, false otherwise
  255. */
  256. bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev);
  257. /**
  258. * ucfg_ipa_uc_disconnect_ap() - send ap disconnect event
  259. * @pdev: pdev obj
  260. * @net_dev: Interface net device
  261. *
  262. * Send disconnect ap event to IPA driver during SSR
  263. *
  264. * Return: QDF_STATUS
  265. */
  266. QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
  267. qdf_netdev_t net_dev);
  268. /**
  269. * ucfg_ipa_cleanup_dev_iface() - Clean up net dev IPA interface
  270. * @pdev: pdev obj
  271. * @net_dev: Interface net device
  272. *
  273. *
  274. * Return: None
  275. */
  276. void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
  277. qdf_netdev_t net_dev);
  278. /**
  279. * ucfg_ipa_uc_ssr_cleanup() - Handle IPA cleanup for SSR
  280. * @pdev: pdev obj
  281. *
  282. * From hostside do cleanup such as deregister IPA interafces
  283. * and send disconnect events so that it will be sync after SSR
  284. *
  285. * Return: None
  286. */
  287. void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev);
  288. /**
  289. * ucfg_ipa_fw_rejuvenate_send_msg() - Send msg to IPA driver in FW rejuvenate
  290. * @pdev: pdev obj
  291. *
  292. * Return: None
  293. */
  294. void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev);
  295. /**
  296. * ucfg_ipa_component_config_update() - update IPA component config
  297. * @psoc: pointer to psoc object
  298. *
  299. * Return: None
  300. */
  301. void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc);
  302. /**
  303. * ucfg_get_ipa_tx_buf_count() - get IPA tx buffer count
  304. *
  305. * Return: IPA tx buffer count
  306. */
  307. uint32_t ucfg_ipa_get_tx_buf_count(void);
  308. #else
  309. static inline bool ucfg_ipa_is_present(void)
  310. {
  311. return false;
  312. }
  313. static inline void ucfg_ipa_update_config(struct wlan_ipa_config *config)
  314. {
  315. }
  316. static inline bool ucfg_ipa_is_enabled(void)
  317. {
  318. return false;
  319. }
  320. static inline bool ucfg_ipa_uc_is_enabled(void)
  321. {
  322. return false;
  323. }
  324. static inline
  325. QDF_STATUS ucfg_ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc,
  326. void *dp_soc)
  327. {
  328. return QDF_STATUS_SUCCESS;
  329. }
  330. static inline
  331. QDF_STATUS ucfg_ipa_set_txrx_handle(struct wlan_objmgr_psoc *psoc,
  332. void *txrx_handle)
  333. {
  334. return QDF_STATUS_SUCCESS;
  335. }
  336. static inline
  337. QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev,
  338. uint64_t tx_packets, uint64_t rx_packets)
  339. {
  340. return QDF_STATUS_SUCCESS;
  341. }
  342. static inline
  343. void ucfg_ipa_uc_info(struct wlan_objmgr_pdev *pdev)
  344. {
  345. }
  346. static inline
  347. void ucfg_ipa_uc_stat(struct wlan_objmgr_pdev *pdev)
  348. {
  349. }
  350. static inline
  351. void ucfg_ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev)
  352. {
  353. }
  354. static inline
  355. void ucfg_ipa_dump_info(struct wlan_objmgr_pdev *pdev)
  356. {
  357. }
  358. static inline
  359. void ucfg_ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
  360. uint8_t reason)
  361. {
  362. }
  363. static inline
  364. void ucfg_ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
  365. uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff)
  366. {
  367. }
  368. static inline
  369. void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
  370. wlan_ipa_softap_xmit cb)
  371. {
  372. }
  373. static inline
  374. void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
  375. wlan_ipa_send_to_nw cb)
  376. {
  377. }
  378. static inline
  379. void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
  380. {
  381. }
  382. static inline
  383. void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block)
  384. {
  385. }
  386. static inline
  387. void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, bool intra_bss)
  388. {
  389. }
  390. static inline
  391. void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev)
  392. {
  393. }
  394. static inline
  395. void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev)
  396. {
  397. }
  398. static inline
  399. QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev)
  400. {
  401. return QDF_STATUS_SUCCESS;
  402. }
  403. static inline
  404. QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev)
  405. {
  406. return QDF_STATUS_SUCCESS;
  407. }
  408. static inline
  409. QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
  410. qdf_device_t osdev)
  411. {
  412. return QDF_STATUS_SUCCESS;
  413. }
  414. static inline
  415. QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev)
  416. {
  417. return QDF_STATUS_SUCCESS;
  418. }
  419. static inline
  420. QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
  421. bool mcc_mode)
  422. {
  423. return QDF_STATUS_SUCCESS;
  424. }
  425. static inline
  426. QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
  427. qdf_netdev_t net_dev, uint8_t device_mode,
  428. uint8_t sta_id, uint8_t session_id,
  429. enum wlan_ipa_wlan_event ipa_event_type,
  430. uint8_t *mac_addr)
  431. {
  432. return QDF_STATUS_SUCCESS;
  433. }
  434. static inline
  435. int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
  436. {
  437. return 0;
  438. }
  439. static inline
  440. bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev)
  441. {
  442. return false;
  443. }
  444. static inline
  445. QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
  446. qdf_netdev_t net_dev)
  447. {
  448. return QDF_STATUS_SUCCESS;
  449. }
  450. static inline
  451. void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
  452. qdf_netdev_t net_dev)
  453. {
  454. }
  455. static inline
  456. void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev)
  457. {
  458. }
  459. static inline
  460. void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev)
  461. {
  462. }
  463. static inline
  464. void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc)
  465. {
  466. }
  467. static inline
  468. uint32_t ucfg_ipa_get_tx_buf_count(void)
  469. {
  470. return 0;
  471. }
  472. #endif /* IPA_OFFLOAD */
  473. #endif /* _WLAN_IPA_UCFG_API_H_ */