linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
To: linux-wireless@vger.kernel.org
Cc: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 37/43] iwlwifi: mvm: update ucode status before stopping device
Date: Wed,  2 Mar 2016 09:56:38 +0200	[thread overview]
Message-ID: <1456905404-14435-37-git-send-email-emmanuel.grumbach@intel.com> (raw)
In-Reply-To: <0BA3FCBA62E2DC44AF3030971E174FB32EA50146@hasmsx107.ger.corp.intel.com>

From: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>

Leaving ucode_loaded to true after stop_device() has been called
is a recipe for problems. Flows that are not sync'ed with the
driver life cycle (like debugfs hooks and thermal hooks) must
check that the firmware is loaded before they interact with it.
Therefore we need to keep this variable updated with the real
status of the firmware.

Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/d3.c       | 3 +--
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c       | 4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 6 ++----
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h      | 6 ++++++
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c      | 2 +-
 5 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
index cf5e634..c1a3131 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
@@ -816,8 +816,7 @@ static int iwl_mvm_switch_to_d3(struct iwl_mvm *mvm)
 {
 	iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true);
 
-	iwl_trans_stop_device(mvm->trans);
-
+	iwl_mvm_stop_device(mvm);
 	/*
 	 * Set the HW restart bit -- this is mostly true as we're
 	 * going to load new firmware and reprogram that, though
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
index f075c36..efec6ec 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
@@ -1009,7 +1009,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
 	IWL_DEBUG_INFO(mvm, "RT uCode started.\n");
 	return 0;
  error:
-	iwl_trans_stop_device(mvm->trans);
+	iwl_mvm_stop_device(mvm);
 	return ret;
 }
 
@@ -1053,7 +1053,7 @@ int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm)
 
 	return 0;
  error:
-	iwl_trans_stop_device(mvm->trans);
+	iwl_mvm_stop_device(mvm);
 	return ret;
 }
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 927b055..ec6b072 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -972,7 +972,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
 	 */
 	iwl_mvm_unref_all_except(mvm, IWL_MVM_REF_UCODE_DOWN);
 
-	iwl_trans_stop_device(mvm->trans);
+	iwl_mvm_stop_device(mvm);
 
 	mvm->scan_status = 0;
 	mvm->ps_disabled = false;
@@ -1141,7 +1141,7 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm)
 	 */
 	flush_work(&mvm->roc_done_wk);
 
-	iwl_trans_stop_device(mvm->trans);
+	iwl_mvm_stop_device(mvm);
 
 	iwl_mvm_async_handlers_purge(mvm);
 	/* async_handlers_list is empty and will stay empty: HW is stopped */
@@ -1172,8 +1172,6 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm)
 				mvm->scan_uid_status[i] = 0;
 		}
 	}
-
-	mvm->ucode_loaded = false;
 }
 
 static void iwl_mvm_mac_stop(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index b461b90..6d4e487 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1549,6 +1549,12 @@ void iwl_mvm_enable_ac_txq(struct iwl_mvm *mvm, int queue, int mac80211_queue,
 	iwl_mvm_enable_txq(mvm, queue, mac80211_queue, ssn, &cfg, wdg_timeout);
 }
 
+static inline void iwl_mvm_stop_device(struct iwl_mvm *mvm)
+{
+	mvm->ucode_loaded = false;
+	iwl_trans_stop_device(mvm->trans);
+}
+
 /* Thermal management and CT-kill */
 void iwl_mvm_tt_tx_backoff(struct iwl_mvm *mvm, u32 backoff);
 void iwl_mvm_tt_temp_changed(struct iwl_mvm *mvm, u32 temp);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 8bdaa7b..4716176 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -643,7 +643,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 		iwl_mvm_ref(mvm, IWL_MVM_REF_INIT_UCODE);
 		err = iwl_run_init_mvm_ucode(mvm, true);
 		if (!err || !iwlmvm_mod_params.init_dbg)
-			iwl_trans_stop_device(trans);
+			iwl_mvm_stop_device(mvm);
 		iwl_mvm_unref(mvm, IWL_MVM_REF_INIT_UCODE);
 		mutex_unlock(&mvm->mutex);
 		/* returns 0 if successful, 1 if success but in rfkill */
-- 
2.5.0


  parent reply	other threads:[~2016-03-02  7:57 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02  7:51 pull request: iwlwifi-next 2016-03-02 Grumbach, Emmanuel
2016-03-02  7:56 ` [PATCH 01/43] iwlwifi: mvm: add CT-KILL notification Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 02/43] iwlwifi: mvm: add registration to thermal zone Emmanuel Grumbach
2016-03-04 18:39   ` Bjørn Mork
2016-03-04 18:53     ` Bjørn Mork
2016-03-04 19:57       ` Coelho, Luciano
2016-03-04 20:22         ` Bjørn Mork
2016-03-04 20:30           ` Coelho, Luciano
2016-03-04 19:52     ` Coelho, Luciano
2016-03-02  7:56 ` [PATCH 03/43] iwlwifi: mvm: add registration to cooling device Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 04/43] iwlwifi: mvm: set the correct descriptor size for tracing Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 05/43] iwlwifi: mvm: fix RSS key sizing Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 06/43] iwlwifi: mvm: handle pass all scan reporting Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 07/43] iwlwifi: mvm: rs: fix a theoretical access to uninitialized array elements Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 08/43] iwlwifi: mvm: bump firmware API to 21 Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 09/43] iwlwifi: pcie: aggregate Flow Handler configuration writes Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 10/43] iwlwifi: pcie: Add new configuration to enable MSIX Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 11/43] iwlwifi: pcie: fix identation in trans.c Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 12/43] iwlwifi: mvm: enable VHT MU-MIMO for supported hardware Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 13/43] iwlwifi: mvm: update firmware of VHT MU-MIMO groups status on restart Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 14/43] iwlwifi: mvm: send large SKBs to the transport Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 15/43] iwlwifi: mvm: add Tx A-MSDU inside A-MPDU Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 16/43] iwlwifi: mvm: allow to limit the A-MSDU from debugfs Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 17/43] iwlwifi: mvm: don't enable A-MSDU when the rates are too low Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 18/43] iwlwifi: mvm: don't send an A-MSDU that is larger than the TXF Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 19/43] iwlwifi: support tracing wide commands Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 20/43] iwlwifi: mvm: update rx_status with mactime flag Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 21/43] iwlwifi: mvm: support filtered frames notification Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 22/43] iwlwifi: pcie: configure more RFH settings Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 23/43] iwlwifi: pcie: add pm_prepare and pm_complete ops Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 24/43] iwlwifi: pcie: prevent skbs shadowing in iwl_trans_pcie_reclaim Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 25/43] iwlwifi: mvm: add duplicate packet detection per rx queue Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 26/43] iwlwifi: mvm: add RSS queues notification infrastructure Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 27/43] iwlwifi: mvm: remove unused field in iwl_mvm_tid_data Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 28/43] iwlwifi: mvm: support VHT MU-MIMO notification Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 29/43] iwlwifi: mvm: various trivial cleanups Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 30/43] iwlwifi: mvm: Set global RRM capability Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 31/43] iwlwifi: mvm: forbid U-APSD for P2P Client if the firmware doesn't support it Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 32/43] iwlwifi: mvm: Send power command on BSS_CHANGED_BEACON_INFO if needed Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 33/43] iwlwifi: mvm: take care of padded packets Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 34/43] iwlwifi: mvm: kill iwl_mvm_enable_agg_txq Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 35/43] iwlwifi: mvm: Disable beacon storing in D3 when WOWLAN configured Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 36/43] iwlwifi: support ucode with d0 unified image - regular and usniffer Emmanuel Grumbach
2016-03-02  7:56 ` Emmanuel Grumbach [this message]
2016-03-02  7:56 ` [PATCH 38/43] iwlwifi: pcie: detect and workaround invalid write ptr behavior Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 39/43] iwlwifi: mvm: disable DQA support Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 40/43] iwlwifi: mvm: only release the trans ref if d0i3 is supported in fw Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 41/43] iwlwifi: add disable_11ac module param Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 42/43] iwlwifi: mvm: take the transport ref back when leaving Emmanuel Grumbach
2016-03-02  7:56 ` [PATCH 43/43] iwlwifi: mvm: support sw queue start/stop from mvm Emmanuel Grumbach
2016-03-07 13:50 ` pull request: iwlwifi-next 2016-03-02 Kalle Valo

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=1456905404-14435-37-git-send-email-emmanuel.grumbach@intel.com \
    --to=emmanuel.grumbach@intel.com \
    --cc=chaya.rachel.ivgi@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).