iwlwifi: add debugfs to monitor force reset parameters
authorWey-Yi Guy <wey-yi.w.guy@intel.com>
Fri, 19 Feb 2010 06:03:07 +0000 (22:03 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 19 Feb 2010 20:52:50 +0000 (15:52 -0500)
Adding debugfs file to monitor the counters and other
information related to "force_reset" request.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-debugfs.c

index 7241fda022c56b6271c9c1df9b46bbe4b4615960..7bf44f1467993d911d3f95bd18892cea408306aa 100644 (file)
@@ -2221,6 +2221,36 @@ static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file,
        return count;
 }
 
+static ssize_t iwl_dbgfs_force_reset_read(struct file *file,
+                                       char __user *user_buf,
+                                       size_t count, loff_t *ppos) {
+
+       struct iwl_priv *priv = file->private_data;
+       int i, pos = 0;
+       char buf[300];
+       const size_t bufsz = sizeof(buf);
+       struct iwl_force_reset *force_reset;
+
+       for (i = 0; i < IWL_MAX_FORCE_RESET; i++) {
+               force_reset = &priv->force_reset[i];
+               pos += scnprintf(buf + pos, bufsz - pos,
+                               "Force reset method %d\n", i);
+               pos += scnprintf(buf + pos, bufsz - pos,
+                               "\tnumber of reset request: %d\n",
+                               force_reset->reset_request_count);
+               pos += scnprintf(buf + pos, bufsz - pos,
+                               "\tnumber of reset request success: %d\n",
+                               force_reset->reset_success_count);
+               pos += scnprintf(buf + pos, bufsz - pos,
+                               "\tnumber of reset request reject: %d\n",
+                               force_reset->reset_reject_count);
+               pos += scnprintf(buf + pos, bufsz - pos,
+                               "\treset duration: %lu\n",
+                               force_reset->reset_duration);
+       }
+       return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
+}
+
 static ssize_t iwl_dbgfs_force_reset_write(struct file *file,
                                        const char __user *user_buf,
                                        size_t count, loff_t *ppos) {
@@ -2267,7 +2297,7 @@ DEBUGFS_READ_FILE_OPS(fh_reg);
 DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon);
 DEBUGFS_WRITE_FILE_OPS(internal_scan);
 DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta);
-DEBUGFS_WRITE_FILE_OPS(force_reset);
+DEBUGFS_READ_WRITE_FILE_OPS(force_reset);
 
 /*
  * Create the debugfs files and directories
@@ -2321,7 +2351,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
        DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
        DEBUGFS_ADD_FILE(internal_scan, dir_debug, S_IWUSR);
        DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR);
-       DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR);
+       DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR | S_IRUSR);
        if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) {
                DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
                DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);