linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jouni Malinen <jouni.malinen@atheros.com>
To: "John W. Linville" <linville@tuxdriver.com>,
	Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org,
	Jouni Malinen <jouni.malinen@atheros.com>
Subject: [PATCH 5/7] ath9k: Set PM field in frame control when in PS mode
Date: Tue, 19 May 2009 17:01:42 +0300	[thread overview]
Message-ID: <20090519140232.813904147@atheros.com> (raw)
In-Reply-To: 20090519140137.708996030@atheros.com

mac80211 does not set PM field for normal data frames, so we need to
update that based on the current PS mode when using PS-Poll
(timeout=0) power save mode.

This allows the AP to remain in sync with our PS state. However, there
is still a potential race condition between PS state changes when
multiple TX queues are used and nullfunc and PS-Poll frames use
different queue. That corner case may need to be handled separately by
changing which queue is used either in ath9k or mac80211.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

---
 drivers/net/wireless/ath/ath9k/main.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- wireless-testing.orig/drivers/net/wireless/ath/ath9k/main.c	2009-05-19 16:32:35.000000000 +0300
+++ wireless-testing/drivers/net/wireless/ath/ath9k/main.c	2009-05-19 16:32:37.000000000 +0300
@@ -2088,6 +2088,21 @@ static int ath9k_tx(struct ieee80211_hw 
 		goto exit;
 	}
 
+	if (sc->hw->conf.flags & IEEE80211_CONF_PS) {
+		struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+		/*
+		 * mac80211 does not set PM field for normal data frames, so we
+		 * need to update that based on the current PS mode.
+		 */
+		if (ieee80211_is_data(hdr->frame_control) &&
+		    !ieee80211_is_nullfunc(hdr->frame_control) &&
+		    !ieee80211_has_pm(hdr->frame_control)) {
+			DPRINTF(sc, ATH_DBG_PS, "Add PM=1 for a TX frame "
+				"while in PS mode\n");
+			hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
+		}
+	}
+
 	if (unlikely(sc->sc_ah->power_mode != ATH9K_PM_AWAKE)) {
 		/*
 		 * We are using PS-Poll and mac80211 can request TX while in

-- 

-- 
Jouni Malinen                                            PGP id EFC895FA

  parent reply	other threads:[~2009-05-19 14:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19 14:01 [PATCH 0/7] ath9k/mac80211: Power save fixes Jouni Malinen
2009-05-19 14:01 ` [PATCH 1/7] ath9k: Wake up for TX in mac80211 timeout=0 sleep mode Jouni Malinen
2009-05-19 14:01 ` [PATCH 2/7] ath9k: Do not try to calibrate radio when in " Jouni Malinen
2009-05-19 14:01 ` [PATCH 3/7] ath9k: Use TSFOOR interrupt to trigger TSF sync with next Beacon Jouni Malinen
2009-05-19 14:01 ` [PATCH 4/7] ath9k: Wake up for RX filter changes Jouni Malinen
2009-05-19 14:01 ` Jouni Malinen [this message]
2009-05-19 14:01 ` [PATCH 6/7] mac80211: PS processing for every Beacon with our AID in TIM Jouni Malinen
2009-05-19 14:51   ` Johannes Berg
2009-05-19 14:01 ` [PATCH 7/7] mac80211: Do not override AID in the duration field Jouni Malinen
2009-05-19 14:52   ` Johannes Berg
2009-05-19 16:25     ` [PATCH v2 " Jouni Malinen

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=20090519140232.813904147@atheros.com \
    --to=jouni.malinen@atheros.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /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).