Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 1 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 2 | /* |
| 3 | * mac80211 debugfs for wireless PHYs |
| 4 | * |
| 5 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> |
| 6 | * |
| 7 | * GPLv2 |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | #include <linux/debugfs.h> |
| 12 | #include <linux/rtnetlink.h> |
| 13 | #include "ieee80211_i.h" |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 14 | #include "driver-ops.h" |
Johannes Berg | 2c8dccc | 2008-04-08 15:14:40 -0400 | [diff] [blame] | 15 | #include "rate.h" |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 16 | #include "debugfs.h" |
| 17 | |
Eliad Peller | 07caf9d | 2010-10-27 14:58:29 +0200 | [diff] [blame] | 18 | #define DEBUGFS_FORMAT_BUFFER_SIZE 100 |
| 19 | |
| 20 | int mac80211_format_buffer(char __user *userbuf, size_t count, |
| 21 | loff_t *ppos, char *fmt, ...) |
| 22 | { |
| 23 | va_list args; |
| 24 | char buf[DEBUGFS_FORMAT_BUFFER_SIZE]; |
| 25 | int res; |
| 26 | |
| 27 | va_start(args, fmt); |
| 28 | res = vscnprintf(buf, sizeof(buf), fmt, args); |
| 29 | va_end(args); |
| 30 | |
| 31 | return simple_read_from_buffer(userbuf, count, ppos, buf, res); |
| 32 | } |
| 33 | |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 34 | #define DEBUGFS_READONLY_FILE_FN(name, fmt, value...) \ |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 35 | static ssize_t name## _read(struct file *file, char __user *userbuf, \ |
| 36 | size_t count, loff_t *ppos) \ |
| 37 | { \ |
| 38 | struct ieee80211_local *local = file->private_data; \ |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 39 | \ |
Eliad Peller | 07caf9d | 2010-10-27 14:58:29 +0200 | [diff] [blame] | 40 | return mac80211_format_buffer(userbuf, count, ppos, \ |
| 41 | fmt "\n", ##value); \ |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | #define DEBUGFS_READONLY_FILE_OPS(name) \ |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 45 | static const struct file_operations name## _ops = { \ |
| 46 | .read = name## _read, \ |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 47 | .open = simple_open, \ |
Arnd Bergmann | 2b18ab36 | 2010-07-06 19:05:31 +0200 | [diff] [blame] | 48 | .llseek = generic_file_llseek, \ |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 51 | #define DEBUGFS_READONLY_FILE(name, fmt, value...) \ |
| 52 | DEBUGFS_READONLY_FILE_FN(name, fmt, value) \ |
| 53 | DEBUGFS_READONLY_FILE_OPS(name) |
| 54 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 55 | #define DEBUGFS_ADD(name) \ |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 56 | debugfs_create_file(#name, 0400, phyd, local, &name## _ops); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 57 | |
Johannes Berg | 827b1fb | 2009-03-13 11:44:18 +0100 | [diff] [blame] | 58 | #define DEBUGFS_ADD_MODE(name, mode) \ |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 59 | debugfs_create_file(#name, mode, phyd, local, &name## _ops); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 60 | |
| 61 | |
Ben Greear | 83bdf2a | 2011-02-15 13:11:22 -0800 | [diff] [blame] | 62 | DEBUGFS_READONLY_FILE(user_power, "%d", |
| 63 | local->user_power_level); |
| 64 | DEBUGFS_READONLY_FILE(power, "%d", |
| 65 | local->hw.conf.power_level); |
Eliad Peller | 07caf9d | 2010-10-27 14:58:29 +0200 | [diff] [blame] | 66 | DEBUGFS_READONLY_FILE(total_ps_buffered, "%d", |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 67 | local->total_ps_buffered); |
Eliad Peller | 07caf9d | 2010-10-27 14:58:29 +0200 | [diff] [blame] | 68 | DEBUGFS_READONLY_FILE(wep_iv, "%#08x", |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 69 | local->wep_iv & 0xffffff); |
Eliad Peller | 07caf9d | 2010-10-27 14:58:29 +0200 | [diff] [blame] | 70 | DEBUGFS_READONLY_FILE(rate_ctrl_alg, "%s", |
Johannes Berg | af65cd96 | 2009-11-17 18:18:36 +0100 | [diff] [blame] | 71 | local->rate_ctrl ? local->rate_ctrl->ops->name : "hw/driver"); |
Alina Friedrichsen | 3b5d665 | 2009-01-24 07:09:59 +0100 | [diff] [blame] | 72 | |
Johannes Berg | 2ad4814 | 2012-09-19 08:20:24 +0200 | [diff] [blame] | 73 | #ifdef CONFIG_PM |
Johannes Berg | 827b1fb | 2009-03-13 11:44:18 +0100 | [diff] [blame] | 74 | static ssize_t reset_write(struct file *file, const char __user *user_buf, |
| 75 | size_t count, loff_t *ppos) |
| 76 | { |
| 77 | struct ieee80211_local *local = file->private_data; |
| 78 | |
| 79 | rtnl_lock(); |
Johannes Berg | eecc480 | 2011-05-04 15:37:29 +0200 | [diff] [blame] | 80 | __ieee80211_suspend(&local->hw, NULL); |
Johannes Berg | 827b1fb | 2009-03-13 11:44:18 +0100 | [diff] [blame] | 81 | __ieee80211_resume(&local->hw); |
| 82 | rtnl_unlock(); |
| 83 | |
| 84 | return count; |
| 85 | } |
| 86 | |
| 87 | static const struct file_operations reset_ops = { |
| 88 | .write = reset_write, |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 89 | .open = simple_open, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 90 | .llseek = noop_llseek, |
Johannes Berg | 827b1fb | 2009-03-13 11:44:18 +0100 | [diff] [blame] | 91 | }; |
Johannes Berg | 2ad4814 | 2012-09-19 08:20:24 +0200 | [diff] [blame] | 92 | #endif |
Johannes Berg | 827b1fb | 2009-03-13 11:44:18 +0100 | [diff] [blame] | 93 | |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 94 | static ssize_t hwflags_read(struct file *file, char __user *user_buf, |
| 95 | size_t count, loff_t *ppos) |
| 96 | { |
| 97 | struct ieee80211_local *local = file->private_data; |
| 98 | int mxln = 500; |
| 99 | ssize_t rv; |
| 100 | char *buf = kzalloc(mxln, GFP_KERNEL); |
| 101 | int sf = 0; /* how many written so far */ |
| 102 | |
Joe Perches | d15b845 | 2011-08-29 14:17:31 -0700 | [diff] [blame] | 103 | if (!buf) |
| 104 | return 0; |
| 105 | |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 106 | sf += scnprintf(buf, mxln - sf, "0x%x\n", local->hw.flags); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 107 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 108 | sf += scnprintf(buf + sf, mxln - sf, "HAS_RATE_CONTROL\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 109 | if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 110 | sf += scnprintf(buf + sf, mxln - sf, "RX_INCLUDES_FCS\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 111 | if (local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 112 | sf += scnprintf(buf + sf, mxln - sf, |
| 113 | "HOST_BCAST_PS_BUFFERING\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 114 | if (local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 115 | sf += scnprintf(buf + sf, mxln - sf, |
| 116 | "2GHZ_SHORT_SLOT_INCAPABLE\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 117 | if (local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 118 | sf += scnprintf(buf + sf, mxln - sf, |
| 119 | "2GHZ_SHORT_PREAMBLE_INCAPABLE\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 120 | if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 121 | sf += scnprintf(buf + sf, mxln - sf, "SIGNAL_UNSPEC\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 122 | if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 123 | sf += scnprintf(buf + sf, mxln - sf, "SIGNAL_DBM\n"); |
Emmanuel Grumbach | c65dd14 | 2012-12-12 10:12:24 +0200 | [diff] [blame] | 124 | if (local->hw.flags & IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 125 | sf += scnprintf(buf + sf, mxln - sf, |
| 126 | "NEED_DTIM_BEFORE_ASSOC\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 127 | if (local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 128 | sf += scnprintf(buf + sf, mxln - sf, "SPECTRUM_MGMT\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 129 | if (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 130 | sf += scnprintf(buf + sf, mxln - sf, "AMPDU_AGGREGATION\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 131 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_PS) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 132 | sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_PS\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 133 | if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 134 | sf += scnprintf(buf + sf, mxln - sf, "PS_NULLFUNC_STACK\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 135 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 136 | sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_DYNAMIC_PS\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 137 | if (local->hw.flags & IEEE80211_HW_MFP_CAPABLE) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 138 | sf += scnprintf(buf + sf, mxln - sf, "MFP_CAPABLE\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 139 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_STATIC_SMPS) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 140 | sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_STATIC_SMPS\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 141 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 142 | sf += scnprintf(buf + sf, mxln - sf, |
| 143 | "SUPPORTS_DYNAMIC_SMPS\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 144 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 145 | sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_UAPSD\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 146 | if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 147 | sf += scnprintf(buf + sf, mxln - sf, |
| 148 | "REPORTS_TX_ACK_STATUS\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 149 | if (local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 150 | sf += scnprintf(buf + sf, mxln - sf, "CONNECTION_MONITOR\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 151 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_PER_STA_GTK) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 152 | sf += scnprintf(buf + sf, mxln - sf, "SUPPORTS_PER_STA_GTK\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 153 | if (local->hw.flags & IEEE80211_HW_AP_LINK_PS) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 154 | sf += scnprintf(buf + sf, mxln - sf, "AP_LINK_PS\n"); |
Arik Nemtsov | edf6b78 | 2011-08-30 09:32:38 +0300 | [diff] [blame] | 155 | if (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW) |
Eliad Peller | f364ef9 | 2013-08-27 12:40:15 +0300 | [diff] [blame^] | 156 | sf += scnprintf(buf + sf, mxln - sf, "TX_AMPDU_SETUP_IN_HW\n"); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 157 | |
| 158 | rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); |
| 159 | kfree(buf); |
| 160 | return rv; |
| 161 | } |
Benoit Papillault | 199d69f | 2010-02-04 22:00:20 +0100 | [diff] [blame] | 162 | |
Johannes Berg | db2e6bd | 2009-06-14 17:37:39 +0200 | [diff] [blame] | 163 | static ssize_t queues_read(struct file *file, char __user *user_buf, |
| 164 | size_t count, loff_t *ppos) |
| 165 | { |
| 166 | struct ieee80211_local *local = file->private_data; |
| 167 | unsigned long flags; |
| 168 | char buf[IEEE80211_MAX_QUEUES * 20]; |
| 169 | int q, res = 0; |
| 170 | |
| 171 | spin_lock_irqsave(&local->queue_stop_reason_lock, flags); |
| 172 | for (q = 0; q < local->hw.queues; q++) |
| 173 | res += sprintf(buf + res, "%02d: %#.8lx/%d\n", q, |
| 174 | local->queue_stop_reasons[q], |
Johannes Berg | 3b8d81e0 | 2009-06-17 17:43:56 +0200 | [diff] [blame] | 175 | skb_queue_len(&local->pending[q])); |
Johannes Berg | db2e6bd | 2009-06-14 17:37:39 +0200 | [diff] [blame] | 176 | spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); |
| 177 | |
| 178 | return simple_read_from_buffer(user_buf, count, ppos, buf, res); |
| 179 | } |
| 180 | |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 181 | DEBUGFS_READONLY_FILE_OPS(hwflags); |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 182 | DEBUGFS_READONLY_FILE_OPS(queues); |
Johannes Berg | db2e6bd | 2009-06-14 17:37:39 +0200 | [diff] [blame] | 183 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 184 | /* statistics stuff */ |
| 185 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 186 | static ssize_t format_devstat_counter(struct ieee80211_local *local, |
| 187 | char __user *userbuf, |
| 188 | size_t count, loff_t *ppos, |
| 189 | int (*printvalue)(struct ieee80211_low_level_stats *stats, char *buf, |
| 190 | int buflen)) |
| 191 | { |
| 192 | struct ieee80211_low_level_stats stats; |
| 193 | char buf[20]; |
| 194 | int res; |
| 195 | |
Johannes Berg | 7563652 | 2008-07-09 14:40:35 +0200 | [diff] [blame] | 196 | rtnl_lock(); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 197 | res = drv_get_stats(local, &stats); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 198 | rtnl_unlock(); |
Johannes Berg | 2448798 | 2009-04-23 18:52:52 +0200 | [diff] [blame] | 199 | if (res) |
| 200 | return res; |
| 201 | res = printvalue(&stats, buf, sizeof(buf)); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 202 | return simple_read_from_buffer(userbuf, count, ppos, buf, res); |
| 203 | } |
| 204 | |
| 205 | #define DEBUGFS_DEVSTATS_FILE(name) \ |
| 206 | static int print_devstats_##name(struct ieee80211_low_level_stats *stats,\ |
| 207 | char *buf, int buflen) \ |
| 208 | { \ |
| 209 | return scnprintf(buf, buflen, "%u\n", stats->name); \ |
| 210 | } \ |
| 211 | static ssize_t stats_ ##name## _read(struct file *file, \ |
| 212 | char __user *userbuf, \ |
| 213 | size_t count, loff_t *ppos) \ |
| 214 | { \ |
| 215 | return format_devstat_counter(file->private_data, \ |
| 216 | userbuf, \ |
| 217 | count, \ |
| 218 | ppos, \ |
| 219 | print_devstats_##name); \ |
| 220 | } \ |
| 221 | \ |
| 222 | static const struct file_operations stats_ ##name## _ops = { \ |
| 223 | .read = stats_ ##name## _read, \ |
Stephen Boyd | 234e340 | 2012-04-05 14:25:11 -0700 | [diff] [blame] | 224 | .open = simple_open, \ |
Arnd Bergmann | 2b18ab36 | 2010-07-06 19:05:31 +0200 | [diff] [blame] | 225 | .llseek = generic_file_llseek, \ |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 226 | }; |
| 227 | |
Felix Fietkau | 2826bcd | 2010-06-02 02:57:34 +0200 | [diff] [blame] | 228 | #define DEBUGFS_STATS_ADD(name, field) \ |
| 229 | debugfs_create_u32(#name, 0400, statsd, (u32 *) &field); |
| 230 | #define DEBUGFS_DEVSTATS_ADD(name) \ |
Johannes Berg | 7bcfaf2 | 2009-10-27 12:59:03 +0100 | [diff] [blame] | 231 | debugfs_create_file(#name, 0400, statsd, local, &stats_ ##name## _ops); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 232 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 233 | DEBUGFS_DEVSTATS_FILE(dot11ACKFailureCount); |
| 234 | DEBUGFS_DEVSTATS_FILE(dot11RTSFailureCount); |
| 235 | DEBUGFS_DEVSTATS_FILE(dot11FCSErrorCount); |
| 236 | DEBUGFS_DEVSTATS_FILE(dot11RTSSuccessCount); |
| 237 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 238 | void debugfs_hw_add(struct ieee80211_local *local) |
| 239 | { |
| 240 | struct dentry *phyd = local->hw.wiphy->debugfsdir; |
| 241 | struct dentry *statsd; |
| 242 | |
| 243 | if (!phyd) |
| 244 | return; |
| 245 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 246 | local->debugfs.keys = debugfs_create_dir("keys", phyd); |
| 247 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 248 | DEBUGFS_ADD(total_ps_buffered); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 249 | DEBUGFS_ADD(wep_iv); |
Johannes Berg | db2e6bd | 2009-06-14 17:37:39 +0200 | [diff] [blame] | 250 | DEBUGFS_ADD(queues); |
Johannes Berg | 2ad4814 | 2012-09-19 08:20:24 +0200 | [diff] [blame] | 251 | #ifdef CONFIG_PM |
Johannes Berg | 827b1fb | 2009-03-13 11:44:18 +0100 | [diff] [blame] | 252 | DEBUGFS_ADD_MODE(reset, 0200); |
Johannes Berg | 2ad4814 | 2012-09-19 08:20:24 +0200 | [diff] [blame] | 253 | #endif |
Ben Greear | 279daf6 | 2011-03-23 14:04:31 -0700 | [diff] [blame] | 254 | DEBUGFS_ADD(hwflags); |
Ben Greear | 83bdf2a | 2011-02-15 13:11:22 -0800 | [diff] [blame] | 255 | DEBUGFS_ADD(user_power); |
| 256 | DEBUGFS_ADD(power); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 257 | |
| 258 | statsd = debugfs_create_dir("statistics", phyd); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 259 | |
| 260 | /* if the dir failed, don't put all the other things into the root! */ |
| 261 | if (!statsd) |
| 262 | return; |
| 263 | |
Felix Fietkau | 2826bcd | 2010-06-02 02:57:34 +0200 | [diff] [blame] | 264 | DEBUGFS_STATS_ADD(transmitted_fragment_count, |
| 265 | local->dot11TransmittedFragmentCount); |
| 266 | DEBUGFS_STATS_ADD(multicast_transmitted_frame_count, |
| 267 | local->dot11MulticastTransmittedFrameCount); |
| 268 | DEBUGFS_STATS_ADD(failed_count, local->dot11FailedCount); |
| 269 | DEBUGFS_STATS_ADD(retry_count, local->dot11RetryCount); |
| 270 | DEBUGFS_STATS_ADD(multiple_retry_count, |
| 271 | local->dot11MultipleRetryCount); |
| 272 | DEBUGFS_STATS_ADD(frame_duplicate_count, |
| 273 | local->dot11FrameDuplicateCount); |
| 274 | DEBUGFS_STATS_ADD(received_fragment_count, |
| 275 | local->dot11ReceivedFragmentCount); |
| 276 | DEBUGFS_STATS_ADD(multicast_received_frame_count, |
| 277 | local->dot11MulticastReceivedFrameCount); |
| 278 | DEBUGFS_STATS_ADD(transmitted_frame_count, |
| 279 | local->dot11TransmittedFrameCount); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 280 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS |
Felix Fietkau | 2826bcd | 2010-06-02 02:57:34 +0200 | [diff] [blame] | 281 | DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop); |
| 282 | DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued); |
| 283 | DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted, |
| 284 | local->tx_handlers_drop_unencrypted); |
| 285 | DEBUGFS_STATS_ADD(tx_handlers_drop_fragment, |
| 286 | local->tx_handlers_drop_fragment); |
| 287 | DEBUGFS_STATS_ADD(tx_handlers_drop_wep, |
| 288 | local->tx_handlers_drop_wep); |
| 289 | DEBUGFS_STATS_ADD(tx_handlers_drop_not_assoc, |
| 290 | local->tx_handlers_drop_not_assoc); |
| 291 | DEBUGFS_STATS_ADD(tx_handlers_drop_unauth_port, |
| 292 | local->tx_handlers_drop_unauth_port); |
| 293 | DEBUGFS_STATS_ADD(rx_handlers_drop, local->rx_handlers_drop); |
| 294 | DEBUGFS_STATS_ADD(rx_handlers_queued, local->rx_handlers_queued); |
| 295 | DEBUGFS_STATS_ADD(rx_handlers_drop_nullfunc, |
| 296 | local->rx_handlers_drop_nullfunc); |
| 297 | DEBUGFS_STATS_ADD(rx_handlers_drop_defrag, |
| 298 | local->rx_handlers_drop_defrag); |
| 299 | DEBUGFS_STATS_ADD(rx_handlers_drop_short, |
| 300 | local->rx_handlers_drop_short); |
Felix Fietkau | 2826bcd | 2010-06-02 02:57:34 +0200 | [diff] [blame] | 301 | DEBUGFS_STATS_ADD(tx_expand_skb_head, |
| 302 | local->tx_expand_skb_head); |
| 303 | DEBUGFS_STATS_ADD(tx_expand_skb_head_cloned, |
| 304 | local->tx_expand_skb_head_cloned); |
| 305 | DEBUGFS_STATS_ADD(rx_expand_skb_head, |
| 306 | local->rx_expand_skb_head); |
| 307 | DEBUGFS_STATS_ADD(rx_expand_skb_head2, |
| 308 | local->rx_expand_skb_head2); |
| 309 | DEBUGFS_STATS_ADD(rx_handlers_fragments, |
| 310 | local->rx_handlers_fragments); |
| 311 | DEBUGFS_STATS_ADD(tx_status_drop, |
| 312 | local->tx_status_drop); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 313 | #endif |
Felix Fietkau | 2826bcd | 2010-06-02 02:57:34 +0200 | [diff] [blame] | 314 | DEBUGFS_DEVSTATS_ADD(dot11ACKFailureCount); |
| 315 | DEBUGFS_DEVSTATS_ADD(dot11RTSFailureCount); |
| 316 | DEBUGFS_DEVSTATS_ADD(dot11FCSErrorCount); |
| 317 | DEBUGFS_DEVSTATS_ADD(dot11RTSSuccessCount); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 318 | } |