Commit cd0b8d89 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: further optimise buffer expiry timer

Juuso optimised the timer to not run all the
time in commit 3393a608.
However, after that it will still run once
more even if all frames just expired. Fixing
that also makes the function return value a
little clearer in the process.

Also, while at it, change the return value
to bool (instead of int).

Cc: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 0eff8fcd
...@@ -691,14 +691,13 @@ void sta_info_clear_tim_bit(struct sta_info *sta) ...@@ -691,14 +691,13 @@ void sta_info_clear_tim_bit(struct sta_info *sta)
spin_unlock_irqrestore(&sta->local->sta_lock, flags); spin_unlock_irqrestore(&sta->local->sta_lock, flags);
} }
static int sta_info_buffer_expired(struct sta_info *sta, static bool sta_info_buffer_expired(struct sta_info *sta, struct sk_buff *skb)
struct sk_buff *skb)
{ {
struct ieee80211_tx_info *info; struct ieee80211_tx_info *info;
int timeout; int timeout;
if (!skb) if (!skb)
return 0; return false;
info = IEEE80211_SKB_CB(skb); info = IEEE80211_SKB_CB(skb);
...@@ -718,9 +717,6 @@ static bool sta_info_cleanup_expire_buffered(struct ieee80211_local *local, ...@@ -718,9 +717,6 @@ static bool sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
unsigned long flags; unsigned long flags;
struct sk_buff *skb; struct sk_buff *skb;
if (skb_queue_empty(&sta->ps_tx_buf))
return false;
for (;;) { for (;;) {
spin_lock_irqsave(&sta->ps_tx_buf.lock, flags); spin_lock_irqsave(&sta->ps_tx_buf.lock, flags);
skb = skb_peek(&sta->ps_tx_buf); skb = skb_peek(&sta->ps_tx_buf);
...@@ -745,7 +741,7 @@ static bool sta_info_cleanup_expire_buffered(struct ieee80211_local *local, ...@@ -745,7 +741,7 @@ static bool sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
sta_info_clear_tim_bit(sta); sta_info_clear_tim_bit(sta);
} }
return true; return !skb_queue_empty(&sta->ps_tx_buf);
} }
static int __must_check __sta_info_destroy(struct sta_info *sta) static int __must_check __sta_info_destroy(struct sta_info *sta)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment