All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: linux-wireless@vger.kernel.org
Cc: Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 06/56] iwlwifi: mvm: change scan timeout to a delayed work
Date: Wed,  6 Jul 2016 13:40:01 +0300	[thread overview]
Message-ID: <1467801651-1816-6-git-send-email-luca@coelho.fi> (raw)
In-Reply-To: <1467801452.25088.20.camel@coelho.fi>

From: Luca Coelho <luciano.coelho@intel.com>

Some transports may sleep when writing to registers, which is done
when calling iwl_force_nmi().  So we can't call iwl_force_nmi() in a
timer context.  To solve that, convert the scan timeout timer to a
delayed work.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |  1 +
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h      |  4 ++--
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c      |  6 +-----
 drivers/net/wireless/intel/iwlwifi/mvm/scan.c     | 18 ++++++++++--------
 4 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index e5cb7db..af1d266 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -1200,6 +1200,7 @@ static void iwl_mvm_mac_stop(struct ieee80211_hw *hw)
 	flush_work(&mvm->add_stream_wk);
 	cancel_delayed_work_sync(&mvm->fw_dump_wk);
 	cancel_delayed_work_sync(&mvm->cs_tx_unblock_dwork);
+	cancel_delayed_work_sync(&mvm->scan_timeout_dwork);
 	iwl_mvm_free_fw_dump_desc(mvm);
 
 	mutex_lock(&mvm->mutex);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index bf7d78e..3775e26 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -802,7 +802,7 @@ struct iwl_mvm {
 	struct iwl_mcast_filter_cmd *mcast_filter_cmd;
 	enum iwl_mvm_scan_type scan_type;
 	enum iwl_mvm_sched_scan_pass_all_states sched_scan_pass_all;
-	struct timer_list scan_timer;
+	struct delayed_work scan_timeout_dwork;
 
 	/* max number of simultaneous scans the FW supports */
 	unsigned int max_scans;
@@ -1415,7 +1415,7 @@ int iwl_mvm_scan_size(struct iwl_mvm *mvm);
 int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify);
 int iwl_mvm_max_scan_ie_len(struct iwl_mvm *mvm);
 void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm);
-void iwl_mvm_scan_timeout(unsigned long data);
+void iwl_mvm_scan_timeout_wk(struct work_struct *work);
 
 /* Scheduled scan */
 void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm,
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
index 632b1dc..063ebbe 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c
@@ -608,6 +608,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 	INIT_WORK(&mvm->d0i3_exit_work, iwl_mvm_d0i3_exit_work);
 	INIT_DELAYED_WORK(&mvm->fw_dump_wk, iwl_mvm_fw_error_dump_wk);
 	INIT_DELAYED_WORK(&mvm->tdls_cs.dwork, iwl_mvm_tdls_ch_switch_work);
+	INIT_DELAYED_WORK(&mvm->scan_timeout_dwork, iwl_mvm_scan_timeout_wk);
 	INIT_WORK(&mvm->add_stream_wk, iwl_mvm_add_new_dqa_stream_wk);
 
 	spin_lock_init(&mvm->d0i3_tx_lock);
@@ -766,9 +767,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
 
 	iwl_mvm_tof_init(mvm);
 
-	setup_timer(&mvm->scan_timer, iwl_mvm_scan_timeout,
-		    (unsigned long)mvm);
-
 	return op_mode;
 
  out_unregister:
@@ -822,8 +820,6 @@ static void iwl_op_mode_mvm_stop(struct iwl_op_mode *op_mode)
 
 	iwl_mvm_tof_clean(mvm);
 
-	del_timer_sync(&mvm->scan_timer);
-
 	mutex_destroy(&mvm->mutex);
 	mutex_destroy(&mvm->d0i3_suspend_mutex);
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index 6f609dd..fb25d9e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
@@ -399,7 +399,7 @@ void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm,
 		ieee80211_scan_completed(mvm->hw,
 				scan_notif->status == IWL_SCAN_OFFLOAD_ABORTED);
 		iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
-		del_timer(&mvm->scan_timer);
+		cancel_delayed_work(&mvm->scan_timeout_dwork);
 	} else {
 		IWL_ERR(mvm,
 			"got scan complete notification but no scan is running\n");
@@ -1222,15 +1222,16 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type)
 	return -EIO;
 }
 
-#define SCAN_TIMEOUT (16 * HZ)
+#define SCAN_TIMEOUT 20000
 
-void iwl_mvm_scan_timeout(unsigned long data)
+void iwl_mvm_scan_timeout_wk(struct work_struct *work)
 {
-	struct iwl_mvm *mvm = (struct iwl_mvm *)data;
+	struct delayed_work *delayed_work = to_delayed_work(work);
+	struct iwl_mvm *mvm = container_of(delayed_work, struct iwl_mvm,
+					   scan_timeout_dwork);
 
 	IWL_ERR(mvm, "regular scan timed out\n");
 
-	del_timer(&mvm->scan_timer);
 	iwl_force_nmi(mvm->trans);
 }
 
@@ -1313,7 +1314,8 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 	mvm->scan_status |= IWL_MVM_SCAN_REGULAR;
 	iwl_mvm_ref(mvm, IWL_MVM_REF_SCAN);
 
-	mod_timer(&mvm->scan_timer, jiffies + SCAN_TIMEOUT);
+	queue_delayed_work(system_wq, &mvm->scan_timeout_dwork,
+			   msecs_to_jiffies(SCAN_TIMEOUT));
 
 	return 0;
 }
@@ -1432,7 +1434,7 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm,
 	if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_REGULAR) {
 		ieee80211_scan_completed(mvm->hw, aborted);
 		iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
-		del_timer(&mvm->scan_timer);
+		cancel_delayed_work(&mvm->scan_timeout_dwork);
 	} else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) {
 		ieee80211_sched_scan_stopped(mvm->hw);
 		mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
@@ -1628,7 +1630,7 @@ out:
 		 * to release the scan reference here.
 		 */
 		iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
-		del_timer(&mvm->scan_timer);
+		cancel_delayed_work(&mvm->scan_timeout_dwork);
 		if (notify)
 			ieee80211_scan_completed(mvm->hw, true);
 	} else if (notify) {
-- 
2.8.1


  parent reply	other threads:[~2016-07-06 10:41 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 10:37 pull-request: iwlwifi-next 2016-07-06 Luca Coelho
2016-07-06 10:39 ` [PATCH 01/56] iwlwifi: remove useless enum values Luca Coelho
2016-07-06 10:39 ` [PATCH 02/56] iwlwifi: change fw.mvm_fw to fw.type Luca Coelho
2016-07-06 10:39 ` [PATCH 03/56] iwlwifi: mvm: support dqa queue inactivation upon timeout Luca Coelho
2016-07-06 10:39 ` [PATCH 04/56] iwlwifi: pcie: unify restock calls on init Luca Coelho
2016-07-06 10:40 ` [PATCH 05/56] iwlwifi: mvm: fix possible division by zero Luca Coelho
2016-07-06 10:40 ` Luca Coelho [this message]
2016-07-06 10:40 ` [PATCH 07/56] iwlwifi: mvm: remove an unused variable Luca Coelho
2016-07-06 10:40 ` [PATCH 08/56] iwlwifi: mvm: silence uninitialized variable warning Luca Coelho
2016-07-06 10:40 ` [PATCH 09/56] iwlwifi: mvm: support dqa queue sharing Luca Coelho
2016-07-06 10:40 ` [PATCH 10/56] iwlwifi: mvm: set sta_id in SCD_QUEUE_CONFIG cmd Luca Coelho
2016-07-06 10:40 ` [PATCH 11/56] iwlwifi: mvm: update aux queue in dqa mode Luca Coelho
2016-07-06 10:40 ` [PATCH 12/56] iwlwifi: mvm: support dqa-enable hcmd Luca Coelho
2016-07-06 10:40 ` [PATCH 13/56] iwlwifi: add new 8260 PCI IDs Luca Coelho
2016-07-06 10:40 ` [PATCH 14/56] iwlwifi: add new 8265 Luca Coelho
2016-07-06 10:40 ` [PATCH 15/56] iwlwifi: mvm: remove unnecessary device conversion when reading the MCC Luca Coelho
2016-07-06 10:40 ` [PATCH 16/56] iwlwifi: pcie: poll RFH for RX DMA stop Luca Coelho
2016-07-06 10:40 ` [PATCH 17/56] iwlwifi: mvm: Do not open aggregations for null data packets Luca Coelho
2016-07-06 10:40 ` [PATCH 18/56] iwlwifi: mvm: fix RX mpdu status enum Luca Coelho
2016-07-06 10:40 ` [PATCH 19/56] iwlwifi: mvm: rs: add rate scaling support for 160MHz channels Luca Coelho
2016-07-06 10:40 ` [PATCH 20/56] iwlwifi: mvm: avoid harmless -Wmaybe-uninialized warning Luca Coelho
2016-07-06 10:40 ` [PATCH 21/56] iwlwifi: mvm: fix txq aggregation bug Luca Coelho
2016-07-06 10:40 ` [PATCH 22/56] iwlwifi: dvm: Remove unused array 'iwlagn_loose_lookup' Luca Coelho
2016-07-06 10:40 ` [PATCH 23/56] iwlwifi: add dump of RFH Luca Coelho
2016-07-06 10:40 ` [PATCH 24/56] iwlwifi: Reserve iwl_fw_error_dump_type enum Luca Coelho
2016-07-06 10:40 ` [PATCH 25/56] iwlwifi: mvm: add support for GCMP encryption Luca Coelho
2016-07-06 10:40 ` [PATCH 26/56] iwlwifi: mvm: support new statistics notification Luca Coelho
2016-07-06 10:40 ` [PATCH 27/56] iwlwifi: Add a000 HW family support Luca Coelho
2016-07-06 10:40 ` [PATCH 28/56] iwlwifi: pcie: enable interrupts before releasing the NIC's CPU Luca Coelho
2016-07-06 10:40 ` [PATCH 29/56] iwlmvm: mvm: set correct state in smart-fifo configuration Luca Coelho
2016-07-06 10:40 ` [PATCH 30/56] iwlwifi: mvm: checksum IPv6 fragmented packet Luca Coelho
2016-07-06 10:40 ` [PATCH 31/56] iwlwifi: mvm: cleanup the coex code Luca Coelho
2016-07-06 10:40 ` [PATCH 32/56] iwlwifi: mvm: read SAR BIOS table from ACPI Luca Coelho
2016-07-06 10:40 ` [PATCH 33/56] iwlwifi: pcie: Enable MSI mode when using MSI interrupts Luca Coelho
2016-07-06 10:40 ` [PATCH 34/56] iwlwifi: pcie: fix access to scratch buffer Luca Coelho
2016-07-06 10:40 ` [PATCH 35/56] iwlwifi: mvm: write the correct internal TXF index Luca Coelho
2016-07-06 10:40 ` [PATCH 36/56] iwlwifi: mvm: fix coex related comments Luca Coelho
2016-07-06 10:40 ` [PATCH 37/56] iwlwifi: mvm: fix the channel inhibition table for Channel 14 Luca Coelho
2016-07-06 10:40 ` [PATCH 38/56] iwlwifi: remove iwl_ht_params.smps_mode Luca Coelho
2016-07-06 10:40 ` [PATCH 39/56] iwlwifi: mvm: unmap the paging memory before freeing it Luca Coelho
2016-07-06 10:40 ` [PATCH 40/56] iwlwifi: pcie: don't use vid 0 Luca Coelho
2016-07-06 10:40 ` [PATCH 41/56] iwlwifi: mvm: support tdls in dqa mode Luca Coelho
2016-07-06 10:40 ` [PATCH 42/56] iwlwifi: mvm: support dqa-mode scd queue redirection Luca Coelho
2016-07-06 10:40 ` [PATCH 43/56] iwlwifi: mvm: add RX aggregation prints Luca Coelho
2016-07-06 10:40 ` [PATCH 44/56] iwlwifi: mvm: free RX reorder buffer on restart Luca Coelho
2016-07-06 10:40 ` [PATCH 45/56] iwlwifi: store cipher scheme independent of mac80211 Luca Coelho
2016-07-06 10:40 ` [PATCH 46/56] iwlwifi: tracing: decouple from mac80211 Luca Coelho
2016-07-06 10:40 ` [PATCH 47/56] iwlwifi: decouple PCIe transport " Luca Coelho
2016-07-06 10:40 ` [PATCH 48/56] iwlwifi: pcie: fix a race in firmware loading flow Luca Coelho
2016-07-06 10:40 ` [PATCH 49/56] iwlwifi: pcie: track rxb status Luca Coelho
2016-07-06 10:40 ` [PATCH 50/56] iwlwifi: pcie: generalize and increase the size of scratchbuf Luca Coelho
2016-07-06 10:40 ` [PATCH 51/56] iwlwifi: centralize 64 bit HW registers write Luca Coelho
2016-07-06 10:40 ` [PATCH 52/56] iwlwifi: pcie: initialize a000 device's TFD table Luca Coelho
2016-07-06 10:40 ` [PATCH 53/56] iwlwifi: pcie: load FW chunk for a000 devices Luca Coelho
2016-07-06 10:40 ` [PATCH 54/56] iwlwifi: mvm: support v4 of the TX power command Luca Coelho
2016-07-06 10:40 ` [PATCH 55/56] iwlwifi: pcie: centralize SCD status logging Luca Coelho
2016-07-06 10:40 ` [PATCH 56/56] iwlwifi: move iwl_drv to be shared across transports Luca Coelho
2016-07-08  9:21 ` pull-request: iwlwifi-next 2016-07-06 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=1467801651-1816-6-git-send-email-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.