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