Commit ed2578cd authored by Rajkumar Manoharan's avatar Rajkumar Manoharan Committed by John W. Linville

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: default avatarRajkumar Manoharan <rmanohar@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 78241bdc
...@@ -817,8 +817,10 @@ void ath9k_set_beaconing_status(struct ath_softc *sc, bool status) ...@@ -817,8 +817,10 @@ void ath9k_set_beaconing_status(struct ath_softc *sc, bool status)
{ {
struct ath_hw *ah = sc->sc_ah; struct ath_hw *ah = sc->sc_ah;
if (!ath_has_valid_bslot(sc)) if (!ath_has_valid_bslot(sc)) {
sc->sc_flags &= ~SC_OP_BEACONS;
return; return;
}
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
if (status) { if (status) {
......
...@@ -1245,7 +1245,6 @@ static void ath9k_reclaim_beacon(struct ath_softc *sc, ...@@ -1245,7 +1245,6 @@ static void ath9k_reclaim_beacon(struct ath_softc *sc,
ath9k_set_beaconing_status(sc, false); ath9k_set_beaconing_status(sc, false);
ath_beacon_return(sc, avp); ath_beacon_return(sc, avp);
ath9k_set_beaconing_status(sc, true); ath9k_set_beaconing_status(sc, true);
sc->sc_flags &= ~SC_OP_BEACONS;
} }
static void ath9k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) static 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,17 +1375,9 @@ static void ath9k_do_vif_add_setup(struct ieee80211_hw *hw,
ath9k_calculate_summary_state(hw, vif); ath9k_calculate_summary_state(hw, vif);
if (ath9k_uses_beacons(vif->type)) { if (ath9k_uses_beacons(vif->type)) {
int error; /* Reserve a beacon slot for the vif */
/* This may fail because upper levels do not have beacons
* properly configured yet. That's OK, we assume it
* will be properly configured and then we will be notified
* in the info_changed method and set up beacons properly
* there.
*/
ath9k_set_beaconing_status(sc, false); ath9k_set_beaconing_status(sc, false);
error = ath_beacon_alloc(sc, vif); ath_beacon_alloc(sc, vif);
if (!error)
ath_beacon_config(sc, vif);
ath9k_set_beaconing_status(sc, true); ath9k_set_beaconing_status(sc, true);
} }
} }
...@@ -1986,7 +1977,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -1986,7 +1977,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath_vif *avp = (void *)vif->drv_priv; struct ath_vif *avp = (void *)vif->drv_priv;
int slottime; int slottime;
int error;
ath9k_ps_wakeup(sc); ath9k_ps_wakeup(sc);
mutex_lock(&sc->mutex); mutex_lock(&sc->mutex);
...@@ -2019,12 +2009,24 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -2019,12 +2009,24 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
} }
} }
/* Enable transmission of beacons (AP, IBSS, MESH) */ /*
if ((changed & BSS_CHANGED_BEACON) || * In case of AP mode, the HW TSF has to be reset
((changed & BSS_CHANGED_BEACON_ENABLED) && bss_conf->enable_beacon)) { * when the beacon interval changes.
*/
if ((changed & BSS_CHANGED_BEACON_INT) &&
(vif->type == NL80211_IFTYPE_AP))
sc->sc_flags |= SC_OP_TSF_RESET;
/* Configure beaconing (AP, IBSS, MESH) */
if (ath9k_uses_beacons(vif->type) &&
((changed & BSS_CHANGED_BEACON) ||
(changed & BSS_CHANGED_BEACON_ENABLED) ||
(changed & BSS_CHANGED_BEACON_INT))) {
ath9k_set_beaconing_status(sc, false); ath9k_set_beaconing_status(sc, false);
error = ath_beacon_alloc(sc, vif); if (bss_conf->enable_beacon)
if (!error) ath_beacon_alloc(sc, vif);
else
avp->is_bslot_active = false;
ath_beacon_config(sc, vif); ath_beacon_config(sc, vif);
ath9k_set_beaconing_status(sc, true); ath9k_set_beaconing_status(sc, true);
} }
...@@ -2048,30 +2050,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw, ...@@ -2048,30 +2050,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
} }
} }
/* Disable transmission of beacons */
if ((changed & BSS_CHANGED_BEACON_ENABLED) &&
!bss_conf->enable_beacon) {
ath9k_set_beaconing_status(sc, false);
avp->is_bslot_active = false;
ath9k_set_beaconing_status(sc, true);
}
if (changed & BSS_CHANGED_BEACON_INT) {
/*
* In case of AP mode, the HW TSF has to be reset
* when the beacon interval changes.
*/
if (vif->type == NL80211_IFTYPE_AP) {
sc->sc_flags |= SC_OP_TSF_RESET;
ath9k_set_beaconing_status(sc, false);
error = ath_beacon_alloc(sc, vif);
if (!error)
ath_beacon_config(sc, vif);
ath9k_set_beaconing_status(sc, true);
} else
ath_beacon_config(sc, vif);
}
mutex_unlock(&sc->mutex); mutex_unlock(&sc->mutex);
ath9k_ps_restore(sc); ath9k_ps_restore(sc);
} }
......
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