summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
authorWey-Yi Guy2009-11-20 21:05:07 +0100
committerJohn W. Linville2009-11-23 23:05:37 +0100
commitc341ddb283b9e1a6d217e73fa36738629ca8f4fb (patch)
tree38c9d421c4751a5ca7964a7c7e35043033b7a98e /drivers/net/wireless/iwlwifi/iwl-agn.c
parentiwlwifi: Tell the ucode immediately when association state changes (diff)
downloadkernel-qcow2-linux-c341ddb283b9e1a6d217e73fa36738629ca8f4fb.tar.gz
kernel-qcow2-linux-c341ddb283b9e1a6d217e73fa36738629ca8f4fb.tar.xz
kernel-qcow2-linux-c341ddb283b9e1a6d217e73fa36738629ca8f4fb.zip
iwlwifi: print limited number of event log when uCode error
To help iwlagn uCode debugging, event log will dump to syslog when driver detect uCode error occurred, but this only happen when compile with CONFIG_IWLWIFI_DEBUG and debug flag is enabled; which is not always the case. Also, there is another problem, if the flag is set, the entire event log buffer will be dump to syslog, it can flood the syslog and make it very difficult to debug the problem. Change the default to only dump last 20 entries of event log to syslog unless the following condition meets: 1. both compile with CONFIG_IWLWIFI_DEBUG and debug flag is enabled, and then dump the entire event buffer to syslog. 2. dump event log request from debugfs Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Acked-by: Ben Cahill <ben.m.cahill@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c76
1 files changed, 62 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 927131192572..9b04b25f0e57 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1696,8 +1696,6 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
}
-#ifdef CONFIG_IWLWIFI_DEBUG
-
#define EVENT_START_OFFSET (4 * sizeof(u32))
/**
@@ -1758,10 +1756,42 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
}
+/**
+ * iwl_print_last_event_logs - Dump the newest # of event log to syslog
+ */
+static void iwl_print_last_event_logs(struct iwl_priv *priv, u32 capacity,
+ u32 num_wraps, u32 next_entry,
+ u32 size, u32 mode)
+{
+ /*
+ * display the newest DEFAULT_LOG_ENTRIES entries
+ * i.e the entries just before the next ont that uCode would fill.
+ */
+ if (num_wraps) {
+ if (next_entry < size) {
+ iwl_print_event_log(priv,
+ capacity - (size - next_entry),
+ size - next_entry, mode);
+ iwl_print_event_log(priv, 0,
+ next_entry, mode);
+ } else
+ iwl_print_event_log(priv, next_entry - size,
+ size, mode);
+ } else {
+ if (next_entry < size)
+ iwl_print_event_log(priv, 0, next_entry, mode);
+ else
+ iwl_print_event_log(priv, next_entry - size,
+ size, mode);
+ }
+}
+
/* For sanity check only. Actual size is determined by uCode, typ. 512 */
#define MAX_EVENT_LOG_SIZE (512)
-void iwl_dump_nic_event_log(struct iwl_priv *priv)
+#define DEFAULT_DUMP_EVENT_LOG_ENTRIES (20)
+
+void iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log)
{
u32 base; /* SRAM byte address of event log header */
u32 capacity; /* event log capacity in # entries */
@@ -1806,19 +1836,37 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv)
return;
}
- IWL_ERR(priv, "Start IWL Event Log Dump: display count %d, wraps %d\n",
- size, num_wraps);
-
- /* if uCode has wrapped back to top of log, start at the oldest entry,
- * i.e the next one that uCode would fill. */
- if (num_wraps)
- iwl_print_event_log(priv, next_entry,
- capacity - next_entry, mode);
- /* (then/else) start at top of log */
- iwl_print_event_log(priv, 0, next_entry, mode);
+#ifdef CONFIG_IWLWIFI_DEBUG
+ if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS))
+ size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
+ ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
+#else
+ size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
+ ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
+#endif
+ IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n",
+ size);
-}
+#ifdef CONFIG_IWLWIFI_DEBUG
+ if ((iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) {
+ /*
+ * if uCode has wrapped back to top of log,
+ * start at the oldest entry,
+ * i.e the next one that uCode would fill.
+ */
+ if (num_wraps)
+ iwl_print_event_log(priv, next_entry,
+ capacity - next_entry, mode);
+ /* (then/else) start at top of log */
+ iwl_print_event_log(priv, 0, next_entry, mode);
+ } else
+ iwl_print_last_event_logs(priv, capacity, num_wraps,
+ next_entry, size, mode);
+#else
+ iwl_print_last_event_logs(priv, capacity, num_wraps,
+ next_entry, size, mode);
#endif
+}
/**
* iwl_alive_start - called after REPLY_ALIVE notification received