wlan_ipa_ucfg_api.h 12 KB

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