ath9k: DFS radar detection
cover ath9k: DFS radar detection
This patch series proposes DFS radar pulse detection for ath9k.
The first patch adds a new DFS module, the second turns those knobs to enable the HW to detect radar pulses and forward them to the new module.
Here, sanity and plausibility checks that are HW dependent are performed and resulting radar events are passed to higher level generic pattern detectors for further processing (spectrum management, etc.).
DFS support is limited to newer chip-sets (for now 9280 and later).
So far, AP operation on DFS channels is not supported by mac80211/hostapd. Testing the proposed pulse detection is done in monitor mode.
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/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/debug.c | 3 + drivers/net/wireless/ath/ath9k/debug.h | 2 + drivers/net/wireless/ath/ath9k/dfs.c | 203 ++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/dfs.h | 38 +++++ drivers/net/wireless/ath/ath9k/dfs_debug.c | 89 ++++++++++++ drivers/net/wireless/ath/ath9k/dfs_debug.h | 59 ++++++++ drivers/net/wireless/ath/ath9k/hw-ops.h | 9 ++ drivers/net/wireless/ath/ath9k/hw.c | 7 + drivers/net/wireless/ath/ath9k/hw.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 16 +++ drivers/net/wireless/ath/ath9k/recv.c | 19 ++- 14 files changed, 446 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
PATCH 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 pulse 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 | 203 ++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath9k/dfs.h | 38 +++++ drivers/net/wireless/ath/ath9k/dfs_debug.c | 89 ++++++++++++ drivers/net/wireless/ath/ath9k/dfs_debug.h | 59 ++++++++ 5 files changed, 391 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 +203 -0
203 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/dfs.h new file +38 -0
@@ -0,0 +1,38 @@ +/* +* 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 + +/** +* ath9k_dfs_process_phyerr - process radar PHY error +* @sc: ath_softc +* @data: RX payload data +* @rs: RX status after processing descriptor +* @mactime: receive time +* +* This function is called whenever the HW DFS module detects a radar +* pulse and reports it as a PHY error. +* +* The radar information provided as raw payload data is validated and +* filtered for false pulses. Events passing all tests are forwarded to +* the upper layer for pattern detection. +*/ +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
PATCH 2/2 ath9k: integrate initial DFS module
In reply to Zefir KurtisiThis patch integrates the DFS module into ath9k, including
* build the module into ath9k_hw
* set up DFS debugfs
* define HW capability flag for DFS support
(so far: AR_SREV_9280_20_OR_LATER, TBC)
* define and set DFS opmode flag when on DFS channel
* configure radar params after reset
* provide radar RX filter flag in ath_calcrxfilter()
* 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 not part of this patch.
--- drivers/net/wireless/ath/ath9k/Makefile | 2 ++ drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/debug.c | 3 +++ drivers/net/wireless/ath/ath9k/debug.h | 2 ++ drivers/net/wireless/ath/ath9k/hw-ops.h | 9 +++++++++ drivers/net/wireless/ath/ath9k/hw.c | 7 +++++++ drivers/net/wireless/ath/ath9k/hw.h | 1 + drivers/net/wireless/ath/ath9k/main.c | 16 ++++++++++++++++ drivers/net/wireless/ath/ath9k/recv.c | 19 ++++++++++++++----- 9 files changed, 55 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/ath9k.h +1 -0
@@ -563,6 +563,7 @@ struct ath_ant_comb {#define SC_OP_BT_SCAN BIT(13)#define SC_OP_ANI_RUN BIT(14)#define SC_OP_PRIM_STA_VIF BIT(15) +#define SC_OP_DFS BIT(16)/* Powersave flags */ #define PS_WAIT_FOR_BEACON BIT(0)
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-ops.h +9 -0
@@ -212,4 +212,13 @@ static inline int ath9k_hw_fast_chan_change(struct ath_hw *ah,return ath9k_hw_private_ops (ah)->fast_chan_change (ah, chan, ini_reloaded); } + +static inline void ath9k_hw_set_radar_params (struct ath_hw *ah) +{ +if (!ath9k_hw_private_ops (ah)->set_radar_params) +return ; + +ath9k_hw_private_ops (ah)->set_radar_params (ah, &ah->radar_conf); +} +#endif /* ATH9K_HW_OPS_H */
drivers/net/wireless/ath/ath9k/hw.c +7 -0
@@ -2333,6 +2333,13 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) pCap->pcie_lcr_offset =0x80 ; } +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 ; + } + 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 +16 -0
@@ -305,6 +305,10 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)ath9k_hw_antdiv_comb_conf_set (ah, &div_ant_conf); } +/* set radar parameters if in DFS mode */ +if (sc->sc_flags &SC_OP_DFS ) +ath9k_hw_set_radar_params (ah); +ieee80211_wake_queues (sc->hw);return true;
@@ -1722,9 +1726,21 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)memset (&sc->survey[pos],0 ,sizeof (struct survey_info )); } +if (curchan->flags &IEEE80211_CHAN_RADAR ) { +if (!(ah->caps.hw_caps &ATH9K_HW_CAP_DFS )) { +ath_err (common,"HW does not support DFS\n" ); +mutex_unlock (&sc->mutex); +return -EINVAL ; + } + sc->sc_flags |=SC_OP_DFS ; + }else + sc->sc_flags &= ~SC_OP_DFS ; +if (ath_set_channel (sc, hw, &sc->sc_ah->channels[pos]) <0 ) {ath_err (common,"Unable to set channel\n" );mutex_unlock (&sc->mutex); +/* clear DFS operation flag on failure */ + sc->sc_flags &= ~SC_OP_DFS ;return -EINVAL ; }
drivers/net/wireless/ath/ath9k/recv.c +14 -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))
@@ -473,6 +474,8 @@ u32 ath_calcrxfilter(struct ath_softc *sc) rfilt |=ATH9K_RX_FILTER_MCAST_BCAST_ALL ; } +if (sc->sc_flags &SC_OP_DFS ) + rfilt |=ATH9K_RX_FILTER_PHYRADAR ;return rfilt;#undef RX_FILTER_PRESERVE
@@ -1855,11 +1858,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 ))
@@ -1869,6 +1867,17 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) rxs->mactime += 0x100000000ULL; +if ((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
PATCH 2/2 ath9k: integrate initial DFS module
Hi Zefir,
just few doubt, sorry for the late reply
Quoted 208 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including ?* build the module into
ath9k_hw
?* set up DFS debugfs
?* define HW capability flag for DFS support
? (so far:AR_SREV_9280_20_OR_LATER, TBC)
?* define and set DFS opmode flag when on DFS channel ? * configure radar params after reset
? * provide radar RX filter flag inath_calcrxfilter()?* 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 not part of this patch.
Signed-off-by Zefir Kurtisi <[email protected]>---
?drivers/net/wireless/ath/ath9k/Makefile | ? ?2 ++ ?drivers/net/wireless/ath/ath9k/ath9k.h ?| ? ?1 + ?drivers/net/wireless/ath/ath9k/debug.c ?| ? ?3 +++ ?drivers/net/wireless/ath/ath9k/debug.h ?| ? ?2 ++ ?drivers/net/wireless/ath/ath9k/hw-ops.h | ? ?9 +++++++++ ?drivers/net/wireless/ath/ath9k/hw.c ? ? | ? ?7 +++++++ ?drivers/net/wireless/ath/ath9k/hw.h ? ? | ? ?1 + ?drivers/net/wireless/ath/ath9k/main.c ? | ? 16 ++++++++++++++++ ?drivers/net/wireless/ath/ath9k/recv.c ? | ? 19 ++++++++++++++-----?9 files changed, 55 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/ath9k.h +1
-0@@ -563,6 +563,7 @@ struct ath_ant_comb { ?#define SC_OP_BT_SCAN ? ? ? ? ? ? ? BIT(13) ?#define SC_OP_ANI_RUN ? ? ? ? ? ? ? BIT(14) ?#define SC_OP_PRIM_STA_VIF ? ? ? ? ?BIT(15) +#define SC_OP_DFS ? ? ? ? ? ? ? ? ? BIT(16)?/* Powersave flags */
?#definePS_WAIT_FOR_BEACON? ? ? ?BIT(0)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-ops.h +9
-0@@ -212,4 +212,13 @@ static inline int ath9k_hw_fast_chan_change(struct ath_hw *ah, ? ? ? ?return ath9k_hw_private_ops(ah)->fast_chan_change(ah, chan, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ini_reloaded); ?} + +static inline void ath9k_hw_set_radar_params (struct ath_hw *ah) +{ + ? ? ? if (!ath9k_hw_private_ops(ah)->set_radar_params) + ? ? ? ? ? ? ? return; + + ? ? ? ath9k_hw_private_ops(ah)->set_radar_params(ah, &ah->radar_conf); +} +?#endif /*
ATH9K_HW_OPS_H*/drivers/net/wireless/ath/ath9k/hw.c +7
-0@@ -2333,6 +2333,13 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) ? ? ? ? ? ? ? ?pCap->pcie_lcr_offset = 0x80; ? ? ? ?} + ? ? ? 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; + ? ? ? } + ? ? ? ?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 +16
-0@@ -305,6 +305,10 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start) ? ? ? ? ? ? ? ?ath9k_hw_antdiv_comb_conf_set(ah, &div_ant_conf); ? ? ? ?} + ? ? ? /* set radar parameters if in DFS mode */ + ? ? ? if (sc->sc_flags & SC_OP_DFS) + ? ? ? ? ? ? ? ath9k_hw_set_radar_params(ah); + ? ? ? ?ieee80211_wake_queues(sc->hw); ? ? ? ?return true;@@ -1722,9 +1726,21 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) ? ? ? ? ? ? ? ? ? ? ? ?memset(&sc->survey[pos], 0, sizeof(struct survey_info)); ? ? ? ? ? ? ? ?} + ? ? ? ? ? ? ? if (curchan->flags & IEEE80211_CHAN_RADAR) { + ? ? ? ? ? ? ? ? ? ? ? if (!(ah->caps.hw_caps & ATH9K_HW_CAP_DFS)) { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ath_err(common, "HW does not support DFS\n"); + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mutex_unlock(&sc->mutex); + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return -EINVAL; + ? ? ? ? ? ? ? ? ? ? ? } + ? ? ? ? ? ? ? ? ? ? ? sc->sc_flags |= SC_OP_DFS; + ? ? ? ? ? ? ? } else + ? ? ? ? ? ? ? ? ? ? ? sc->sc_flags &= ~SC_OP_DFS; + ? ? ? ? ? ? ? ?if (ath_set_channel(sc, hw, &sc->sc_ah->channels[pos]) < 0) { ? ? ? ? ? ? ? ? ? ? ? ?ath_err(common, "Unable to set channel\n"); ? ? ? ? ? ? ? ? ? ? ? ?mutex_unlock(&sc->mutex); + ? ? ? ? ? ? ? ? ? ? ? /* clear DFS operation flag on failure */ + ? ? ? ? ? ? ? ? ? ? ? sc->sc_flags &= ~SC_OP_DFS; ? ? ? ? ? ? ? ? ? ? ? ?return -EINVAL; ? ? ? ? ? ? ? ?}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 +2
-0@@ -473,6 +474,8 @@ u32 ath_calcrxfilter(struct ath_softc *sc) ? ? ? ? ? ? ? ?rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL; ? ? ? ?} + ? ? ? if (sc->sc_flags & SC_OP_DFS) + ? ? ? ? ? ? ? rfilt |= ATH9K_RX_FILTER_PHYRADAR; ? ? ? ?return rfilt;?#undef
RX_FILTER_PRESERVEdrivers/net/wireless/ath/ath9k/recv.c +0
-5@@ -1855,11 +1858,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 +0
-0@@ -1869,6 +1867,17 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ? ? ? ? ? ? ? ? ? ?unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) ? ? ? ? ? ? ? ? ? ? ? ?rxs->mactime += 0x100000000ULL;
drivers/net/wireless/ath/ath9k/recv.c int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) · line 1879
Quoted 10 lines
drivers/net/wireless/ath/ath9k/recv.c +10
-0+ ? ? ? ? ? ? ? if ((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;
does the above fixes any bug related to mactime displayed in sniffer
+
Quoted 7 lines
? ? ? ? ? ? ? ?/* 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
Signature · 1 line
shafi
PATCH 2/2 ath9k: integrate initial DFS module
Quoted 25 lines · Mohammed Shafi
Hi Zefir,
just few doubt, sorry for the late reply
Quoted 19 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including
* build the module intoath9k_hw
* set up DFS debugfsdrivers/net/wireless/ath/ath9k/recv.c +0
-5@@ -1855,11 +1858,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 ))@@ -1869,6 +1867,17 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) rxs->mactime +=0x100000000ULL ;
Quoted 14 lines
drivers/net/wireless/ath/ath9k/recv.c int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) · line 1879
Quoted 10 lines
drivers/net/wireless/ath/ath9k/recv.c +10
-0+if ((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;does the above fixes any bug related to mactime displayed in sniffer
Hi Mohammed,
no, like all other modifications within this patch the above does not fix anything (at least not intentionally) ;)
What it does is moving the calculation of rxs->mactime before ath9k_rx_skb_preprocess(), since the mactime is needed to stamp the radar event. So, the five lines marked as removals are actually moved further down which shouldn't have any side effects.
Thanks
Zefir
PATCH 2/2 ath9k: integrate initial DFS module
Quoted 41 lines · Zefir Kurtisi
Quoted 25 lines · Mohammed Shafi
Hi Zefir,
just few doubt, sorry for the late reply
Quoted 19 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including ?* build the module into
ath9k_hw
?* set up DFS debugfs(quoted diff) +0
-5@@ -1855,11 +1858,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))(quoted diff) +0
-0@@ -1869,6 +1867,17 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ? ? ? ? ? ? ? ? ? ?unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) ? ? ? ? ? ? ? ? ? ? ? ?rxs->mactime += 0x100000000ULL;Quoted 14 lines
Review int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) · line 1879
Quoted 10 lines
(quoted diff) +10
-0+ ? ? ? ? ? ? ? if ((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;does the above fixes any bug related to mactime displayed in sniffer
Quoted 5 lines
Hi Mohammed,
no, like all other modifications within this patch the above does not fix anything (at least not intentionally) ;)
What it does is moving the calculation of
rxs->mactimebeforeath9k_rx_skb_preprocess(), since the mactime is needed to stamp the radar event. So, the five lines marked as removals are actually moved further down which shouldn't have any side effects.
Zefir, can you split the patch so that the move of ath9k_rx_skb_preprocess() call can clearly be marked as a separate change, if a regressions should be introduced by the move the move itself would be single regression instead of the entire DFS patch.
Luis
PATCH 2/2 ath9k: integrate initial DFS module
In reply to Zefir KurtisiQuoted 19 lines
Quoted 4 lines
Quoted 4 lines
(quoted diff) +0
-0@@ -1869,6 +1867,17 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ? ? ? ? ? ? ? ? ? ?unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) ? ? ? ? ? ? ? ? ? ? ? ?rxs->mactime += 0x100000000ULL;Quoted 14 lines
Review int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) · line 1879
Quoted 10 lines
(quoted diff) +10
-0+ ? ? ? ? ? ? ? if ((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;does the above fixes any bug related to mactime displayed in sniffer
Quoted 5 lines
Hi Mohammed,
no, like all other modifications within this patch the above does not fix anything (at least not intentionally) ;)
What it does is moving the calculation of
rxs->mactimebeforeath9k_rx_skb_preprocess(), since the mactime is needed to stamp the radar event. So, the five lines marked as removals are actually moved further down which shouldn't have any side effects.
sure, thanks a lot for your explanation ;)
Quoted 5 lines
Thanks
Zefir
Signature · 1 line
shafi
PATCH 2/2 ath9k: integrate initial DFS module
In reply to Zefir KurtisiQuoted 45 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including ?* build the module into
ath9k_hw
?* set up DFS debugfs
?* define HW capability flag for DFS support
? (so far:AR_SREV_9280_20_OR_LATER, TBC)
?* define and set DFS opmode flag when on DFS channel ? * configure radar params after reset
? * provide radar RX filter flag inath_calcrxfilter()?* 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 not part of this patch.
Signed-off-by Zefir Kurtisi <[email protected]>---
?drivers/net/wireless/ath/ath9k/Makefile | ? ?2 ++ ?drivers/net/wireless/ath/ath9k/ath9k.h ?| ? ?1 + ?drivers/net/wireless/ath/ath9k/debug.c ?| ? ?3 +++ ?drivers/net/wireless/ath/ath9k/debug.h ?| ? ?2 ++ ?drivers/net/wireless/ath/ath9k/hw-ops.h | ? ?9 +++++++++ ?drivers/net/wireless/ath/ath9k/hw.c ? ? | ? ?7 +++++++ ?drivers/net/wireless/ath/ath9k/hw.h ? ? | ? ?1 + ?drivers/net/wireless/ath/ath9k/main.c ? | ? 16 ++++++++++++++++ ?drivers/net/wireless/ath/ath9k/recv.c ? | ? 19 ++++++++++++++-----?9 files changed, 55 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/ath9k.h +0
-0
drivers/net/wireless/ath/ath9k/ath9k.h struct ath_ant_comb { · line 566
Quoted 4 lines
drivers/net/wireless/ath/ath9k/ath9k.h +1
-0@@ -563,6 +563,7 @@ struct ath_ant_comb { ?#define SC_OP_BT_SCAN ? ? ? ? ? ? ? BIT(13) ?#define SC_OP_ANI_RUN ? ? ? ? ? ? ? BIT(14) ?#define SC_OP_PRIM_STA_VIF ? ? ? ? ?BIT(15) +#define SC_OP_DFS ? ? ? ? ? ? ? ? ? BIT(16)
The way you use this is to set the bit when a DFS channel is found on the mac80211 config() callback so that upon ath_complete_reset() we call ath9k_hw_set_radar_params() with the params captured in ath_calcrxfilter(). This seems fair... but have you considered all the other cases that will call ath_complete_reset() that do come through the mac80211 config() callback? What got me thinking about this was the actual declaration of this bit, is it really necessary? It seems to reflect a state from a small state machine that you need to ensure is respected. If this is true you just need then to guarantee that that the ath9k_hw_set_radar_params() will get called properly for all the cases that you do need. Its not clear from the current implementation that this is the case right now, it seems a bit fragile. Consider all the idle() and non-idle() calls that mac80211 could use to call on the driver. Granted, the idle stuff is mostly observed on the client side, but its just one case I am thinking off the top of my head based on a quick review of this patch.
Quoted 59 lines
?/* Powersave flags */
?#definePS_WAIT_FOR_BEACON? ? ? ?BIT(0)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-ops.h +9
-0@@ -212,4 +212,13 @@ static inline int ath9k_hw_fast_chan_change(struct ath_hw *ah, ? ? ? ?return ath9k_hw_private_ops(ah)->fast_chan_change(ah, chan, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?ini_reloaded); ?} + +static inline void ath9k_hw_set_radar_params (struct ath_hw *ah) +{ + ? ? ? if (!ath9k_hw_private_ops(ah)->set_radar_params) + ? ? ? ? ? ? ? return; + + ? ? ? ath9k_hw_private_ops(ah)->set_radar_params(ah, &ah->radar_conf); +} +?#endif /*
ATH9K_HW_OPS_H*/drivers/net/wireless/ath/ath9k/hw.c +0
-0
drivers/net/wireless/ath/ath9k/hw.c int ath9k_hw_fill_cap_info(struct ath_hw *ah) · line 2342
Quoted 10 lines
drivers/net/wireless/ath/ath9k/hw.c +7
-0@@ -2333,6 +2333,13 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) ? ? ? ? ? ? ? ?pCap->pcie_lcr_offset = 0x80; ? ? ? ?} + ? ? ? 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; + ? ? ? } +
Please change to AR_SREV_9300_20_OR_LATER(), its the only family that we can likely get resources to support, validate and test for. I'm even having a hard time getting support, etc for AR9003 but I think its fair to at least get this chugging for AR9003. If someone wants to pick up support, validation and testing for AR9002 then great, but this is not trivial to commit to. I rather deal only with what we can get commitment to properly test and validate.
In fact I will need to verify our test plan for this. I'll start on that while you review my comments.
Quoted 31 lines
drivers/net/wireless/ath/ath9k/hw.c +0
-0? ? ? ?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 +4
-0@@ -305,6 +305,10 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start) ? ? ? ? ? ? ? ?ath9k_hw_antdiv_comb_conf_set(ah, &div_ant_conf); ? ? ? ?} + ? ? ? /* set radar parameters if in DFS mode */ + ? ? ? if (sc->sc_flags & SC_OP_DFS) + ? ? ? ? ? ? ? ath9k_hw_set_radar_params(ah); + ? ? ? ?ieee80211_wake_queues(sc->hw); ? ? ? ?return true;
drivers/net/wireless/ath/ath9k/main.c static int ath9k_config(struct ieee80211_hw *hw, u32 changed) · line 1733
Quoted 8 lines
drivers/net/wireless/ath/ath9k/main.c +5
-0@@ -1722,9 +1726,21 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) ? ? ? ? ? ? ? ? ? ? ? ?memset(&sc->survey[pos], 0, sizeof(struct survey_info)); ? ? ? ? ? ? ? ?} + ? ? ? ? ? ? ? if (curchan->flags & IEEE80211_CHAN_RADAR) { + ? ? ? ? ? ? ? ? ? ? ? if (!(ah->caps.hw_caps & ATH9K_HW_CAP_DFS)) { + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ath_err(common, "HW does not support DFS\n"); + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mutex_unlock(&sc->mutex); + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return -EINVAL;
Seems like a wrong place for this, shouldn't cfg80211 deal with this check for us? That is, export a cfg80211 DFS capability and cfg80211 would deny using any DFS channel unless the wiphy declares itself capable.
Quoted 51 lines
drivers/net/wireless/ath/ath9k/main.c +7
-0+ ? ? ? ? ? ? ? ? ? ? ? } + ? ? ? ? ? ? ? ? ? ? ? sc->sc_flags |= SC_OP_DFS; + ? ? ? ? ? ? ? } else + ? ? ? ? ? ? ? ? ? ? ? sc->sc_flags &= ~SC_OP_DFS; + ? ? ? ? ? ? ? ?if (ath_set_channel(sc, hw, &sc->sc_ah->channels[pos]) < 0) { ? ? ? ? ? ? ? ? ? ? ? ?ath_err(common, "Unable to set channel\n"); ? ? ? ? ? ? ? ? ? ? ? ?mutex_unlock(&sc->mutex); + ? ? ? ? ? ? ? ? ? ? ? /* clear DFS operation flag on failure */ + ? ? ? ? ? ? ? ? ? ? ? sc->sc_flags &= ~SC_OP_DFS; ? ? ? ? ? ? ? ? ? ? ? ?return -EINVAL; ? ? ? ? ? ? ? ?}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 +2
-0@@ -473,6 +474,8 @@ u32 ath_calcrxfilter(struct ath_softc *sc) ? ? ? ? ? ? ? ?rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL; ? ? ? ?} + ? ? ? if (sc->sc_flags & SC_OP_DFS) + ? ? ? ? ? ? ? rfilt |= ATH9K_RX_FILTER_PHYRADAR; ? ? ? ?return rfilt;?#undef
RX_FILTER_PRESERVEdrivers/net/wireless/ath/ath9k/recv.c +0
-5@@ -1855,11 +1858,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 +1
-0@@ -1869,6 +1867,17 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) ? ? ? ? ? ? ? ? ? ?unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) ? ? ? ? ? ? ? ? ? ? ? ?rxs->mactime += 0x100000000ULL; + ? ? ? ? ? ? ? if ((rs.rs_status & ATH9K_RXERR_PHY) &&
drivers/net/wireless/ath/ath9k/recv.c int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) · line 1880
Quoted 10 lines
drivers/net/wireless/ath/ath9k/recv.c +10
-0+ ? ? ? ? ? ? ? ? ? (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; +
As noted in the other e-mail please split the move of the check to another patch, the new code can be kept here.
Luis
PATCH 2/2 ath9k: integrate initial DFS module
Hi Luis,
thanks for the feedback.
This series went through several RFCs before I posted it as patch. Now that there are still some general concerns open, would you prefer to go back to RFC or are you ok with PATCH_v2?
Quoted 22 lines · Luis R. Rodriguez
drivers/net/wireless/ath/ath9k/ath9k.h struct ath_ant_comb { · line 566
Quoted 12 lines · Zefir Kurtisi
This patch integrates the DFS module into ath9k, including
* build the module intoath9k_hw
[...]drivers/net/wireless/ath/ath9k/ath9k.h +1
-0@@ -563,6 +563,7 @@ struct ath_ant_comb {#define SC_OP_BT_SCAN BIT(13)#define SC_OP_ANI_RUN BIT(14)#define SC_OP_PRIM_STA_VIF BIT(15) +#define SC_OP_DFS BIT(16)The way you use this is to set the bit when a DFS channel is found on the mac80211
config()callback so that uponath_complete_reset()we callath9k_hw_set_radar_params()with the params captured inath_calcrxfilter(). This seems fair... but have you considered all the other cases that will callath_complete_reset()that do come through the mac80211config()callback? What got me thinking about this was the actual declaration of this bit, is it really necessary? It seems to reflect a state from a small state machine that you need to ensure
Quoted 9 lines
is respected. If this is true you just need then to guarantee that that the
ath9k_hw_set_radar_params()will get called properly for all the cases that you do need. Its not clear from the current implementation that this is the case right now, it seems a bit fragile. Consider all theidle()and non-idle() calls that mac80211 could use to call on the driver. Granted, the idle stuff is mostly observed on the client side, but its just one case I am thinking off the top of my head based on a quick review of this patch.
We need to ensure two things to get the pulse reporting done:
1. write the configuration params to the DFS detector regs via ath9k_hw_set_radar_params() after chip reset
2. set the PHYRADAR bit in RX filter, i.e. let ath_calcrxfilter() add this bit in its mask returned to be correctly set with the following ath9k_hw_setrxfilter()
In my RFC_v2 I proposed to set the radar parameters when the device is set to a DFS channel and to preserve the PHYRADAR bit in the RX filter register. Felix pointed out that we can not rely on the register value being always valid (e.g. during reset) and we need to keep the information about DFS channel operation in higher layers.
Defining a DFS opmode flag for that is arguable (since we have the information from (curchan->flags & IEEE80211_CHAN_RADAR)), but for sure improves readability.
As for your concern about ath_complete_reset() being called from wherever: right now, it is called from three locations that end to be all in the processing path of either device initialization or configuration. From there, worst thing that can happen is that the device is reconfigured with the channel unchanged - resulting in a redundant write of radar configuration. I expect writing those handful registers twice being irrelevant to performance, or did you mean something else?
Quoted 25 lines
Quoted 6 lines
drivers/net/wireless/ath/ath9k/ath9k.h +0
-0drivers/net/wireless/ath/ath9k/hw.c +0
-0drivers/net/wireless/ath/ath9k/hw.c int ath9k_hw_fill_cap_info(struct ath_hw *ah) · line 2342
Quoted 10 lines
drivers/net/wireless/ath/ath9k/hw.c +7
-0@@ -2333,6 +2333,13 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) pCap->pcie_lcr_offset =0x80 ; } +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 ; + } +Please change to
AR_SREV_9300_20_OR_LATER(), its the only family that we can likely get resources to support, validate and test for. I'm even having a hard time getting support, etc for AR9003 but I think its fair to at least get this chugging for AR9003. If someone wants to pick up support, validation and testing for AR9002 then great, but this is not trivial to commit to. I rather deal only with what we can get commitment to properly test and validate.
Quoted 3 lines
In fact I will need to verify our test plan for this. I'll start on that while you review my comments.
Thanks for that. I remember Felix was asking to include support for AR9002 and after I tested pulse detection is working with 9280 I let it in. But sure, seeing it working somewhat and committing to support it in the long run are not the same.
I'm fine with reducing support to 9300_20_OR_LATER in v2.
Quoted 5 lines
Quoted 5 lines
[...]
drivers/net/wireless/ath/ath9k/hw.c +0
-0@@ -1722,9 +1726,21 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)memset (&sc->survey[pos],0 ,sizeof (struct survey_info )); }
Quoted 11 lines
drivers/net/wireless/ath/ath9k/hw.c static int ath9k_config(struct ieee80211_hw *hw, u32 changed) · line 1733
Quoted 5 lines
drivers/net/wireless/ath/ath9k/hw.c +5
-0+if (curchan->flags &IEEE80211_CHAN_RADAR ) { +if (!(ah->caps.hw_caps &ATH9K_HW_CAP_DFS )) { +ath_err (common,"HW does not support DFS\n" ); +mutex_unlock (&sc->mutex); +return -EINVAL ;Seems like a wrong place for this, shouldn't cfg80211 deal with this check for us? That is, export a cfg80211 DFS capability and cfg80211 would deny using any DFS channel unless the wiphy declares itself capable.
Thats ideally true. Problem is that the DFS managing component (which capability handling is part of) is not ready yet (big hello to TI guys) and I don't want to mess around with some half-baked capability handling in cfg/mac80211.
For now, lack of master support for DFS channels in mac80211/hostapd ensures that we are regulatory compliant here, since DFS channels will only be set in monitor mode.
I'd opt to take it as it is, maybe replace the above check with a WARN_ON until capability handling at upper layer is fully tested. Agree?
Quoted 17 lines
Quoted 17 lines
[...]
drivers/net/wireless/ath/ath9k/hw.c +0
-5@@ -1855,11 +1858,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 ))@@ -1869,6 +1867,17 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) unlikely(tsf_lower - rs.rs_tstamp > 0x10000000)) rxs->mactime +=0x100000000ULL ;
Quoted 14 lines
drivers/net/wireless/ath/ath9k/hw.c int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) · line 1880
Quoted 11 lines
drivers/net/wireless/ath/ath9k/hw.c +11
-0+if ((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; +As noted in the other e-mail please split the move of the check to another patch, the new code can be kept here.
Done: [PATCH] ath9k: trivial: reorder rx_tasklet processing
Quoted 2 lines
Luis
Thanks,
Zefir
cover ath9k: DFS radar detection
In reply to Zefir KurtisiQuoted 13 lines · Zefir Kurtisi
This patch series proposes DFS radar pulse detection for ath9k.
The first patch adds a new DFS module, the second turns those knobs to enable the HW to detect radar pulses and forward them to the new module.
Here, sanity and plausibility checks that are HW dependent are performed and resulting radar events are passed to higher level generic pattern detectors for further processing (spectrum management, etc.).
DFS support is limited to newer chip-sets (for now 9280 and later).
Quoted 7 lines
So far, AP operation on DFS channels is not supported by mac80211/hostapd. Testing the proposed pulse detection is done in monitor mode.
Zefir Kurtisi (2):
ath9k: add DFS radar pulse processing
ath9k: integrate initial DFS module
Any comments from the ath9k guys on this?
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
cover ath9k: DFS radar detection
Quoted 18 lines · John W. Linville
Quoted 17 lines · Zefir Kurtisi
This patch series proposes DFS radar pulse detection for ath9k.
The first patch adds a new DFS module, the second turns those knobs to enable the HW to detect radar pulses and forward them to the new module.
Here, sanity and plausibility checks that are HW dependent are performed and resulting radar events are passed to higher level generic pattern detectors for further processing (spectrum management, etc.).
DFS support is limited to newer chip-sets (for now 9280 and later).
So far, AP operation on DFS channels is not supported by mac80211/hostapd. Testing the proposed pulse detection is done in monitor mode.
Quoted 5 lines
Quoted 3 lines
Zefir Kurtisi (2):
? ath9k: add DFS radar pulse processing
? ath9k: integrate initial DFS moduleAny comments from the ath9k guys on this?
Just sent my initial set of comments.
Luis
cover ath9k: DFS radar detection
Luis,
any pending concerns or feedback before I start working on v2?
Zefir
Quoted 29 lines · Luis R. Rodriguez
Quoted 18 lines · John W. Linville
Quoted 17 lines · Zefir Kurtisi
This patch series proposes DFS radar pulse detection for ath9k.
The first patch adds a new DFS module, the second turns those knobs to enable the HW to detect radar pulses and forward them to the new module.
Here, sanity and plausibility checks that are HW dependent are performed and resulting radar events are passed to higher level generic pattern detectors for further processing (spectrum management, etc.).
DFS support is limited to newer chip-sets (for now 9280 and later).
So far, AP operation on DFS channels is not supported by mac80211/hostapd. Testing the proposed pulse detection is done in monitor mode.
Quoted 5 lines
Quoted 3 lines
Zefir Kurtisi (2):
ath9k: add DFS radar pulse processing
ath9k: integrate initial DFS moduleAny comments from the ath9k guys on this?
Just sent my initial set of comments.
Luis
cover ath9k: DFS radar detection
Quoted 3 lines · Zefir Kurtisi
Luis,
any pending concerns or feedback before I start working on v2?
What's your ETA for getting the radar classification stuff done?
I'd like to evaluate the radar classification code and how it all ties together. :)
Thanks,
adrian
cover ath9k: DFS radar detection
Quoted 7 lines · Adrian Chadd
Quoted 3 lines · Zefir Kurtisi
Luis,
any pending concerns or feedback before I start working on v2?
What's your ETA for getting the radar classification stuff done?
Quoted 7 lines
I'd like to evaluate the radar classification code and how it all ties together. :)
Thanks,
adrian
Hi Adrian,
I'm stuck in my step-by-step approach, i.e. to get the pulse detection upstream first and then get back to the detection stuff. Just under-estimated how long it takes to get those few lines accepted...
Hopefully we'll have something to evaluate soon.
Zefir