Skip to contentSkip to conversation

wifi: ath9k: restore background spectral scan after reset

PATCH In review Nick Hainke 2 participants 4 messages Sep 15 – Nov 19 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: ath9k: restore background spectral scan after reset

A reset leaves spectral_mode set to SPECTRAL_BACKGROUND, but resets the spectral registers and receive filter. The driver therefore still reports a background scan even though the hardware no longer produces FFT samples.

Re-trigger background spectral scanning after reset recovery so the software and hardware state match again. Do not re-trigger spectral scanning in disabled, manual, channel-scan, radar, or off-channel modes.

Assisted-by Claude:opus-5
---
 drivers/net/wireless/ath/ath9k/main.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/net/wireless/ath/ath9k/main.c +12 -0
index 740a6fc7b067..00e587fe6ee3 100644
@@ -231,6 +231,17 @@ static bool ath_prepare_reset(struct ath_softc *sc)
 	return ret;
 }
 
+static void ath_restore_spectral_scan(struct ath_softc *sc, bool start)
+{
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+
+	if (!start || sc->cur_chan->offchannel || sc->hw->conf.radar_enabled ||
+	    sc->spec_priv.spectral_mode != SPECTRAL_BACKGROUND)
+		return;
+
+	ath9k_cmn_spectral_scan_trigger(common, &sc->spec_priv);
+}
+
 static bool ath_complete_reset(struct ath_softc *sc, bool start)
 {
 	struct ath_hw *ah = sc->sc_ah;
@@ -269,6 +280,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
 		ath_restart_work(sc);
 		ath_txq_schedule_all(sc);
 	}
+	ath_restore_spectral_scan(sc, start);
 
 	sc->gtt_cnt = 0;
 
Signature · 1 line
2.55.0
author
#1 lore raw

Hi, I did not get any feedback so far, so a friendly reminder. :)

Bests
Nick

Quoted 44 lines · Nick Hainke

A reset leaves spectral_mode set to SPECTRAL_BACKGROUND, but resets the spectral registers and receive filter. The driver therefore still reports a background scan even though the hardware no longer produces FFT samples.

Re-trigger background spectral scanning after reset recovery so the software and hardware state match again. Do not re-trigger spectral scanning in disabled, manual, channel-scan, radar, or off-channel modes.

Assisted-by Claude:opus-5
---
  drivers/net/wireless/ath/ath9k/main.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
drivers/net/wireless/ath/ath9k/main.c +12 -0
index 740a6fc7b067..00e587fe6ee3 100644
@@ -231,6 +231,17 @@ static bool ath_prepare_reset(struct ath_softc *sc)
  	return ret;
  }
 
+static void ath_restore_spectral_scan(struct ath_softc *sc, bool start)
+{
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+
+	if (!start || sc->cur_chan->offchannel || sc->hw->conf.radar_enabled ||
+	    sc->spec_priv.spectral_mode != SPECTRAL_BACKGROUND)
+		return;
+
+	ath9k_cmn_spectral_scan_trigger(common, &sc->spec_priv);
+}
+
  static bool ath_complete_reset(struct ath_softc *sc, bool start)
  {
  	struct ath_hw *ah = sc->sc_ah;
@@ -269,6 +280,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
  		ath_restart_work(sc);
  		ath_txq_schedule_all(sc);
  	}
+	ath_restore_spectral_scan(sc, start);
 
  	sc->gtt_cnt = 0;
 
#2 lore raw
In reply to Nick Hainke
Quoted 8 lines · Nick Hainke

A reset leaves spectral_mode set to SPECTRAL_BACKGROUND, but resets the spectral registers and receive filter. The driver therefore still reports a background scan even though the hardware no longer produces FFT samples.

Re-trigger background spectral scanning after reset recovery so the software and hardware state match again. Do not re-trigger spectral scanning in disabled, manual, channel-scan, radar, or off-channel modes.

What bug is this fixing, and how did you test the change?

-Toke

#3 lore raw
In reply to Nick Hainke
Quoted 7 lines

A reset leaves spectral_mode set to SPECTRAL_BACKGROUND, but resets the spectral registers and receive filter. The driver therefore still reports a background scan even though the hardware no longer produces FFT samples.

Re-trigger background spectral scanning after reset recovery so the software and hardware state match again. Do not re-trigger spectral scanning in disabled, manual, channel-scan, radar, or off-channel modes.

Looking at this again, it's not obvious to me that the right thing to do here is to re-trigger the scan. Shouldn't the reset just set the state back to disabled instead?

-Toke