linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Seth Forshee <seth.forshee@canonical.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org,
	brcm80211-dev-list@broadcom.com,
	"John W. Linville" <linville@tuxdriver.com>,
	Stefano Brivio <stefano.brivio@polimi.it>,
	Arend van Spriel <arend@broadcom.com>,
	Seth Forshee <seth.forshee@canonical.com>
Subject: [RFC PATCH 6/8] brcmsmac: Set MCTL_HPS when PM should be set
Date: Mon, 16 Dec 2013 16:00:58 -0600	[thread overview]
Message-ID: <1387231260-2849-7-git-send-email-seth.forshee@canonical.com> (raw)
In-Reply-To: <1387231260-2849-1-git-send-email-seth.forshee@canonical.com>

Even though powersave is not supported MCTL_HPS still needs to be
set in order to transmit nullfunc frames with PM set. Add support
for the change_ps callback to set this bit whenever the powersave
mode requires PM to be set.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c |  7 +++++++
 drivers/net/wireless/brcm80211/brcmsmac/main.c        | 17 ++++++++++-------
 drivers/net/wireless/brcm80211/brcmsmac/main.h        |  1 +
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index e71ce8c..e6a8c72 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -734,6 +734,12 @@ brcms_ops_bss_info_changed(struct ieee80211_hw *hw,
 	return;
 }
 
+void brcms_ops_change_ps(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+	struct brcms_info *wl = hw->priv;
+	brcms_c_set_ps_ctrl(wl->wlc, vif);
+}
+
 static void
 brcms_ops_configure_filter(struct ieee80211_hw *hw,
 			unsigned int changed_flags,
@@ -944,6 +950,7 @@ static const struct ieee80211_ops brcms_ops = {
 	.remove_interface = brcms_ops_remove_interface,
 	.config = brcms_ops_config,
 	.bss_info_changed = brcms_ops_bss_info_changed,
+	.change_ps = brcms_ops_change_ps,
 	.configure_filter = brcms_ops_configure_filter,
 	.sw_scan_start = brcms_ops_sw_scan_start,
 	.sw_scan_complete = brcms_ops_sw_scan_complete,
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 8138f1c..5d4dabb 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -3072,10 +3072,13 @@ static void brcms_b_antsel_set(struct brcms_hardware *wlc_hw, u32 antsel_avail)
  * conditions under which the PM bit should be set in outgoing frames
  * and STAY_AWAKE is meaningful
  */
-static bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
+static bool brcms_c_ps_allowed(struct brcms_c_info *wlc,
+			       struct ieee80211_vif *vif)
 {
-	/* not supporting PS so always return false for now */
-	return false;
+	if (!vif)
+		return false;
+	return vif->ps_mode == IEEE80211_VIF_PS_DOZE ||
+	       vif->ps_mode == IEEE80211_VIF_PS_AWAKE_PM;
 }
 
 static void brcms_c_statsupd(struct brcms_c_info *wlc)
@@ -3748,13 +3751,13 @@ brcms_c_duty_cycle_set(struct brcms_c_info *wlc, int duty_cycle, bool isOFDM,
 }
 
 /* push sw hps and wake state through hardware */
-static void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc)
+void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc, struct ieee80211_vif *vif)
 {
 	u32 v1, v2;
 	bool hps;
 	bool awake_before;
 
-	hps = brcms_c_ps_allowed(wlc);
+	hps = brcms_c_ps_allowed(wlc, vif);
 
 	brcms_dbg_mac80211(wlc->hw->d11core, "wl%d: hps %d\n", wlc->pub->unit,
 			   hps);
@@ -3901,7 +3904,7 @@ static void brcms_c_setband(struct brcms_c_info *wlc,
 		return;
 
 	/* wait for at least one beacon before entering sleeping state */
-	brcms_c_set_ps_ctrl(wlc);
+	brcms_c_set_ps_ctrl(wlc, NULL);
 
 	/* band-specific initializations */
 	brcms_c_bsinit(wlc);
@@ -7938,7 +7941,7 @@ void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx)
 			     bi << CFPREP_CBI_SHIFT);
 
 		/* Update maccontrol PM related bits */
-		brcms_c_set_ps_ctrl(wlc);
+		brcms_c_set_ps_ctrl(wlc, NULL);
 	}
 
 	brcms_c_bandinit_ordered(wlc, chanspec);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.h b/drivers/net/wireless/brcm80211/brcmsmac/main.h
index c4d135c..58abbe3 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.h
@@ -622,6 +622,7 @@ int brcms_b_xmtfifo_sz_get(struct brcms_hardware *wlc_hw, uint fifo,
 
 int brcms_c_set_gmode(struct brcms_c_info *wlc, u8 gmode, bool config);
 void brcms_c_mac_promisc(struct brcms_c_info *wlc, uint filter_flags);
+void brcms_c_set_ps_ctrl(struct brcms_c_info *wlc, struct ieee80211_vif *vif);
 u16 brcms_c_calc_lsig_len(struct brcms_c_info *wlc, u32 ratespec, uint mac_len);
 u32 brcms_c_rspec_to_rts_rspec(struct brcms_c_info *wlc, u32 rspec,
 			       bool use_rspec, u16 mimo_ctlchbw);
-- 
1.8.3.2


  parent reply	other threads:[~2013-12-16 22:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 22:00 [RFC/RFT] mac80211 powersave rework Seth Forshee
2013-12-16 22:00 ` [RFC PATCH 1/8] mac80211: Move dynamic PS data out of common code Seth Forshee
2013-12-17  8:08   ` Johannes Berg
2013-12-17 12:37     ` Seth Forshee
2013-12-16 22:00 ` [RFC PATCH 2/8] mac80211: Add per-interface powersave states and parameters Seth Forshee
2013-12-17  8:11   ` Johannes Berg
2013-12-17 13:12     ` Seth Forshee
2013-12-16 22:00 ` [RFC PATCH 3/8] mac80211: Add powersave module Seth Forshee
2013-12-17  8:16   ` Johannes Berg
2013-12-17 13:31     ` Seth Forshee
2013-12-16 22:00 ` [RFC PATCH 4/8] mac80211: Use PS module for managed mode powersave Seth Forshee
2013-12-17  8:25   ` Johannes Berg
2013-12-17 14:09     ` Seth Forshee
2013-12-16 22:00 ` [RFC PATCH 5/8] mac80211: Don't start dynamic PS timer when leaving off-channel if still scanning Seth Forshee
2013-12-16 22:00 ` Seth Forshee [this message]
2013-12-16 22:00 ` [RFC PATCH 7/8] b43: Allow HWPS state to be changed Seth Forshee
2013-12-16 22:01 ` [RFC PATCH 8/8] b43: Set B43_MACCTL_HWPS when PM should be set Seth Forshee

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=1387231260-2849-7-git-send-email-seth.forshee@canonical.com \
    --to=seth.forshee@canonical.com \
    --cc=arend@broadcom.com \
    --cc=b43-dev@lists.infradead.org \
    --cc=brcm80211-dev-list@broadcom.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=stefano.brivio@polimi.it \
    /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).