aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2008-12-18 16:35:27 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-19 15:24:00 -0500
commit520eb82076993b7f55ef9b80771d264272e5127b (patch)
treef98b74dbe404d4c3a55b5f649c25ca24958e62ba /net/mac80211/tx.c
parentce7c9111a97492d04c504f40736a669c235d664a (diff)
mac80211: implement dynamic power save
This patch implements dynamic power save for mac80211. Basically it means enabling power save mode after an idle period. Implementing it dynamically gives a good compromise of low power consumption and low latency. Some hardware have support for this in firmware, but some require the host to do it. The dynamic power save is implemented by adding an timeout to ieee80211_subif_start_xmit(). The timeout can be enabled from userspace with Wireless Extensions. For example, the command below enables the dynamic power save and sets the time timeout to 500 ms: iwconfig wlan0 power timeout 500m Power save now only works with devices which handle power save in firmware. It's also disabled by default and the heuristics when and how to enable is considered as a policy decision and will be left for the userspace to handle. In case the firmware has support for this, drivers can disable this feature with IEEE80211_HW_NO_STACK_DYNAMIC_PS. Big thanks to Johannes Berg for the help with the design and code. Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index b098c58d216f..a4af3a124cce 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1473,6 +1473,19 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1473 goto fail; 1473 goto fail;
1474 } 1474 }
1475 1475
1476 if (!(local->hw.flags & IEEE80211_HW_NO_STACK_DYNAMIC_PS) &&
1477 local->dynamic_ps_timeout > 0) {
1478 if (local->hw.conf.flags & IEEE80211_CONF_PS) {
1479 ieee80211_stop_queues_by_reason(&local->hw,
1480 IEEE80211_QUEUE_STOP_REASON_PS);
1481 queue_work(local->hw.workqueue,
1482 &local->dynamic_ps_disable_work);
1483 }
1484
1485 mod_timer(&local->dynamic_ps_timer, jiffies +
1486 msecs_to_jiffies(local->dynamic_ps_timeout));
1487 }
1488
1476 nh_pos = skb_network_header(skb) - skb->data; 1489 nh_pos = skb_network_header(skb) - skb->data;
1477 h_pos = skb_transport_header(skb) - skb->data; 1490 h_pos = skb_transport_header(skb) - skb->data;
1478 1491