xref: /wlan-driver/qca-wifi-host-cmn/htc/htc_credit_history.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2018,2020-2021, 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 #ifndef _HTC_CREDIT_HISTORY_H_
20 #define _HTC_CREDIT_HISTORY_H_
21 
22 #include "htc_internal.h"
23 
24 #ifdef FEATURE_HTC_CREDIT_HISTORY
25 
26 /**
27  * htc_credit_history_init() - Init helper function
28  *
29  * The htc_credit_history_init() function, helps to initialize
30  * HTC credit history buffers and variable.
31  *
32  * Return: None
33  */
34 void htc_credit_history_init(void);
35 
36 /**
37  * htc_credit_history_deinit() - Deinit helper function
38  *
39  * The htc_credit_history_deinit() function, helps to remove
40  * the HTC credit history buffers from minidump.
41  *
42  * Return: None
43  */
44 void htc_credit_history_deinit(void);
45 void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
46 			uint32_t htc_tx_queue_depth);
47 #ifdef WLAN_HANG_EVENT
48 /**
49  * htc_log_hang_credit_history() - Log the credit history into a buffer
50  * @block: Notifier block
51  * @data: Private data of the block.
52  *
53  * HTC hang event notifier callback inovked when the recovery is triggered
54  * to log the credit information to understand the reason for recovery.
55  *
56  * Return: None
57  */
58 void htc_log_hang_credit_history(struct notifier_block *block, void *data);
59 #else
60 static inline
htc_log_hang_credit_history(struct notifier_block * block,void * data)61 void htc_log_hang_credit_history(struct notifier_block *block, void *data)
62 {
63 }
64 #endif
65 #else /* FEATURE_HTC_CREDIT_HISTORY */
66 
67 static inline
htc_credit_history_init(void)68 void htc_credit_history_init(void)
69 {
70 }
71 
72 static inline
htc_credit_history_deinit(void)73 void htc_credit_history_deinit(void)
74 {
75 }
76 
77 static inline
htc_credit_record(enum htc_credit_exchange_type type,uint32_t tx_credit,uint32_t htc_tx_queue_depth)78 void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
79 			uint32_t htc_tx_queue_depth)
80 { }
81 #endif /* FEATURE_HTC_CREDIT_HISTORY */
82 #endif /* _HTC_CREDIT_HISTORY_H_ */
83