wlan_ipa_ucfg_api.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  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_pdev_id() - register pdev id
  65. * @psoc: psoc handle
  66. * @pdev_id: data path txrx pdev id
  67. *
  68. * Return: None
  69. */
  70. void ucfg_ipa_set_pdev_id(struct wlan_objmgr_psoc *psoc,
  71. uint8_t pdev_id);
  72. /**
  73. * ucfg_ipa_set_perf_level() - Set IPA perf level
  74. * @pdev: pdev obj
  75. * @tx_packets: Number of packets transmitted in the last sample period
  76. * @rx_packets: Number of packets received in the last sample period
  77. *
  78. * Return: QDF_STATUS_SUCCESS on success
  79. */
  80. QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev,
  81. uint64_t tx_packets, uint64_t rx_packets);
  82. /**
  83. * ucfg_ipa_uc_info() - Print IPA uC resource and session information
  84. * @pdev: pdev obj
  85. *
  86. * Return: None
  87. */
  88. void ucfg_ipa_uc_info(struct wlan_objmgr_pdev *pdev);
  89. /**
  90. * ucfg_ipa_uc_stat() - Print IPA uC stats
  91. * @pdev: pdev obj
  92. *
  93. * Return: None
  94. */
  95. void ucfg_ipa_uc_stat(struct wlan_objmgr_pdev *pdev);
  96. /**
  97. * ucfg_ipa_uc_rt_debug_host_dump() - IPA rt debug host dump
  98. * @pdev: pdev obj
  99. *
  100. * Return: None
  101. */
  102. void ucfg_ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev);
  103. /**
  104. * ucfg_ipa_dump_info() - Dump IPA context information
  105. * @pdev: pdev obj
  106. *
  107. * Return: None
  108. */
  109. void ucfg_ipa_dump_info(struct wlan_objmgr_pdev *pdev);
  110. /**
  111. * ucfg_ipa_uc_stat_request() - Get IPA stats from IPA.
  112. * @pdev: pdev obj
  113. * @reason: STAT REQ Reason
  114. *
  115. * Return: None
  116. */
  117. void ucfg_ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
  118. uint8_t reason);
  119. /**
  120. * ucfg_ipa_uc_stat_query() - Query the IPA stats
  121. * @pdev: pdev obj
  122. * @ipa_tx_diff: tx packet count diff from previous tx packet count
  123. * @ipa_rx_diff: rx packet count diff from previous rx packet count
  124. *
  125. * Return: None
  126. */
  127. void ucfg_ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
  128. uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff);
  129. /**
  130. * ucfg_ipa_reg_sap_xmit_cb() - Register upper layer SAP cb to transmit
  131. * @pdev: pdev obj
  132. * @cb: callback
  133. *
  134. * Return: None
  135. */
  136. void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
  137. wlan_ipa_softap_xmit 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,
  146. wlan_ipa_send_to_nw cb);
  147. /**
  148. * ucfg_ipa_set_mcc_mode() - Set MCC mode
  149. * @pdev: pdev obj
  150. * @mcc_mode: 0=MCC/1=SCC
  151. *
  152. * Return: void
  153. */
  154. void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode);
  155. /**
  156. * ucfg_ipa_set_dfs_cac_tx() - Set DFS cac tx block
  157. * @pdev: pdev obj
  158. * @tx_block: dfs cac tx block
  159. *
  160. * Return: void
  161. */
  162. void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block);
  163. /**
  164. * ucfg_ipa_set_ap_ibss_fwd() - Set AP intra bss forward
  165. * @pdev: pdev obj
  166. * @intra_bss: enable or disable ap intra bss forward
  167. *
  168. * Return: void
  169. */
  170. void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, bool intra_bss);
  171. /**
  172. * ucfg_ipa_uc_force_pipe_shutdown() - Force shutdown IPA pipe
  173. * @pdev: pdev obj
  174. *
  175. * Return: void
  176. */
  177. void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev);
  178. /**
  179. * ucfg_ipa_flush() - flush IPA exception path SKB's
  180. * @pdev: pdev obj
  181. *
  182. * Return: None
  183. */
  184. void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev);
  185. /**
  186. * ucfg_ipa_suspend() - Suspend IPA
  187. * @pdev: pdev obj
  188. *
  189. * Return: QDF STATUS
  190. */
  191. QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev);
  192. /**
  193. * ucfg_ipa_resume() - Resume IPA
  194. * @pdev: pdev obj
  195. *
  196. * Return: QDF STATUS
  197. */
  198. QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev);
  199. /**
  200. * ucfg_ipa_uc_ol_init() - Initialize IPA uC offload
  201. * @pdev: pdev obj
  202. * @osdev: OS dev
  203. *
  204. * Return: QDF STATUS
  205. */
  206. QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
  207. qdf_device_t osdev);
  208. /**
  209. * ucfg_ipa_uc_ol_deinit() - Deinitialize IPA uC offload
  210. * @pdev: pdev obj
  211. *
  212. * Return: QDF STATUS
  213. */
  214. QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev);
  215. /**
  216. * ucfg_ipa_is_tx_pending() - Check if IPA WLAN TX completions are pending
  217. * @pdev: pdev obj
  218. *
  219. * Return: bool if pending TX for IPA.
  220. */
  221. bool ucfg_ipa_is_tx_pending(struct wlan_objmgr_pdev *pdev);
  222. /**
  223. * ucfg_ipa_send_mcc_scc_msg() - Send IPA WLAN_SWITCH_TO_MCC/SCC message
  224. * @mcc_mode: 0=MCC/1=SCC
  225. *
  226. * Return: QDF STATUS
  227. */
  228. QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
  229. bool mcc_mode);
  230. /**
  231. * ucfg_ipa_wlan_evt() - IPA event handler
  232. * @pdev: pdev obj
  233. * @net_dev: Interface net device
  234. * @device_mode: Net interface device mode
  235. * @session_id: session id for the event
  236. * @type: event enum of type ipa_wlan_event
  237. * @mac_address: MAC address associated with the event
  238. *
  239. * Return: QDF_STATUS
  240. */
  241. QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
  242. qdf_netdev_t net_dev, uint8_t device_mode,
  243. uint8_t session_id,
  244. enum wlan_ipa_wlan_event ipa_event_type,
  245. uint8_t *mac_addr);
  246. /**
  247. * ucfg_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC
  248. * @map: Map / unmap operation
  249. * @num_buf: Number of buffers in array
  250. * @buf_arr: Buffer array of DMA mem mapping info
  251. *
  252. * Return: Status of map operation
  253. */
  254. int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
  255. /**
  256. * ucfg_ipa_is_fw_wdi_activated - Is FW WDI activated?
  257. * @pdev: pdev obj
  258. *
  259. * Return: true if FW WDI activated, false otherwise
  260. */
  261. bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev);
  262. /**
  263. * ucfg_ipa_uc_cleanup_sta() - disconnect and cleanup sta iface
  264. * @pdev: pdev obj
  265. * @net_dev: Interface net device
  266. *
  267. * Send disconnect sta event to IPA driver and cleanup IPA iface,
  268. * if not yet done
  269. *
  270. * Return: void
  271. */
  272. void ucfg_ipa_uc_cleanup_sta(struct wlan_objmgr_pdev *pdev,
  273. qdf_netdev_t net_dev);
  274. /**
  275. * ucfg_ipa_uc_disconnect_ap() - send ap disconnect event
  276. * @pdev: pdev obj
  277. * @net_dev: Interface net device
  278. *
  279. * Send disconnect ap event to IPA driver during SSR
  280. *
  281. * Return: QDF_STATUS
  282. */
  283. QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
  284. qdf_netdev_t net_dev);
  285. /**
  286. * ucfg_ipa_cleanup_dev_iface() - Clean up net dev IPA interface
  287. * @pdev: pdev obj
  288. * @net_dev: Interface net device
  289. *
  290. *
  291. * Return: None
  292. */
  293. void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
  294. qdf_netdev_t net_dev);
  295. /**
  296. * ucfg_ipa_uc_ssr_cleanup() - Handle IPA cleanup for SSR
  297. * @pdev: pdev obj
  298. *
  299. * From hostside do cleanup such as deregister IPA interafces
  300. * and send disconnect events so that it will be sync after SSR
  301. *
  302. * Return: None
  303. */
  304. void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev);
  305. /**
  306. * ucfg_ipa_fw_rejuvenate_send_msg() - Send msg to IPA driver in FW rejuvenate
  307. * @pdev: pdev obj
  308. *
  309. * Return: None
  310. */
  311. void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev);
  312. /**
  313. * ucfg_ipa_component_config_update() - update IPA component config
  314. * @psoc: pointer to psoc object
  315. *
  316. * Return: None
  317. */
  318. void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc);
  319. /**
  320. * ucfg_get_ipa_tx_buf_count() - get IPA tx buffer count
  321. *
  322. * Return: IPA tx buffer count
  323. */
  324. uint32_t ucfg_ipa_get_tx_buf_count(void);
  325. /**
  326. * ucfg_ipa_update_tx_stats() - send embedded tx traffic in bytes to IPA
  327. * @pdev: pdev obj
  328. * @sta_tx: tx in bytes on sta vdev
  329. * @ap_tx: tx in bytes on sap vdev
  330. *
  331. * Return: void
  332. */
  333. void ucfg_ipa_update_tx_stats(struct wlan_objmgr_pdev *pdev, uint64_t sta_tx,
  334. uint64_t ap_tx);
  335. #else
  336. static inline bool ucfg_ipa_is_present(void)
  337. {
  338. return false;
  339. }
  340. static inline void ucfg_ipa_update_config(struct wlan_ipa_config *config)
  341. {
  342. }
  343. static inline bool ucfg_ipa_is_enabled(void)
  344. {
  345. return false;
  346. }
  347. static inline bool ucfg_ipa_uc_is_enabled(void)
  348. {
  349. return false;
  350. }
  351. static inline
  352. QDF_STATUS ucfg_ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc,
  353. void *dp_soc)
  354. {
  355. return QDF_STATUS_SUCCESS;
  356. }
  357. static inline
  358. QDF_STATUS ucfg_ipa_set_pdev_id(struct wlan_objmgr_psoc *psoc,
  359. uint8_t pdev_id)
  360. {
  361. return QDF_STATUS_SUCCESS;
  362. }
  363. static inline
  364. QDF_STATUS ucfg_ipa_set_perf_level(struct wlan_objmgr_pdev *pdev,
  365. uint64_t tx_packets, uint64_t rx_packets)
  366. {
  367. return QDF_STATUS_SUCCESS;
  368. }
  369. static inline
  370. void ucfg_ipa_uc_info(struct wlan_objmgr_pdev *pdev)
  371. {
  372. }
  373. static inline
  374. void ucfg_ipa_uc_stat(struct wlan_objmgr_pdev *pdev)
  375. {
  376. }
  377. static inline
  378. void ucfg_ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev)
  379. {
  380. }
  381. static inline
  382. void ucfg_ipa_dump_info(struct wlan_objmgr_pdev *pdev)
  383. {
  384. }
  385. static inline
  386. void ucfg_ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
  387. uint8_t reason)
  388. {
  389. }
  390. static inline
  391. void ucfg_ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
  392. uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff)
  393. {
  394. }
  395. static inline
  396. void ucfg_ipa_reg_sap_xmit_cb(struct wlan_objmgr_pdev *pdev,
  397. wlan_ipa_softap_xmit cb)
  398. {
  399. }
  400. static inline
  401. void ucfg_ipa_reg_send_to_nw_cb(struct wlan_objmgr_pdev *pdev,
  402. wlan_ipa_send_to_nw cb)
  403. {
  404. }
  405. static inline
  406. void ucfg_ipa_set_mcc_mode(struct wlan_objmgr_pdev *pdev, bool mcc_mode)
  407. {
  408. }
  409. static inline
  410. void ucfg_ipa_set_dfs_cac_tx(struct wlan_objmgr_pdev *pdev, bool tx_block)
  411. {
  412. }
  413. static inline
  414. void ucfg_ipa_set_ap_ibss_fwd(struct wlan_objmgr_pdev *pdev, bool intra_bss)
  415. {
  416. }
  417. static inline
  418. void ucfg_ipa_uc_force_pipe_shutdown(struct wlan_objmgr_pdev *pdev)
  419. {
  420. }
  421. static inline
  422. void ucfg_ipa_flush(struct wlan_objmgr_pdev *pdev)
  423. {
  424. }
  425. static inline
  426. QDF_STATUS ucfg_ipa_suspend(struct wlan_objmgr_pdev *pdev)
  427. {
  428. return QDF_STATUS_SUCCESS;
  429. }
  430. static inline
  431. QDF_STATUS ucfg_ipa_resume(struct wlan_objmgr_pdev *pdev)
  432. {
  433. return QDF_STATUS_SUCCESS;
  434. }
  435. static inline
  436. QDF_STATUS ucfg_ipa_uc_ol_init(struct wlan_objmgr_pdev *pdev,
  437. qdf_device_t osdev)
  438. {
  439. return QDF_STATUS_SUCCESS;
  440. }
  441. static inline
  442. QDF_STATUS ucfg_ipa_uc_ol_deinit(struct wlan_objmgr_pdev *pdev)
  443. {
  444. return QDF_STATUS_SUCCESS;
  445. }
  446. static inline bool ucfg_ipa_is_tx_pending(struct wlan_objmgr_pdev *pdev)
  447. {
  448. return false;
  449. }
  450. static inline
  451. QDF_STATUS ucfg_ipa_send_mcc_scc_msg(struct wlan_objmgr_pdev *pdev,
  452. bool mcc_mode)
  453. {
  454. return QDF_STATUS_SUCCESS;
  455. }
  456. static inline
  457. QDF_STATUS ucfg_ipa_wlan_evt(struct wlan_objmgr_pdev *pdev,
  458. qdf_netdev_t net_dev, uint8_t device_mode,
  459. uint8_t session_id,
  460. enum wlan_ipa_wlan_event ipa_event_type,
  461. uint8_t *mac_addr)
  462. {
  463. return QDF_STATUS_SUCCESS;
  464. }
  465. static inline
  466. int ucfg_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr)
  467. {
  468. return 0;
  469. }
  470. static inline
  471. bool ucfg_ipa_is_fw_wdi_activated(struct wlan_objmgr_pdev *pdev)
  472. {
  473. return false;
  474. }
  475. static inline
  476. void ucfg_ipa_uc_cleanup_sta(struct wlan_objmgr_pdev *pdev,
  477. qdf_netdev_t net_dev)
  478. {
  479. }
  480. static inline
  481. QDF_STATUS ucfg_ipa_uc_disconnect_ap(struct wlan_objmgr_pdev *pdev,
  482. qdf_netdev_t net_dev)
  483. {
  484. return QDF_STATUS_SUCCESS;
  485. }
  486. static inline
  487. void ucfg_ipa_cleanup_dev_iface(struct wlan_objmgr_pdev *pdev,
  488. qdf_netdev_t net_dev)
  489. {
  490. }
  491. static inline
  492. void ucfg_ipa_uc_ssr_cleanup(struct wlan_objmgr_pdev *pdev)
  493. {
  494. }
  495. static inline
  496. void ucfg_ipa_fw_rejuvenate_send_msg(struct wlan_objmgr_pdev *pdev)
  497. {
  498. }
  499. static inline
  500. void ucfg_ipa_component_config_update(struct wlan_objmgr_psoc *psoc)
  501. {
  502. }
  503. static inline
  504. uint32_t ucfg_ipa_get_tx_buf_count(void)
  505. {
  506. return 0;
  507. }
  508. static inline
  509. void ucfg_ipa_update_tx_stats(struct wlan_objmgr_pdev *pdev, uint64_t sta_tx,
  510. uint64_t ap_tx)
  511. {
  512. }
  513. #endif /* IPA_OFFLOAD */
  514. #endif /* _WLAN_IPA_UCFG_API_H_ */