diff options
author | Kalle Valo <kalle.valo@nokia.com> | 2009-10-27 11:36:09 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-30 16:49:18 -0400 |
commit | ed620590de15021f6baf08ca098c90f47470efd7 (patch) | |
tree | 2d04e564a1b7d0559a62af1c652c49e09bd807ec /net | |
parent | 7bcfaf2f431c09c51fe776fc06638b25d3b421c5 (diff) |
mac80211: refactor dynamic power save check
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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r-- | 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 eaa4118de988..498cdd435d73 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -1387,6 +1387,26 @@ static int ieee80211_skb_resize(struct ieee80211_local *local, | |||
1387 | return 0; | 1387 | return 0; |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | static bool need_dynamic_ps(struct ieee80211_local *local) | ||
1391 | { | ||
1392 | /* driver doesn't support power save */ | ||
1393 | if (!(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)) | ||
1394 | return false; | ||
1395 | |||
1396 | /* dynamic power save disabled */ | ||
1397 | if (local->hw.conf.dynamic_ps_timeout <= 0) | ||
1398 | return false; | ||
1399 | |||
1400 | /* we are scanning, don't enable power save */ | ||
1401 | if (local->scanning) | ||
1402 | return false; | ||
1403 | |||
1404 | if (!local->ps_sdata) | ||
1405 | return false; | ||
1406 | |||
1407 | return true; | ||
1408 | } | ||
1409 | |||
1390 | static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, | 1410 | static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, |
1391 | struct sk_buff *skb) | 1411 | struct sk_buff *skb) |
1392 | { | 1412 | { |
@@ -1399,9 +1419,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, | |||
1399 | 1419 | ||
1400 | dev_hold(sdata->dev); | 1420 | dev_hold(sdata->dev); |
1401 | 1421 | ||
1402 | if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) && | 1422 | if (need_dynamic_ps(local)) { |
1403 | local->hw.conf.dynamic_ps_timeout > 0 && | ||
1404 | !(local->scanning) && local->ps_sdata) { | ||
1405 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { | 1423 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { |
1406 | ieee80211_stop_queues_by_reason(&local->hw, | 1424 | ieee80211_stop_queues_by_reason(&local->hw, |
1407 | IEEE80211_QUEUE_STOP_REASON_PS); | 1425 | IEEE80211_QUEUE_STOP_REASON_PS); |