linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <sgruszka@redhat.com>
To: Pedro Francisco <pedrogfrancisco@gmail.com>
Cc: Tino Keitel <tino.keitel@tikei.de>,
	ML linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: Power saving features for iwl4965
Date: Thu, 17 Oct 2013 15:32:13 +0200	[thread overview]
Message-ID: <20131017133210.GB1723@redhat.com> (raw)
In-Reply-To: <20131017090654.GA21496@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

On Thu, Oct 17, 2013 at 11:06:55AM +0200, Stanislaw Gruszka wrote:
> Sorry for late answer. I have two more patches, which perhaps make
> powersave stop crashing on 3945. Please test them (note that I only
> compile tested, be carefull :-)

First patch has a bug. I'm attaching improved version.

Stanislaw

[-- Attachment #2: 0001-iwlegacy-poke-device-when-waiting-for-hcmd.patch --]
[-- Type: text/plain, Size: 2045 bytes --]

>From dae9f167853f266d5efe688f965968725375e2ae Mon Sep 17 00:00:00 2001
From: Stanislaw Gruszka <sgruszka@redhat.com>
Date: Thu, 17 Oct 2013 15:30:07 +0200
Subject: [PATCH] iwlegacy poke device when waiting for hcmd

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/iwlegacy/common.c | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index b03e22e..3d8dae3c 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -254,8 +254,6 @@ il_get_cmd_string(u8 cmd)
 }
 EXPORT_SYMBOL(il_get_cmd_string);
 
-#define HOST_COMPLETE_TIMEOUT (HZ / 2)
-
 static void
 il_generic_cmd_callback(struct il_priv *il, struct il_device_cmd *cmd,
 			struct il_rx_pkt *pkt)
@@ -305,11 +303,15 @@ il_send_cmd_async(struct il_priv *il, struct il_host_cmd *cmd)
 	return 0;
 }
 
+#define HOST_COMPLETE_TIMEOUT (HZ / 2)
+#define COMMAND_POKE_TIMEOUT  (HZ / 10)
+
 int
 il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
 {
-	int cmd_idx;
-	int ret;
+	unsigned long flags;
+	int cmd_idx, ret;
+	int timeout = HOST_COMPLETE_TIMEOUT;
 
 	lockdep_assert_held(&il->mutex);
 
@@ -333,9 +335,22 @@ il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd)
 		goto out;
 	}
 
-	ret = wait_event_timeout(il->wait_command_queue,
-				 !test_bit(S_HCMD_ACTIVE, &il->status),
-				 HOST_COMPLETE_TIMEOUT);
+	while (timeout > 0) {
+		ret = wait_event_timeout(il->wait_command_queue,
+					 !test_bit(S_HCMD_ACTIVE, &il->status),
+					 COMMAND_POKE_TIMEOUT);
+		if (ret)
+			break;
+
+		/* Poke the device, it may have lost the command. */
+		spin_lock_irqsave(&il->reg_lock, flags);
+		_il_grab_nic_access(il);
+		_il_release_nic_access(il);
+		spin_unlock_irqrestore(&il->reg_lock, flags);
+
+		timeout -= COMMAND_POKE_TIMEOUT;
+	}
+
 	if (!ret) {
 		if (test_bit(S_HCMD_ACTIVE, &il->status)) {
 			IL_ERR("Error sending %s: time out after %dms.\n",
-- 
1.8.3.1


  reply	other threads:[~2013-10-17 13:35 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-18 20:35 Power saving features for iwl4965 Tino Keitel
2012-04-19 14:25 ` Johannes Berg
2012-04-19 18:50   ` tino
2012-04-25 12:25 ` Stanislaw Gruszka
2012-05-03 18:28   ` Tino Keitel
2012-12-26 18:54     ` Tino Keitel
2013-01-07 11:08       ` Stanislaw Gruszka
2013-01-08  1:48         ` Pedro Francisco
2013-01-08  8:47           ` Stanislaw Gruszka
2013-06-03  8:52         ` Tino Keitel
2013-06-03 14:18           ` Stanislaw Gruszka
2013-06-09  0:28             ` Pedro Francisco
2013-06-10 19:31               ` Pedro Francisco
2013-06-11 16:19                 ` Stanislaw Gruszka
2013-06-11 18:55                   ` Tino Keitel
2013-06-14 12:50                   ` Pedro Francisco
2013-06-14 13:18                     ` Stanislaw Gruszka
2013-06-25 14:25                       ` Stanislaw Gruszka
2013-07-11 21:02                         ` Pedro Francisco
2013-07-16 10:27                           ` Stanislaw Gruszka
2013-07-16 11:02                             ` Pedro Francisco
2013-07-17 11:48                             ` Pedro Francisco
2013-07-31 12:08                               ` Stanislaw Gruszka
2013-08-04 14:24                                 ` Pedro Francisco
2013-08-04 14:53                                   ` Pedro Francisco
2013-10-17  9:06                                     ` Stanislaw Gruszka
2013-10-17 13:32                                       ` Stanislaw Gruszka [this message]
2013-06-11 18:51             ` Tino Keitel
2014-02-18 10:57               ` Stanislaw Gruszka
2014-02-18 11:32                 ` Emmanuel Grumbach
2014-02-18 11:59                   ` Stanislaw Gruszka
2014-02-20 12:08                 ` Pedro Francisco
2014-02-25 16:16                   ` Pedro Francisco
  -- strict thread matches above, loose matches on Subject: below --
2012-10-01 16:06 Tino Keitel

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=20131017133210.GB1723@redhat.com \
    --to=sgruszka@redhat.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pedrogfrancisco@gmail.com \
    --cc=tino.keitel@tikei.de \
    /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).