aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/net/wireless/ath/ar9170/mac.c6
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c5
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/ath9k.h2
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c9
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c22
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c2
-rw-r--r--drivers/net/wireless/b43/main.c12
-rw-r--r--drivers/net/wireless/b43legacy/main.c10
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c5
-rw-r--r--drivers/net/wireless/libertas_tf/main.c2
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c20
-rw-r--r--include/net/mac80211.h14
-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
21 files changed, 112 insertions, 82 deletions
diff --git a/drivers/net/wireless/ath/ar9170/mac.c b/drivers/net/wireless/ath/ar9170/mac.c
index c8fa3073169f..0e5967dd119c 100644
--- a/drivers/net/wireless/ath/ar9170/mac.c
+++ b/drivers/net/wireless/ath/ar9170/mac.c
@@ -316,9 +316,9 @@ int ar9170_set_beacon_timers(struct ar9170 *ar)
316 u32 v = 0; 316 u32 v = 0;
317 u32 pretbtt = 0; 317 u32 pretbtt = 0;
318 318
319 v |= ar->hw->conf.beacon_int;
320
321 if (ar->vif) { 319 if (ar->vif) {
320 v |= ar->vif->bss_conf.beacon_int;
321
322 switch (ar->vif->type) { 322 switch (ar->vif->type) {
323 case NL80211_IFTYPE_MESH_POINT: 323 case NL80211_IFTYPE_MESH_POINT:
324 case NL80211_IFTYPE_ADHOC: 324 case NL80211_IFTYPE_ADHOC:
@@ -326,7 +326,7 @@ int ar9170_set_beacon_timers(struct ar9170 *ar)
326 break; 326 break;
327 case NL80211_IFTYPE_AP: 327 case NL80211_IFTYPE_AP:
328 v |= BIT(24); 328 v |= BIT(24);
329 pretbtt = (ar->hw->conf.beacon_int - 6) << 16; 329 pretbtt = (ar->vif->bss_conf.beacon_int - 6) << 16;
330 break; 330 break;
331 default: 331 default:
332 break; 332 break;
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index 1b60906b80c9..49c729bc7147 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -1337,7 +1337,7 @@ static int ar9170_op_config(struct ieee80211_hw *hw, u32 changed)
1337 goto out; 1337 goto out;
1338 } 1338 }
1339 1339
1340 if (changed & IEEE80211_CONF_CHANGE_BEACON_INTERVAL) { 1340 if (changed & BSS_CHANGED_BEACON_INT) {
1341 err = ar9170_set_beacon_timers(ar); 1341 err = ar9170_set_beacon_timers(ar);
1342 if (err) 1342 if (err)
1343 goto out; 1343 goto out;
@@ -1499,6 +1499,9 @@ static void ar9170_op_bss_info_changed(struct ieee80211_hw *hw,
1499#endif /* CONFIG_AR9170_LEDS */ 1499#endif /* CONFIG_AR9170_LEDS */
1500 } 1500 }
1501 1501
1502 if (changed & BSS_CHANGED_BEACON_INT)
1503 err = ar9170_set_beacon_timers(ar);
1504
1502 if (changed & BSS_CHANGED_HT) { 1505 if (changed & BSS_CHANGED_HT) {
1503 /* TODO */ 1506 /* TODO */
1504 err = 0; 1507 err = 0;
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index c8c658bfcf9d..e4b1d9efa42e 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -2756,7 +2756,6 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
2756 2756
2757 mutex_lock(&sc->lock); 2757 mutex_lock(&sc->lock);
2758 2758
2759 sc->bintval = conf->beacon_int;
2760 sc->power_level = conf->power_level; 2759 sc->power_level = conf->power_level;
2761 2760
2762 ret = ath5k_chan_set(sc, conf->channel); 2761 ret = ath5k_chan_set(sc, conf->channel);
@@ -3083,6 +3082,10 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
3083 u32 changes) 3082 u32 changes)
3084{ 3083{
3085 struct ath5k_softc *sc = hw->priv; 3084 struct ath5k_softc *sc = hw->priv;
3085
3086 if (changes & BSS_CHANGED_BEACON_INT)
3087 sc->bintval = bss_conf->beacon_int;
3088
3086 if (changes & BSS_CHANGED_ASSOC) { 3089 if (changes & BSS_CHANGED_ASSOC) {
3087 mutex_lock(&sc->lock); 3090 mutex_lock(&sc->lock);
3088 sc->assoc = bss_conf->assoc; 3091 sc->assoc = bss_conf->assoc;
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index c92d46fa9d51..d5084ddf44ff 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -590,6 +590,8 @@ struct ath_softc {
590 int led_on_cnt; 590 int led_on_cnt;
591 int led_off_cnt; 591 int led_off_cnt;
592 592
593 int beacon_interval;
594
593 struct ath_rfkill rf_kill; 595 struct ath_rfkill rf_kill;
594 struct ath_ani ani; 596 struct ath_ani ani;
595 struct ath9k_node_stats nodestats; 597 struct ath9k_node_stats nodestats;
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index eb4759fc6a0d..c17b8382e328 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -320,8 +320,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
320 u64 tsfadjust; 320 u64 tsfadjust;
321 int intval; 321 int intval;
322 322
323 intval = sc->hw->conf.beacon_int ? 323 intval = sc->beacon_interval ? : ATH_DEFAULT_BINTVAL;
324 sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL;
325 324
326 /* 325 /*
327 * Calculate the TSF offset for this beacon slot, i.e., the 326 * Calculate the TSF offset for this beacon slot, i.e., the
@@ -431,8 +430,7 @@ void ath_beacon_tasklet(unsigned long data)
431 * on the tsf to safeguard against missing an swba. 430 * on the tsf to safeguard against missing an swba.
432 */ 431 */
433 432
434 intval = sc->hw->conf.beacon_int ? 433 intval = sc->beacon_interval ? : ATH_DEFAULT_BINTVAL;
435 sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL;
436 434
437 tsf = ath9k_hw_gettsf64(ah); 435 tsf = ath9k_hw_gettsf64(ah);
438 tsftu = TSF_TO_TU(tsf>>32, tsf); 436 tsftu = TSF_TO_TU(tsf>>32, tsf);
@@ -711,8 +709,7 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif)
711 /* Setup the beacon configuration parameters */ 709 /* Setup the beacon configuration parameters */
712 710
713 memset(&conf, 0, sizeof(struct ath_beacon_config)); 711 memset(&conf, 0, sizeof(struct ath_beacon_config));
714 conf.beacon_interval = sc->hw->conf.beacon_int ? 712 conf.beacon_interval = sc->beacon_interval ? : ATH_DEFAULT_BINTVAL;
715 sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL;
716 conf.listen_interval = 1; 713 conf.listen_interval = 1;
717 conf.dtim_period = conf.beacon_interval; 714 conf.dtim_period = conf.beacon_interval;
718 conf.dtim_count = 1; 715 conf.dtim_count = 1;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 2398d4f45f28..28cc9cd52f32 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2358,16 +2358,6 @@ skip_chan_change:
2358 if (changed & IEEE80211_CONF_CHANGE_POWER) 2358 if (changed & IEEE80211_CONF_CHANGE_POWER)
2359 sc->config.txpowlimit = 2 * conf->power_level; 2359 sc->config.txpowlimit = 2 * conf->power_level;
2360 2360
2361 /*
2362 * The HW TSF has to be reset when the beacon interval changes.
2363 * We set the flag here, and ath_beacon_config_ap() would take this
2364 * into account when it gets called through the subsequent
2365 * config_interface() call - with IFCC_BEACON in the changed field.
2366 */
2367
2368 if (changed & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
2369 sc->sc_flags |= SC_OP_TSF_RESET;
2370
2371 mutex_unlock(&sc->mutex); 2361 mutex_unlock(&sc->mutex);
2372 2362
2373 return 0; 2363 return 0;
@@ -2635,6 +2625,18 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2635 ath9k_bss_assoc_info(sc, vif, bss_conf); 2625 ath9k_bss_assoc_info(sc, vif, bss_conf);
2636 } 2626 }
2637 2627
2628 /*
2629 * The HW TSF has to be reset when the beacon interval changes.
2630 * We set the flag here, and ath_beacon_config_ap() would take this
2631 * into account when it gets called through the subsequent
2632 * config_interface() call - with IFCC_BEACON in the changed field.
2633 */
2634
2635 if (changed & BSS_CHANGED_BEACON_INT) {
2636 sc->sc_flags |= SC_OP_TSF_RESET;
2637 sc->beacon_interval = bss_conf->beacon_int;
2638 }
2639
2638 mutex_unlock(&sc->mutex); 2640 mutex_unlock(&sc->mutex);
2639} 2641}
2640 2642
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index faf2cab49ea3..501493ffc3a7 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -971,7 +971,7 @@ int ath_cabq_update(struct ath_softc *sc)
971 else if (sc->config.cabqReadytime > ATH9K_READY_TIME_HI_BOUND) 971 else if (sc->config.cabqReadytime > ATH9K_READY_TIME_HI_BOUND)
972 sc->config.cabqReadytime = ATH9K_READY_TIME_HI_BOUND; 972 sc->config.cabqReadytime = ATH9K_READY_TIME_HI_BOUND;
973 973
974 qi.tqi_readyTime = (sc->hw->conf.beacon_int * 974 qi.tqi_readyTime = (sc->beacon_interval *
975 sc->config.cabqReadytime) / 100; 975 sc->config.cabqReadytime) / 100;
976 ath_txq_update(sc, qnum, &qi); 976 ath_txq_update(sc, qnum, &qi);
977 977
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index a97c6ff0f12e..3c693e6ec904 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3468,11 +3468,6 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed)
3468 if (phy->ops->set_rx_antenna) 3468 if (phy->ops->set_rx_antenna)
3469 phy->ops->set_rx_antenna(dev, antenna); 3469 phy->ops->set_rx_antenna(dev, antenna);
3470 3470
3471 /* Update templates for AP/mesh mode. */
3472 if (b43_is_mode(wl, NL80211_IFTYPE_AP) ||
3473 b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT))
3474 b43_set_beacon_int(dev, conf->beacon_int);
3475
3476 if (!!conf->radio_enabled != phy->radio_on) { 3471 if (!!conf->radio_enabled != phy->radio_on) {
3477 if (conf->radio_enabled) { 3472 if (conf->radio_enabled) {
3478 b43_software_rfkill(dev, RFKILL_STATE_UNBLOCKED); 3473 b43_software_rfkill(dev, RFKILL_STATE_UNBLOCKED);
@@ -3556,6 +3551,13 @@ static void b43_op_bss_info_changed(struct ieee80211_hw *hw,
3556 goto out_unlock_mutex; 3551 goto out_unlock_mutex;
3557 b43_mac_suspend(dev); 3552 b43_mac_suspend(dev);
3558 3553
3554 /* Update templates for AP/mesh mode. */
3555 if (changed & BSS_CHANGED_BEACON_INT &&
3556 (b43_is_mode(wl, NL80211_IFTYPE_AP) ||
3557 b43_is_mode(wl, NL80211_IFTYPE_MESH_POINT) ||
3558 b43_is_mode(wl, NL80211_IFTYPE_ADHOC)))
3559 b43_set_beacon_int(dev, conf->beacon_int);
3560
3559 if (changed & BSS_CHANGED_BASIC_RATES) 3561 if (changed & BSS_CHANGED_BASIC_RATES)
3560 b43_update_basic_rates(dev, conf->basic_rates); 3562 b43_update_basic_rates(dev, conf->basic_rates);
3561 3563
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index ee202b4f77b5..276f314688f7 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2721,11 +2721,6 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw,
2721 /* Antennas for RX and management frame TX. */ 2721 /* Antennas for RX and management frame TX. */
2722 b43legacy_mgmtframe_txantenna(dev, antenna_tx); 2722 b43legacy_mgmtframe_txantenna(dev, antenna_tx);
2723 2723
2724 /* Update templates for AP mode. */
2725 if (b43legacy_is_mode(wl, NL80211_IFTYPE_AP))
2726 b43legacy_set_beacon_int(dev, conf->beacon_int);
2727
2728
2729 if (!!conf->radio_enabled != phy->radio_on) { 2724 if (!!conf->radio_enabled != phy->radio_on) {
2730 if (conf->radio_enabled) { 2725 if (conf->radio_enabled) {
2731 b43legacy_radio_turn_on(dev); 2726 b43legacy_radio_turn_on(dev);
@@ -2827,6 +2822,11 @@ static void b43legacy_op_bss_info_changed(struct ieee80211_hw *hw,
2827 2822
2828 b43legacy_mac_suspend(dev); 2823 b43legacy_mac_suspend(dev);
2829 2824
2825 if (changed & BSS_CHANGED_BEACON_INT &&
2826 (b43legacy_is_mode(wl, NL80211_IFTYPE_AP) ||
2827 b43legacy_is_mode(wl, NL80211_IFTYPE_ADHOC)))
2828 b43legacy_set_beacon_int(dev, conf->beacon_int);
2829
2830 if (changed & BSS_CHANGED_BASIC_RATES) 2830 if (changed & BSS_CHANGED_BASIC_RATES)
2831 b43legacy_update_basic_rates(dev, conf->basic_rates); 2831 b43legacy_update_basic_rates(dev, conf->basic_rates);
2832 2832
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 277dfc57fde9..4920dcf7d7b0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -567,7 +567,8 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
567 beacon_int = iwl_adjust_beacon_interval(priv->beacon_int); 567 beacon_int = iwl_adjust_beacon_interval(priv->beacon_int);
568 priv->rxon_timing.atim_window = 0; 568 priv->rxon_timing.atim_window = 0;
569 } else { 569 } else {
570 beacon_int = iwl_adjust_beacon_interval(conf->beacon_int); 570 beacon_int = iwl_adjust_beacon_interval(
571 priv->vif->bss_conf.beacon_int);
571 572
572 /* TODO: we need to get atim_window from upper stack 573 /* TODO: we need to get atim_window from upper stack
573 * for now we set to 0 */ 574 * for now we set to 0 */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 3dec2d25fa3d..cd8a5ed97c4f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -1313,7 +1313,6 @@ int iwl_setup_mac(struct iwl_priv *priv)
1313 /* Default value; 4 EDCA QOS priorities */ 1313 /* Default value; 4 EDCA QOS priorities */
1314 hw->queues = 4; 1314 hw->queues = 4;
1315 1315
1316 hw->conf.beacon_int = 100;
1317 hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL; 1316 hw->max_listen_interval = IWL_CONN_MAX_LISTEN_INTERVAL;
1318 1317
1319 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) 1318 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
@@ -2751,7 +2750,7 @@ void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
2751 2750
2752 priv->ibss_beacon = NULL; 2751 priv->ibss_beacon = NULL;
2753 2752
2754 priv->beacon_int = priv->hw->conf.beacon_int; 2753 priv->beacon_int = priv->vif->bss_conf.beacon_int;
2755 priv->timestamp = 0; 2754 priv->timestamp = 0;
2756 if ((priv->iw_mode == NL80211_IFTYPE_STATION)) 2755 if ((priv->iw_mode == NL80211_IFTYPE_STATION))
2757 priv->beacon_int = 0; 2756 priv->beacon_int = 0;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index a782292ed435..f9d9b65ef300 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -551,7 +551,8 @@ static void iwl3945_setup_rxon_timing(struct iwl_priv *priv)
551 priv->rxon_timing.atim_window = 0; 551 priv->rxon_timing.atim_window = 0;
552 } else { 552 } else {
553 priv->rxon_timing.beacon_interval = 553 priv->rxon_timing.beacon_interval =
554 iwl3945_adjust_beacon_interval(conf->beacon_int); 554 iwl3945_adjust_beacon_interval(
555 priv->vif->bss_conf.beacon_int);
555 /* TODO: we need to get atim_window from upper stack 556 /* TODO: we need to get atim_window from upper stack
556 * for now we set to 0 */ 557 * for now we set to 0 */
557 priv->rxon_timing.atim_window = 0; 558 priv->rxon_timing.atim_window = 0;
@@ -4211,8 +4212,6 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
4211 /* Default value; 4 EDCA QOS priorities */ 4212 /* Default value; 4 EDCA QOS priorities */
4212 hw->queues = 4; 4213 hw->queues = 4;
4213 4214
4214 hw->conf.beacon_int = 100;
4215
4216 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels) 4215 if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
4217 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = 4216 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
4218 &priv->bands[IEEE80211_BAND_2GHZ]; 4217 &priv->bands[IEEE80211_BAND_2GHZ];
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index e7289e2e7f16..68e47fb47a1e 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -380,7 +380,7 @@ static int lbtf_op_config_interface(struct ieee80211_hw *hw,
380 if (beacon) { 380 if (beacon) {
381 lbtf_beacon_set(priv, beacon); 381 lbtf_beacon_set(priv, beacon);
382 kfree_skb(beacon); 382 kfree_skb(beacon);
383 lbtf_beacon_ctrl(priv, 1, hw->conf.beacon_int); 383 lbtf_beacon_ctrl(priv, 1, vif->bss_conf.beacon_int);
384 } 384 }
385 break; 385 break;
386 default: 386 default:
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index d4fdc8b7d7d8..24c95a619e4c 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -553,18 +553,13 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
553 struct mac80211_hwsim_data *data = hw->priv; 553 struct mac80211_hwsim_data *data = hw->priv;
554 struct ieee80211_conf *conf = &hw->conf; 554 struct ieee80211_conf *conf = &hw->conf;
555 555
556 printk(KERN_DEBUG "%s:%s (freq=%d radio_enabled=%d beacon_int=%d)\n", 556 printk(KERN_DEBUG "%s:%s (freq=%d radio_enabled=%d)\n",
557 wiphy_name(hw->wiphy), __func__, 557 wiphy_name(hw->wiphy), __func__,
558 conf->channel->center_freq, conf->radio_enabled, 558 conf->channel->center_freq, conf->radio_enabled);
559 conf->beacon_int);
560 559
561 data->channel = conf->channel; 560 data->channel = conf->channel;
562 data->radio_enabled = conf->radio_enabled; 561 data->radio_enabled = conf->radio_enabled;
563 data->beacon_int = 1024 * conf->beacon_int / 1000 * HZ / 1000; 562 if (!data->started || !data->radio_enabled || !data->beacon_int)
564 if (data->beacon_int < 1)
565 data->beacon_int = 1;
566
567 if (!data->started || !data->radio_enabled)
568 del_timer(&data->beacon_timer); 563 del_timer(&data->beacon_timer);
569 else 564 else
570 mod_timer(&data->beacon_timer, jiffies + data->beacon_int); 565 mod_timer(&data->beacon_timer, jiffies + data->beacon_int);
@@ -615,6 +610,7 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw,
615 u32 changed) 610 u32 changed)
616{ 611{
617 struct hwsim_vif_priv *vp = (void *)vif->drv_priv; 612 struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
613 struct mac80211_hwsim_data *data = hw->priv;
618 614
619 hwsim_check_magic(vif); 615 hwsim_check_magic(vif);
620 616
@@ -628,6 +624,14 @@ static void mac80211_hwsim_bss_info_changed(struct ieee80211_hw *hw,
628 vp->aid = info->aid; 624 vp->aid = info->aid;
629 } 625 }
630 626
627 if (changed & BSS_CHANGED_BEACON_INT) {
628 printk(KERN_DEBUG " %s: BCNINT: %d\n",
629 wiphy_name(hw->wiphy), info->beacon_int);
630 data->beacon_int = 1024 * info->beacon_int / 1000 * HZ / 1000;
631 if (WARN_ON(data->beacon_int))
632 data->beacon_int = 1;
633 }
634
631 if (changed & BSS_CHANGED_ERP_CTS_PROT) { 635 if (changed & BSS_CHANGED_ERP_CTS_PROT) {
632 printk(KERN_DEBUG " %s: ERP_CTS_PROT: %d\n", 636 printk(KERN_DEBUG " %s: ERP_CTS_PROT: %d\n",
633 wiphy_name(hw->wiphy), info->use_cts_prot); 637 wiphy_name(hw->wiphy), info->use_cts_prot);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 81d706d85226..22c65e8cbb71 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -149,6 +149,7 @@ struct ieee80211_low_level_stats {
149 * @BSS_CHANGED_ERP_SLOT: slot timing changed 149 * @BSS_CHANGED_ERP_SLOT: slot timing changed
150 * @BSS_CHANGED_HT: 802.11n parameters changed 150 * @BSS_CHANGED_HT: 802.11n parameters changed
151 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed 151 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed
152 * @BSS_CHANGED_BEACON_INT: Beacon interval changed
152 */ 153 */
153enum ieee80211_bss_change { 154enum ieee80211_bss_change {
154 BSS_CHANGED_ASSOC = 1<<0, 155 BSS_CHANGED_ASSOC = 1<<0,
@@ -157,6 +158,7 @@ enum ieee80211_bss_change {
157 BSS_CHANGED_ERP_SLOT = 1<<3, 158 BSS_CHANGED_ERP_SLOT = 1<<3,
158 BSS_CHANGED_HT = 1<<4, 159 BSS_CHANGED_HT = 1<<4,
159 BSS_CHANGED_BASIC_RATES = 1<<5, 160 BSS_CHANGED_BASIC_RATES = 1<<5,
161 BSS_CHANGED_BEACON_INT = 1<<6,
160}; 162};
161 163
162/** 164/**
@@ -529,7 +531,7 @@ enum ieee80211_conf_flags {
529 * enum ieee80211_conf_changed - denotes which configuration changed 531 * enum ieee80211_conf_changed - denotes which configuration changed
530 * 532 *
531 * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed 533 * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed
532 * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed 534 * @_IEEE80211_CONF_CHANGE_BEACON_INTERVAL: DEPRECATED
533 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 535 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
534 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 536 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
535 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed 537 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
@@ -539,7 +541,7 @@ enum ieee80211_conf_flags {
539 */ 541 */
540enum ieee80211_conf_changed { 542enum ieee80211_conf_changed {
541 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), 543 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
542 IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1), 544 _IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1),
543 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 545 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
544 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 546 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
545 IEEE80211_CONF_CHANGE_PS = BIT(4), 547 IEEE80211_CONF_CHANGE_PS = BIT(4),
@@ -548,6 +550,14 @@ enum ieee80211_conf_changed {
548 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), 550 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
549}; 551};
550 552
553static inline __deprecated enum ieee80211_conf_changed
554__IEEE80211_CONF_CHANGE_BEACON_INTERVAL(void)
555{
556 return _IEEE80211_CONF_CHANGE_BEACON_INTERVAL;
557}
558#define IEEE80211_CONF_CHANGE_BEACON_INTERVAL \
559 __IEEE80211_CONF_CHANGE_BEACON_INTERVAL()
560
551/** 561/**
552 * struct ieee80211_conf - configuration of the device 562 * struct ieee80211_conf - configuration of the device
553 * 563 *
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);