linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <egrumbach@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Arik Nemtsov <arik@wizery.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 22/36] iwlwifi: trans: prevent reprobe on repeated FW errors before restart
Date: Tue, 17 Dec 2013 22:44:25 +0200	[thread overview]
Message-ID: <1387313079-28123-22-git-send-email-egrumbach@gmail.com> (raw)
In-Reply-To: <52B0B72A.5070704@gmail.com>

From: Arik Nemtsov <arik@wizery.com>

In case a sync command timeouts or Tx is stuck while a FW error
interrupt arrives, we might call iwl_op_mode_nic_error twice before
a restart has been initiated. This will cause a reprobe. Unify calls
to this function at the transport level and only call it on the first
FW error in a given by checking the transport FW error flag.

While at it, remove the privately defined iwl_nic_error from PCIE code
and use the common callback instead.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-trans.h     |   11 +++++++++++
 drivers/net/wireless/iwlwifi/pcie/internal.h |    6 ------
 drivers/net/wireless/iwlwifi/pcie/rx.c       |   12 ++++++------
 drivers/net/wireless/iwlwifi/pcie/tx.c       |    6 +++---
 4 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index c71519d..fa495ba 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -70,6 +70,7 @@
 #include "iwl-debug.h"
 #include "iwl-config.h"
 #include "iwl-fw.h"
+#include "iwl-op-mode.h"
 
 /**
  * DOC: Transport layer - what is it ?
@@ -805,6 +806,16 @@ iwl_trans_release_nic_access(struct iwl_trans *trans, unsigned long *flags)
 	__release(nic_access);
 }
 
+static inline void iwl_trans_fw_error(struct iwl_trans *trans)
+{
+	if (WARN_ON_ONCE(!trans->op_mode))
+		return;
+
+	/* prevent double restarts due to the same erroneous FW */
+	if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status))
+		iwl_op_mode_nic_error(trans->op_mode);
+}
+
 /*****************************************************
 * driver (transport) register/unregister functions
 ******************************************************/
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h
index 8a2de33..674c75b 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -456,10 +456,4 @@ static inline bool iwl_is_rfkill_set(struct iwl_trans *trans)
 		CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW);
 }
 
-static inline void iwl_nic_error(struct iwl_trans *trans)
-{
-	set_bit(STATUS_FW_ERROR, &trans->status);
-	iwl_op_mode_nic_error(trans->op_mode);
-}
-
 #endif /* __iwl_trans_int_pcie_h__ */
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index bbbb3ca..7aeec5c 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -797,14 +797,14 @@ static void iwl_pcie_irq_handle_error(struct iwl_trans *trans)
 	iwl_pcie_dump_csr(trans);
 	iwl_dump_fh(trans, NULL);
 
-	/* set the ERROR bit before we wake up the caller */
-	set_bit(STATUS_FW_ERROR, &trans->status);
-	clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status);
-	wake_up(&trans_pcie->wait_command_queue);
-
 	local_bh_disable();
-	iwl_nic_error(trans);
+	/* The STATUS_FW_ERROR bit is set in this function. This must happen
+	 * before we wake up the command caller, to ensure a proper cleanup. */
+	iwl_trans_fw_error(trans);
 	local_bh_enable();
+
+	clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status);
+	wake_up(&trans_pcie->wait_command_queue);
 }
 
 irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id)
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 5b63948..8df2478 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -207,7 +207,7 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data)
 		IWL_ERR(trans, "scratch %d = 0x%08x\n", i,
 			le32_to_cpu(txq->scratchbufs[i].scratch));
 
-	iwl_nic_error(trans);
+	iwl_trans_fw_error(trans);
 }
 
 /*
@@ -1021,7 +1021,7 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx)
 		if (nfreed++ > 0) {
 			IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n",
 				idx, q->write_ptr, q->read_ptr);
-			iwl_nic_error(trans);
+			iwl_trans_fw_error(trans);
 		}
 	}
 
@@ -1555,7 +1555,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
 			       get_cmd_string(trans_pcie, cmd->id));
 		ret = -ETIMEDOUT;
 
-		iwl_nic_error(trans);
+		iwl_trans_fw_error(trans);
 
 		goto cancel;
 	}
-- 
1.7.9.5


  parent reply	other threads:[~2013-12-17 20:45 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 20:42 pull request: iwlwifi-next 2013-12-17 Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 01/36] iwlwifi: mvm: don't send SMPS action frame with single RX antenna Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 02/36] iwlwifi: mvm: Add Smart FIFO support Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 03/36] iwlwifi: mvm: add a generic cipher scheme support Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 04/36] iwlwifi: publish STBC support in HT Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 05/36] iwlwifi: set VHT beamformee STS cap correctly Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 06/36] iwlwifi: publish Tx STBC support in VHT Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 07/36] iwlwifi: mvm: Add uAPSD misbehaving AP notification handling Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 08/36] iwlwifi: mvm: Change power management dependency on multi MAC Emmanuel Grumbach
2014-01-13 11:13   ` Karl Beldan
2014-01-13 11:15     ` Grumbach, Emmanuel
2014-01-13 12:41       ` Karl Beldan
2014-01-16 20:08         ` Emmanuel Grumbach
2014-01-16 21:43           ` Karl Beldan
2014-02-13 12:01             ` Emmanuel Grumbach
2014-03-06 10:21               ` Karl Beldan
2014-03-06 10:22                 ` Grumbach, Emmanuel
2014-03-06 11:59                   ` Karl Beldan
2014-03-06 10:25                 ` Grumbach, Emmanuel
2014-03-06 10:49                   ` Karl Beldan
2014-03-06 10:58                     ` Grumbach, Emmanuel
2014-03-06 11:02                     ` Grumbach, Emmanuel
2014-03-06 11:54                       ` Karl Beldan
2013-12-17 20:44 ` [PATCH 09/36] iwlwifi: mvm: Disable power save for monitor interface Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 10/36] iwlwifi: mvm: Enable power save on a single P2P client interface Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 11/36] iwlwifi: mvm: add per-vif power debugfs hooks Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 12/36] iwlwifi: mvm: move iwl_mvm_set_tx_power to PHY area Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 13/36] iwlwifi: mvm: add multicast filtering support Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 14/36] iwlwifi: mvm: configure phy_ctxt with min_def Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 15/36] iwlwifi: mvm: clarify smps_requests documentation Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 16/36] iwlwifi: trans: divide stop_hw into stop_device/op_mode_leave Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 17/36] iwlwifi: trans: use a unified transport status Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 18/36] iwlwifi: trans: prevent tx and cmds during FW error Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 19/36] iwlwifi: mvm: rs: move rs_program_fix_rate to cleanup ifdefs Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 20/36] iwlwifi: remove pointer to transport from op_mode Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 21/36] iwlwifi: mvm: check iwl_nvm_init return value Emmanuel Grumbach
2013-12-17 20:44 ` Emmanuel Grumbach [this message]
2013-12-17 20:44 ` [PATCH 23/36] iwlwifi: trans: clear FW_ERROR status in common code Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 24/36] iwlwifi: trans: turn set_pmi into an optional callback Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 25/36] iwlwifi: mvm: Add and examine TLV flag for P2P client uAPSD support Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 26/36] iwlwifi: mvm: rs: refactor building the LQ command Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 27/36] iwlwifi: mvm: rs: avoid recalc of supported legacy rate mask Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 28/36] iwlwifi: mvm: rs: improve rates table algo Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 29/36] iwlwifi: mvm: rs: remove unnecessary debug logs Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 30/36] iwlwifi: mvm: rs: refactor rate scale action decision Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 31/36] iwlwifi: mvm: fixup Makefile Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 32/36] iwlwifi: mvm: Do not allow AP MAC context update if not active Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 33/36] iwlwifi: mvm: rs: disable MCS9 Tx workaround Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 34/36] iwlwifi: mvm: set highest rate in VHT MCS Set Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 35/36] iwlwifi: mvm: rs: fix RTS protection being set indefinitely Emmanuel Grumbach
2013-12-17 20:44 ` [PATCH 36/36] iwlwifi: mvm: rs: fix variable shadowing Emmanuel Grumbach
2013-12-18 20:12 ` pull request: iwlwifi-next 2013-12-17 John W. Linville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1387313079-28123-22-git-send-email-egrumbach@gmail.com \
    --to=egrumbach@gmail.com \
    --cc=arik@wizery.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).