Skip to content

Commit

Permalink
mac80211: further optimise buffer expiry timer
Browse files Browse the repository at this point in the history
Juuso optimised the timer to not run all the
time in commit 3393a60.
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: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Sep 14, 2011
1 parent 0eff8fc commit cd0b8d8
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,14 +691,13 @@ void sta_info_clear_tim_bit(struct sta_info *sta)
spin_unlock_irqrestore(&sta->local->sta_lock, flags);
}

static int sta_info_buffer_expired(struct sta_info *sta,
struct sk_buff *skb)
static bool sta_info_buffer_expired(struct sta_info *sta, struct sk_buff *skb)
{
struct ieee80211_tx_info *info;
int timeout;

if (!skb)
return 0;
return false;

info = IEEE80211_SKB_CB(skb);

Expand All @@ -718,9 +717,6 @@ static bool sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
unsigned long flags;
struct sk_buff *skb;

if (skb_queue_empty(&sta->ps_tx_buf))
return false;

for (;;) {
spin_lock_irqsave(&sta->ps_tx_buf.lock, flags);
skb = skb_peek(&sta->ps_tx_buf);
Expand All @@ -745,7 +741,7 @@ static bool sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
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)
Expand Down

0 comments on commit cd0b8d8

Please sign in to comment.