blob: 825d104426d1d957de72c8b8d218087eab1854cd [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Arun Khandavallicc544b32017-01-30 19:52:16 +05302 * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#ifndef HDD_IPA_H__
29#define HDD_IPA_H__
30
31/**
32 * DOC: wlan_hdd_ipa.h
33 *
34 * WLAN IPA interface module headers
35 * Originally written by Qualcomm Atheros, Inc
36 */
37
Jeff Johnsondd595cb2017-08-28 11:58:09 -070038struct hdd_context;
39
Mohit Khannafa99aea2016-05-12 21:43:13 -070040/**
41 * enum hdd_ipa_wlan_event - HDD IPA events
42 * @HDD_IPA_CLIENT_CONNECT: Client Connects
43 * @HDD_IPA_CLIENT_DISCONNECT: Client Disconnects
44 * @HDD_IPA_AP_CONNECT: SoftAP is started
45 * @HDD_IPA_AP_DISCONNECT: SoftAP is stopped
46 * @HDD_IPA_STA_CONNECT: STA associates to AP
47 * @HDD_IPA_STA_DISCONNECT: STA dissociates from AP
48 * @HDD_IPA_CLIENT_CONNECT_EX: Peer associates/re-associates to softap
49 * @HDD_IPA_WLAN_EVENT_MAX: Max value for the enum
50 */
51enum hdd_ipa_wlan_event {
52 HDD_IPA_CLIENT_CONNECT,
53 HDD_IPA_CLIENT_DISCONNECT,
54 HDD_IPA_AP_CONNECT,
55 HDD_IPA_AP_DISCONNECT,
56 HDD_IPA_STA_CONNECT,
57 HDD_IPA_STA_DISCONNECT,
58 HDD_IPA_CLIENT_CONNECT_EX,
59 HDD_IPA_WLAN_EVENT_MAX
60};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080061
62#ifdef IPA_OFFLOAD
Houston Hoffman43d47fa2016-02-24 16:34:30 -080063
64/**
Prakash Dhavali87b38e32016-11-14 16:22:53 -080065 * enum hdd_ipa_forward_type: Type of forward packet received from IPA
66 * @HDD_IPA_FORWARD_PKT_NONE: No forward packet
67 * @HDD_IPA_FORWARD_PKT_LOCAL_STACK: Packet forwarded to kernel network stack
68 * @HDD_IPA_FORWARD_PKT_DISCARD: Discarded packet before sending to kernel stack
69 */
70enum hdd_ipa_forward_type {
71 HDD_IPA_FORWARD_PKT_NONE = 0,
72 HDD_IPA_FORWARD_PKT_LOCAL_STACK = 1,
73 HDD_IPA_FORWARD_PKT_DISCARD = 2
74};
75
76/**
Houston Hoffman43d47fa2016-02-24 16:34:30 -080077 * FIXME: Temporary hack - until IPA functionality gets restored
78 *
79 */
Nirav Shahcbc6d722016-03-01 16:24:53 +053080typedef void (*hdd_ipa_nbuf_cb_fn)(qdf_nbuf_t);
81void hdd_ipa_nbuf_cb(qdf_nbuf_t skb); /* Fwd declare */
Houston Hoffman43d47fa2016-02-24 16:34:30 -080082static inline hdd_ipa_nbuf_cb_fn wlan_hdd_stub_ipa_fn(void)
83{
84 return hdd_ipa_nbuf_cb;
85};
86
Jeff Johnsondd595cb2017-08-28 11:58:09 -070087QDF_STATUS hdd_ipa_init(struct hdd_context *hdd_ctx);
88QDF_STATUS hdd_ipa_cleanup(struct hdd_context *hdd_ctx);
Govind Singh1dab23b2017-08-12 13:31:00 +053089void hdd_ipa_flush(struct hdd_context *hdd_ctx);
Nirav Shahcbc6d722016-03-01 16:24:53 +053090QDF_STATUS hdd_ipa_process_rxt(void *cds_context, qdf_nbuf_t rxBuf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080091 uint8_t sta_id);
Jeff Johnson49d45e62017-08-29 14:30:42 -070092int hdd_ipa_wlan_evt(struct hdd_adapter *adapter, uint8_t sta_id,
Mohit Khannafa99aea2016-05-12 21:43:13 -070093 enum hdd_ipa_wlan_event type, uint8_t *mac_addr);
Jeff Johnsondd595cb2017-08-28 11:58:09 -070094int hdd_ipa_set_perf_level(struct hdd_context *hdd_ctx, uint64_t tx_packets,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080095 uint64_t rx_packets);
Jeff Johnsondd595cb2017-08-28 11:58:09 -070096int hdd_ipa_suspend(struct hdd_context *hdd_ctx);
97int hdd_ipa_resume(struct hdd_context *hdd_ctx);
98void hdd_ipa_uc_stat_query(struct hdd_context *hdd_ctx, uint32_t *ipa_tx_diff,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080099 uint32_t *ipa_rx_diff);
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700100void hdd_ipa_uc_rt_debug_host_dump(struct hdd_context *hdd_ctx);
Jeff Johnson49d45e62017-08-29 14:30:42 -0700101void hdd_ipa_uc_stat_request(struct hdd_adapter *adapter, uint8_t reason);
102void hdd_ipa_uc_sharing_stats_request(struct hdd_adapter *adapter,
Yun Park637d6482016-10-05 10:51:33 -0700103 uint8_t reset_stats);
Jeff Johnson49d45e62017-08-29 14:30:42 -0700104void hdd_ipa_uc_set_quota(struct hdd_adapter *adapter, uint8_t set_quota,
Yun Park637d6482016-10-05 10:51:33 -0700105 uint64_t quota_bytes);
Jeff Johnson2c4a93f2017-09-03 08:51:14 -0700106bool hdd_ipa_is_enabled(struct hdd_context *hdd_ctx);
107bool hdd_ipa_uc_is_enabled(struct hdd_context *hdd_ctx);
Yun Parka27049a2016-10-11 12:30:49 -0700108#ifndef QCA_LL_TX_FLOW_CONTROL_V2
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700109int hdd_ipa_send_mcc_scc_msg(struct hdd_context *hdd_ctx, bool mcc_mode);
Yun Parka27049a2016-10-11 12:30:49 -0700110#else
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700111static inline int hdd_ipa_send_mcc_scc_msg(struct hdd_context *hdd_ctx,
Yun Parka27049a2016-10-11 12:30:49 -0700112 bool mcc_mode)
113{
114 return 0;
115}
116#endif
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700117int hdd_ipa_uc_ssr_reinit(struct hdd_context *hdd_ctx);
Leo Change3e49442015-10-26 20:07:13 -0700118int hdd_ipa_uc_ssr_deinit(void);
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700119void hdd_ipa_uc_force_pipe_shutdown(struct hdd_context *hdd_ctx);
120struct sk_buff *hdd_ipa_tx_packet_ipa(struct hdd_context *hdd_ctx,
Leo Chang3bc8fed2015-11-13 10:59:47 -0800121 struct sk_buff *skb, uint8_t session_id);
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700122bool hdd_ipa_is_present(struct hdd_context *hdd_ctx);
123void hdd_ipa_dump_info(struct hdd_context *hdd_ctx);
124QDF_STATUS hdd_ipa_uc_ol_init(struct hdd_context *hdd_ctx);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -0800125void hdd_ipa_set_tx_flow_info(void);
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700126int hdd_ipa_uc_ol_deinit(struct hdd_context *hdd_ctx);
Yun Park46255682017-10-09 15:56:34 -0700127
128/**
129 * hdd_ipa_uc_stat() - Print IPA uC stats
130 * @adapter: network adapter
131 *
132 * Return: None
133 */
134void hdd_ipa_uc_stat(struct hdd_adapter *adapter);
135
136/**
137 * hdd_ipa_uc_info() - Print IPA uC resource and session information
138 * @adapter: network adapter
139 *
140 * Return: None
141 */
142void hdd_ipa_uc_info(struct hdd_context *hdd_ctx);
143
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800144#else
Yun Park46255682017-10-09 15:56:34 -0700145
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700146static inline QDF_STATUS hdd_ipa_init(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800147{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530148 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800149}
150
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700151static inline QDF_STATUS hdd_ipa_cleanup(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800152{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530153 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800154}
155
Govind Singh1dab23b2017-08-12 13:31:00 +0530156static inline void hdd_ipa_flush(struct hdd_context *hdd_ctx)
157{
158}
159
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530160static inline QDF_STATUS hdd_ipa_process_rxt(void *cds_context,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530161 qdf_nbuf_t rxBuf, uint8_t sta_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800162{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530163 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800164}
165
Jeff Johnson49d45e62017-08-29 14:30:42 -0700166static inline int hdd_ipa_wlan_evt(struct hdd_adapter *adapter, uint8_t sta_id,
Mohit Khannafa99aea2016-05-12 21:43:13 -0700167 enum hdd_ipa_wlan_event type, uint8_t *mac_addr)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800168{
169 return 0;
170}
171
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700172static inline int hdd_ipa_send_mcc_scc_msg(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800173 bool mcc_mode)
174{
175 return 0;
176}
177
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700178static inline int hdd_ipa_set_perf_level(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800179 uint64_t tx_packets,
180 uint64_t rx_packets)
181{
182 return 0;
183}
184
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700185static inline int hdd_ipa_suspend(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800186{
187 return 0;
188}
189
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700190static inline int hdd_ipa_resume(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800191{
192 return 0;
193}
194
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700195static inline void hdd_ipa_uc_stat_query(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800196 uint32_t *ipa_tx_diff,
197 uint32_t *ipa_rx_diff)
198{
199 *ipa_tx_diff = 0;
200 *ipa_rx_diff = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800201}
202
Jeff Johnson49d45e62017-08-29 14:30:42 -0700203static inline void hdd_ipa_uc_stat_request(struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800204 uint8_t reason)
205{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800206}
207
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700208static inline void hdd_ipa_uc_rt_debug_host_dump(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800209{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800210}
211
Jeff Johnson2c4a93f2017-09-03 08:51:14 -0700212static inline bool hdd_ipa_is_enabled(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800213{
214 return false;
215}
216
Jeff Johnson2c4a93f2017-09-03 08:51:14 -0700217static inline bool hdd_ipa_uc_is_enabled(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800218{
219 return false;
220}
Yun Parkb187d542016-11-14 18:10:04 -0800221
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700222static inline void hdd_ipa_dump_info(struct hdd_context *hdd_ctx)
Yun Parkb187d542016-11-14 18:10:04 -0800223{
Yun Parkb187d542016-11-14 18:10:04 -0800224}
225
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700226static inline int hdd_ipa_uc_ssr_reinit(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800227{
228 return false;
229}
230
231static inline int hdd_ipa_uc_ssr_deinit(void)
232{
233 return false;
234}
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700235static inline void hdd_ipa_uc_force_pipe_shutdown(struct hdd_context *hdd_ctx)
Leo Change3e49442015-10-26 20:07:13 -0700236{
Leo Change3e49442015-10-26 20:07:13 -0700237}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800238
Leo Chang3bc8fed2015-11-13 10:59:47 -0800239/**
240 * hdd_ipa_tx_packet_ipa() - send packet to IPA
241 * @hdd_ctx: Global HDD context
242 * @skb: skb sent to IPA
243 * @session_id: send packet instance session id
244 *
245 * Send TX packet which generated by system to IPA.
246 * This routine only will be used for function verification
247 *
248 * Return: NULL packet sent to IPA properly
249 * skb packet not sent to IPA. legacy data path should handle
250 */
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700251static inline struct sk_buff *hdd_ipa_tx_packet_ipa(struct hdd_context *hdd_ctx,
Leo Chang3bc8fed2015-11-13 10:59:47 -0800252 struct sk_buff *skb, uint8_t session_id)
253{
254 return skb;
255}
Leo Chang11545d62016-10-17 14:53:50 -0700256
257/**
258 * hdd_ipa_is_present() - get IPA hw status
259 * @hdd_ctx: pointer to hdd context
260 *
261 * ipa_uc_reg_rdyCB is not directly designed to check
262 * ipa hw status. This is an undocumented function which
263 * has confirmed with IPA team.
264 *
265 * Return: true - ipa hw present
266 * false - ipa hw not present
267 */
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700268static inline bool hdd_ipa_is_present(struct hdd_context *hdd_ctx)
Leo Chang11545d62016-10-17 14:53:50 -0700269{
270 return false;
271}
Manikandan Mohanbb8a7ee2017-02-09 11:26:53 -0800272
273/**
274 * hdd_ipa_uc_ol_init() - Initialize IPA uC offload
275 * @hdd_ctx: Global HDD context
276 *
277 * Return: QDF_STATUS
278 */
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700279static inline QDF_STATUS hdd_ipa_uc_ol_init(struct hdd_context *hdd_ctx)
Manikandan Mohanbb8a7ee2017-02-09 11:26:53 -0800280{
281 return QDF_STATUS_SUCCESS;
282}
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -0800283
284static inline void hdd_ipa_set_tx_flow_info(void)
285{
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -0800286}
287
Sravan Kumar Kairam71121712017-04-15 00:34:42 +0530288/**
289 * hdd_ipa_uc_ol_deinit() - Disconnect IPA TX and RX pipes
290 * @hdd_ctx: Global HDD context
291 *
292 * Return: 0 on success, negativer errno on error
293 */
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700294static inline int hdd_ipa_uc_ol_deinit(struct hdd_context *hdd_ctx)
Sravan Kumar Kairam71121712017-04-15 00:34:42 +0530295{
296 return 0;
297}
Yun Park46255682017-10-09 15:56:34 -0700298
299/**
300 * hdd_ipa_uc_stat() - Print IPA uC stats
301 * @adapter: network adapter
302 *
303 * Return: None
304 */
305static inline void hdd_ipa_uc_stat(struct hdd_adapter *adapter)
306{
307}
308
309/**
310 * hdd_ipa_uc_info() - Print IPA uC resource and session information
311 * @adapter: network adapter
312 *
313 * Return: None
314 */
315static inline void hdd_ipa_uc_info(struct hdd_context *hdd_ctx)
316{
317}
318
Leo Chang3bc8fed2015-11-13 10:59:47 -0800319#endif /* IPA_OFFLOAD */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800320#endif /* #ifndef HDD_IPA_H__ */