diff mbox series

[1/1] ath9k: reset survey of current channel after a scan started

Message ID 20231205170623.3029689-1-hyang@freebox.fr (mailing list archive)
State Accepted
Commit 4fadce88cb9fe95cfa7000c4ec041acf47b67447
Delegated to: Kalle Valo
Headers show
Series [1/1] ath9k: reset survey of current channel after a scan started | expand

Commit Message

Hancheng Yang Dec. 5, 2023, 5:06 p.m. UTC
In the `ath_set_channel()` function, we only reset surveys that are not
from the current channel. This leads to the accumulation of survey data for
the current channel indefinitely. This may not be the most optimal 
approach, as we want the ACS to rely on the most recent survey.
So reset the survey data for the current channel at the start of each scan.

Signed-off-by: Hancheng Yang <hyang@freebox.fr>
---
 drivers/net/wireless/ath/ath9k/main.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Toke Høiland-Jørgensen Dec. 7, 2023, 5:28 p.m. UTC | #1
Hancheng Yang <hyang@freebox.fr> writes:

> In the `ath_set_channel()` function, we only reset surveys that are not
> from the current channel. This leads to the accumulation of survey data for
> the current channel indefinitely. This may not be the most optimal 
> approach, as we want the ACS to rely on the most recent survey.
> So reset the survey data for the current channel at the start of each scan.
>
> Signed-off-by: Hancheng Yang <hyang@freebox.fr>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Kalle Valo Dec. 13, 2023, 10:42 a.m. UTC | #2
Hancheng Yang <hyang@freebox.fr> wrote:

> In the `ath_set_channel()` function, we only reset surveys that are not
> from the current channel. This leads to the accumulation of survey data for
> the current channel indefinitely. This may not be the most optimal
> approach, as we want the ACS to rely on the most recent survey.
> So reset the survey data for the current channel at the start of each scan.
> 
> Signed-off-by: Hancheng Yang <hyang@freebox.fr>
> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

4fadce88cb9f wifi: ath9k: reset survey of current channel after a scan started
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 859210b586c2..bb94b0dd86bb 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2383,7 +2383,22 @@  static void ath9k_sw_scan_start(struct ieee80211_hw *hw,
 {
 	struct ath_softc *sc = hw->priv;
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+	struct cfg80211_chan_def *chandef = &sc->cur_chan->chandef;
+	struct ieee80211_channel *chan = chandef->chan;
+	int pos = chan->hw_value;
 	set_bit(ATH_OP_SCANNING, &common->op_flags);
+
+	/* Reset current survey */
+	if (!sc->cur_chan->offchannel) {
+		if (sc->cur_survey != &sc->survey[pos]) {
+			if (sc->cur_survey)
+				sc->cur_survey->filled &= ~SURVEY_INFO_IN_USE;
+			sc->cur_survey = &sc->survey[pos];
+		}
+
+		memset(sc->cur_survey, 0, sizeof(struct survey_info));
+		sc->cur_survey->filled |= SURVEY_INFO_IN_USE;
+	}
 }
 
 static void ath9k_sw_scan_complete(struct ieee80211_hw *hw,