From: Zefir Kurtisi <[email protected]>
These are the remaining knobs required to turn to get DFS
detection working in ath9k.
---
Testing mini-HowTo
Building:
On top of the patches, building a DFS capable driver requires
* setting CONFIG_ATH9K_DFS_CERTIFIED=y
* change hw.c:ath9k_hw_dfs_tested() to return true for the
chip-set you are testing
(tested so far: AR9280, AR9390 and AR9580)
Setting CONFIG_ATH_DEBUG=y will allow you to log detailed pulse
event information by setting the DFS_DEBUG bit (0x20000) in
ath9k/debug, while radar detection events are logged generally.
Also, set CONFIG_ATH9K_DFS_DEBUGFS=y to enable pulse and
pattern detection statistics along with pool utilization stats
in phyX/ath9k/dfs_stats. Ensure to have recent
'[PATCH] ath9k: extend DFS detector stats in dfs_debugfs'
applied for the full set of DFS statistics.
Testing:
You need wireless tools built with
* crda: add support to send DFS master region
* wireless-regdb: Add master DFS region support
* wireless-regdb: set ETSI as DFS region for EU
(all upstream since 2012-01)
1) setup ath9k monitor
sudo iw phy phy0 interface add moni0 type monitor
sudo iw dev moni0 set freq 5500 HT20
sudo ifconfig moni0 up
2) set ETSI countrycode, e.g.
sudo iw reg set CH
3) fire some ETSI radars at device and check log and dfs_stats
Note: due to the lack of DFS master support, only monitor mode
can be tested. Furthermore, at this stage the detector
supports ETSI defined radar patterns only. With other
DFS domains you still are able to test pulse detections,
but any pulse event will be accounted as radar event
in the stats/logs.
Zefir Kurtisi (4):
ath9k: set detector DFS domain in reg notifyer
ath9k: set PHYRADAR in RX filter when on DFS channel
ath9k: forward pulse events to DFS pulse detector
ath9k: set radar config if switching to DFS channel
drivers/net/wireless/ath/ath9k/init.c | 4 ++++
drivers/net/wireless/ath/ath9k/main.c | 10 ++++++++++
drivers/net/wireless/ath/ath9k/recv.c | 9 +++++++++
3 files changed, 23 insertions(+), 0 deletions(-)
--
1.7.4.1
On 22.04.2012 22:00, Felix Fietkau wrote:
> On 2012-04-22 9:50 PM, Zefir Kurtisi wrote:
>> From: Zefir Kurtisi<[email protected]>
>>
>>
>> Signed-off-by: Zefir Kurtisi<[email protected]>
>> ---
>> drivers/net/wireless/ath/ath9k/recv.c | 6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
>> index f4ae3ba..ef45c0c 100644
>> --- a/drivers/net/wireless/ath/ath9k/recv.c
>> +++ b/drivers/net/wireless/ath/ath9k/recv.c
>> @@ -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))
>>
>> @@ -467,6 +468,11 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
>> rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
>> }
>>
>> + if (sc->sc_ah->curchan->chan->flags& IEEE80211_CHAN_RADAR)
>> + rfilt |= ATH9K_RX_FILTER_PHYRADAR;
>> + else
>> + rfilt&= ~ATH9K_RX_FILTER_PHYRADAR;
> This should only be done in AP mode, maybe mac80211 should have a
> separate flag to tell the driver to enable this. Same comment also
> applies to patch 4/4.
>
> - Felix
>
Are you aware of any issues enabling DFS in client modes? My thinking
was that it won't hurt to detect radars in any mode and let the DFS
management component decide what to do with that events.
I'll be out of office for some time and update the patches then.
John, please ignore this series for now.
Thanks,
Zefir
From: Zefir Kurtisi <[email protected]>
Signed-off-by: Zefir Kurtisi <[email protected]>
---
drivers/net/wireless/ath/ath9k/init.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index f9130f7..6c4153c 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -298,6 +298,7 @@ static int ath9k_reg_notifier(struct wiphy *wiphy,
struct ath_softc *sc = hw->priv;
struct ath_hw *ah = sc->sc_ah;
struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
+ struct dfs_pattern_detector *dfs_detector = sc->dfs_detector;
int ret;
ret = ath_reg_notifier_apply(wiphy, request, reg);
@@ -311,6 +312,9 @@ static int ath9k_reg_notifier(struct wiphy *wiphy,
ath9k_ps_restore(sc);
}
+ if (dfs_detector != NULL)
+ dfs_detector->set_domain(dfs_detector, request->dfs_region);
+
return ret;
}
--
1.7.4.1
Hi,
I'm fine with all of these patches.
Thanks for tackling it!
Adrian
On Mon, Apr 23, 2012 at 07:23:58PM +0200, Felix Fietkau wrote:
> On 2012-04-23 11:12 AM, Zefir Kurtisi wrote:
> > On 22.04.2012 22:00, Felix Fietkau wrote:
> >> On 2012-04-22 9:50 PM, Zefir Kurtisi wrote:
> >>> From: Zefir Kurtisi<[email protected]>
> >>>
> >>>
> >>> Signed-off-by: Zefir Kurtisi<[email protected]>
> >>> ---
> >>> drivers/net/wireless/ath/ath9k/recv.c | 6 ++++++
> >>> 1 files changed, 6 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
> >>> index f4ae3ba..ef45c0c 100644
> >>> --- a/drivers/net/wireless/ath/ath9k/recv.c
> >>> +++ b/drivers/net/wireless/ath/ath9k/recv.c
> >>> @@ -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))
> >>>
> >>> @@ -467,6 +468,11 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
> >>> rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
> >>> }
> >>>
> >>> + if (sc->sc_ah->curchan->chan->flags& IEEE80211_CHAN_RADAR)
> >>> + rfilt |= ATH9K_RX_FILTER_PHYRADAR;
> >>> + else
> >>> + rfilt&= ~ATH9K_RX_FILTER_PHYRADAR;
> >> This should only be done in AP mode, maybe mac80211 should have a
> >> separate flag to tell the driver to enable this. Same comment also
> >> applies to patch 4/4.
> >>
> >> - Felix
> >>
> > Are you aware of any issues enabling DFS in client modes? My thinking
> > was that it won't hurt to detect radars in any mode and let the DFS
> > management component decide what to do with that events.
> Power consumption (for laptops), performance issues (due to DMA
> descriptor use and interrupts triggered by pulse detection).
>
> If the DFS management component decides what to do with the events, why
> not let it decide whether it actually wants events as well ;)
This could come from mac80211's filter flag call on to the driver, that is,
mac80211 can figure out when we need something like ATH9K_RX_FILTER_PHYRADAR
and tell us, instead of having the driver figure this out.
Luis
There may be a need later on (eg mesh, p2p mode, etc.)
2c,
Adrian
-----Original Message-----
From: Felix Fietkau [mailto:[email protected]]
Sent: Monday, April 23, 2012 10:24 AM
To: Zefir Kurtisi
Cc: Zefir Kurtisi; [email protected]; [email protected]; [email protected]; Rodriguez, Luis; Chadd, Adrian; [email protected]
Subject: Re: [PATCH 2/4] ath9k: set PHYRADAR in RX filter when on DFS channel
On 2012-04-23 11:12 AM, Zefir Kurtisi wrote:
> On 22.04.2012 22:00, Felix Fietkau wrote:
>> On 2012-04-22 9:50 PM, Zefir Kurtisi wrote:
>>> From: Zefir Kurtisi<[email protected]>
>>>
>>>
>>> Signed-off-by: Zefir Kurtisi<[email protected]>
>>> ---
>>> drivers/net/wireless/ath/ath9k/recv.c | 6 ++++++
>>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath9k/recv.c
>>> b/drivers/net/wireless/ath/ath9k/recv.c
>>> index f4ae3ba..ef45c0c 100644
>>> --- a/drivers/net/wireless/ath/ath9k/recv.c
>>> +++ b/drivers/net/wireless/ath/ath9k/recv.c
>>> @@ -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))
>>>
>>> @@ -467,6 +468,11 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
>>> rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
>>> }
>>>
>>> + if (sc->sc_ah->curchan->chan->flags& IEEE80211_CHAN_RADAR)
>>> + rfilt |= ATH9K_RX_FILTER_PHYRADAR;
>>> + else
>>> + rfilt&= ~ATH9K_RX_FILTER_PHYRADAR;
>> This should only be done in AP mode, maybe mac80211 should have a
>> separate flag to tell the driver to enable this. Same comment also
>> applies to patch 4/4.
>>
>> - Felix
>>
> Are you aware of any issues enabling DFS in client modes? My thinking
> was that it won't hurt to detect radars in any mode and let the DFS
> management component decide what to do with that events.
Power consumption (for laptops), performance issues (due to DMA descriptor use and interrupts triggered by pulse detection).
If the DFS management component decides what to do with the events, why not let it decide whether it actually wants events as well ;)
- Felix
On 2012-04-22 9:50 PM, Zefir Kurtisi wrote:
> From: Zefir Kurtisi <[email protected]>
>
>
> Signed-off-by: Zefir Kurtisi <[email protected]>
> ---
> drivers/net/wireless/ath/ath9k/recv.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
> index f4ae3ba..ef45c0c 100644
> --- a/drivers/net/wireless/ath/ath9k/recv.c
> +++ b/drivers/net/wireless/ath/ath9k/recv.c
> @@ -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))
>
> @@ -467,6 +468,11 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
> rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
> }
>
> + if (sc->sc_ah->curchan->chan->flags & IEEE80211_CHAN_RADAR)
> + rfilt |= ATH9K_RX_FILTER_PHYRADAR;
> + else
> + rfilt &= ~ATH9K_RX_FILTER_PHYRADAR;
This should only be done in AP mode, maybe mac80211 should have a
separate flag to tell the driver to enable this. Same comment also
applies to patch 4/4.
- Felix
From: Zefir Kurtisi <[email protected]>
Signed-off-by: Zefir Kurtisi <[email protected]>
---
drivers/net/wireless/ath/ath9k/recv.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index ef45c0c..f647d0b 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -1856,6 +1856,9 @@ 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_phyerr == ATH9K_PHYERR_RADAR)
+ ath9k_dfs_process_phyerr(sc, hdr, &rs, rxs->mactime);
+
retval = ath9k_rx_skb_preprocess(common, hw, hdr, &rs,
rxs, &decrypt_error);
if (retval)
--
1.7.4.1
On Monday, April 23, 2012 11:12:33 AM Zefir Kurtisi wrote:
> On 22.04.2012 22:00, Felix Fietkau wrote:
> > On 2012-04-22 9:50 PM, Zefir Kurtisi wrote:
> >> From: Zefir Kurtisi<[email protected]>
> >>
> >>
> >> Signed-off-by: Zefir Kurtisi<[email protected]>
> >> ---
> >> drivers/net/wireless/ath/ath9k/recv.c | 6 ++++++
> >> 1 files changed, 6 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
> >> index f4ae3ba..ef45c0c 100644
> >> --- a/drivers/net/wireless/ath/ath9k/recv.c
> >> +++ b/drivers/net/wireless/ath/ath9k/recv.c
> >> @@ -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))
> >>
> >> @@ -467,6 +468,11 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
> >> rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
> >> }
> >>
> >> + if (sc->sc_ah->curchan->chan->flags& IEEE80211_CHAN_RADAR)
> >> + rfilt |= ATH9K_RX_FILTER_PHYRADAR;
> >> + else
> >> + rfilt&= ~ATH9K_RX_FILTER_PHYRADAR;
> > This should only be done in AP mode, maybe mac80211 should have a
> > separate flag to tell the driver to enable this. Same comment also
> > applies to patch 4/4.
> >
> > - Felix
> >
> Are you aware of any issues enabling DFS in client modes? My thinking
> was that it won't hurt to detect radars in any mode and let the DFS
> management component decide what to do with that events.
>
Hm, what about:
"2. Slave devices with a maximum EIRP of less than 23 dBm do not have
to implement radar detection."
<http://linuxwireless.org/en/developers/DFS/ETSI> - Table D.2
So, 5GHz ath9k devices with 23 dBm (or more) have to have
radar detection anyway?
Regards,
Christian
On 2012-04-23 11:12 AM, Zefir Kurtisi wrote:
> On 22.04.2012 22:00, Felix Fietkau wrote:
>> On 2012-04-22 9:50 PM, Zefir Kurtisi wrote:
>>> From: Zefir Kurtisi<[email protected]>
>>>
>>>
>>> Signed-off-by: Zefir Kurtisi<[email protected]>
>>> ---
>>> drivers/net/wireless/ath/ath9k/recv.c | 6 ++++++
>>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
>>> index f4ae3ba..ef45c0c 100644
>>> --- a/drivers/net/wireless/ath/ath9k/recv.c
>>> +++ b/drivers/net/wireless/ath/ath9k/recv.c
>>> @@ -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))
>>>
>>> @@ -467,6 +468,11 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
>>> rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
>>> }
>>>
>>> + if (sc->sc_ah->curchan->chan->flags& IEEE80211_CHAN_RADAR)
>>> + rfilt |= ATH9K_RX_FILTER_PHYRADAR;
>>> + else
>>> + rfilt&= ~ATH9K_RX_FILTER_PHYRADAR;
>> This should only be done in AP mode, maybe mac80211 should have a
>> separate flag to tell the driver to enable this. Same comment also
>> applies to patch 4/4.
>>
>> - Felix
>>
> Are you aware of any issues enabling DFS in client modes? My thinking
> was that it won't hurt to detect radars in any mode and let the DFS
> management component decide what to do with that events.
Power consumption (for laptops), performance issues (due to DMA
descriptor use and interrupts triggered by pulse detection).
If the DFS management component decides what to do with the events, why
not let it decide whether it actually wants events as well ;)
- Felix
From: Zefir Kurtisi <[email protected]>
Signed-off-by: Zefir Kurtisi <[email protected]>
---
drivers/net/wireless/ath/ath9k/main.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 3879485..0aeba88 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -371,6 +371,16 @@ static int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
r = ath_reset_internal(sc, hchan, false);
+ if ((r == 0) && (hchan->chan->flags & IEEE80211_CHAN_RADAR)) {
+ /* set HW specific DFS configuration if on DFS channel */
+ struct ath_hw *ah = sc->sc_ah;
+ struct ath_common *common = ath9k_hw_common(ah);
+
+ ath9k_hw_set_radar_params(ah);
+ ath_dbg(common, DFS, "DFS enabled for channel %d\n",
+ hchan->chan->center_freq);
+ }
+
return r;
}
--
1.7.4.1
From: Zefir Kurtisi <[email protected]>
Signed-off-by: Zefir Kurtisi <[email protected]>
---
drivers/net/wireless/ath/ath9k/recv.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index f4ae3ba..ef45c0c 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -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))
@@ -467,6 +468,11 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
}
+ if (sc->sc_ah->curchan->chan->flags & IEEE80211_CHAN_RADAR)
+ rfilt |= ATH9K_RX_FILTER_PHYRADAR;
+ else
+ rfilt &= ~ATH9K_RX_FILTER_PHYRADAR;
+
return rfilt;
}
--
1.7.4.1