summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-core.c
diff options
context:
space:
mode:
authorWey-Yi Guy2011-02-09 18:37:46 +0100
committerWey-Yi Guy2011-02-21 19:08:15 +0100
commit491bc292766330473eac4569be5d57f9aeb80112 (patch)
tree4642fd4973e736e1e69b486e91ebf17350157771 /drivers/net/wireless/iwlwifi/iwl-core.c
parentMerge ssh://master.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 (diff)
downloadkernel-qcow2-linux-491bc292766330473eac4569be5d57f9aeb80112.tar.gz
kernel-qcow2-linux-491bc292766330473eac4569be5d57f9aeb80112.tar.xz
kernel-qcow2-linux-491bc292766330473eac4569be5d57f9aeb80112.zip
iwlwifi: Limit number of firmware reload
If device has serious problem and cause firmware can not recover itself. Keep reloading firmware will not help, it can only fill up the syslog and lock up the system because busy reloading. Introduce the limit reload counter, if the reload reach the maximum within the pre-defined duration;stop the reload operation. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-core.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 4ad89389a0a9..977ddfb8c24c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -948,6 +948,9 @@ EXPORT_SYMBOL(iwl_print_rx_config_cmd);
*/
void iwl_irq_handle_error(struct iwl_priv *priv)
{
+ unsigned int reload_msec;
+ unsigned long reload_jiffies;
+
/* Set the FW error flag -- cleared on iwl_down */
set_bit(STATUS_FW_ERROR, &priv->status);
@@ -991,6 +994,25 @@ void iwl_irq_handle_error(struct iwl_priv *priv)
* commands by clearing the INIT status bit */
clear_bit(STATUS_READY, &priv->status);
+ /*
+ * If firmware keep reloading, then it indicate something
+ * serious wrong and firmware having problem to recover
+ * from it. Instead of keep trying which will fill the syslog
+ * and hang the system, let's just stop it
+ */
+ reload_jiffies = jiffies;
+ reload_msec = jiffies_to_msecs((long) reload_jiffies -
+ (long) priv->reload_jiffies);
+ priv->reload_jiffies = reload_jiffies;
+ if (reload_msec <= IWL_MIN_RELOAD_DURATION) {
+ priv->reload_count++;
+ if (priv->reload_count >= IWL_MAX_CONTINUE_RELOAD_CNT) {
+ IWL_ERR(priv, "BUG_ON, Stop restarting\n");
+ return;
+ }
+ } else
+ priv->reload_count = 0;
+
if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
IWL_DEBUG(priv, IWL_DL_FW_ERRORS,
"Restarting adapter due to uCode error.\n");