xref: /wlan-driver/qcacld-3.0/core/hdd/inc/wlan_hdd_debugfs.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2013-2018, 2020 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name #ifndef _WLAN_HDD_DEBUGFS_H
20*5113495bSYour Name #define _WLAN_HDD_DEBUGFS_H
21*5113495bSYour Name 
22*5113495bSYour Name #ifdef WLAN_DEBUGFS
23*5113495bSYour Name 
24*5113495bSYour Name #define HDD_DEBUGFS_FILE_NAME_MAX 24
25*5113495bSYour Name 
26*5113495bSYour Name /**
27*5113495bSYour Name  * enum hdd_debugfs_file_id - Debugfs file Identifier
28*5113495bSYour Name  * @HDD_DEBUFS_FILE_ID_ROAM_SCAN_STATS_INFO: roam_scan_stats file id
29*5113495bSYour Name  * @HDD_DEBUFS_FILE_ID_OFFLOAD_INFO: offload_info file id
30*5113495bSYour Name  * @HDD_DEBUGFS_FILE_ID_MAX: maximum id of csr debugfs file
31*5113495bSYour Name  */
32*5113495bSYour Name enum hdd_debugfs_file_id {
33*5113495bSYour Name 	HDD_DEBUFS_FILE_ID_ROAM_SCAN_STATS_INFO = 0,
34*5113495bSYour Name 	HDD_DEBUFS_FILE_ID_OFFLOAD_INFO = 1,
35*5113495bSYour Name 
36*5113495bSYour Name 	HDD_DEBUGFS_FILE_ID_MAX,
37*5113495bSYour Name };
38*5113495bSYour Name 
39*5113495bSYour Name /**
40*5113495bSYour Name  * struct hdd_debugfs_file_info - Debugfs file info
41*5113495bSYour Name  * @name: name of debugfs file
42*5113495bSYour Name  * @id: id from enum hdd_debugfs_file_id used to identify file
43*5113495bSYour Name  * @buf_max_size: max size of buffer from which debugfs file is updated
44*5113495bSYour Name  * @entry: dentry pointer to debugfs file
45*5113495bSYour Name  */
46*5113495bSYour Name struct hdd_debugfs_file_info {
47*5113495bSYour Name 	uint8_t name[HDD_DEBUGFS_FILE_NAME_MAX];
48*5113495bSYour Name 	enum hdd_debugfs_file_id id;
49*5113495bSYour Name 	ssize_t buf_max_size;
50*5113495bSYour Name 	struct dentry *entry;
51*5113495bSYour Name };
52*5113495bSYour Name 
53*5113495bSYour Name QDF_STATUS hdd_debugfs_init(struct hdd_adapter *adapter);
54*5113495bSYour Name void hdd_debugfs_exit(struct hdd_adapter *adapter);
55*5113495bSYour Name 
56*5113495bSYour Name /**
57*5113495bSYour Name  * hdd_wait_for_debugfs_threads_completion() - Wait for debugfs threads
58*5113495bSYour Name  * completion before proceeding further to stop modules
59*5113495bSYour Name  *
60*5113495bSYour Name  * Return: true if there is no debugfs open
61*5113495bSYour Name  *         false if there is at least one debugfs open
62*5113495bSYour Name  */
63*5113495bSYour Name bool hdd_wait_for_debugfs_threads_completion(void);
64*5113495bSYour Name 
65*5113495bSYour Name /**
66*5113495bSYour Name  * hdd_return_debugfs_threads_count() - Return active debugfs threads
67*5113495bSYour Name  *
68*5113495bSYour Name  * Return: total number of active debugfs threads in driver
69*5113495bSYour Name  */
70*5113495bSYour Name int hdd_return_debugfs_threads_count(void);
71*5113495bSYour Name 
72*5113495bSYour Name /**
73*5113495bSYour Name  * hdd_debugfs_thread_increment() - Increment debugfs thread count
74*5113495bSYour Name  *
75*5113495bSYour Name  * This function is used to increment and keep track of debugfs thread count.
76*5113495bSYour Name  * This is invoked for every file open operation.
77*5113495bSYour Name  *
78*5113495bSYour Name  * Return: None
79*5113495bSYour Name  */
80*5113495bSYour Name void hdd_debugfs_thread_increment(void);
81*5113495bSYour Name 
82*5113495bSYour Name /**
83*5113495bSYour Name  * hdd_debugfs_thread_decrement() - Decrement debugfs thread count
84*5113495bSYour Name  *
85*5113495bSYour Name  * This function is used to decrement and keep track of debugfs thread count.
86*5113495bSYour Name  * This is invoked for every file release operation.
87*5113495bSYour Name  *
88*5113495bSYour Name  * Return: None
89*5113495bSYour Name  */
90*5113495bSYour Name void hdd_debugfs_thread_decrement(void);
91*5113495bSYour Name 
92*5113495bSYour Name #else
hdd_debugfs_init(struct hdd_adapter * adapter)93*5113495bSYour Name static inline QDF_STATUS hdd_debugfs_init(struct hdd_adapter *adapter)
94*5113495bSYour Name {
95*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
96*5113495bSYour Name }
97*5113495bSYour Name 
hdd_debugfs_exit(struct hdd_adapter * adapter)98*5113495bSYour Name static inline void hdd_debugfs_exit(struct hdd_adapter *adapter)
99*5113495bSYour Name {
100*5113495bSYour Name }
101*5113495bSYour Name 
102*5113495bSYour Name /**
103*5113495bSYour Name  * hdd_wait_for_debugfs_threads_completion() - Wait for debugfs threads
104*5113495bSYour Name  * completion before proceeding further to stop modules
105*5113495bSYour Name  *
106*5113495bSYour Name  * Return: true if there is no debugfs open
107*5113495bSYour Name  *         false if there is at least one debugfs open
108*5113495bSYour Name  */
109*5113495bSYour Name static inline
hdd_wait_for_debugfs_threads_completion(void)110*5113495bSYour Name bool hdd_wait_for_debugfs_threads_completion(void)
111*5113495bSYour Name {
112*5113495bSYour Name 	return true;
113*5113495bSYour Name }
114*5113495bSYour Name 
115*5113495bSYour Name /**
116*5113495bSYour Name  * hdd_return_debugfs_threads_count() - Return active debugfs threads
117*5113495bSYour Name  *
118*5113495bSYour Name  * Return: total number of active debugfs threads in driver
119*5113495bSYour Name  */
120*5113495bSYour Name static inline
hdd_return_debugfs_threads_count(void)121*5113495bSYour Name int hdd_return_debugfs_threads_count(void)
122*5113495bSYour Name {
123*5113495bSYour Name 	return 0;
124*5113495bSYour Name }
125*5113495bSYour Name 
126*5113495bSYour Name /**
127*5113495bSYour Name  * hdd_debugfs_thread_increment() - Increment debugfs thread count
128*5113495bSYour Name  *
129*5113495bSYour Name  * This function is used to increment and keep track of debugfs thread count.
130*5113495bSYour Name  * This is invoked for every file open operation.
131*5113495bSYour Name  *
132*5113495bSYour Name  * Return: None
133*5113495bSYour Name  */
134*5113495bSYour Name static inline
hdd_debugfs_thread_increment(void)135*5113495bSYour Name void hdd_debugfs_thread_increment(void)
136*5113495bSYour Name {
137*5113495bSYour Name }
138*5113495bSYour Name 
139*5113495bSYour Name /**
140*5113495bSYour Name  * hdd_debugfs_thread_decrement() - Decrement debugfs thread count
141*5113495bSYour Name  *
142*5113495bSYour Name  * This function is used to decrement and keep track of debugfs thread count.
143*5113495bSYour Name  * This is invoked for every file release operation.
144*5113495bSYour Name  *
145*5113495bSYour Name  * Return: None
146*5113495bSYour Name  */
147*5113495bSYour Name static inline
hdd_debugfs_thread_decrement(void)148*5113495bSYour Name void hdd_debugfs_thread_decrement(void)
149*5113495bSYour Name {
150*5113495bSYour Name }
151*5113495bSYour Name 
152*5113495bSYour Name #endif /* #ifdef WLAN_DEBUGFS */
153*5113495bSYour Name #endif /* #ifndef _WLAN_HDD_DEBUGFS_H */
154