diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 64 |
1 files changed, 22 insertions, 42 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index eaf5e66e603c..2e85edac560c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -2267,59 +2267,39 @@ static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file, | |||
2267 | return count; | 2267 | return count; |
2268 | } | 2268 | } |
2269 | 2269 | ||
2270 | static ssize_t iwl_dbgfs_force_reset_read(struct file *file, | 2270 | static ssize_t iwl_dbgfs_rf_reset_read(struct file *file, |
2271 | char __user *user_buf, | 2271 | char __user *user_buf, |
2272 | size_t count, loff_t *ppos) | 2272 | size_t count, loff_t *ppos) |
2273 | { | 2273 | { |
2274 | struct iwl_priv *priv = file->private_data; | 2274 | struct iwl_priv *priv = file->private_data; |
2275 | int i, pos = 0; | 2275 | int pos = 0; |
2276 | char buf[300]; | 2276 | char buf[300]; |
2277 | const size_t bufsz = sizeof(buf); | 2277 | const size_t bufsz = sizeof(buf); |
2278 | struct iwl_force_reset *force_reset; | 2278 | struct iwl_rf_reset *rf_reset = &priv->rf_reset; |
2279 | |||
2280 | pos += scnprintf(buf + pos, bufsz - pos, | ||
2281 | "RF reset statistics\n"); | ||
2282 | pos += scnprintf(buf + pos, bufsz - pos, | ||
2283 | "\tnumber of reset request: %d\n", | ||
2284 | rf_reset->reset_request_count); | ||
2285 | pos += scnprintf(buf + pos, bufsz - pos, | ||
2286 | "\tnumber of reset request success: %d\n", | ||
2287 | rf_reset->reset_success_count); | ||
2288 | pos += scnprintf(buf + pos, bufsz - pos, | ||
2289 | "\tnumber of reset request reject: %d\n", | ||
2290 | rf_reset->reset_reject_count); | ||
2279 | 2291 | ||
2280 | for (i = 0; i < IWL_MAX_FORCE_RESET; i++) { | ||
2281 | force_reset = &priv->force_reset[i]; | ||
2282 | pos += scnprintf(buf + pos, bufsz - pos, | ||
2283 | "Force reset method %d\n", i); | ||
2284 | pos += scnprintf(buf + pos, bufsz - pos, | ||
2285 | "\tnumber of reset request: %d\n", | ||
2286 | force_reset->reset_request_count); | ||
2287 | pos += scnprintf(buf + pos, bufsz - pos, | ||
2288 | "\tnumber of reset request success: %d\n", | ||
2289 | force_reset->reset_success_count); | ||
2290 | pos += scnprintf(buf + pos, bufsz - pos, | ||
2291 | "\tnumber of reset request reject: %d\n", | ||
2292 | force_reset->reset_reject_count); | ||
2293 | pos += scnprintf(buf + pos, bufsz - pos, | ||
2294 | "\treset duration: %lu\n", | ||
2295 | force_reset->reset_duration); | ||
2296 | } | ||
2297 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 2292 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
2298 | } | 2293 | } |
2299 | 2294 | ||
2300 | static ssize_t iwl_dbgfs_force_reset_write(struct file *file, | 2295 | static ssize_t iwl_dbgfs_rf_reset_write(struct file *file, |
2301 | const char __user *user_buf, | 2296 | const char __user *user_buf, |
2302 | size_t count, loff_t *ppos) { | 2297 | size_t count, loff_t *ppos) { |
2303 | 2298 | ||
2304 | struct iwl_priv *priv = file->private_data; | 2299 | struct iwl_priv *priv = file->private_data; |
2305 | char buf[8]; | 2300 | int ret; |
2306 | int buf_size; | ||
2307 | int reset, ret; | ||
2308 | 2301 | ||
2309 | memset(buf, 0, sizeof(buf)); | 2302 | ret = iwl_force_rf_reset(priv, true); |
2310 | buf_size = min(count, sizeof(buf) - 1); | ||
2311 | if (copy_from_user(buf, user_buf, buf_size)) | ||
2312 | return -EFAULT; | ||
2313 | if (sscanf(buf, "%d", &reset) != 1) | ||
2314 | return -EINVAL; | ||
2315 | switch (reset) { | ||
2316 | case IWL_RF_RESET: | ||
2317 | case IWL_FW_RESET: | ||
2318 | ret = iwl_force_reset(priv, reset, true); | ||
2319 | break; | ||
2320 | default: | ||
2321 | return -EINVAL; | ||
2322 | } | ||
2323 | return ret ? ret : count; | 2303 | return ret ? ret : count; |
2324 | } | 2304 | } |
2325 | 2305 | ||
@@ -2507,7 +2487,7 @@ DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); | |||
2507 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); | 2487 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); |
2508 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); | 2488 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); |
2509 | DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); | 2489 | DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); |
2510 | DEBUGFS_READ_WRITE_FILE_OPS(force_reset); | 2490 | DEBUGFS_READ_WRITE_FILE_OPS(rf_reset); |
2511 | DEBUGFS_READ_FILE_OPS(rxon_flags); | 2491 | DEBUGFS_READ_FILE_OPS(rxon_flags); |
2512 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); | 2492 | DEBUGFS_READ_FILE_OPS(rxon_filter_flags); |
2513 | DEBUGFS_WRITE_FILE_OPS(txfifo_flush); | 2493 | DEBUGFS_WRITE_FILE_OPS(txfifo_flush); |
@@ -2565,7 +2545,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
2565 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); | 2545 | DEBUGFS_ADD_FILE(clear_traffic_statistics, dir_debug, S_IWUSR); |
2566 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); | 2546 | DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); |
2567 | DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); | 2547 | DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); |
2568 | DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR); | 2548 | DEBUGFS_ADD_FILE(rf_reset, dir_debug, S_IWUSR | S_IRUSR); |
2569 | DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); | 2549 | DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); |
2570 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); | 2550 | DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); |
2571 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); | 2551 | DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); |