Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * GPL LICENSE SUMMARY |
| 4 | * |
Reinette Chatre | 1f44780 | 2010-01-15 13:43:41 -0800 | [diff] [blame] | 5 | * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved. |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of version 2 of the GNU General Public License as |
| 9 | * published by the Free Software Foundation. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 19 | * USA |
| 20 | * |
| 21 | * The full GNU General Public License is included in this distribution |
| 22 | * in the file called LICENSE.GPL. |
| 23 | * |
| 24 | * Contact Information: |
Winkler, Tomas | 759ef89 | 2008-12-09 11:28:58 -0800 | [diff] [blame] | 25 | * Intel Linux Wireless <ilw@linux.intel.com> |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 26 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 27 | *****************************************************************************/ |
| 28 | |
| 29 | #include <linux/kernel.h> |
| 30 | #include <linux/module.h> |
| 31 | #include <linux/debugfs.h> |
| 32 | |
| 33 | #include <linux/ieee80211.h> |
| 34 | #include <net/mac80211.h> |
| 35 | |
| 36 | |
Tomas Winkler | 3e0d4cb | 2008-04-24 11:55:38 -0700 | [diff] [blame] | 37 | #include "iwl-dev.h" |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 38 | #include "iwl-debug.h" |
Tomas Winkler | fee1247 | 2008-04-03 16:05:21 -0700 | [diff] [blame] | 39 | #include "iwl-core.h" |
Tomas Winkler | 3395f6e | 2008-03-25 16:33:37 -0700 | [diff] [blame] | 40 | #include "iwl-io.h" |
Wey-Yi Guy | 5225935 | 2009-08-07 15:41:43 -0700 | [diff] [blame] | 41 | #include "iwl-calib.h" |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 42 | |
| 43 | /* create and remove of files */ |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 44 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
| 45 | if (!debugfs_create_file(#name, mode, parent, priv, \ |
| 46 | &iwl_dbgfs_##name##_ops)) \ |
| 47 | goto err; \ |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 48 | } while (0) |
| 49 | |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 50 | #define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \ |
| 51 | struct dentry *__tmp; \ |
| 52 | __tmp = debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \ |
| 53 | parent, ptr); \ |
| 54 | if (IS_ERR(__tmp) || !__tmp) \ |
| 55 | goto err; \ |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 56 | } while (0) |
| 57 | |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 58 | #define DEBUGFS_ADD_X32(name, parent, ptr) do { \ |
| 59 | struct dentry *__tmp; \ |
| 60 | __tmp = debugfs_create_x32(#name, S_IWUSR | S_IRUSR, \ |
| 61 | parent, ptr); \ |
| 62 | if (IS_ERR(__tmp) || !__tmp) \ |
| 63 | goto err; \ |
Tomas Winkler | 445c2df | 2008-05-15 13:54:16 +0800 | [diff] [blame] | 64 | } while (0) |
| 65 | |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 66 | /* file operation */ |
| 67 | #define DEBUGFS_READ_FUNC(name) \ |
| 68 | static ssize_t iwl_dbgfs_##name##_read(struct file *file, \ |
| 69 | char __user *user_buf, \ |
| 70 | size_t count, loff_t *ppos); |
| 71 | |
| 72 | #define DEBUGFS_WRITE_FUNC(name) \ |
| 73 | static ssize_t iwl_dbgfs_##name##_write(struct file *file, \ |
| 74 | const char __user *user_buf, \ |
| 75 | size_t count, loff_t *ppos); |
| 76 | |
| 77 | |
| 78 | static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file) |
| 79 | { |
| 80 | file->private_data = inode->i_private; |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | #define DEBUGFS_READ_FILE_OPS(name) \ |
| 85 | DEBUGFS_READ_FUNC(name); \ |
| 86 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
| 87 | .read = iwl_dbgfs_##name##_read, \ |
| 88 | .open = iwl_dbgfs_open_file_generic, \ |
| 89 | }; |
| 90 | |
Ester Kummer | 189a2b5 | 2008-05-15 13:54:18 +0800 | [diff] [blame] | 91 | #define DEBUGFS_WRITE_FILE_OPS(name) \ |
| 92 | DEBUGFS_WRITE_FUNC(name); \ |
| 93 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
| 94 | .write = iwl_dbgfs_##name##_write, \ |
| 95 | .open = iwl_dbgfs_open_file_generic, \ |
| 96 | }; |
| 97 | |
| 98 | |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 99 | #define DEBUGFS_READ_WRITE_FILE_OPS(name) \ |
| 100 | DEBUGFS_READ_FUNC(name); \ |
| 101 | DEBUGFS_WRITE_FUNC(name); \ |
| 102 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
| 103 | .write = iwl_dbgfs_##name##_write, \ |
| 104 | .read = iwl_dbgfs_##name##_read, \ |
| 105 | .open = iwl_dbgfs_open_file_generic, \ |
| 106 | }; |
| 107 | |
| 108 | |
| 109 | static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, |
| 110 | char __user *user_buf, |
| 111 | size_t count, loff_t *ppos) { |
| 112 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 113 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 114 | char *buf; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 115 | int pos = 0; |
| 116 | |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 117 | int cnt; |
| 118 | ssize_t ret; |
Wey-Yi Guy | 98a7b43 | 2009-11-13 11:56:31 -0800 | [diff] [blame] | 119 | const size_t bufsz = 100 + |
| 120 | sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX); |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 121 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 122 | if (!buf) |
| 123 | return -ENOMEM; |
| 124 | pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); |
| 125 | for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { |
| 126 | pos += scnprintf(buf + pos, bufsz - pos, |
Wey-Yi Guy | 98a7b43 | 2009-11-13 11:56:31 -0800 | [diff] [blame] | 127 | "\t%25s\t\t: %u\n", |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 128 | get_mgmt_string(cnt), |
| 129 | priv->tx_stats.mgmt[cnt]); |
| 130 | } |
| 131 | pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); |
| 132 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { |
| 133 | pos += scnprintf(buf + pos, bufsz - pos, |
Wey-Yi Guy | 98a7b43 | 2009-11-13 11:56:31 -0800 | [diff] [blame] | 134 | "\t%25s\t\t: %u\n", |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 135 | get_ctrl_string(cnt), |
| 136 | priv->tx_stats.ctrl[cnt]); |
| 137 | } |
| 138 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); |
| 139 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", |
| 140 | priv->tx_stats.data_cnt); |
| 141 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", |
| 142 | priv->tx_stats.data_bytes); |
| 143 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 144 | kfree(buf); |
| 145 | return ret; |
| 146 | } |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 147 | |
Wey-Yi Guy | 7163b8a | 2009-11-20 12:04:56 -0800 | [diff] [blame] | 148 | static ssize_t iwl_dbgfs_clear_traffic_statistics_write(struct file *file, |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 149 | const char __user *user_buf, |
| 150 | size_t count, loff_t *ppos) |
| 151 | { |
| 152 | struct iwl_priv *priv = file->private_data; |
| 153 | u32 clear_flag; |
| 154 | char buf[8]; |
| 155 | int buf_size; |
| 156 | |
| 157 | memset(buf, 0, sizeof(buf)); |
| 158 | buf_size = min(count, sizeof(buf) - 1); |
| 159 | if (copy_from_user(buf, user_buf, buf_size)) |
| 160 | return -EFAULT; |
| 161 | if (sscanf(buf, "%x", &clear_flag) != 1) |
| 162 | return -EFAULT; |
Wey-Yi Guy | 7163b8a | 2009-11-20 12:04:56 -0800 | [diff] [blame] | 163 | iwl_clear_traffic_stats(priv); |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 164 | |
| 165 | return count; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file, |
| 169 | char __user *user_buf, |
| 170 | size_t count, loff_t *ppos) { |
| 171 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 172 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 173 | char *buf; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 174 | int pos = 0; |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 175 | int cnt; |
| 176 | ssize_t ret; |
| 177 | const size_t bufsz = 100 + |
Wey-Yi Guy | 98a7b43 | 2009-11-13 11:56:31 -0800 | [diff] [blame] | 178 | sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX); |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 179 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 180 | if (!buf) |
| 181 | return -ENOMEM; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 182 | |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 183 | pos += scnprintf(buf + pos, bufsz - pos, "Management:\n"); |
| 184 | for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) { |
| 185 | pos += scnprintf(buf + pos, bufsz - pos, |
Wey-Yi Guy | 98a7b43 | 2009-11-13 11:56:31 -0800 | [diff] [blame] | 186 | "\t%25s\t\t: %u\n", |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 187 | get_mgmt_string(cnt), |
| 188 | priv->rx_stats.mgmt[cnt]); |
| 189 | } |
| 190 | pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); |
| 191 | for (cnt = 0; cnt < CONTROL_MAX; cnt++) { |
| 192 | pos += scnprintf(buf + pos, bufsz - pos, |
Wey-Yi Guy | 98a7b43 | 2009-11-13 11:56:31 -0800 | [diff] [blame] | 193 | "\t%25s\t\t: %u\n", |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 194 | get_ctrl_string(cnt), |
| 195 | priv->rx_stats.ctrl[cnt]); |
| 196 | } |
| 197 | pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); |
| 198 | pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", |
| 199 | priv->rx_stats.data_cnt); |
| 200 | pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", |
| 201 | priv->rx_stats.data_bytes); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 202 | |
Wey-Yi Guy | 22fdf3c | 2009-08-07 15:41:40 -0700 | [diff] [blame] | 203 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 204 | kfree(buf); |
| 205 | return ret; |
| 206 | } |
| 207 | |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 208 | #define BYTE1_MASK 0x000000ff; |
| 209 | #define BYTE2_MASK 0x0000ffff; |
| 210 | #define BYTE3_MASK 0x00ffffff; |
| 211 | static ssize_t iwl_dbgfs_sram_read(struct file *file, |
| 212 | char __user *user_buf, |
| 213 | size_t count, loff_t *ppos) |
| 214 | { |
| 215 | u32 val; |
Wey-Yi Guy | 2943f13 | 2009-11-20 12:05:00 -0800 | [diff] [blame] | 216 | char *buf; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 217 | ssize_t ret; |
| 218 | int i; |
| 219 | int pos = 0; |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 220 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 2943f13 | 2009-11-20 12:05:00 -0800 | [diff] [blame] | 221 | size_t bufsz; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 222 | |
Wey-Yi Guy | 5ade1e4 | 2009-11-20 12:05:04 -0800 | [diff] [blame] | 223 | /* default is to dump the entire data segment */ |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 224 | if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { |
| 225 | priv->dbgfs_sram_offset = 0x800000; |
Wey-Yi Guy | 5ade1e4 | 2009-11-20 12:05:04 -0800 | [diff] [blame] | 226 | if (priv->ucode_type == UCODE_INIT) |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 227 | priv->dbgfs_sram_len = priv->ucode_init_data.len; |
Wey-Yi Guy | 5ade1e4 | 2009-11-20 12:05:04 -0800 | [diff] [blame] | 228 | else |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 229 | priv->dbgfs_sram_len = priv->ucode_data.len; |
Wey-Yi Guy | 5ade1e4 | 2009-11-20 12:05:04 -0800 | [diff] [blame] | 230 | } |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 231 | bufsz = 30 + priv->dbgfs_sram_len * sizeof(char) * 10; |
Wey-Yi Guy | 2943f13 | 2009-11-20 12:05:00 -0800 | [diff] [blame] | 232 | buf = kmalloc(bufsz, GFP_KERNEL); |
| 233 | if (!buf) |
| 234 | return -ENOMEM; |
Wey-Yi Guy | 5ade1e4 | 2009-11-20 12:05:04 -0800 | [diff] [blame] | 235 | pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n", |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 236 | priv->dbgfs_sram_len); |
Wey-Yi Guy | 5ade1e4 | 2009-11-20 12:05:04 -0800 | [diff] [blame] | 237 | pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n", |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 238 | priv->dbgfs_sram_offset); |
| 239 | for (i = priv->dbgfs_sram_len; i > 0; i -= 4) { |
| 240 | val = iwl_read_targ_mem(priv, priv->dbgfs_sram_offset + \ |
| 241 | priv->dbgfs_sram_len - i); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 242 | if (i < 4) { |
| 243 | switch (i) { |
| 244 | case 1: |
| 245 | val &= BYTE1_MASK; |
| 246 | break; |
| 247 | case 2: |
| 248 | val &= BYTE2_MASK; |
| 249 | break; |
| 250 | case 3: |
| 251 | val &= BYTE3_MASK; |
| 252 | break; |
| 253 | } |
| 254 | } |
Wey-Yi Guy | 2943f13 | 2009-11-20 12:05:00 -0800 | [diff] [blame] | 255 | if (!(i % 16)) |
| 256 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 257 | pos += scnprintf(buf + pos, bufsz - pos, "0x%08x ", val); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 258 | } |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 259 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 260 | |
| 261 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
Wey-Yi Guy | 2943f13 | 2009-11-20 12:05:00 -0800 | [diff] [blame] | 262 | kfree(buf); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 263 | return ret; |
| 264 | } |
| 265 | |
| 266 | static ssize_t iwl_dbgfs_sram_write(struct file *file, |
| 267 | const char __user *user_buf, |
| 268 | size_t count, loff_t *ppos) |
| 269 | { |
| 270 | struct iwl_priv *priv = file->private_data; |
| 271 | char buf[64]; |
| 272 | int buf_size; |
| 273 | u32 offset, len; |
| 274 | |
| 275 | memset(buf, 0, sizeof(buf)); |
| 276 | buf_size = min(count, sizeof(buf) - 1); |
| 277 | if (copy_from_user(buf, user_buf, buf_size)) |
| 278 | return -EFAULT; |
| 279 | |
| 280 | if (sscanf(buf, "%x,%x", &offset, &len) == 2) { |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 281 | priv->dbgfs_sram_offset = offset; |
| 282 | priv->dbgfs_sram_len = len; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 283 | } else { |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 284 | priv->dbgfs_sram_offset = 0; |
| 285 | priv->dbgfs_sram_len = 0; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | return count; |
| 289 | } |
| 290 | |
| 291 | static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf, |
| 292 | size_t count, loff_t *ppos) |
| 293 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 294 | struct iwl_priv *priv = file->private_data; |
Tomas Winkler | 6def976 | 2008-05-05 10:22:31 +0800 | [diff] [blame] | 295 | struct iwl_station_entry *station; |
Tomas Winkler | 5425e49 | 2008-04-15 16:01:38 -0700 | [diff] [blame] | 296 | int max_sta = priv->hw_params.max_stations; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 297 | char *buf; |
| 298 | int i, j, pos = 0; |
| 299 | ssize_t ret; |
| 300 | /* Add 30 for initial string */ |
| 301 | const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 302 | |
| 303 | buf = kmalloc(bufsz, GFP_KERNEL); |
Tomas Winkler | 3ac7f14 | 2008-07-21 02:40:14 +0300 | [diff] [blame] | 304 | if (!buf) |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 305 | return -ENOMEM; |
| 306 | |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 307 | pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n", |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 308 | priv->num_stations); |
| 309 | |
| 310 | for (i = 0; i < max_sta; i++) { |
| 311 | station = &priv->stations[i]; |
| 312 | if (station->used) { |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 313 | pos += scnprintf(buf + pos, bufsz - pos, |
| 314 | "station %d:\ngeneral data:\n", i+1); |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 315 | pos += scnprintf(buf + pos, bufsz - pos, "id: %u\n", |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 316 | station->sta.sta.sta_id); |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 317 | pos += scnprintf(buf + pos, bufsz - pos, "mode: %u\n", |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 318 | station->sta.mode); |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 319 | pos += scnprintf(buf + pos, bufsz - pos, |
| 320 | "flags: 0x%x\n", |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 321 | station->sta.station_flags_msk); |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 322 | pos += scnprintf(buf + pos, bufsz - pos, "tid data:\n"); |
| 323 | pos += scnprintf(buf + pos, bufsz - pos, |
David S. Miller | 344234d | 2008-04-19 18:09:39 -0700 | [diff] [blame] | 324 | "seq_num\t\ttxq_id"); |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 325 | pos += scnprintf(buf + pos, bufsz - pos, |
David S. Miller | 344234d | 2008-04-19 18:09:39 -0700 | [diff] [blame] | 326 | "\tframe_count\twait_for_ba\t"); |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 327 | pos += scnprintf(buf + pos, bufsz - pos, |
| 328 | "start_idx\tbitmap0\t"); |
| 329 | pos += scnprintf(buf + pos, bufsz - pos, |
David S. Miller | 344234d | 2008-04-19 18:09:39 -0700 | [diff] [blame] | 330 | "bitmap1\trate_n_flags"); |
David S. Miller | 344234d | 2008-04-19 18:09:39 -0700 | [diff] [blame] | 331 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 332 | |
| 333 | for (j = 0; j < MAX_TID_COUNT; j++) { |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 334 | pos += scnprintf(buf + pos, bufsz - pos, |
David S. Miller | 344234d | 2008-04-19 18:09:39 -0700 | [diff] [blame] | 335 | "[%d]:\t\t%u", j, |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 336 | station->tid[j].seq_number); |
| 337 | pos += scnprintf(buf + pos, bufsz - pos, |
David S. Miller | 344234d | 2008-04-19 18:09:39 -0700 | [diff] [blame] | 338 | "\t%u\t\t%u\t\t%u\t\t", |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 339 | station->tid[j].agg.txq_id, |
| 340 | station->tid[j].agg.frame_count, |
| 341 | station->tid[j].agg.wait_for_ba); |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 342 | pos += scnprintf(buf + pos, bufsz - pos, |
David S. Miller | 344234d | 2008-04-19 18:09:39 -0700 | [diff] [blame] | 343 | "%u\t%llu\t%u", |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 344 | station->tid[j].agg.start_idx, |
John W. Linville | 1678859 | 2008-04-01 20:59:32 -0400 | [diff] [blame] | 345 | (unsigned long long)station->tid[j].agg.bitmap, |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 346 | station->tid[j].agg.rate_n_flags); |
David S. Miller | 344234d | 2008-04-19 18:09:39 -0700 | [diff] [blame] | 347 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 348 | } |
Abhijeet Kolekar | db0589f | 2008-04-14 21:16:04 -0700 | [diff] [blame] | 349 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 350 | } |
| 351 | } |
| 352 | |
| 353 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 354 | kfree(buf); |
| 355 | return ret; |
| 356 | } |
| 357 | |
Wey-Yi Guy | 0848e29 | 2009-05-22 11:01:46 -0700 | [diff] [blame] | 358 | static ssize_t iwl_dbgfs_nvm_read(struct file *file, |
Tomas Winkler | 8dd266e | 2008-05-05 10:22:32 +0800 | [diff] [blame] | 359 | char __user *user_buf, |
| 360 | size_t count, |
| 361 | loff_t *ppos) |
| 362 | { |
| 363 | ssize_t ret; |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 364 | struct iwl_priv *priv = file->private_data; |
Tomas Winkler | 8dd266e | 2008-05-05 10:22:32 +0800 | [diff] [blame] | 365 | int pos = 0, ofs = 0, buf_size = 0; |
| 366 | const u8 *ptr; |
| 367 | char *buf; |
Wey-Yi Guy | e307ddc | 2009-09-11 10:38:16 -0700 | [diff] [blame] | 368 | u16 eeprom_ver; |
Tomas Winkler | 8dd266e | 2008-05-05 10:22:32 +0800 | [diff] [blame] | 369 | size_t eeprom_len = priv->cfg->eeprom_size; |
| 370 | buf_size = 4 * eeprom_len + 256; |
| 371 | |
| 372 | if (eeprom_len % 16) { |
Wey-Yi Guy | 0848e29 | 2009-05-22 11:01:46 -0700 | [diff] [blame] | 373 | IWL_ERR(priv, "NVM size is not multiple of 16.\n"); |
Tomas Winkler | 8dd266e | 2008-05-05 10:22:32 +0800 | [diff] [blame] | 374 | return -ENODATA; |
| 375 | } |
| 376 | |
Julia Lawall | c37457e | 2009-08-03 11:11:45 +0200 | [diff] [blame] | 377 | ptr = priv->eeprom; |
| 378 | if (!ptr) { |
| 379 | IWL_ERR(priv, "Invalid EEPROM/OTP memory\n"); |
| 380 | return -ENOMEM; |
| 381 | } |
| 382 | |
Tomas Winkler | 8dd266e | 2008-05-05 10:22:32 +0800 | [diff] [blame] | 383 | /* 4 characters for byte 0xYY */ |
| 384 | buf = kzalloc(buf_size, GFP_KERNEL); |
| 385 | if (!buf) { |
Winkler, Tomas | 15b1687 | 2008-12-19 10:37:33 +0800 | [diff] [blame] | 386 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
Tomas Winkler | 8dd266e | 2008-05-05 10:22:32 +0800 | [diff] [blame] | 387 | return -ENOMEM; |
| 388 | } |
Wey-Yi Guy | e307ddc | 2009-09-11 10:38:16 -0700 | [diff] [blame] | 389 | eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); |
| 390 | pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s, " |
| 391 | "version: 0x%x\n", |
Wey-Yi Guy | 0848e29 | 2009-05-22 11:01:46 -0700 | [diff] [blame] | 392 | (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) |
Wey-Yi Guy | e307ddc | 2009-09-11 10:38:16 -0700 | [diff] [blame] | 393 | ? "OTP" : "EEPROM", eeprom_ver); |
Tomas Winkler | 8dd266e | 2008-05-05 10:22:32 +0800 | [diff] [blame] | 394 | for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { |
| 395 | pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); |
| 396 | hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos, |
| 397 | buf_size - pos, 0); |
Reinette Chatre | 2fac971 | 2009-09-25 14:24:21 -0700 | [diff] [blame] | 398 | pos += strlen(buf + pos); |
Tomas Winkler | 8dd266e | 2008-05-05 10:22:32 +0800 | [diff] [blame] | 399 | if (buf_size - pos > 0) |
| 400 | buf[pos++] = '\n'; |
| 401 | } |
| 402 | |
| 403 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 404 | kfree(buf); |
| 405 | return ret; |
| 406 | } |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 407 | |
Wey-Yi Guy | b03d7d0 | 2009-12-14 14:12:20 -0800 | [diff] [blame] | 408 | static ssize_t iwl_dbgfs_log_event_read(struct file *file, |
| 409 | char __user *user_buf, |
| 410 | size_t count, loff_t *ppos) |
| 411 | { |
| 412 | struct iwl_priv *priv = file->private_data; |
| 413 | char *buf; |
| 414 | int pos = 0; |
| 415 | ssize_t ret = -ENOMEM; |
| 416 | |
Wey-Yi Guy | 937c397 | 2010-01-15 13:43:36 -0800 | [diff] [blame] | 417 | ret = pos = priv->cfg->ops->lib->dump_nic_event_log( |
| 418 | priv, true, &buf, true); |
| 419 | if (buf) { |
Wey-Yi Guy | b03d7d0 | 2009-12-14 14:12:20 -0800 | [diff] [blame] | 420 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 421 | kfree(buf); |
| 422 | } |
| 423 | return ret; |
| 424 | } |
| 425 | |
Ester Kummer | 189a2b5 | 2008-05-15 13:54:18 +0800 | [diff] [blame] | 426 | static ssize_t iwl_dbgfs_log_event_write(struct file *file, |
| 427 | const char __user *user_buf, |
| 428 | size_t count, loff_t *ppos) |
| 429 | { |
| 430 | struct iwl_priv *priv = file->private_data; |
| 431 | u32 event_log_flag; |
| 432 | char buf[8]; |
| 433 | int buf_size; |
| 434 | |
| 435 | memset(buf, 0, sizeof(buf)); |
| 436 | buf_size = min(count, sizeof(buf) - 1); |
| 437 | if (copy_from_user(buf, user_buf, buf_size)) |
| 438 | return -EFAULT; |
| 439 | if (sscanf(buf, "%d", &event_log_flag) != 1) |
| 440 | return -EFAULT; |
| 441 | if (event_log_flag == 1) |
Wey-Yi Guy | b03d7d0 | 2009-12-14 14:12:20 -0800 | [diff] [blame] | 442 | priv->cfg->ops->lib->dump_nic_event_log(priv, true, |
| 443 | NULL, false); |
Ester Kummer | 189a2b5 | 2008-05-15 13:54:18 +0800 | [diff] [blame] | 444 | |
| 445 | return count; |
| 446 | } |
| 447 | |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 448 | |
| 449 | |
| 450 | static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, |
| 451 | size_t count, loff_t *ppos) |
| 452 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 453 | struct iwl_priv *priv = file->private_data; |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 454 | struct ieee80211_channel *channels = NULL; |
| 455 | const struct ieee80211_supported_band *supp_band = NULL; |
| 456 | int pos = 0, i, bufsz = PAGE_SIZE; |
| 457 | char *buf; |
| 458 | ssize_t ret; |
| 459 | |
| 460 | if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status)) |
| 461 | return -EAGAIN; |
| 462 | |
| 463 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 464 | if (!buf) { |
Winkler, Tomas | 15b1687 | 2008-12-19 10:37:33 +0800 | [diff] [blame] | 465 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 466 | return -ENOMEM; |
| 467 | } |
| 468 | |
| 469 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); |
Wey-Yi Guy | a2e2322 | 2009-05-22 11:01:55 -0700 | [diff] [blame] | 470 | if (supp_band) { |
| 471 | channels = supp_band->channels; |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 472 | |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 473 | pos += scnprintf(buf + pos, bufsz - pos, |
Wey-Yi Guy | a2e2322 | 2009-05-22 11:01:55 -0700 | [diff] [blame] | 474 | "Displaying %d channels in 2.4GHz band 802.11bg):\n", |
| 475 | supp_band->n_channels); |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 476 | |
Wey-Yi Guy | a2e2322 | 2009-05-22 11:01:55 -0700 | [diff] [blame] | 477 | for (i = 0; i < supp_band->n_channels; i++) |
| 478 | pos += scnprintf(buf + pos, bufsz - pos, |
| 479 | "%d: %ddBm: BSS%s%s, %s.\n", |
| 480 | ieee80211_frequency_to_channel( |
| 481 | channels[i].center_freq), |
| 482 | channels[i].max_power, |
| 483 | channels[i].flags & IEEE80211_CHAN_RADAR ? |
| 484 | " (IEEE 802.11h required)" : "", |
| 485 | ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) |
| 486 | || (channels[i].flags & |
| 487 | IEEE80211_CHAN_RADAR)) ? "" : |
| 488 | ", IBSS", |
| 489 | channels[i].flags & |
| 490 | IEEE80211_CHAN_PASSIVE_SCAN ? |
| 491 | "passive only" : "active/passive"); |
| 492 | } |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 493 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); |
Wey-Yi Guy | a2e2322 | 2009-05-22 11:01:55 -0700 | [diff] [blame] | 494 | if (supp_band) { |
| 495 | channels = supp_band->channels; |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 496 | |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 497 | pos += scnprintf(buf + pos, bufsz - pos, |
Wey-Yi Guy | a2e2322 | 2009-05-22 11:01:55 -0700 | [diff] [blame] | 498 | "Displaying %d channels in 5.2GHz band (802.11a)\n", |
| 499 | supp_band->n_channels); |
| 500 | |
| 501 | for (i = 0; i < supp_band->n_channels; i++) |
| 502 | pos += scnprintf(buf + pos, bufsz - pos, |
| 503 | "%d: %ddBm: BSS%s%s, %s.\n", |
| 504 | ieee80211_frequency_to_channel( |
| 505 | channels[i].center_freq), |
| 506 | channels[i].max_power, |
| 507 | channels[i].flags & IEEE80211_CHAN_RADAR ? |
| 508 | " (IEEE 802.11h required)" : "", |
| 509 | ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) |
| 510 | || (channels[i].flags & |
| 511 | IEEE80211_CHAN_RADAR)) ? "" : |
| 512 | ", IBSS", |
| 513 | channels[i].flags & |
| 514 | IEEE80211_CHAN_PASSIVE_SCAN ? |
| 515 | "passive only" : "active/passive"); |
| 516 | } |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 517 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 518 | kfree(buf); |
| 519 | return ret; |
| 520 | } |
| 521 | |
Wey-Yi Guy | 08df05a | 2009-03-24 10:02:54 -0700 | [diff] [blame] | 522 | static ssize_t iwl_dbgfs_status_read(struct file *file, |
| 523 | char __user *user_buf, |
| 524 | size_t count, loff_t *ppos) { |
| 525 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 526 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 08df05a | 2009-03-24 10:02:54 -0700 | [diff] [blame] | 527 | char buf[512]; |
| 528 | int pos = 0; |
| 529 | const size_t bufsz = sizeof(buf); |
| 530 | |
| 531 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n", |
| 532 | test_bit(STATUS_HCMD_ACTIVE, &priv->status)); |
Wey-Yi Guy | 08df05a | 2009-03-24 10:02:54 -0700 | [diff] [blame] | 533 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n", |
| 534 | test_bit(STATUS_INT_ENABLED, &priv->status)); |
| 535 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", |
| 536 | test_bit(STATUS_RF_KILL_HW, &priv->status)); |
Wey-Yi Guy | 7812b16 | 2009-10-02 13:43:58 -0700 | [diff] [blame] | 537 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n", |
| 538 | test_bit(STATUS_CT_KILL, &priv->status)); |
Wey-Yi Guy | 08df05a | 2009-03-24 10:02:54 -0700 | [diff] [blame] | 539 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n", |
| 540 | test_bit(STATUS_INIT, &priv->status)); |
| 541 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n", |
| 542 | test_bit(STATUS_ALIVE, &priv->status)); |
| 543 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n", |
| 544 | test_bit(STATUS_READY, &priv->status)); |
| 545 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n", |
| 546 | test_bit(STATUS_TEMPERATURE, &priv->status)); |
| 547 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n", |
| 548 | test_bit(STATUS_GEO_CONFIGURED, &priv->status)); |
| 549 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n", |
| 550 | test_bit(STATUS_EXIT_PENDING, &priv->status)); |
Wey-Yi Guy | 08df05a | 2009-03-24 10:02:54 -0700 | [diff] [blame] | 551 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n", |
| 552 | test_bit(STATUS_STATISTICS, &priv->status)); |
| 553 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n", |
| 554 | test_bit(STATUS_SCANNING, &priv->status)); |
| 555 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n", |
| 556 | test_bit(STATUS_SCAN_ABORTING, &priv->status)); |
| 557 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n", |
| 558 | test_bit(STATUS_SCAN_HW, &priv->status)); |
| 559 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n", |
| 560 | test_bit(STATUS_POWER_PMI, &priv->status)); |
| 561 | pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n", |
| 562 | test_bit(STATUS_FW_ERROR, &priv->status)); |
Wey-Yi Guy | 08df05a | 2009-03-24 10:02:54 -0700 | [diff] [blame] | 563 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 564 | } |
| 565 | |
Wey-Yi Guy | a83b914 | 2009-04-08 11:39:32 -0700 | [diff] [blame] | 566 | static ssize_t iwl_dbgfs_interrupt_read(struct file *file, |
| 567 | char __user *user_buf, |
| 568 | size_t count, loff_t *ppos) { |
| 569 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 570 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | a83b914 | 2009-04-08 11:39:32 -0700 | [diff] [blame] | 571 | int pos = 0; |
| 572 | int cnt = 0; |
| 573 | char *buf; |
| 574 | int bufsz = 24 * 64; /* 24 items * 64 char per item */ |
| 575 | ssize_t ret; |
| 576 | |
| 577 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 578 | if (!buf) { |
| 579 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 580 | return -ENOMEM; |
| 581 | } |
| 582 | |
| 583 | pos += scnprintf(buf + pos, bufsz - pos, |
| 584 | "Interrupt Statistics Report:\n"); |
| 585 | |
| 586 | pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n", |
| 587 | priv->isr_stats.hw); |
| 588 | pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n", |
| 589 | priv->isr_stats.sw); |
| 590 | if (priv->isr_stats.sw > 0) { |
| 591 | pos += scnprintf(buf + pos, bufsz - pos, |
| 592 | "\tLast Restarting Code: 0x%X\n", |
| 593 | priv->isr_stats.sw_err); |
| 594 | } |
| 595 | #ifdef CONFIG_IWLWIFI_DEBUG |
| 596 | pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n", |
| 597 | priv->isr_stats.sch); |
| 598 | pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n", |
| 599 | priv->isr_stats.alive); |
| 600 | #endif |
| 601 | pos += scnprintf(buf + pos, bufsz - pos, |
| 602 | "HW RF KILL switch toggled:\t %u\n", |
| 603 | priv->isr_stats.rfkill); |
| 604 | |
| 605 | pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n", |
| 606 | priv->isr_stats.ctkill); |
| 607 | |
| 608 | pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n", |
| 609 | priv->isr_stats.wakeup); |
| 610 | |
| 611 | pos += scnprintf(buf + pos, bufsz - pos, |
| 612 | "Rx command responses:\t\t %u\n", |
| 613 | priv->isr_stats.rx); |
| 614 | for (cnt = 0; cnt < REPLY_MAX; cnt++) { |
| 615 | if (priv->isr_stats.rx_handlers[cnt] > 0) |
| 616 | pos += scnprintf(buf + pos, bufsz - pos, |
| 617 | "\tRx handler[%36s]:\t\t %u\n", |
| 618 | get_cmd_string(cnt), |
| 619 | priv->isr_stats.rx_handlers[cnt]); |
| 620 | } |
| 621 | |
| 622 | pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n", |
| 623 | priv->isr_stats.tx); |
| 624 | |
| 625 | pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n", |
| 626 | priv->isr_stats.unhandled); |
| 627 | |
| 628 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 629 | kfree(buf); |
| 630 | return ret; |
| 631 | } |
| 632 | |
| 633 | static ssize_t iwl_dbgfs_interrupt_write(struct file *file, |
| 634 | const char __user *user_buf, |
| 635 | size_t count, loff_t *ppos) |
| 636 | { |
| 637 | struct iwl_priv *priv = file->private_data; |
| 638 | char buf[8]; |
| 639 | int buf_size; |
| 640 | u32 reset_flag; |
| 641 | |
| 642 | memset(buf, 0, sizeof(buf)); |
| 643 | buf_size = min(count, sizeof(buf) - 1); |
| 644 | if (copy_from_user(buf, user_buf, buf_size)) |
| 645 | return -EFAULT; |
| 646 | if (sscanf(buf, "%x", &reset_flag) != 1) |
| 647 | return -EFAULT; |
| 648 | if (reset_flag == 0) |
| 649 | iwl_clear_isr_stats(priv); |
| 650 | |
| 651 | return count; |
| 652 | } |
| 653 | |
Wey-Yi Guy | f5ad69f | 2009-07-09 10:33:36 -0700 | [diff] [blame] | 654 | static ssize_t iwl_dbgfs_qos_read(struct file *file, char __user *user_buf, |
| 655 | size_t count, loff_t *ppos) |
| 656 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 657 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | f5ad69f | 2009-07-09 10:33:36 -0700 | [diff] [blame] | 658 | int pos = 0, i; |
| 659 | char buf[256]; |
| 660 | const size_t bufsz = sizeof(buf); |
Wey-Yi Guy | f5ad69f | 2009-07-09 10:33:36 -0700 | [diff] [blame] | 661 | |
| 662 | for (i = 0; i < AC_NUM; i++) { |
| 663 | pos += scnprintf(buf + pos, bufsz - pos, |
| 664 | "\tcw_min\tcw_max\taifsn\ttxop\n"); |
| 665 | pos += scnprintf(buf + pos, bufsz - pos, |
| 666 | "AC[%d]\t%u\t%u\t%u\t%u\n", i, |
| 667 | priv->qos_data.def_qos_parm.ac[i].cw_min, |
| 668 | priv->qos_data.def_qos_parm.ac[i].cw_max, |
| 669 | priv->qos_data.def_qos_parm.ac[i].aifsn, |
| 670 | priv->qos_data.def_qos_parm.ac[i].edca_txop); |
| 671 | } |
Wey-Yi Guy | 4967c31 | 2010-02-18 15:22:07 -0800 | [diff] [blame] | 672 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
Wey-Yi Guy | f5ad69f | 2009-07-09 10:33:36 -0700 | [diff] [blame] | 673 | } |
Wey-Yi Guy | a83b914 | 2009-04-08 11:39:32 -0700 | [diff] [blame] | 674 | |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 675 | static ssize_t iwl_dbgfs_led_read(struct file *file, char __user *user_buf, |
| 676 | size_t count, loff_t *ppos) |
| 677 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 678 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 679 | int pos = 0; |
| 680 | char buf[256]; |
| 681 | const size_t bufsz = sizeof(buf); |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 682 | |
| 683 | pos += scnprintf(buf + pos, bufsz - pos, |
| 684 | "allow blinking: %s\n", |
| 685 | (priv->allow_blinking) ? "True" : "False"); |
| 686 | if (priv->allow_blinking) { |
| 687 | pos += scnprintf(buf + pos, bufsz - pos, |
| 688 | "Led blinking rate: %u\n", |
| 689 | priv->last_blink_rate); |
| 690 | pos += scnprintf(buf + pos, bufsz - pos, |
| 691 | "Last blink time: %lu\n", |
| 692 | priv->last_blink_time); |
| 693 | } |
| 694 | |
Wey-Yi Guy | 4967c31 | 2010-02-18 15:22:07 -0800 | [diff] [blame] | 695 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 696 | } |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 697 | |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 698 | static ssize_t iwl_dbgfs_thermal_throttling_read(struct file *file, |
| 699 | char __user *user_buf, |
| 700 | size_t count, loff_t *ppos) |
| 701 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 702 | struct iwl_priv *priv = file->private_data; |
Johannes Berg | 3ad3b92 | 2009-08-07 15:41:48 -0700 | [diff] [blame] | 703 | struct iwl_tt_mgmt *tt = &priv->thermal_throttle; |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 704 | struct iwl_tt_restriction *restriction; |
| 705 | char buf[100]; |
| 706 | int pos = 0; |
| 707 | const size_t bufsz = sizeof(buf); |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 708 | |
| 709 | pos += scnprintf(buf + pos, bufsz - pos, |
| 710 | "Thermal Throttling Mode: %s\n", |
Johannes Berg | 3ad3b92 | 2009-08-07 15:41:48 -0700 | [diff] [blame] | 711 | tt->advanced_tt ? "Advance" : "Legacy"); |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 712 | pos += scnprintf(buf + pos, bufsz - pos, |
| 713 | "Thermal Throttling State: %d\n", |
| 714 | tt->state); |
Johannes Berg | 3ad3b92 | 2009-08-07 15:41:48 -0700 | [diff] [blame] | 715 | if (tt->advanced_tt) { |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 716 | restriction = tt->restriction + tt->state; |
| 717 | pos += scnprintf(buf + pos, bufsz - pos, |
| 718 | "Tx mode: %d\n", |
| 719 | restriction->tx_stream); |
| 720 | pos += scnprintf(buf + pos, bufsz - pos, |
| 721 | "Rx mode: %d\n", |
| 722 | restriction->rx_stream); |
| 723 | pos += scnprintf(buf + pos, bufsz - pos, |
| 724 | "HT mode: %d\n", |
| 725 | restriction->is_ht); |
| 726 | } |
Wey-Yi Guy | 4967c31 | 2010-02-18 15:22:07 -0800 | [diff] [blame] | 727 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 728 | } |
| 729 | |
Wey-Yi Guy | 1e4247d | 2009-07-27 13:50:15 -0700 | [diff] [blame] | 730 | static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file, |
| 731 | const char __user *user_buf, |
| 732 | size_t count, loff_t *ppos) |
| 733 | { |
| 734 | struct iwl_priv *priv = file->private_data; |
| 735 | char buf[8]; |
| 736 | int buf_size; |
| 737 | int ht40; |
| 738 | |
| 739 | memset(buf, 0, sizeof(buf)); |
| 740 | buf_size = min(count, sizeof(buf) - 1); |
| 741 | if (copy_from_user(buf, user_buf, buf_size)) |
| 742 | return -EFAULT; |
| 743 | if (sscanf(buf, "%d", &ht40) != 1) |
| 744 | return -EFAULT; |
| 745 | if (!iwl_is_associated(priv)) |
| 746 | priv->disable_ht40 = ht40 ? true : false; |
| 747 | else { |
| 748 | IWL_ERR(priv, "Sta associated with AP - " |
| 749 | "Change to 40MHz channel support is not allowed\n"); |
| 750 | return -EINVAL; |
| 751 | } |
| 752 | |
| 753 | return count; |
| 754 | } |
| 755 | |
| 756 | static ssize_t iwl_dbgfs_disable_ht40_read(struct file *file, |
| 757 | char __user *user_buf, |
| 758 | size_t count, loff_t *ppos) |
| 759 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 760 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 1e4247d | 2009-07-27 13:50:15 -0700 | [diff] [blame] | 761 | char buf[100]; |
| 762 | int pos = 0; |
| 763 | const size_t bufsz = sizeof(buf); |
Wey-Yi Guy | 1e4247d | 2009-07-27 13:50:15 -0700 | [diff] [blame] | 764 | |
| 765 | pos += scnprintf(buf + pos, bufsz - pos, |
| 766 | "11n 40MHz Mode: %s\n", |
| 767 | priv->disable_ht40 ? "Disabled" : "Enabled"); |
Wey-Yi Guy | 4967c31 | 2010-02-18 15:22:07 -0800 | [diff] [blame] | 768 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
Wey-Yi Guy | 1e4247d | 2009-07-27 13:50:15 -0700 | [diff] [blame] | 769 | } |
| 770 | |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 771 | static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file, |
| 772 | const char __user *user_buf, |
| 773 | size_t count, loff_t *ppos) |
| 774 | { |
| 775 | struct iwl_priv *priv = file->private_data; |
| 776 | char buf[8]; |
| 777 | int buf_size; |
| 778 | int value; |
| 779 | |
| 780 | memset(buf, 0, sizeof(buf)); |
| 781 | buf_size = min(count, sizeof(buf) - 1); |
| 782 | if (copy_from_user(buf, user_buf, buf_size)) |
| 783 | return -EFAULT; |
| 784 | |
| 785 | if (sscanf(buf, "%d", &value) != 1) |
| 786 | return -EINVAL; |
| 787 | |
| 788 | /* |
| 789 | * Our users expect 0 to be "CAM", but 0 isn't actually |
| 790 | * valid here. However, let's not confuse them and present |
| 791 | * IWL_POWER_INDEX_1 as "1", not "0". |
| 792 | */ |
Reinette Chatre | 1a34c04 | 2009-10-09 13:20:25 -0700 | [diff] [blame] | 793 | if (value == 0) |
| 794 | return -EINVAL; |
| 795 | else if (value > 0) |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 796 | value -= 1; |
| 797 | |
| 798 | if (value != -1 && (value < 0 || value >= IWL_POWER_NUM)) |
| 799 | return -EINVAL; |
| 800 | |
Wey-Yi Guy | 4ad177b | 2009-10-16 14:25:58 -0700 | [diff] [blame] | 801 | if (!iwl_is_ready_rf(priv)) |
| 802 | return -EAGAIN; |
| 803 | |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 804 | priv->power_data.debug_sleep_level_override = value; |
| 805 | |
Reinette Chatre | d3a5719 | 2010-01-21 11:52:28 -0800 | [diff] [blame] | 806 | mutex_lock(&priv->mutex); |
Wey-Yi Guy | 4ad177b | 2009-10-16 14:25:58 -0700 | [diff] [blame] | 807 | iwl_power_update_mode(priv, true); |
Reinette Chatre | d3a5719 | 2010-01-21 11:52:28 -0800 | [diff] [blame] | 808 | mutex_unlock(&priv->mutex); |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 809 | |
| 810 | return count; |
| 811 | } |
| 812 | |
| 813 | static ssize_t iwl_dbgfs_sleep_level_override_read(struct file *file, |
| 814 | char __user *user_buf, |
| 815 | size_t count, loff_t *ppos) |
| 816 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 817 | struct iwl_priv *priv = file->private_data; |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 818 | char buf[10]; |
| 819 | int pos, value; |
| 820 | const size_t bufsz = sizeof(buf); |
| 821 | |
| 822 | /* see the write function */ |
| 823 | value = priv->power_data.debug_sleep_level_override; |
| 824 | if (value >= 0) |
| 825 | value += 1; |
| 826 | |
| 827 | pos = scnprintf(buf, bufsz, "%d\n", value); |
| 828 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 829 | } |
| 830 | |
| 831 | static ssize_t iwl_dbgfs_current_sleep_command_read(struct file *file, |
| 832 | char __user *user_buf, |
| 833 | size_t count, loff_t *ppos) |
| 834 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 835 | struct iwl_priv *priv = file->private_data; |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 836 | char buf[200]; |
| 837 | int pos = 0, i; |
| 838 | const size_t bufsz = sizeof(buf); |
| 839 | struct iwl_powertable_cmd *cmd = &priv->power_data.sleep_cmd; |
| 840 | |
| 841 | pos += scnprintf(buf + pos, bufsz - pos, |
| 842 | "flags: %#.2x\n", le16_to_cpu(cmd->flags)); |
| 843 | pos += scnprintf(buf + pos, bufsz - pos, |
| 844 | "RX/TX timeout: %d/%d usec\n", |
| 845 | le32_to_cpu(cmd->rx_data_timeout), |
| 846 | le32_to_cpu(cmd->tx_data_timeout)); |
| 847 | for (i = 0; i < IWL_POWER_VEC_SIZE; i++) |
| 848 | pos += scnprintf(buf + pos, bufsz - pos, |
| 849 | "sleep_interval[%d]: %d\n", i, |
| 850 | le32_to_cpu(cmd->sleep_interval[i])); |
| 851 | |
| 852 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 853 | } |
| 854 | |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 855 | DEBUGFS_READ_WRITE_FILE_OPS(sram); |
Wey-Yi Guy | b03d7d0 | 2009-12-14 14:12:20 -0800 | [diff] [blame] | 856 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); |
Wey-Yi Guy | 0848e29 | 2009-05-22 11:01:46 -0700 | [diff] [blame] | 857 | DEBUGFS_READ_FILE_OPS(nvm); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 858 | DEBUGFS_READ_FILE_OPS(stations); |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 859 | DEBUGFS_READ_FILE_OPS(channels); |
Wey-Yi Guy | 08df05a | 2009-03-24 10:02:54 -0700 | [diff] [blame] | 860 | DEBUGFS_READ_FILE_OPS(status); |
Wey-Yi Guy | a83b914 | 2009-04-08 11:39:32 -0700 | [diff] [blame] | 861 | DEBUGFS_READ_WRITE_FILE_OPS(interrupt); |
Wey-Yi Guy | f5ad69f | 2009-07-09 10:33:36 -0700 | [diff] [blame] | 862 | DEBUGFS_READ_FILE_OPS(qos); |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 863 | DEBUGFS_READ_FILE_OPS(led); |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 864 | DEBUGFS_READ_FILE_OPS(thermal_throttling); |
Wey-Yi Guy | 1e4247d | 2009-07-27 13:50:15 -0700 | [diff] [blame] | 865 | DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40); |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 866 | DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override); |
| 867 | DEBUGFS_READ_FILE_OPS(current_sleep_command); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 868 | |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 869 | static ssize_t iwl_dbgfs_traffic_log_read(struct file *file, |
| 870 | char __user *user_buf, |
| 871 | size_t count, loff_t *ppos) |
| 872 | { |
| 873 | struct iwl_priv *priv = file->private_data; |
| 874 | int pos = 0, ofs = 0; |
| 875 | int cnt = 0, entry; |
| 876 | struct iwl_tx_queue *txq; |
| 877 | struct iwl_queue *q; |
| 878 | struct iwl_rx_queue *rxq = &priv->rxq; |
| 879 | char *buf; |
| 880 | int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + |
Wey-Yi Guy | 88804e2 | 2009-10-09 13:20:28 -0700 | [diff] [blame] | 881 | (priv->cfg->num_of_queues * 32 * 8) + 400; |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 882 | const u8 *ptr; |
| 883 | ssize_t ret; |
| 884 | |
Wey-Yi Guy | 88804e2 | 2009-10-09 13:20:28 -0700 | [diff] [blame] | 885 | if (!priv->txq) { |
| 886 | IWL_ERR(priv, "txq not ready\n"); |
| 887 | return -EAGAIN; |
| 888 | } |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 889 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 890 | if (!buf) { |
| 891 | IWL_ERR(priv, "Can not allocate buffer\n"); |
| 892 | return -ENOMEM; |
| 893 | } |
| 894 | pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n"); |
| 895 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { |
| 896 | txq = &priv->txq[cnt]; |
| 897 | q = &txq->q; |
| 898 | pos += scnprintf(buf + pos, bufsz - pos, |
| 899 | "q[%d]: read_ptr: %u, write_ptr: %u\n", |
| 900 | cnt, q->read_ptr, q->write_ptr); |
| 901 | } |
| 902 | if (priv->tx_traffic && (iwl_debug_level & IWL_DL_TX)) { |
| 903 | ptr = priv->tx_traffic; |
| 904 | pos += scnprintf(buf + pos, bufsz - pos, |
| 905 | "Tx Traffic idx: %u\n", priv->tx_traffic_idx); |
| 906 | for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { |
| 907 | for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; |
| 908 | entry++, ofs += 16) { |
| 909 | pos += scnprintf(buf + pos, bufsz - pos, |
| 910 | "0x%.4x ", ofs); |
| 911 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, |
| 912 | buf + pos, bufsz - pos, 0); |
Reinette Chatre | 2fac971 | 2009-09-25 14:24:21 -0700 | [diff] [blame] | 913 | pos += strlen(buf + pos); |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 914 | if (bufsz - pos > 0) |
| 915 | buf[pos++] = '\n'; |
| 916 | } |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | pos += scnprintf(buf + pos, bufsz - pos, "Rx Queue\n"); |
| 921 | pos += scnprintf(buf + pos, bufsz - pos, |
| 922 | "read: %u, write: %u\n", |
| 923 | rxq->read, rxq->write); |
| 924 | |
| 925 | if (priv->rx_traffic && (iwl_debug_level & IWL_DL_RX)) { |
| 926 | ptr = priv->rx_traffic; |
| 927 | pos += scnprintf(buf + pos, bufsz - pos, |
| 928 | "Rx Traffic idx: %u\n", priv->rx_traffic_idx); |
| 929 | for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { |
| 930 | for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; |
| 931 | entry++, ofs += 16) { |
| 932 | pos += scnprintf(buf + pos, bufsz - pos, |
| 933 | "0x%.4x ", ofs); |
| 934 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, |
| 935 | buf + pos, bufsz - pos, 0); |
Reinette Chatre | 2fac971 | 2009-09-25 14:24:21 -0700 | [diff] [blame] | 936 | pos += strlen(buf + pos); |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 937 | if (bufsz - pos > 0) |
| 938 | buf[pos++] = '\n'; |
| 939 | } |
| 940 | } |
| 941 | } |
| 942 | |
| 943 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 944 | kfree(buf); |
| 945 | return ret; |
| 946 | } |
| 947 | |
| 948 | static ssize_t iwl_dbgfs_traffic_log_write(struct file *file, |
| 949 | const char __user *user_buf, |
| 950 | size_t count, loff_t *ppos) |
| 951 | { |
| 952 | struct iwl_priv *priv = file->private_data; |
| 953 | char buf[8]; |
| 954 | int buf_size; |
| 955 | int traffic_log; |
| 956 | |
| 957 | memset(buf, 0, sizeof(buf)); |
| 958 | buf_size = min(count, sizeof(buf) - 1); |
| 959 | if (copy_from_user(buf, user_buf, buf_size)) |
| 960 | return -EFAULT; |
| 961 | if (sscanf(buf, "%d", &traffic_log) != 1) |
| 962 | return -EFAULT; |
| 963 | if (traffic_log == 0) |
| 964 | iwl_reset_traffic_log(priv); |
| 965 | |
| 966 | return count; |
| 967 | } |
| 968 | |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 969 | static ssize_t iwl_dbgfs_tx_queue_read(struct file *file, |
| 970 | char __user *user_buf, |
| 971 | size_t count, loff_t *ppos) { |
| 972 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 973 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 974 | struct iwl_tx_queue *txq; |
| 975 | struct iwl_queue *q; |
| 976 | char *buf; |
| 977 | int pos = 0; |
| 978 | int cnt; |
| 979 | int ret; |
Wey-Yi Guy | d23db55 | 2009-11-20 12:04:59 -0800 | [diff] [blame] | 980 | const size_t bufsz = sizeof(char) * 64 * priv->cfg->num_of_queues; |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 981 | |
Wey-Yi Guy | 88804e2 | 2009-10-09 13:20:28 -0700 | [diff] [blame] | 982 | if (!priv->txq) { |
| 983 | IWL_ERR(priv, "txq not ready\n"); |
| 984 | return -EAGAIN; |
| 985 | } |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 986 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 987 | if (!buf) |
| 988 | return -ENOMEM; |
| 989 | |
| 990 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { |
| 991 | txq = &priv->txq[cnt]; |
| 992 | q = &txq->q; |
| 993 | pos += scnprintf(buf + pos, bufsz - pos, |
| 994 | "hwq %.2d: read=%u write=%u stop=%d" |
| 995 | " swq_id=%#.2x (ac %d/hwq %d)\n", |
| 996 | cnt, q->read_ptr, q->write_ptr, |
| 997 | !!test_bit(cnt, priv->queue_stopped), |
| 998 | txq->swq_id, |
| 999 | txq->swq_id & 0x80 ? txq->swq_id & 3 : |
| 1000 | txq->swq_id, |
| 1001 | txq->swq_id & 0x80 ? (txq->swq_id >> 2) & |
| 1002 | 0x1f : txq->swq_id); |
| 1003 | if (cnt >= 4) |
| 1004 | continue; |
| 1005 | /* for the ACs, display the stop count too */ |
| 1006 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1007 | " stop-count: %d\n", |
| 1008 | atomic_read(&priv->queue_stop_count[cnt])); |
| 1009 | } |
| 1010 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1011 | kfree(buf); |
| 1012 | return ret; |
| 1013 | } |
| 1014 | |
| 1015 | static ssize_t iwl_dbgfs_rx_queue_read(struct file *file, |
| 1016 | char __user *user_buf, |
| 1017 | size_t count, loff_t *ppos) { |
| 1018 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1019 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 1020 | struct iwl_rx_queue *rxq = &priv->rxq; |
| 1021 | char buf[256]; |
| 1022 | int pos = 0; |
| 1023 | const size_t bufsz = sizeof(buf); |
| 1024 | |
| 1025 | pos += scnprintf(buf + pos, bufsz - pos, "read: %u\n", |
| 1026 | rxq->read); |
| 1027 | pos += scnprintf(buf + pos, bufsz - pos, "write: %u\n", |
| 1028 | rxq->write); |
| 1029 | pos += scnprintf(buf + pos, bufsz - pos, "free_count: %u\n", |
| 1030 | rxq->free_count); |
| 1031 | pos += scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n", |
| 1032 | le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF); |
| 1033 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1034 | } |
| 1035 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1036 | static int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf, |
| 1037 | int bufsz) |
| 1038 | { |
| 1039 | int p = 0; |
| 1040 | |
| 1041 | p += scnprintf(buf + p, bufsz - p, |
| 1042 | "Statistics Flag(0x%X):\n", |
| 1043 | le32_to_cpu(priv->statistics.flag)); |
| 1044 | if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK) |
| 1045 | p += scnprintf(buf + p, bufsz - p, |
| 1046 | "\tStatistics have been cleared\n"); |
| 1047 | p += scnprintf(buf + p, bufsz - p, |
| 1048 | "\tOperational Frequency: %s\n", |
| 1049 | (le32_to_cpu(priv->statistics.flag) & |
| 1050 | UCODE_STATISTICS_FREQUENCY_MSK) |
| 1051 | ? "2.4 GHz" : "5.2 GHz"); |
| 1052 | p += scnprintf(buf + p, bufsz - p, |
| 1053 | "\tTGj Narrow Band: %s\n", |
| 1054 | (le32_to_cpu(priv->statistics.flag) & |
| 1055 | UCODE_STATISTICS_NARROW_BAND_MSK) |
| 1056 | ? "enabled" : "disabled"); |
| 1057 | return p; |
| 1058 | } |
| 1059 | |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1060 | static const char ucode_stats_header[] = |
| 1061 | "%-32s current acumulative delta max\n"; |
| 1062 | static const char ucode_stats_short_format[] = |
| 1063 | " %-30s %10u\n"; |
| 1064 | static const char ucode_stats_format[] = |
| 1065 | " %-30s %10u %10u %10u %10u\n"; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1066 | |
| 1067 | static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, |
| 1068 | char __user *user_buf, |
| 1069 | size_t count, loff_t *ppos) |
| 1070 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1071 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1072 | int pos = 0; |
| 1073 | char *buf; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1074 | int bufsz = sizeof(struct statistics_rx_phy) * 40 + |
| 1075 | sizeof(struct statistics_rx_non_phy) * 40 + |
| 1076 | sizeof(struct statistics_rx_ht_phy) * 40 + 400; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1077 | ssize_t ret; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1078 | struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm; |
| 1079 | struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1080 | struct statistics_rx_non_phy *general, *accum_general; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1081 | struct statistics_rx_non_phy *delta_general, *max_general; |
| 1082 | struct statistics_rx_ht_phy *ht, *accum_ht, *delta_ht, *max_ht; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1083 | |
| 1084 | if (!iwl_is_alive(priv)) |
| 1085 | return -EAGAIN; |
| 1086 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1087 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1088 | if (!buf) { |
| 1089 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1090 | return -ENOMEM; |
| 1091 | } |
| 1092 | |
| 1093 | /* the statistic information display here is based on |
| 1094 | * the last statistics notification from uCode |
| 1095 | * might not reflect the current uCode activity |
| 1096 | */ |
| 1097 | ofdm = &priv->statistics.rx.ofdm; |
| 1098 | cck = &priv->statistics.rx.cck; |
| 1099 | general = &priv->statistics.rx.general; |
| 1100 | ht = &priv->statistics.rx.ofdm_ht; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1101 | accum_ofdm = &priv->accum_statistics.rx.ofdm; |
| 1102 | accum_cck = &priv->accum_statistics.rx.cck; |
| 1103 | accum_general = &priv->accum_statistics.rx.general; |
| 1104 | accum_ht = &priv->accum_statistics.rx.ofdm_ht; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1105 | delta_ofdm = &priv->delta_statistics.rx.ofdm; |
| 1106 | delta_cck = &priv->delta_statistics.rx.cck; |
| 1107 | delta_general = &priv->delta_statistics.rx.general; |
| 1108 | delta_ht = &priv->delta_statistics.rx.ofdm_ht; |
| 1109 | max_ofdm = &priv->max_delta.rx.ofdm; |
| 1110 | max_cck = &priv->max_delta.rx.cck; |
| 1111 | max_general = &priv->max_delta.rx.general; |
| 1112 | max_ht = &priv->max_delta.rx.ofdm_ht; |
| 1113 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1114 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1115 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1116 | "Statistics_Rx - OFDM:"); |
| 1117 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1118 | "ina_cnt:", le32_to_cpu(ofdm->ina_cnt), |
| 1119 | accum_ofdm->ina_cnt, |
| 1120 | delta_ofdm->ina_cnt, max_ofdm->ina_cnt); |
| 1121 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1122 | "fina_cnt:", |
| 1123 | le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt, |
| 1124 | delta_ofdm->fina_cnt, max_ofdm->fina_cnt); |
| 1125 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1126 | "plcp_err:", |
| 1127 | le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err, |
| 1128 | delta_ofdm->plcp_err, max_ofdm->plcp_err); |
| 1129 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1130 | "crc32_err:", |
| 1131 | le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err, |
| 1132 | delta_ofdm->crc32_err, max_ofdm->crc32_err); |
| 1133 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1134 | "overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1135 | le32_to_cpu(ofdm->overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1136 | accum_ofdm->overrun_err, |
| 1137 | delta_ofdm->overrun_err, max_ofdm->overrun_err); |
| 1138 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1139 | "early_overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1140 | le32_to_cpu(ofdm->early_overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1141 | accum_ofdm->early_overrun_err, |
| 1142 | delta_ofdm->early_overrun_err, |
| 1143 | max_ofdm->early_overrun_err); |
| 1144 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1145 | "crc32_good:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1146 | le32_to_cpu(ofdm->crc32_good), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1147 | accum_ofdm->crc32_good, |
| 1148 | delta_ofdm->crc32_good, max_ofdm->crc32_good); |
| 1149 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1150 | "false_alarm_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1151 | le32_to_cpu(ofdm->false_alarm_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1152 | accum_ofdm->false_alarm_cnt, |
| 1153 | delta_ofdm->false_alarm_cnt, |
| 1154 | max_ofdm->false_alarm_cnt); |
| 1155 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1156 | "fina_sync_err_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1157 | le32_to_cpu(ofdm->fina_sync_err_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1158 | accum_ofdm->fina_sync_err_cnt, |
| 1159 | delta_ofdm->fina_sync_err_cnt, |
| 1160 | max_ofdm->fina_sync_err_cnt); |
| 1161 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1162 | "sfd_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1163 | le32_to_cpu(ofdm->sfd_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1164 | accum_ofdm->sfd_timeout, |
| 1165 | delta_ofdm->sfd_timeout, |
| 1166 | max_ofdm->sfd_timeout); |
| 1167 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1168 | "fina_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1169 | le32_to_cpu(ofdm->fina_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1170 | accum_ofdm->fina_timeout, |
| 1171 | delta_ofdm->fina_timeout, |
| 1172 | max_ofdm->fina_timeout); |
| 1173 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1174 | "unresponded_rts:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1175 | le32_to_cpu(ofdm->unresponded_rts), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1176 | accum_ofdm->unresponded_rts, |
| 1177 | delta_ofdm->unresponded_rts, |
| 1178 | max_ofdm->unresponded_rts); |
| 1179 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1180 | "rxe_frame_lmt_ovrun:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1181 | le32_to_cpu(ofdm->rxe_frame_limit_overrun), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1182 | accum_ofdm->rxe_frame_limit_overrun, |
| 1183 | delta_ofdm->rxe_frame_limit_overrun, |
| 1184 | max_ofdm->rxe_frame_limit_overrun); |
| 1185 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1186 | "sent_ack_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1187 | le32_to_cpu(ofdm->sent_ack_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1188 | accum_ofdm->sent_ack_cnt, |
| 1189 | delta_ofdm->sent_ack_cnt, |
| 1190 | max_ofdm->sent_ack_cnt); |
| 1191 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1192 | "sent_cts_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1193 | le32_to_cpu(ofdm->sent_cts_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1194 | accum_ofdm->sent_cts_cnt, |
| 1195 | delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt); |
| 1196 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1197 | "sent_ba_rsp_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1198 | le32_to_cpu(ofdm->sent_ba_rsp_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1199 | accum_ofdm->sent_ba_rsp_cnt, |
| 1200 | delta_ofdm->sent_ba_rsp_cnt, |
| 1201 | max_ofdm->sent_ba_rsp_cnt); |
| 1202 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1203 | "dsp_self_kill:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1204 | le32_to_cpu(ofdm->dsp_self_kill), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1205 | accum_ofdm->dsp_self_kill, |
| 1206 | delta_ofdm->dsp_self_kill, |
| 1207 | max_ofdm->dsp_self_kill); |
| 1208 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1209 | "mh_format_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1210 | le32_to_cpu(ofdm->mh_format_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1211 | accum_ofdm->mh_format_err, |
| 1212 | delta_ofdm->mh_format_err, |
| 1213 | max_ofdm->mh_format_err); |
| 1214 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1215 | "re_acq_main_rssi_sum:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1216 | le32_to_cpu(ofdm->re_acq_main_rssi_sum), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1217 | accum_ofdm->re_acq_main_rssi_sum, |
| 1218 | delta_ofdm->re_acq_main_rssi_sum, |
| 1219 | max_ofdm->re_acq_main_rssi_sum); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1220 | |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1221 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1222 | "Statistics_Rx - CCK:"); |
| 1223 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1224 | "ina_cnt:", |
| 1225 | le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt, |
| 1226 | delta_cck->ina_cnt, max_cck->ina_cnt); |
| 1227 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1228 | "fina_cnt:", |
| 1229 | le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt, |
| 1230 | delta_cck->fina_cnt, max_cck->fina_cnt); |
| 1231 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1232 | "plcp_err:", |
| 1233 | le32_to_cpu(cck->plcp_err), accum_cck->plcp_err, |
| 1234 | delta_cck->plcp_err, max_cck->plcp_err); |
| 1235 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1236 | "crc32_err:", |
| 1237 | le32_to_cpu(cck->crc32_err), accum_cck->crc32_err, |
| 1238 | delta_cck->crc32_err, max_cck->crc32_err); |
| 1239 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1240 | "overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1241 | le32_to_cpu(cck->overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1242 | accum_cck->overrun_err, |
| 1243 | delta_cck->overrun_err, max_cck->overrun_err); |
| 1244 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1245 | "early_overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1246 | le32_to_cpu(cck->early_overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1247 | accum_cck->early_overrun_err, |
| 1248 | delta_cck->early_overrun_err, |
| 1249 | max_cck->early_overrun_err); |
| 1250 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1251 | "crc32_good:", |
| 1252 | le32_to_cpu(cck->crc32_good), accum_cck->crc32_good, |
| 1253 | delta_cck->crc32_good, |
| 1254 | max_cck->crc32_good); |
| 1255 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1256 | "false_alarm_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1257 | le32_to_cpu(cck->false_alarm_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1258 | accum_cck->false_alarm_cnt, |
| 1259 | delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt); |
| 1260 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1261 | "fina_sync_err_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1262 | le32_to_cpu(cck->fina_sync_err_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1263 | accum_cck->fina_sync_err_cnt, |
| 1264 | delta_cck->fina_sync_err_cnt, |
| 1265 | max_cck->fina_sync_err_cnt); |
| 1266 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1267 | "sfd_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1268 | le32_to_cpu(cck->sfd_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1269 | accum_cck->sfd_timeout, |
| 1270 | delta_cck->sfd_timeout, max_cck->sfd_timeout); |
| 1271 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1272 | "fina_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1273 | le32_to_cpu(cck->fina_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1274 | accum_cck->fina_timeout, |
| 1275 | delta_cck->fina_timeout, max_cck->fina_timeout); |
| 1276 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1277 | "unresponded_rts:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1278 | le32_to_cpu(cck->unresponded_rts), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1279 | accum_cck->unresponded_rts, |
| 1280 | delta_cck->unresponded_rts, |
| 1281 | max_cck->unresponded_rts); |
| 1282 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1283 | "rxe_frame_lmt_ovrun:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1284 | le32_to_cpu(cck->rxe_frame_limit_overrun), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1285 | accum_cck->rxe_frame_limit_overrun, |
| 1286 | delta_cck->rxe_frame_limit_overrun, |
| 1287 | max_cck->rxe_frame_limit_overrun); |
| 1288 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1289 | "sent_ack_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1290 | le32_to_cpu(cck->sent_ack_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1291 | accum_cck->sent_ack_cnt, |
| 1292 | delta_cck->sent_ack_cnt, |
| 1293 | max_cck->sent_ack_cnt); |
| 1294 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1295 | "sent_cts_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1296 | le32_to_cpu(cck->sent_cts_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1297 | accum_cck->sent_cts_cnt, |
| 1298 | delta_cck->sent_cts_cnt, |
| 1299 | max_cck->sent_cts_cnt); |
| 1300 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1301 | "sent_ba_rsp_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1302 | le32_to_cpu(cck->sent_ba_rsp_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1303 | accum_cck->sent_ba_rsp_cnt, |
| 1304 | delta_cck->sent_ba_rsp_cnt, |
| 1305 | max_cck->sent_ba_rsp_cnt); |
| 1306 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1307 | "dsp_self_kill:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1308 | le32_to_cpu(cck->dsp_self_kill), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1309 | accum_cck->dsp_self_kill, |
| 1310 | delta_cck->dsp_self_kill, |
| 1311 | max_cck->dsp_self_kill); |
| 1312 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1313 | "mh_format_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1314 | le32_to_cpu(cck->mh_format_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1315 | accum_cck->mh_format_err, |
| 1316 | delta_cck->mh_format_err, max_cck->mh_format_err); |
| 1317 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1318 | "re_acq_main_rssi_sum:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1319 | le32_to_cpu(cck->re_acq_main_rssi_sum), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1320 | accum_cck->re_acq_main_rssi_sum, |
| 1321 | delta_cck->re_acq_main_rssi_sum, |
| 1322 | max_cck->re_acq_main_rssi_sum); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1323 | |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1324 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1325 | "Statistics_Rx - GENERAL:"); |
| 1326 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1327 | "bogus_cts:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1328 | le32_to_cpu(general->bogus_cts), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1329 | accum_general->bogus_cts, |
| 1330 | delta_general->bogus_cts, max_general->bogus_cts); |
| 1331 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1332 | "bogus_ack:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1333 | le32_to_cpu(general->bogus_ack), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1334 | accum_general->bogus_ack, |
| 1335 | delta_general->bogus_ack, max_general->bogus_ack); |
| 1336 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1337 | "non_bssid_frames:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1338 | le32_to_cpu(general->non_bssid_frames), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1339 | accum_general->non_bssid_frames, |
| 1340 | delta_general->non_bssid_frames, |
| 1341 | max_general->non_bssid_frames); |
| 1342 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1343 | "filtered_frames:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1344 | le32_to_cpu(general->filtered_frames), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1345 | accum_general->filtered_frames, |
| 1346 | delta_general->filtered_frames, |
| 1347 | max_general->filtered_frames); |
| 1348 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1349 | "non_channel_beacons:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1350 | le32_to_cpu(general->non_channel_beacons), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1351 | accum_general->non_channel_beacons, |
| 1352 | delta_general->non_channel_beacons, |
| 1353 | max_general->non_channel_beacons); |
| 1354 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1355 | "channel_beacons:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1356 | le32_to_cpu(general->channel_beacons), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1357 | accum_general->channel_beacons, |
| 1358 | delta_general->channel_beacons, |
| 1359 | max_general->channel_beacons); |
| 1360 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1361 | "num_missed_bcon:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1362 | le32_to_cpu(general->num_missed_bcon), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1363 | accum_general->num_missed_bcon, |
| 1364 | delta_general->num_missed_bcon, |
| 1365 | max_general->num_missed_bcon); |
| 1366 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1367 | "adc_rx_saturation_time:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1368 | le32_to_cpu(general->adc_rx_saturation_time), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1369 | accum_general->adc_rx_saturation_time, |
| 1370 | delta_general->adc_rx_saturation_time, |
| 1371 | max_general->adc_rx_saturation_time); |
| 1372 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1373 | "ina_detect_search_tm:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1374 | le32_to_cpu(general->ina_detection_search_time), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1375 | accum_general->ina_detection_search_time, |
| 1376 | delta_general->ina_detection_search_time, |
| 1377 | max_general->ina_detection_search_time); |
| 1378 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1379 | "beacon_silence_rssi_a:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1380 | le32_to_cpu(general->beacon_silence_rssi_a), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1381 | accum_general->beacon_silence_rssi_a, |
| 1382 | delta_general->beacon_silence_rssi_a, |
| 1383 | max_general->beacon_silence_rssi_a); |
| 1384 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1385 | "beacon_silence_rssi_b:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1386 | le32_to_cpu(general->beacon_silence_rssi_b), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1387 | accum_general->beacon_silence_rssi_b, |
| 1388 | delta_general->beacon_silence_rssi_b, |
| 1389 | max_general->beacon_silence_rssi_b); |
| 1390 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1391 | "beacon_silence_rssi_c:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1392 | le32_to_cpu(general->beacon_silence_rssi_c), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1393 | accum_general->beacon_silence_rssi_c, |
| 1394 | delta_general->beacon_silence_rssi_c, |
| 1395 | max_general->beacon_silence_rssi_c); |
| 1396 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1397 | "interference_data_flag:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1398 | le32_to_cpu(general->interference_data_flag), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1399 | accum_general->interference_data_flag, |
| 1400 | delta_general->interference_data_flag, |
| 1401 | max_general->interference_data_flag); |
| 1402 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1403 | "channel_load:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1404 | le32_to_cpu(general->channel_load), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1405 | accum_general->channel_load, |
| 1406 | delta_general->channel_load, |
| 1407 | max_general->channel_load); |
| 1408 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1409 | "dsp_false_alarms:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1410 | le32_to_cpu(general->dsp_false_alarms), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1411 | accum_general->dsp_false_alarms, |
| 1412 | delta_general->dsp_false_alarms, |
| 1413 | max_general->dsp_false_alarms); |
| 1414 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1415 | "beacon_rssi_a:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1416 | le32_to_cpu(general->beacon_rssi_a), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1417 | accum_general->beacon_rssi_a, |
| 1418 | delta_general->beacon_rssi_a, |
| 1419 | max_general->beacon_rssi_a); |
| 1420 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1421 | "beacon_rssi_b:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1422 | le32_to_cpu(general->beacon_rssi_b), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1423 | accum_general->beacon_rssi_b, |
| 1424 | delta_general->beacon_rssi_b, |
| 1425 | max_general->beacon_rssi_b); |
| 1426 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1427 | "beacon_rssi_c:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1428 | le32_to_cpu(general->beacon_rssi_c), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1429 | accum_general->beacon_rssi_c, |
| 1430 | delta_general->beacon_rssi_c, |
| 1431 | max_general->beacon_rssi_c); |
| 1432 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1433 | "beacon_energy_a:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1434 | le32_to_cpu(general->beacon_energy_a), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1435 | accum_general->beacon_energy_a, |
| 1436 | delta_general->beacon_energy_a, |
| 1437 | max_general->beacon_energy_a); |
| 1438 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1439 | "beacon_energy_b:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1440 | le32_to_cpu(general->beacon_energy_b), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1441 | accum_general->beacon_energy_b, |
| 1442 | delta_general->beacon_energy_b, |
| 1443 | max_general->beacon_energy_b); |
| 1444 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1445 | "beacon_energy_c:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1446 | le32_to_cpu(general->beacon_energy_c), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1447 | accum_general->beacon_energy_c, |
| 1448 | delta_general->beacon_energy_c, |
| 1449 | max_general->beacon_energy_c); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1450 | |
| 1451 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n"); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1452 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1453 | "Statistics_Rx - OFDM_HT:"); |
| 1454 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1455 | "plcp_err:", |
| 1456 | le32_to_cpu(ht->plcp_err), accum_ht->plcp_err, |
| 1457 | delta_ht->plcp_err, max_ht->plcp_err); |
| 1458 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1459 | "overrun_err:", |
| 1460 | le32_to_cpu(ht->overrun_err), accum_ht->overrun_err, |
| 1461 | delta_ht->overrun_err, max_ht->overrun_err); |
| 1462 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1463 | "early_overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1464 | le32_to_cpu(ht->early_overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1465 | accum_ht->early_overrun_err, |
| 1466 | delta_ht->early_overrun_err, |
| 1467 | max_ht->early_overrun_err); |
| 1468 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1469 | "crc32_good:", |
| 1470 | le32_to_cpu(ht->crc32_good), accum_ht->crc32_good, |
| 1471 | delta_ht->crc32_good, max_ht->crc32_good); |
| 1472 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1473 | "crc32_err:", |
| 1474 | le32_to_cpu(ht->crc32_err), accum_ht->crc32_err, |
| 1475 | delta_ht->crc32_err, max_ht->crc32_err); |
| 1476 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1477 | "mh_format_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1478 | le32_to_cpu(ht->mh_format_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1479 | accum_ht->mh_format_err, |
| 1480 | delta_ht->mh_format_err, max_ht->mh_format_err); |
| 1481 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1482 | "agg_crc32_good:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1483 | le32_to_cpu(ht->agg_crc32_good), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1484 | accum_ht->agg_crc32_good, |
| 1485 | delta_ht->agg_crc32_good, max_ht->agg_crc32_good); |
| 1486 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1487 | "agg_mpdu_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1488 | le32_to_cpu(ht->agg_mpdu_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1489 | accum_ht->agg_mpdu_cnt, |
| 1490 | delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt); |
| 1491 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1492 | "agg_cnt:", |
| 1493 | le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt, |
| 1494 | delta_ht->agg_cnt, max_ht->agg_cnt); |
| 1495 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1496 | "unsupport_mcs:", |
Wey-Yi Guy | f0118a4 | 2010-01-08 10:04:42 -0800 | [diff] [blame] | 1497 | le32_to_cpu(ht->unsupport_mcs), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1498 | accum_ht->unsupport_mcs, |
| 1499 | delta_ht->unsupport_mcs, max_ht->unsupport_mcs); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1500 | |
| 1501 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1502 | kfree(buf); |
| 1503 | return ret; |
| 1504 | } |
| 1505 | |
| 1506 | static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, |
| 1507 | char __user *user_buf, |
| 1508 | size_t count, loff_t *ppos) |
| 1509 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1510 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1511 | int pos = 0; |
| 1512 | char *buf; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1513 | int bufsz = (sizeof(struct statistics_tx) * 48) + 250; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1514 | ssize_t ret; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1515 | struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1516 | |
| 1517 | if (!iwl_is_alive(priv)) |
| 1518 | return -EAGAIN; |
| 1519 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1520 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1521 | if (!buf) { |
| 1522 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1523 | return -ENOMEM; |
| 1524 | } |
| 1525 | |
| 1526 | /* the statistic information display here is based on |
| 1527 | * the last statistics notification from uCode |
| 1528 | * might not reflect the current uCode activity |
| 1529 | */ |
| 1530 | tx = &priv->statistics.tx; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1531 | accum_tx = &priv->accum_statistics.tx; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1532 | delta_tx = &priv->delta_statistics.tx; |
| 1533 | max_tx = &priv->max_delta.tx; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1534 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1535 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1536 | "Statistics_Tx:"); |
| 1537 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1538 | "preamble:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1539 | le32_to_cpu(tx->preamble_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1540 | accum_tx->preamble_cnt, |
| 1541 | delta_tx->preamble_cnt, max_tx->preamble_cnt); |
| 1542 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1543 | "rx_detected_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1544 | le32_to_cpu(tx->rx_detected_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1545 | accum_tx->rx_detected_cnt, |
| 1546 | delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt); |
| 1547 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1548 | "bt_prio_defer_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1549 | le32_to_cpu(tx->bt_prio_defer_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1550 | accum_tx->bt_prio_defer_cnt, |
| 1551 | delta_tx->bt_prio_defer_cnt, |
| 1552 | max_tx->bt_prio_defer_cnt); |
| 1553 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1554 | "bt_prio_kill_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1555 | le32_to_cpu(tx->bt_prio_kill_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1556 | accum_tx->bt_prio_kill_cnt, |
| 1557 | delta_tx->bt_prio_kill_cnt, |
| 1558 | max_tx->bt_prio_kill_cnt); |
| 1559 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1560 | "few_bytes_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1561 | le32_to_cpu(tx->few_bytes_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1562 | accum_tx->few_bytes_cnt, |
| 1563 | delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt); |
| 1564 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1565 | "cts_timeout:", |
| 1566 | le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout, |
| 1567 | delta_tx->cts_timeout, max_tx->cts_timeout); |
| 1568 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1569 | "ack_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1570 | le32_to_cpu(tx->ack_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1571 | accum_tx->ack_timeout, |
| 1572 | delta_tx->ack_timeout, max_tx->ack_timeout); |
| 1573 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1574 | "expected_ack_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1575 | le32_to_cpu(tx->expected_ack_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1576 | accum_tx->expected_ack_cnt, |
| 1577 | delta_tx->expected_ack_cnt, |
| 1578 | max_tx->expected_ack_cnt); |
| 1579 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1580 | "actual_ack_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1581 | le32_to_cpu(tx->actual_ack_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1582 | accum_tx->actual_ack_cnt, |
| 1583 | delta_tx->actual_ack_cnt, |
| 1584 | max_tx->actual_ack_cnt); |
| 1585 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1586 | "dump_msdu_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1587 | le32_to_cpu(tx->dump_msdu_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1588 | accum_tx->dump_msdu_cnt, |
| 1589 | delta_tx->dump_msdu_cnt, |
| 1590 | max_tx->dump_msdu_cnt); |
| 1591 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1592 | "abort_nxt_frame_mismatch:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1593 | le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1594 | accum_tx->burst_abort_next_frame_mismatch_cnt, |
| 1595 | delta_tx->burst_abort_next_frame_mismatch_cnt, |
| 1596 | max_tx->burst_abort_next_frame_mismatch_cnt); |
| 1597 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1598 | "abort_missing_nxt_frame:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1599 | le32_to_cpu(tx->burst_abort_missing_next_frame_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1600 | accum_tx->burst_abort_missing_next_frame_cnt, |
| 1601 | delta_tx->burst_abort_missing_next_frame_cnt, |
| 1602 | max_tx->burst_abort_missing_next_frame_cnt); |
| 1603 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1604 | "cts_timeout_collision:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1605 | le32_to_cpu(tx->cts_timeout_collision), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1606 | accum_tx->cts_timeout_collision, |
| 1607 | delta_tx->cts_timeout_collision, |
| 1608 | max_tx->cts_timeout_collision); |
| 1609 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1610 | "ack_ba_timeout_collision:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1611 | le32_to_cpu(tx->ack_or_ba_timeout_collision), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1612 | accum_tx->ack_or_ba_timeout_collision, |
| 1613 | delta_tx->ack_or_ba_timeout_collision, |
| 1614 | max_tx->ack_or_ba_timeout_collision); |
| 1615 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1616 | "agg ba_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1617 | le32_to_cpu(tx->agg.ba_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1618 | accum_tx->agg.ba_timeout, |
| 1619 | delta_tx->agg.ba_timeout, |
| 1620 | max_tx->agg.ba_timeout); |
| 1621 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1622 | "agg ba_resched_frames:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1623 | le32_to_cpu(tx->agg.ba_reschedule_frames), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1624 | accum_tx->agg.ba_reschedule_frames, |
| 1625 | delta_tx->agg.ba_reschedule_frames, |
| 1626 | max_tx->agg.ba_reschedule_frames); |
| 1627 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1628 | "agg scd_query_agg_frame:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1629 | le32_to_cpu(tx->agg.scd_query_agg_frame_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1630 | accum_tx->agg.scd_query_agg_frame_cnt, |
| 1631 | delta_tx->agg.scd_query_agg_frame_cnt, |
| 1632 | max_tx->agg.scd_query_agg_frame_cnt); |
| 1633 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1634 | "agg scd_query_no_agg:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1635 | le32_to_cpu(tx->agg.scd_query_no_agg), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1636 | accum_tx->agg.scd_query_no_agg, |
| 1637 | delta_tx->agg.scd_query_no_agg, |
| 1638 | max_tx->agg.scd_query_no_agg); |
| 1639 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1640 | "agg scd_query_agg:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1641 | le32_to_cpu(tx->agg.scd_query_agg), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1642 | accum_tx->agg.scd_query_agg, |
| 1643 | delta_tx->agg.scd_query_agg, |
| 1644 | max_tx->agg.scd_query_agg); |
| 1645 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1646 | "agg scd_query_mismatch:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1647 | le32_to_cpu(tx->agg.scd_query_mismatch), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1648 | accum_tx->agg.scd_query_mismatch, |
| 1649 | delta_tx->agg.scd_query_mismatch, |
| 1650 | max_tx->agg.scd_query_mismatch); |
| 1651 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1652 | "agg frame_not_ready:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1653 | le32_to_cpu(tx->agg.frame_not_ready), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1654 | accum_tx->agg.frame_not_ready, |
| 1655 | delta_tx->agg.frame_not_ready, |
| 1656 | max_tx->agg.frame_not_ready); |
| 1657 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1658 | "agg underrun:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1659 | le32_to_cpu(tx->agg.underrun), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1660 | accum_tx->agg.underrun, |
| 1661 | delta_tx->agg.underrun, max_tx->agg.underrun); |
| 1662 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1663 | "agg bt_prio_kill:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1664 | le32_to_cpu(tx->agg.bt_prio_kill), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1665 | accum_tx->agg.bt_prio_kill, |
| 1666 | delta_tx->agg.bt_prio_kill, |
| 1667 | max_tx->agg.bt_prio_kill); |
| 1668 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1669 | "agg rx_ba_rsp_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1670 | le32_to_cpu(tx->agg.rx_ba_rsp_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1671 | accum_tx->agg.rx_ba_rsp_cnt, |
| 1672 | delta_tx->agg.rx_ba_rsp_cnt, |
| 1673 | max_tx->agg.rx_ba_rsp_cnt); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1674 | |
| 1675 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1676 | kfree(buf); |
| 1677 | return ret; |
| 1678 | } |
| 1679 | |
| 1680 | static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, |
| 1681 | char __user *user_buf, |
| 1682 | size_t count, loff_t *ppos) |
| 1683 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1684 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1685 | int pos = 0; |
| 1686 | char *buf; |
Wey-Yi Guy | 11fc524 | 2010-01-15 13:43:35 -0800 | [diff] [blame] | 1687 | int bufsz = sizeof(struct statistics_general) * 10 + 300; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1688 | ssize_t ret; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1689 | struct statistics_general *general, *accum_general; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1690 | struct statistics_general *delta_general, *max_general; |
| 1691 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; |
| 1692 | struct statistics_div *div, *accum_div, *delta_div, *max_div; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1693 | |
| 1694 | if (!iwl_is_alive(priv)) |
| 1695 | return -EAGAIN; |
| 1696 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1697 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1698 | if (!buf) { |
| 1699 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1700 | return -ENOMEM; |
| 1701 | } |
| 1702 | |
| 1703 | /* the statistic information display here is based on |
| 1704 | * the last statistics notification from uCode |
| 1705 | * might not reflect the current uCode activity |
| 1706 | */ |
| 1707 | general = &priv->statistics.general; |
| 1708 | dbg = &priv->statistics.general.dbg; |
| 1709 | div = &priv->statistics.general.div; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1710 | accum_general = &priv->accum_statistics.general; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1711 | delta_general = &priv->delta_statistics.general; |
| 1712 | max_general = &priv->max_delta.general; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1713 | accum_dbg = &priv->accum_statistics.general.dbg; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1714 | delta_dbg = &priv->delta_statistics.general.dbg; |
| 1715 | max_dbg = &priv->max_delta.general.dbg; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1716 | accum_div = &priv->accum_statistics.general.div; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1717 | delta_div = &priv->delta_statistics.general.div; |
| 1718 | max_div = &priv->max_delta.general.div; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1719 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1720 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1721 | "Statistics_General:"); |
| 1722 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format, |
| 1723 | "temperature:", |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1724 | le32_to_cpu(general->temperature)); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1725 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format, |
| 1726 | "temperature_m:", |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1727 | le32_to_cpu(general->temperature_m)); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1728 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1729 | "burst_check:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1730 | le32_to_cpu(dbg->burst_check), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1731 | accum_dbg->burst_check, |
| 1732 | delta_dbg->burst_check, max_dbg->burst_check); |
| 1733 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1734 | "burst_count:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1735 | le32_to_cpu(dbg->burst_count), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1736 | accum_dbg->burst_count, |
| 1737 | delta_dbg->burst_count, max_dbg->burst_count); |
| 1738 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1739 | "sleep_time:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1740 | le32_to_cpu(general->sleep_time), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1741 | accum_general->sleep_time, |
| 1742 | delta_general->sleep_time, max_general->sleep_time); |
| 1743 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1744 | "slots_out:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1745 | le32_to_cpu(general->slots_out), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1746 | accum_general->slots_out, |
| 1747 | delta_general->slots_out, max_general->slots_out); |
| 1748 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1749 | "slots_idle:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1750 | le32_to_cpu(general->slots_idle), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1751 | accum_general->slots_idle, |
| 1752 | delta_general->slots_idle, max_general->slots_idle); |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1753 | pos += scnprintf(buf + pos, bufsz - pos, "ttl_timestamp:\t\t\t%u\n", |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1754 | le32_to_cpu(general->ttl_timestamp)); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1755 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1756 | "tx_on_a:", |
| 1757 | le32_to_cpu(div->tx_on_a), accum_div->tx_on_a, |
| 1758 | delta_div->tx_on_a, max_div->tx_on_a); |
| 1759 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1760 | "tx_on_b:", |
| 1761 | le32_to_cpu(div->tx_on_b), accum_div->tx_on_b, |
| 1762 | delta_div->tx_on_b, max_div->tx_on_b); |
| 1763 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1764 | "exec_time:", |
| 1765 | le32_to_cpu(div->exec_time), accum_div->exec_time, |
| 1766 | delta_div->exec_time, max_div->exec_time); |
| 1767 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1768 | "probe_time:", |
| 1769 | le32_to_cpu(div->probe_time), accum_div->probe_time, |
| 1770 | delta_div->probe_time, max_div->probe_time); |
| 1771 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1772 | "rx_enable_counter:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1773 | le32_to_cpu(general->rx_enable_counter), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1774 | accum_general->rx_enable_counter, |
| 1775 | delta_general->rx_enable_counter, |
| 1776 | max_general->rx_enable_counter); |
Wey-Yi Guy | 11fc524 | 2010-01-15 13:43:35 -0800 | [diff] [blame] | 1777 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1778 | "num_of_sos_states:", |
| 1779 | le32_to_cpu(general->num_of_sos_states), |
| 1780 | accum_general->num_of_sos_states, |
| 1781 | delta_general->num_of_sos_states, |
| 1782 | max_general->num_of_sos_states); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1783 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1784 | kfree(buf); |
| 1785 | return ret; |
| 1786 | } |
| 1787 | |
Wey-Yi Guy | 5225935 | 2009-08-07 15:41:43 -0700 | [diff] [blame] | 1788 | static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, |
| 1789 | char __user *user_buf, |
| 1790 | size_t count, loff_t *ppos) { |
| 1791 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1792 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 5225935 | 2009-08-07 15:41:43 -0700 | [diff] [blame] | 1793 | int pos = 0; |
| 1794 | int cnt = 0; |
| 1795 | char *buf; |
| 1796 | int bufsz = sizeof(struct iwl_sensitivity_data) * 4 + 100; |
| 1797 | ssize_t ret; |
| 1798 | struct iwl_sensitivity_data *data; |
| 1799 | |
| 1800 | data = &priv->sensitivity_data; |
| 1801 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1802 | if (!buf) { |
| 1803 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1804 | return -ENOMEM; |
| 1805 | } |
| 1806 | |
| 1807 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n", |
| 1808 | data->auto_corr_ofdm); |
| 1809 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1810 | "auto_corr_ofdm_mrc:\t\t %u\n", |
| 1811 | data->auto_corr_ofdm_mrc); |
| 1812 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_x1:\t\t %u\n", |
| 1813 | data->auto_corr_ofdm_x1); |
| 1814 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1815 | "auto_corr_ofdm_mrc_x1:\t\t %u\n", |
| 1816 | data->auto_corr_ofdm_mrc_x1); |
| 1817 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck:\t\t\t %u\n", |
| 1818 | data->auto_corr_cck); |
| 1819 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck_mrc:\t\t %u\n", |
| 1820 | data->auto_corr_cck_mrc); |
| 1821 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1822 | "last_bad_plcp_cnt_ofdm:\t\t %u\n", |
| 1823 | data->last_bad_plcp_cnt_ofdm); |
| 1824 | pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_ofdm:\t\t %u\n", |
| 1825 | data->last_fa_cnt_ofdm); |
| 1826 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1827 | "last_bad_plcp_cnt_cck:\t\t %u\n", |
| 1828 | data->last_bad_plcp_cnt_cck); |
| 1829 | pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_cck:\t\t %u\n", |
| 1830 | data->last_fa_cnt_cck); |
| 1831 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_curr_state:\t\t\t %u\n", |
| 1832 | data->nrg_curr_state); |
| 1833 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_prev_state:\t\t\t %u\n", |
| 1834 | data->nrg_prev_state); |
| 1835 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_value:\t\t\t"); |
| 1836 | for (cnt = 0; cnt < 10; cnt++) { |
| 1837 | pos += scnprintf(buf + pos, bufsz - pos, " %u", |
| 1838 | data->nrg_value[cnt]); |
| 1839 | } |
| 1840 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
| 1841 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_rssi:\t\t"); |
| 1842 | for (cnt = 0; cnt < NRG_NUM_PREV_STAT_L; cnt++) { |
| 1843 | pos += scnprintf(buf + pos, bufsz - pos, " %u", |
| 1844 | data->nrg_silence_rssi[cnt]); |
| 1845 | } |
| 1846 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
| 1847 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_ref:\t\t %u\n", |
| 1848 | data->nrg_silence_ref); |
| 1849 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_energy_idx:\t\t\t %u\n", |
| 1850 | data->nrg_energy_idx); |
| 1851 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_idx:\t\t %u\n", |
| 1852 | data->nrg_silence_idx); |
| 1853 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_cck:\t\t\t %u\n", |
| 1854 | data->nrg_th_cck); |
| 1855 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1856 | "nrg_auto_corr_silence_diff:\t %u\n", |
| 1857 | data->nrg_auto_corr_silence_diff); |
| 1858 | pos += scnprintf(buf + pos, bufsz - pos, "num_in_cck_no_fa:\t\t %u\n", |
| 1859 | data->num_in_cck_no_fa); |
| 1860 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_ofdm:\t\t\t %u\n", |
| 1861 | data->nrg_th_ofdm); |
| 1862 | |
| 1863 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1864 | kfree(buf); |
| 1865 | return ret; |
| 1866 | } |
| 1867 | |
| 1868 | |
| 1869 | static ssize_t iwl_dbgfs_chain_noise_read(struct file *file, |
| 1870 | char __user *user_buf, |
| 1871 | size_t count, loff_t *ppos) { |
| 1872 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1873 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 5225935 | 2009-08-07 15:41:43 -0700 | [diff] [blame] | 1874 | int pos = 0; |
| 1875 | int cnt = 0; |
| 1876 | char *buf; |
| 1877 | int bufsz = sizeof(struct iwl_chain_noise_data) * 4 + 100; |
| 1878 | ssize_t ret; |
| 1879 | struct iwl_chain_noise_data *data; |
| 1880 | |
| 1881 | data = &priv->chain_noise_data; |
| 1882 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1883 | if (!buf) { |
| 1884 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1885 | return -ENOMEM; |
| 1886 | } |
| 1887 | |
| 1888 | pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n", |
| 1889 | data->active_chains); |
| 1890 | pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_a:\t\t\t %u\n", |
| 1891 | data->chain_noise_a); |
| 1892 | pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_b:\t\t\t %u\n", |
| 1893 | data->chain_noise_b); |
| 1894 | pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_c:\t\t\t %u\n", |
| 1895 | data->chain_noise_c); |
| 1896 | pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_a:\t\t\t %u\n", |
| 1897 | data->chain_signal_a); |
| 1898 | pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_b:\t\t\t %u\n", |
| 1899 | data->chain_signal_b); |
| 1900 | pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_c:\t\t\t %u\n", |
| 1901 | data->chain_signal_c); |
| 1902 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_count:\t\t\t %u\n", |
| 1903 | data->beacon_count); |
| 1904 | |
| 1905 | pos += scnprintf(buf + pos, bufsz - pos, "disconn_array:\t\t\t"); |
| 1906 | for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) { |
| 1907 | pos += scnprintf(buf + pos, bufsz - pos, " %u", |
| 1908 | data->disconn_array[cnt]); |
| 1909 | } |
| 1910 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
| 1911 | pos += scnprintf(buf + pos, bufsz - pos, "delta_gain_code:\t\t"); |
| 1912 | for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) { |
| 1913 | pos += scnprintf(buf + pos, bufsz - pos, " %u", |
| 1914 | data->delta_gain_code[cnt]); |
| 1915 | } |
| 1916 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
| 1917 | pos += scnprintf(buf + pos, bufsz - pos, "radio_write:\t\t\t %u\n", |
| 1918 | data->radio_write); |
| 1919 | pos += scnprintf(buf + pos, bufsz - pos, "state:\t\t\t\t %u\n", |
| 1920 | data->state); |
| 1921 | |
| 1922 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1923 | kfree(buf); |
| 1924 | return ret; |
| 1925 | } |
| 1926 | |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 1927 | static ssize_t iwl_dbgfs_tx_power_read(struct file *file, |
| 1928 | char __user *user_buf, |
| 1929 | size_t count, loff_t *ppos) { |
| 1930 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1931 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 1932 | char buf[128]; |
| 1933 | int pos = 0; |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 1934 | const size_t bufsz = sizeof(buf); |
| 1935 | struct statistics_tx *tx; |
| 1936 | |
| 1937 | if (!iwl_is_alive(priv)) |
| 1938 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); |
| 1939 | else { |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 1940 | tx = &priv->statistics.tx; |
| 1941 | if (tx->tx_power.ant_a || |
| 1942 | tx->tx_power.ant_b || |
| 1943 | tx->tx_power.ant_c) { |
| 1944 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1945 | "tx power: (1/2 dB step)\n"); |
| 1946 | if ((priv->cfg->valid_tx_ant & ANT_A) && |
| 1947 | tx->tx_power.ant_a) |
| 1948 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1949 | "\tantenna A: 0x%X\n", |
| 1950 | tx->tx_power.ant_a); |
| 1951 | if ((priv->cfg->valid_tx_ant & ANT_B) && |
| 1952 | tx->tx_power.ant_b) |
| 1953 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1954 | "\tantenna B: 0x%X\n", |
| 1955 | tx->tx_power.ant_b); |
| 1956 | if ((priv->cfg->valid_tx_ant & ANT_C) && |
| 1957 | tx->tx_power.ant_c) |
| 1958 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1959 | "\tantenna C: 0x%X\n", |
| 1960 | tx->tx_power.ant_c); |
| 1961 | } else |
| 1962 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); |
| 1963 | } |
| 1964 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1965 | } |
| 1966 | |
Wey-Yi Guy | c09430a | 2009-10-16 14:25:50 -0700 | [diff] [blame] | 1967 | static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, |
| 1968 | char __user *user_buf, |
| 1969 | size_t count, loff_t *ppos) |
| 1970 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1971 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | c09430a | 2009-10-16 14:25:50 -0700 | [diff] [blame] | 1972 | char buf[60]; |
| 1973 | int pos = 0; |
| 1974 | const size_t bufsz = sizeof(buf); |
| 1975 | u32 pwrsave_status; |
| 1976 | |
| 1977 | pwrsave_status = iwl_read32(priv, CSR_GP_CNTRL) & |
| 1978 | CSR_GP_REG_POWER_SAVE_STATUS_MSK; |
| 1979 | |
| 1980 | pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); |
| 1981 | pos += scnprintf(buf + pos, bufsz - pos, "%s\n", |
| 1982 | (pwrsave_status == CSR_GP_REG_NO_POWER_SAVE) ? "none" : |
| 1983 | (pwrsave_status == CSR_GP_REG_MAC_POWER_SAVE) ? "MAC" : |
| 1984 | (pwrsave_status == CSR_GP_REG_PHY_POWER_SAVE) ? "PHY" : |
| 1985 | "error"); |
| 1986 | |
| 1987 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1988 | } |
| 1989 | |
Wey-Yi Guy | 7163b8a | 2009-11-20 12:04:56 -0800 | [diff] [blame] | 1990 | static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file, |
Wey-Yi Guy | ef8d552 | 2009-11-13 11:56:28 -0800 | [diff] [blame] | 1991 | const char __user *user_buf, |
| 1992 | size_t count, loff_t *ppos) |
| 1993 | { |
| 1994 | struct iwl_priv *priv = file->private_data; |
| 1995 | char buf[8]; |
| 1996 | int buf_size; |
| 1997 | int clear; |
| 1998 | |
| 1999 | memset(buf, 0, sizeof(buf)); |
| 2000 | buf_size = min(count, sizeof(buf) - 1); |
| 2001 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2002 | return -EFAULT; |
| 2003 | if (sscanf(buf, "%d", &clear) != 1) |
| 2004 | return -EFAULT; |
| 2005 | |
| 2006 | /* make request to uCode to retrieve statistics information */ |
| 2007 | mutex_lock(&priv->mutex); |
| 2008 | iwl_send_statistics_request(priv, CMD_SYNC, true); |
| 2009 | mutex_unlock(&priv->mutex); |
| 2010 | |
| 2011 | return count; |
| 2012 | } |
| 2013 | |
Wey-Yi Guy | 696bdee | 2009-12-10 14:37:25 -0800 | [diff] [blame] | 2014 | static ssize_t iwl_dbgfs_csr_write(struct file *file, |
| 2015 | const char __user *user_buf, |
| 2016 | size_t count, loff_t *ppos) |
| 2017 | { |
| 2018 | struct iwl_priv *priv = file->private_data; |
| 2019 | char buf[8]; |
| 2020 | int buf_size; |
| 2021 | int csr; |
| 2022 | |
| 2023 | memset(buf, 0, sizeof(buf)); |
| 2024 | buf_size = min(count, sizeof(buf) - 1); |
| 2025 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2026 | return -EFAULT; |
| 2027 | if (sscanf(buf, "%d", &csr) != 1) |
| 2028 | return -EFAULT; |
| 2029 | |
| 2030 | if (priv->cfg->ops->lib->dump_csr) |
| 2031 | priv->cfg->ops->lib->dump_csr(priv); |
| 2032 | |
| 2033 | return count; |
| 2034 | } |
| 2035 | |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 2036 | static ssize_t iwl_dbgfs_ucode_tracing_read(struct file *file, |
| 2037 | char __user *user_buf, |
| 2038 | size_t count, loff_t *ppos) { |
| 2039 | |
| 2040 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2041 | int pos = 0; |
| 2042 | char buf[128]; |
| 2043 | const size_t bufsz = sizeof(buf); |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 2044 | |
| 2045 | pos += scnprintf(buf + pos, bufsz - pos, "ucode trace timer is %s\n", |
| 2046 | priv->event_log.ucode_trace ? "On" : "Off"); |
| 2047 | pos += scnprintf(buf + pos, bufsz - pos, "non_wraps_count:\t\t %u\n", |
| 2048 | priv->event_log.non_wraps_count); |
| 2049 | pos += scnprintf(buf + pos, bufsz - pos, "wraps_once_count:\t\t %u\n", |
| 2050 | priv->event_log.wraps_once_count); |
| 2051 | pos += scnprintf(buf + pos, bufsz - pos, "wraps_more_count:\t\t %u\n", |
| 2052 | priv->event_log.wraps_more_count); |
| 2053 | |
Wey-Yi Guy | 4967c31 | 2010-02-18 15:22:07 -0800 | [diff] [blame] | 2054 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 2055 | } |
| 2056 | |
| 2057 | static ssize_t iwl_dbgfs_ucode_tracing_write(struct file *file, |
| 2058 | const char __user *user_buf, |
| 2059 | size_t count, loff_t *ppos) |
| 2060 | { |
| 2061 | struct iwl_priv *priv = file->private_data; |
| 2062 | char buf[8]; |
| 2063 | int buf_size; |
| 2064 | int trace; |
| 2065 | |
| 2066 | memset(buf, 0, sizeof(buf)); |
| 2067 | buf_size = min(count, sizeof(buf) - 1); |
| 2068 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2069 | return -EFAULT; |
| 2070 | if (sscanf(buf, "%d", &trace) != 1) |
| 2071 | return -EFAULT; |
| 2072 | |
| 2073 | if (trace) { |
| 2074 | priv->event_log.ucode_trace = true; |
| 2075 | /* schedule the ucode timer to occur in UCODE_TRACE_PERIOD */ |
| 2076 | mod_timer(&priv->ucode_trace, |
| 2077 | jiffies + msecs_to_jiffies(UCODE_TRACE_PERIOD)); |
| 2078 | } else { |
| 2079 | priv->event_log.ucode_trace = false; |
| 2080 | del_timer_sync(&priv->ucode_trace); |
| 2081 | } |
| 2082 | |
| 2083 | return count; |
| 2084 | } |
| 2085 | |
Johannes Berg | 6098720 | 2010-02-18 00:36:07 -0800 | [diff] [blame] | 2086 | static ssize_t iwl_dbgfs_rxon_flags_read(struct file *file, |
| 2087 | char __user *user_buf, |
| 2088 | size_t count, loff_t *ppos) { |
| 2089 | |
| 2090 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2091 | int len = 0; |
| 2092 | char buf[20]; |
| 2093 | |
| 2094 | len = sprintf(buf, "0x%04X\n", le32_to_cpu(priv->active_rxon.flags)); |
| 2095 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 2096 | } |
| 2097 | |
| 2098 | static ssize_t iwl_dbgfs_rxon_filter_flags_read(struct file *file, |
| 2099 | char __user *user_buf, |
| 2100 | size_t count, loff_t *ppos) { |
| 2101 | |
| 2102 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2103 | int len = 0; |
| 2104 | char buf[20]; |
| 2105 | |
| 2106 | len = sprintf(buf, "0x%04X\n", |
| 2107 | le32_to_cpu(priv->active_rxon.filter_flags)); |
| 2108 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 2109 | } |
| 2110 | |
Wey-Yi Guy | 1b3eb82 | 2010-01-15 13:43:39 -0800 | [diff] [blame] | 2111 | static ssize_t iwl_dbgfs_fh_reg_read(struct file *file, |
| 2112 | char __user *user_buf, |
| 2113 | size_t count, loff_t *ppos) |
| 2114 | { |
| 2115 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2116 | char *buf; |
| 2117 | int pos = 0; |
| 2118 | ssize_t ret = -EFAULT; |
| 2119 | |
| 2120 | if (priv->cfg->ops->lib->dump_fh) { |
| 2121 | ret = pos = priv->cfg->ops->lib->dump_fh(priv, &buf, true); |
| 2122 | if (buf) { |
| 2123 | ret = simple_read_from_buffer(user_buf, |
| 2124 | count, ppos, buf, pos); |
| 2125 | kfree(buf); |
| 2126 | } |
| 2127 | } |
| 2128 | |
| 2129 | return ret; |
| 2130 | } |
| 2131 | |
Wey-Yi Guy | a13d276 | 2010-01-22 14:22:42 -0800 | [diff] [blame] | 2132 | static ssize_t iwl_dbgfs_missed_beacon_read(struct file *file, |
| 2133 | char __user *user_buf, |
| 2134 | size_t count, loff_t *ppos) { |
| 2135 | |
| 2136 | struct iwl_priv *priv = file->private_data; |
| 2137 | int pos = 0; |
| 2138 | char buf[12]; |
| 2139 | const size_t bufsz = sizeof(buf); |
Wey-Yi Guy | a13d276 | 2010-01-22 14:22:42 -0800 | [diff] [blame] | 2140 | |
| 2141 | pos += scnprintf(buf + pos, bufsz - pos, "%d\n", |
| 2142 | priv->missed_beacon_threshold); |
| 2143 | |
Wey-Yi Guy | 4967c31 | 2010-02-18 15:22:07 -0800 | [diff] [blame] | 2144 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
Wey-Yi Guy | a13d276 | 2010-01-22 14:22:42 -0800 | [diff] [blame] | 2145 | } |
| 2146 | |
| 2147 | static ssize_t iwl_dbgfs_missed_beacon_write(struct file *file, |
| 2148 | const char __user *user_buf, |
| 2149 | size_t count, loff_t *ppos) |
| 2150 | { |
| 2151 | struct iwl_priv *priv = file->private_data; |
| 2152 | char buf[8]; |
| 2153 | int buf_size; |
| 2154 | int missed; |
| 2155 | |
| 2156 | memset(buf, 0, sizeof(buf)); |
| 2157 | buf_size = min(count, sizeof(buf) - 1); |
| 2158 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2159 | return -EFAULT; |
| 2160 | if (sscanf(buf, "%d", &missed) != 1) |
| 2161 | return -EINVAL; |
| 2162 | |
| 2163 | if (missed < IWL_MISSED_BEACON_THRESHOLD_MIN || |
| 2164 | missed > IWL_MISSED_BEACON_THRESHOLD_MAX) |
| 2165 | priv->missed_beacon_threshold = |
| 2166 | IWL_MISSED_BEACON_THRESHOLD_DEF; |
| 2167 | else |
| 2168 | priv->missed_beacon_threshold = missed; |
| 2169 | |
| 2170 | return count; |
| 2171 | } |
| 2172 | |
Trieu 'Andrew' Nguyen | 3e4fb5f | 2010-01-22 14:22:46 -0800 | [diff] [blame] | 2173 | static ssize_t iwl_dbgfs_plcp_delta_read(struct file *file, |
| 2174 | char __user *user_buf, |
| 2175 | size_t count, loff_t *ppos) { |
| 2176 | |
| 2177 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2178 | int pos = 0; |
| 2179 | char buf[12]; |
| 2180 | const size_t bufsz = sizeof(buf); |
Trieu 'Andrew' Nguyen | 3e4fb5f | 2010-01-22 14:22:46 -0800 | [diff] [blame] | 2181 | |
| 2182 | pos += scnprintf(buf + pos, bufsz - pos, "%u\n", |
| 2183 | priv->cfg->plcp_delta_threshold); |
| 2184 | |
Wey-Yi Guy | 4967c31 | 2010-02-18 15:22:07 -0800 | [diff] [blame] | 2185 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
Trieu 'Andrew' Nguyen | 3e4fb5f | 2010-01-22 14:22:46 -0800 | [diff] [blame] | 2186 | } |
| 2187 | |
| 2188 | static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file, |
| 2189 | const char __user *user_buf, |
| 2190 | size_t count, loff_t *ppos) { |
| 2191 | |
| 2192 | struct iwl_priv *priv = file->private_data; |
| 2193 | char buf[8]; |
| 2194 | int buf_size; |
| 2195 | int plcp; |
| 2196 | |
| 2197 | memset(buf, 0, sizeof(buf)); |
| 2198 | buf_size = min(count, sizeof(buf) - 1); |
| 2199 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2200 | return -EFAULT; |
| 2201 | if (sscanf(buf, "%d", &plcp) != 1) |
| 2202 | return -EINVAL; |
| 2203 | if ((plcp <= IWL_MAX_PLCP_ERR_THRESHOLD_MIN) || |
| 2204 | (plcp > IWL_MAX_PLCP_ERR_THRESHOLD_MAX)) |
| 2205 | priv->cfg->plcp_delta_threshold = |
| 2206 | IWL_MAX_PLCP_ERR_THRESHOLD_DEF; |
| 2207 | else |
| 2208 | priv->cfg->plcp_delta_threshold = plcp; |
| 2209 | return count; |
| 2210 | } |
| 2211 | |
Wey-Yi Guy | 528c312 | 2010-02-18 22:03:07 -0800 | [diff] [blame] | 2212 | static ssize_t iwl_dbgfs_force_reset_read(struct file *file, |
| 2213 | char __user *user_buf, |
| 2214 | size_t count, loff_t *ppos) { |
| 2215 | |
| 2216 | struct iwl_priv *priv = file->private_data; |
| 2217 | int i, pos = 0; |
| 2218 | char buf[300]; |
| 2219 | const size_t bufsz = sizeof(buf); |
| 2220 | struct iwl_force_reset *force_reset; |
| 2221 | |
| 2222 | for (i = 0; i < IWL_MAX_FORCE_RESET; i++) { |
| 2223 | force_reset = &priv->force_reset[i]; |
| 2224 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2225 | "Force reset method %d\n", i); |
| 2226 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2227 | "\tnumber of reset request: %d\n", |
| 2228 | force_reset->reset_request_count); |
| 2229 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2230 | "\tnumber of reset request success: %d\n", |
| 2231 | force_reset->reset_success_count); |
| 2232 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2233 | "\tnumber of reset request reject: %d\n", |
| 2234 | force_reset->reset_reject_count); |
| 2235 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2236 | "\treset duration: %lu\n", |
| 2237 | force_reset->reset_duration); |
| 2238 | } |
| 2239 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 2240 | } |
| 2241 | |
Wey-Yi Guy | 04cafd7 | 2010-02-03 11:47:20 -0800 | [diff] [blame] | 2242 | static ssize_t iwl_dbgfs_force_reset_write(struct file *file, |
| 2243 | const char __user *user_buf, |
| 2244 | size_t count, loff_t *ppos) { |
| 2245 | |
| 2246 | struct iwl_priv *priv = file->private_data; |
| 2247 | char buf[8]; |
| 2248 | int buf_size; |
| 2249 | int reset, ret; |
| 2250 | |
| 2251 | memset(buf, 0, sizeof(buf)); |
| 2252 | buf_size = min(count, sizeof(buf) - 1); |
| 2253 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2254 | return -EFAULT; |
| 2255 | if (sscanf(buf, "%d", &reset) != 1) |
| 2256 | return -EINVAL; |
| 2257 | switch (reset) { |
| 2258 | case IWL_RF_RESET: |
| 2259 | case IWL_FW_RESET: |
| 2260 | ret = iwl_force_reset(priv, reset); |
| 2261 | break; |
| 2262 | default: |
| 2263 | return -EINVAL; |
| 2264 | } |
| 2265 | return ret ? ret : count; |
| 2266 | } |
| 2267 | |
Wey-Yi Guy | 7163b8a | 2009-11-20 12:04:56 -0800 | [diff] [blame] | 2268 | DEBUGFS_READ_FILE_OPS(rx_statistics); |
| 2269 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 2270 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 2271 | DEBUGFS_READ_FILE_OPS(rx_queue); |
| 2272 | DEBUGFS_READ_FILE_OPS(tx_queue); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 2273 | DEBUGFS_READ_FILE_OPS(ucode_rx_stats); |
| 2274 | DEBUGFS_READ_FILE_OPS(ucode_tx_stats); |
| 2275 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); |
Wey-Yi Guy | 5225935 | 2009-08-07 15:41:43 -0700 | [diff] [blame] | 2276 | DEBUGFS_READ_FILE_OPS(sensitivity); |
| 2277 | DEBUGFS_READ_FILE_OPS(chain_noise); |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 2278 | DEBUGFS_READ_FILE_OPS(tx_power); |
Wey-Yi Guy | c09430a | 2009-10-16 14:25:50 -0700 | [diff] [blame] | 2279 | DEBUGFS_READ_FILE_OPS(power_save_status); |
Wey-Yi Guy | 7163b8a | 2009-11-20 12:04:56 -0800 | [diff] [blame] | 2280 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); |
| 2281 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); |
Wey-Yi Guy | 696bdee | 2009-12-10 14:37:25 -0800 | [diff] [blame] | 2282 | DEBUGFS_WRITE_FILE_OPS(csr); |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 2283 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); |
Wey-Yi Guy | 1b3eb82 | 2010-01-15 13:43:39 -0800 | [diff] [blame] | 2284 | DEBUGFS_READ_FILE_OPS(fh_reg); |
Wey-Yi Guy | a13d276 | 2010-01-22 14:22:42 -0800 | [diff] [blame] | 2285 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); |
Trieu 'Andrew' Nguyen | 3e4fb5f | 2010-01-22 14:22:46 -0800 | [diff] [blame] | 2286 | DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); |
Wey-Yi Guy | 528c312 | 2010-02-18 22:03:07 -0800 | [diff] [blame] | 2287 | DEBUGFS_READ_WRITE_FILE_OPS(force_reset); |
Johannes Berg | 6098720 | 2010-02-18 00:36:07 -0800 | [diff] [blame] | 2288 | DEBUGFS_READ_FILE_OPS(rxon_flags); |
| 2289 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 2290 | |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2291 | /* |
| 2292 | * Create the debugfs files and directories |
| 2293 | * |
| 2294 | */ |
| 2295 | int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) |
| 2296 | { |
Zhu Yi | 95b1a82 | 2008-05-29 16:34:50 +0800 | [diff] [blame] | 2297 | struct dentry *phyd = priv->hw->wiphy->debugfsdir; |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2298 | struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2299 | |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2300 | dir_drv = debugfs_create_dir(name, phyd); |
| 2301 | if (!dir_drv) |
| 2302 | return -ENOMEM; |
| 2303 | |
| 2304 | priv->debugfs_dir = dir_drv; |
| 2305 | |
| 2306 | dir_data = debugfs_create_dir("data", dir_drv); |
| 2307 | if (!dir_data) |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2308 | goto err; |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2309 | dir_rf = debugfs_create_dir("rf", dir_drv); |
| 2310 | if (!dir_rf) |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2311 | goto err; |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2312 | dir_debug = debugfs_create_dir("debug", dir_drv); |
| 2313 | if (!dir_debug) |
| 2314 | goto err; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2315 | |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2316 | DEBUGFS_ADD_FILE(nvm, dir_data, S_IRUSR); |
| 2317 | DEBUGFS_ADD_FILE(sram, dir_data, S_IWUSR | S_IRUSR); |
| 2318 | DEBUGFS_ADD_FILE(log_event, dir_data, S_IWUSR | S_IRUSR); |
| 2319 | DEBUGFS_ADD_FILE(stations, dir_data, S_IRUSR); |
| 2320 | DEBUGFS_ADD_FILE(channels, dir_data, S_IRUSR); |
| 2321 | DEBUGFS_ADD_FILE(status, dir_data, S_IRUSR); |
| 2322 | DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR); |
| 2323 | DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); |
| 2324 | DEBUGFS_ADD_FILE(led, dir_data, S_IRUSR); |
| 2325 | DEBUGFS_ADD_FILE(sleep_level_override, dir_data, S_IWUSR | S_IRUSR); |
| 2326 | DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); |
| 2327 | DEBUGFS_ADD_FILE(thermal_throttling, dir_data, S_IRUSR); |
| 2328 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); |
| 2329 | DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); |
| 2330 | DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR); |
| 2331 | DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); |
| 2332 | DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR); |
| 2333 | DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR); |
| 2334 | DEBUGFS_ADD_FILE(tx_power, dir_debug, S_IRUSR); |
| 2335 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); |
| 2336 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); |
| 2337 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); |
| 2338 | DEBUGFS_ADD_FILE(csr, dir_debug, S_IWUSR); |
| 2339 | DEBUGFS_ADD_FILE(fh_reg, dir_debug, S_IRUSR); |
| 2340 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2341 | DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); |
Wey-Yi Guy | 528c312 | 2010-02-18 22:03:07 -0800 | [diff] [blame] | 2342 | DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 2343 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2344 | DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); |
| 2345 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); |
| 2346 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); |
| 2347 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); |
| 2348 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); |
| 2349 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 2350 | } |
Johannes Berg | 6098720 | 2010-02-18 00:36:07 -0800 | [diff] [blame] | 2351 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
| 2352 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2353 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, &priv->disable_sens_cal); |
| 2354 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, |
Tomas Winkler | 445c2df | 2008-05-15 13:54:16 +0800 | [diff] [blame] | 2355 | &priv->disable_chain_noise_cal); |
Wey-Yi Guy | 030b865 | 2009-06-12 13:22:55 -0700 | [diff] [blame] | 2356 | if (((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) || |
| 2357 | ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_3945)) |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2358 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, |
Wey-Yi Guy | 030b865 | 2009-06-12 13:22:55 -0700 | [diff] [blame] | 2359 | &priv->disable_tx_power_cal); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2360 | return 0; |
| 2361 | |
| 2362 | err: |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2363 | IWL_ERR(priv, "Can't create the debugfs directory\n"); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2364 | iwl_dbgfs_unregister(priv); |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2365 | return -ENOMEM; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2366 | } |
| 2367 | EXPORT_SYMBOL(iwl_dbgfs_register); |
| 2368 | |
| 2369 | /** |
| 2370 | * Remove the debugfs files and directories |
| 2371 | * |
| 2372 | */ |
| 2373 | void iwl_dbgfs_unregister(struct iwl_priv *priv) |
| 2374 | { |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2375 | if (!priv->debugfs_dir) |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2376 | return; |
| 2377 | |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2378 | debugfs_remove_recursive(priv->debugfs_dir); |
| 2379 | priv->debugfs_dir = NULL; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2380 | } |
| 2381 | EXPORT_SYMBOL(iwl_dbgfs_unregister); |
| 2382 | |
| 2383 | |
Tomas Winkler | 445c2df | 2008-05-15 13:54:16 +0800 | [diff] [blame] | 2384 | |