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); |
| 661 | ssize_t ret; |
| 662 | |
| 663 | for (i = 0; i < AC_NUM; i++) { |
| 664 | pos += scnprintf(buf + pos, bufsz - pos, |
| 665 | "\tcw_min\tcw_max\taifsn\ttxop\n"); |
| 666 | pos += scnprintf(buf + pos, bufsz - pos, |
| 667 | "AC[%d]\t%u\t%u\t%u\t%u\n", i, |
| 668 | priv->qos_data.def_qos_parm.ac[i].cw_min, |
| 669 | priv->qos_data.def_qos_parm.ac[i].cw_max, |
| 670 | priv->qos_data.def_qos_parm.ac[i].aifsn, |
| 671 | priv->qos_data.def_qos_parm.ac[i].edca_txop); |
| 672 | } |
| 673 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 674 | return ret; |
| 675 | } |
Wey-Yi Guy | a83b914 | 2009-04-08 11:39:32 -0700 | [diff] [blame] | 676 | |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 677 | static ssize_t iwl_dbgfs_led_read(struct file *file, char __user *user_buf, |
| 678 | size_t count, loff_t *ppos) |
| 679 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 680 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 681 | int pos = 0; |
| 682 | char buf[256]; |
| 683 | const size_t bufsz = sizeof(buf); |
| 684 | ssize_t ret; |
| 685 | |
| 686 | pos += scnprintf(buf + pos, bufsz - pos, |
| 687 | "allow blinking: %s\n", |
| 688 | (priv->allow_blinking) ? "True" : "False"); |
| 689 | if (priv->allow_blinking) { |
| 690 | pos += scnprintf(buf + pos, bufsz - pos, |
| 691 | "Led blinking rate: %u\n", |
| 692 | priv->last_blink_rate); |
| 693 | pos += scnprintf(buf + pos, bufsz - pos, |
| 694 | "Last blink time: %lu\n", |
| 695 | priv->last_blink_time); |
| 696 | } |
| 697 | |
| 698 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 699 | return ret; |
| 700 | } |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 701 | |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 702 | static ssize_t iwl_dbgfs_thermal_throttling_read(struct file *file, |
| 703 | char __user *user_buf, |
| 704 | size_t count, loff_t *ppos) |
| 705 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 706 | struct iwl_priv *priv = file->private_data; |
Johannes Berg | 3ad3b92 | 2009-08-07 15:41:48 -0700 | [diff] [blame] | 707 | struct iwl_tt_mgmt *tt = &priv->thermal_throttle; |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 708 | struct iwl_tt_restriction *restriction; |
| 709 | char buf[100]; |
| 710 | int pos = 0; |
| 711 | const size_t bufsz = sizeof(buf); |
| 712 | ssize_t ret; |
| 713 | |
| 714 | pos += scnprintf(buf + pos, bufsz - pos, |
| 715 | "Thermal Throttling Mode: %s\n", |
Johannes Berg | 3ad3b92 | 2009-08-07 15:41:48 -0700 | [diff] [blame] | 716 | tt->advanced_tt ? "Advance" : "Legacy"); |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 717 | pos += scnprintf(buf + pos, bufsz - pos, |
| 718 | "Thermal Throttling State: %d\n", |
| 719 | tt->state); |
Johannes Berg | 3ad3b92 | 2009-08-07 15:41:48 -0700 | [diff] [blame] | 720 | if (tt->advanced_tt) { |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 721 | restriction = tt->restriction + tt->state; |
| 722 | pos += scnprintf(buf + pos, bufsz - pos, |
| 723 | "Tx mode: %d\n", |
| 724 | restriction->tx_stream); |
| 725 | pos += scnprintf(buf + pos, bufsz - pos, |
| 726 | "Rx mode: %d\n", |
| 727 | restriction->rx_stream); |
| 728 | pos += scnprintf(buf + pos, bufsz - pos, |
| 729 | "HT mode: %d\n", |
| 730 | restriction->is_ht); |
| 731 | } |
| 732 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 733 | return ret; |
| 734 | } |
| 735 | |
Wey-Yi Guy | 1e4247d | 2009-07-27 13:50:15 -0700 | [diff] [blame] | 736 | static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file, |
| 737 | const char __user *user_buf, |
| 738 | size_t count, loff_t *ppos) |
| 739 | { |
| 740 | struct iwl_priv *priv = file->private_data; |
| 741 | char buf[8]; |
| 742 | int buf_size; |
| 743 | int ht40; |
| 744 | |
| 745 | memset(buf, 0, sizeof(buf)); |
| 746 | buf_size = min(count, sizeof(buf) - 1); |
| 747 | if (copy_from_user(buf, user_buf, buf_size)) |
| 748 | return -EFAULT; |
| 749 | if (sscanf(buf, "%d", &ht40) != 1) |
| 750 | return -EFAULT; |
| 751 | if (!iwl_is_associated(priv)) |
| 752 | priv->disable_ht40 = ht40 ? true : false; |
| 753 | else { |
| 754 | IWL_ERR(priv, "Sta associated with AP - " |
| 755 | "Change to 40MHz channel support is not allowed\n"); |
| 756 | return -EINVAL; |
| 757 | } |
| 758 | |
| 759 | return count; |
| 760 | } |
| 761 | |
| 762 | static ssize_t iwl_dbgfs_disable_ht40_read(struct file *file, |
| 763 | char __user *user_buf, |
| 764 | size_t count, loff_t *ppos) |
| 765 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 766 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 1e4247d | 2009-07-27 13:50:15 -0700 | [diff] [blame] | 767 | char buf[100]; |
| 768 | int pos = 0; |
| 769 | const size_t bufsz = sizeof(buf); |
| 770 | ssize_t ret; |
| 771 | |
| 772 | pos += scnprintf(buf + pos, bufsz - pos, |
| 773 | "11n 40MHz Mode: %s\n", |
| 774 | priv->disable_ht40 ? "Disabled" : "Enabled"); |
| 775 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 776 | return ret; |
| 777 | } |
| 778 | |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 779 | static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file, |
| 780 | const char __user *user_buf, |
| 781 | size_t count, loff_t *ppos) |
| 782 | { |
| 783 | struct iwl_priv *priv = file->private_data; |
| 784 | char buf[8]; |
| 785 | int buf_size; |
| 786 | int value; |
| 787 | |
| 788 | memset(buf, 0, sizeof(buf)); |
| 789 | buf_size = min(count, sizeof(buf) - 1); |
| 790 | if (copy_from_user(buf, user_buf, buf_size)) |
| 791 | return -EFAULT; |
| 792 | |
| 793 | if (sscanf(buf, "%d", &value) != 1) |
| 794 | return -EINVAL; |
| 795 | |
| 796 | /* |
| 797 | * Our users expect 0 to be "CAM", but 0 isn't actually |
| 798 | * valid here. However, let's not confuse them and present |
| 799 | * IWL_POWER_INDEX_1 as "1", not "0". |
| 800 | */ |
Reinette Chatre | 1a34c04 | 2009-10-09 13:20:25 -0700 | [diff] [blame] | 801 | if (value == 0) |
| 802 | return -EINVAL; |
| 803 | else if (value > 0) |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 804 | value -= 1; |
| 805 | |
| 806 | if (value != -1 && (value < 0 || value >= IWL_POWER_NUM)) |
| 807 | return -EINVAL; |
| 808 | |
Wey-Yi Guy | 4ad177b | 2009-10-16 14:25:58 -0700 | [diff] [blame] | 809 | if (!iwl_is_ready_rf(priv)) |
| 810 | return -EAGAIN; |
| 811 | |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 812 | priv->power_data.debug_sleep_level_override = value; |
| 813 | |
Reinette Chatre | d3a5719 | 2010-01-21 11:52:28 -0800 | [diff] [blame] | 814 | mutex_lock(&priv->mutex); |
Wey-Yi Guy | 4ad177b | 2009-10-16 14:25:58 -0700 | [diff] [blame] | 815 | iwl_power_update_mode(priv, true); |
Reinette Chatre | d3a5719 | 2010-01-21 11:52:28 -0800 | [diff] [blame] | 816 | mutex_unlock(&priv->mutex); |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 817 | |
| 818 | return count; |
| 819 | } |
| 820 | |
| 821 | static ssize_t iwl_dbgfs_sleep_level_override_read(struct file *file, |
| 822 | char __user *user_buf, |
| 823 | size_t count, loff_t *ppos) |
| 824 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 825 | struct iwl_priv *priv = file->private_data; |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 826 | char buf[10]; |
| 827 | int pos, value; |
| 828 | const size_t bufsz = sizeof(buf); |
| 829 | |
| 830 | /* see the write function */ |
| 831 | value = priv->power_data.debug_sleep_level_override; |
| 832 | if (value >= 0) |
| 833 | value += 1; |
| 834 | |
| 835 | pos = scnprintf(buf, bufsz, "%d\n", value); |
| 836 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 837 | } |
| 838 | |
| 839 | static ssize_t iwl_dbgfs_current_sleep_command_read(struct file *file, |
| 840 | char __user *user_buf, |
| 841 | size_t count, loff_t *ppos) |
| 842 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 843 | struct iwl_priv *priv = file->private_data; |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 844 | char buf[200]; |
| 845 | int pos = 0, i; |
| 846 | const size_t bufsz = sizeof(buf); |
| 847 | struct iwl_powertable_cmd *cmd = &priv->power_data.sleep_cmd; |
| 848 | |
| 849 | pos += scnprintf(buf + pos, bufsz - pos, |
| 850 | "flags: %#.2x\n", le16_to_cpu(cmd->flags)); |
| 851 | pos += scnprintf(buf + pos, bufsz - pos, |
| 852 | "RX/TX timeout: %d/%d usec\n", |
| 853 | le32_to_cpu(cmd->rx_data_timeout), |
| 854 | le32_to_cpu(cmd->tx_data_timeout)); |
| 855 | for (i = 0; i < IWL_POWER_VEC_SIZE; i++) |
| 856 | pos += scnprintf(buf + pos, bufsz - pos, |
| 857 | "sleep_interval[%d]: %d\n", i, |
| 858 | le32_to_cpu(cmd->sleep_interval[i])); |
| 859 | |
| 860 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 861 | } |
| 862 | |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 863 | DEBUGFS_READ_WRITE_FILE_OPS(sram); |
Wey-Yi Guy | b03d7d0 | 2009-12-14 14:12:20 -0800 | [diff] [blame] | 864 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); |
Wey-Yi Guy | 0848e29 | 2009-05-22 11:01:46 -0700 | [diff] [blame] | 865 | DEBUGFS_READ_FILE_OPS(nvm); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 866 | DEBUGFS_READ_FILE_OPS(stations); |
Winkler, Tomas | d366df5 | 2008-12-02 12:14:01 -0800 | [diff] [blame] | 867 | DEBUGFS_READ_FILE_OPS(channels); |
Wey-Yi Guy | 08df05a | 2009-03-24 10:02:54 -0700 | [diff] [blame] | 868 | DEBUGFS_READ_FILE_OPS(status); |
Wey-Yi Guy | a83b914 | 2009-04-08 11:39:32 -0700 | [diff] [blame] | 869 | DEBUGFS_READ_WRITE_FILE_OPS(interrupt); |
Wey-Yi Guy | f5ad69f | 2009-07-09 10:33:36 -0700 | [diff] [blame] | 870 | DEBUGFS_READ_FILE_OPS(qos); |
Wey-Yi Guy | a283c01 | 2009-07-17 09:30:19 -0700 | [diff] [blame] | 871 | DEBUGFS_READ_FILE_OPS(led); |
Wey-Yi Guy | fbf3a2a | 2009-07-24 11:13:04 -0700 | [diff] [blame] | 872 | DEBUGFS_READ_FILE_OPS(thermal_throttling); |
Wey-Yi Guy | 1e4247d | 2009-07-27 13:50:15 -0700 | [diff] [blame] | 873 | DEBUGFS_READ_WRITE_FILE_OPS(disable_ht40); |
Johannes Berg | e312c24 | 2009-08-07 15:41:51 -0700 | [diff] [blame] | 874 | DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override); |
| 875 | DEBUGFS_READ_FILE_OPS(current_sleep_command); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 876 | |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 877 | static ssize_t iwl_dbgfs_traffic_log_read(struct file *file, |
| 878 | char __user *user_buf, |
| 879 | size_t count, loff_t *ppos) |
| 880 | { |
| 881 | struct iwl_priv *priv = file->private_data; |
| 882 | int pos = 0, ofs = 0; |
| 883 | int cnt = 0, entry; |
| 884 | struct iwl_tx_queue *txq; |
| 885 | struct iwl_queue *q; |
| 886 | struct iwl_rx_queue *rxq = &priv->rxq; |
| 887 | char *buf; |
| 888 | int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + |
Wey-Yi Guy | 88804e2 | 2009-10-09 13:20:28 -0700 | [diff] [blame] | 889 | (priv->cfg->num_of_queues * 32 * 8) + 400; |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 890 | const u8 *ptr; |
| 891 | ssize_t ret; |
| 892 | |
Wey-Yi Guy | 88804e2 | 2009-10-09 13:20:28 -0700 | [diff] [blame] | 893 | if (!priv->txq) { |
| 894 | IWL_ERR(priv, "txq not ready\n"); |
| 895 | return -EAGAIN; |
| 896 | } |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 897 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 898 | if (!buf) { |
| 899 | IWL_ERR(priv, "Can not allocate buffer\n"); |
| 900 | return -ENOMEM; |
| 901 | } |
| 902 | pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n"); |
| 903 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { |
| 904 | txq = &priv->txq[cnt]; |
| 905 | q = &txq->q; |
| 906 | pos += scnprintf(buf + pos, bufsz - pos, |
| 907 | "q[%d]: read_ptr: %u, write_ptr: %u\n", |
| 908 | cnt, q->read_ptr, q->write_ptr); |
| 909 | } |
| 910 | if (priv->tx_traffic && (iwl_debug_level & IWL_DL_TX)) { |
| 911 | ptr = priv->tx_traffic; |
| 912 | pos += scnprintf(buf + pos, bufsz - pos, |
| 913 | "Tx Traffic idx: %u\n", priv->tx_traffic_idx); |
| 914 | for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { |
| 915 | for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; |
| 916 | entry++, ofs += 16) { |
| 917 | pos += scnprintf(buf + pos, bufsz - pos, |
| 918 | "0x%.4x ", ofs); |
| 919 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, |
| 920 | buf + pos, bufsz - pos, 0); |
Reinette Chatre | 2fac971 | 2009-09-25 14:24:21 -0700 | [diff] [blame] | 921 | pos += strlen(buf + pos); |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 922 | if (bufsz - pos > 0) |
| 923 | buf[pos++] = '\n'; |
| 924 | } |
| 925 | } |
| 926 | } |
| 927 | |
| 928 | pos += scnprintf(buf + pos, bufsz - pos, "Rx Queue\n"); |
| 929 | pos += scnprintf(buf + pos, bufsz - pos, |
| 930 | "read: %u, write: %u\n", |
| 931 | rxq->read, rxq->write); |
| 932 | |
| 933 | if (priv->rx_traffic && (iwl_debug_level & IWL_DL_RX)) { |
| 934 | ptr = priv->rx_traffic; |
| 935 | pos += scnprintf(buf + pos, bufsz - pos, |
| 936 | "Rx Traffic idx: %u\n", priv->rx_traffic_idx); |
| 937 | for (cnt = 0, ofs = 0; cnt < IWL_TRAFFIC_ENTRIES; cnt++) { |
| 938 | for (entry = 0; entry < IWL_TRAFFIC_ENTRY_SIZE / 16; |
| 939 | entry++, ofs += 16) { |
| 940 | pos += scnprintf(buf + pos, bufsz - pos, |
| 941 | "0x%.4x ", ofs); |
| 942 | hex_dump_to_buffer(ptr + ofs, 16, 16, 2, |
| 943 | buf + pos, bufsz - pos, 0); |
Reinette Chatre | 2fac971 | 2009-09-25 14:24:21 -0700 | [diff] [blame] | 944 | pos += strlen(buf + pos); |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 945 | if (bufsz - pos > 0) |
| 946 | buf[pos++] = '\n'; |
| 947 | } |
| 948 | } |
| 949 | } |
| 950 | |
| 951 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 952 | kfree(buf); |
| 953 | return ret; |
| 954 | } |
| 955 | |
| 956 | static ssize_t iwl_dbgfs_traffic_log_write(struct file *file, |
| 957 | const char __user *user_buf, |
| 958 | size_t count, loff_t *ppos) |
| 959 | { |
| 960 | struct iwl_priv *priv = file->private_data; |
| 961 | char buf[8]; |
| 962 | int buf_size; |
| 963 | int traffic_log; |
| 964 | |
| 965 | memset(buf, 0, sizeof(buf)); |
| 966 | buf_size = min(count, sizeof(buf) - 1); |
| 967 | if (copy_from_user(buf, user_buf, buf_size)) |
| 968 | return -EFAULT; |
| 969 | if (sscanf(buf, "%d", &traffic_log) != 1) |
| 970 | return -EFAULT; |
| 971 | if (traffic_log == 0) |
| 972 | iwl_reset_traffic_log(priv); |
| 973 | |
| 974 | return count; |
| 975 | } |
| 976 | |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 977 | static ssize_t iwl_dbgfs_tx_queue_read(struct file *file, |
| 978 | char __user *user_buf, |
| 979 | size_t count, loff_t *ppos) { |
| 980 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 981 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 982 | struct iwl_tx_queue *txq; |
| 983 | struct iwl_queue *q; |
| 984 | char *buf; |
| 985 | int pos = 0; |
| 986 | int cnt; |
| 987 | int ret; |
Wey-Yi Guy | d23db55 | 2009-11-20 12:04:59 -0800 | [diff] [blame] | 988 | 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] | 989 | |
Wey-Yi Guy | 88804e2 | 2009-10-09 13:20:28 -0700 | [diff] [blame] | 990 | if (!priv->txq) { |
| 991 | IWL_ERR(priv, "txq not ready\n"); |
| 992 | return -EAGAIN; |
| 993 | } |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 994 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 995 | if (!buf) |
| 996 | return -ENOMEM; |
| 997 | |
| 998 | for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { |
| 999 | txq = &priv->txq[cnt]; |
| 1000 | q = &txq->q; |
| 1001 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1002 | "hwq %.2d: read=%u write=%u stop=%d" |
| 1003 | " swq_id=%#.2x (ac %d/hwq %d)\n", |
| 1004 | cnt, q->read_ptr, q->write_ptr, |
| 1005 | !!test_bit(cnt, priv->queue_stopped), |
| 1006 | txq->swq_id, |
| 1007 | txq->swq_id & 0x80 ? txq->swq_id & 3 : |
| 1008 | txq->swq_id, |
| 1009 | txq->swq_id & 0x80 ? (txq->swq_id >> 2) & |
| 1010 | 0x1f : txq->swq_id); |
| 1011 | if (cnt >= 4) |
| 1012 | continue; |
| 1013 | /* for the ACs, display the stop count too */ |
| 1014 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1015 | " stop-count: %d\n", |
| 1016 | atomic_read(&priv->queue_stop_count[cnt])); |
| 1017 | } |
| 1018 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1019 | kfree(buf); |
| 1020 | return ret; |
| 1021 | } |
| 1022 | |
| 1023 | static ssize_t iwl_dbgfs_rx_queue_read(struct file *file, |
| 1024 | char __user *user_buf, |
| 1025 | size_t count, loff_t *ppos) { |
| 1026 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1027 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 1028 | struct iwl_rx_queue *rxq = &priv->rxq; |
| 1029 | char buf[256]; |
| 1030 | int pos = 0; |
| 1031 | const size_t bufsz = sizeof(buf); |
| 1032 | |
| 1033 | pos += scnprintf(buf + pos, bufsz - pos, "read: %u\n", |
| 1034 | rxq->read); |
| 1035 | pos += scnprintf(buf + pos, bufsz - pos, "write: %u\n", |
| 1036 | rxq->write); |
| 1037 | pos += scnprintf(buf + pos, bufsz - pos, "free_count: %u\n", |
| 1038 | rxq->free_count); |
| 1039 | pos += scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n", |
| 1040 | le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF); |
| 1041 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1042 | } |
| 1043 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1044 | static int iwl_dbgfs_statistics_flag(struct iwl_priv *priv, char *buf, |
| 1045 | int bufsz) |
| 1046 | { |
| 1047 | int p = 0; |
| 1048 | |
| 1049 | p += scnprintf(buf + p, bufsz - p, |
| 1050 | "Statistics Flag(0x%X):\n", |
| 1051 | le32_to_cpu(priv->statistics.flag)); |
| 1052 | if (le32_to_cpu(priv->statistics.flag) & UCODE_STATISTICS_CLEAR_MSK) |
| 1053 | p += scnprintf(buf + p, bufsz - p, |
| 1054 | "\tStatistics have been cleared\n"); |
| 1055 | p += scnprintf(buf + p, bufsz - p, |
| 1056 | "\tOperational Frequency: %s\n", |
| 1057 | (le32_to_cpu(priv->statistics.flag) & |
| 1058 | UCODE_STATISTICS_FREQUENCY_MSK) |
| 1059 | ? "2.4 GHz" : "5.2 GHz"); |
| 1060 | p += scnprintf(buf + p, bufsz - p, |
| 1061 | "\tTGj Narrow Band: %s\n", |
| 1062 | (le32_to_cpu(priv->statistics.flag) & |
| 1063 | UCODE_STATISTICS_NARROW_BAND_MSK) |
| 1064 | ? "enabled" : "disabled"); |
| 1065 | return p; |
| 1066 | } |
| 1067 | |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1068 | static const char ucode_stats_header[] = |
| 1069 | "%-32s current acumulative delta max\n"; |
| 1070 | static const char ucode_stats_short_format[] = |
| 1071 | " %-30s %10u\n"; |
| 1072 | static const char ucode_stats_format[] = |
| 1073 | " %-30s %10u %10u %10u %10u\n"; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1074 | |
| 1075 | static ssize_t iwl_dbgfs_ucode_rx_stats_read(struct file *file, |
| 1076 | char __user *user_buf, |
| 1077 | size_t count, loff_t *ppos) |
| 1078 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1079 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1080 | int pos = 0; |
| 1081 | char *buf; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1082 | int bufsz = sizeof(struct statistics_rx_phy) * 40 + |
| 1083 | sizeof(struct statistics_rx_non_phy) * 40 + |
| 1084 | sizeof(struct statistics_rx_ht_phy) * 40 + 400; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1085 | ssize_t ret; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1086 | struct statistics_rx_phy *ofdm, *accum_ofdm, *delta_ofdm, *max_ofdm; |
| 1087 | struct statistics_rx_phy *cck, *accum_cck, *delta_cck, *max_cck; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1088 | struct statistics_rx_non_phy *general, *accum_general; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1089 | struct statistics_rx_non_phy *delta_general, *max_general; |
| 1090 | 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] | 1091 | |
| 1092 | if (!iwl_is_alive(priv)) |
| 1093 | return -EAGAIN; |
| 1094 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1095 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1096 | if (!buf) { |
| 1097 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1098 | return -ENOMEM; |
| 1099 | } |
| 1100 | |
| 1101 | /* the statistic information display here is based on |
| 1102 | * the last statistics notification from uCode |
| 1103 | * might not reflect the current uCode activity |
| 1104 | */ |
| 1105 | ofdm = &priv->statistics.rx.ofdm; |
| 1106 | cck = &priv->statistics.rx.cck; |
| 1107 | general = &priv->statistics.rx.general; |
| 1108 | ht = &priv->statistics.rx.ofdm_ht; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1109 | accum_ofdm = &priv->accum_statistics.rx.ofdm; |
| 1110 | accum_cck = &priv->accum_statistics.rx.cck; |
| 1111 | accum_general = &priv->accum_statistics.rx.general; |
| 1112 | accum_ht = &priv->accum_statistics.rx.ofdm_ht; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1113 | delta_ofdm = &priv->delta_statistics.rx.ofdm; |
| 1114 | delta_cck = &priv->delta_statistics.rx.cck; |
| 1115 | delta_general = &priv->delta_statistics.rx.general; |
| 1116 | delta_ht = &priv->delta_statistics.rx.ofdm_ht; |
| 1117 | max_ofdm = &priv->max_delta.rx.ofdm; |
| 1118 | max_cck = &priv->max_delta.rx.cck; |
| 1119 | max_general = &priv->max_delta.rx.general; |
| 1120 | max_ht = &priv->max_delta.rx.ofdm_ht; |
| 1121 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1122 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1123 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1124 | "Statistics_Rx - OFDM:"); |
| 1125 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1126 | "ina_cnt:", le32_to_cpu(ofdm->ina_cnt), |
| 1127 | accum_ofdm->ina_cnt, |
| 1128 | delta_ofdm->ina_cnt, max_ofdm->ina_cnt); |
| 1129 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1130 | "fina_cnt:", |
| 1131 | le32_to_cpu(ofdm->fina_cnt), accum_ofdm->fina_cnt, |
| 1132 | delta_ofdm->fina_cnt, max_ofdm->fina_cnt); |
| 1133 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1134 | "plcp_err:", |
| 1135 | le32_to_cpu(ofdm->plcp_err), accum_ofdm->plcp_err, |
| 1136 | delta_ofdm->plcp_err, max_ofdm->plcp_err); |
| 1137 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1138 | "crc32_err:", |
| 1139 | le32_to_cpu(ofdm->crc32_err), accum_ofdm->crc32_err, |
| 1140 | delta_ofdm->crc32_err, max_ofdm->crc32_err); |
| 1141 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1142 | "overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1143 | le32_to_cpu(ofdm->overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1144 | accum_ofdm->overrun_err, |
| 1145 | delta_ofdm->overrun_err, max_ofdm->overrun_err); |
| 1146 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1147 | "early_overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1148 | le32_to_cpu(ofdm->early_overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1149 | accum_ofdm->early_overrun_err, |
| 1150 | delta_ofdm->early_overrun_err, |
| 1151 | max_ofdm->early_overrun_err); |
| 1152 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1153 | "crc32_good:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1154 | le32_to_cpu(ofdm->crc32_good), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1155 | accum_ofdm->crc32_good, |
| 1156 | delta_ofdm->crc32_good, max_ofdm->crc32_good); |
| 1157 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1158 | "false_alarm_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1159 | le32_to_cpu(ofdm->false_alarm_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1160 | accum_ofdm->false_alarm_cnt, |
| 1161 | delta_ofdm->false_alarm_cnt, |
| 1162 | max_ofdm->false_alarm_cnt); |
| 1163 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1164 | "fina_sync_err_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1165 | le32_to_cpu(ofdm->fina_sync_err_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1166 | accum_ofdm->fina_sync_err_cnt, |
| 1167 | delta_ofdm->fina_sync_err_cnt, |
| 1168 | max_ofdm->fina_sync_err_cnt); |
| 1169 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1170 | "sfd_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1171 | le32_to_cpu(ofdm->sfd_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1172 | accum_ofdm->sfd_timeout, |
| 1173 | delta_ofdm->sfd_timeout, |
| 1174 | max_ofdm->sfd_timeout); |
| 1175 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1176 | "fina_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1177 | le32_to_cpu(ofdm->fina_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1178 | accum_ofdm->fina_timeout, |
| 1179 | delta_ofdm->fina_timeout, |
| 1180 | max_ofdm->fina_timeout); |
| 1181 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1182 | "unresponded_rts:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1183 | le32_to_cpu(ofdm->unresponded_rts), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1184 | accum_ofdm->unresponded_rts, |
| 1185 | delta_ofdm->unresponded_rts, |
| 1186 | max_ofdm->unresponded_rts); |
| 1187 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1188 | "rxe_frame_lmt_ovrun:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1189 | le32_to_cpu(ofdm->rxe_frame_limit_overrun), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1190 | accum_ofdm->rxe_frame_limit_overrun, |
| 1191 | delta_ofdm->rxe_frame_limit_overrun, |
| 1192 | max_ofdm->rxe_frame_limit_overrun); |
| 1193 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1194 | "sent_ack_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1195 | le32_to_cpu(ofdm->sent_ack_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1196 | accum_ofdm->sent_ack_cnt, |
| 1197 | delta_ofdm->sent_ack_cnt, |
| 1198 | max_ofdm->sent_ack_cnt); |
| 1199 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1200 | "sent_cts_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1201 | le32_to_cpu(ofdm->sent_cts_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1202 | accum_ofdm->sent_cts_cnt, |
| 1203 | delta_ofdm->sent_cts_cnt, max_ofdm->sent_cts_cnt); |
| 1204 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1205 | "sent_ba_rsp_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1206 | le32_to_cpu(ofdm->sent_ba_rsp_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1207 | accum_ofdm->sent_ba_rsp_cnt, |
| 1208 | delta_ofdm->sent_ba_rsp_cnt, |
| 1209 | max_ofdm->sent_ba_rsp_cnt); |
| 1210 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1211 | "dsp_self_kill:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1212 | le32_to_cpu(ofdm->dsp_self_kill), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1213 | accum_ofdm->dsp_self_kill, |
| 1214 | delta_ofdm->dsp_self_kill, |
| 1215 | max_ofdm->dsp_self_kill); |
| 1216 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1217 | "mh_format_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1218 | le32_to_cpu(ofdm->mh_format_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1219 | accum_ofdm->mh_format_err, |
| 1220 | delta_ofdm->mh_format_err, |
| 1221 | max_ofdm->mh_format_err); |
| 1222 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1223 | "re_acq_main_rssi_sum:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1224 | le32_to_cpu(ofdm->re_acq_main_rssi_sum), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1225 | accum_ofdm->re_acq_main_rssi_sum, |
| 1226 | delta_ofdm->re_acq_main_rssi_sum, |
| 1227 | max_ofdm->re_acq_main_rssi_sum); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1228 | |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1229 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1230 | "Statistics_Rx - CCK:"); |
| 1231 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1232 | "ina_cnt:", |
| 1233 | le32_to_cpu(cck->ina_cnt), accum_cck->ina_cnt, |
| 1234 | delta_cck->ina_cnt, max_cck->ina_cnt); |
| 1235 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1236 | "fina_cnt:", |
| 1237 | le32_to_cpu(cck->fina_cnt), accum_cck->fina_cnt, |
| 1238 | delta_cck->fina_cnt, max_cck->fina_cnt); |
| 1239 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1240 | "plcp_err:", |
| 1241 | le32_to_cpu(cck->plcp_err), accum_cck->plcp_err, |
| 1242 | delta_cck->plcp_err, max_cck->plcp_err); |
| 1243 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1244 | "crc32_err:", |
| 1245 | le32_to_cpu(cck->crc32_err), accum_cck->crc32_err, |
| 1246 | delta_cck->crc32_err, max_cck->crc32_err); |
| 1247 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1248 | "overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1249 | le32_to_cpu(cck->overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1250 | accum_cck->overrun_err, |
| 1251 | delta_cck->overrun_err, max_cck->overrun_err); |
| 1252 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1253 | "early_overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1254 | le32_to_cpu(cck->early_overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1255 | accum_cck->early_overrun_err, |
| 1256 | delta_cck->early_overrun_err, |
| 1257 | max_cck->early_overrun_err); |
| 1258 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1259 | "crc32_good:", |
| 1260 | le32_to_cpu(cck->crc32_good), accum_cck->crc32_good, |
| 1261 | delta_cck->crc32_good, |
| 1262 | max_cck->crc32_good); |
| 1263 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1264 | "false_alarm_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1265 | le32_to_cpu(cck->false_alarm_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1266 | accum_cck->false_alarm_cnt, |
| 1267 | delta_cck->false_alarm_cnt, max_cck->false_alarm_cnt); |
| 1268 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1269 | "fina_sync_err_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1270 | le32_to_cpu(cck->fina_sync_err_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1271 | accum_cck->fina_sync_err_cnt, |
| 1272 | delta_cck->fina_sync_err_cnt, |
| 1273 | max_cck->fina_sync_err_cnt); |
| 1274 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1275 | "sfd_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1276 | le32_to_cpu(cck->sfd_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1277 | accum_cck->sfd_timeout, |
| 1278 | delta_cck->sfd_timeout, max_cck->sfd_timeout); |
| 1279 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1280 | "fina_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1281 | le32_to_cpu(cck->fina_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1282 | accum_cck->fina_timeout, |
| 1283 | delta_cck->fina_timeout, max_cck->fina_timeout); |
| 1284 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1285 | "unresponded_rts:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1286 | le32_to_cpu(cck->unresponded_rts), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1287 | accum_cck->unresponded_rts, |
| 1288 | delta_cck->unresponded_rts, |
| 1289 | max_cck->unresponded_rts); |
| 1290 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1291 | "rxe_frame_lmt_ovrun:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1292 | le32_to_cpu(cck->rxe_frame_limit_overrun), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1293 | accum_cck->rxe_frame_limit_overrun, |
| 1294 | delta_cck->rxe_frame_limit_overrun, |
| 1295 | max_cck->rxe_frame_limit_overrun); |
| 1296 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1297 | "sent_ack_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1298 | le32_to_cpu(cck->sent_ack_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1299 | accum_cck->sent_ack_cnt, |
| 1300 | delta_cck->sent_ack_cnt, |
| 1301 | max_cck->sent_ack_cnt); |
| 1302 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1303 | "sent_cts_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1304 | le32_to_cpu(cck->sent_cts_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1305 | accum_cck->sent_cts_cnt, |
| 1306 | delta_cck->sent_cts_cnt, |
| 1307 | max_cck->sent_cts_cnt); |
| 1308 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1309 | "sent_ba_rsp_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1310 | le32_to_cpu(cck->sent_ba_rsp_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1311 | accum_cck->sent_ba_rsp_cnt, |
| 1312 | delta_cck->sent_ba_rsp_cnt, |
| 1313 | max_cck->sent_ba_rsp_cnt); |
| 1314 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1315 | "dsp_self_kill:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1316 | le32_to_cpu(cck->dsp_self_kill), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1317 | accum_cck->dsp_self_kill, |
| 1318 | delta_cck->dsp_self_kill, |
| 1319 | max_cck->dsp_self_kill); |
| 1320 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1321 | "mh_format_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1322 | le32_to_cpu(cck->mh_format_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1323 | accum_cck->mh_format_err, |
| 1324 | delta_cck->mh_format_err, max_cck->mh_format_err); |
| 1325 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1326 | "re_acq_main_rssi_sum:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1327 | le32_to_cpu(cck->re_acq_main_rssi_sum), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1328 | accum_cck->re_acq_main_rssi_sum, |
| 1329 | delta_cck->re_acq_main_rssi_sum, |
| 1330 | max_cck->re_acq_main_rssi_sum); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1331 | |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1332 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1333 | "Statistics_Rx - GENERAL:"); |
| 1334 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1335 | "bogus_cts:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1336 | le32_to_cpu(general->bogus_cts), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1337 | accum_general->bogus_cts, |
| 1338 | delta_general->bogus_cts, max_general->bogus_cts); |
| 1339 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1340 | "bogus_ack:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1341 | le32_to_cpu(general->bogus_ack), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1342 | accum_general->bogus_ack, |
| 1343 | delta_general->bogus_ack, max_general->bogus_ack); |
| 1344 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1345 | "non_bssid_frames:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1346 | le32_to_cpu(general->non_bssid_frames), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1347 | accum_general->non_bssid_frames, |
| 1348 | delta_general->non_bssid_frames, |
| 1349 | max_general->non_bssid_frames); |
| 1350 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1351 | "filtered_frames:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1352 | le32_to_cpu(general->filtered_frames), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1353 | accum_general->filtered_frames, |
| 1354 | delta_general->filtered_frames, |
| 1355 | max_general->filtered_frames); |
| 1356 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1357 | "non_channel_beacons:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1358 | le32_to_cpu(general->non_channel_beacons), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1359 | accum_general->non_channel_beacons, |
| 1360 | delta_general->non_channel_beacons, |
| 1361 | max_general->non_channel_beacons); |
| 1362 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1363 | "channel_beacons:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1364 | le32_to_cpu(general->channel_beacons), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1365 | accum_general->channel_beacons, |
| 1366 | delta_general->channel_beacons, |
| 1367 | max_general->channel_beacons); |
| 1368 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1369 | "num_missed_bcon:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1370 | le32_to_cpu(general->num_missed_bcon), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1371 | accum_general->num_missed_bcon, |
| 1372 | delta_general->num_missed_bcon, |
| 1373 | max_general->num_missed_bcon); |
| 1374 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1375 | "adc_rx_saturation_time:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1376 | le32_to_cpu(general->adc_rx_saturation_time), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1377 | accum_general->adc_rx_saturation_time, |
| 1378 | delta_general->adc_rx_saturation_time, |
| 1379 | max_general->adc_rx_saturation_time); |
| 1380 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1381 | "ina_detect_search_tm:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1382 | le32_to_cpu(general->ina_detection_search_time), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1383 | accum_general->ina_detection_search_time, |
| 1384 | delta_general->ina_detection_search_time, |
| 1385 | max_general->ina_detection_search_time); |
| 1386 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1387 | "beacon_silence_rssi_a:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1388 | le32_to_cpu(general->beacon_silence_rssi_a), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1389 | accum_general->beacon_silence_rssi_a, |
| 1390 | delta_general->beacon_silence_rssi_a, |
| 1391 | max_general->beacon_silence_rssi_a); |
| 1392 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1393 | "beacon_silence_rssi_b:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1394 | le32_to_cpu(general->beacon_silence_rssi_b), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1395 | accum_general->beacon_silence_rssi_b, |
| 1396 | delta_general->beacon_silence_rssi_b, |
| 1397 | max_general->beacon_silence_rssi_b); |
| 1398 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1399 | "beacon_silence_rssi_c:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1400 | le32_to_cpu(general->beacon_silence_rssi_c), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1401 | accum_general->beacon_silence_rssi_c, |
| 1402 | delta_general->beacon_silence_rssi_c, |
| 1403 | max_general->beacon_silence_rssi_c); |
| 1404 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1405 | "interference_data_flag:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1406 | le32_to_cpu(general->interference_data_flag), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1407 | accum_general->interference_data_flag, |
| 1408 | delta_general->interference_data_flag, |
| 1409 | max_general->interference_data_flag); |
| 1410 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1411 | "channel_load:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1412 | le32_to_cpu(general->channel_load), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1413 | accum_general->channel_load, |
| 1414 | delta_general->channel_load, |
| 1415 | max_general->channel_load); |
| 1416 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1417 | "dsp_false_alarms:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1418 | le32_to_cpu(general->dsp_false_alarms), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1419 | accum_general->dsp_false_alarms, |
| 1420 | delta_general->dsp_false_alarms, |
| 1421 | max_general->dsp_false_alarms); |
| 1422 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1423 | "beacon_rssi_a:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1424 | le32_to_cpu(general->beacon_rssi_a), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1425 | accum_general->beacon_rssi_a, |
| 1426 | delta_general->beacon_rssi_a, |
| 1427 | max_general->beacon_rssi_a); |
| 1428 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1429 | "beacon_rssi_b:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1430 | le32_to_cpu(general->beacon_rssi_b), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1431 | accum_general->beacon_rssi_b, |
| 1432 | delta_general->beacon_rssi_b, |
| 1433 | max_general->beacon_rssi_b); |
| 1434 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1435 | "beacon_rssi_c:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1436 | le32_to_cpu(general->beacon_rssi_c), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1437 | accum_general->beacon_rssi_c, |
| 1438 | delta_general->beacon_rssi_c, |
| 1439 | max_general->beacon_rssi_c); |
| 1440 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1441 | "beacon_energy_a:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1442 | le32_to_cpu(general->beacon_energy_a), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1443 | accum_general->beacon_energy_a, |
| 1444 | delta_general->beacon_energy_a, |
| 1445 | max_general->beacon_energy_a); |
| 1446 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1447 | "beacon_energy_b:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1448 | le32_to_cpu(general->beacon_energy_b), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1449 | accum_general->beacon_energy_b, |
| 1450 | delta_general->beacon_energy_b, |
| 1451 | max_general->beacon_energy_b); |
| 1452 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1453 | "beacon_energy_c:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1454 | le32_to_cpu(general->beacon_energy_c), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1455 | accum_general->beacon_energy_c, |
| 1456 | delta_general->beacon_energy_c, |
| 1457 | max_general->beacon_energy_c); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1458 | |
| 1459 | pos += scnprintf(buf + pos, bufsz - pos, "Statistics_Rx - OFDM_HT:\n"); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1460 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1461 | "Statistics_Rx - OFDM_HT:"); |
| 1462 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1463 | "plcp_err:", |
| 1464 | le32_to_cpu(ht->plcp_err), accum_ht->plcp_err, |
| 1465 | delta_ht->plcp_err, max_ht->plcp_err); |
| 1466 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1467 | "overrun_err:", |
| 1468 | le32_to_cpu(ht->overrun_err), accum_ht->overrun_err, |
| 1469 | delta_ht->overrun_err, max_ht->overrun_err); |
| 1470 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1471 | "early_overrun_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1472 | le32_to_cpu(ht->early_overrun_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1473 | accum_ht->early_overrun_err, |
| 1474 | delta_ht->early_overrun_err, |
| 1475 | max_ht->early_overrun_err); |
| 1476 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1477 | "crc32_good:", |
| 1478 | le32_to_cpu(ht->crc32_good), accum_ht->crc32_good, |
| 1479 | delta_ht->crc32_good, max_ht->crc32_good); |
| 1480 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1481 | "crc32_err:", |
| 1482 | le32_to_cpu(ht->crc32_err), accum_ht->crc32_err, |
| 1483 | delta_ht->crc32_err, max_ht->crc32_err); |
| 1484 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1485 | "mh_format_err:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1486 | le32_to_cpu(ht->mh_format_err), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1487 | accum_ht->mh_format_err, |
| 1488 | delta_ht->mh_format_err, max_ht->mh_format_err); |
| 1489 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1490 | "agg_crc32_good:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1491 | le32_to_cpu(ht->agg_crc32_good), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1492 | accum_ht->agg_crc32_good, |
| 1493 | delta_ht->agg_crc32_good, max_ht->agg_crc32_good); |
| 1494 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1495 | "agg_mpdu_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1496 | le32_to_cpu(ht->agg_mpdu_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1497 | accum_ht->agg_mpdu_cnt, |
| 1498 | delta_ht->agg_mpdu_cnt, max_ht->agg_mpdu_cnt); |
| 1499 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1500 | "agg_cnt:", |
| 1501 | le32_to_cpu(ht->agg_cnt), accum_ht->agg_cnt, |
| 1502 | delta_ht->agg_cnt, max_ht->agg_cnt); |
| 1503 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1504 | "unsupport_mcs:", |
Wey-Yi Guy | f0118a4 | 2010-01-08 10:04:42 -0800 | [diff] [blame] | 1505 | le32_to_cpu(ht->unsupport_mcs), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1506 | accum_ht->unsupport_mcs, |
| 1507 | delta_ht->unsupport_mcs, max_ht->unsupport_mcs); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1508 | |
| 1509 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1510 | kfree(buf); |
| 1511 | return ret; |
| 1512 | } |
| 1513 | |
| 1514 | static ssize_t iwl_dbgfs_ucode_tx_stats_read(struct file *file, |
| 1515 | char __user *user_buf, |
| 1516 | size_t count, loff_t *ppos) |
| 1517 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1518 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1519 | int pos = 0; |
| 1520 | char *buf; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1521 | int bufsz = (sizeof(struct statistics_tx) * 48) + 250; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1522 | ssize_t ret; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1523 | struct statistics_tx *tx, *accum_tx, *delta_tx, *max_tx; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1524 | |
| 1525 | if (!iwl_is_alive(priv)) |
| 1526 | return -EAGAIN; |
| 1527 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1528 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1529 | if (!buf) { |
| 1530 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1531 | return -ENOMEM; |
| 1532 | } |
| 1533 | |
| 1534 | /* the statistic information display here is based on |
| 1535 | * the last statistics notification from uCode |
| 1536 | * might not reflect the current uCode activity |
| 1537 | */ |
| 1538 | tx = &priv->statistics.tx; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1539 | accum_tx = &priv->accum_statistics.tx; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1540 | delta_tx = &priv->delta_statistics.tx; |
| 1541 | max_tx = &priv->max_delta.tx; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1542 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1543 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1544 | "Statistics_Tx:"); |
| 1545 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1546 | "preamble:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1547 | le32_to_cpu(tx->preamble_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1548 | accum_tx->preamble_cnt, |
| 1549 | delta_tx->preamble_cnt, max_tx->preamble_cnt); |
| 1550 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1551 | "rx_detected_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1552 | le32_to_cpu(tx->rx_detected_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1553 | accum_tx->rx_detected_cnt, |
| 1554 | delta_tx->rx_detected_cnt, max_tx->rx_detected_cnt); |
| 1555 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1556 | "bt_prio_defer_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1557 | le32_to_cpu(tx->bt_prio_defer_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1558 | accum_tx->bt_prio_defer_cnt, |
| 1559 | delta_tx->bt_prio_defer_cnt, |
| 1560 | max_tx->bt_prio_defer_cnt); |
| 1561 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1562 | "bt_prio_kill_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1563 | le32_to_cpu(tx->bt_prio_kill_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1564 | accum_tx->bt_prio_kill_cnt, |
| 1565 | delta_tx->bt_prio_kill_cnt, |
| 1566 | max_tx->bt_prio_kill_cnt); |
| 1567 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1568 | "few_bytes_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1569 | le32_to_cpu(tx->few_bytes_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1570 | accum_tx->few_bytes_cnt, |
| 1571 | delta_tx->few_bytes_cnt, max_tx->few_bytes_cnt); |
| 1572 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1573 | "cts_timeout:", |
| 1574 | le32_to_cpu(tx->cts_timeout), accum_tx->cts_timeout, |
| 1575 | delta_tx->cts_timeout, max_tx->cts_timeout); |
| 1576 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1577 | "ack_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1578 | le32_to_cpu(tx->ack_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1579 | accum_tx->ack_timeout, |
| 1580 | delta_tx->ack_timeout, max_tx->ack_timeout); |
| 1581 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1582 | "expected_ack_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1583 | le32_to_cpu(tx->expected_ack_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1584 | accum_tx->expected_ack_cnt, |
| 1585 | delta_tx->expected_ack_cnt, |
| 1586 | max_tx->expected_ack_cnt); |
| 1587 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1588 | "actual_ack_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1589 | le32_to_cpu(tx->actual_ack_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1590 | accum_tx->actual_ack_cnt, |
| 1591 | delta_tx->actual_ack_cnt, |
| 1592 | max_tx->actual_ack_cnt); |
| 1593 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1594 | "dump_msdu_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1595 | le32_to_cpu(tx->dump_msdu_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1596 | accum_tx->dump_msdu_cnt, |
| 1597 | delta_tx->dump_msdu_cnt, |
| 1598 | max_tx->dump_msdu_cnt); |
| 1599 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1600 | "abort_nxt_frame_mismatch:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1601 | le32_to_cpu(tx->burst_abort_next_frame_mismatch_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1602 | accum_tx->burst_abort_next_frame_mismatch_cnt, |
| 1603 | delta_tx->burst_abort_next_frame_mismatch_cnt, |
| 1604 | max_tx->burst_abort_next_frame_mismatch_cnt); |
| 1605 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1606 | "abort_missing_nxt_frame:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1607 | le32_to_cpu(tx->burst_abort_missing_next_frame_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1608 | accum_tx->burst_abort_missing_next_frame_cnt, |
| 1609 | delta_tx->burst_abort_missing_next_frame_cnt, |
| 1610 | max_tx->burst_abort_missing_next_frame_cnt); |
| 1611 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1612 | "cts_timeout_collision:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1613 | le32_to_cpu(tx->cts_timeout_collision), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1614 | accum_tx->cts_timeout_collision, |
| 1615 | delta_tx->cts_timeout_collision, |
| 1616 | max_tx->cts_timeout_collision); |
| 1617 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1618 | "ack_ba_timeout_collision:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1619 | le32_to_cpu(tx->ack_or_ba_timeout_collision), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1620 | accum_tx->ack_or_ba_timeout_collision, |
| 1621 | delta_tx->ack_or_ba_timeout_collision, |
| 1622 | max_tx->ack_or_ba_timeout_collision); |
| 1623 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1624 | "agg ba_timeout:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1625 | le32_to_cpu(tx->agg.ba_timeout), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1626 | accum_tx->agg.ba_timeout, |
| 1627 | delta_tx->agg.ba_timeout, |
| 1628 | max_tx->agg.ba_timeout); |
| 1629 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1630 | "agg ba_resched_frames:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1631 | le32_to_cpu(tx->agg.ba_reschedule_frames), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1632 | accum_tx->agg.ba_reschedule_frames, |
| 1633 | delta_tx->agg.ba_reschedule_frames, |
| 1634 | max_tx->agg.ba_reschedule_frames); |
| 1635 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1636 | "agg scd_query_agg_frame:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1637 | le32_to_cpu(tx->agg.scd_query_agg_frame_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1638 | accum_tx->agg.scd_query_agg_frame_cnt, |
| 1639 | delta_tx->agg.scd_query_agg_frame_cnt, |
| 1640 | max_tx->agg.scd_query_agg_frame_cnt); |
| 1641 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1642 | "agg scd_query_no_agg:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1643 | le32_to_cpu(tx->agg.scd_query_no_agg), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1644 | accum_tx->agg.scd_query_no_agg, |
| 1645 | delta_tx->agg.scd_query_no_agg, |
| 1646 | max_tx->agg.scd_query_no_agg); |
| 1647 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1648 | "agg scd_query_agg:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1649 | le32_to_cpu(tx->agg.scd_query_agg), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1650 | accum_tx->agg.scd_query_agg, |
| 1651 | delta_tx->agg.scd_query_agg, |
| 1652 | max_tx->agg.scd_query_agg); |
| 1653 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1654 | "agg scd_query_mismatch:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1655 | le32_to_cpu(tx->agg.scd_query_mismatch), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1656 | accum_tx->agg.scd_query_mismatch, |
| 1657 | delta_tx->agg.scd_query_mismatch, |
| 1658 | max_tx->agg.scd_query_mismatch); |
| 1659 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1660 | "agg frame_not_ready:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1661 | le32_to_cpu(tx->agg.frame_not_ready), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1662 | accum_tx->agg.frame_not_ready, |
| 1663 | delta_tx->agg.frame_not_ready, |
| 1664 | max_tx->agg.frame_not_ready); |
| 1665 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1666 | "agg underrun:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1667 | le32_to_cpu(tx->agg.underrun), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1668 | accum_tx->agg.underrun, |
| 1669 | delta_tx->agg.underrun, max_tx->agg.underrun); |
| 1670 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1671 | "agg bt_prio_kill:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1672 | le32_to_cpu(tx->agg.bt_prio_kill), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1673 | accum_tx->agg.bt_prio_kill, |
| 1674 | delta_tx->agg.bt_prio_kill, |
| 1675 | max_tx->agg.bt_prio_kill); |
| 1676 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1677 | "agg rx_ba_rsp_cnt:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1678 | le32_to_cpu(tx->agg.rx_ba_rsp_cnt), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1679 | accum_tx->agg.rx_ba_rsp_cnt, |
| 1680 | delta_tx->agg.rx_ba_rsp_cnt, |
| 1681 | max_tx->agg.rx_ba_rsp_cnt); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1682 | |
| 1683 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1684 | kfree(buf); |
| 1685 | return ret; |
| 1686 | } |
| 1687 | |
| 1688 | static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file, |
| 1689 | char __user *user_buf, |
| 1690 | size_t count, loff_t *ppos) |
| 1691 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1692 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1693 | int pos = 0; |
| 1694 | char *buf; |
Wey-Yi Guy | 11fc524 | 2010-01-15 13:43:35 -0800 | [diff] [blame] | 1695 | int bufsz = sizeof(struct statistics_general) * 10 + 300; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1696 | ssize_t ret; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1697 | struct statistics_general *general, *accum_general; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1698 | struct statistics_general *delta_general, *max_general; |
| 1699 | struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg; |
| 1700 | struct statistics_div *div, *accum_div, *delta_div, *max_div; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1701 | |
| 1702 | if (!iwl_is_alive(priv)) |
| 1703 | return -EAGAIN; |
| 1704 | |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1705 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1706 | if (!buf) { |
| 1707 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1708 | return -ENOMEM; |
| 1709 | } |
| 1710 | |
| 1711 | /* the statistic information display here is based on |
| 1712 | * the last statistics notification from uCode |
| 1713 | * might not reflect the current uCode activity |
| 1714 | */ |
| 1715 | general = &priv->statistics.general; |
| 1716 | dbg = &priv->statistics.general.dbg; |
| 1717 | div = &priv->statistics.general.div; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1718 | accum_general = &priv->accum_statistics.general; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1719 | delta_general = &priv->delta_statistics.general; |
| 1720 | max_general = &priv->max_delta.general; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1721 | accum_dbg = &priv->accum_statistics.general.dbg; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1722 | delta_dbg = &priv->delta_statistics.general.dbg; |
| 1723 | max_dbg = &priv->max_delta.general.dbg; |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1724 | accum_div = &priv->accum_statistics.general.div; |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1725 | delta_div = &priv->delta_statistics.general.div; |
| 1726 | max_div = &priv->max_delta.general.div; |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1727 | pos += iwl_dbgfs_statistics_flag(priv, buf, bufsz); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1728 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_header, |
| 1729 | "Statistics_General:"); |
| 1730 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format, |
| 1731 | "temperature:", |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1732 | le32_to_cpu(general->temperature)); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1733 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_short_format, |
| 1734 | "temperature_m:", |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1735 | le32_to_cpu(general->temperature_m)); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1736 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1737 | "burst_check:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1738 | le32_to_cpu(dbg->burst_check), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1739 | accum_dbg->burst_check, |
| 1740 | delta_dbg->burst_check, max_dbg->burst_check); |
| 1741 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1742 | "burst_count:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1743 | le32_to_cpu(dbg->burst_count), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1744 | accum_dbg->burst_count, |
| 1745 | delta_dbg->burst_count, max_dbg->burst_count); |
| 1746 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1747 | "sleep_time:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1748 | le32_to_cpu(general->sleep_time), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1749 | accum_general->sleep_time, |
| 1750 | delta_general->sleep_time, max_general->sleep_time); |
| 1751 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1752 | "slots_out:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1753 | le32_to_cpu(general->slots_out), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1754 | accum_general->slots_out, |
| 1755 | delta_general->slots_out, max_general->slots_out); |
| 1756 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1757 | "slots_idle:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1758 | le32_to_cpu(general->slots_idle), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1759 | accum_general->slots_idle, |
| 1760 | delta_general->slots_idle, max_general->slots_idle); |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1761 | 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] | 1762 | le32_to_cpu(general->ttl_timestamp)); |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1763 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1764 | "tx_on_a:", |
| 1765 | le32_to_cpu(div->tx_on_a), accum_div->tx_on_a, |
| 1766 | delta_div->tx_on_a, max_div->tx_on_a); |
| 1767 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1768 | "tx_on_b:", |
| 1769 | le32_to_cpu(div->tx_on_b), accum_div->tx_on_b, |
| 1770 | delta_div->tx_on_b, max_div->tx_on_b); |
| 1771 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1772 | "exec_time:", |
| 1773 | le32_to_cpu(div->exec_time), accum_div->exec_time, |
| 1774 | delta_div->exec_time, max_div->exec_time); |
| 1775 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1776 | "probe_time:", |
| 1777 | le32_to_cpu(div->probe_time), accum_div->probe_time, |
| 1778 | delta_div->probe_time, max_div->probe_time); |
| 1779 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1780 | "rx_enable_counter:", |
Wey-Yi Guy | 92a35bd | 2009-10-09 13:20:29 -0700 | [diff] [blame] | 1781 | le32_to_cpu(general->rx_enable_counter), |
Wey-Yi Guy | e3ef216 | 2010-01-15 13:43:34 -0800 | [diff] [blame] | 1782 | accum_general->rx_enable_counter, |
| 1783 | delta_general->rx_enable_counter, |
| 1784 | max_general->rx_enable_counter); |
Wey-Yi Guy | 11fc524 | 2010-01-15 13:43:35 -0800 | [diff] [blame] | 1785 | pos += scnprintf(buf + pos, bufsz - pos, ucode_stats_format, |
| 1786 | "num_of_sos_states:", |
| 1787 | le32_to_cpu(general->num_of_sos_states), |
| 1788 | accum_general->num_of_sos_states, |
| 1789 | delta_general->num_of_sos_states, |
| 1790 | max_general->num_of_sos_states); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 1791 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1792 | kfree(buf); |
| 1793 | return ret; |
| 1794 | } |
| 1795 | |
Wey-Yi Guy | 5225935 | 2009-08-07 15:41:43 -0700 | [diff] [blame] | 1796 | static ssize_t iwl_dbgfs_sensitivity_read(struct file *file, |
| 1797 | char __user *user_buf, |
| 1798 | size_t count, loff_t *ppos) { |
| 1799 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1800 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 5225935 | 2009-08-07 15:41:43 -0700 | [diff] [blame] | 1801 | int pos = 0; |
| 1802 | int cnt = 0; |
| 1803 | char *buf; |
| 1804 | int bufsz = sizeof(struct iwl_sensitivity_data) * 4 + 100; |
| 1805 | ssize_t ret; |
| 1806 | struct iwl_sensitivity_data *data; |
| 1807 | |
| 1808 | data = &priv->sensitivity_data; |
| 1809 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1810 | if (!buf) { |
| 1811 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1812 | return -ENOMEM; |
| 1813 | } |
| 1814 | |
| 1815 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n", |
| 1816 | data->auto_corr_ofdm); |
| 1817 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1818 | "auto_corr_ofdm_mrc:\t\t %u\n", |
| 1819 | data->auto_corr_ofdm_mrc); |
| 1820 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_x1:\t\t %u\n", |
| 1821 | data->auto_corr_ofdm_x1); |
| 1822 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1823 | "auto_corr_ofdm_mrc_x1:\t\t %u\n", |
| 1824 | data->auto_corr_ofdm_mrc_x1); |
| 1825 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck:\t\t\t %u\n", |
| 1826 | data->auto_corr_cck); |
| 1827 | pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck_mrc:\t\t %u\n", |
| 1828 | data->auto_corr_cck_mrc); |
| 1829 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1830 | "last_bad_plcp_cnt_ofdm:\t\t %u\n", |
| 1831 | data->last_bad_plcp_cnt_ofdm); |
| 1832 | pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_ofdm:\t\t %u\n", |
| 1833 | data->last_fa_cnt_ofdm); |
| 1834 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1835 | "last_bad_plcp_cnt_cck:\t\t %u\n", |
| 1836 | data->last_bad_plcp_cnt_cck); |
| 1837 | pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_cck:\t\t %u\n", |
| 1838 | data->last_fa_cnt_cck); |
| 1839 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_curr_state:\t\t\t %u\n", |
| 1840 | data->nrg_curr_state); |
| 1841 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_prev_state:\t\t\t %u\n", |
| 1842 | data->nrg_prev_state); |
| 1843 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_value:\t\t\t"); |
| 1844 | for (cnt = 0; cnt < 10; cnt++) { |
| 1845 | pos += scnprintf(buf + pos, bufsz - pos, " %u", |
| 1846 | data->nrg_value[cnt]); |
| 1847 | } |
| 1848 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
| 1849 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_rssi:\t\t"); |
| 1850 | for (cnt = 0; cnt < NRG_NUM_PREV_STAT_L; cnt++) { |
| 1851 | pos += scnprintf(buf + pos, bufsz - pos, " %u", |
| 1852 | data->nrg_silence_rssi[cnt]); |
| 1853 | } |
| 1854 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
| 1855 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_ref:\t\t %u\n", |
| 1856 | data->nrg_silence_ref); |
| 1857 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_energy_idx:\t\t\t %u\n", |
| 1858 | data->nrg_energy_idx); |
| 1859 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_idx:\t\t %u\n", |
| 1860 | data->nrg_silence_idx); |
| 1861 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_cck:\t\t\t %u\n", |
| 1862 | data->nrg_th_cck); |
| 1863 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1864 | "nrg_auto_corr_silence_diff:\t %u\n", |
| 1865 | data->nrg_auto_corr_silence_diff); |
| 1866 | pos += scnprintf(buf + pos, bufsz - pos, "num_in_cck_no_fa:\t\t %u\n", |
| 1867 | data->num_in_cck_no_fa); |
| 1868 | pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_ofdm:\t\t\t %u\n", |
| 1869 | data->nrg_th_ofdm); |
| 1870 | |
| 1871 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1872 | kfree(buf); |
| 1873 | return ret; |
| 1874 | } |
| 1875 | |
| 1876 | |
| 1877 | static ssize_t iwl_dbgfs_chain_noise_read(struct file *file, |
| 1878 | char __user *user_buf, |
| 1879 | size_t count, loff_t *ppos) { |
| 1880 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1881 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | 5225935 | 2009-08-07 15:41:43 -0700 | [diff] [blame] | 1882 | int pos = 0; |
| 1883 | int cnt = 0; |
| 1884 | char *buf; |
| 1885 | int bufsz = sizeof(struct iwl_chain_noise_data) * 4 + 100; |
| 1886 | ssize_t ret; |
| 1887 | struct iwl_chain_noise_data *data; |
| 1888 | |
| 1889 | data = &priv->chain_noise_data; |
| 1890 | buf = kzalloc(bufsz, GFP_KERNEL); |
| 1891 | if (!buf) { |
| 1892 | IWL_ERR(priv, "Can not allocate Buffer\n"); |
| 1893 | return -ENOMEM; |
| 1894 | } |
| 1895 | |
| 1896 | pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n", |
| 1897 | data->active_chains); |
| 1898 | pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_a:\t\t\t %u\n", |
| 1899 | data->chain_noise_a); |
| 1900 | pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_b:\t\t\t %u\n", |
| 1901 | data->chain_noise_b); |
| 1902 | pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_c:\t\t\t %u\n", |
| 1903 | data->chain_noise_c); |
| 1904 | pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_a:\t\t\t %u\n", |
| 1905 | data->chain_signal_a); |
| 1906 | pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_b:\t\t\t %u\n", |
| 1907 | data->chain_signal_b); |
| 1908 | pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_c:\t\t\t %u\n", |
| 1909 | data->chain_signal_c); |
| 1910 | pos += scnprintf(buf + pos, bufsz - pos, "beacon_count:\t\t\t %u\n", |
| 1911 | data->beacon_count); |
| 1912 | |
| 1913 | pos += scnprintf(buf + pos, bufsz - pos, "disconn_array:\t\t\t"); |
| 1914 | for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) { |
| 1915 | pos += scnprintf(buf + pos, bufsz - pos, " %u", |
| 1916 | data->disconn_array[cnt]); |
| 1917 | } |
| 1918 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
| 1919 | pos += scnprintf(buf + pos, bufsz - pos, "delta_gain_code:\t\t"); |
| 1920 | for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) { |
| 1921 | pos += scnprintf(buf + pos, bufsz - pos, " %u", |
| 1922 | data->delta_gain_code[cnt]); |
| 1923 | } |
| 1924 | pos += scnprintf(buf + pos, bufsz - pos, "\n"); |
| 1925 | pos += scnprintf(buf + pos, bufsz - pos, "radio_write:\t\t\t %u\n", |
| 1926 | data->radio_write); |
| 1927 | pos += scnprintf(buf + pos, bufsz - pos, "state:\t\t\t\t %u\n", |
| 1928 | data->state); |
| 1929 | |
| 1930 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1931 | kfree(buf); |
| 1932 | return ret; |
| 1933 | } |
| 1934 | |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 1935 | static ssize_t iwl_dbgfs_tx_power_read(struct file *file, |
| 1936 | char __user *user_buf, |
| 1937 | size_t count, loff_t *ppos) { |
| 1938 | |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1939 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 1940 | char buf[128]; |
| 1941 | int pos = 0; |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 1942 | const size_t bufsz = sizeof(buf); |
| 1943 | struct statistics_tx *tx; |
| 1944 | |
| 1945 | if (!iwl_is_alive(priv)) |
| 1946 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); |
| 1947 | else { |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 1948 | tx = &priv->statistics.tx; |
| 1949 | if (tx->tx_power.ant_a || |
| 1950 | tx->tx_power.ant_b || |
| 1951 | tx->tx_power.ant_c) { |
| 1952 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1953 | "tx power: (1/2 dB step)\n"); |
| 1954 | if ((priv->cfg->valid_tx_ant & ANT_A) && |
| 1955 | tx->tx_power.ant_a) |
| 1956 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1957 | "\tantenna A: 0x%X\n", |
| 1958 | tx->tx_power.ant_a); |
| 1959 | if ((priv->cfg->valid_tx_ant & ANT_B) && |
| 1960 | tx->tx_power.ant_b) |
| 1961 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1962 | "\tantenna B: 0x%X\n", |
| 1963 | tx->tx_power.ant_b); |
| 1964 | if ((priv->cfg->valid_tx_ant & ANT_C) && |
| 1965 | tx->tx_power.ant_c) |
| 1966 | pos += scnprintf(buf + pos, bufsz - pos, |
| 1967 | "\tantenna C: 0x%X\n", |
| 1968 | tx->tx_power.ant_c); |
| 1969 | } else |
| 1970 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); |
| 1971 | } |
| 1972 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1973 | } |
| 1974 | |
Wey-Yi Guy | c09430a | 2009-10-16 14:25:50 -0700 | [diff] [blame] | 1975 | static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, |
| 1976 | char __user *user_buf, |
| 1977 | size_t count, loff_t *ppos) |
| 1978 | { |
H Hartley Sweeten | 28f63a4 | 2010-01-08 16:14:10 -0700 | [diff] [blame] | 1979 | struct iwl_priv *priv = file->private_data; |
Wey-Yi Guy | c09430a | 2009-10-16 14:25:50 -0700 | [diff] [blame] | 1980 | char buf[60]; |
| 1981 | int pos = 0; |
| 1982 | const size_t bufsz = sizeof(buf); |
| 1983 | u32 pwrsave_status; |
| 1984 | |
| 1985 | pwrsave_status = iwl_read32(priv, CSR_GP_CNTRL) & |
| 1986 | CSR_GP_REG_POWER_SAVE_STATUS_MSK; |
| 1987 | |
| 1988 | pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); |
| 1989 | pos += scnprintf(buf + pos, bufsz - pos, "%s\n", |
| 1990 | (pwrsave_status == CSR_GP_REG_NO_POWER_SAVE) ? "none" : |
| 1991 | (pwrsave_status == CSR_GP_REG_MAC_POWER_SAVE) ? "MAC" : |
| 1992 | (pwrsave_status == CSR_GP_REG_PHY_POWER_SAVE) ? "PHY" : |
| 1993 | "error"); |
| 1994 | |
| 1995 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 1996 | } |
| 1997 | |
Wey-Yi Guy | 7163b8a | 2009-11-20 12:04:56 -0800 | [diff] [blame] | 1998 | 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] | 1999 | const char __user *user_buf, |
| 2000 | size_t count, loff_t *ppos) |
| 2001 | { |
| 2002 | struct iwl_priv *priv = file->private_data; |
| 2003 | char buf[8]; |
| 2004 | int buf_size; |
| 2005 | int clear; |
| 2006 | |
| 2007 | memset(buf, 0, sizeof(buf)); |
| 2008 | buf_size = min(count, sizeof(buf) - 1); |
| 2009 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2010 | return -EFAULT; |
| 2011 | if (sscanf(buf, "%d", &clear) != 1) |
| 2012 | return -EFAULT; |
| 2013 | |
| 2014 | /* make request to uCode to retrieve statistics information */ |
| 2015 | mutex_lock(&priv->mutex); |
| 2016 | iwl_send_statistics_request(priv, CMD_SYNC, true); |
| 2017 | mutex_unlock(&priv->mutex); |
| 2018 | |
| 2019 | return count; |
| 2020 | } |
| 2021 | |
Wey-Yi Guy | 696bdee | 2009-12-10 14:37:25 -0800 | [diff] [blame] | 2022 | static ssize_t iwl_dbgfs_csr_write(struct file *file, |
| 2023 | const char __user *user_buf, |
| 2024 | size_t count, loff_t *ppos) |
| 2025 | { |
| 2026 | struct iwl_priv *priv = file->private_data; |
| 2027 | char buf[8]; |
| 2028 | int buf_size; |
| 2029 | int csr; |
| 2030 | |
| 2031 | memset(buf, 0, sizeof(buf)); |
| 2032 | buf_size = min(count, sizeof(buf) - 1); |
| 2033 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2034 | return -EFAULT; |
| 2035 | if (sscanf(buf, "%d", &csr) != 1) |
| 2036 | return -EFAULT; |
| 2037 | |
| 2038 | if (priv->cfg->ops->lib->dump_csr) |
| 2039 | priv->cfg->ops->lib->dump_csr(priv); |
| 2040 | |
| 2041 | return count; |
| 2042 | } |
| 2043 | |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 2044 | static ssize_t iwl_dbgfs_ucode_tracing_read(struct file *file, |
| 2045 | char __user *user_buf, |
| 2046 | size_t count, loff_t *ppos) { |
| 2047 | |
| 2048 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2049 | int pos = 0; |
| 2050 | char buf[128]; |
| 2051 | const size_t bufsz = sizeof(buf); |
| 2052 | ssize_t ret; |
| 2053 | |
| 2054 | pos += scnprintf(buf + pos, bufsz - pos, "ucode trace timer is %s\n", |
| 2055 | priv->event_log.ucode_trace ? "On" : "Off"); |
| 2056 | pos += scnprintf(buf + pos, bufsz - pos, "non_wraps_count:\t\t %u\n", |
| 2057 | priv->event_log.non_wraps_count); |
| 2058 | pos += scnprintf(buf + pos, bufsz - pos, "wraps_once_count:\t\t %u\n", |
| 2059 | priv->event_log.wraps_once_count); |
| 2060 | pos += scnprintf(buf + pos, bufsz - pos, "wraps_more_count:\t\t %u\n", |
| 2061 | priv->event_log.wraps_more_count); |
| 2062 | |
| 2063 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 2064 | return ret; |
| 2065 | } |
| 2066 | |
| 2067 | static ssize_t iwl_dbgfs_ucode_tracing_write(struct file *file, |
| 2068 | const char __user *user_buf, |
| 2069 | size_t count, loff_t *ppos) |
| 2070 | { |
| 2071 | struct iwl_priv *priv = file->private_data; |
| 2072 | char buf[8]; |
| 2073 | int buf_size; |
| 2074 | int trace; |
| 2075 | |
| 2076 | memset(buf, 0, sizeof(buf)); |
| 2077 | buf_size = min(count, sizeof(buf) - 1); |
| 2078 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2079 | return -EFAULT; |
| 2080 | if (sscanf(buf, "%d", &trace) != 1) |
| 2081 | return -EFAULT; |
| 2082 | |
| 2083 | if (trace) { |
| 2084 | priv->event_log.ucode_trace = true; |
| 2085 | /* schedule the ucode timer to occur in UCODE_TRACE_PERIOD */ |
| 2086 | mod_timer(&priv->ucode_trace, |
| 2087 | jiffies + msecs_to_jiffies(UCODE_TRACE_PERIOD)); |
| 2088 | } else { |
| 2089 | priv->event_log.ucode_trace = false; |
| 2090 | del_timer_sync(&priv->ucode_trace); |
| 2091 | } |
| 2092 | |
| 2093 | return count; |
| 2094 | } |
| 2095 | |
Johannes Berg | 6098720 | 2010-02-18 00:36:07 -0800 | [diff] [blame^] | 2096 | static ssize_t iwl_dbgfs_rxon_flags_read(struct file *file, |
| 2097 | char __user *user_buf, |
| 2098 | size_t count, loff_t *ppos) { |
| 2099 | |
| 2100 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2101 | int len = 0; |
| 2102 | char buf[20]; |
| 2103 | |
| 2104 | len = sprintf(buf, "0x%04X\n", le32_to_cpu(priv->active_rxon.flags)); |
| 2105 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 2106 | } |
| 2107 | |
| 2108 | static ssize_t iwl_dbgfs_rxon_filter_flags_read(struct file *file, |
| 2109 | char __user *user_buf, |
| 2110 | size_t count, loff_t *ppos) { |
| 2111 | |
| 2112 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2113 | int len = 0; |
| 2114 | char buf[20]; |
| 2115 | |
| 2116 | len = sprintf(buf, "0x%04X\n", |
| 2117 | le32_to_cpu(priv->active_rxon.filter_flags)); |
| 2118 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); |
| 2119 | } |
| 2120 | |
Wey-Yi Guy | 1b3eb82 | 2010-01-15 13:43:39 -0800 | [diff] [blame] | 2121 | static ssize_t iwl_dbgfs_fh_reg_read(struct file *file, |
| 2122 | char __user *user_buf, |
| 2123 | size_t count, loff_t *ppos) |
| 2124 | { |
| 2125 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2126 | char *buf; |
| 2127 | int pos = 0; |
| 2128 | ssize_t ret = -EFAULT; |
| 2129 | |
| 2130 | if (priv->cfg->ops->lib->dump_fh) { |
| 2131 | ret = pos = priv->cfg->ops->lib->dump_fh(priv, &buf, true); |
| 2132 | if (buf) { |
| 2133 | ret = simple_read_from_buffer(user_buf, |
| 2134 | count, ppos, buf, pos); |
| 2135 | kfree(buf); |
| 2136 | } |
| 2137 | } |
| 2138 | |
| 2139 | return ret; |
| 2140 | } |
| 2141 | |
Wey-Yi Guy | a13d276 | 2010-01-22 14:22:42 -0800 | [diff] [blame] | 2142 | static ssize_t iwl_dbgfs_missed_beacon_read(struct file *file, |
| 2143 | char __user *user_buf, |
| 2144 | size_t count, loff_t *ppos) { |
| 2145 | |
| 2146 | struct iwl_priv *priv = file->private_data; |
| 2147 | int pos = 0; |
| 2148 | char buf[12]; |
| 2149 | const size_t bufsz = sizeof(buf); |
| 2150 | ssize_t ret; |
| 2151 | |
| 2152 | pos += scnprintf(buf + pos, bufsz - pos, "%d\n", |
| 2153 | priv->missed_beacon_threshold); |
| 2154 | |
| 2155 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 2156 | return ret; |
| 2157 | } |
| 2158 | |
| 2159 | static ssize_t iwl_dbgfs_missed_beacon_write(struct file *file, |
| 2160 | const char __user *user_buf, |
| 2161 | size_t count, loff_t *ppos) |
| 2162 | { |
| 2163 | struct iwl_priv *priv = file->private_data; |
| 2164 | char buf[8]; |
| 2165 | int buf_size; |
| 2166 | int missed; |
| 2167 | |
| 2168 | memset(buf, 0, sizeof(buf)); |
| 2169 | buf_size = min(count, sizeof(buf) - 1); |
| 2170 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2171 | return -EFAULT; |
| 2172 | if (sscanf(buf, "%d", &missed) != 1) |
| 2173 | return -EINVAL; |
| 2174 | |
| 2175 | if (missed < IWL_MISSED_BEACON_THRESHOLD_MIN || |
| 2176 | missed > IWL_MISSED_BEACON_THRESHOLD_MAX) |
| 2177 | priv->missed_beacon_threshold = |
| 2178 | IWL_MISSED_BEACON_THRESHOLD_DEF; |
| 2179 | else |
| 2180 | priv->missed_beacon_threshold = missed; |
| 2181 | |
| 2182 | return count; |
| 2183 | } |
| 2184 | |
Wey-Yi Guy | afbdd69 | 2010-01-22 14:22:43 -0800 | [diff] [blame] | 2185 | static ssize_t iwl_dbgfs_internal_scan_write(struct file *file, |
| 2186 | const char __user *user_buf, |
| 2187 | size_t count, loff_t *ppos) |
| 2188 | { |
| 2189 | struct iwl_priv *priv = file->private_data; |
| 2190 | char buf[8]; |
| 2191 | int buf_size; |
| 2192 | int scan; |
| 2193 | |
| 2194 | memset(buf, 0, sizeof(buf)); |
| 2195 | buf_size = min(count, sizeof(buf) - 1); |
| 2196 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2197 | return -EFAULT; |
| 2198 | if (sscanf(buf, "%d", &scan) != 1) |
| 2199 | return -EINVAL; |
| 2200 | |
| 2201 | iwl_internal_short_hw_scan(priv); |
| 2202 | |
| 2203 | return count; |
| 2204 | } |
| 2205 | |
Trieu 'Andrew' Nguyen | 3e4fb5f | 2010-01-22 14:22:46 -0800 | [diff] [blame] | 2206 | static ssize_t iwl_dbgfs_plcp_delta_read(struct file *file, |
| 2207 | char __user *user_buf, |
| 2208 | size_t count, loff_t *ppos) { |
| 2209 | |
| 2210 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; |
| 2211 | int pos = 0; |
| 2212 | char buf[12]; |
| 2213 | const size_t bufsz = sizeof(buf); |
| 2214 | ssize_t ret; |
| 2215 | |
| 2216 | pos += scnprintf(buf + pos, bufsz - pos, "%u\n", |
| 2217 | priv->cfg->plcp_delta_threshold); |
| 2218 | |
| 2219 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 2220 | return ret; |
| 2221 | } |
| 2222 | |
| 2223 | static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file, |
| 2224 | const char __user *user_buf, |
| 2225 | size_t count, loff_t *ppos) { |
| 2226 | |
| 2227 | struct iwl_priv *priv = file->private_data; |
| 2228 | char buf[8]; |
| 2229 | int buf_size; |
| 2230 | int plcp; |
| 2231 | |
| 2232 | memset(buf, 0, sizeof(buf)); |
| 2233 | buf_size = min(count, sizeof(buf) - 1); |
| 2234 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2235 | return -EFAULT; |
| 2236 | if (sscanf(buf, "%d", &plcp) != 1) |
| 2237 | return -EINVAL; |
| 2238 | if ((plcp <= IWL_MAX_PLCP_ERR_THRESHOLD_MIN) || |
| 2239 | (plcp > IWL_MAX_PLCP_ERR_THRESHOLD_MAX)) |
| 2240 | priv->cfg->plcp_delta_threshold = |
| 2241 | IWL_MAX_PLCP_ERR_THRESHOLD_DEF; |
| 2242 | else |
| 2243 | priv->cfg->plcp_delta_threshold = plcp; |
| 2244 | return count; |
| 2245 | } |
| 2246 | |
Wey-Yi Guy | 528c312 | 2010-02-18 22:03:07 -0800 | [diff] [blame] | 2247 | static ssize_t iwl_dbgfs_force_reset_read(struct file *file, |
| 2248 | char __user *user_buf, |
| 2249 | size_t count, loff_t *ppos) { |
| 2250 | |
| 2251 | struct iwl_priv *priv = file->private_data; |
| 2252 | int i, pos = 0; |
| 2253 | char buf[300]; |
| 2254 | const size_t bufsz = sizeof(buf); |
| 2255 | struct iwl_force_reset *force_reset; |
| 2256 | |
| 2257 | for (i = 0; i < IWL_MAX_FORCE_RESET; i++) { |
| 2258 | force_reset = &priv->force_reset[i]; |
| 2259 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2260 | "Force reset method %d\n", i); |
| 2261 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2262 | "\tnumber of reset request: %d\n", |
| 2263 | force_reset->reset_request_count); |
| 2264 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2265 | "\tnumber of reset request success: %d\n", |
| 2266 | force_reset->reset_success_count); |
| 2267 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2268 | "\tnumber of reset request reject: %d\n", |
| 2269 | force_reset->reset_reject_count); |
| 2270 | pos += scnprintf(buf + pos, bufsz - pos, |
| 2271 | "\treset duration: %lu\n", |
| 2272 | force_reset->reset_duration); |
| 2273 | } |
| 2274 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
| 2275 | } |
| 2276 | |
Wey-Yi Guy | 04cafd7 | 2010-02-03 11:47:20 -0800 | [diff] [blame] | 2277 | static ssize_t iwl_dbgfs_force_reset_write(struct file *file, |
| 2278 | const char __user *user_buf, |
| 2279 | size_t count, loff_t *ppos) { |
| 2280 | |
| 2281 | struct iwl_priv *priv = file->private_data; |
| 2282 | char buf[8]; |
| 2283 | int buf_size; |
| 2284 | int reset, ret; |
| 2285 | |
| 2286 | memset(buf, 0, sizeof(buf)); |
| 2287 | buf_size = min(count, sizeof(buf) - 1); |
| 2288 | if (copy_from_user(buf, user_buf, buf_size)) |
| 2289 | return -EFAULT; |
| 2290 | if (sscanf(buf, "%d", &reset) != 1) |
| 2291 | return -EINVAL; |
| 2292 | switch (reset) { |
| 2293 | case IWL_RF_RESET: |
| 2294 | case IWL_FW_RESET: |
| 2295 | ret = iwl_force_reset(priv, reset); |
| 2296 | break; |
| 2297 | default: |
| 2298 | return -EINVAL; |
| 2299 | } |
| 2300 | return ret ? ret : count; |
| 2301 | } |
| 2302 | |
Wey-Yi Guy | 7163b8a | 2009-11-20 12:04:56 -0800 | [diff] [blame] | 2303 | DEBUGFS_READ_FILE_OPS(rx_statistics); |
| 2304 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 2305 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
Wey-Yi Guy | 141b03e | 2009-08-07 15:41:41 -0700 | [diff] [blame] | 2306 | DEBUGFS_READ_FILE_OPS(rx_queue); |
| 2307 | DEBUGFS_READ_FILE_OPS(tx_queue); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 2308 | DEBUGFS_READ_FILE_OPS(ucode_rx_stats); |
| 2309 | DEBUGFS_READ_FILE_OPS(ucode_tx_stats); |
| 2310 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); |
Wey-Yi Guy | 5225935 | 2009-08-07 15:41:43 -0700 | [diff] [blame] | 2311 | DEBUGFS_READ_FILE_OPS(sensitivity); |
| 2312 | DEBUGFS_READ_FILE_OPS(chain_noise); |
Wey-Yi Guy | f204b24 | 2009-08-21 13:34:19 -0700 | [diff] [blame] | 2313 | DEBUGFS_READ_FILE_OPS(tx_power); |
Wey-Yi Guy | c09430a | 2009-10-16 14:25:50 -0700 | [diff] [blame] | 2314 | DEBUGFS_READ_FILE_OPS(power_save_status); |
Wey-Yi Guy | 7163b8a | 2009-11-20 12:04:56 -0800 | [diff] [blame] | 2315 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); |
| 2316 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); |
Wey-Yi Guy | 696bdee | 2009-12-10 14:37:25 -0800 | [diff] [blame] | 2317 | DEBUGFS_WRITE_FILE_OPS(csr); |
Wey-Yi Guy | a9e1cb6 | 2009-12-10 14:37:26 -0800 | [diff] [blame] | 2318 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); |
Wey-Yi Guy | 1b3eb82 | 2010-01-15 13:43:39 -0800 | [diff] [blame] | 2319 | DEBUGFS_READ_FILE_OPS(fh_reg); |
Wey-Yi Guy | a13d276 | 2010-01-22 14:22:42 -0800 | [diff] [blame] | 2320 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); |
Wey-Yi Guy | afbdd69 | 2010-01-22 14:22:43 -0800 | [diff] [blame] | 2321 | DEBUGFS_WRITE_FILE_OPS(internal_scan); |
Trieu 'Andrew' Nguyen | 3e4fb5f | 2010-01-22 14:22:46 -0800 | [diff] [blame] | 2322 | DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); |
Wey-Yi Guy | 528c312 | 2010-02-18 22:03:07 -0800 | [diff] [blame] | 2323 | DEBUGFS_READ_WRITE_FILE_OPS(force_reset); |
Johannes Berg | 6098720 | 2010-02-18 00:36:07 -0800 | [diff] [blame^] | 2324 | DEBUGFS_READ_FILE_OPS(rxon_flags); |
| 2325 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); |
Wey-Yi Guy | 20594eb | 2009-08-07 15:41:39 -0700 | [diff] [blame] | 2326 | |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2327 | /* |
| 2328 | * Create the debugfs files and directories |
| 2329 | * |
| 2330 | */ |
| 2331 | int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) |
| 2332 | { |
Zhu Yi | 95b1a82 | 2008-05-29 16:34:50 +0800 | [diff] [blame] | 2333 | struct dentry *phyd = priv->hw->wiphy->debugfsdir; |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2334 | struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2335 | |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2336 | dir_drv = debugfs_create_dir(name, phyd); |
| 2337 | if (!dir_drv) |
| 2338 | return -ENOMEM; |
| 2339 | |
| 2340 | priv->debugfs_dir = dir_drv; |
| 2341 | |
| 2342 | dir_data = debugfs_create_dir("data", dir_drv); |
| 2343 | if (!dir_data) |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2344 | goto err; |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2345 | dir_rf = debugfs_create_dir("rf", dir_drv); |
| 2346 | if (!dir_rf) |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2347 | goto err; |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2348 | dir_debug = debugfs_create_dir("debug", dir_drv); |
| 2349 | if (!dir_debug) |
| 2350 | goto err; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2351 | |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2352 | DEBUGFS_ADD_FILE(nvm, dir_data, S_IRUSR); |
| 2353 | DEBUGFS_ADD_FILE(sram, dir_data, S_IWUSR | S_IRUSR); |
| 2354 | DEBUGFS_ADD_FILE(log_event, dir_data, S_IWUSR | S_IRUSR); |
| 2355 | DEBUGFS_ADD_FILE(stations, dir_data, S_IRUSR); |
| 2356 | DEBUGFS_ADD_FILE(channels, dir_data, S_IRUSR); |
| 2357 | DEBUGFS_ADD_FILE(status, dir_data, S_IRUSR); |
| 2358 | DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR); |
| 2359 | DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); |
| 2360 | DEBUGFS_ADD_FILE(led, dir_data, S_IRUSR); |
| 2361 | DEBUGFS_ADD_FILE(sleep_level_override, dir_data, S_IWUSR | S_IRUSR); |
| 2362 | DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); |
| 2363 | DEBUGFS_ADD_FILE(thermal_throttling, dir_data, S_IRUSR); |
| 2364 | DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); |
| 2365 | DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); |
| 2366 | DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR); |
| 2367 | DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); |
| 2368 | DEBUGFS_ADD_FILE(rx_queue, dir_debug, S_IRUSR); |
| 2369 | DEBUGFS_ADD_FILE(tx_queue, dir_debug, S_IRUSR); |
| 2370 | DEBUGFS_ADD_FILE(tx_power, dir_debug, S_IRUSR); |
| 2371 | DEBUGFS_ADD_FILE(power_save_status, dir_debug, S_IRUSR); |
| 2372 | DEBUGFS_ADD_FILE(clear_ucode_statistics, dir_debug, S_IWUSR); |
| 2373 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); |
| 2374 | DEBUGFS_ADD_FILE(csr, dir_debug, S_IWUSR); |
| 2375 | DEBUGFS_ADD_FILE(fh_reg, dir_debug, S_IRUSR); |
| 2376 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); |
| 2377 | DEBUGFS_ADD_FILE(internal_scan, dir_debug, S_IWUSR); |
| 2378 | DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); |
Wey-Yi Guy | 528c312 | 2010-02-18 22:03:07 -0800 | [diff] [blame] | 2379 | DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 2380 | 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] | 2381 | DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); |
| 2382 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); |
| 2383 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); |
| 2384 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); |
| 2385 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); |
| 2386 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); |
Wey-Yi Guy | e8fe59a | 2009-08-07 15:41:42 -0700 | [diff] [blame] | 2387 | } |
Johannes Berg | 6098720 | 2010-02-18 00:36:07 -0800 | [diff] [blame^] | 2388 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
| 2389 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2390 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, &priv->disable_sens_cal); |
| 2391 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, |
Tomas Winkler | 445c2df | 2008-05-15 13:54:16 +0800 | [diff] [blame] | 2392 | &priv->disable_chain_noise_cal); |
Wey-Yi Guy | 030b865 | 2009-06-12 13:22:55 -0700 | [diff] [blame] | 2393 | if (((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) || |
| 2394 | ((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] | 2395 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, |
Wey-Yi Guy | 030b865 | 2009-06-12 13:22:55 -0700 | [diff] [blame] | 2396 | &priv->disable_tx_power_cal); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2397 | return 0; |
| 2398 | |
| 2399 | err: |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2400 | IWL_ERR(priv, "Can't create the debugfs directory\n"); |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2401 | iwl_dbgfs_unregister(priv); |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2402 | return -ENOMEM; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2403 | } |
| 2404 | EXPORT_SYMBOL(iwl_dbgfs_register); |
| 2405 | |
| 2406 | /** |
| 2407 | * Remove the debugfs files and directories |
| 2408 | * |
| 2409 | */ |
| 2410 | void iwl_dbgfs_unregister(struct iwl_priv *priv) |
| 2411 | { |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2412 | if (!priv->debugfs_dir) |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2413 | return; |
| 2414 | |
Johannes Berg | 4c84a8f | 2010-01-22 14:22:54 -0800 | [diff] [blame] | 2415 | debugfs_remove_recursive(priv->debugfs_dir); |
| 2416 | priv->debugfs_dir = NULL; |
Tomas Winkler | 712b6cf | 2008-03-12 16:58:52 -0700 | [diff] [blame] | 2417 | } |
| 2418 | EXPORT_SYMBOL(iwl_dbgfs_unregister); |
| 2419 | |
| 2420 | |
Tomas Winkler | 445c2df | 2008-05-15 13:54:16 +0800 | [diff] [blame] | 2421 | |