aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c60
1 files changed, 58 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index d134301b553c..7bf44f146799 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -530,8 +530,6 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
530 530
531 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n", 531 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
532 test_bit(STATUS_HCMD_ACTIVE, &priv->status)); 532 test_bit(STATUS_HCMD_ACTIVE, &priv->status));
533 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_SYNC_ACTIVE: %d\n",
534 test_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status));
535 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n", 533 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
536 test_bit(STATUS_INT_ENABLED, &priv->status)); 534 test_bit(STATUS_INT_ENABLED, &priv->status));
537 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", 535 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
@@ -2223,6 +2221,62 @@ static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file,
2223 return count; 2221 return count;
2224} 2222}
2225 2223
2224static ssize_t iwl_dbgfs_force_reset_read(struct file *file,
2225 char __user *user_buf,
2226 size_t count, loff_t *ppos) {
2227
2228 struct iwl_priv *priv = file->private_data;
2229 int i, pos = 0;
2230 char buf[300];
2231 const size_t bufsz = sizeof(buf);
2232 struct iwl_force_reset *force_reset;
2233
2234 for (i = 0; i < IWL_MAX_FORCE_RESET; i++) {
2235 force_reset = &priv->force_reset[i];
2236 pos += scnprintf(buf + pos, bufsz - pos,
2237 "Force reset method %d\n", i);
2238 pos += scnprintf(buf + pos, bufsz - pos,
2239 "\tnumber of reset request: %d\n",
2240 force_reset->reset_request_count);
2241 pos += scnprintf(buf + pos, bufsz - pos,
2242 "\tnumber of reset request success: %d\n",
2243 force_reset->reset_success_count);
2244 pos += scnprintf(buf + pos, bufsz - pos,
2245 "\tnumber of reset request reject: %d\n",
2246 force_reset->reset_reject_count);
2247 pos += scnprintf(buf + pos, bufsz - pos,
2248 "\treset duration: %lu\n",
2249 force_reset->reset_duration);
2250 }
2251 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
2252}
2253
2254static ssize_t iwl_dbgfs_force_reset_write(struct file *file,
2255 const char __user *user_buf,
2256 size_t count, loff_t *ppos) {
2257
2258 struct iwl_priv *priv = file->private_data;
2259 char buf[8];
2260 int buf_size;
2261 int reset, ret;
2262
2263 memset(buf, 0, sizeof(buf));
2264 buf_size = min(count, sizeof(buf) - 1);
2265 if (copy_from_user(buf, user_buf, buf_size))
2266 return -EFAULT;
2267 if (sscanf(buf, "%d", &reset) != 1)
2268 return -EINVAL;
2269 switch (reset) {
2270 case IWL_RF_RESET:
2271 case IWL_FW_RESET:
2272 ret = iwl_force_reset(priv, reset);
2273 break;
2274 default:
2275 return -EINVAL;
2276 }
2277 return ret ? ret : count;
2278}
2279
2226DEBUGFS_READ_FILE_OPS(rx_statistics); 2280DEBUGFS_READ_FILE_OPS(rx_statistics);
2227DEBUGFS_READ_FILE_OPS(tx_statistics); 2281DEBUGFS_READ_FILE_OPS(tx_statistics);
2228DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); 2282DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
@@ -2243,6 +2297,7 @@ DEBUGFS_READ_FILE_OPS(fh_reg);
2243DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); 2297DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon);
2244DEBUGFS_WRITE_FILE_OPS(internal_scan); 2298DEBUGFS_WRITE_FILE_OPS(internal_scan);
2245DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); 2299DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta);
2300DEBUGFS_READ_WRITE_FILE_OPS(force_reset);
2246 2301
2247/* 2302/*
2248 * Create the debugfs files and directories 2303 * Create the debugfs files and directories
@@ -2296,6 +2351,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2296 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); 2351 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
2297 DEBUGFS_ADD_FILE(internal_scan, dir_debug, S_IWUSR); 2352 DEBUGFS_ADD_FILE(internal_scan, dir_debug, S_IWUSR);
2298 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); 2353 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR);
2354 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR);
2299 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { 2355 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) {
2300 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); 2356 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
2301 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); 2357 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);