ath9k: DFS radar detection
v2 cover ath9k: DFS radar detection
This patch series proposes DFS radar pulse detection for ath9k.
Updates
* use DFS HW capability flag instead of #ifdefs
* disable feature by default
* moved DFS debugfs into own file
* reverted BIT() debug flags to hex
* limited DFS support to AR_SREV_9280_20_OR_LATER (TBC)
* minor changes considering feedback
Zefir Kurtisi (2):
ath9k: add DFS radar pulse processing
ath9k: integrate initial DFS module
drivers/net/wireless/ath/ath.h | 2 + drivers/net/wireless/ath/ath9k/Makefile | 2 + drivers/net/wireless/ath/ath9k/debug.c | 3 + drivers/net/wireless/ath/ath9k/debug.h | 2 + drivers/net/wireless/ath/ath9k/dfs.c | 192 ++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/dfs.h | 24 ++++ drivers/net/wireless/ath/ath9k/dfs_debug.c | 89 +++++++++++++ drivers/net/wireless/ath/ath9k/dfs_debug.h | 59 +++++++++ drivers/net/wireless/ath/ath9k/hw.c | 12 ++ drivers/net/wireless/ath/ath9k/hw.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 17 +++ drivers/net/wireless/ath/ath9k/recv.c | 18 ++- 12 files changed, 416 insertions(+), 5 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/dfs.c create mode 100644 drivers/net/wireless/ath/ath9k/dfs.h create mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.c create mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.h
Signature · 1 line
1.7.4.1
RFC v2 1/2 ath9k: add DFS radar pulse processing
This initial DFS module provides basic functionality to deal with radar pulses reported by the DFS HW pattern detector.
The reported data is evaluated and basic plausibility checks are performed to filter false pulses. Passing radar pulses are forwarded to pattern detectors (not part of this patch).
The patch also includes
* new debug level ATH_DBG_DFS
* debugfs DFS radar statistics
--- drivers/net/wireless/ath/ath.h | 2 + drivers/net/wireless/ath/ath9k/dfs.c | 192 ++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/dfs.h | 24 ++++ drivers/net/wireless/ath/ath9k/dfs_debug.c | 89 +++++++++++++ drivers/net/wireless/ath/ath9k/dfs_debug.h | 59 +++++++++ 5 files changed, 366 insertions(+), 0 deletions(-) create mode 100644 drivers/net/wireless/ath/ath9k/dfs.c create mode 100644 drivers/net/wireless/ath/ath9k/dfs.h create mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.c create mode 100644 drivers/net/wireless/ath/ath9k/dfs_debug.h
drivers/net/wireless/ath/ath.h +2 -0
@@ -215,6 +215,7 @@ do { \* @ATH_DBG_HWTIMER: hardware timer handling * @ATH_DBG_BTCOEX: bluetooth coexistance * @ATH_DBG_BSTUCK: stuck beacons +* @ATH_DBG_DFS: radar datection * @ATH_DBG_ANY: enable all debugging * * The debug level is used to control the amount and type of debugging output
@@ -240,6 +241,7 @@ enum ATH_DEBUG {ATH_DBG_BTCOEX =0x00002000 ,ATH_DBG_WMI =0x00004000 ,ATH_DBG_BSTUCK =0x00008000 , +ATH_DBG_DFS =0x00010000 , ATH_DBG_ANY = 0xffffffff };
drivers/net/wireless/ath/ath9k/dfs.c new file +192 -0
192 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/dfs.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Copyright (c) 2008-2011 Atheros Communications Inc. +* Copyright (c) 2011 Neratec Solutions AG +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef ATH9K_DFS_H +#define ATH9K_DFS_H + +void ath9k_dfs_process_phyerr (struct ath_softc *sc,void *data, +struct ath_rx_status *rs,u64 mactime); + +#endif /* ATH9K_DFS_H */
drivers/net/wireless/ath/ath9k/dfs_debug.c new file +89 -0
89 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/dfs_debug.h new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
1.7.4.1
RFC v2 1/2 ath9k: add DFS radar pulse processing
Quoted 92 lines · Zefir Kurtisi
This initial DFS module provides basic functionality to deal with radar pulses reported by the DFS HW pattern detector.
The reported data is evaluated and basic plausibility checks are performed to filter false pulses. Passing radar pulses are forwarded to pattern detectors (not part of this patch).
The patch also includes
?* new debug levelATH_DBG_DFS
?* debugfs DFS radar statisticsSigned-off-by Zefir Kurtisi <[email protected]>---
?drivers/net/wireless/ath/ath.h ? ? ? ? ? ? | ? ?2 + ?drivers/net/wireless/ath/ath9k/dfs.c ? ? ? | ?192 ++++++++++++++++++++++++++++ ?drivers/net/wireless/ath/ath9k/dfs.h ? ? ? | ? 24 ++++ ?drivers/net/wireless/ath/ath9k/dfs_debug.c | ? 89 +++++++++++++ ?drivers/net/wireless/ath/ath9k/dfs_debug.h | ? 59 +++++++++?5 files changed, 366 insertions(+), 0 deletions(-) ?create mode 100644
drivers/net/wireless/ath/ath9k/dfs.c?create mode 100644drivers/net/wireless/ath/ath9k/dfs.h?create mode 100644drivers/net/wireless/ath/ath9k/dfs_debug.c?create mode 100644drivers/net/wireless/ath/ath9k/dfs_debug.hdrivers/net/wireless/ath/ath.h +0
-0@@ -215,6 +215,7 @@ do { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\?* @ATH_DBG_HWTIMER: hardware timer handling
?* @ATH_DBG_BTCOEX: bluetooth coexistance
?* @ATH_DBG_BSTUCK: stuck beacons
+ * @ATH_DBG_DFS: radar datection
?* @ATH_DBG_ANY: enable all debugging
?*
?* The debug level is used to control the amount and type of debugging outputdrivers/net/wireless/ath/ath.h +1
-0@@ -240,6 +241,7 @@ enum ATH_DEBUG { ? ? ? ?ATH_DBG_BTCOEX ? ? ? ? ?= 0x00002000, ? ? ? ?ATH_DBG_WMI ? ? ? ? ? ? = 0x00004000, ? ? ? ?ATH_DBG_BSTUCK ? ? ? ? ?= 0x00008000, + ? ? ? ATH_DBG_DFS ? ? ? ? ? ? = 0x00010000,? ? ? ?ATH_DBG_ANY ? ? ? ? ? ? =
0xffffffff
?};drivers/net/wireless/ath/ath9k/dfs.c new file +42
-0@@ -0,0 +1,192 @@ +/* +* Copyright (c) 2008-2011 Atheros Communications Inc. +* Copyright (c) 2011 Neratec Solutions AG +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "hw.h" +#include "hw-ops.h" +#include "ath9k.h" +#include "dfs.h" +#include "dfs_debug.h" + +/* pulse duration reported is scaled with 1000/800 us */ +#define AR93X_NSECS_PER_DUR 800 +static u32 dur_to_usecs (u32 dur) +{ + ? ? ? return (dur * AR93X_NSECS_PER_DUR + 500) / 1000; +} + +/* internal struct to pass radar data */ +struct ath_radar_data { + ? ? ? u8 pulse_bw_info; + ? ? ? u8 rssi; + ? ? ? u8 ext_rssi; + ? ? ? u8 pulse_length_ext; + ? ? ? u8 pulse_length_pri; +}; + +/* TODO: move into or synchronize this with generic header +* ? ? ? as soon as IF is defined */ +struct dfs_radar_pulse {
drivers/net/wireless/ath/ath9k/dfs.c line 52
Quoted 10 lines
drivers/net/wireless/ath/ath9k/dfs.c new file +10
-0+ ? ? ? u16 freq; + ? ? ? u64 ts; + ? ? ? u32 width; + ? ? ? u8 rssi; +}; + +#define PRI_CH_RADAR_FOUND 0x01 +#define EXT_CH_RADAR_FOUND 0x02 +static bool postprocess_radar_event (struct ath_softc *sc, + ? ? ? ? ? ? ? struct ath_radar_data *are, struct dfs_radar_pulse *drp)
ath9k_postprocess_radar_event would be better?
Quoted 338 lines
drivers/net/wireless/ath/ath9k/dfs.c new file +140
-0+{ + ? ? ? u8 rssi; + ? ? ? u16 dur; + + ? ? ? ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_DFS, + ? ? ? ? ? ? ? "pulse_bw_info=0x%x, pri,ext len/rssi=(%u/%u, %u/%u)\n", + ? ? ? ? ? ? ? are->pulse_bw_info, + ? ? ? ? ? ? ? are->pulse_length_pri, are->rssi, + ? ? ? ? ? ? ? are->pulse_length_ext, are->ext_rssi); + + ? ? ? /* Only the last 2 bits of the BW info are relevant, they indicate + ? ? ? ?which channel the radar was detected in.*/ + ? ? ? are->pulse_bw_info &= 0x03; + + ? ? ? switch (are->pulse_bw_info) { + ? ? ? case 0: + ? ? ? ? ? ? ? /* Bogus bandwidth info received in descriptor, + ? ? ? ? ? ? ? ?so ignore this PHY error */ + ? ? ? ? ? ? ? DFS_STAT_INC(sc, bwinfo_discards); + ? ? ? ? ? ? ? return false; + ? ? ? case PRI_CH_RADAR_FOUND: + ? ? ? ? ? ? ? /* radar in ctrl channel */ + ? ? ? ? ? ? ? dur = are->pulse_length_pri; + ? ? ? ? ? ? ? DFS_STAT_INC(sc, pri_phy_errors); + ? ? ? ? ? ? ? /* cannot use ctrl channel RSSI + ? ? ? ? ? ? ? ?* if extension channel is stronger */ + ? ? ? ? ? ? ? rssi = (are->ext_rssi >= (are->rssi + 3)) ? 0 : are->rssi; + ? ? ? ? ? ? ? break; + ? ? ? case EXT_CH_RADAR_FOUND: + ? ? ? ? ? ? ? /* radar in extension channel */ + ? ? ? ? ? ? ? dur = are->pulse_length_ext; + ? ? ? ? ? ? ? DFS_STAT_INC(sc, ext_phy_errors); + ? ? ? ? ? ? ? /* cannot use extension channel RSSI + ? ? ? ? ? ? ? ?* if control channel is stronger */ + ? ? ? ? ? ? ? rssi = (are->rssi >= (are->ext_rssi + 12)) ? 0 : are->ext_rssi; + ? ? ? ? ? ? ? break; + ? ? ? case (PRI_CH_RADAR_FOUND | EXT_CH_RADAR_FOUND): + ? ? ? ? ? ? ? /* + ? ? ? ? ? ? ? ?* Conducted testing, when pulse is on DC, both pri and ext + ? ? ? ? ? ? ? ?* durations are reported to be same + ? ? ? ? ? ? ? ?* + ? ? ? ? ? ? ? ?* Radiated testing, when pulse is on DC, different pri and + ? ? ? ? ? ? ? ?* ext durations are reported, so take the larger of the two + ? ? ? ? ? ? ? ?* */ + ? ? ? ? ? ? ? if (are->pulse_length_ext >= are->pulse_length_pri) + ? ? ? ? ? ? ? ? ? ? ? dur = are->pulse_length_ext; + ? ? ? ? ? ? ? else + ? ? ? ? ? ? ? ? ? ? ? dur = are->pulse_length_pri; + ? ? ? ? ? ? ? DFS_STAT_INC(sc, dc_phy_errors); + + ? ? ? ? ? ? ? /* when both are present use stronger one */ + ? ? ? ? ? ? ? rssi = (are->rssi < are->ext_rssi) ? are->ext_rssi : are->rssi; + ? ? ? ? ? ? ? break; + ? ? ? } + + ? ? ? if (rssi == 0) { + ? ? ? ? ? ? ? DFS_STAT_INC(sc, rssi_discards); + ? ? ? ? ? ? ? return false; + ? ? ? } + + ? ? ? /* + ? ? ? ?* TODO: check chirping pulses + ? ? ? ?*/ + + ? ? ? /* convert duration to usecs */ + ? ? ? drp->width = dur_to_usecs(dur); + ? ? ? drp->rssi = rssi; + + ? ? ? DFS_STAT_INC(sc, pulses_detected); + ? ? ? return true; +} + + +/* + * DFS: check PHY-error for radar pulse and feed the detector + */ +void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, + ? ? ? ? ? ? ? struct ath_rx_status *rs, u64 mactime) +{ + ? ? ? struct ath_radar_data ard; + ? ? ? u16 datalen; + ? ? ? char *vdata_end; + ? ? ? struct dfs_radar_pulse drp; + ? ? ? struct ath_hw *ah = sc->sc_ah; + ? ? ? struct ath_common *common = ath9k_hw_common(ah); + + ? ? ? if ((!(rs->rs_phyerr != ATH9K_PHYERR_RADAR)) && + ? ? ? ? ? ? ? (!(rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT))) { + ? ? ? ? ? ? ? ath_dbg(common, ATH_DBG_DFS, + ? ? ? ? ? ? ? ? ? ? ? "Error: rs_phyer=0x%x not a radar error\n", + ? ? ? ? ? ? ? ? ? ? ? rs->rs_phyerr); + ? ? ? ? ? ? ? return; + ? ? ? } + + ? ? ? datalen = rs->rs_datalen; + ? ? ? if (datalen == 0) { + ? ? ? ? ? ? ? DFS_STAT_INC(sc, datalen_discards); + ? ? ? ? ? ? ? return; + ? ? ? } + + ? ? ? ard.rssi = rs->rs_rssi_ctl0; + ? ? ? ard.ext_rssi = rs->rs_rssi_ext0; + + ? ? ? /* hardware stores this as 8 bit signed value. + ? ? ? ?* we will cap it at 0 if it is a negative number + ? ? ? ?*/ + ? ? ? if (ard.rssi & 0x80) + ? ? ? ? ? ? ? ard.rssi = 0; + ? ? ? if (ard.ext_rssi & 0x80) + ? ? ? ? ? ? ? ard.ext_rssi = 0; + + ? ? ? vdata_end = (char *)data + datalen; + ? ? ? ard.pulse_bw_info = vdata_end[-1]; + ? ? ? ard.pulse_length_ext = vdata_end[-2]; + ? ? ? ard.pulse_length_pri = vdata_end[-3]; + + ? ? ? ath_dbg(common, ATH_DBG_DFS, + ? ? ? ? ? ? ? "bw_info=%d, length_pri=%d, length_ext=%d, " + ? ? ? ? ? ? ? "rssi_pri=%d, rssi_ext=%d\n", + ? ? ? ? ? ? ? ard.pulse_bw_info, ard.pulse_length_pri, ard.pulse_length_ext, + ? ? ? ? ? ? ? ard.rssi, ard.ext_rssi); + + ? ? ? drp.freq = ah->curchan->channel; + ? ? ? drp.ts = mactime; + ? ? ? if (postprocess_radar_event(sc, &ard, &drp)) { + ? ? ? ? ? ? ? static u64 last_ts; + ? ? ? ? ? ? ? ath_dbg(common, ATH_DBG_DFS, + ? ? ? ? ? ? ? ? ? ? ? "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, " + ? ? ? ? ? ? ? ? ? ? ? "width=%d, rssi=%d, delta_ts=%llu\n", + ? ? ? ? ? ? ? ? ? ? ? drp.freq, drp.ts, drp.width, drp.rssi, drp.ts-last_ts); + ? ? ? ? ? ? ? last_ts = drp.ts; + ? ? ? ? ? ? ? /* + ? ? ? ? ? ? ? ?* TODO: forward pulse to pattern detector + ? ? ? ? ? ? ? ?* + ? ? ? ? ? ? ? ?* ieee80211_add_radar_pulse(drp.freq, drp.ts, + ? ? ? ? ? ? ? ?* ? ? ? ? ? ? ? ? ? ? ? ? ? drp.width, drp.rssi); + ? ? ? ? ? ? ? ?*/ + ? ? ? } +} +EXPORT_SYMBOL(ath9k_dfs_process_phyerr);drivers/net/wireless/ath/ath9k/dfs.h new file +24
-0@@ -0,0 +1,24 @@ +/* +* Copyright (c) 2008-2011 Atheros Communications Inc. +* Copyright (c) 2011 Neratec Solutions AG +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef ATH9K_DFS_H +#define ATH9K_DFS_H + +void ath9k_dfs_process_phyerr (struct ath_softc *sc,void *data, + ? ? ? ? ? ? ? struct ath_rx_status *rs, u64 mactime); + +#endif /* ATH9K_DFS_H */ drivers/net/wireless/ath/ath9k/dfs_debug.c new file +89
-0@@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-2011 Atheros Communications Inc. +* Copyright (c) 2011 Neratec Solutions AG +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + + +#include <linux/debugfs.h> + +#include "ath9k.h" +#include "dfs_debug.h" + + +#if defined(CONFIG_ATH9K_DEBUGFS ) + +#define ATH9K_DFS_STAT (s, p) \ + ? ? ? len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \ + ? ? ? ? ? ? ? ? ? ? ? sc->debug.stats.dfs_stats.p); + +static ssize_t read_file_dfs (struct file *file,char __user *user_buf, + ? ? ? ? ? ? ? ? ? ? ? ? ? ?size_t count, loff_t *ppos) +{ + ? ? ? struct ath_softc *sc = file->private_data; + ? ? ? struct ath9k_hw_version *hw_ver = &sc->sc_ah->hw_version; + ? ? ? char *buf; + ? ? ? unsigned int len = 0, size = 8000; + ? ? ? ssize_t retval = 0; + + ? ? ? buf = kzalloc(size, GFP_KERNEL); + ? ? ? if (buf == NULL) + ? ? ? ? ? ? ? return -ENOMEM; + + ? ? ? len += snprintf(buf + len, size - len, "DFS support for " + ? ? ? ? ? ? ? ? ? ? ? "macVersion = 0x%x, macRev = 0x%x: %s\n", + ? ? ? ? ? ? ? ? ? ? ? hw_ver->macVersion, hw_ver->macRev, + ? ? ? ? ? ? ? ? ? ? ? (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ? + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "enabled" : "disabled"); + ? ? ? ATH9K_DFS_STAT("DFS pulses detected ? ? ", pulses_detected); + ? ? ? ATH9K_DFS_STAT("Datalen discards ? ? ? ?", datalen_discards); + ? ? ? ATH9K_DFS_STAT("RSSI discards ? ? ? ? ? ", rssi_discards); + ? ? ? ATH9K_DFS_STAT("BW info discards ? ? ? ?", bwinfo_discards); + ? ? ? ATH9K_DFS_STAT("Primary channel pulses ?", pri_phy_errors); + ? ? ? ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors); + ? ? ? ATH9K_DFS_STAT("Dual channel pulses ? ? ", dc_phy_errors); + + ? ? ? if (len > size) + ? ? ? ? ? ? ? len = size; + + ? ? ? retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); + ? ? ? kfree(buf); + + ? ? ? return retval; +} + +static int ath9k_dfs_debugfs_open (struct inode *inode,struct file *file) +{ + ? ? ? file->private_data = inode->i_private; + ? ? ? return 0; +} + + +static const struct file_operations fops_dfs_stats = { + ? ? ? .read = read_file_dfs, + ? ? ? .open = ath9k_dfs_debugfs_open, + ? ? ? .owner = THIS_MODULE, + ? ? ? .llseek = default_llseek, +}; + + +void ath9k_dfs_init_debug (struct ath_softc *sc) +{ + ? ? ? debugfs_create_file("dfs_stats", S_IRUSR, + ? ? ? ? ? ? ? ? ? ? ? sc->debug.debugfs_phy, sc, &fops_dfs_stats); +} +EXPORT_SYMBOL (ath9k_dfs_init_debug); + +#endif /* CONFIG_ATH9K_DEBUGFS */ +drivers/net/wireless/ath/ath9k/dfs_debug.h new file +59
-1@@ -0,0 +1,59 @@ +/* +* Copyright (c) 2008-2011 Atheros Communications Inc. +* Copyright (c) 2011 Neratec Solutions AG +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + + +#ifndef DFS_DEBUG_H +#define DFS_DEBUG_H + +#include "hw.h" + +/** +* struct ath_dfs_stats - DFS Statistics +* +* @pulses_detected: ?No. of pulses detected so far +* @datalen_discards: No. of pulses discarded due to invalid datalen +* @rssi_discards: ? ?No. of pulses discarded due to invalid RSSI +* @bwinfo_discards: ?No. of pulses discarded due to invalid BW info +* @pri_phy_errors: ? No. of pulses reported for primary channel +* @ext_phy_errors: ? No. of pulses reported for extension channel +* @dc_phy_errors: ? ?No. of pulses reported for primary + extension channel +*/ +struct ath_dfs_stats { + ? ? ? u32 pulses_detected; + ? ? ? u32 datalen_discards; + ? ? ? u32 rssi_discards; + ? ? ? u32 bwinfo_discards; + ? ? ? u32 pri_phy_errors; + ? ? ? u32 ext_phy_errors; + ? ? ? u32 dc_phy_errors; +}; + + +#if defined(CONFIG_ATH9K_DEBUGFS ) + +#define DFS_STAT_INC (sc, c) (sc->debug.stats.dfs_stats.c++) +void ath9k_dfs_init_debug (struct ath_softc *sc); + +#else + +#define DFS_STAT_INC (sc, c) do { } while (0) +static inline void ath9k_dfs_init_debug (struct ath_softc *sc) { } + +#endif + + +#endif /* DFS_DEBUG_H */ --1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
Signature · 1 line
shafi
RFC v2 1/2 ath9k: add DFS radar pulse processing
Quoted 7 lines · Mohammed Shafi
drivers/net/wireless/ath/ath9k/dfs.c line 52
Quoted 3 lines · Zefir Kurtisi
[...]
drivers/net/wireless/ath/ath9k/dfs.c new file +2
-0+static bool postprocess_radar_event (struct ath_softc *sc, +struct ath_radar_data *are,struct dfs_radar_pulse *drp)
ath9k_postprocess_radar_eventwould be better?
Ok (I don't mind, as it's static anyhow.).
RFC v2 1/2 ath9k: add DFS radar pulse processing
In reply to Zefir KurtisiQuoted 108 lines · Zefir Kurtisi
This initial DFS module provides basic functionality to deal with radar pulses reported by the DFS HW pattern detector.
The reported data is evaluated and basic plausibility checks are performed to filter false pulses. Passing radar pulses are forwarded to pattern detectors (not part of this patch).
The patch also includes
?* new debug levelATH_DBG_DFS
?* debugfs DFS radar statisticsSigned-off-by Zefir Kurtisi <[email protected]>---
?drivers/net/wireless/ath/ath.h ? ? ? ? ? ? | ? ?2 + ?drivers/net/wireless/ath/ath9k/dfs.c ? ? ? | ?192 ++++++++++++++++++++++++++++ ?drivers/net/wireless/ath/ath9k/dfs.h ? ? ? | ? 24 ++++ ?drivers/net/wireless/ath/ath9k/dfs_debug.c | ? 89 +++++++++++++ ?drivers/net/wireless/ath/ath9k/dfs_debug.h | ? 59 +++++++++?5 files changed, 366 insertions(+), 0 deletions(-) ?create mode 100644
drivers/net/wireless/ath/ath9k/dfs.c?create mode 100644drivers/net/wireless/ath/ath9k/dfs.h?create mode 100644drivers/net/wireless/ath/ath9k/dfs_debug.c?create mode 100644drivers/net/wireless/ath/ath9k/dfs_debug.hdrivers/net/wireless/ath/ath.h +0
-0@@ -215,6 +215,7 @@ do { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\?* @ATH_DBG_HWTIMER: hardware timer handling
?* @ATH_DBG_BTCOEX: bluetooth coexistance
?* @ATH_DBG_BSTUCK: stuck beacons
+ * @ATH_DBG_DFS: radar datection
?* @ATH_DBG_ANY: enable all debugging
?*
?* The debug level is used to control the amount and type of debugging outputdrivers/net/wireless/ath/ath.h +1
-0@@ -240,6 +241,7 @@ enum ATH_DEBUG { ? ? ? ?ATH_DBG_BTCOEX ? ? ? ? ?= 0x00002000, ? ? ? ?ATH_DBG_WMI ? ? ? ? ? ? = 0x00004000, ? ? ? ?ATH_DBG_BSTUCK ? ? ? ? ?= 0x00008000, + ? ? ? ATH_DBG_DFS ? ? ? ? ? ? = 0x00010000,? ? ? ?ATH_DBG_ANY ? ? ? ? ? ? =
0xffffffff
?};drivers/net/wireless/ath/ath9k/dfs.c new file +58
-0@@ -0,0 +1,192 @@ +/* +* Copyright (c) 2008-2011 Atheros Communications Inc. +* Copyright (c) 2011 Neratec Solutions AG +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include "hw.h" +#include "hw-ops.h" +#include "ath9k.h" +#include "dfs.h" +#include "dfs_debug.h" + +/* pulse duration reported is scaled with 1000/800 us */ +#define AR93X_NSECS_PER_DUR 800 +static u32 dur_to_usecs (u32 dur) +{ + ? ? ? return (dur * AR93X_NSECS_PER_DUR + 500) / 1000; +} + +/* internal struct to pass radar data */ +struct ath_radar_data { + ? ? ? u8 pulse_bw_info; + ? ? ? u8 rssi; + ? ? ? u8 ext_rssi; + ? ? ? u8 pulse_length_ext; + ? ? ? u8 pulse_length_pri; +}; + +/* TODO: move into or synchronize this with generic header +* ? ? ? as soon as IF is defined */ +struct dfs_radar_pulse { + ? ? ? u16 freq; + ? ? ? u64 ts; + ? ? ? u32 width; + ? ? ? u8 rssi; +}; + +#define PRI_CH_RADAR_FOUND 0x01 +#define EXT_CH_RADAR_FOUND 0x02 +static bool postprocess_radar_event (struct ath_softc *sc, + ? ? ? ? ? ? ? struct ath_radar_data *are, struct dfs_radar_pulse *drp) +{ + ? ? ? u8 rssi; + ? ? ? u16 dur; + + ? ? ? ath_dbg(ath9k_hw_common(sc->sc_ah), ATH_DBG_DFS, + ? ? ? ? ? ? ? "pulse_bw_info=0x%x, pri,ext len/rssi=(%u/%u, %u/%u)\n",
drivers/net/wireless/ath/ath9k/dfs.c line 68
Quoted 10 lines
drivers/net/wireless/ath/ath9k/dfs.c new file +10
-0+ ? ? ? ? ? ? ? are->pulse_bw_info, + ? ? ? ? ? ? ? are->pulse_length_pri, are->rssi, + ? ? ? ? ? ? ? are->pulse_length_ext, are->ext_rssi); + + ? ? ? /* Only the last 2 bits of the BW info are relevant, they indicate + ? ? ? ?which channel the radar was detected in.*/ + ? ? ? are->pulse_bw_info &= 0x03; + + ? ? ? switch (are->pulse_bw_info) { + ? ? ? case 0:
can we define some macro for this. thanks!
Quoted 322 lines
drivers/net/wireless/ath/ath9k/dfs.c new file +124
-0+ ? ? ? ? ? ? ? /* Bogus bandwidth info received in descriptor, + ? ? ? ? ? ? ? ?so ignore this PHY error */ + ? ? ? ? ? ? ? DFS_STAT_INC(sc, bwinfo_discards); + ? ? ? ? ? ? ? return false; + ? ? ? case PRI_CH_RADAR_FOUND: + ? ? ? ? ? ? ? /* radar in ctrl channel */ + ? ? ? ? ? ? ? dur = are->pulse_length_pri; + ? ? ? ? ? ? ? DFS_STAT_INC(sc, pri_phy_errors); + ? ? ? ? ? ? ? /* cannot use ctrl channel RSSI + ? ? ? ? ? ? ? ?* if extension channel is stronger */ + ? ? ? ? ? ? ? rssi = (are->ext_rssi >= (are->rssi + 3)) ? 0 : are->rssi; + ? ? ? ? ? ? ? break; + ? ? ? case EXT_CH_RADAR_FOUND: + ? ? ? ? ? ? ? /* radar in extension channel */ + ? ? ? ? ? ? ? dur = are->pulse_length_ext; + ? ? ? ? ? ? ? DFS_STAT_INC(sc, ext_phy_errors); + ? ? ? ? ? ? ? /* cannot use extension channel RSSI + ? ? ? ? ? ? ? ?* if control channel is stronger */ + ? ? ? ? ? ? ? rssi = (are->rssi >= (are->ext_rssi + 12)) ? 0 : are->ext_rssi; + ? ? ? ? ? ? ? break; + ? ? ? case (PRI_CH_RADAR_FOUND | EXT_CH_RADAR_FOUND): + ? ? ? ? ? ? ? /* + ? ? ? ? ? ? ? ?* Conducted testing, when pulse is on DC, both pri and ext + ? ? ? ? ? ? ? ?* durations are reported to be same + ? ? ? ? ? ? ? ?* + ? ? ? ? ? ? ? ?* Radiated testing, when pulse is on DC, different pri and + ? ? ? ? ? ? ? ?* ext durations are reported, so take the larger of the two + ? ? ? ? ? ? ? ?* */ + ? ? ? ? ? ? ? if (are->pulse_length_ext >= are->pulse_length_pri) + ? ? ? ? ? ? ? ? ? ? ? dur = are->pulse_length_ext; + ? ? ? ? ? ? ? else + ? ? ? ? ? ? ? ? ? ? ? dur = are->pulse_length_pri; + ? ? ? ? ? ? ? DFS_STAT_INC(sc, dc_phy_errors); + + ? ? ? ? ? ? ? /* when both are present use stronger one */ + ? ? ? ? ? ? ? rssi = (are->rssi < are->ext_rssi) ? are->ext_rssi : are->rssi; + ? ? ? ? ? ? ? break; + ? ? ? } + + ? ? ? if (rssi == 0) { + ? ? ? ? ? ? ? DFS_STAT_INC(sc, rssi_discards); + ? ? ? ? ? ? ? return false; + ? ? ? } + + ? ? ? /* + ? ? ? ?* TODO: check chirping pulses + ? ? ? ?*/ + + ? ? ? /* convert duration to usecs */ + ? ? ? drp->width = dur_to_usecs(dur); + ? ? ? drp->rssi = rssi; + + ? ? ? DFS_STAT_INC(sc, pulses_detected); + ? ? ? return true; +} + + +/* + * DFS: check PHY-error for radar pulse and feed the detector + */ +void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, + ? ? ? ? ? ? ? struct ath_rx_status *rs, u64 mactime) +{ + ? ? ? struct ath_radar_data ard; + ? ? ? u16 datalen; + ? ? ? char *vdata_end; + ? ? ? struct dfs_radar_pulse drp; + ? ? ? struct ath_hw *ah = sc->sc_ah; + ? ? ? struct ath_common *common = ath9k_hw_common(ah); + + ? ? ? if ((!(rs->rs_phyerr != ATH9K_PHYERR_RADAR)) && + ? ? ? ? ? ? ? (!(rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT))) { + ? ? ? ? ? ? ? ath_dbg(common, ATH_DBG_DFS, + ? ? ? ? ? ? ? ? ? ? ? "Error: rs_phyer=0x%x not a radar error\n", + ? ? ? ? ? ? ? ? ? ? ? rs->rs_phyerr); + ? ? ? ? ? ? ? return; + ? ? ? } + + ? ? ? datalen = rs->rs_datalen; + ? ? ? if (datalen == 0) { + ? ? ? ? ? ? ? DFS_STAT_INC(sc, datalen_discards); + ? ? ? ? ? ? ? return; + ? ? ? } + + ? ? ? ard.rssi = rs->rs_rssi_ctl0; + ? ? ? ard.ext_rssi = rs->rs_rssi_ext0; + + ? ? ? /* hardware stores this as 8 bit signed value. + ? ? ? ?* we will cap it at 0 if it is a negative number + ? ? ? ?*/ + ? ? ? if (ard.rssi & 0x80) + ? ? ? ? ? ? ? ard.rssi = 0; + ? ? ? if (ard.ext_rssi & 0x80) + ? ? ? ? ? ? ? ard.ext_rssi = 0; + + ? ? ? vdata_end = (char *)data + datalen; + ? ? ? ard.pulse_bw_info = vdata_end[-1]; + ? ? ? ard.pulse_length_ext = vdata_end[-2]; + ? ? ? ard.pulse_length_pri = vdata_end[-3]; + + ? ? ? ath_dbg(common, ATH_DBG_DFS, + ? ? ? ? ? ? ? "bw_info=%d, length_pri=%d, length_ext=%d, " + ? ? ? ? ? ? ? "rssi_pri=%d, rssi_ext=%d\n", + ? ? ? ? ? ? ? ard.pulse_bw_info, ard.pulse_length_pri, ard.pulse_length_ext, + ? ? ? ? ? ? ? ard.rssi, ard.ext_rssi); + + ? ? ? drp.freq = ah->curchan->channel; + ? ? ? drp.ts = mactime; + ? ? ? if (postprocess_radar_event(sc, &ard, &drp)) { + ? ? ? ? ? ? ? static u64 last_ts; + ? ? ? ? ? ? ? ath_dbg(common, ATH_DBG_DFS, + ? ? ? ? ? ? ? ? ? ? ? "ath9k_dfs_process_phyerr: channel=%d, ts=%llu, " + ? ? ? ? ? ? ? ? ? ? ? "width=%d, rssi=%d, delta_ts=%llu\n", + ? ? ? ? ? ? ? ? ? ? ? drp.freq, drp.ts, drp.width, drp.rssi, drp.ts-last_ts); + ? ? ? ? ? ? ? last_ts = drp.ts; + ? ? ? ? ? ? ? /* + ? ? ? ? ? ? ? ?* TODO: forward pulse to pattern detector + ? ? ? ? ? ? ? ?* + ? ? ? ? ? ? ? ?* ieee80211_add_radar_pulse(drp.freq, drp.ts, + ? ? ? ? ? ? ? ?* ? ? ? ? ? ? ? ? ? ? ? ? ? drp.width, drp.rssi); + ? ? ? ? ? ? ? ?*/ + ? ? ? } +} +EXPORT_SYMBOL(ath9k_dfs_process_phyerr);drivers/net/wireless/ath/ath9k/dfs.h new file +24
-0@@ -0,0 +1,24 @@ +/* +* Copyright (c) 2008-2011 Atheros Communications Inc. +* Copyright (c) 2011 Neratec Solutions AG +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef ATH9K_DFS_H +#define ATH9K_DFS_H + +void ath9k_dfs_process_phyerr (struct ath_softc *sc,void *data, + ? ? ? ? ? ? ? struct ath_rx_status *rs, u64 mactime); + +#endif /* ATH9K_DFS_H */ drivers/net/wireless/ath/ath9k/dfs_debug.c new file +89
-0@@ -0,0 +1,89 @@ +/* +* Copyright (c) 2008-2011 Atheros Communications Inc. +* Copyright (c) 2011 Neratec Solutions AG +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + + +#include <linux/debugfs.h> + +#include "ath9k.h" +#include "dfs_debug.h" + + +#if defined(CONFIG_ATH9K_DEBUGFS ) + +#define ATH9K_DFS_STAT (s, p) \ + ? ? ? len += snprintf(buf + len, size - len, "%28s : %10u\n", s, \ + ? ? ? ? ? ? ? ? ? ? ? sc->debug.stats.dfs_stats.p); + +static ssize_t read_file_dfs (struct file *file,char __user *user_buf, + ? ? ? ? ? ? ? ? ? ? ? ? ? ?size_t count, loff_t *ppos) +{ + ? ? ? struct ath_softc *sc = file->private_data; + ? ? ? struct ath9k_hw_version *hw_ver = &sc->sc_ah->hw_version; + ? ? ? char *buf; + ? ? ? unsigned int len = 0, size = 8000; + ? ? ? ssize_t retval = 0; + + ? ? ? buf = kzalloc(size, GFP_KERNEL); + ? ? ? if (buf == NULL) + ? ? ? ? ? ? ? return -ENOMEM; + + ? ? ? len += snprintf(buf + len, size - len, "DFS support for " + ? ? ? ? ? ? ? ? ? ? ? "macVersion = 0x%x, macRev = 0x%x: %s\n", + ? ? ? ? ? ? ? ? ? ? ? hw_ver->macVersion, hw_ver->macRev, + ? ? ? ? ? ? ? ? ? ? ? (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_DFS) ? + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "enabled" : "disabled"); + ? ? ? ATH9K_DFS_STAT("DFS pulses detected ? ? ", pulses_detected); + ? ? ? ATH9K_DFS_STAT("Datalen discards ? ? ? ?", datalen_discards); + ? ? ? ATH9K_DFS_STAT("RSSI discards ? ? ? ? ? ", rssi_discards); + ? ? ? ATH9K_DFS_STAT("BW info discards ? ? ? ?", bwinfo_discards); + ? ? ? ATH9K_DFS_STAT("Primary channel pulses ?", pri_phy_errors); + ? ? ? ATH9K_DFS_STAT("Secondary channel pulses", ext_phy_errors); + ? ? ? ATH9K_DFS_STAT("Dual channel pulses ? ? ", dc_phy_errors); + + ? ? ? if (len > size) + ? ? ? ? ? ? ? len = size; + + ? ? ? retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); + ? ? ? kfree(buf); + + ? ? ? return retval; +} + +static int ath9k_dfs_debugfs_open (struct inode *inode,struct file *file) +{ + ? ? ? file->private_data = inode->i_private; + ? ? ? return 0; +} + + +static const struct file_operations fops_dfs_stats = { + ? ? ? .read = read_file_dfs, + ? ? ? .open = ath9k_dfs_debugfs_open, + ? ? ? .owner = THIS_MODULE, + ? ? ? .llseek = default_llseek, +}; + + +void ath9k_dfs_init_debug (struct ath_softc *sc) +{ + ? ? ? debugfs_create_file("dfs_stats", S_IRUSR, + ? ? ? ? ? ? ? ? ? ? ? sc->debug.debugfs_phy, sc, &fops_dfs_stats); +} +EXPORT_SYMBOL (ath9k_dfs_init_debug); + +#endif /* CONFIG_ATH9K_DEBUGFS */ +drivers/net/wireless/ath/ath9k/dfs_debug.h new file +59
-1@@ -0,0 +1,59 @@ +/* +* Copyright (c) 2008-2011 Atheros Communications Inc. +* Copyright (c) 2011 Neratec Solutions AG +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + + +#ifndef DFS_DEBUG_H +#define DFS_DEBUG_H + +#include "hw.h" + +/** +* struct ath_dfs_stats - DFS Statistics +* +* @pulses_detected: ?No. of pulses detected so far +* @datalen_discards: No. of pulses discarded due to invalid datalen +* @rssi_discards: ? ?No. of pulses discarded due to invalid RSSI +* @bwinfo_discards: ?No. of pulses discarded due to invalid BW info +* @pri_phy_errors: ? No. of pulses reported for primary channel +* @ext_phy_errors: ? No. of pulses reported for extension channel +* @dc_phy_errors: ? ?No. of pulses reported for primary + extension channel +*/ +struct ath_dfs_stats { + ? ? ? u32 pulses_detected; + ? ? ? u32 datalen_discards; + ? ? ? u32 rssi_discards; + ? ? ? u32 bwinfo_discards; + ? ? ? u32 pri_phy_errors; + ? ? ? u32 ext_phy_errors; + ? ? ? u32 dc_phy_errors; +}; + + +#if defined(CONFIG_ATH9K_DEBUGFS ) + +#define DFS_STAT_INC (sc, c) (sc->debug.stats.dfs_stats.c++) +void ath9k_dfs_init_debug (struct ath_softc *sc); + +#else + +#define DFS_STAT_INC (sc, c) do { } while (0) +static inline void ath9k_dfs_init_debug (struct ath_softc *sc) { } + +#endif + + +#endif /* DFS_DEBUG_H */ --1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
Signature · 1 line
shafi
RFC v2 1/2 ath9k: add DFS radar pulse processing
Quoted 7 lines · Mohammed Shafi
drivers/net/wireless/ath/ath9k/dfs.c line 68
Quoted 3 lines · Zefir Kurtisi
[...]
drivers/net/wireless/ath/ath9k/dfs.c new file +2
-0+switch (are->pulse_bw_info) { +case 0 :can we define some macro for this. thanks!
Ok.
RFC v2 2/2 ath9k: integrate initial DFS module
In reply to Zefir KurtisiThis patch integrates the DFS module into ath9k, including
* building the module into ath9k_hw
* setting up DFS debugfs
* defining HW capability flag for DFS support
* setting this flag by DFS supporting devices (so far: AR_SREV_9280_20_OR_LATER, TBC)
* setting PHYRADAR rx filter flag to enable radar pulse reporting
* forward radar PHY errors to dfs module
This is WIP and at its current stage is limited to test ath9k pulse detection capabilities. The DFS pattern matching is TBD in the higher layers and is not part of this patch.
CONFIG_ATH9K_DFS must be set to enable pulse detection.
--- drivers/net/wireless/ath/ath9k/Makefile | 2 ++ drivers/net/wireless/ath/ath9k/debug.c | 3 +++ drivers/net/wireless/ath/ath9k/debug.h | 2 ++ drivers/net/wireless/ath/ath9k/hw.c | 12 ++++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 17 +++++++++++++++++ drivers/net/wireless/ath/ath9k/recv.c | 18 +++++++++++++----- 7 files changed, 50 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/Makefile +2 -0
@@ -29,6 +29,8 @@ ath9k_hw-y:= \ eeprom_9287.o \ ani.o \ btcoex.o \ + dfs.o \ + dfs_debug.o \ mac.o \ ar9002_mac.o \ ar9003_mac.o \
drivers/net/wireless/ath/ath9k/debug.c +3 -0
@@ -1633,6 +1633,9 @@ int ath9k_init_debug(struct ath_hw *ah)debugfs_create_file ("debug" ,S_IRUSR |S_IWUSR , sc->debug.debugfs_phy, sc, &fops_debug);#endif + +ath9k_dfs_init_debug (sc); +debugfs_create_file ("dma" ,S_IRUSR , sc->debug.debugfs_phy, sc, &fops_dma); debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
drivers/net/wireless/ath/ath9k/debug.h +2 -0
@@ -19,6 +19,7 @@#include "hw.h" #include "rc.h" +#include "dfs_debug.h" struct ath_txq ;struct ath_buf ;
@@ -180,6 +181,7 @@ struct ath_stats {struct ath_interrupt_stats istats;struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES ];struct ath_rx_stats rxstats; +struct ath_dfs_stats dfs_stats;u32 reset[__RESET_TYPE_MAX]; };
drivers/net/wireless/ath/ath9k/hw.c +12 -0
@@ -2333,6 +2333,18 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) pCap->pcie_lcr_offset =0x80 ; } +#ifdef CONFIG_ATH9K_DFS +/* +* enable radar detection on DFS supporting devices +*/ +if (AR_SREV_9280_20_OR_LATER (ah)) { +/* +* TODO: check for which chip-sets we want to support DFS +*/ + pCap->hw_caps |=ATH9K_HW_CAP_DFS ; + } +#endif + tx_chainmask = pCap->tx_chainmask; rx_chainmask = pCap->rx_chainmask;while (tx_chainmask || rx_chainmask) {
drivers/net/wireless/ath/ath9k/hw.h +1 -0
@@ -204,6 +204,7 @@ enum ath9k_hw_caps {ATH9K_HW_CAP_5GHZ =BIT (14 ),ATH9K_HW_CAP_APM =BIT (15 ),ATH9K_HW_CAP_RTT =BIT (16 ), + ATH9K_HW_CAP_DFS = BIT(17), }; struct ath9k_hw_capabilities {
drivers/net/wireless/ath/ath9k/main.c +17 -0
@@ -305,6 +305,23 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)ath9k_hw_antdiv_comb_conf_set (ah, &div_ant_conf); } +if (ah->caps.hw_caps &&ATH9K_HW_CAP_DFS ) { +/** +* enable radar pulse detection +* +* TODO: do this only for DFS channels +*/ + ah->private_ops.set_radar_params (ah, &ah->radar_conf); +ath9k_hw_setrxfilter (ah, +ath9k_hw_getrxfilter (ah) |ATH9K_RX_FILTER_PHYRADAR ); +ath_dbg (common,ATH_DBG_DFS , +"DFS radar detection enabled for channel %d\n" , + ah->curchan->channel); + }else { +ath9k_hw_setrxfilter (ah, +ath9k_hw_getrxfilter (ah) & ~ATH9K_RX_FILTER_PHYRADAR ); + } +ieee80211_wake_queues (sc->hw);return true;
drivers/net/wireless/ath/ath9k/recv.c +13 -5
@@ -17,6 +17,7 @@#include <linux/dma-mapping.h> #include "ath9k.h" #include "ar9003_mac.h" +#include "dfs.h" #define SKB_CB_ATHBUF (__skb) (*((struct ath_buf **)__skb->cb))
@@ -1865,11 +1866,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)if (sc->sc_flags &SC_OP_RXFLUSH ) goto requeue_drop_frag; - retval =ath9k_rx_skb_preprocess (common, hw, hdr, &rs, - rxs, &decrypt_error); -if (retval) - goto requeue_drop_frag; - rxs->mactime = (tsf & ~0xffffffffULL ) | rs.rs_tstamp;if (rs.rs_tstamp > tsf_lower &&unlikely (rs.rs_tstamp - tsf_lower >0x10000000 ))
@@ -1879,6 +1875,18 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) rxs->mactime += 0x100000000ULL; +if ((ah->caps.hw_caps &ATH9K_HW_CAP_DFS ) && + (rs.rs_status &ATH9K_RXERR_PHY ) && + (rs.rs_phyerr ==ATH9K_PHYERR_RADAR )) { +/* DFS: check for radar pulse */ +ath9k_dfs_process_phyerr (sc, hdr, &rs, rxs->mactime); + } + + retval =ath9k_rx_skb_preprocess (common, hw, hdr, &rs, + rxs, &decrypt_error); +if (retval) + goto requeue_drop_frag; +/* Ensure we always have an skb to requeue once we are done * processing the current buffer's skb */ requeue_skb =ath_rxbuf_alloc (common, common->rx_bufsize,GFP_ATOMIC );
Signature · 1 line
1.7.4.1
RFC v2 2/2 ath9k: integrate initial DFS module
Quoted 42 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including
* building the module intoath9k_hw
* setting up DFS debugfs
* defining HW capability flag for DFS support
* setting this flag by DFS supporting devices(so far: AR_SREV_9280_20_OR_LATER, TBC)* setting PHYRADAR rx filter flag to enable radar pulse reporting
* forward radar PHY errors to dfs moduleThis is WIP and at its current stage is limited to test ath9k pulse detection capabilities. The DFS pattern matching is TBD in the higher layers and is not part of this patch.
CONFIG_ATH9K_DFSmust be set to enable pulse detection.Signed-off-by Zefir Kurtisi<[email protected]>--- drivers/net/wireless/ath/ath9k/Makefile | 2 ++ drivers/net/wireless/ath/ath9k/debug.c | 3 +++ drivers/net/wireless/ath/ath9k/debug.h | 2 ++ drivers/net/wireless/ath/ath9k/hw.c | 12 ++++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 17 +++++++++++++++++ drivers/net/wireless/ath/ath9k/recv.c | 18 +++++++++++++----- 7 files changed, 50 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath9k/main.c +7
-0@@ -305,6 +305,23 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)ath9k_hw_antdiv_comb_conf_set (ah,&div_ant_conf); } +if (ah->caps.hw_caps&&ATH9K_HW_CAP_DFS ) { +/** +* enable radar pulse detection +* +* TODO: do this only for DFS channels +*/ + ah->private_ops.set_radar_params (ah,&ah->radar_conf);
drivers/net/wireless/ath/ath9k/main.c static bool ath_complete_reset(struct ath_softc *sc, bool start) · line 324
Quoted 10 lines
drivers/net/wireless/ath/ath9k/main.c +10
-0+ath9k_hw_setrxfilter (ah, +ath9k_hw_getrxfilter (ah) |ATH9K_RX_FILTER_PHYRADAR ); +ath_dbg (common,ATH_DBG_DFS , +"DFS radar detection enabled for channel %d\n" , + ah->curchan->channel); + }else { +ath9k_hw_setrxfilter (ah, +ath9k_hw_getrxfilter (ah)& ~ATH9K_RX_FILTER_PHYRADAR ); + } +
Please drop this chunk of code and move the check to ath_calcrxfilter, which gets called after every reset anyway. Also, use a separate flag in sc->flags for actually enabling DFS. Even if the chip has DFS support, we don't always want to enable it - especially not on 2.4 GHz or indoor 5 GHz channels.
- Felix
RFC v2 2/2 ath9k: integrate initial DFS module
Quoted 55 lines · Felix Fietkau
Quoted 42 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including
* building the module intoath9k_hw
* setting up DFS debugfs
* defining HW capability flag for DFS support
* setting this flag by DFS supporting devices(so far: AR_SREV_9280_20_OR_LATER, TBC)* setting PHYRADAR rx filter flag to enable radar pulse reporting
* forward radar PHY errors to dfs moduleThis is WIP and at its current stage is limited to test ath9k pulse detection capabilities. The DFS pattern matching is TBD in the higher layers and is not part of this patch.
CONFIG_ATH9K_DFSmust be set to enable pulse detection.Signed-off-by Zefir Kurtisi<[email protected]>--- drivers/net/wireless/ath/ath9k/Makefile | 2 ++ drivers/net/wireless/ath/ath9k/debug.c | 3 +++ drivers/net/wireless/ath/ath9k/debug.h | 2 ++ drivers/net/wireless/ath/ath9k/hw.c | 12 ++++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 17 +++++++++++++++++ drivers/net/wireless/ath/ath9k/recv.c | 18 +++++++++++++----- 7 files changed, 50 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath9k/main.c +7
-0@@ -305,6 +305,23 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)ath9k_hw_antdiv_comb_conf_set (ah,&div_ant_conf); } +if (ah->caps.hw_caps&&ATH9K_HW_CAP_DFS ) { +/** +* enable radar pulse detection +* +* TODO: do this only for DFS channels +*/ + ah->private_ops.set_radar_params (ah,&ah->radar_conf);drivers/net/wireless/ath/ath9k/main.c static bool ath_complete_reset(struct ath_softc *sc, bool start) · line 324
Quoted 10 lines
drivers/net/wireless/ath/ath9k/main.c +10
-0+ath9k_hw_setrxfilter (ah, +ath9k_hw_getrxfilter (ah) |ATH9K_RX_FILTER_PHYRADAR ); +ath_dbg (common,ATH_DBG_DFS , +"DFS radar detection enabled for channel %d\n" , + ah->curchan->channel); + }else { +ath9k_hw_setrxfilter (ah, +ath9k_hw_getrxfilter (ah)& ~ATH9K_RX_FILTER_PHYRADAR ); + } +Please drop this chunk of code and move the check to
ath_calcrxfilter, which gets called after every reset anyway. Also, use a separate flag insc->flagsfor actually enabling DFS. Even if the chip has DFS support, we don't always want to enable it - especially not on 2.4 GHz or indoor 5 GHz channels.
Quoted 2 lines
- Felix
Hi Felix,
while I was waiting for your feedback on my related patch, I assumed you're okay with having those rx filter flags preserved in ath_calcrxfilter.
I'll check your proposal for v3.
BTW, as the comment says, it is TODO enable radar detection only for DFS channels. Beside the lack of the management module to provide the relevant information, it comes handy to test pulse detection on non-DFS channels without the need to modify hostapd ;)
Thanks,
Zefir
RFC v2 2/2 ath9k: integrate initial DFS module
Quoted 4 lines · Zefir Kurtisi
Hi Felix,
while I was waiting for your feedback on my related patch, I assumed you're okay with having those rx filter flags preserved in
ath_calcrxfilter.
I did send some feedback on the rx filter preserve patch. I think it's unnecessary and should be left out. If calcrxfilter properly returns the ATH9K_RX_FILTER_PHYRADAR flag where necessary, then no preserve logic is needed.
Quoted 6 lines
I'll check your proposal for v3.
BTW, as the comment says, it is TODO enable radar detection only for DFS channels. Beside the lack of the management module to provide the relevant information, it comes handy to test pulse detection on non-DFS channels without the need to modify hostapd ;)
Yeah, but it would be nice to split hardware capability from runtime state early on.
- Felix
RFC v2 2/2 ath9k: integrate initial DFS module
In reply to Zefir KurtisiHi Zefir,
Quoted 114 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including ?* building the module into
ath9k_hw
?* setting up DFS debugfs
?* defining HW capability flag for DFS support
?* setting this flag by DFS supporting devices
? (so far:AR_SREV_9280_20_OR_LATER, TBC)
?* setting PHYRADAR rx filter flag to enable radar ? pulse reporting
?* forward radar PHY errors to dfs moduleThis is WIP and at its current stage is limited to test ath9k pulse detection capabilities. The DFS pattern matching is TBD in the higher layers and is not part of this patch.
CONFIG_ATH9K_DFSmust be set to enable pulse detection.Signed-off-by Zefir Kurtisi <[email protected]>---
?drivers/net/wireless/ath/ath9k/Makefile | ? ?2 ++ ?drivers/net/wireless/ath/ath9k/debug.c ?| ? ?3 +++ ?drivers/net/wireless/ath/ath9k/debug.h ?| ? ?2 ++ ?drivers/net/wireless/ath/ath9k/hw.c ? ? | ? 12 ++++++++++++ ?drivers/net/wireless/ath/ath9k/hw.h ? ? | ? ?1 + ?drivers/net/wireless/ath/ath9k/main.c ? | ? 17 +++++++++++++++++ ?drivers/net/wireless/ath/ath9k/recv.c ? | ? 18 +++++++++++++-----?7 files changed, 50 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/Makefile +2
-0@@ -29,6 +29,8 @@ ath9k_hw-y:= ?\ ? ? ? ? ? ? ? ?eeprom_9287.o \ ? ? ? ? ? ? ? ?ani.o \ ? ? ? ? ? ? ? ?btcoex.o \ + ? ? ? ? ? ? ? dfs.o \ + ? ? ? ? ? ? ? dfs_debug.o \ ? ? ? ? ? ? ? ?mac.o \ ? ? ? ? ? ? ? ?ar9002_mac.o \ ? ? ? ? ? ? ? ?ar9003_mac.o \drivers/net/wireless/ath/ath9k/debug.c +0
-0@@ -1633,6 +1633,9 @@ int ath9k_init_debug(struct ath_hw *ah) ? ? ? ?debugfs_create_file("debug", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, ? ? ? ? ? ? ? ? ? ? ? ? ? ?sc, &fops_debug);?#endif
drivers/net/wireless/ath/ath9k/debug.c +3
-0+ + ? ? ? ath9k_dfs_init_debug(sc); +? ? ? ?debugfs_create_file("dma",
S_IRUSR,sc->debug.debugfs_phy, sc, ? ? ? ? ? ? ? ? ? ? ? ? ? ?&fops_dma);
? ? ? ?debugfs_create_file("interrupt",S_IRUSR,sc->debug.debugfs_phy, sc,drivers/net/wireless/ath/ath9k/debug.h +0
-0@@ -19,6 +19,7 @@?#include "
hw.h"
?#include "rc.h"
+#include "dfs_debug.h"?struct
ath_txq;
?structath_buf;drivers/net/wireless/ath/ath9k/debug.h +1
-0@@ -180,6 +181,7 @@ struct ath_stats { ? ? ? ?struct ath_interrupt_stats istats; ? ? ? ?struct ath_tx_stats txstats[ATH9K_NUM_TX_QUEUES]; ? ? ? ?struct ath_rx_stats rxstats; + ? ? ? struct ath_dfs_stats dfs_stats; ? ? ? ?u32 reset[__RESET_TYPE_MAX]; ?};drivers/net/wireless/ath/ath9k/hw.c +12
-0@@ -2333,6 +2333,18 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) ? ? ? ? ? ? ? ?pCap->pcie_lcr_offset = 0x80; ? ? ? ?} +#ifdef CONFIG_ATH9K_DFS + ? ? ? /* + ? ? ? ?* enable radar detection on DFS supporting devices + ? ? ? ?*/ + ? ? ? if (AR_SREV_9280_20_OR_LATER(ah)) { + ? ? ? ? ? ? ? /* + ? ? ? ? ? ? ? ?* TODO: check for which chip-sets we want to support DFS + ? ? ? ? ? ? ? ?*/ + ? ? ? ? ? ? ? pCap->hw_caps |= ATH9K_HW_CAP_DFS; + ? ? ? } +#endif + ? ? ? ?tx_chainmask = pCap->tx_chainmask; ? ? ? ?rx_chainmask = pCap->rx_chainmask; ? ? ? ?while (tx_chainmask || rx_chainmask) {drivers/net/wireless/ath/ath9k/hw.h +1
-0@@ -204,6 +204,7 @@ enum ath9k_hw_caps { ? ? ? ?ATH9K_HW_CAP_5GHZ ? ? ? ? ? ? ? ? ? ? ? = BIT(14), ? ? ? ?ATH9K_HW_CAP_APM ? ? ? ? ? ? ? ? ? ? ? ?= BIT(15), ? ? ? ?ATH9K_HW_CAP_RTT ? ? ? ? ? ? ? ? ? ? ? ?= BIT(16), + ? ? ? ATH9K_HW_CAP_DFS ? ? ? ? ? ? ? ? ? ? ? ?= BIT(17), ?}; ?struct ath9k_hw_capabilities {drivers/net/wireless/ath/ath9k/main.c +0
-0
drivers/net/wireless/ath/ath9k/main.c static bool ath_complete_reset(struct ath_softc *sc, bool start) · line 314
Quoted 10 lines
drivers/net/wireless/ath/ath9k/main.c +7
-0@@ -305,6 +305,23 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start) ? ? ? ? ? ? ? ?ath9k_hw_antdiv_comb_conf_set(ah, &div_ant_conf); ? ? ? ?} + ? ? ? if (ah->caps.hw_caps && ATH9K_HW_CAP_DFS) { + ? ? ? ? ? ? ? /** + ? ? ? ? ? ? ? ?* enable radar pulse detection + ? ? ? ? ? ? ? ?* + ? ? ? ? ? ? ? ?* TODO: do this only for DFS channels + ? ? ? ? ? ? ? ?*/ + ? ? ? ? ? ? ? ah->private_ops.set_radar_params(ah, &ah->radar_conf);
can we do this something like ath9k_hw_set_radar_params? why we need a seperate debug file for dfs, had i missed something?
Quoted 64 lines
drivers/net/wireless/ath/ath9k/main.c +10
-0+ ? ? ? ? ? ? ? ath9k_hw_setrxfilter(ah, + ? ? ? ? ? ? ? ? ? ? ? ath9k_hw_getrxfilter(ah) | ATH9K_RX_FILTER_PHYRADAR); + ? ? ? ? ? ? ? ath_dbg(common, ATH_DBG_DFS, + ? ? ? ? ? ? ? ? ? ? ? "DFS radar detection enabled for channel %d\n", + ? ? ? ? ? ? ? ? ? ? ? ah->curchan->channel); + ? ? ? } else { + ? ? ? ? ? ? ? ath9k_hw_setrxfilter(ah, + ? ? ? ? ? ? ? ? ? ? ? ath9k_hw_getrxfilter(ah) & ~ATH9K_RX_FILTER_PHYRADAR); + ? ? ? } + ? ? ? ?ieee80211_wake_queues(sc->hw); ? ? ? ?return true;drivers/net/wireless/ath/ath9k/recv.c +0
-0@@ -17,6 +17,7 @@?#include <
linux/dma-mapping.h>
?#include "ath9k.h"
?#include "ar9003_mac.h"
+#include "dfs.h"?#define
SKB_CB_ATHBUF(__skb)? (*((structath_buf**)__skb->cb))drivers/net/wireless/ath/ath9k/recv.c +0
-5@@ -1865,11 +1866,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ? ? ? ? ? ? ? ?if (sc->sc_flags & SC_OP_RXFLUSH) ? ? ? ? ? ? ? ? ? ? ? ?goto requeue_drop_frag; - ? ? ? ? ? ? ? retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs, - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?rxs, &decrypt_error); - ? ? ? ? ? ? ? if (retval) - ? ? ? ? ? ? ? ? ? ? ? goto requeue_drop_frag; - ? ? ? ? ? ? ? ?rxs->mactime = (tsf & ~0xffffffffULL) | rs.rs_tstamp;? ? ? ? ? ? ? ?if (rs.rs_tstamp >
tsf_lower&&
? ? ? ? ? ? ? ? ? ?unlikely(rs.rs_tstamp -tsf_lower>0x10000000))drivers/net/wireless/ath/ath9k/recv.c +12
-0@@ -1879,6 +1875,18 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ? ? ? ? ? ? ? ? ? ?unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) ? ? ? ? ? ? ? ? ? ? ? ?rxs->mactime += 0x100000000ULL; + ? ? ? ? ? ? ? if ((ah->caps.hw_caps & ATH9K_HW_CAP_DFS) && + ? ? ? ? ? ? ? ? ? (rs.rs_status & ATH9K_RXERR_PHY) && + ? ? ? ? ? ? ? ? ? (rs.rs_phyerr == ATH9K_PHYERR_RADAR)) { + ? ? ? ? ? ? ? ? ? ? ? /* DFS: check for radar pulse */ + ? ? ? ? ? ? ? ? ? ? ? ath9k_dfs_process_phyerr(sc, hdr, &rs, rxs->mactime); + ? ? ? ? ? ? ? } + + ? ? ? ? ? ? ? retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs, + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?rxs, &decrypt_error); + ? ? ? ? ? ? ? if (retval) + ? ? ? ? ? ? ? ? ? ? ? goto requeue_drop_frag; +? ? ? ? ? ? ? ?/* Ensure we always have an skb to requeue once we are done ? ? ? ? ? ? ? ? * processing the current buffer's skb */
? ? ? ? ? ? ? ?requeue_skb =ath_rxbuf_alloc(common, common->rx_bufsize, GFP_ATOMIC); --
1.7.4.1--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html
Signature · 1 line
shafi
RFC v2 2/2 ath9k: integrate initial DFS module
Quoted 2 lines · Mohammed Shafi
Hi Zefir,
Hello Mohammed,
Quoted 11 lines · Zefir Kurtisi
drivers/net/wireless/ath/ath9k/main.c static bool ath_complete_reset(struct ath_softc *sc, bool start) · line 314
Quoted 9 lines
[...]
drivers/net/wireless/ath/ath9k/main.c +7
-0+if (ah->caps.hw_caps &&ATH9K_HW_CAP_DFS ) { +/** +* enable radar pulse detection +* +* TODO: do this only for DFS channels +*/ + ah->private_ops.set_radar_params (ah, &ah->radar_conf);
Quoted 3 lines
can we do this something like
ath9k_hw_set_radar_params? why we need a seperate debug file for dfs, had i missed something?
My first proposal included the DFS statistics in debug.c, but Luis asked me to keep it separated (see http://www.mail-archive.com/ath9k-devel at lists.ath9k.org/msg06821.html). I'm fine with both approaches, just let me know.
I'll add a ath9k_hw_set_radar_params() in v3.
Thanks,
Zefir
RFC v2 2/2 ath9k: integrate initial DFS module
Quoted 16 lines · Zefir Kurtisi
Quoted 2 lines · Mohammed Shafi
Hi Zefir,
Hello Mohammed,
Quoted 11 lines · Zefir Kurtisi
Quoted 9 lines
[...]
+ ? ? ? if (
ah->caps.hw_caps&&ATH9K_HW_CAP_DFS) {
+ ? ? ? ? ? ? ? /**
+ ? ? ? ? ? ? ? ?* enable radar pulse detection
+ ? ? ? ? ? ? ? ?*
+ ? ? ? ? ? ? ? ?* TODO: do this only for DFS channels
+ ? ? ? ? ? ? ? ?*/
+ ? ? ? ? ? ? ?ah->private_ops.set_radar_params(ah, &ah->radar_conf);
Quoted 4 lines
Quoted 3 lines
can we do this something like
ath9k_hw_set_radar_params? why we need a seperate debug file for dfs, had i missed something?My first proposal included the DFS statistics in
debug.c, but Luis asked me to keep it separated (see http://www.mail-archive.com/ath9k-devel at lists.ath9k.org/msg06821.html). I'm fine with both approaches, just let me know.
oh ok. please follow up with Luis's approach. thanks.
Quoted 7 lines
I'll add a
ath9k_hw_set_radar_params()in v3.Thanks,
Zefir
Signature · 1 line
shafi
RFC v2 2/2 ath9k: integrate initial DFS module
In reply to Zefir KurtisiQuoted 10 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including
* building the module intoath9k_hw
* setting up DFS debugfs
* defining HW capability flag for DFS support
* setting this flag by DFS supporting devices (so far:AR_SREV_9280_20_OR_LATER, TBC)
* setting PHYRADAR rx filter flag to enable radar pulse reporting
* forward radar PHY errors to dfs module
Quoted 5 lines
This is WIP and at its current stage is limited to test ath9k pulse detection capabilities. The DFS pattern matching is TBD in the higher layers and is not part of this patch.
CONFIG_ATH9K_DFSmust be set to enable pulse detection.
where? There's no kconfig option, yet it has the CONFIG_ perifx. So people will be looking for it.
This is exactly why I made such a big fuss about CONFIG_XYZ issue last time.
<http://www.mail-archive.com/[email protected]/msg06825.html>
Just drop the ifdef.
Quoted 22 lines
Signed-off-by Zefir Kurtisi <[email protected]>--- drivers/net/wireless/ath/ath9k/Makefile | 2 ++ drivers/net/wireless/ath/ath9k/debug.c | 3 +++ drivers/net/wireless/ath/ath9k/debug.h | 2 ++ drivers/net/wireless/ath/ath9k/hw.c | 12 ++++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 17 +++++++++++++++++ drivers/net/wireless/ath/ath9k/recv.c | 18 +++++++++++++----- 7 files changed, 50 insertions(+), 5 deletions(-)drivers/net/wireless/ath/ath9k/hw.c +5
-0@@ -2333,6 +2333,18 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) pCap->pcie_lcr_offset =0x80 ; } +#ifdef CONFIG_ATH9K_DFS +/* +* enable radar detection on DFS supporting devices +*/ +if (AR_SREV_9280_20_OR_LATER (ah)) {
drivers/net/wireless/ath/ath9k/hw.c int ath9k_hw_fill_cap_info(struct ath_hw *ah) · line 2350
Quoted 10 lines
drivers/net/wireless/ath/ath9k/hw.c +7
-0+/* +* TODO: check for which chip-sets we want to support DFS +*/ + pCap->hw_caps |= ATH9K_HW_CAP_DFS; + } +#endif + tx_chainmask = pCap->tx_chainmask; rx_chainmask = pCap->rx_chainmask;while (tx_chainmask || rx_chainmask) {
Regards,
Chr
RFC v2 2/2 ath9k: integrate initial DFS module
Quoted 15 lines · Christian Lamparter
Quoted 14 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including
* building the module intoath9k_hw
* setting up DFS debugfs
* defining HW capability flag for DFS support
* setting this flag by DFS supporting devices (so far:AR_SREV_9280_20_OR_LATER, TBC)
* setting PHYRADAR rx filter flag to enable radar pulse reporting
* forward radar PHY errors to dfs moduleThis is WIP and at its current stage is limited to test ath9k pulse detection capabilities. The DFS pattern matching is TBD in the higher layers and is not part of this patch.
Quoted 9 lines
Quoted 1 line
CONFIG_ATH9K_DFSmust be set to enable pulse detection.where? There's no kconfig option, yet it has the
CONFIG_perifx. So people will be looking for it.This is exactly why I made such a big fuss about
CONFIG_XYZissue last time.
<http://www.mail-archive.com/[email protected]/msg06825.html>
Just drop the ifdef.
Hi Christian,
I just followed Luis' request to follow the regulatory statement and make non regulatory certified code unusable by the 'common user'.
Therefore, not (yet) selectable as a kconfig option, but for devs and testers to be easily enabled.
At this stage, removing the ifdef would not harm, because all the code does is counting events. But for the long run I understand it is a sensitive topic and requires to be disabled (at least as default setting).
I'll consider your feedback for v3, thanks. Just clarify whether you do not like the CONFIG_ prefix or the fact that it can't be enabled.
Quoted 2 lines
Regards,
Chr
Cheers
Zefir
RFC v2 2/2 ath9k: integrate initial DFS module
Quoted 30 lines · Zefir Kurtisi
Quoted 15 lines · Christian Lamparter
Quoted 14 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including
* building the module intoath9k_hw
* setting up DFS debugfs
* defining HW capability flag for DFS support
* setting this flag by DFS supporting devices(so far: AR_SREV_9280_20_OR_LATER, TBC)* setting PHYRADAR rx filter flag to enable radar pulse reporting
* forward radar PHY errors to dfs moduleThis is WIP and at its current stage is limited to test ath9k pulse detection capabilities. The DFS pattern matching is TBD in the higher layers and is not part of this patch.
Quoted 9 lines
Quoted 1 line
CONFIG_ATH9K_DFSmust be set to enable pulse detection.where? There's no kconfig option, yet it has the
CONFIG_perifx. So people will be looking for it.This is exactly why I made such a big fuss about
CONFIG_XYZissue last time.
<http://www.mail-archive.com/[email protected]/msg06825.html>
Just drop the ifdef.Hi Christian,
I just followed Luis' request to follow the regulatory statement and make non regulatory certified code unusable by the 'common user'.
Quoted 7 lines
Therefore, not (yet) selectable as a kconfig option, but for devs and testers to be easily enabled.
At this stage, removing the ifdef would not harm, because all the code does is counting events. But for the long run I understand it is a sensitive topic and requires to be disabled (at least as default setting).
I don't think it's a sensitive topic at all. Just leave out all the ifdef stuff. In the long run when we actually get to the part where we can test a full DFS implementation, the only thing that needs to be left out for normal users is the flag announcing support for it.
- Felix
RFC v2 2/2 ath9k: integrate initial DFS module
Quoted 20 lines · Felix Fietkau
Quoted 19 lines · Zefir Kurtisi
Quoted 10 lines · Christian Lamparter
Quoted 1 line · Zefir Kurtisi
[...]
where? There's no kconfig option, yet it has the
CONFIG_perifx. So people will be looking for it.This is exactly why I made such a big fuss about
CONFIG_XYZissue last time.
<http://www.mail-archive.com/[email protected]/msg06825.html>
Just drop the ifdef.Hi Christian,
I just followed Luis' request to follow the regulatory statement and make non regulatory certified code unusable by the 'common user'.
Therefore, not (yet) selectable as a kconfig option, but for devs and testers to be easily enabled.
Quoted 7 lines
Quoted 4 lines
At this stage, removing the ifdef would not harm, because all the code does is counting events. But for the long run I understand it is a sensitive topic and requires to be disabled (at least as default setting).
I don't think it's a sensitive topic at all. Just leave out all the ifdef stuff. In the long run when we actually get to the part where we can test a full DFS implementation, the only thing that needs to be left out for normal users is the flag announcing support for it.
- Felix
Yes, and that's what is done here: just let the HW pretend having no DFS capabilities until enabled.
Anyhow, DFS channels operation is not supported so far (and will be controlled) by hostapd, it's therefore safe to remove the remaining ifdef in v3.
Thanks
Zefir
RFC v2 2/2 ath9k: integrate initial DFS module
In reply to Zefir KurtisiQuoted 2 lines · Zefir Kurtisi
Just clarify whether you do not like the
CONFIG_prefix or the fact that it can't be enabled.
It's IMO always stupid to add dead code. No exceptions for $random_authority_which_has_no_jurisdiction_for_billions_of_users.
//Peter
RFC v2 2/2 ath9k: integrate initial DFS module
Quoted 9 lines · Peter Stuge
Quoted 2 lines · Zefir Kurtisi
Just clarify whether you do not like the
CONFIG_prefix or the fact that it can't be enabled.It's IMO always stupid to add dead code. No exceptions for $random_authority_which_has_no_jurisdiction_for_billions_of_users.
//Peter
Hi Peter,
ok, got it.
But I don't call it dead code when its sole purpose is to be tested by developers (i.e. useless for the common user) and can be easily enabled by those. This is only a tiny fraction of the DFS functionality at the lowest layer that need additional support at the upper (mac, hostapd) that is missing so far. Therefore I opted to make it available for devs until all pieces are in (no authority issue, just sanity), but will change it in v3.
Thanks for your feedback
Zefir