aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-02-19 20:07:21 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:37:26 -0500
commit836341a70471ba77657b0b420dd7eea3c30a038b (patch)
treef27af297dd49c1aa5d6df3cd496b8b5fb7e43c2a /net/mac80211
parentd2259243a19894eee06c16e278adfea81dc42bd9 (diff)
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: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/debugfs_sta.c3
-rw-r--r--net/mac80211/rx.c7
-rw-r--r--net/mac80211/sta_info.c28
-rw-r--r--net/mac80211/sta_info.h14
-rw-r--r--net/mac80211/tx.c1
5 files changed, 28 insertions, 25 deletions
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index ac61353ae7ce..47db0d4aa433 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -74,11 +74,10 @@ static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
74{ 74{
75 char buf[100]; 75 char buf[100];
76 struct sta_info *sta = file->private_data; 76 struct sta_info *sta = file->private_data;
77 int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s", 77 int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s",
78 sta->flags & WLAN_STA_AUTH ? "AUTH\n" : "", 78 sta->flags & WLAN_STA_AUTH ? "AUTH\n" : "",
79 sta->flags & WLAN_STA_ASSOC ? "ASSOC\n" : "", 79 sta->flags & WLAN_STA_ASSOC ? "ASSOC\n" : "",
80 sta->flags & WLAN_STA_PS ? "PS\n" : "", 80 sta->flags & WLAN_STA_PS ? "PS\n" : "",
81 sta->flags & WLAN_STA_TIM ? "TIM\n" : "",
82 sta->flags & WLAN_STA_AUTHORIZED ? "AUTHORIZED\n" : "", 81 sta->flags & WLAN_STA_AUTHORIZED ? "AUTHORIZED\n" : "",
83 sta->flags & WLAN_STA_SHORT_PREAMBLE ? "SHORT PREAMBLE\n" : "", 82 sta->flags & WLAN_STA_SHORT_PREAMBLE ? "SHORT PREAMBLE\n" : "",
84 sta->flags & WLAN_STA_WME ? "WME\n" : "", 83 sta->flags & WLAN_STA_WME ? "WME\n" : "",
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index af606f715016..0e8a371496b3 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -598,7 +598,7 @@ static int ap_sta_ps_end(struct net_device *dev, struct sta_info *sta)
598 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); 598 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
599 if (sdata->bss) 599 if (sdata->bss)
600 atomic_dec(&sdata->bss->num_sta_ps); 600 atomic_dec(&sdata->bss->num_sta_ps);
601 sta->flags &= ~(WLAN_STA_PS | WLAN_STA_TIM | WLAN_STA_PSPOLL); 601 sta->flags &= ~(WLAN_STA_PS | WLAN_STA_PSPOLL);
602 if (!skb_queue_empty(&sta->ps_tx_buf)) { 602 if (!skb_queue_empty(&sta->ps_tx_buf)) {
603 if (sdata->bss) 603 if (sdata->bss)
604 bss_tim_clear(local, sdata->bss, sta->aid); 604 bss_tim_clear(local, sdata->bss, sta->aid);
@@ -938,10 +938,9 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
938 938
939 /* Use MoreData flag to indicate whether there are more 939 /* Use MoreData flag to indicate whether there are more
940 * buffered frames for this STA */ 940 * buffered frames for this STA */
941 if (no_pending_pkts) { 941 if (no_pending_pkts)
942 hdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREDATA); 942 hdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREDATA);
943 rx->sta->flags &= ~WLAN_STA_TIM; 943 else
944 } else
945 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA); 944 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_MOREDATA);
946 945
947 dev_queue_xmit(skb); 946 dev_queue_xmit(skb);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index cbe00979e444..a843bb7dd2d3 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -286,6 +286,7 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
286{ 286{
287 unsigned long flags; 287 unsigned long flags;
288 struct sk_buff *skb; 288 struct sk_buff *skb;
289 struct ieee80211_sub_if_data *sdata;
289 DECLARE_MAC_BUF(mac); 290 DECLARE_MAC_BUF(mac);
290 291
291 if (skb_queue_empty(&sta->ps_tx_buf)) 292 if (skb_queue_empty(&sta->ps_tx_buf))
@@ -294,21 +295,28 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
294 for (;;) { 295 for (;;) {
295 spin_lock_irqsave(&sta->ps_tx_buf.lock, flags); 296 spin_lock_irqsave(&sta->ps_tx_buf.lock, flags);
296 skb = skb_peek(&sta->ps_tx_buf); 297 skb = skb_peek(&sta->ps_tx_buf);
297 if (sta_info_buffer_expired(local, sta, skb)) { 298 if (sta_info_buffer_expired(local, sta, skb))
298 skb = __skb_dequeue(&sta->ps_tx_buf); 299 skb = __skb_dequeue(&sta->ps_tx_buf);
299 if (skb_queue_empty(&sta->ps_tx_buf)) 300 else
300 sta->flags &= ~WLAN_STA_TIM;
301 } else
302 skb = NULL; 301 skb = NULL;
303 spin_unlock_irqrestore(&sta->ps_tx_buf.lock, flags); 302 spin_unlock_irqrestore(&sta->ps_tx_buf.lock, flags);
304 303
305 if (skb) { 304 if (!skb)
306 local->total_ps_buffered--;
307 printk(KERN_DEBUG "Buffered frame expired (STA "
308 "%s)\n", print_mac(mac, sta->addr));
309 dev_kfree_skb(skb);
310 } else
311 break; 305 break;
306
307 sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev);
308 local->total_ps_buffered--;
309 printk(KERN_DEBUG "Buffered frame expired (STA "
310 "%s)\n", print_mac(mac, sta->addr));
311 dev_kfree_skb(skb);
312
313 if (skb_queue_empty(&sta->ps_tx_buf)) {
314 if (sdata->bss)
315 bss_tim_set(sta->local, sdata->bss, sta->aid);
316 if (sta->local->ops->set_tim)
317 sta->local->ops->set_tim(local_to_hw(sta->local),
318 sta->aid, 0);
319 }
312 } 320 }
313} 321}
314 322
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index ca51d29b7008..f3d9f872db4a 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -23,7 +23,6 @@
23 * @WLAN_STA_AUTH: Station is authenticated. 23 * @WLAN_STA_AUTH: Station is authenticated.
24 * @WLAN_STA_ASSOC: Station is associated. 24 * @WLAN_STA_ASSOC: Station is associated.
25 * @WLAN_STA_PS: Station is in power-save mode 25 * @WLAN_STA_PS: Station is in power-save mode
26 * @WLAN_STA_TIM: TIM bit is on for this PS station (traffic buffered)
27 * @WLAN_STA_AUTHORIZED: Station is authorized to send/receive traffic. 26 * @WLAN_STA_AUTHORIZED: Station is authorized to send/receive traffic.
28 * This bit is always checked so needs to be enabled for all stations 27 * This bit is always checked so needs to be enabled for all stations
29 * when virtual port control is not in use. 28 * when virtual port control is not in use.
@@ -38,13 +37,12 @@ enum ieee80211_sta_info_flags {
38 WLAN_STA_AUTH = 1<<0, 37 WLAN_STA_AUTH = 1<<0,
39 WLAN_STA_ASSOC = 1<<1, 38 WLAN_STA_ASSOC = 1<<1,
40 WLAN_STA_PS = 1<<2, 39 WLAN_STA_PS = 1<<2,
41 WLAN_STA_TIM = 1<<3, 40 WLAN_STA_AUTHORIZED = 1<<3,
42 WLAN_STA_AUTHORIZED = 1<<4, 41 WLAN_STA_SHORT_PREAMBLE = 1<<4,
43 WLAN_STA_SHORT_PREAMBLE = 1<<5, 42 WLAN_STA_ASSOC_AP = 1<<5,
44 WLAN_STA_ASSOC_AP = 1<<6, 43 WLAN_STA_WME = 1<<6,
45 WLAN_STA_WME = 1<<7, 44 WLAN_STA_WDS = 1<<7,
46 WLAN_STA_WDS = 1<<8, 45 WLAN_STA_PSPOLL = 1<<8,
47 WLAN_STA_PSPOLL = 1<<9,
48}; 46};
49 47
50#define STA_TID_NUM 16 48#define STA_TID_NUM 16
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 82474a8f251b..db6a871b51ed 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -404,7 +404,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx)
404 print_mac(mac, sta->addr), sta->aid, 404 print_mac(mac, sta->addr), sta->aid,
405 skb_queue_len(&sta->ps_tx_buf)); 405 skb_queue_len(&sta->ps_tx_buf));
406#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ 406#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
407 sta->flags |= WLAN_STA_TIM;
408 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) 407 if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER)
409 purge_old_ps_buffers(tx->local); 408 purge_old_ps_buffers(tx->local);
410 if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) { 409 if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) {