Skip to contentSkip to conversation

ath9k: integrate DFS detection

PATCH New Zefir Kurtisi 8 participants 13 messages Apr 22, 2012 – May 25, 2012 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath9k: integrate DFS detection

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(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/4 ath9k: set detector DFS domain in reg notifyer

From: Zefir Kurtisi <[email protected]>

---
 drivers/net/wireless/ath/ath9k/init.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/init.c +4 -0
index f9130f7..6c4153c 100644
@@ -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;
 }
 
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/4 ath9k: set PHYRADAR in RX filter when on DFS channel

In reply to Zefir Kurtisi

From: Zefir Kurtisi <[email protected]>

---
 drivers/net/wireless/ath/ath9k/recv.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +6 -0
index f4ae3ba..ef45c0c 100644
@@ -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;
 
 }
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 2/4 ath9k: set PHYRADAR in RX filter when on DFS channel

Quoted 21 lines · Zefir Kurtisi

From: Zefir Kurtisi <[email protected]>

---
 drivers/net/wireless/ath/ath9k/recv.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +1 -0
index f4ae3ba..ef45c0c 100644
@@ -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))
 

drivers/net/wireless/ath/ath9k/recv.c u32 ath_calcrxfilter(struct ath_softc *sc) · line 474

Quoted 7 lines
drivers/net/wireless/ath/ath9k/recv.c +4 -0
@@ -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

#4 lore raw

PATCH 2/4 ath9k: set PHYRADAR in RX filter when on DFS channel

Quoted 33 lines · Felix Fietkau
Quoted 21 lines · Zefir Kurtisi

From: Zefir Kurtisi<[email protected]>

---
  drivers/net/wireless/ath/ath9k/recv.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +1 -0
index f4ae3ba..ef45c0c 100644
@@ -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))
 

drivers/net/wireless/ath/ath9k/recv.c u32 ath_calcrxfilter(struct ath_softc *sc) · line 474

Quoted 7 lines
drivers/net/wireless/ath/ath9k/recv.c +4 -0
@@ -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.

Quoted 2 lines

- 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

#5 lore raw

PATCH 2/4 ath9k: set PHYRADAR in RX filter when on DFS channel

Quoted 34 lines · Zefir Kurtisi
Quoted 33 lines · Felix Fietkau
Quoted 21 lines · Zefir Kurtisi

From: Zefir Kurtisi<[email protected]>

---
  drivers/net/wireless/ath/ath9k/recv.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +1 -0
index f4ae3ba..ef45c0c 100644
@@ -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))
 

drivers/net/wireless/ath/ath9k/recv.c u32 ath_calcrxfilter(struct ath_softc *sc) · line 474

Quoted 7 lines
drivers/net/wireless/ath/ath9k/recv.c +4 -0
@@ -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.

Quoted 5 lines
Quoted 2 lines

- 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

#6 lore raw

PATCH 2/4 ath9k: set PHYRADAR in RX filter when on DFS channel

There may be a need later on (eg mesh, p2p mode, etc.)

2c,

Adrian

-----Original Message-----
From: Felix Fietkau [mailto:nbd at openwrt.org]
Sent: Monday, April 23, 2012 10:24 AM
To: Zefir Kurtisi
Cc: Zefir Kurtisi; linville at tuxdriver.com; ath9k-devel at lists.ath9k.org; linux-wireless at vger.kernel.org; Rodriguez, Luis; Chadd, Adrian; chunkeey at googlemail.com
Subject: Re: [PATCH 2/4] ath9k: set PHYRADAR in RX filter when on DFS channel

Quoted 35 lines · Zefir Kurtisi
Quoted 34 lines · Felix Fietkau
Quoted 22 lines · Zefir Kurtisi

From: Zefir Kurtisi<[email protected]>

---
  drivers/net/wireless/ath/ath9k/recv.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +1 -0
index f4ae3ba..ef45c0c 100644
@@ -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))
 

drivers/net/wireless/ath/ath9k/recv.c u32 ath_calcrxfilter(struct ath_softc *sc) · line 474

Quoted 7 lines
drivers/net/wireless/ath/ath9k/recv.c +4 -0
@@ -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.

Quoted 5 lines
Quoted 2 lines

- 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

#7 lore raw

PATCH 2/4 ath9k: set PHYRADAR in RX filter when on DFS channel

In reply to Felix Fietkau
Quoted 37 lines · Felix Fietkau
Quoted 36 lines · Zefir Kurtisi
Quoted 35 lines · Felix Fietkau
Quoted 21 lines · Zefir Kurtisi

From: Zefir Kurtisi<[email protected]>

---
  drivers/net/wireless/ath/ath9k/recv.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +1 -0
index f4ae3ba..ef45c0c 100644
@@ -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))
 

drivers/net/wireless/ath/ath9k/recv.c u32 ath_calcrxfilter(struct ath_softc *sc) · line 474

Quoted 7 lines
drivers/net/wireless/ath/ath9k/recv.c +4 -0
@@ -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

Quoted 8 lines
Quoted 3 lines

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

#8 lore raw

PATCH 2/4 ath9k: set PHYRADAR in RX filter when on DFS channel

In reply to Zefir Kurtisi
Quoted 34 lines · Zefir Kurtisi
Quoted 33 lines · Felix Fietkau
Quoted 21 lines · Zefir Kurtisi

From: Zefir Kurtisi<[email protected]>

---
  drivers/net/wireless/ath/ath9k/recv.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +1 -0
index f4ae3ba..ef45c0c 100644
@@ -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))
 

drivers/net/wireless/ath/ath9k/recv.c u32 ath_calcrxfilter(struct ath_softc *sc) · line 474

Quoted 7 lines
drivers/net/wireless/ath/ath9k/recv.c +4 -0
@@ -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.

Quoted 6 lines
Quoted 2 lines

- 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

#9 lore raw

PATCH 3/4 ath9k: forward pulse events to DFS pulse detector

In reply to Zefir Kurtisi

From: Zefir Kurtisi <[email protected]>

---
 drivers/net/wireless/ath/ath9k/recv.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +3 -0
index ef45c0c..f647d0b 100644
@@ -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)
Signature · 1 line
1.7.4.1
#10 lore raw

PATCH 3/4 ath9k: forward pulse events to DFS pulse detector

Le 22/04/2012 21:50, Zefir Kurtisi a ?crit :

Quoted 13 lines

From: Zefir Kurtisi<[email protected]>

---
  drivers/net/wireless/ath/ath9k/recv.c |    3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/recv.c +0 -0
index ef45c0c..f647d0b 100644

drivers/net/wireless/ath/ath9k/recv.c int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) · line 1864

Quoted 9 lines
drivers/net/wireless/ath/ath9k/recv.c +3 -0
@@ -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)

Sorry to jump into this old thread. IMHO, rs.rs_phyerr is only valid if rs.rs_status & ATH9K_RXERR_PHY is set. So we should check for the later first, isn't it?

Regards,
Benoit

#11 lore raw

PATCH 4/4 ath9k: set radar config if switching to DFS channel

In reply to Zefir Kurtisi

From: Zefir Kurtisi <[email protected]>

---
 drivers/net/wireless/ath/ath9k/main.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +10 -0
index 3879485..0aeba88 100644
@@ -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;
 }
 
Signature · 1 line
1.7.4.1
#12 lore raw

PATCH 4/4 ath9k: set radar config if switching to DFS channel

Hi,

I'm fine with all of these patches.

Thanks for tackling it!

Adrian