linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Luis Rodriguez <Luis.Rodriguez@Atheros.com>,
	"linville@tuxdriver.com" <linville@tuxdriver.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Amod Bodas <Amod.Bodas@Atheros.com>,
	"pstew@google.com" <pstew@google.com>,
	"stable@kernel.org" <stable@kernel.org>
Subject: Re: [PATCH 5/5] mac80211: fix issuing idle calls when device open count is 0
Date: Tue, 7 Dec 2010 07:59:16 -0800	[thread overview]
Message-ID: <20101207155916.GA1855@tux> (raw)
In-Reply-To: <1291737298.3607.48.camel@jlt3.sipsolutions.net>

On Tue, Dec 07, 2010 at 07:54:58AM -0800, Johannes Berg wrote:
> On Tue, 2010-12-07 at 07:51 -0800, Luis R. Rodriguez wrote:
> 
> > >> >>       drv_stop(local);
> > >> >> +     ieee80211_recalc_idle_force(local);
> 
> > > Because you can't call into drivers after you stop them? Shouldn't this
> > > be obvious?
> > 
> > That makes sense, but mac80211 is the one who tells the driver when
> > its idle or non-idle, if we stop the device do we want it to handle an
> > idle check itself? This change would only force out an idle change
> > notification, nothing else.
> 
> I don't get what you're saying at all. Can you look at the code lines I
> quoted again?

Yes, I did. Anyway here is a v2 with the changes you outlined incorporated.

>From d8983b423b24037e8e847fa45778d9313af3e057 Mon Sep 17 00:00:00 2001
From: Luis R. Rodriguez <lrodriguez@atheros.com>
Date: Mon, 6 Dec 2010 18:04:03 -0800
Subject: [PATCH v2] mac80211: fix issuing idle calls when device open count is 0

There are a few places where mac80211 may issue a hw config
but the hw config will be ignored and got into a black hole if
the device count is already 0. Further hw config calls will also
be discarded as the device is already marked as idle, in these
cases mac80211 assumes the radio is idle but the driver never
really got the notification. We need to ensure that places that
will call a hw reconfig with open_count set to 0 will send the
notification to the driver. This forces these checks in a few
other key missing places.

Without this suspend and resume is broken on devices which require
notifying the driver to become idle once the open_count already
has reached 0. This fixes suspend/resume when using new DBus APIs
are used which idle the device in places which had not yet gotten
widely tested.

Cc: stable@kernel.org
Cc: Paul Stewart <pstew@google.com>
Cc: Amod Bodas <amod.bodas@atheros.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/mac80211/ieee80211_i.h |   16 +++++++++++++++-
 net/mac80211/iface.c       |    4 ++--
 net/mac80211/scan.c        |    2 +-
 net/mac80211/util.c        |    1 +
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index ae32349..873ec88 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1132,8 +1132,21 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
 			     enum nl80211_iftype type);
 void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
 void ieee80211_remove_interfaces(struct ieee80211_local *local);
+
 u32 __ieee80211_recalc_idle(struct ieee80211_local *local);
-void ieee80211_recalc_idle(struct ieee80211_local *local);
+void ieee80211_recalc_idle_check(struct ieee80211_local *local, bool force);
+
+static inline void ieee80211_recalc_idle(struct ieee80211_local *local)
+{
+	ieee80211_recalc_idle_check(local, false);
+}
+
+static inline void ieee80211_recalc_idle_force(struct ieee80211_local *local)
+
+{
+	ieee80211_recalc_idle_check(local, true);
+}
+
 void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
 				    const int offset);
 
@@ -1211,6 +1224,7 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
 
 /* Suspend/resume and hw reconfiguration */
 int ieee80211_reconfig(struct ieee80211_local *local);
+void ieee80211_recalc_idle_force(struct ieee80211_local *local);
 void ieee80211_stop_device(struct ieee80211_local *local);
 
 #ifdef CONFIG_PM
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 36b7000..2803a7a 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1320,7 +1320,7 @@ u32 __ieee80211_recalc_idle(struct ieee80211_local *local)
 	return 0;
 }
 
-void ieee80211_recalc_idle(struct ieee80211_local *local)
+void ieee80211_recalc_idle_check(struct ieee80211_local *local, bool force)
 {
 	u32 chg;
 
@@ -1328,7 +1328,7 @@ void ieee80211_recalc_idle(struct ieee80211_local *local)
 	chg = __ieee80211_recalc_idle(local);
 	mutex_unlock(&local->iflist_mtx);
 	if (chg)
-		ieee80211_hw_config(local, chg);
+		__ieee80211_hw_config(local, chg, force);
 }
 
 static int netdev_notify(struct notifier_block *nb,
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index fb274db..30cd2a0 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -301,7 +301,7 @@ static void __ieee80211_scan_completed_finish(struct ieee80211_hw *hw,
 	}
 
 	mutex_lock(&local->mtx);
-	ieee80211_recalc_idle(local);
+	ieee80211_recalc_idle_force(local);
 	mutex_unlock(&local->mtx);
 
 	ieee80211_mlme_notify_scan_completed(local);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index e497476..a4184eb 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1120,6 +1120,7 @@ void ieee80211_stop_device(struct ieee80211_local *local)
 	cancel_work_sync(&local->reconfig_filter);
 
 	flush_workqueue(local->workqueue);
+	ieee80211_recalc_idle_force(local);
 	drv_stop(local);
 }
 
-- 
1.7.3.2.90.gd4c43


  reply	other threads:[~2010-12-07 15:59 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07  2:48 [PATCH 0/5] mac80211/ath9k: few suspend checks and fixes Luis R. Rodriguez
2010-12-07  2:48 ` [PATCH 1/5] ath9k: warn when we get a ATH9K_INT_TIM_TIMER and are idle Luis R. Rodriguez
2011-01-19  1:34   ` Ben Greear
2011-01-19  1:38     ` Luis R. Rodriguez
2011-01-19  1:42       ` Ben Greear
2011-01-19  1:43         ` Luis R. Rodriguez
2010-12-07  2:48 ` [PATCH 2/5] ath9k: Fix power save count imbalance on ath_radio_enable() Luis R. Rodriguez
2010-12-07  2:48 ` [PATCH 3/5] ath9k_hw: warn if we cannot change the power to the chip Luis R. Rodriguez
2010-12-07  2:48 ` [PATCH 4/5] mac80211: fix idle change notifications upon device stop Luis R. Rodriguez
2010-12-07  2:48 ` [PATCH 5/5] mac80211: fix issuing idle calls when device open count is 0 Luis R. Rodriguez
2010-12-07  9:38   ` Johannes Berg
2010-12-07 15:20     ` Paul Stewart
2010-12-07 15:23       ` Johannes Berg
2010-12-07 17:28         ` Paul Stewart
2010-12-07 17:31           ` Johannes Berg
2010-12-07 15:44     ` Luis R. Rodriguez
2010-12-07 15:48       ` Johannes Berg
2010-12-07 15:51         ` Luis R. Rodriguez
2010-12-07 15:54           ` Johannes Berg
2010-12-07 15:59             ` Luis R. Rodriguez [this message]
2010-12-07 17:32               ` Johannes Berg
2010-12-07 18:04                 ` Luis R. Rodriguez
2010-12-07 18:12                   ` Johannes Berg
2010-12-07 20:49                     ` Luis R. Rodriguez
2010-12-07 20:54                       ` Johannes Berg
2010-12-07 20:56                         ` Luis R. Rodriguez
2010-12-07 20:57                           ` Johannes Berg
2010-12-07 21:28                             ` Luis R. Rodriguez

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=20101207155916.GA1855@tux \
    --to=lrodriguez@atheros.com \
    --cc=Amod.Bodas@Atheros.com \
    --cc=Luis.Rodriguez@Atheros.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=pstew@google.com \
    --cc=stable@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).