1 /*
2 * Copyright (c) 2011-2020, The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 /**
18 * DOC: wlan_hdd_sysfs_stats.h
19 *
20 * Implementation for creating sysfs files:
21 *
22 * stats
23 * dump_stats
24 * clear_stats
25 */
26
27 #ifndef _WLAN_HDD_SYSFS_STATS_H
28 #define _WLAN_HDD_SYSFS_STATS_H
29
30 #if defined(WLAN_SYSFS) && defined(WLAN_SYSFS_STATS)
31 /**
32 * hdd_sysfs_stats_create() - API to create stats files
33 * @adapter: pointer to adapter
34 *
35 * these files are created per adapter.
36 * file path:
37 * /sys/class/net/wlanxx/dump_stats
38 * /sys/class/net/wlanxx/clear_stats
39 * /sys/class/net/wlanxx/stats
40 * where wlanxx is adapter name
41 *
42 * usage:
43 * echo [stats_id] > dump_stats
44 * cat dump_stats
45 * echo [stats_id] > clear_stats
46 * cat /sys/class/net/wlanxx/stats
47 *
48 * Return: 0 on success and errno on failure
49 */
50 int hdd_sysfs_stats_create(struct hdd_adapter *adapter);
51
52 /**
53 * hdd_sysfs_stats_destroy() -
54 * API to destroy stats
55 * @adapter: pointer to adapter
56 *
57 * Return: none
58 */
59 void hdd_sysfs_stats_destroy(struct hdd_adapter *adapter);
60 #else
61 static inline int
hdd_sysfs_stats_create(struct hdd_adapter * adapter)62 hdd_sysfs_stats_create(struct hdd_adapter *adapter)
63 {
64 return 0;
65 }
66
67 static inline void
hdd_sysfs_stats_destroy(struct hdd_adapter * adapter)68 hdd_sysfs_stats_destroy(struct hdd_adapter *adapter)
69 {
70 }
71 #endif
72 #endif /* #ifndef _WLAN_HDD_SYSFS_STATS_H */
73