blob: 4e3bae9604fa939ca0a5e22560f4a11e21bc3799 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Himanshu Agarwaledf30dc2017-06-05 15:54:27 +05302 * Copyright (c) 2013-2018 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
Himanshu Agarwaledf30dc2017-06-05 15:54:27 +0530144/**
145 * hdd_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC
146 * @map: Map / unmap operation
147 * @num_buf: Number of buffers in array
148 * @buf_arr: Buffer array of DMA mem mapping info
149 *
150 * This API maps/unmaps WLAN-IPA buffers if SMMU S1 translation
151 * is enabled.
152 *
153 * Return: Status of map operation
154 */
155int hdd_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800156#else
Yun Park46255682017-10-09 15:56:34 -0700157
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700158static inline QDF_STATUS hdd_ipa_init(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800159{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530160 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800161}
162
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700163static inline QDF_STATUS hdd_ipa_cleanup(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800164{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530165 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800166}
167
Govind Singh1dab23b2017-08-12 13:31:00 +0530168static inline void hdd_ipa_flush(struct hdd_context *hdd_ctx)
169{
170}
171
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530172static inline QDF_STATUS hdd_ipa_process_rxt(void *cds_context,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530173 qdf_nbuf_t rxBuf, uint8_t sta_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800174{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530175 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800176}
177
Jeff Johnson49d45e62017-08-29 14:30:42 -0700178static inline int hdd_ipa_wlan_evt(struct hdd_adapter *adapter, uint8_t sta_id,
Mohit Khannafa99aea2016-05-12 21:43:13 -0700179 enum hdd_ipa_wlan_event type, uint8_t *mac_addr)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800180{
181 return 0;
182}
183
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700184static inline int hdd_ipa_send_mcc_scc_msg(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185 bool mcc_mode)
186{
187 return 0;
188}
189
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700190static inline int hdd_ipa_set_perf_level(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800191 uint64_t tx_packets,
192 uint64_t rx_packets)
193{
194 return 0;
195}
196
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700197static inline int hdd_ipa_suspend(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800198{
199 return 0;
200}
201
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700202static inline int hdd_ipa_resume(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800203{
204 return 0;
205}
206
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700207static inline void hdd_ipa_uc_stat_query(struct hdd_context *hdd_ctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800208 uint32_t *ipa_tx_diff,
209 uint32_t *ipa_rx_diff)
210{
211 *ipa_tx_diff = 0;
212 *ipa_rx_diff = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800213}
214
Jeff Johnson49d45e62017-08-29 14:30:42 -0700215static inline void hdd_ipa_uc_stat_request(struct hdd_adapter *adapter,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800216 uint8_t reason)
217{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800218}
219
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700220static inline void hdd_ipa_uc_rt_debug_host_dump(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800221{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800222}
223
Jeff Johnson2c4a93f2017-09-03 08:51:14 -0700224static inline bool hdd_ipa_is_enabled(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800225{
226 return false;
227}
228
Jeff Johnson2c4a93f2017-09-03 08:51:14 -0700229static inline bool hdd_ipa_uc_is_enabled(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800230{
231 return false;
232}
Yun Parkb187d542016-11-14 18:10:04 -0800233
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700234static inline void hdd_ipa_dump_info(struct hdd_context *hdd_ctx)
Yun Parkb187d542016-11-14 18:10:04 -0800235{
Yun Parkb187d542016-11-14 18:10:04 -0800236}
237
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700238static inline int hdd_ipa_uc_ssr_reinit(struct hdd_context *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800239{
240 return false;
241}
242
243static inline int hdd_ipa_uc_ssr_deinit(void)
244{
245 return false;
246}
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700247static inline void hdd_ipa_uc_force_pipe_shutdown(struct hdd_context *hdd_ctx)
Leo Change3e49442015-10-26 20:07:13 -0700248{
Leo Change3e49442015-10-26 20:07:13 -0700249}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800250
Leo Chang3bc8fed2015-11-13 10:59:47 -0800251/**
252 * hdd_ipa_tx_packet_ipa() - send packet to IPA
253 * @hdd_ctx: Global HDD context
254 * @skb: skb sent to IPA
255 * @session_id: send packet instance session id
256 *
257 * Send TX packet which generated by system to IPA.
258 * This routine only will be used for function verification
259 *
260 * Return: NULL packet sent to IPA properly
261 * skb packet not sent to IPA. legacy data path should handle
262 */
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700263static inline struct sk_buff *hdd_ipa_tx_packet_ipa(struct hdd_context *hdd_ctx,
Leo Chang3bc8fed2015-11-13 10:59:47 -0800264 struct sk_buff *skb, uint8_t session_id)
265{
266 return skb;
267}
Leo Chang11545d62016-10-17 14:53:50 -0700268
269/**
270 * hdd_ipa_is_present() - get IPA hw status
271 * @hdd_ctx: pointer to hdd context
272 *
273 * ipa_uc_reg_rdyCB is not directly designed to check
274 * ipa hw status. This is an undocumented function which
275 * has confirmed with IPA team.
276 *
277 * Return: true - ipa hw present
278 * false - ipa hw not present
279 */
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700280static inline bool hdd_ipa_is_present(struct hdd_context *hdd_ctx)
Leo Chang11545d62016-10-17 14:53:50 -0700281{
282 return false;
283}
Manikandan Mohanbb8a7ee2017-02-09 11:26:53 -0800284
285/**
286 * hdd_ipa_uc_ol_init() - Initialize IPA uC offload
287 * @hdd_ctx: Global HDD context
288 *
289 * Return: QDF_STATUS
290 */
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700291static inline QDF_STATUS hdd_ipa_uc_ol_init(struct hdd_context *hdd_ctx)
Manikandan Mohanbb8a7ee2017-02-09 11:26:53 -0800292{
293 return QDF_STATUS_SUCCESS;
294}
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -0800295
296static inline void hdd_ipa_set_tx_flow_info(void)
297{
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -0800298}
299
Sravan Kumar Kairam71121712017-04-15 00:34:42 +0530300/**
301 * hdd_ipa_uc_ol_deinit() - Disconnect IPA TX and RX pipes
302 * @hdd_ctx: Global HDD context
303 *
304 * Return: 0 on success, negativer errno on error
305 */
Jeff Johnsondd595cb2017-08-28 11:58:09 -0700306static inline int hdd_ipa_uc_ol_deinit(struct hdd_context *hdd_ctx)
Sravan Kumar Kairam71121712017-04-15 00:34:42 +0530307{
308 return 0;
309}
Yun Park46255682017-10-09 15:56:34 -0700310
311/**
312 * hdd_ipa_uc_stat() - Print IPA uC stats
313 * @adapter: network adapter
314 *
315 * Return: None
316 */
317static inline void hdd_ipa_uc_stat(struct hdd_adapter *adapter)
318{
319}
320
321/**
322 * hdd_ipa_uc_info() - Print IPA uC resource and session information
323 * @adapter: network adapter
324 *
325 * Return: None
326 */
327static inline void hdd_ipa_uc_info(struct hdd_context *hdd_ctx)
328{
329}
330
Himanshu Agarwaledf30dc2017-06-05 15:54:27 +0530331static inline int hdd_ipa_uc_smmu_map(bool map, uint32_t num_buf,
332 qdf_mem_info_t *buf_arr)
333{
334 return 0;
335}
Leo Chang3bc8fed2015-11-13 10:59:47 -0800336#endif /* IPA_OFFLOAD */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800337#endif /* #ifndef HDD_IPA_H__ */