Commit 58766977 authored by Zefir Kurtisi's avatar Zefir Kurtisi Committed by Kalle Valo

ath9k: add DFS support for extension channel

In HT40 modes, pulse events on primary and extension
channel are processed individually. If valid, a pulse
event will be fed into the detector
* for primary frequency, or
* for extension frequency (+/-20MHz based on HT40-mode)
* or both

With that, a 40MHz radar will result in two individual
radar events.
Signed-off-by: default avatarZefir Kurtisi <zefir.kurtisi@neratec.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 8252a35a
...@@ -126,8 +126,19 @@ ath9k_postprocess_radar_event(struct ath_softc *sc, ...@@ -126,8 +126,19 @@ ath9k_postprocess_radar_event(struct ath_softc *sc,
DFS_STAT_INC(sc, pulses_detected); DFS_STAT_INC(sc, pulses_detected);
return true; return true;
} }
#undef PRI_CH_RADAR_FOUND
#undef EXT_CH_RADAR_FOUND static void
ath9k_dfs_process_radar_pulse(struct ath_softc *sc, struct pulse_event *pe)
{
struct dfs_pattern_detector *pd = sc->dfs_detector;
DFS_STAT_INC(sc, pulses_processed);
if (pd == NULL)
return;
if (!pd->add_pulse(pd, pe))
return;
DFS_STAT_INC(sc, radar_detected);
ieee80211_radar_detected(sc->hw);
}
/* /*
* DFS: check PHY-error for radar pulse and feed the detector * DFS: check PHY-error for radar pulse and feed the detector
...@@ -176,18 +187,21 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, ...@@ -176,18 +187,21 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
ard.pulse_length_pri = vdata_end[-3]; ard.pulse_length_pri = vdata_end[-3];
pe.freq = ah->curchan->channel; pe.freq = ah->curchan->channel;
pe.ts = mactime; pe.ts = mactime;
if (ath9k_postprocess_radar_event(sc, &ard, &pe)) { if (!ath9k_postprocess_radar_event(sc, &ard, &pe))
struct dfs_pattern_detector *pd = sc->dfs_detector; return;
ath_dbg(common, DFS, ath_dbg(common, DFS,
"ath9k_dfs_process_phyerr: channel=%d, ts=%llu, " "ath9k_dfs_process_phyerr: type=%d, freq=%d, ts=%llu, "
"width=%d, rssi=%d, delta_ts=%llu\n", "width=%d, rssi=%d, delta_ts=%llu\n",
pe.freq, pe.ts, pe.width, pe.rssi, ard.pulse_bw_info, pe.freq, pe.ts, pe.width, pe.rssi,
pe.ts - sc->dfs_prev_pulse_ts); pe.ts - sc->dfs_prev_pulse_ts);
sc->dfs_prev_pulse_ts = pe.ts; sc->dfs_prev_pulse_ts = pe.ts;
DFS_STAT_INC(sc, pulses_processed); if (ard.pulse_bw_info & PRI_CH_RADAR_FOUND)
if (pd != NULL && pd->add_pulse(pd, &pe)) { ath9k_dfs_process_radar_pulse(sc, &pe);
DFS_STAT_INC(sc, radar_detected); if (ard.pulse_bw_info & EXT_CH_RADAR_FOUND) {
ieee80211_radar_detected(sc->hw); pe.freq += IS_CHAN_HT40PLUS(ah->curchan) ? 20 : -20;
} ath9k_dfs_process_radar_pulse(sc, &pe);
} }
} }
#undef PRI_CH_RADAR_FOUND
#undef EXT_CH_RADAR_FOUND
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment