blob: b8e5aa5b17f451cad11cdd1c0dafbb4e53c01aad [file] [log] [blame]
Sravan Kumar Kairam4af61cf2018-02-22 17:53:44 +05301/*
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 various api which shall be used by
20 * IPA user configuration and target interface
21 */
22
23#ifndef _WLAN_IPA_MAIN_H_
24#define _WLAN_IPA_MAIN_H_
25
26#ifdef IPA_OFFLOAD
27
28#include <wlan_objmgr_psoc_obj.h>
29#include <wlan_objmgr_pdev_obj.h>
30#include <wlan_ipa_public_struct.h>
31#include <wlan_ipa_priv.h>
32
33#define ipa_log(level, args...) QDF_TRACE(QDF_MODULE_ID_IPA, level, ## args)
34#define ipa_logfl(level, format, args...) ipa_log(level, FL(format), ## args)
35
36#define ipa_fatal(format, args...) \
37 ipa_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
38#define ipa_err(format, args...) \
39 ipa_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
40#define ipa_warn(format, args...) \
41 ipa_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
42#define ipa_info(format, args...) \
43 ipa_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
44#define ipa_debug(format, args...) \
45 ipa_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
46
47#define IPA_ENTER() ipa_debug("enter")
48#define IPA_EXIT() ipa_debug("exit")
49
50/**
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +053051 * ipa_check_hw_present() - get IPA hw status
Sravan Kumar Kairam4af61cf2018-02-22 17:53:44 +053052 *
53 * ipa_uc_reg_rdyCB is not directly designed to check
54 * ipa hw status. This is an undocumented function which
55 * has confirmed with IPA team.
56 *
57 * Return: true - ipa hw present
58 * false - ipa hw not present
59 */
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +053060bool ipa_check_hw_present(void);
Sravan Kumar Kairam4af61cf2018-02-22 17:53:44 +053061
62/**
63 * wlan_get_pdev_ipa_obj() - private API to get ipa pdev object
64 * @pdev: pdev object
65 *
66 * Return: ipa object
67 */
68static inline struct wlan_ipa_priv *
69ipa_pdev_get_priv_obj(struct wlan_objmgr_pdev *pdev)
70{
71 struct wlan_ipa_priv *pdev_obj;
72
73 pdev_obj = (struct wlan_ipa_priv *)
74 wlan_objmgr_pdev_get_comp_private_obj(pdev,
75 WLAN_UMAC_COMP_IPA);
76
77 return pdev_obj;
78}
79
80/**
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +053081 * ipa_is_hw_support() - Is IPA HW support?
82 *
83 * Return: true if IPA HW is present or false otherwise
84 */
85bool ipa_is_hw_support(void);
86
87/**
88 * ipa_config_mem_alloc() - IPA config allocation
89 *
90 * Return: QDF_STATUS_SUCCESS on success
91 */
92QDF_STATUS ipa_config_mem_alloc(void);
93
94/**
95 * ipa_config_mem_free() - IPA config mem free
96 *
97 * Return: None
98 */
99void ipa_config_mem_free(void);
100
101/**
102 * ipa_config_update() - IPA component config update
103 * @config: IPA config
104 *
105 * Return: None
106 */
107void ipa_config_update(struct wlan_ipa_config *config);
108
109/**
110 * ipa_config_is_enabled() - Is IPA config enabled?
111 *
112 * Return: true if IPA is enabled in IPA config
113 */
114bool ipa_config_is_enabled(void);
115
116/**
117 * ipa_obj_setup() - IPA obj initialization and setup
118 * @ipa_ctx: IPA obj context
119 *
120 * Return: QDF_STATUS_SUCCESS on success
121 */
122QDF_STATUS ipa_obj_setup(struct wlan_ipa_priv *ipa_ctx);
123
124/**
125 * ipa_obj_cleanup() - IPA obj cleanup
126 * @ipa_ctx: IPA obj context
127 *
128 * Return: QDF_STATUS_SUCCESS on success
129 */
130QDF_STATUS ipa_obj_cleanup(struct wlan_ipa_priv *ipa_ctx);
131
132/**
Sravan Kumar Kairam4af61cf2018-02-22 17:53:44 +0530133 * ipa_send_uc_offload_enable_disable() - wdi enable/disable notify to fw
134 * @pdev: objmgr pdev object
135 * @req: ipa offload control request
136 *
137 * Return: QDF status success or failure
138 */
139QDF_STATUS ipa_send_uc_offload_enable_disable(struct wlan_objmgr_pdev *pdev,
140 struct ipa_uc_offload_control_params *req);
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +0530141
142/**
143 * ipa_set_dp_handle() - set dp soc handle
144 * @psoc: psoc handle
145 * @dp_soc: dp soc handle
146 *
147 * Return: None
148 */
149void ipa_set_dp_handle(struct wlan_objmgr_psoc *psoc, void *dp_soc);
150
151/**
152 * ipa_set_txrx_handle() - set dp txrx handle
153 * @psoc: psoc handle
154 * @txrx_handle: dp txrx handle
155 *
156 * Return: None
157 */
158void ipa_set_txrx_handle(struct wlan_objmgr_psoc *psoc, void *txrx_handle);
Sravan Kumar Kairam9e99e9a2018-03-12 19:09:45 +0530159
160/**
161 * ipa_rm_set_perf_level() - set ipa rm perf level
162 * @pdev: pdev handle
163 * @tx_packets: packets transmitted in the last sample period
164 * @rx_packets: packets received in the last sample period
165 *
166 * Return: QDF_STATUS
167 */
168QDF_STATUS ipa_rm_set_perf_level(struct wlan_objmgr_pdev *pdev,
169 uint64_t tx_packets, uint64_t rx_packets);
Sravan Kumar Kairam271fab22018-03-07 18:57:41 +0530170
171/**
172 * ipa_uc_info() - Print IPA uC resource and session information
173 * @pdev: pdev obj
174 *
175 * Return: None
176 */
177void ipa_uc_info(struct wlan_objmgr_pdev *pdev);
178
179/**
180 * ipa_uc_stat() - Print IPA uC stats
181 * @pdev: pdev obj
182 *
183 * Return: None
184 */
185void ipa_uc_stat(struct wlan_objmgr_pdev *pdev);
186
187/**
188 * ipa_uc_rt_debug_host_dump() - IPA rt debug host dump
189 * @pdev: pdev obj
190 *
191 * Return: None
192 */
193void ipa_uc_rt_debug_host_dump(struct wlan_objmgr_pdev *pdev);
194
195/**
196 * ipa_dump_info() - Dump IPA context information
197 * @pdev: pdev obj
198 *
199 * Return: None
200 */
201void ipa_dump_info(struct wlan_objmgr_pdev *pdev);
202
203/**
204 * ipa_uc_stat_request() - Get IPA stats from IPA.
205 * @pdev: pdev obj
206 * @reason: STAT REQ Reason
207 *
208 * Return: None
209 */
210void ipa_uc_stat_request(struct wlan_objmgr_pdev *pdev,
211 uint8_t reason);
212
213/**
214 * ipa_uc_stat_query() - Query the IPA stats
215 * @pdev: pdev obj
216 * @ipa_tx_diff: tx packet count diff from previous tx packet count
217 * @ipa_rx_diff: rx packet count diff from previous rx packet count
218 *
219 * Return: None
220 */
221void ipa_uc_stat_query(struct wlan_objmgr_pdev *pdev,
222 uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff);
223
Sravan Kumar Kairam4af61cf2018-02-22 17:53:44 +0530224#endif /* IPA_OFFLOAD */
225#endif /* end of _WLAN_IPA_MAIN_H_ */