From patchwork Tue Jan 29 23:47:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 2064261 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 46A59DF23E for ; Tue, 29 Jan 2013 23:48:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753141Ab3A2XsC (ORCPT ); Tue, 29 Jan 2013 18:48:02 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:43093 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753119Ab3A2Xr7 (ORCPT ); Tue, 29 Jan 2013 18:47:59 -0500 Received: from 64-126-113-177.dyn.everestkc.net ([64.126.113.177] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1U0KuE-0001uV-0V; Tue, 29 Jan 2013 23:47:58 +0000 From: Seth Forshee To: Johannes Berg , linux-wireless@vger.kernel.org Cc: Seth Forshee , "John W. Linville" , Arend van Spriel , Stanislaw Gruszka Subject: [PATCH 7/7] brcmsmac: Add support for off-channel powersave Date: Tue, 29 Jan 2013 17:47:35 -0600 Message-Id: <1359503255-18270-8-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1359503255-18270-1-git-send-email-seth.forshee@canonical.com> References: <1359503255-18270-1-git-send-email-seth.forshee@canonical.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Broadcom hardware sets the value of the PM flag in frame control based on the value of MCTL_HPS, which seems to include actively clearing PM if MCTL_HPS is not set. brcmsmac needs to suppor the off-channel powersave state in order to enable powersave at the AP at all. Add limited support for powersave to brcmsmac to prevent frame loss during background scans. Full powersave supoprt remains unimplemented, but switching between the off-channel and disabled states is possible. Signed-off-by: Seth Forshee --- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 15 +++++++++++---- drivers/net/wireless/brcm80211/brcmsmac/main.c | 9 +++++++++ drivers/net/wireless/brcm80211/brcmsmac/pub.h | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c index be3820e..408eb94 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c @@ -393,10 +393,17 @@ static int brcms_ops_config(struct ieee80211_hw *hw, u32 changed) brcms_dbg_info(core, "%s: change monitor mode: %s\n", __func__, conf->flags & IEEE80211_CONF_MONITOR ? "true" : "false"); - if (changed & IEEE80211_CONF_CHANGE_PS) - brcms_err(core, "%s: change power-save mode: %s (implement)\n", - __func__, ieee80211_is_ps_enabled(conf) ? - "true" : "false"); + if (changed & IEEE80211_CONF_CHANGE_PS) { + /* + * brcmsmac doesn't support powersave, but it does support + * setting the PM bit in frame control for off-channel PS + */ + if (ieee80211_is_ps_enabled(conf)) + brcms_err(core, "%s: cannot enable power-save mode (implement)\n", + __func__); + else + brcms_c_set_ps(wl->wlc); + } if (changed & IEEE80211_CONF_CHANGE_POWER) { err = brcms_c_set_tx_power(wl->wlc, conf->power_level); diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index c26992a..3fb71c9 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c @@ -3054,6 +3054,10 @@ static bool brcms_c_ps_allowed(struct brcms_c_info *wlc) { struct brcms_bss_cfg *cfg = wlc->bsscfg; + /* allow PS when off-channel PS is enabled */ + if (ieee80211_is_ps_offchannel(&wlc->pub->ieee_hw->conf)) + return true; + /* disallow PS when one of the following global conditions meets */ if (!wlc->pub->associated) return false; @@ -7545,6 +7549,11 @@ void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval) brcms_c_bcn_li_upd(wlc); } +void brcms_c_set_ps(struct brcms_c_info *wlc) +{ + brcms_c_set_ps_ctrl(wlc); +} + int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr) { uint qdbm; diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pub.h b/drivers/net/wireless/brcm80211/brcmsmac/pub.h index 4fb2834..5482fae 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/pub.h +++ b/drivers/net/wireless/brcm80211/brcmsmac/pub.h @@ -328,6 +328,7 @@ extern void brcms_c_set_shortslot_override(struct brcms_c_info *wlc, s8 sslot_override); extern void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval); +extern void brcms_c_set_ps(struct brcms_c_info *wlc); extern int brcms_c_set_tx_power(struct brcms_c_info *wlc, int txpwr); extern int brcms_c_get_tx_power(struct brcms_c_info *wlc); extern bool brcms_c_check_radio_disabled(struct brcms_c_info *wlc);