linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull request: iwlwifi 2015-07-30
@ 2015-07-30 18:52 Grumbach, Emmanuel
  2015-07-31  4:43 ` [PATCH 1/3] iwlwifi: pcie: fix prepare card flow Emmanuel Grumbach
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Grumbach, Emmanuel @ 2015-07-30 18:52 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless@vger.kernel.org

Hi Kalle,

Here is another pull request for 4.2. Three small fixes this time.
Let me know if you have any issues.

Note that my availability will be limited next week, and the week after
I'll be completely offline.
Thanks!

The following changes since commit be88a1ada9b97bb016196b7f4a1fc2fe2f798529:

  iwlwifi: nvm: remove mac address byte swapping in 8000 family
(2015-07-12 19:54:19 +0300)

are available in the git repository at:

 
https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes.git tags/iwlwifi-for-kalle-2015-07-30

for you to fetch changes up to aecdc63d87891c75e60906973c7b7c9cd58403d6:

  iwlwifi: pcie: fix stuck queue detection for sleeping clients
(2015-07-30 21:38:14 +0300)

----------------------------------------------------------------
* a fix for the stuck TFD queue mechanism - it was producing
  noisy false alarms.
* a fix for the NIC prepare flow that prevented the driver
  from being able to access the device on certain systems.
* a fix for the scan prority handling which allows the
  regular scan to run even if a scheduled scan is already
  running.

----------------------------------------------------------------
Avraham Stern (1):
      iwlwifi: mvm: Fix regular scan priority

Emmanuel Grumbach (2):
      iwlwifi: pcie: fix prepare card flow
      iwlwifi: pcie: fix stuck queue detection for sleeping clients

 drivers/net/wireless/iwlwifi/mvm/scan.c   |  2 +-
 drivers/net/wireless/iwlwifi/pcie/trans.c | 22 +++++++++++++++++++---
 drivers/net/wireless/iwlwifi/pcie/tx.c    | 15 +++++++++++++--
 3 files changed, 33 insertions(+), 6 deletions(-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] iwlwifi: pcie: fix prepare card flow
  2015-07-30 18:52 pull request: iwlwifi 2015-07-30 Grumbach, Emmanuel
@ 2015-07-31  4:43 ` Emmanuel Grumbach
  2015-07-31  4:43 ` [PATCH 2/3] iwlwifi: mvm: Fix regular scan priority Emmanuel Grumbach
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Emmanuel Grumbach @ 2015-07-31  4:43 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach, stable

When the card is not owned by the PCIe bus, we need to
acquire ownership first. This flow is implemented in
iwl_pcie_prepare_card_hw. Because of a hardware bug, we
need to disable link power management before we can
request ownership otherwise the other user of the device
won't get notified that we are requesting the device which
will prevent us from acquire ownership.

Same holds for the down flow where we need to make sure
that any other potential user is notified that the driver
is going down.

CC: <stable@vger.kernel.org> [4.1]
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/iwlwifi/pcie/trans.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 6203c4a..9e144e7 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -478,10 +478,16 @@ static void iwl_pcie_apm_stop(struct iwl_trans *trans, bool op_mode_leave)
 		if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000)
 			iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG,
 					  APMG_PCIDEV_STT_VAL_WAKE_ME);
-		else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)
+		else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
+			iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
+				    CSR_RESET_LINK_PWR_MGMT_DISABLED);
 			iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
 				    CSR_HW_IF_CONFIG_REG_PREPARE |
 				    CSR_HW_IF_CONFIG_REG_ENABLE_PME);
+			mdelay(1);
+			iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
+				      CSR_RESET_LINK_PWR_MGMT_DISABLED);
+		}
 		mdelay(5);
 	}
 
@@ -575,6 +581,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
 	if (ret >= 0)
 		return 0;
 
+	iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
+		    CSR_RESET_LINK_PWR_MGMT_DISABLED);
+	msleep(1);
+
 	for (iter = 0; iter < 10; iter++) {
 		/* If HW is not ready, prepare the conditions to check again */
 		iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
@@ -582,8 +592,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
 
 		do {
 			ret = iwl_pcie_set_hw_ready(trans);
-			if (ret >= 0)
-				return 0;
+			if (ret >= 0) {
+				ret = 0;
+				goto out;
+			}
 
 			usleep_range(200, 1000);
 			t += 200;
@@ -593,6 +605,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)
 
 	IWL_ERR(trans, "Couldn't prepare the card\n");
 
+out:
+	iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG,
+		      CSR_RESET_LINK_PWR_MGMT_DISABLED);
+
 	return ret;
 }
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] iwlwifi: mvm: Fix regular scan priority
  2015-07-30 18:52 pull request: iwlwifi 2015-07-30 Grumbach, Emmanuel
  2015-07-31  4:43 ` [PATCH 1/3] iwlwifi: pcie: fix prepare card flow Emmanuel Grumbach
@ 2015-07-31  4:43 ` Emmanuel Grumbach
  2015-07-31  4:43 ` [PATCH 3/3] iwlwifi: pcie: fix stuck queue detection for sleeping clients Emmanuel Grumbach
  2015-07-31  6:21 ` pull request: iwlwifi 2015-07-30 Kalle Valo
  3 siblings, 0 replies; 5+ messages in thread
From: Emmanuel Grumbach @ 2015-07-31  4:43 UTC (permalink / raw)
  To: linux-wireless; +Cc: Avraham Stern, Emmanuel Grumbach

From: Avraham Stern <avraham.stern@intel.com>

The code checks the total number of iterations to differentiate
between regular scan and scheduled scan. However, regular scan has
a total of one iteration, not zero. As a result, regular scan will
have lower priority than it should have, and in case scheduled
scan is already running when regular scan is requested, regular scan
will be delayed until scheduled scan is aborted.
Fix that by checking for total iterations number of one as an
identifier for regular scan.

Fixes: 133c8259f885 ("iwlwifi: mvm: rename generic_scan_cmd functions to dwell")
Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/iwlwifi/mvm/scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index 5000bfcd..5514ad6 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -1023,7 +1023,7 @@ static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm,
 	cmd->scan_priority =
 		iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);
 
-	if (iwl_mvm_scan_total_iterations(params) == 0)
+	if (iwl_mvm_scan_total_iterations(params) == 1)
 		cmd->ooc_priority =
 			iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6);
 	else
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] iwlwifi: pcie: fix stuck queue detection for sleeping clients
  2015-07-30 18:52 pull request: iwlwifi 2015-07-30 Grumbach, Emmanuel
  2015-07-31  4:43 ` [PATCH 1/3] iwlwifi: pcie: fix prepare card flow Emmanuel Grumbach
  2015-07-31  4:43 ` [PATCH 2/3] iwlwifi: mvm: Fix regular scan priority Emmanuel Grumbach
@ 2015-07-31  4:43 ` Emmanuel Grumbach
  2015-07-31  6:21 ` pull request: iwlwifi 2015-07-30 Kalle Valo
  3 siblings, 0 replies; 5+ messages in thread
From: Emmanuel Grumbach @ 2015-07-31  4:43 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach

The stuck queue detection mechanism allows to detect queues
that are stuck. For sleeping clients, a queue may rightfully
be stuck: if a poor client implementation stays asleep for
more than 10s, then we don't want to trigger recovery flows
because of that client.
In order to cope with this, I added a mechanism that
monitors the state of the client: when a client goes to
sleep, the timer of his queues is frozen. When he wakes up,
the timer is reset to the right value so that if a client
was awake for more than 10s and the queues are stuck, only
then, the recovery flow will kick in.
This is valid only on non-shared queues: A-MPDU queues.

There was a bug in case we Tx to a sleeping client that has
an empty A-MPDU queue: the timer was armed to now + 10s.
This is bad, but pretty harmless.
The problem is that when the client wakes up, the timer is
modified to be now + remainder. But remainder is 0 since the
queue was empty when that client went to sleep...

Fix this by checking the state of the client before playing
with the timer when we add a packet to an empty queue.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/iwlwifi/pcie/tx.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 2b86c21..607acb5 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -1875,8 +1875,19 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
 
 	/* start timer if queue currently empty */
 	if (q->read_ptr == q->write_ptr) {
-		if (txq->wd_timeout)
-			mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout);
+		if (txq->wd_timeout) {
+			/*
+			 * If the TXQ is active, then set the timer, if not,
+			 * set the timer in remainder so that the timer will
+			 * be armed with the right value when the station will
+			 * wake up.
+			 */
+			if (!txq->frozen)
+				mod_timer(&txq->stuck_timer,
+					  jiffies + txq->wd_timeout);
+			else
+				txq->frozen_expiry_remainder = txq->wd_timeout;
+		}
 		IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", q->id);
 		iwl_trans_pcie_ref(trans);
 	}
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: pull request: iwlwifi 2015-07-30
  2015-07-30 18:52 pull request: iwlwifi 2015-07-30 Grumbach, Emmanuel
                   ` (2 preceding siblings ...)
  2015-07-31  4:43 ` [PATCH 3/3] iwlwifi: pcie: fix stuck queue detection for sleeping clients Emmanuel Grumbach
@ 2015-07-31  6:21 ` Kalle Valo
  3 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2015-07-31  6:21 UTC (permalink / raw)
  To: Grumbach, Emmanuel; +Cc: linux-wireless@vger.kernel.org

"Grumbach, Emmanuel" <emmanuel.grumbach@intel.com> writes:

> Here is another pull request for 4.2. Three small fixes this time.
> Let me know if you have any issues.
>
> Note that my availability will be limited next week, and the week after
> I'll be completely offline.
> Thanks!
>
> The following changes since commit be88a1ada9b97bb016196b7f4a1fc2fe2f798529:
>
>   iwlwifi: nvm: remove mac address byte swapping in 8000 family
> (2015-07-12 19:54:19 +0300)
>
> are available in the git repository at:
>
>  
> https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes.git tags/iwlwifi-for-kalle-2015-07-30

Thanks, pulled.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-31  6:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-30 18:52 pull request: iwlwifi 2015-07-30 Grumbach, Emmanuel
2015-07-31  4:43 ` [PATCH 1/3] iwlwifi: pcie: fix prepare card flow Emmanuel Grumbach
2015-07-31  4:43 ` [PATCH 2/3] iwlwifi: mvm: Fix regular scan priority Emmanuel Grumbach
2015-07-31  4:43 ` [PATCH 3/3] iwlwifi: pcie: fix stuck queue detection for sleeping clients Emmanuel Grumbach
2015-07-31  6:21 ` pull request: iwlwifi 2015-07-30 Kalle Valo

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).