public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Kalle Valo <kalle.valo@iki.fi>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net, a.young.jason@gmail.com
Subject: [RFC PATCH v5 4/7] mac80211: check uapsd state for dynamic power save
Date: Thu, 31 Dec 2009 15:37:35 +0200	[thread overview]
Message-ID: <20091231133735.29899.85614.stgit@tikku> (raw)
In-Reply-To: <20091231133626.29899.95683.stgit@tikku>

From: Kalle Valo <kalle.valo@nokia.com>

To make U-APSD client mode effective, we must not wake up from dynamic power
save when transmitting frames. So if dynamic power save is enabled, it needs
check the queue the transmitted packet is in and decide if we need to wake
up or not.

In a perfect world, where all packets would have correct QoS tags, U-APSD
enabled queues should not trigger wakeup from power save. But in the real
world, where very few packets have correct QoS tags, this won't work. For
example, if only voip class has U-APSD enabled and we send a packet in voip
class, but the packets we receive are in best effort class, we would receive
the packets with the legacy power save method. And that would increase
latencies too much from a voip application point of view.

The workaround is to enable U-APSD for all qeueus and still use dynamic ps
wakeup for all other queues except voip. That way we can still save power
with a voip application and not sacrifice latency. Normal traffic (in
background, best effort or video class) would still trigger wakeup from
dynamic power save.

Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
 net/mac80211/tx.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 32bbbc2..a782f4c 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -184,6 +184,7 @@ static ieee80211_tx_result debug_noinline
 ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
 {
 	struct ieee80211_local *local = tx->local;
+	struct ieee80211_if_managed *ifmgd;
 
 	/* driver doesn't support power save */
 	if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
@@ -208,6 +209,30 @@ ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx)
 	if (local->quiescing)
 		return TX_CONTINUE;
 
+	/* dynamic ps is supported only in managed mode */
+	if (tx->sdata->vif.type != NL80211_IFTYPE_STATION)
+		return TX_CONTINUE;
+
+	ifmgd = &tx->sdata->u.mgd;
+
+	/*
+	 * Don't wakeup from power save if u-apsd is enabled, voip ac has
+	 * u-apsd enabled and the frame is in voip class. This effectively
+	 * means that even if all access categories have u-apsd enabled, in
+	 * practise u-apsd is only used with the voip ac. This is a
+	 * workaround for the case when received voip class packets do not
+	 * have correct qos tag for some reason, due the network or the
+	 * peer application.
+	 *
+	 * Note: local->uapsd_queues access is racy here. If the value is
+	 * changed via debugfs, user needs to reassociate manually to have
+	 * everything in sync.
+	 */
+	if ((ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED)
+	    && (local->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO)
+	    && skb_get_queue_mapping(tx->skb) == 0)
+		return TX_CONTINUE;
+
 	if (local->hw.conf.flags & IEEE80211_CONF_PS) {
 		ieee80211_stop_queues_by_reason(&local->hw,
 						IEEE80211_QUEUE_STOP_REASON_PS);


  parent reply	other threads:[~2009-12-31 13:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-31 13:37 [RFC PATCH v5 0/7] mac80211 client U-APSD support Kalle Valo
2009-12-31 13:37 ` [RFC PATCH v5 1/7] mac80211: add U-APSD client support Kalle Valo
2009-12-31 13:37 ` [RFC PATCH v5 2/7] mac80211: add debugfs interface for U-APSD queue configuration Kalle Valo
2010-01-05  9:48   ` Johannes Berg
2010-01-05 10:27     ` Kalle Valo
2010-01-05 10:44       ` Johannes Berg
2010-01-05 10:53         ` Kalle Valo
2009-12-31 13:37 ` [RFC PATCH v5 3/7] mac80211: create tx handler for dynamic ps Kalle Valo
2009-12-31 13:37 ` Kalle Valo [this message]
2009-12-31 13:37 ` [RFC PATCH v5 5/7] ieee80211: add struct ieee80211_hdr_qos Kalle Valo
2009-12-31 13:37 ` [RFC PATCH v5 6/7] wl1251: create qos null data template Kalle Valo
2009-12-31 13:37 ` [RFC PATCH v5 7/7] wl1251: add U-APSD support Kalle Valo
2010-01-05  9:51 ` [RFC PATCH v5 0/7] mac80211 client " Johannes Berg
2010-01-05 10:31   ` Kalle Valo

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=20091231133735.29899.85614.stgit@tikku \
    --to=kalle.valo@iki.fi \
    --cc=a.young.jason@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.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