1 /*
2 * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /**
21 * DOC: wlan_hdd_debugfs_llstat.h
22 *
23 * WLAN Host Device Driver implementation to update
24 * debugfs with Link Layer statistics
25 */
26
27 #ifndef _WLAN_HDD_DEBUGFS_LLSTAT_H
28 #define _WLAN_HDD_DEBUGFS_LLSTAT_H
29
30 #include <wlan_hdd_main.h>
31
32 #if defined(WLAN_FEATURE_11BE_MLO) && defined(CFG80211_11BE_BASIC)
33 #define DEBUGFS_LLSTATS_BUF_SIZE 32768
34 #else
35 #define DEBUGFS_LLSTATS_BUF_SIZE 16384
36 #endif
37
38 #define DEBUGFS_LLSTATS_REQID 4294967295UL
39 #define DEBUGFS_LLSTATS_REQMASK 0x7
40
41 #if defined(WLAN_FEATURE_LINK_LAYER_STATS) && defined(WLAN_DEBUGFS)
42 /**
43 * hdd_debugfs_process_peer_stats() - Parse Peer stats and add it to buffer
44 * @adapter: Pointer to device adapter
45 * @data: Pointer to stats data
46 *
47 * Receiving Link Layer peer statistics from FW. This function stores the
48 * firmware data in a buffer to be written into debugfs.
49 *
50 * Return: None
51 */
52 void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter, void *data);
53
54 /**
55 * hdd_debugfs_process_radio_stats() - Parse Radio stats and add it to buffer
56 * @adapter: Pointer to device adapter
57 * @more_data: More data
58 * @data: Pointer to stats data
59 * @num_radio: Number of radios
60 *
61 * Receiving Link Layer Radio statistics from FW. This function stores the
62 * firmware data in a buffer to be written into debugfs.
63 *
64 * Return: None
65 */
66 void hdd_debugfs_process_radio_stats(struct hdd_adapter *adapter,
67 uint32_t more_data, void *data, uint32_t num_radio);
68
69 /**
70 * hdd_debugfs_process_iface_stats() - This function is called after
71 * @link_info: Link info pointer in HDD adapter
72 * @data: Pointer to stats data
73 * @num_peers: Number of peers
74 *
75 * Receiving Link Layer Interface statistics from FW.This function converts
76 * the firmware data to the NL data and sends the same to the kernel/upper
77 * layers.
78 *
79 * Return: None
80 */
81 void hdd_debugfs_process_iface_stats(struct wlan_hdd_link_info *link_info,
82 void *data, uint32_t num_peers);
83
84 /**
85 * wlan_hdd_create_ll_stats_file() - API to create Link Layer stats file
86 * @adapter: interface adapter pointer
87 *
88 * Return: 0 on success and errno on failure
89 */
90 int wlan_hdd_create_ll_stats_file(struct hdd_adapter *adapter);
91 #else
hdd_debugfs_process_peer_stats(struct hdd_adapter * adapter,void * data)92 static inline void hdd_debugfs_process_peer_stats(struct hdd_adapter *adapter,
93 void *data)
94 {
95 }
96
hdd_debugfs_process_radio_stats(struct hdd_adapter * adapter,uint32_t more_data,void * data,uint32_t num_radio)97 static inline void hdd_debugfs_process_radio_stats(
98 struct hdd_adapter *adapter,
99 uint32_t more_data, void *data, uint32_t num_radio)
100 {
101 }
102
103 static inline void
hdd_debugfs_process_iface_stats(struct wlan_hdd_link_info * link_info,void * data,uint32_t num_peers)104 hdd_debugfs_process_iface_stats(struct wlan_hdd_link_info *link_info,
105 void *data, uint32_t num_peers)
106 {
107 }
108
wlan_hdd_create_ll_stats_file(struct hdd_adapter * adapter)109 static inline int wlan_hdd_create_ll_stats_file(struct hdd_adapter *adapter)
110 {
111 return 0;
112 }
113 #endif
114 #endif /* #ifndef _WLAN_HDD_DEBUGFS_LLSTAT_H */
115