blob: 825ba55eee6587e596eba4fd24a4239e23825f39 [file] [log] [blame]
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +05301/*
Vevek Venkatesan78f7f092019-05-23 17:16:28 +05302 * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +05303 *
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +05304 * 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
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +053019#ifndef _WLAN_IPA_CORE_H_
20#define _WLAN_IPA_CORE_H_
21
22#ifdef IPA_OFFLOAD
23
24#include "wlan_ipa_priv.h"
25#include "wlan_ipa_public_struct.h"
26
27/**
28 * wlan_ipa_is_enabled() - Is IPA enabled?
29 * @ipa_cfg: IPA config
30 *
31 * Return: true if IPA is enabled, false otherwise
32 */
33static inline bool wlan_ipa_is_enabled(struct wlan_ipa_config *ipa_cfg)
34{
35 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_ENABLE_MASK);
36}
37
38/**
39 * wlan_ipa_uc_is_enabled() - Is IPA UC enabled?
40 * @ipa_cfg: IPA config
41 *
42 * Return: true if IPA UC is enabled, false otherwise
43 */
44static inline bool wlan_ipa_uc_is_enabled(struct wlan_ipa_config *ipa_cfg)
45{
46 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_UC_ENABLE_MASK);
47}
48
49/**
Sravan Kumar Kairam271fab22018-03-07 18:57:41 +053050 * wlan_ipa_is_rt_debugging_enabled() - Is IPA RT debugging enabled?
51 * @ipa_cfg: IPA config
52 *
53 * Return: true if IPA RT debugging is enabled, false otherwise
54 */
55static inline
56bool wlan_ipa_is_rt_debugging_enabled(struct wlan_ipa_config *ipa_cfg)
57{
58 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg,
59 WLAN_IPA_REAL_TIME_DEBUGGING);
60}
61
62/**
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +053063 * wlan_ipa_setup - IPA initialize and setup
64 * @ipa_ctx: IPA priv obj
65 * @ipa_cfg: IPA config
66 *
67 * Return: QDF_STATUS
68 */
69QDF_STATUS wlan_ipa_setup(struct wlan_ipa_priv *ipa_ctx,
70 struct wlan_ipa_config *ipa_cfg);
71
72/**
Sravan Kumar Kairam2e7aae92018-03-06 19:32:49 +053073 * wlan_ipa_get_obj_context - Get IPA OBJ context
74 *
75 * Return: IPA context
76 */
77struct wlan_ipa_priv *wlan_ipa_get_obj_context(void);
78
79/**
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +053080 * wlan_ipa_cleanup - IPA cleanup
81 * @ipa_ctx: IPA priv obj
82 *
83 * Return: QDF_STATUS
84 */
85QDF_STATUS wlan_ipa_cleanup(struct wlan_ipa_priv *ipa_ctx);
Sravan Kumar Kairam2e7aae92018-03-06 19:32:49 +053086
87/**
88 * wlan_ipa_uc_enable_pipes() - Enable IPA uC pipes
89 * @ipa_ctx: IPA context
90 *
91 * Return: QDF_STATUS
92 */
93QDF_STATUS wlan_ipa_uc_enable_pipes(struct wlan_ipa_priv *ipa_ctx);
94
95/**
96 * wlan_ipa_uc_disable_pipes() - Disable IPA uC pipes
97 * @ipa_ctx: IPA context
98 *
99 * Return: QDF_STATUS
100 */
101QDF_STATUS wlan_ipa_uc_disable_pipes(struct wlan_ipa_priv *ipa_ctx);
102
Sravan Kumar Kairam9e99e9a2018-03-12 19:09:45 +0530103/**
Sravan Kumar Kairamc056d992018-03-22 12:35:37 +0530104 * wlan_ipa_set_perf_level() - Set IPA performance level
105 * @ipa_ctx: IPA context
106 * @tx_packets: Number of packets transmitted in the last sample period
107 * @rx_packets: Number of packets received in the last sample period
108 *
109 * Return: QDF STATUS
110 */
111QDF_STATUS wlan_ipa_set_perf_level(struct wlan_ipa_priv *ipa_ctx,
112 uint64_t tx_packets, uint64_t rx_packets);
113
114/**
jiadf9771182018-06-12 12:43:40 +0800115 * wlan_ipa_init_perf_level() - Initialize IPA performance level
116 * @ipa_ctx: IPA context
117 *
118 * If IPA clock scaling is disabled, initialize perf level to maximum.
119 * Else set the lowest level to start with.
120 *
121 * Return: QDF STATUS
122 */
123QDF_STATUS wlan_ipa_init_perf_level(struct wlan_ipa_priv *ipa_ctx);
124
125/**
Sravan Kumar Kairamfbc87b72018-04-09 14:09:52 +0530126 * wlan_ipa_get_iface() - Get IPA interface
127 * @ipa_ctx: IPA context
128 * @mode: Interface device mode
129 *
130 * Return: IPA interface address
131 */
132struct wlan_ipa_iface_context
133*wlan_ipa_get_iface(struct wlan_ipa_priv *ipa_ctx, uint8_t mode);
134
135#ifndef CONFIG_IPA_WDI_UNIFIED_API
jiadad913c72018-06-12 10:48:07 +0800136
137/**
jiad9d613a22018-11-09 13:45:54 +0800138 * wlan_ipa_is_rm_enabled() - Is IPA RM enabled?
139 * @ipa_cfg: IPA config
140 *
141 * Return: true if IPA RM is enabled, false otherwise
142 */
143static inline bool wlan_ipa_is_rm_enabled(struct wlan_ipa_config *ipa_cfg)
144{
145 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg, WLAN_IPA_RM_ENABLE_MASK);
146}
147
148/**
jiadad913c72018-06-12 10:48:07 +0800149 * wlan_ipa_is_clk_scaling_enabled() - Is IPA clock scaling enabled?
150 * @ipa_cfg: IPA config
151 *
152 * Return: true if IPA clock scaling is enabled, false otherwise
153 */
154static inline
155bool wlan_ipa_is_clk_scaling_enabled(struct wlan_ipa_config *ipa_cfg)
156{
157 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg,
158 WLAN_IPA_CLK_SCALING_ENABLE_MASK |
159 WLAN_IPA_RM_ENABLE_MASK);
160}
161
Sravan Kumar Kairamfbc87b72018-04-09 14:09:52 +0530162/**
Sravan Kumar Kairam2e7aae92018-03-06 19:32:49 +0530163 * wlan_ipa_wdi_rm_request_resource() - IPA WDI request resource
164 * @ipa_ctx: IPA context
165 * @res_name: IPA RM resource name
166 *
167 * Return: 0 on success, negative errno on error
168 */
169static inline
170int wlan_ipa_wdi_rm_request_resource(struct wlan_ipa_priv *ipa_ctx,
171 qdf_ipa_rm_resource_name_t res_name)
172{
173 return qdf_ipa_rm_request_resource(res_name);
174}
175
176/**
177 * wlan_ipa_wdi_rm_release_resource() - IPA WDI release resource
178 * @ipa_ctx: IPA context
179 * @res_name: IPA RM resource name
180 *
181 * Return: 0 on success, negative errno on error
182 */
183static inline
184int wlan_ipa_wdi_rm_release_resource(struct wlan_ipa_priv *ipa_ctx,
185 qdf_ipa_rm_resource_name_t res_name)
186{
187 return qdf_ipa_rm_release_resource(res_name);
188}
189
190/**
191 * wlan_ipa_wdi_rm_request() - Request resource from IPA
192 * @ipa_ctx: IPA context
193 *
194 * Return: QDF_STATUS
195 */
196QDF_STATUS wlan_ipa_wdi_rm_request(struct wlan_ipa_priv *ipa_ctx);
197
198/**
199 * wlan_ipa_wdi_rm_try_release() - Attempt to release IPA resource
200 * @ipa_ctx: IPA context
201 *
202 * Return: QDF_STATUS
203 */
204QDF_STATUS wlan_ipa_wdi_rm_try_release(struct wlan_ipa_priv *ipa_ctx);
205
206/**
207 * wlan_ipa_wdi_setup_rm() - Setup IPA resource management
208 * @ipa_ctx: IPA context
209 *
210 * Return: QDF_STATUS
211 */
212QDF_STATUS wlan_ipa_wdi_setup_rm(struct wlan_ipa_priv *ipa_ctx);
213
214/**
215 * wlan_ipa_wdi_destroy_rm() - Destroy IPA resources
216 * @ipa_ctx: IPA context
217 *
218 * Destroys all resources associated with the IPA resource manager
219 *
220 * Return: None
221 */
222void wlan_ipa_wdi_destroy_rm(struct wlan_ipa_priv *ipa_ctx);
223
Yun Parke114fbf2018-04-05 20:02:12 -0700224static inline
225int wlan_ipa_wdi_rm_notify_completion(qdf_ipa_rm_event_t event,
226 qdf_ipa_rm_resource_name_t res_name)
227{
228 return qdf_ipa_rm_notify_completion(event, res_name);
229}
230
231static inline
232int wlan_ipa_wdi_rm_inactivity_timer_destroy(
233 qdf_ipa_rm_resource_name_t res_name)
234{
235 return qdf_ipa_rm_inactivity_timer_destroy(res_name);
236}
237
Yun Parke74e6092018-04-27 11:36:34 -0700238bool wlan_ipa_is_rm_released(struct wlan_ipa_priv *ipa_ctx);
239
Sravan Kumar Kairam2e7aae92018-03-06 19:32:49 +0530240#else /* CONFIG_IPA_WDI_UNIFIED_API */
241
jiadad913c72018-06-12 10:48:07 +0800242/**
jiad9d613a22018-11-09 13:45:54 +0800243 * wlan_ipa_is_rm_enabled() - Is IPA RM enabled?
244 * @ipa_cfg: IPA config
245 *
246 * IPA RM is deprecated and IPA PM is involved. WLAN driver
247 * has no control over IPA PM and thus we could regard IPA
248 * RM as always enabled for power efficiency.
249 *
250 * Return: true
251 */
252static inline bool wlan_ipa_is_rm_enabled(struct wlan_ipa_config *ipa_cfg)
253{
254 return true;
255}
256
257/**
jiadad913c72018-06-12 10:48:07 +0800258 * wlan_ipa_is_clk_scaling_enabled() - Is IPA clock scaling enabled?
259 * @ipa_cfg: IPA config
260 *
261 * Return: true if IPA clock scaling is enabled, false otherwise
262 */
263static inline
264bool wlan_ipa_is_clk_scaling_enabled(struct wlan_ipa_config *ipa_cfg)
265{
266 return WLAN_IPA_IS_CONFIG_ENABLED(ipa_cfg,
267 WLAN_IPA_CLK_SCALING_ENABLE_MASK);
268}
269
Sravan Kumar Kairam2e7aae92018-03-06 19:32:49 +0530270static inline int wlan_ipa_wdi_rm_request_resource(
271 struct wlan_ipa_priv *ipa_ctx,
272 qdf_ipa_rm_resource_name_t res_name)
273{
274 return 0;
275}
276
277static inline int wlan_ipa_wdi_rm_release_resource(
278 struct wlan_ipa_priv *ipa_ctx,
279 qdf_ipa_rm_resource_name_t res_name)
280{
281 return 0;
282}
283
284static inline QDF_STATUS wlan_ipa_wdi_setup_rm(struct wlan_ipa_priv *ipa_ctx)
285{
286 return 0;
287}
288
289static inline int wlan_ipa_wdi_destroy_rm(struct wlan_ipa_priv *ipa_ctx)
290{
291 return 0;
292}
293
294static inline QDF_STATUS wlan_ipa_wdi_rm_request(struct wlan_ipa_priv *ipa_ctx)
295{
296 return QDF_STATUS_SUCCESS;
297}
298
299static inline QDF_STATUS wlan_ipa_wdi_rm_try_release(struct wlan_ipa_priv
300 *ipa_ctx)
301{
302 return QDF_STATUS_SUCCESS;
303}
304
Yun Parke114fbf2018-04-05 20:02:12 -0700305static inline
306int wlan_ipa_wdi_rm_notify_completion(qdf_ipa_rm_event_t event,
307 qdf_ipa_rm_resource_name_t res_name)
308{
309 return 0;
310}
311
312static inline
313int wlan_ipa_wdi_rm_inactivity_timer_destroy(
314 qdf_ipa_rm_resource_name_t res_name)
315{
316 return 0;
317}
318
Yun Parke74e6092018-04-27 11:36:34 -0700319static inline
320bool wlan_ipa_is_rm_released(struct wlan_ipa_priv *ipa_ctx)
321{
322 return true;
323}
324
Sravan Kumar Kairam2e7aae92018-03-06 19:32:49 +0530325#endif /* CONFIG_IPA_WDI_UNIFIED_API */
326
Sravan Kumar Kairam271fab22018-03-07 18:57:41 +0530327#ifdef FEATURE_METERING
328
Sravan Kumar Kairam3bc886d2019-08-22 23:46:27 +0530329#ifndef WDI3_STATS_UPDATE
Sravan Kumar Kairam271fab22018-03-07 18:57:41 +0530330/**
331 * wlan_ipa_uc_op_metering() - IPA uC operation for stats and quota limit
332 * @ipa_ctx: IPA context
333 * @op_msg: operation message received from firmware
334 *
335 * Return: QDF_STATUS enumeration
336 */
337QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx,
Sravan Kumar Kairam3bc886d2019-08-22 23:46:27 +0530338 struct op_msg_type *op_msg);
339#else
340static inline
341QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx,
342 struct op_msg_type *op_msg)
343{
344 return QDF_STATUS_SUCCESS;
345}
346#endif
Sravan Kumar Kairam271fab22018-03-07 18:57:41 +0530347
348/**
jitiphilfdcaaba2018-09-03 16:19:52 +0530349 * wlan_ipa_wdi_meter_notifier_cb() - SSR wrapper for
350 * __wlan_ipa_wdi_meter_notifier_cb
Sravan Kumar Kairam271fab22018-03-07 18:57:41 +0530351 * @priv: pointer to private data registered with IPA (we register a
352 * pointer to the global IPA context)
353 * @evt: the IPA event which triggered the callback
354 * @data: data associated with the event
355 *
356 * Return: None
357 */
358void wlan_ipa_wdi_meter_notifier_cb(qdf_ipa_wdi_meter_evt_type_t evt,
jitiphilfdcaaba2018-09-03 16:19:52 +0530359 void *data);
Sravan Kumar Kairam1309e7e2018-03-13 09:29:52 +0530360
361/**
362 * wlan_ipa_init_metering() - IPA metering stats completion event reset
363 * @ipa_ctx: IPA context
364 *
365 * Return: QDF_STATUS enumeration
366 */
367void wlan_ipa_init_metering(struct wlan_ipa_priv *ipa_ctx);
Sravan Kumar Kairam3bc886d2019-08-22 23:46:27 +0530368
369#ifdef WDI3_STATS_UPDATE
370/**
371 * wlan_ipa_update_tx_stats() - send embedded tx traffic in bytes to IPA
372 * @ipa_ctx: IPA context
373 * @sta_tx: tx in bytes on sta interface
374 * @sap_tx: tx in bytes on sap interface
375 *
376 * Return: void
377 */
378void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx, uint64_t sta_tx,
379 uint64_t sap_tx);
380#else
381static inline void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx,
382 uint64_t sta_tx, uint64_t sap_tx)
383{
384}
385#endif /* WDI3_STATS_UPDATE */
386
Sravan Kumar Kairam271fab22018-03-07 18:57:41 +0530387#else
388
389static inline
390QDF_STATUS wlan_ipa_uc_op_metering(struct wlan_ipa_priv *ipa_ctx,
391 struct op_msg_type *op_msg)
392{
393 return QDF_STATUS_SUCCESS;
394}
395
396static inline void wlan_ipa_wdi_meter_notifier_cb(void)
397{
398}
Sravan Kumar Kairam1309e7e2018-03-13 09:29:52 +0530399
400static inline void wlan_ipa_init_metering(struct wlan_ipa_priv *ipa_ctx)
401{
402}
Sravan Kumar Kairam3bc886d2019-08-22 23:46:27 +0530403
404static inline void wlan_ipa_update_tx_stats(struct wlan_ipa_priv *ipa_ctx,
405 uint64_t sta_tx, uint64_t sap_tx)
406{
407}
Sravan Kumar Kairam271fab22018-03-07 18:57:41 +0530408#endif /* FEATURE_METERING */
409
410/**
411 * wlan_ipa_uc_stat() - Print IPA uC stats
412 * @ipa_ctx: IPA context
413 *
414 * Return: None
415 */
416void wlan_ipa_uc_stat(struct wlan_ipa_priv *ipa_ctx);
417
418/**
419 * wlan_ipa_uc_info() - Print IPA uC resource and session information
420 * @ipa_ctx: IPA context
421 *
422 * Return: None
423 */
424void wlan_ipa_uc_info(struct wlan_ipa_priv *ipa_ctx);
425
426/**
427 * wlan_ipa_print_fw_wdi_stats() - Print FW IPA WDI stats
428 * @ipa_ctx: IPA context
429 *
430 * Return: None
431 */
432void wlan_ipa_print_fw_wdi_stats(struct wlan_ipa_priv *ipa_ctx,
433 struct ipa_uc_fw_stats *uc_fw_stat);
434
435/**
436 * wlan_ipa_uc_stat_request() - Get IPA stats from IPA
437 * @ipa_ctx: IPA context
438 * @reason: STAT REQ Reason
439 *
440 * Return: None
441 */
442void wlan_ipa_uc_stat_request(struct wlan_ipa_priv *ipa_ctx, uint8_t reason);
443
444/**
445 * wlan_ipa_uc_stat_query() - Query the IPA stats
446 * @ipa_ctx: IPA context
447 * @ipa_tx_diff: tx packet count diff from previous tx packet count
448 * @ipa_rx_diff: rx packet count diff from previous rx packet count
449 *
450 * Return: None
451 */
452void wlan_ipa_uc_stat_query(struct wlan_ipa_priv *ipa_ctx,
453 uint32_t *ipa_tx_diff, uint32_t *ipa_rx_diff);
454
455/**
456 * wlan_ipa_dump_info() - dump IPA IPA struct
457 * @ipa_ctx: IPA context
458 *
459 * Dump entire struct ipa_ctx
460 *
461 * Return: none
462 */
463void wlan_ipa_dump_info(struct wlan_ipa_priv *ipa_ctx);
464
465/**
466 * wlan_ipa_uc_rt_debug_host_dump - dump rt debug buffer
467 * @ipa_ctx: IPA context
468 *
469 * If rt debug enabled, dump debug buffer contents based on requirement
470 *
471 * Return: none
472 */
473void wlan_ipa_uc_rt_debug_host_dump(struct wlan_ipa_priv *ipa_ctx);
474
475/**
476 * wlan_ipa_uc_rt_debug_destructor() - called by data packet free
477 * @nbuff: packet pinter
478 *
479 * when free data packet, will be invoked by wlan client and will increase
480 * free counter
481 *
482 * Return: none
483 */
484void wlan_ipa_uc_rt_debug_destructor(qdf_nbuf_t nbuff);
485
486/**
487 * wlan_ipa_uc_rt_debug_deinit() - remove resources to handle rt debugging
488 * @ipa_ctx: IPA context
489 *
490 * free all rt debugging resources
491 *
492 * Return: none
493 */
494void wlan_ipa_uc_rt_debug_deinit(struct wlan_ipa_priv *ipa_ctx);
495
496/**
497 * wlan_ipa_uc_rt_debug_init() - initialize resources to handle rt debugging
498 * @ipa_ctx: IPA context
499 *
500 * alloc and initialize all rt debugging resources
501 *
502 * Return: none
503 */
504void wlan_ipa_uc_rt_debug_init(struct wlan_ipa_priv *ipa_ctx);
505
Sravan Kumar Kairam858073b2018-03-13 09:03:32 +0530506/**
507 * wlan_ipa_reg_sap_xmit_cb() - Register upper layer SAP cb to transmit
508 * @ipa_ctx: IPA context
509 * @cb: callback
510 *
511 * Return: None
512 */
513static inline
Vevek Venkatesan78f7f092019-05-23 17:16:28 +0530514void wlan_ipa_reg_sap_xmit_cb(struct wlan_ipa_priv *ipa_ctx,
515 wlan_ipa_softap_xmit cb)
Sravan Kumar Kairam858073b2018-03-13 09:03:32 +0530516{
517 ipa_ctx->softap_xmit = cb;
518}
519
520/**
521 * wlan_ipa_reg_send_to_nw_cb() - Register cb to send IPA Rx packet to network
522 * @ipa_ctx: IPA context
523 * @cb: callback
524 *
525 * Return: None
526 */
527static inline
Vevek Venkatesan3b6be822019-05-28 18:19:15 +0530528void wlan_ipa_reg_send_to_nw_cb(struct wlan_ipa_priv *ipa_ctx,
529 wlan_ipa_send_to_nw cb)
Sravan Kumar Kairam858073b2018-03-13 09:03:32 +0530530{
531 ipa_ctx->send_to_nw = cb;
532}
533
534/**
535 * wlan_ipa_set_mcc_mode() - Set MCC mode
536 * @ipa_ctx: IPA context
jiadbb47e132018-03-30 16:28:30 +0800537 * @mcc_mode: 1=MCC/0=SCC
Sravan Kumar Kairam858073b2018-03-13 09:03:32 +0530538 *
539 * Return: void
540 */
jiadbb47e132018-03-30 16:28:30 +0800541void wlan_ipa_set_mcc_mode(struct wlan_ipa_priv *ipa_ctx, bool mcc_mode);
Sravan Kumar Kairam858073b2018-03-13 09:03:32 +0530542
543/**
544 * wlan_ipa_set_dfs_cac_tx() - Set DFS cac tx block
545 * @ipa_ctx: IPA context
546 * @tx_block: dfs cac tx block
547 *
548 * Return: void
549 */
550static inline
551void wlan_ipa_set_dfs_cac_tx(struct wlan_ipa_priv *ipa_ctx, bool tx_block)
552{
553 ipa_ctx->dfs_cac_block_tx = tx_block;
554}
555
556/**
557 * wlan_ipa_set_ap_ibss_fwd() - Set AP intra bss forward
558 * @ipa_ctx: IPA context
559 * @intra_bss: enable or disable ap intra bss forward
560 *
561 * Return: void
562 */
563static inline
564void wlan_ipa_set_ap_ibss_fwd(struct wlan_ipa_priv *ipa_ctx, bool intra_bss)
565{
566 ipa_ctx->ap_intrabss_fwd = intra_bss;
567}
568
Sravan Kumar Kairam1309e7e2018-03-13 09:29:52 +0530569/**
570 * wlan_ipa_uc_ol_init() - Initialize IPA uC offload
571 * @ipa_ctx: IPA context
572 * @osdev: Parent device instance
573 *
574 * This function is called to update IPA pipe configuration with resources
575 * allocated by wlan driver (cds_pre_enable) before enabling it in FW
576 *
577 * Return: QDF_STATUS
578 */
579QDF_STATUS wlan_ipa_uc_ol_init(struct wlan_ipa_priv *ipa_ctx,
580 qdf_device_t osdev);
581
582/**
583 * wlan_ipa_uc_ol_deinit() - Disconnect IPA TX and RX pipes
584 * @ipa_ctx: IPA context
585 *
586 * Return: QDF_STATUS
587 */
588QDF_STATUS wlan_ipa_uc_ol_deinit(struct wlan_ipa_priv *ipa_ctx);
589
590/**
591 * wlan_ipa_flush() - flush IPA exception path SKB's
592 * @ipa_ctx: IPA context
593 *
594 * Return: None
595 */
596void wlan_ipa_flush(struct wlan_ipa_priv *ipa_ctx);
597
598/**
599 * wlan_ipa_suspend() - Suspend IPA
600 * @ipa_ctx: IPA context
601 *
602 * Return: QDF STATUS
603 */
604QDF_STATUS wlan_ipa_suspend(struct wlan_ipa_priv *ipa_ctx);
605
606/**
607 * wlan_ipa_resume() - Resume IPA
608 * @ipa_ctx: IPA context
609 *
610 * Return: QDF STATUS
611 */
612QDF_STATUS wlan_ipa_resume(struct wlan_ipa_priv *ipa_ctx);
613
Sravan Kumar Kairam7d931ff2018-03-13 09:42:02 +0530614#ifndef QCA_LL_TX_FLOW_CONTROL_V2
615/**
616 * wlan_ipa_send_mcc_scc_msg() - Send IPA WLAN_SWITCH_TO_MCC/SCC message
617 * @ipa_ctx: IPA context
618 * @mcc_mode: 0=MCC/1=SCC
619 *
620 * Return: QDF STATUS
621 */
622QDF_STATUS wlan_ipa_send_mcc_scc_msg(struct wlan_ipa_priv *ipa_ctx,
623 bool mcc_mode);
624#else
625static inline
626QDF_STATUS wlan_ipa_send_mcc_scc_msg(struct wlan_ipa_priv *ipa_ctx,
627 bool mcc_mode)
628{
629 return QDF_STATUS_SUCCESS;
630}
jiadbb47e132018-03-30 16:28:30 +0800631
632static inline void wlan_ipa_mcc_work_handler(void *data)
633{
634}
Sravan Kumar Kairam7d931ff2018-03-13 09:42:02 +0530635#endif
636
Sravan Kumar Kairam5214f652018-03-13 09:52:31 +0530637/**
638 * wlan_ipa_wlan_evt() - IPA event handler
639 * @net_dev: Interface net device
640 * @device_mode: Net interface device mode
Sravan Kumar Kairam5214f652018-03-13 09:52:31 +0530641 * @session_id: session id for the event
642 * @type: event enum of type ipa_wlan_event
643 * @mac_address: MAC address associated with the event
644 *
645 * Return: QDF_STATUS
646 */
647QDF_STATUS wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode,
Rakshith Suresh Patkar96703f62019-08-06 14:34:36 +0530648 uint8_t session_id,
Sravan Kumar Kairam5214f652018-03-13 09:52:31 +0530649 enum wlan_ipa_wlan_event ipa_event_type,
650 uint8_t *mac_addr);
651
Sravan Kumar Kairam983a4452018-03-20 13:30:22 +0530652/**
653 * wlan_ipa_uc_smmu_map() - Map / Unmap DMA buffer to IPA UC
654 * @map: Map / unmap operation
655 * @num_buf: Number of buffers in array
656 * @buf_arr: Buffer array of DMA mem mapping info
657 *
658 * This API maps/unmaps WLAN-IPA buffers if SMMU S1 translation
659 * is enabled.
660 *
661 * Return: Status of map operation
662 */
663int wlan_ipa_uc_smmu_map(bool map, uint32_t num_buf, qdf_mem_info_t *buf_arr);
664
Yun Parka29974a2018-04-09 12:05:49 -0700665/**
666 * wlan_ipa_is_fw_wdi_activated() - Is FW WDI actived?
667 * @ipa_ctx: IPA contex
668 *
669 * Return: true if FW WDI actived, false otherwise
670 */
671bool wlan_ipa_is_fw_wdi_activated(struct wlan_ipa_priv *ipa_ctx);
Sravan Kumar Kairamce792eb2018-06-15 15:07:11 +0530672
673/**
Vevek Venkatesane81bca82019-08-12 22:25:15 +0530674 * wlan_ipa_uc_cleanup_sta - disconnect and cleanup sta iface
675 * @ipa_ctx: IPA context
676 * @net_dev: Interface net device
677 *
678 * Send disconnect sta event to IPA driver and cleanup IPA iface
679 * if not yet done
680 *
681 * Return: void
682 */
683void wlan_ipa_uc_cleanup_sta(struct wlan_ipa_priv *ipa_ctx,
684 qdf_netdev_t net_dev);
685
686/**
Sravan Kumar Kairamce792eb2018-06-15 15:07:11 +0530687 * wlan_ipa_uc_disconnect_ap() - send ap disconnect event
688 * @ipa_ctx: IPA context
689 * @net_dev: Interface net device
690 *
691 * Send disconnect ap event to IPA driver
692 *
693 * Return: QDF_STATUS
694 */
695QDF_STATUS wlan_ipa_uc_disconnect_ap(struct wlan_ipa_priv *ipa_ctx,
696 qdf_netdev_t net_dev);
697
698/**
699 * wlan_ipa_cleanup_dev_iface() - Clean up net dev IPA interface
700 * @ipa_ctx: IPA context
701 * @net_dev: Interface net device
702 *
703 * Return: None
704 */
705void wlan_ipa_cleanup_dev_iface(struct wlan_ipa_priv *ipa_ctx,
706 qdf_netdev_t net_dev);
Sravan Kumar Kairam657f89e2018-09-18 10:13:37 +0530707
708/**
709 * wlan_ipa_uc_ssr_cleanup() - handle IPA UC clean up during SSR
710 * @ipa_ctx: IPA context
711 *
712 * Return: None
713 */
714void wlan_ipa_uc_ssr_cleanup(struct wlan_ipa_priv *ipa_ctx);
jitiphil0e3b5922018-07-24 18:43:50 +0530715
716/**
717 * wlan_ipa_fw_rejuvenate_send_msg() - send fw rejuvenate message to IPA driver
718 * @ipa_ctx: IPA context
719 *
720 * Return: void
721 */
722void wlan_ipa_fw_rejuvenate_send_msg(struct wlan_ipa_priv *ipa_ctx);
723
Sravan Kumar Kairamd01b4452018-03-07 17:37:09 +0530724#endif /* IPA_OFFLOAD */
725#endif /* _WLAN_IPA_CORE_H_ */