All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Porsch <marco@cozybit.com>
To: adrian@freebsd.org
Cc: linux-wireless@vger.kernel.org, "Luis R. Rodriguez" <mcgrof@gmail.com>
Subject: issue with ath9k_htc and mesh mode powersave
Date: Tue, 13 Nov 2012 11:55:40 -0800	[thread overview]
Message-ID: <50A2A5BC.1030303@cozybit.com> (raw)

Hi,

my name is Marco Porsch, I am currently implementing mesh mode powersave 
as part of mac80211 and some wireless drivers.

When testing with a ath9k_htc TL-WN721N and monitoring the power 
consumption on the USB cable, I see the following behaviour:

during normal mesh operation in powersave mode the power consumption 
rises to 120mA (~55mA is the usual current in PS mode without activity) 
and stays stuck at that level until ifdown. Mesh leave + join does not 
reset it to normal behaviour. Sometimes it only takes few seconds until 
the power consumption gets stuck; sometimes it works fine for multiple 
minutes.

I have no idea what is the reason for that behaviour.
No obvious debug output is given despite all ath9k debugs enabled. I can 
only suspect the hardware expects some managed-mode only event from the 
access point that we do not have there in mesh mode.
When looking at the NDA firmware I did not see anything related to power 
save mode that could help.

Do you have any idea what could be the reason for that behaviour? Or any 
hints for debugging the issue?


Regards,
Marco



PS:

For testing I use a simplistic "mesh awake window" implementation that 
queues waking up from sleep mode after beacon preparation and sets a 
timer for going to sleep again after the awake window is expired. I 
added a bool in_awake_window that blocks going to NETWORKSLEEP when set. 
The code looks like:

@@ -473,6 +495,14 @@ void ath9k_htc_swba(struct ath9k_htc_priv *priv,
  	ath9k_htc_send_buffered(priv, slot);
  	ath9k_htc_send_beacon(priv, slot);

+	/* mesh awake window */
+	if (priv->ah->opmode == NL80211_IFTYPE_MESH_POINT && priv->ps_enabled) {
+		priv->in_awake_window = true;
+		ieee80211_queue_work(priv->hw, &priv->ps_work);
+		mod_timer(&priv->awake_window_timer, jiffies +
+				usecs_to_jiffies(1024 * priv->awake_window) +
+				priv->ah->config.sw_beacon_response_time);
+	}
  }

When the timer expires it calls:

@@ -276,6 +284,14 @@ void ath9k_ps_work(struct work_struct *work)
  	ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP);
  }

+void ath9k_htc_mesh_awake_window_timer(unsigned long data)
+{
+	struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) data;
+
+	priv->in_awake_window = false;
+	ieee80211_queue_work(priv->hw, &priv->ps_work);
+}
+


PPS:

Some further hacking revealed that reading AR_RTC_STATUS before and 
after REG_CLR_BIT(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN) shows the 
following

normal behaviour:

[ 301.655141] ath: phy0: AR_RTC_STATUS before: 02
[ 301.661079] ath: phy0: AR_RTC_STATUS after : 04

when being stuck it changes to:

[ 302.677066] ath: phy0: AR_RTC_STATUS before: 02
[ 302.683085] ath: phy0: AR_RTC_STATUS after : 02

                 reply	other threads:[~2012-11-13 19:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=50A2A5BC.1030303@cozybit.com \
    --to=marco@cozybit.com \
    --cc=adrian@freebsd.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.