aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/main.c
diff options
context:
space:
mode:
authorRajkumar Manoharan <rmanohar@qca.qualcomm.com>2012-04-19 09:43:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-23 15:35:30 -0400
commited2578cd24d033dcaa046b7324e91215ae1fdd8d (patch)
treee23b84c5a154b1e7fee3476bb67bc0a79465c974 /drivers/net/wireless/ath/ath9k/main.c
parent78241bdcaf617f477f778c957ed93afc9551ff78 (diff)
ath9k: simplify beacon configuration for beaconing vifs
As of now beacon configuration is being called multiple times in bss info change notification. This patch avoids multiple configuration and make it simpler. Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c62
1 files changed, 20 insertions, 42 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 384e5c498440..1fc6e331589a 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1245,7 +1245,6 @@ static void ath9k_reclaim_beacon(struct ath_softc *sc,
1245 ath9k_set_beaconing_status(sc, false); 1245 ath9k_set_beaconing_status(sc, false);
1246 ath_beacon_return(sc, avp); 1246 ath_beacon_return(sc, avp);
1247 ath9k_set_beaconing_status(sc, true); 1247 ath9k_set_beaconing_status(sc, true);
1248 sc->sc_flags &= ~SC_OP_BEACONS;
1249} 1248}
1250 1249
1251static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) 1250static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
@@ -1376,17 +1375,9 @@ static void ath9k_do_vif_add_setup(struct ieee80211_hw *hw,
1376 ath9k_calculate_summary_state(hw, vif); 1375 ath9k_calculate_summary_state(hw, vif);
1377 1376
1378 if (ath9k_uses_beacons(vif->type)) { 1377 if (ath9k_uses_beacons(vif->type)) {
1379 int error; 1378 /* Reserve a beacon slot for the vif */
1380 /* This may fail because upper levels do not have beacons
1381 * properly configured yet. That's OK, we assume it
1382 * will be properly configured and then we will be notified
1383 * in the info_changed method and set up beacons properly
1384 * there.
1385 */
1386 ath9k_set_beaconing_status(sc, false); 1379 ath9k_set_beaconing_status(sc, false);
1387 error = ath_beacon_alloc(sc, vif); 1380 ath_beacon_alloc(sc, vif);
1388 if (!error)
1389 ath_beacon_config(sc, vif);
1390 ath9k_set_beaconing_status(sc, true); 1381 ath9k_set_beaconing_status(sc, true);
1391 } 1382 }
1392} 1383}
@@ -1986,7 +1977,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
1986 struct ath_common *common = ath9k_hw_common(ah); 1977 struct ath_common *common = ath9k_hw_common(ah);
1987 struct ath_vif *avp = (void *)vif->drv_priv; 1978 struct ath_vif *avp = (void *)vif->drv_priv;
1988 int slottime; 1979 int slottime;
1989 int error;
1990 1980
1991 ath9k_ps_wakeup(sc); 1981 ath9k_ps_wakeup(sc);
1992 mutex_lock(&sc->mutex); 1982 mutex_lock(&sc->mutex);
@@ -2019,13 +2009,25 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2019 } 2009 }
2020 } 2010 }
2021 2011
2022 /* Enable transmission of beacons (AP, IBSS, MESH) */ 2012 /*
2023 if ((changed & BSS_CHANGED_BEACON) || 2013 * In case of AP mode, the HW TSF has to be reset
2024 ((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) { 2014 * when the beacon interval changes.
2015 */
2016 if ((changed & BSS_CHANGED_BEACON_INT) &&
2017 (vif->type == NL80211_IFTYPE_AP))
2018 sc->sc_flags |= SC_OP_TSF_RESET;
2019
2020 /* Configure beaconing (AP, IBSS, MESH) */
2021 if (ath9k_uses_beacons(vif->type) &&
2022 ((changed & BSS_CHANGED_BEACON) ||
2023 (changed & BSS_CHANGED_BEACON_ENABLED) ||
2024 (changed & BSS_CHANGED_BEACON_INT))) {
2025 ath9k_set_beaconing_status(sc, false); 2025 ath9k_set_beaconing_status(sc, false);
2026 error = ath_beacon_alloc(sc, vif); 2026 if (bss_conf->enable_beacon)
2027 if (!error) 2027 ath_beacon_alloc(sc, vif);
2028 ath_beacon_config(sc, vif); 2028 else
2029 avp->is_bslot_active = false;
2030 ath_beacon_config(sc, vif);
2029 ath9k_set_beaconing_status(sc, true); 2031 ath9k_set_beaconing_status(sc, true);
2030 } 2032 }
2031 2033
@@ -2048,30 +2050,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2048 } 2050 }
2049 } 2051 }
2050 2052
2051 /* Disable transmission of beacons */
2052 if ((changed & BSS_CHANGED_BEACON_ENABLED) &&
2053 !bss_conf->enable_beacon) {
2054 ath9k_set_beaconing_status(sc, false);
2055 avp->is_bslot_active = false;
2056 ath9k_set_beaconing_status(sc, true);
2057 }
2058
2059 if (changed & BSS_CHANGED_BEACON_INT) {
2060 /*
2061 * In case of AP mode, the HW TSF has to be reset
2062 * when the beacon interval changes.
2063 */
2064 if (vif->type == NL80211_IFTYPE_AP) {
2065 sc->sc_flags |= SC_OP_TSF_RESET;
2066 ath9k_set_beaconing_status(sc, false);
2067 error = ath_beacon_alloc(sc, vif);
2068 if (!error)
2069 ath_beacon_config(sc, vif);
2070 ath9k_set_beaconing_status(sc, true);
2071 } else
2072 ath_beacon_config(sc, vif);
2073 }
2074
2075 mutex_unlock(&sc->mutex); 2053 mutex_unlock(&sc->mutex);
2076 ath9k_ps_restore(sc); 2054 ath9k_ps_restore(sc);
2077} 2055}