diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-01-07 12:28:20 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:59:58 -0500 |
commit | 4be8c3873e0b88397866d3ede578503e188f9ad2 (patch) | |
tree | 1ccf8a0c204bb01aca08d90c2d8c37b5e0439bd3 /net | |
parent | acbaf32e94cb70218792cac68e5149e482e77441 (diff) |
mac80211: extend/document powersave API
This modifies hardware flags for powersave to support three different
flags:
* IEEE80211_HW_SUPPORTS_PS - indicates general PS support
* IEEE80211_HW_PS_NULLFUNC_STACK - indicates nullfunc sending in software
* IEEE80211_HW_SUPPORTS_DYNAMIC_PS - indicates dynamic PS on the device
It also adds documentation for all this which explains how to set the
various flags.
Additionally, it fixes a few things:
* a spot where && was used to test flags
* enable CONF_PS only when associated again
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/mlme.c | 31 | ||||
-rw-r--r-- | net/mac80211/tx.c | 2 | ||||
-rw-r--r-- | net/mac80211/wext.c | 40 |
3 files changed, 40 insertions, 33 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 7709e7645671..a1e683e305f0 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -775,17 +775,17 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, | |||
775 | bss_info_changed |= BSS_CHANGED_BASIC_RATES; | 775 | bss_info_changed |= BSS_CHANGED_BASIC_RATES; |
776 | ieee80211_bss_info_change_notify(sdata, bss_info_changed); | 776 | ieee80211_bss_info_change_notify(sdata, bss_info_changed); |
777 | 777 | ||
778 | if (local->powersave && | 778 | if (local->powersave) { |
779 | !(local->hw.flags & IEEE80211_HW_NO_STACK_DYNAMIC_PS)) { | 779 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) && |
780 | if (local->hw.conf.dynamic_ps_timeout > 0) | 780 | local->hw.conf.dynamic_ps_timeout > 0) { |
781 | mod_timer(&local->dynamic_ps_timer, jiffies + | 781 | mod_timer(&local->dynamic_ps_timer, jiffies + |
782 | msecs_to_jiffies( | 782 | msecs_to_jiffies( |
783 | local->hw.conf.dynamic_ps_timeout)); | 783 | local->hw.conf.dynamic_ps_timeout)); |
784 | else { | 784 | } else { |
785 | ieee80211_send_nullfunc(local, sdata, 1); | 785 | if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) |
786 | ieee80211_send_nullfunc(local, sdata, 1); | ||
786 | conf->flags |= IEEE80211_CONF_PS; | 787 | conf->flags |= IEEE80211_CONF_PS; |
787 | ieee80211_hw_config(local, | 788 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
788 | IEEE80211_CONF_CHANGE_PS); | ||
789 | } | 789 | } |
790 | } | 790 | } |
791 | 791 | ||
@@ -1779,16 +1779,14 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1779 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, | 1779 | ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param, |
1780 | elems.wmm_param_len); | 1780 | elems.wmm_param_len); |
1781 | 1781 | ||
1782 | if (!(local->hw.flags & IEEE80211_HW_NO_STACK_DYNAMIC_PS)) { | 1782 | if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK && |
1783 | local->hw.conf.flags & IEEE80211_CONF_PS) { | ||
1783 | directed_tim = check_tim(&elems, ifsta->aid, &is_mc); | 1784 | directed_tim = check_tim(&elems, ifsta->aid, &is_mc); |
1784 | 1785 | ||
1785 | if (directed_tim || is_mc) { | 1786 | if (directed_tim || is_mc) { |
1786 | if (local->hw.conf.flags && IEEE80211_CONF_PS) { | 1787 | local->hw.conf.flags &= ~IEEE80211_CONF_PS; |
1787 | local->hw.conf.flags &= ~IEEE80211_CONF_PS; | 1788 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
1788 | ieee80211_hw_config(local, | 1789 | ieee80211_send_nullfunc(local, sdata, 0); |
1789 | IEEE80211_CONF_CHANGE_PS); | ||
1790 | ieee80211_send_nullfunc(local, sdata, 0); | ||
1791 | } | ||
1792 | } | 1790 | } |
1793 | } | 1791 | } |
1794 | 1792 | ||
@@ -2694,9 +2692,10 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work) | |||
2694 | if (local->hw.conf.flags & IEEE80211_CONF_PS) | 2692 | if (local->hw.conf.flags & IEEE80211_CONF_PS) |
2695 | return; | 2693 | return; |
2696 | 2694 | ||
2697 | ieee80211_send_nullfunc(local, sdata, 1); | 2695 | if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) |
2698 | local->hw.conf.flags |= IEEE80211_CONF_PS; | 2696 | ieee80211_send_nullfunc(local, sdata, 1); |
2699 | 2697 | ||
2698 | local->hw.conf.flags |= IEEE80211_CONF_PS; | ||
2700 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); | 2699 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
2701 | } | 2700 | } |
2702 | 2701 | ||
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index b18a72690119..cd6bc87eec73 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1295,7 +1295,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1295 | return 0; | 1295 | return 0; |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | if (!(local->hw.flags & IEEE80211_HW_NO_STACK_DYNAMIC_PS) && | 1298 | if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) && |
1299 | local->hw.conf.dynamic_ps_timeout > 0) { | 1299 | local->hw.conf.dynamic_ps_timeout > 0) { |
1300 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { | 1300 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { |
1301 | ieee80211_stop_queues_by_reason(&local->hw, | 1301 | ieee80211_stop_queues_by_reason(&local->hw, |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 3f2db0bda46c..1e5b29bdb3a7 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -837,6 +837,9 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev, | |||
837 | int ret = 0, timeout = 0; | 837 | int ret = 0, timeout = 0; |
838 | bool ps; | 838 | bool ps; |
839 | 839 | ||
840 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) | ||
841 | return -EOPNOTSUPP; | ||
842 | |||
840 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 843 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
841 | return -EINVAL; | 844 | return -EINVAL; |
842 | 845 | ||
@@ -862,32 +865,37 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev, | |||
862 | if (wrq->flags & IW_POWER_TIMEOUT) | 865 | if (wrq->flags & IW_POWER_TIMEOUT) |
863 | timeout = wrq->value / 1000; | 866 | timeout = wrq->value / 1000; |
864 | 867 | ||
865 | set: | 868 | set: |
866 | if (ps == local->powersave && timeout == conf->dynamic_ps_timeout) | 869 | if (ps == local->powersave && timeout == conf->dynamic_ps_timeout) |
867 | return ret; | 870 | return ret; |
868 | 871 | ||
869 | local->powersave = ps; | 872 | local->powersave = ps; |
870 | conf->dynamic_ps_timeout = timeout; | 873 | conf->dynamic_ps_timeout = timeout; |
871 | 874 | ||
872 | if (local->hw.flags & IEEE80211_HW_NO_STACK_DYNAMIC_PS) { | 875 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) |
873 | ret = ieee80211_hw_config(local, | 876 | ret = ieee80211_hw_config(local, |
874 | IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT); | 877 | IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT); |
875 | } else if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) { | 878 | |
876 | if (conf->dynamic_ps_timeout > 0) | 879 | if (!(sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED)) |
877 | mod_timer(&local->dynamic_ps_timer, jiffies + | 880 | return ret; |
878 | msecs_to_jiffies(conf->dynamic_ps_timeout)); | 881 | |
879 | else { | 882 | if (conf->dynamic_ps_timeout > 0 && |
880 | if (local->powersave) { | 883 | !(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)) { |
884 | mod_timer(&local->dynamic_ps_timer, jiffies + | ||
885 | msecs_to_jiffies(conf->dynamic_ps_timeout)); | ||
886 | } else { | ||
887 | if (local->powersave) { | ||
888 | if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) | ||
881 | ieee80211_send_nullfunc(local, sdata, 1); | 889 | ieee80211_send_nullfunc(local, sdata, 1); |
882 | conf->flags |= IEEE80211_CONF_PS; | 890 | conf->flags |= IEEE80211_CONF_PS; |
883 | ret = ieee80211_hw_config(local, | 891 | ret = ieee80211_hw_config(local, |
884 | IEEE80211_CONF_CHANGE_PS); | 892 | IEEE80211_CONF_CHANGE_PS); |
885 | } else { | 893 | } else { |
886 | conf->flags &= ~IEEE80211_CONF_PS; | 894 | conf->flags &= ~IEEE80211_CONF_PS; |
887 | ret = ieee80211_hw_config(local, | 895 | ret = ieee80211_hw_config(local, |
888 | IEEE80211_CONF_CHANGE_PS); | 896 | IEEE80211_CONF_CHANGE_PS); |
897 | if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) | ||
889 | ieee80211_send_nullfunc(local, sdata, 0); | 898 | ieee80211_send_nullfunc(local, sdata, 0); |
890 | } | ||
891 | } | 899 | } |
892 | } | 900 | } |
893 | 901 | ||