Skip to content

Commit 7f67673

Browse files
Felix Fietkausashalevin
authored andcommitted
ath9k: fix tracking of enabled AP beacons
[ Upstream commit 1cf48f2 ] 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: stable@vger.kernel.org Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent 9786bf2 commit 7f67673

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

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

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

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

225226
tasklet_disable(&sc->bcon_tasklet);
226227

228+
cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
229+
227230
if (bf && bf->bf_mpdu) {
228231
struct sk_buff *skb = bf->bf_mpdu;
229232
dma_unmap_single(sc->dev, bf->bf_buf_addr,
@@ -520,8 +523,7 @@ static bool ath9k_allow_beacon_config(struct ath_softc *sc,
520523
}
521524

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

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

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

0 commit comments

Comments
 (0)