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>
Subject: [RFC PATCH 4/8] mac80211: Use PS module for managed mode powersave
Date: Tue, 17 Dec 2013 08:09:13 -0600 [thread overview]
Message-ID: <20131217140913.GC5175@ubuntu-mba51> (raw)
In-Reply-To: <1387268712.4749.14.camel@jlt4.sipsolutions.net>
On Tue, Dec 17, 2013 at 09:25:12AM +0100, Johannes Berg wrote:
> On Mon, 2013-12-16 at 16:00 -0600, Seth Forshee wrote:
>
> > --- a/net/mac80211/iface.c
> > +++ b/net/mac80211/iface.c
> > @@ -682,7 +682,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
> > if (hw_reconf_flags)
> > ieee80211_hw_config(local, hw_reconf_flags);
> >
> > - ieee80211_recalc_ps(local, -1);
> > + ieee80211_ps_vif_open(sdata);
>
> I have a feeling that now that we have very regular join/leave code, and
> are guaranteed to go through disassoc when the interface is stopped, we
> probably don't need all the hooks in this file at all any more.
Okay, I'll look at this.
> > @@ -1609,6 +1609,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
> > strlcpy(sdata->name, name, IFNAMSIZ);
> > ieee80211_assign_perm_addr(local, wdev->address, type);
> > memcpy(sdata->vif.addr, wdev->address, ETH_ALEN);
> > + ieee80211_ps_init_vif(sdata);
>
> That doesn't really seem like the right place? Shouldn't it somehow be
> specific for managed interfaces, and be reset when the interface changes
> type, for example?
I intended the PS code to be usable for other interface types and tried
to isolate the parts specific to managed mode. Right now at minimum
other interface types need to "open" the interface with the PS module to
reference awake_count.
Maybe this is the wrong place though. I'll look at it.
> > --- a/net/mac80211/status.c
> > +++ b/net/mac80211/status.c
> > @@ -732,15 +732,16 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
> > local->dot11FailedCount++;
> > }
> >
> > + sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev);
>
> This isn't safe, the interface can go away while the SKB is on some
> hardware queue. Look at what we do in ieee80211_report_used_skb() and
> maybe refactor that somehow.
Okay. This was using ps_sdata, so I need some other way to get at sdata.
I'll look at that code.
> > - if (local->hw.conf.flags & IEEE80211_CONF_PS) {
> > + if (sdata->vif.ps_mode == IEEE80211_VIF_PS_DOZE) {
> > ieee80211_stop_queues_by_reason(&local->hw,
> > IEEE80211_MAX_QUEUE_MAP,
> > IEEE80211_QUEUE_STOP_REASON_PS);
>
> This is a bit odd now - shouldn't you only stop the queues for that
> interface? Or is this still assuming only a single interface?
You're right, this probably should just stop the interface queues.
> > + list_for_each_entry(sdata, &local->interfaces, list) {
> > + if (sdata->vif.type != NL80211_IFTYPE_STATION)
> > + continue;
> > + if (!sdata->u.mgd.associated)
> > + continue;
> > + if (sdata->vif.ps_mode != IEEE80211_VIF_PS_AWAKE)
> > + continue;
> >
> > - ieee80211_send_nullfunc(local, sdata, 0);
> > - }
> > + ieee80211_send_nullfunc(local, sdata, 0);
>
> Unrelated to your patch, but we should probably send a nullfunc(PM=1)
> packet for the other cases to detect if we got disconnected. Or wake up
> briefly, and go back to sleep later or something ...
>
> > +void ieee80211_recalc_ps(struct ieee80211_sub_if_data *sdata)
> > +{
> > + switch (sdata->vif.type) {
> > + case NL80211_IFTYPE_STATION:
> > + ieee80211_mgd_recalc_ps(sdata);
> > + break;
> > + default:
> > + break;
> > + }
> > +}
>
> Would that make more sense in ps.c now?
>
> > +int ieee80211_max_network_latency(struct notifier_block *nb,
> > + unsigned long data, void *dummy)
>
> ditto?
I guess so, either one seems okay to me.
> > + mutex_lock(&local->iflist_mtx);
> > + list_for_each_entry_rcu(sdata, &local->interfaces, list) {
>
> locking mutex & then rcu seems weird.
Oops. I'll fix that.
next prev parent reply other threads:[~2013-12-17 14:09 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 [this message]
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 ` [RFC PATCH 6/8] brcmsmac: Set MCTL_HPS when PM should be set Seth Forshee
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=20131217140913.GC5175@ubuntu-mba51 \
--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).