blob: 506669d0233d97f878e41b042fdacdba68fff542 [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
Mohit Khannafa99aea2016-05-12 21:43:13 -070038/**
39 * enum hdd_ipa_wlan_event - HDD IPA events
40 * @HDD_IPA_CLIENT_CONNECT: Client Connects
41 * @HDD_IPA_CLIENT_DISCONNECT: Client Disconnects
42 * @HDD_IPA_AP_CONNECT: SoftAP is started
43 * @HDD_IPA_AP_DISCONNECT: SoftAP is stopped
44 * @HDD_IPA_STA_CONNECT: STA associates to AP
45 * @HDD_IPA_STA_DISCONNECT: STA dissociates from AP
46 * @HDD_IPA_CLIENT_CONNECT_EX: Peer associates/re-associates to softap
47 * @HDD_IPA_WLAN_EVENT_MAX: Max value for the enum
48 */
49enum hdd_ipa_wlan_event {
50 HDD_IPA_CLIENT_CONNECT,
51 HDD_IPA_CLIENT_DISCONNECT,
52 HDD_IPA_AP_CONNECT,
53 HDD_IPA_AP_DISCONNECT,
54 HDD_IPA_STA_CONNECT,
55 HDD_IPA_STA_DISCONNECT,
56 HDD_IPA_CLIENT_CONNECT_EX,
57 HDD_IPA_WLAN_EVENT_MAX
58};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080059
60#ifdef IPA_OFFLOAD
61/* Include files */
Houston Hoffman43d47fa2016-02-24 16:34:30 -080062#include <wlan_hdd_assoc.h> /* hdd_context_t */
63
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
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053087QDF_STATUS hdd_ipa_init(hdd_context_t *hdd_ctx);
88QDF_STATUS hdd_ipa_cleanup(hdd_context_t *hdd_ctx);
Nirav Shahcbc6d722016-03-01 16:24:53 +053089QDF_STATUS hdd_ipa_process_rxt(void *cds_context, qdf_nbuf_t rxBuf,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080090 uint8_t sta_id);
91int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
Mohit Khannafa99aea2016-05-12 21:43:13 -070092 enum hdd_ipa_wlan_event type, uint8_t *mac_addr);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080093int hdd_ipa_set_perf_level(hdd_context_t *hdd_ctx, uint64_t tx_packets,
94 uint64_t rx_packets);
95int hdd_ipa_suspend(hdd_context_t *hdd_ctx);
96int hdd_ipa_resume(hdd_context_t *hdd_ctx);
97void hdd_ipa_uc_stat_query(hdd_context_t *hdd_ctx, uint32_t *ipa_tx_diff,
98 uint32_t *ipa_rx_diff);
99void hdd_ipa_uc_rt_debug_host_dump(hdd_context_t *hdd_ctx);
100void hdd_ipa_uc_stat_request(hdd_adapter_t *adapter, uint8_t reason);
Yun Park637d6482016-10-05 10:51:33 -0700101void hdd_ipa_uc_sharing_stats_request(hdd_adapter_t *adapter,
102 uint8_t reset_stats);
103void hdd_ipa_uc_set_quota(hdd_adapter_t *adapter, uint8_t set_quota,
104 uint64_t quota_bytes);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800105bool hdd_ipa_is_enabled(hdd_context_t *pHddCtx);
106bool hdd_ipa_uc_is_enabled(hdd_context_t *pHddCtx);
Yun Parka27049a2016-10-11 12:30:49 -0700107#ifndef QCA_LL_TX_FLOW_CONTROL_V2
108int hdd_ipa_send_mcc_scc_msg(hdd_context_t *hdd_ctx, bool mcc_mode);
109#else
110static inline int hdd_ipa_send_mcc_scc_msg(hdd_context_t *hdd_ctx,
111 bool mcc_mode)
112{
113 return 0;
114}
115#endif
Arun Khandavallicc544b32017-01-30 19:52:16 +0530116int hdd_ipa_uc_ssr_reinit(hdd_context_t *hdd_ctx);
Leo Change3e49442015-10-26 20:07:13 -0700117int hdd_ipa_uc_ssr_deinit(void);
118void hdd_ipa_uc_force_pipe_shutdown(hdd_context_t *hdd_ctx);
Leo Chang3bc8fed2015-11-13 10:59:47 -0800119struct sk_buff *hdd_ipa_tx_packet_ipa(hdd_context_t *hdd_ctx,
120 struct sk_buff *skb, uint8_t session_id);
Leo Chang11545d62016-10-17 14:53:50 -0700121bool hdd_ipa_is_present(hdd_context_t *hdd_ctx);
Yun Parkb187d542016-11-14 18:10:04 -0800122void hdd_ipa_dump_info(hdd_context_t *hdd_ctx);
Manikandan Mohanbb8a7ee2017-02-09 11:26:53 -0800123QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -0800124void hdd_ipa_set_tx_flow_info(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800125#else
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530126static inline QDF_STATUS hdd_ipa_init(hdd_context_t *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800127{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530128 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800129}
130
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530131static inline QDF_STATUS hdd_ipa_cleanup(hdd_context_t *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800132{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530133 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800134}
135
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530136static inline QDF_STATUS hdd_ipa_process_rxt(void *cds_context,
Nirav Shahcbc6d722016-03-01 16:24:53 +0530137 qdf_nbuf_t rxBuf, uint8_t sta_id)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800138{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530139 return QDF_STATUS_SUCCESS;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800140}
141
142static inline int hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id,
Mohit Khannafa99aea2016-05-12 21:43:13 -0700143 enum hdd_ipa_wlan_event type, uint8_t *mac_addr)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800144{
145 return 0;
146}
147
148static inline int hdd_ipa_send_mcc_scc_msg(hdd_context_t *hdd_ctx,
149 bool mcc_mode)
150{
151 return 0;
152}
153
154static inline int hdd_ipa_set_perf_level(hdd_context_t *hdd_ctx,
155 uint64_t tx_packets,
156 uint64_t rx_packets)
157{
158 return 0;
159}
160
161static inline int hdd_ipa_suspend(hdd_context_t *hdd_ctx)
162{
163 return 0;
164}
165
166static inline int hdd_ipa_resume(hdd_context_t *hdd_ctx)
167{
168 return 0;
169}
170
171static inline void hdd_ipa_uc_stat_query(hdd_context_t *hdd_ctx,
172 uint32_t *ipa_tx_diff,
173 uint32_t *ipa_rx_diff)
174{
175 *ipa_tx_diff = 0;
176 *ipa_rx_diff = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800177}
178
179static inline void hdd_ipa_uc_stat_request(hdd_adapter_t *adapter,
180 uint8_t reason)
181{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800182}
183
Leo Chang3bc8fed2015-11-13 10:59:47 -0800184static inline void hdd_ipa_uc_rt_debug_host_dump(hdd_context_t *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185{
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800186}
187
188static inline bool hdd_ipa_is_enabled(hdd_context_t *pHddCtx)
189{
190 return false;
191}
192
193static inline bool hdd_ipa_uc_is_enabled(hdd_context_t *pHddCtx)
194{
195 return false;
196}
Yun Parkb187d542016-11-14 18:10:04 -0800197
198static inline void hdd_ipa_dump_info(hdd_context_t *hdd_ctx)
199{
Yun Parkb187d542016-11-14 18:10:04 -0800200}
201
Arun Khandavallicc544b32017-01-30 19:52:16 +0530202static inline int hdd_ipa_uc_ssr_reinit(hdd_context_t *hdd_ctx)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800203{
204 return false;
205}
206
207static inline int hdd_ipa_uc_ssr_deinit(void)
208{
209 return false;
210}
Leo Change3e49442015-10-26 20:07:13 -0700211static inline void hdd_ipa_uc_force_pipe_shutdown(hdd_context_t *hdd_ctx)
212{
Leo Change3e49442015-10-26 20:07:13 -0700213}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800214
Leo Chang3bc8fed2015-11-13 10:59:47 -0800215/**
216 * hdd_ipa_tx_packet_ipa() - send packet to IPA
217 * @hdd_ctx: Global HDD context
218 * @skb: skb sent to IPA
219 * @session_id: send packet instance session id
220 *
221 * Send TX packet which generated by system to IPA.
222 * This routine only will be used for function verification
223 *
224 * Return: NULL packet sent to IPA properly
225 * skb packet not sent to IPA. legacy data path should handle
226 */
227static inline struct sk_buff *hdd_ipa_tx_packet_ipa(hdd_context_t *hdd_ctx,
228 struct sk_buff *skb, uint8_t session_id)
229{
230 return skb;
231}
Leo Chang11545d62016-10-17 14:53:50 -0700232
233/**
234 * hdd_ipa_is_present() - get IPA hw status
235 * @hdd_ctx: pointer to hdd context
236 *
237 * ipa_uc_reg_rdyCB is not directly designed to check
238 * ipa hw status. This is an undocumented function which
239 * has confirmed with IPA team.
240 *
241 * Return: true - ipa hw present
242 * false - ipa hw not present
243 */
Leo Changfdb45c32016-10-28 11:09:23 -0700244static inline bool hdd_ipa_is_present(hdd_context_t *hdd_ctx)
Leo Chang11545d62016-10-17 14:53:50 -0700245{
246 return false;
247}
Manikandan Mohanbb8a7ee2017-02-09 11:26:53 -0800248
249/**
250 * hdd_ipa_uc_ol_init() - Initialize IPA uC offload
251 * @hdd_ctx: Global HDD context
252 *
253 * Return: QDF_STATUS
254 */
Yun Parkec845302016-12-15 09:22:57 -0800255static inline QDF_STATUS hdd_ipa_uc_ol_init(hdd_context_t *hdd_ctx)
Manikandan Mohanbb8a7ee2017-02-09 11:26:53 -0800256{
257 return QDF_STATUS_SUCCESS;
258}
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -0800259
260static inline void hdd_ipa_set_tx_flow_info(void)
261{
262 return;
263}
264
Leo Chang3bc8fed2015-11-13 10:59:47 -0800265#endif /* IPA_OFFLOAD */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800266#endif /* #ifndef HDD_IPA_H__ */