aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-23 10:10:04 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-06 15:14:33 -0400
commit57c4d7b4c4986037be51476b8e3025d5ba18d8b8 (patch)
treebcd24a127b4c79891f45799a20867f49c0f7f949 /net
parentf3b85252f081581a8f257545ed748062dce7798b (diff)
mac80211: clean up beacon interval settings
We currently have two beacon interval configuration knobs: hw.conf.beacon_int and vif.bss_info.beacon_int. This is rather confusing, even though the former is used when we beacon ourselves and the latter when we are associated to an AP. This just deprecates the hw.conf.beacon_int setting in favour of always using vif.bss_info.beacon_int. Since it touches all the beaconing IBSS code anyway, we can also add support for the cfg80211 IBSS beacon interval configuration easily. NOTE: The hw.conf.beacon_int setting is retained for now due to drivers still using it -- I couldn't untangle all drivers, some are updated in this patch. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/cfg.c17
-rw-r--r--net/mac80211/ibss.c25
-rw-r--r--net/mac80211/main.c17
-rw-r--r--net/mac80211/mlme.c1
-rw-r--r--net/mac80211/sta_info.c12
-rw-r--r--net/mac80211/tx.c2
6 files changed, 41 insertions, 33 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 5e1c230744b5..a898ccd3f2c9 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -451,18 +451,11 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
451 * This is a kludge. beacon interval should really be part 451 * This is a kludge. beacon interval should really be part
452 * of the beacon information. 452 * of the beacon information.
453 */ 453 */
454 if (params->interval && (sdata->local->hw.conf.beacon_int != 454 if (params->interval &&
455 params->interval)) { 455 (sdata->vif.bss_conf.beacon_int != params->interval)) {
456 sdata->local->hw.conf.beacon_int = params->interval; 456 sdata->vif.bss_conf.beacon_int = params->interval;
457 err = ieee80211_hw_config(sdata->local, 457 ieee80211_bss_info_change_notify(sdata,
458 IEEE80211_CONF_CHANGE_BEACON_INTERVAL); 458 BSS_CHANGED_BEACON_INT);
459 if (err < 0)
460 return err;
461 /*
462 * We updated some parameter so if below bails out
463 * it's not an error.
464 */
465 err = 0;
466 } 459 }
467 460
468 /* Need to have a beacon head if we don't have one yet */ 461 /* Need to have a beacon head if we don't have one yet */
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 25ff583612ef..f4879dad3cd7 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -73,6 +73,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
73 struct ieee80211_mgmt *mgmt; 73 struct ieee80211_mgmt *mgmt;
74 u8 *pos; 74 u8 *pos;
75 struct ieee80211_supported_band *sband; 75 struct ieee80211_supported_band *sband;
76 u32 bss_change;
76 77
77 if (local->ops->reset_tsf) { 78 if (local->ops->reset_tsf) {
78 /* Reset own TSF to allow time synchronization work. */ 79 /* Reset own TSF to allow time synchronization work. */
@@ -92,8 +93,6 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
92 93
93 memcpy(ifibss->bssid, bssid, ETH_ALEN); 94 memcpy(ifibss->bssid, bssid, ETH_ALEN);
94 95
95 local->hw.conf.beacon_int = beacon_int >= 10 ? beacon_int : 10;
96
97 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; 96 sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
98 97
99 ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID); 98 ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID);
@@ -101,6 +100,12 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
101 local->oper_channel = chan; 100 local->oper_channel = chan;
102 local->oper_channel_type = NL80211_CHAN_NO_HT; 101 local->oper_channel_type = NL80211_CHAN_NO_HT;
103 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 102 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
103
104 sdata->vif.bss_conf.beacon_int = beacon_int;
105 bss_change = BSS_CHANGED_BEACON_INT;
106 bss_change |= ieee80211_reset_erp_info(sdata);
107 ieee80211_bss_info_change_notify(sdata, bss_change);
108
104 sband = local->hw.wiphy->bands[chan->band]; 109 sband = local->hw.wiphy->bands[chan->band];
105 110
106 /* Build IBSS probe response */ 111 /* Build IBSS probe response */
@@ -111,7 +116,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
111 memset(mgmt->da, 0xff, ETH_ALEN); 116 memset(mgmt->da, 0xff, ETH_ALEN);
112 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); 117 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
113 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); 118 memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN);
114 mgmt->u.beacon.beacon_int = cpu_to_le16(local->hw.conf.beacon_int); 119 mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int);
115 mgmt->u.beacon.timestamp = cpu_to_le64(tsf); 120 mgmt->u.beacon.timestamp = cpu_to_le64(tsf);
116 mgmt->u.beacon.capab_info = cpu_to_le16(capability); 121 mgmt->u.beacon.capab_info = cpu_to_le16(capability);
117 122
@@ -181,8 +186,13 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
181static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, 186static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
182 struct ieee80211_bss *bss) 187 struct ieee80211_bss *bss)
183{ 188{
189 u16 beacon_int = bss->cbss.beacon_interval;
190
191 if (beacon_int < 10)
192 beacon_int = 10;
193
184 __ieee80211_sta_join_ibss(sdata, bss->cbss.bssid, 194 __ieee80211_sta_join_ibss(sdata, bss->cbss.bssid,
185 bss->cbss.beacon_interval, 195 beacon_int,
186 bss->cbss.channel, 196 bss->cbss.channel,
187 bss->supp_rates_len, bss->supp_rates, 197 bss->supp_rates_len, bss->supp_rates,
188 bss->cbss.capability, 198 bss->cbss.capability,
@@ -464,9 +474,6 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
464 474
465 sband = local->hw.wiphy->bands[ifibss->channel->band]; 475 sband = local->hw.wiphy->bands[ifibss->channel->band];
466 476
467 if (local->hw.conf.beacon_int == 0)
468 local->hw.conf.beacon_int = 100;
469
470 capability = WLAN_CAPABILITY_IBSS; 477 capability = WLAN_CAPABILITY_IBSS;
471 478
472 if (sdata->default_key) 479 if (sdata->default_key)
@@ -480,7 +487,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
480 *pos++ = (u8) (rate / 5); 487 *pos++ = (u8) (rate / 5);
481 } 488 }
482 489
483 __ieee80211_sta_join_ibss(sdata, bssid, local->hw.conf.beacon_int, 490 __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
484 ifibss->channel, sband->n_bitrates, 491 ifibss->channel, sband->n_bitrates,
485 supp_rates, capability, 0); 492 supp_rates, capability, 0);
486} 493}
@@ -823,6 +830,8 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
823 } else 830 } else
824 sdata->u.ibss.fixed_bssid = false; 831 sdata->u.ibss.fixed_bssid = false;
825 832
833 sdata->vif.bss_conf.beacon_int = params->beacon_interval;
834
826 sdata->u.ibss.channel = params->channel; 835 sdata->u.ibss.channel = params->channel;
827 sdata->u.ibss.fixed_channel = params->channel_fixed; 836 sdata->u.ibss.fixed_channel = params->channel_fixed;
828 837
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index e00d124e4ef7..b254879d8631 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -294,9 +294,6 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
294{ 294{
295 struct ieee80211_local *local = sdata->local; 295 struct ieee80211_local *local = sdata->local;
296 296
297 if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN))
298 return;
299
300 if (!changed) 297 if (!changed)
301 return; 298 return;
302 299
@@ -305,6 +302,17 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
305 &sdata->vif, 302 &sdata->vif,
306 &sdata->vif.bss_conf, 303 &sdata->vif.bss_conf,
307 changed); 304 changed);
305
306 /*
307 * DEPRECATED
308 *
309 * ~changed is just there to not do this at resume time
310 */
311 if (changed & BSS_CHANGED_BEACON_INT && ~changed) {
312 local->hw.conf.beacon_int = sdata->vif.bss_conf.beacon_int;
313 ieee80211_hw_config(local,
314 _IEEE80211_CONF_CHANGE_BEACON_INTERVAL);
315 }
308} 316}
309 317
310u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) 318u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
@@ -971,9 +979,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
971 979
972 debugfs_hw_add(local); 980 debugfs_hw_add(local);
973 981
974 if (local->hw.conf.beacon_int < 10)
975 local->hw.conf.beacon_int = 100;
976
977 if (local->hw.max_listen_interval == 0) 982 if (local->hw.max_listen_interval == 0)
978 local->hw.max_listen_interval = 1; 983 local->hw.max_listen_interval = 1;
979 984
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a2f5e6223059..bfd571e6f221 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -842,6 +842,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
842 sdata->vif.bss_conf.timestamp = bss->cbss.tsf; 842 sdata->vif.bss_conf.timestamp = bss->cbss.tsf;
843 sdata->vif.bss_conf.dtim_period = bss->dtim_period; 843 sdata->vif.bss_conf.dtim_period = bss->dtim_period;
844 844
845 bss_info_changed |= BSS_CHANGED_BEACON_INT;
845 bss_info_changed |= ieee80211_handle_bss_capability(sdata, 846 bss_info_changed |= ieee80211_handle_bss_capability(sdata,
846 bss->cbss.capability, bss->has_erp_value, bss->erp_value); 847 bss->cbss.capability, bss->has_erp_value, bss->erp_value);
847 848
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 654a8e963ccb..7116220d06be 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -543,9 +543,8 @@ void sta_info_unlink(struct sta_info **sta)
543 spin_unlock_irqrestore(&local->sta_lock, flags); 543 spin_unlock_irqrestore(&local->sta_lock, flags);
544} 544}
545 545
546static inline int sta_info_buffer_expired(struct ieee80211_local *local, 546static int sta_info_buffer_expired(struct sta_info *sta,
547 struct sta_info *sta, 547 struct sk_buff *skb)
548 struct sk_buff *skb)
549{ 548{
550 struct ieee80211_tx_info *info; 549 struct ieee80211_tx_info *info;
551 int timeout; 550 int timeout;
@@ -556,8 +555,9 @@ static inline int sta_info_buffer_expired(struct ieee80211_local *local,
556 info = IEEE80211_SKB_CB(skb); 555 info = IEEE80211_SKB_CB(skb);
557 556
558 /* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */ 557 /* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */
559 timeout = (sta->listen_interval * local->hw.conf.beacon_int * 32 / 558 timeout = (sta->listen_interval *
560 15625) * HZ; 559 sta->sdata->vif.bss_conf.beacon_int *
560 32 / 15625) * HZ;
561 if (timeout < STA_TX_BUFFER_EXPIRE) 561 if (timeout < STA_TX_BUFFER_EXPIRE)
562 timeout = STA_TX_BUFFER_EXPIRE; 562 timeout = STA_TX_BUFFER_EXPIRE;
563 return time_after(jiffies, info->control.jiffies + timeout); 563 return time_after(jiffies, info->control.jiffies + timeout);
@@ -577,7 +577,7 @@ static void sta_info_cleanup_expire_buffered(struct ieee80211_local *local,
577 for (;;) { 577 for (;;) {
578 spin_lock_irqsave(&sta->ps_tx_buf.lock, flags); 578 spin_lock_irqsave(&sta->ps_tx_buf.lock, flags);
579 skb = skb_peek(&sta->ps_tx_buf); 579 skb = skb_peek(&sta->ps_tx_buf);
580 if (sta_info_buffer_expired(local, sta, skb)) 580 if (sta_info_buffer_expired(sta, skb))
581 skb = __skb_dequeue(&sta->ps_tx_buf); 581 skb = __skb_dequeue(&sta->ps_tx_buf);
582 else 582 else
583 skb = NULL; 583 skb = NULL;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 1865622003c9..29df65045fc9 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2132,7 +2132,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
2132 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); 2132 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
2133 /* BSSID is left zeroed, wildcard value */ 2133 /* BSSID is left zeroed, wildcard value */
2134 mgmt->u.beacon.beacon_int = 2134 mgmt->u.beacon.beacon_int =
2135 cpu_to_le16(local->hw.conf.beacon_int); 2135 cpu_to_le16(sdata->vif.bss_conf.beacon_int);
2136 mgmt->u.beacon.capab_info = 0x0; /* 0x0 for MPs */ 2136 mgmt->u.beacon.capab_info = 0x0; /* 0x0 for MPs */
2137 2137
2138 pos = skb_put(skb, 2); 2138 pos = skb_put(skb, 2);