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

mac80211: remove sta TIM flag, fix expiry TIM handling

The TIM flag that is kept in each station's info is completely
useless, there's no code (aside from the debugfs display code)
checking it, hence it can be removed. While doing that, I noticed
that the TIM handling is broken when buffered frames expire, so
fix that.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d2259243
...@@ -74,11 +74,10 @@ static ssize_t sta_flags_read(struct file *file, char __user *userbuf, ...@@ -74,11 +74,10 @@ static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
{ {
char buf[100]; char buf[100];
struct sta_info *sta = file->private_data; struct sta_info *sta = file->private_data;
int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s", int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s",
sta->flags & WLAN_STA_AUTH ? "AUTH\n" : "", sta->flags & WLAN_STA_AUTH ? "AUTH\n" : "",
sta->flags & WLAN_STA_ASSOC ? "ASSOC\n" : "", sta->flags & WLAN_STA_ASSOC ? "ASSOC\n" : "",
sta->flags & WLAN_STA_PS ? "PS\n" : "", sta->flags & WLAN_STA_PS ? "PS\n" : "",
sta->flags & WLAN_STA_TIM ? "TIM\n" : "",
sta->flags & WLAN_STA_AUTHORIZED ? "AUTHORIZED\n" : "", sta->flags & WLAN_STA_AUTHORIZED ? "AUTHORIZED\n" : "",
sta->flags & WLAN_STA_SHORT_PREAMBLE ? "SHORT PREAMBLE\n" : "", sta->flags & WLAN_STA_SHORT_PREAMBLE ? "SHORT PREAMBLE\n" : "",
sta->flags & WLAN_STA_WME ? "WME\n" : "", sta->flags & WLAN_STA_WME ? "WME\n" : "",
......
...@@ -598,7 +598,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta) ...@@ -598,7 +598,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
if (sdata->bss) if (sdata->bss)
atomic_dec(&sdata->bss->num_sta_ps); atomic_dec(&sdata->bss->num_sta_ps);
sta->flags &= ~(WLAN_STA_PS | WLAN_STA_TIM | WLAN_STA_PSPOLL); sta->flags &= ~(WLAN_STA_PS | WLAN_STA_PSPOLL);
if (!skb_queue_empty(&sta->ps_tx_buf)) { if (!skb_queue_empty(&sta->ps_tx_buf)) {
if (sdata->bss) if (sdata->bss)
bss_tim_clear(local, sdata->bss, sta->aid); bss_tim_clear(local, sdata->bss, sta->aid);
...@@ -938,10 +938,9 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx) ...@@ -938,10 +938,9 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
/* Use MoreData flag to indicate whether there are more /* Use MoreData flag to indicate whether there are more
* buffered frames for this STA */ * buffered frames for this STA */
if (no_pending_pkts) { if (no_pending_pkts)
hdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREDATA); hdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREDATA);
rx->sta->flags &= ~WLAN_STA_TIM; else
} else
hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA); hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
dev_queue_xmit(skb); dev_queue_xmit(skb);
......
...@@ -286,6 +286,7 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local, ...@@ -286,6 +286,7 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
{ {
unsigned long flags; unsigned long flags;
struct sk_buff *skb; struct sk_buff *skb;
struct ieee80211_sub_if_data *sdata;
DECLARE_MAC_BUF(mac); DECLARE_MAC_BUF(mac);
if (skb_queue_empty(&sta->ps_tx_buf)) if (skb_queue_empty(&sta->ps_tx_buf))
...@@ -294,21 +295,28 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local, ...@@ -294,21 +295,28 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
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);
if (sta_info_buffer_expired(local, sta, skb)) { if (sta_info_buffer_expired(local, sta, skb))
skb = __skb_dequeue(&sta->ps_tx_buf); skb = __skb_dequeue(&sta->ps_tx_buf);
if (skb_queue_empty(&sta->ps_tx_buf)) else
sta->flags &= ~WLAN_STA_TIM;
} else
skb = NULL; skb = NULL;
spin_unlock_irqrestore(&sta->ps_tx_buf.lock, flags); spin_unlock_irqrestore(&sta->ps_tx_buf.lock, flags);
if (skb) { if (!skb)
break;
sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
local->total_ps_buffered--; local->total_ps_buffered--;
printk(KERN_DEBUG "Buffered frame expired (STA " printk(KERN_DEBUG "Buffered frame expired (STA "
"%s)\n", print_mac(mac, sta->addr)); "%s)\n", print_mac(mac, sta->addr));
dev_kfree_skb(skb); dev_kfree_skb(skb);
} else
break; if (skb_queue_empty(&sta->ps_tx_buf)) {
if (sdata->bss)
bss_tim_set(sta->local, sdata->bss, sta->aid);
if (sta->local->ops->set_tim)
sta->local->ops->set_tim(local_to_hw(sta->local),
sta->aid, 0);
}
} }
} }
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
* @WLAN_STA_AUTH: Station is authenticated. * @WLAN_STA_AUTH: Station is authenticated.
* @WLAN_STA_ASSOC: Station is associated. * @WLAN_STA_ASSOC: Station is associated.
* @WLAN_STA_PS: Station is in power-save mode * @WLAN_STA_PS: Station is in power-save mode
* @WLAN_STA_TIM: TIM bit is on for this PS station (traffic buffered)
* @WLAN_STA_AUTHORIZED: Station is authorized to send/receive traffic. * @WLAN_STA_AUTHORIZED: Station is authorized to send/receive traffic.
* This bit is always checked so needs to be enabled for all stations * This bit is always checked so needs to be enabled for all stations
* when virtual port control is not in use. * when virtual port control is not in use.
...@@ -38,13 +37,12 @@ enum ieee80211_sta_info_flags { ...@@ -38,13 +37,12 @@ enum ieee80211_sta_info_flags {
WLAN_STA_AUTH = 1<<0, WLAN_STA_AUTH = 1<<0,
WLAN_STA_ASSOC = 1<<1, WLAN_STA_ASSOC = 1<<1,
WLAN_STA_PS = 1<<2, WLAN_STA_PS = 1<<2,
WLAN_STA_TIM = 1<<3, WLAN_STA_AUTHORIZED = 1<<3,
WLAN_STA_AUTHORIZED = 1<<4, WLAN_STA_SHORT_PREAMBLE = 1<<4,
WLAN_STA_SHORT_PREAMBLE = 1<<5, WLAN_STA_ASSOC_AP = 1<<5,
WLAN_STA_ASSOC_AP = 1<<6, WLAN_STA_WME = 1<<6,
WLAN_STA_WME = 1<<7, WLAN_STA_WDS = 1<<7,
WLAN_STA_WDS = 1<<8, WLAN_STA_PSPOLL = 1<<8,
WLAN_STA_PSPOLL = 1<<9,
}; };
#define STA_TID_NUM 16 #define STA_TID_NUM 16
......
...@@ -404,7 +404,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx) ...@@ -404,7 +404,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx)
print_mac(mac, sta->addr), sta->aid, print_mac(mac, sta->addr), sta->aid,
skb_queue_len(&sta->ps_tx_buf)); skb_queue_len(&sta->ps_tx_buf));
#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
sta->flags |= WLAN_STA_TIM;
if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
purge_old_ps_buffers(tx->local); purge_old_ps_buffers(tx->local);
if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) { if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) {
......
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