* [PATCH v2 1/3] mac80211: refactor dynamic power save check
@ 2009-10-27 15:36 Kalle Valo
2009-10-27 15:36 ` [PATCH v2 2/3] mac80211: fix dynamic power save for devices with nullfunc support in hw Kalle Valo
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kalle Valo @ 2009-10-27 15:36 UTC (permalink / raw)
To: linville; +Cc: johannes, linux-wireless
From: Kalle Valo <kalle.valo@nokia.com>
Refactor dynamic power save checks to a function of it's own for better
readibility. No functional changes.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
net/mac80211/tx.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index db4bda6..c59ed84 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1387,6 +1387,26 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
return 0;
}
+static bool need_dynamic_ps(struct ieee80211_local *local)
+{
+ /* driver doesn't support power save */
+ if (!(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
+ return false;
+
+ /* dynamic power save disabled */
+ if (local->hw.conf.dynamic_ps_timeout <= 0)
+ return false;
+
+ /* we are scanning, don't enable power save */
+ if (local->scanning)
+ return false;
+
+ if (!local->ps_sdata)
+ return false;
+
+ return true;
+}
+
static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb)
{
@@ -1399,9 +1419,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
dev_hold(sdata->dev);
- if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) &&
- local->hw.conf.dynamic_ps_timeout > 0 &&
- !(local->scanning) && local->ps_sdata) {
+ if (need_dynamic_ps(local)) {
if (local->hw.conf.flags & IEEE80211_CONF_PS) {
ieee80211_stop_queues_by_reason(&local->hw,
IEEE80211_QUEUE_STOP_REASON_PS);
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/3] mac80211: fix dynamic power save for devices with nullfunc support in hw
2009-10-27 15:36 [PATCH v2 1/3] mac80211: refactor dynamic power save check Kalle Valo
@ 2009-10-27 15:36 ` Kalle Valo
2009-10-27 16:08 ` Johannes Berg
2009-10-27 15:36 ` [PATCH v2 3/3] wl1251: enable power save Kalle Valo
2009-10-27 16:07 ` [PATCH v2 1/3] mac80211: refactor dynamic power save check Johannes Berg
2 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2009-10-27 15:36 UTC (permalink / raw)
To: linville; +Cc: johannes, linux-wireless
From: Kalle Valo <kalle.valo@nokia.com>
In TX path it was assumed that dynamic power save works only if
IEEE80211_HW_PS_NULLFUNC_STACK is set. But is not the case, there are
devices which have nullfunc support in hardware but need mac80211
to handle dynamic power save timers, TI's wl1251 is one of them.
The fix is to not check for IEEE80211_HW_PS_NULLFUNC_STACK in
is_dynamic_ps_enabled(), instead check IEEE80211_HW_SUPPORTS_PS and
IEEE80211_HW_SUPPORTS_DYNAMIC_PS flags and act accordingly.
Tested with wl1251.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
net/mac80211/tx.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index c59ed84..66dab40 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1390,7 +1390,11 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
static bool need_dynamic_ps(struct ieee80211_local *local)
{
/* driver doesn't support power save */
- if (!(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
+ if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
+ return false;
+
+ /* hardware does dynamic power save */
+ if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)
return false;
/* dynamic power save disabled */
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/3] wl1251: enable power save
2009-10-27 15:36 [PATCH v2 1/3] mac80211: refactor dynamic power save check Kalle Valo
2009-10-27 15:36 ` [PATCH v2 2/3] mac80211: fix dynamic power save for devices with nullfunc support in hw Kalle Valo
@ 2009-10-27 15:36 ` Kalle Valo
2009-10-27 16:07 ` [PATCH v2 1/3] mac80211: refactor dynamic power save check Johannes Berg
2 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2009-10-27 15:36 UTC (permalink / raw)
To: linville; +Cc: johannes, linux-wireless
From: Kalle Valo <kalle.valo@nokia.com>
wl1251 supports power save and it can be enabled now.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
drivers/net/wireless/wl12xx/wl1251_main.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index ec01e9d..60a337a 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -1311,7 +1311,8 @@ int wl1251_init_ieee80211(struct wl1251 *wl)
wl->hw->channel_change_time = 10000;
wl->hw->flags = IEEE80211_HW_SIGNAL_DBM |
- IEEE80211_HW_NOISE_DBM;
+ IEEE80211_HW_NOISE_DBM |
+ IEEE80211_HW_SUPPORTS_PS;
wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
wl->hw->wiphy->max_scan_ssids = 1;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/3] mac80211: refactor dynamic power save check
2009-10-27 15:36 [PATCH v2 1/3] mac80211: refactor dynamic power save check Kalle Valo
2009-10-27 15:36 ` [PATCH v2 2/3] mac80211: fix dynamic power save for devices with nullfunc support in hw Kalle Valo
2009-10-27 15:36 ` [PATCH v2 3/3] wl1251: enable power save Kalle Valo
@ 2009-10-27 16:07 ` Johannes Berg
2 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2009-10-27 16:07 UTC (permalink / raw)
To: Kalle Valo; +Cc: linville, linux-wireless
On Tue, 2009-10-27 at 17:36 +0200, Kalle Valo wrote:
> From: Kalle Valo <kalle.valo@nokia.com>
>
> Refactor dynamic power save checks to a function of it's own for better
> readibility. No functional changes.
>
> Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
> ---
>
> net/mac80211/tx.c | 24 +++++++++++++++++++++---
> 1 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index db4bda6..c59ed84 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -1387,6 +1387,26 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
> return 0;
> }
>
> +static bool need_dynamic_ps(struct ieee80211_local *local)
> +{
> + /* driver doesn't support power save */
> + if (!(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
> + return false;
> +
> + /* dynamic power save disabled */
> + if (local->hw.conf.dynamic_ps_timeout <= 0)
> + return false;
> +
> + /* we are scanning, don't enable power save */
> + if (local->scanning)
> + return false;
> +
> + if (!local->ps_sdata)
> + return false;
> +
> + return true;
> +}
> +
> static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
> struct sk_buff *skb)
> {
> @@ -1399,9 +1419,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
>
> dev_hold(sdata->dev);
>
> - if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) &&
> - local->hw.conf.dynamic_ps_timeout > 0 &&
> - !(local->scanning) && local->ps_sdata) {
> + if (need_dynamic_ps(local)) {
> if (local->hw.conf.flags & IEEE80211_CONF_PS) {
> ieee80211_stop_queues_by_reason(&local->hw,
> IEEE80211_QUEUE_STOP_REASON_PS);
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/3] mac80211: fix dynamic power save for devices with nullfunc support in hw
2009-10-27 15:36 ` [PATCH v2 2/3] mac80211: fix dynamic power save for devices with nullfunc support in hw Kalle Valo
@ 2009-10-27 16:08 ` Johannes Berg
2009-10-27 16:18 ` Kalle Valo
0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2009-10-27 16:08 UTC (permalink / raw)
To: Kalle Valo; +Cc: linville, linux-wireless
On Tue, 2009-10-27 at 17:36 +0200, Kalle Valo wrote:
> From: Kalle Valo <kalle.valo@nokia.com>
>
> In TX path it was assumed that dynamic power save works only if
> IEEE80211_HW_PS_NULLFUNC_STACK is set. But is not the case, there are
> devices which have nullfunc support in hardware but need mac80211
> to handle dynamic power save timers, TI's wl1251 is one of them.
>
> The fix is to not check for IEEE80211_HW_PS_NULLFUNC_STACK in
> is_dynamic_ps_enabled(), instead check IEEE80211_HW_SUPPORTS_PS and
> IEEE80211_HW_SUPPORTS_DYNAMIC_PS flags and act accordingly.
>
> Tested with wl1251.
>
> Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
> ---
>
> net/mac80211/tx.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index c59ed84..66dab40 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -1390,7 +1390,11 @@ static int ieee80211_skb_resize(struct ieee80211_local *local,
> static bool need_dynamic_ps(struct ieee80211_local *local)
> {
> /* driver doesn't support power save */
> - if (!(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
> + if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
> + return false;
> +
> + /* hardware does dynamic power save */
> + if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)
> return false;
>
> /* dynamic power save disabled */
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/3] mac80211: fix dynamic power save for devices with nullfunc support in hw
2009-10-27 16:08 ` Johannes Berg
@ 2009-10-27 16:18 ` Kalle Valo
0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2009-10-27 16:18 UTC (permalink / raw)
To: Johannes Berg; +Cc: linville, linux-wireless
Johannes Berg <johannes@sipsolutions.net> writes:
> On Tue, 2009-10-27 at 17:36 +0200, Kalle Valo wrote:
>> From: Kalle Valo <kalle.valo@nokia.com>
>>
>> In TX path it was assumed that dynamic power save works only if
>> IEEE80211_HW_PS_NULLFUNC_STACK is set. But is not the case, there are
>> devices which have nullfunc support in hardware but need mac80211
>> to handle dynamic power save timers, TI's wl1251 is one of them.
>>
>> The fix is to not check for IEEE80211_HW_PS_NULLFUNC_STACK in
>> is_dynamic_ps_enabled(), instead check IEEE80211_HW_SUPPORTS_PS and
>> IEEE80211_HW_SUPPORTS_DYNAMIC_PS flags and act accordingly.
>>
>> Tested with wl1251.
>>
>> Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
>
> Acked-by: Johannes Berg <johannes@sipsolutions.net>
Thanks!
For the record, I sent v1 back in August:
http://www.spinics.net/lists/linux-wireless/msg37717.html
Better late than ever :)
--
Kalle Valo
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-10-27 16:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-27 15:36 [PATCH v2 1/3] mac80211: refactor dynamic power save check Kalle Valo
2009-10-27 15:36 ` [PATCH v2 2/3] mac80211: fix dynamic power save for devices with nullfunc support in hw Kalle Valo
2009-10-27 16:08 ` Johannes Berg
2009-10-27 16:18 ` Kalle Valo
2009-10-27 15:36 ` [PATCH v2 3/3] wl1251: enable power save Kalle Valo
2009-10-27 16:07 ` [PATCH v2 1/3] mac80211: refactor dynamic power save check Johannes Berg
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).