Skip to content

Commit 1cf48f2

Browse files
Felix FietkauKalle Valo
authored andcommitted
ath9k: fix tracking of enabled AP beacons
sc->nbcnvifs tracks assigned beacon slots, not enabled beacons. Therefore, it cannot be used to decide if cur_conf->enable_beacon (bool) should be updated, or if beacons have been enabled already. With the current code (depending on the order of calls), beacons often do not get enabled in an AP+STA setup. To fix tracking of enabled beacons, convert cur_conf->enable_beacon to a bitmask of enabled beacon slots. Cc: [email protected] Signed-off-by: Felix Fietkau <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 3f16153 commit 1cf48f2

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

drivers/net/wireless/ath/ath9k/beacon.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,15 @@ void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif)
219219
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
220220
struct ath_vif *avp = (void *)vif->drv_priv;
221221
struct ath_buf *bf = avp->av_bcbuf;
222+
struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
222223

223224
ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
224225
avp->av_bslot);
225226

226227
tasklet_disable(&sc->bcon_tasklet);
227228

229+
cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
230+
228231
if (bf && bf->bf_mpdu) {
229232
struct sk_buff *skb = bf->bf_mpdu;
230233
dma_unmap_single(sc->dev, bf->bf_buf_addr,
@@ -521,8 +524,7 @@ static bool ath9k_allow_beacon_config(struct ath_softc *sc,
521524
}
522525

523526
if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
524-
if ((vif->type != NL80211_IFTYPE_AP) ||
525-
(sc->nbcnvifs > 1)) {
527+
if (vif->type != NL80211_IFTYPE_AP) {
526528
ath_dbg(common, CONFIG,
527529
"An AP interface is already present !\n");
528530
return false;
@@ -616,12 +618,14 @@ void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
616618
* enabling/disabling SWBA.
617619
*/
618620
if (changed & BSS_CHANGED_BEACON_ENABLED) {
619-
if (!bss_conf->enable_beacon &&
620-
(sc->nbcnvifs <= 1)) {
621-
cur_conf->enable_beacon = false;
622-
} else if (bss_conf->enable_beacon) {
623-
cur_conf->enable_beacon = true;
624-
ath9k_cache_beacon_config(sc, ctx, bss_conf);
621+
bool enabled = cur_conf->enable_beacon;
622+
623+
if (!bss_conf->enable_beacon) {
624+
cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
625+
} else {
626+
cur_conf->enable_beacon |= BIT(avp->av_bslot);
627+
if (!enabled)
628+
ath9k_cache_beacon_config(sc, ctx, bss_conf);
625629
}
626630
}
627631

drivers/net/wireless/ath/ath9k/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct ath_beacon_config {
5454
u16 dtim_period;
5555
u16 bmiss_timeout;
5656
u8 dtim_count;
57-
bool enable_beacon;
57+
u8 enable_beacon;
5858
bool ibss_creator;
5959
u32 nexttbtt;
6060
u32 intval;

0 commit comments

Comments
 (0)