From patchwork Fri Aug 12 17:00:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leann Ogasawara X-Patchwork-Id: 109877 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 3F0CBB6F77 for ; Sat, 13 Aug 2011 03:01:02 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Qrv6F-0001tY-3Y; Fri, 12 Aug 2011 17:00:47 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Qrv6C-0001tA-Og for kernel-team@lists.ubuntu.com; Fri, 12 Aug 2011 17:00:44 +0000 Received: from c-24-21-156-70.hsd1.or.comcast.net ([24.21.156.70] helo=[192.168.1.3]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Qrv6C-0007TJ-Ax for kernel-team@lists.ubuntu.com; Fri, 12 Aug 2011 17:00:44 +0000 Subject: [Applied][Oneiric][PATCH 1/1] mac80211: be more careful in suspend/resume From: Leann Ogasawara To: kernel-team Date: Fri, 12 Aug 2011 10:00:40 -0700 Message-ID: <1313168440.18666.5.camel@adamo> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Hi All, The following patch has been confirmed to resolve a suspend/resume regression which was introduced in v3.0. It is a clean cherry-pick from upstream. Just sending a note to the list that I've applied this to Oneiric master-next. Thanks, Leann From 5562b47b1a8f37a23baf846bab66d5b15465045c Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 14 Jul 2011 16:48:54 +0200 Subject: [PATCH] mac80211: be more careful in suspend/resume BugLink: http://bugs.launchpad.net/bugs/811214 When suspending with all netdevs down, the device is stopped but we still call a number of driver callbacks that the driver might not expect. The same happens during resume, we might call a few callbacks without starting the driver. Fix this by checking open_count around more things and exiting quickly if it is 0. Also, while at this I noticed that the coverage class isn't reprogrammed after resume, so add that. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville (cherry picked from commit 94f9b97be5b3bf67392e43fb7f567721b09142c2) Signed-off-by: Leann Ogasawara --- net/mac80211/pm.c | 3 ++ net/mac80211/util.c | 52 +++++++++++++++++++++++++++----------------------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c index 730778a..850979b 100644 --- a/net/mac80211/pm.c +++ b/net/mac80211/pm.c @@ -12,6 +12,9 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) struct ieee80211_sub_if_data *sdata; struct sta_info *sta; + if (!local->open_count) + goto suspend; + ieee80211_scan_cancel(local); if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) { diff --git a/net/mac80211/util.c b/net/mac80211/util.c index d3fe2d2..4a10c41 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1146,27 +1146,37 @@ int ieee80211_reconfig(struct ieee80211_local *local) } #endif - /* restart hardware */ - if (local->open_count) { - /* - * Upon resume hardware can sometimes be goofy due to - * various platform / driver / bus issues, so restarting - * the device may at times not work immediately. Propagate - * the error. - */ - res = drv_start(local); - if (res) { - WARN(local->suspended, "Hardware became unavailable " - "upon resume. This could be a software issue " - "prior to suspend or a hardware issue.\n"); - return res; - } + /* setup fragmentation threshold */ + drv_set_frag_threshold(local, hw->wiphy->frag_threshold); + + /* setup RTS threshold */ + drv_set_rts_threshold(local, hw->wiphy->rts_threshold); + + /* reset coverage class */ + drv_set_coverage_class(local, hw->wiphy->coverage_class); - ieee80211_led_radio(local, true); - ieee80211_mod_tpt_led_trig(local, - IEEE80211_TPT_LEDTRIG_FL_RADIO, 0); + /* everything else happens only if HW was up & running */ + if (!local->open_count) + goto wake_up; + + /* + * Upon resume hardware can sometimes be goofy due to + * various platform / driver / bus issues, so restarting + * the device may at times not work immediately. Propagate + * the error. + */ + res = drv_start(local); + if (res) { + WARN(local->suspended, "Hardware became unavailable " + "upon resume. This could be a software issue " + "prior to suspend or a hardware issue.\n"); + return res; } + ieee80211_led_radio(local, true); + ieee80211_mod_tpt_led_trig(local, + IEEE80211_TPT_LEDTRIG_FL_RADIO, 0); + /* add interfaces */ list_for_each_entry(sdata, &local->interfaces, list) { if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && @@ -1190,12 +1200,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) } mutex_unlock(&local->sta_mtx); - /* setup fragmentation threshold */ - drv_set_frag_threshold(local, hw->wiphy->frag_threshold); - - /* setup RTS threshold */ - drv_set_rts_threshold(local, hw->wiphy->rts_threshold); - /* reconfigure hardware */ ieee80211_hw_config(local, ~0);