All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@kernel.org>
To: Oleksiy Protas <elfy.ua@gmail.com>, elfy.ua@gmail.com
Cc: linux-wireless@vger.kernel.org, Oleksiy Protas <elfy@ecognize.me>
Subject: Re: [PATCH] ath9k: keep ANI in monitor mode
Date: Mon, 11 Aug 2025 14:18:58 +0200	[thread overview]
Message-ID: <87qzxikq4t.fsf@toke.dk> (raw)
In-Reply-To: <20250514180413.373876-2-elfy@ecognize.me>

Oleksiy Protas <elfy.ua@gmail.com> writes:

> Earlier changes that made is_monitoring a separate flag as opposed to setting the opmode caused AMI to never start when monitoring
> ---
>  drivers/net/wireless/ath/ath9k/link.c | 2 +-
>  drivers/net/wireless/ath/ath9k/main.c | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/link.c b/drivers/net/wireless/ath/ath9k/link.c
> index 9d84003db800..cd2ead7b2883 100644
> --- a/drivers/net/wireless/ath/ath9k/link.c
> +++ b/drivers/net/wireless/ath/ath9k/link.c
> @@ -468,7 +468,7 @@ void ath_check_ani(struct ath_softc *sc)
>  			if (!test_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags))
>  				goto stop_ani;
>  		}
> -	} else if (ah->opmode == NL80211_IFTYPE_STATION) {
> +	} else if (ah->opmode == NL80211_IFTYPE_STATION && !ah->is_monitoring) {
>  		if (!test_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags))
>  			goto stop_ani;
>  	}

AFAICT, if you're trying to restore the old logic, ANI should always be
enabled if monitoring is. But here you're only changing the station
branch of the logic. Shouldn't it be something like:

--- i/drivers/net/wireless/ath/ath9k/link.c
+++ w/drivers/net/wireless/ath/ath9k/link.c
@@ -481,6 +481,9 @@ void ath_check_ani(struct ath_softc *sc)
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon;
 
+	if (ah->is_monitoring)
+		goto start_ani;
+
 	/*
 	 * Check for the various conditions in which ANI has to
 	 * be stopped.
@@ -502,6 +505,7 @@ void ath_check_ani(struct ath_softc *sc)
 			goto stop_ani;
 	}
 
+start_ani:
 	if (!test_bit(ATH_OP_ANI_RUN, &common->op_flags)) {
 		set_bit(ATH_OP_ANI_RUN, &common->op_flags);
 		ath_start_ani(sc);


> diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
> index aa271b82875e..2685aeecffad 100644
> --- a/drivers/net/wireless/ath/ath9k/main.c
> +++ b/drivers/net/wireless/ath/ath9k/main.c
> @@ -1530,6 +1530,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
>  		if (conf->flags & IEEE80211_CONF_MONITOR) {
>  			ath_dbg(common, CONFIG, "Monitor mode is enabled\n");
>  			sc->sc_ah->is_monitoring = true;
> +			ath_check_ani(sc);
>  		} else {
>  			ath_dbg(common, CONFIG, "Monitor mode is disabled\n");
>  			sc->sc_ah->is_monitoring = false;

And shouldn't this call to ath_check_ani() be done regardless of whether
monitoring mode is being enabled or disabled? I.e., go after the else of
that if branch?

-Toke

  reply	other threads:[~2025-08-11 12:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 16:19 MikroTik R11e 5HnD monitor mode Oleksiy Protas
2025-05-14 18:04 ` [PATCH] " Oleksiy Protas
2025-05-14 18:04   ` [PATCH] ath9k: keep ANI in " Oleksiy Protas
2025-08-11 12:18     ` Toke Høiland-Jørgensen [this message]
2025-05-14 19:11   ` MikroTik R11e 5HnD " Oleksiy Protas

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=87qzxikq4t.fsf@toke.dk \
    --to=toke@kernel.org \
    --cc=elfy.ua@gmail.com \
    --cc=elfy@ecognize.me \
    --cc=linux-wireless@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.