aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-11-20 15:05:07 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-23 17:05:37 -0500
commitc341ddb283b9e1a6d217e73fa36738629ca8f4fb (patch)
tree38c9d421c4751a5ca7964a7c7e35043033b7a98e /drivers/net/wireless/iwlwifi/iwl-agn.c
parent644c77f0cfa333e58fd4a09450434e89a52d8931 (diff)
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)
1696 1696
1697} 1697}
1698 1698
1699#ifdef CONFIG_IWLWIFI_DEBUG
1700
1701#define EVENT_START_OFFSET (4 * sizeof(u32)) 1699#define EVENT_START_OFFSET (4 * sizeof(u32))
1702 1700
1703/** 1701/**
@@ -1758,10 +1756,42 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
1758 spin_unlock_irqrestore(&priv->reg_lock, reg_flags); 1756 spin_unlock_irqrestore(&priv->reg_lock, reg_flags);
1759} 1757}
1760 1758
1759/**
1760 * iwl_print_last_event_logs - Dump the newest # of event log to syslog
1761 */
1762static void iwl_print_last_event_logs(struct iwl_priv *priv, u32 capacity,
1763 u32 num_wraps, u32 next_entry,
1764 u32 size, u32 mode)
1765{
1766 /*
1767 * display the newest DEFAULT_LOG_ENTRIES entries
1768 * i.e the entries just before the next ont that uCode would fill.
1769 */
1770 if (num_wraps) {
1771 if (next_entry < size) {
1772 iwl_print_event_log(priv,
1773 capacity - (size - next_entry),
1774 size - next_entry, mode);
1775 iwl_print_event_log(priv, 0,
1776 next_entry, mode);
1777 } else
1778 iwl_print_event_log(priv, next_entry - size,
1779 size, mode);
1780 } else {
1781 if (next_entry < size)
1782 iwl_print_event_log(priv, 0, next_entry, mode);
1783 else
1784 iwl_print_event_log(priv, next_entry - size,
1785 size, mode);
1786 }
1787}
1788
1761/* For sanity check only. Actual size is determined by uCode, typ. 512 */ 1789/* For sanity check only. Actual size is determined by uCode, typ. 512 */
1762#define MAX_EVENT_LOG_SIZE (512) 1790#define MAX_EVENT_LOG_SIZE (512)
1763 1791
1764void iwl_dump_nic_event_log(struct iwl_priv *priv) 1792#define DEFAULT_DUMP_EVENT_LOG_ENTRIES (20)
1793
1794void iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log)
1765{ 1795{
1766 u32 base; /* SRAM byte address of event log header */ 1796 u32 base; /* SRAM byte address of event log header */
1767 u32 capacity; /* event log capacity in # entries */ 1797 u32 capacity; /* event log capacity in # entries */
@@ -1806,19 +1836,37 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv)
1806 return; 1836 return;
1807 } 1837 }
1808 1838
1809 IWL_ERR(priv, "Start IWL Event Log Dump: display count %d, wraps %d\n", 1839#ifdef CONFIG_IWLWIFI_DEBUG
1810 size, num_wraps); 1840 if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS))
1811 1841 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
1812 /* if uCode has wrapped back to top of log, start at the oldest entry, 1842 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
1813 * i.e the next one that uCode would fill. */ 1843#else
1814 if (num_wraps) 1844 size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
1815 iwl_print_event_log(priv, next_entry, 1845 ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
1816 capacity - next_entry, mode); 1846#endif
1817 /* (then/else) start at top of log */ 1847 IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n",
1818 iwl_print_event_log(priv, 0, next_entry, mode); 1848 size);
1819 1849
1820} 1850#ifdef CONFIG_IWLWIFI_DEBUG
1851 if ((iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) || full_log) {
1852 /*
1853 * if uCode has wrapped back to top of log,
1854 * start at the oldest entry,
1855 * i.e the next one that uCode would fill.
1856 */
1857 if (num_wraps)
1858 iwl_print_event_log(priv, next_entry,
1859 capacity - next_entry, mode);
1860 /* (then/else) start at top of log */
1861 iwl_print_event_log(priv, 0, next_entry, mode);
1862 } else
1863 iwl_print_last_event_logs(priv, capacity, num_wraps,
1864 next_entry, size, mode);
1865#else
1866 iwl_print_last_event_logs(priv, capacity, num_wraps,
1867 next_entry, size, mode);
1821#endif 1868#endif
1869}
1822 1870
1823/** 1871/**
1824 * iwl_alive_start - called after REPLY_ALIVE notification received 1872 * iwl_alive_start - called after REPLY_ALIVE notification received