Historical ath9k-devel archives
 help / color / mirror / Atom feed
From: Benjamin Berg <benjamin@sipsolutions.net>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH] ath9k: Configure beacons for AP vif if this has not happened yet
Date: Fri, 13 Mar 2015 16:37:02 +0100	[thread overview]
Message-ID: <1426261022.3238.43.camel@sipsolutions.net> (raw)
In-Reply-To: <5502F3C7.1090005@openwrt.org>

On Fr, 2015-03-13 at 15:27 +0100, Felix Fietkau wrote:
> I sent the following patch yesterday - I think it addresses the exact 
> same issue. Please test it to see if it works for you as well.

The patch looks a lot better. I just backported it and it is working
just fine for me.

Benjamin

> Subject: [PATCH 4.0] 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: stable at vger.kernel.org
> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
> ---
>  drivers/net/wireless/ath/ath9k/beacon.c | 20 ++++++++++++--------
>  drivers/net/wireless/ath/ath9k/common.h |  2 +-
>  2 files changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
> index cb366ad..f50a6bc 100644
> --- a/drivers/net/wireless/ath/ath9k/beacon.c
> +++ b/drivers/net/wireless/ath/ath9k/beacon.c
> @@ -219,12 +219,15 @@ void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif)
>  	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
>  	struct ath_vif *avp = (void *)vif->drv_priv;
>  	struct ath_buf *bf = avp->av_bcbuf;
> +	struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
>  
>  	ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n",
>  		avp->av_bslot);
>  
>  	tasklet_disable(&sc->bcon_tasklet);
>  
> +	cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
> +
>  	if (bf && bf->bf_mpdu) {
>  		struct sk_buff *skb = bf->bf_mpdu;
>  		dma_unmap_single(sc->dev, bf->bf_buf_addr,
> @@ -521,8 +524,7 @@ static bool ath9k_allow_beacon_config(struct ath_softc *sc,
>  	}
>  
>  	if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
> -		if ((vif->type != NL80211_IFTYPE_AP) ||
> -		    (sc->nbcnvifs > 1)) {
> +		if (vif->type != NL80211_IFTYPE_AP) {
>  			ath_dbg(common, CONFIG,
>  				"An AP interface is already present !\n");
>  			return false;
> @@ -616,12 +618,14 @@ void ath9k_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif,
>  	 * enabling/disabling SWBA.
>  	 */
>  	if (changed & BSS_CHANGED_BEACON_ENABLED) {
> -		if (!bss_conf->enable_beacon &&
> -		    (sc->nbcnvifs <= 1)) {
> -			cur_conf->enable_beacon = false;
> -		} else if (bss_conf->enable_beacon) {
> -			cur_conf->enable_beacon = true;
> -			ath9k_cache_beacon_config(sc, ctx, bss_conf);
> +		bool enabled = cur_conf->enable_beacon;
> +
> +		if (!bss_conf->enable_beacon) {
> +			cur_conf->enable_beacon &= ~BIT(avp->av_bslot);
> +		} else {
> +			cur_conf->enable_beacon |= BIT(avp->av_bslot);
> +			if (!enabled)
> +				ath9k_cache_beacon_config(sc, ctx, bss_conf);
>  		}
>  	}
>  
> diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h
> index 2b79a56..d237373 100644
> --- a/drivers/net/wireless/ath/ath9k/common.h
> +++ b/drivers/net/wireless/ath/ath9k/common.h
> @@ -54,7 +54,7 @@ struct ath_beacon_config {
>  	u16 dtim_period;
>  	u16 bmiss_timeout;
>  	u8 dtim_count;
> -	bool enable_beacon;
> +	u8 enable_beacon;
>  	bool ibss_creator;
>  	u32 nexttbtt;
>  	u32 intval;
> -- 2.2.2 --
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
Url : http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20150313/3efb06f4/attachment-0001.pgp 

  reply	other threads:[~2015-03-13 15:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 13:33 [ath9k-devel] [PATCH] ath9k: Configure beacons for AP vif if this has not happened yet Benjamin Berg
2015-03-13 14:14 ` Kalle Valo
2015-03-13 14:27 ` Felix Fietkau
2015-03-13 15:37   ` Benjamin Berg [this message]
2015-03-13 15:51   ` Ben Greear

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426261022.3238.43.camel@sipsolutions.net \
    --to=benjamin@sipsolutions.net \
    --cc=ath9k-devel@lists.ath9k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox