xref: /wlan-dirver/qca-wifi-host-cmn/htc/htc_credit_history.h (revision 6d768494e5ce14eb1603a695c86739d12ecc6ec2)
1 /*
2  * Copyright (c) 2018,2020 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 to initialize HTC credit
28  *                            history buffers and variable.
29  * Return: None
30  */
31 
32 void htc_credit_history_init(void);
33 void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
34 			uint32_t htc_tx_queue_depth);
35 #ifdef WLAN_HANG_EVENT
36 /**
37  * htc_log_hang_credit_history: Log the credit history into a buffer
38  * @block: Notifier block
39  * @data: Private data of the block.
40  *
41  * HTC hang event notifier callback inovked when the recovery is triggered
42  * to log the credit information to understand the reason for recovery.
43  *
44  * Return: none
45  */
46 void htc_log_hang_credit_history(struct notifier_block *block, void *data);
47 #else
48 static inline
49 void htc_log_hang_credit_history(struct notifier_block *block, void *data)
50 {
51 }
52 #endif
53 #else /* FEATURE_HTC_CREDIT_HISTORY */
54 
55 static inline
56 void htc_credit_history_init(void)
57 {
58 }
59 
60 static inline
61 void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
62 			uint32_t htc_tx_queue_depth)
63 { }
64 #endif /* FEATURE_HTC_CREDIT_HISTORY */
65 #endif /* _HTC_CREDIT_HISTORY_H_ */
66