From: Felix Fietkau <nbd@openwrt.org>
To: Zefir Kurtisi <zefir.kurtisi@neratec.com>
Cc: ath9k-devel@lists.ath9k.org, linux-wireless@vger.kernel.org,
rodrigue@qca.qualcomm.com, adrian.chadd@gmail.com,
kgiori@qca.qualcomm.com, shafi.wireless@gmail.com
Subject: Re: [RFC 1/2] ath9k: add DFS pattern detector
Date: Thu, 26 Jan 2012 16:53:02 +0100 [thread overview]
Message-ID: <4F2176DE.9010604@openwrt.org> (raw)
In-Reply-To: <1327592044-3319-2-git-send-email-zefir.kurtisi@neratec.com>
On 2012-01-26 4:34 PM, Zefir Kurtisi wrote:
> This adds a DFS pattern detector to the common ath module. It takes
> pulse events reported by ath9k and reports in place whether a
> pattern was detected. On detection, caller must report a radar event
> to the DFS management component in the upper layer.
>
> Currently the ETSI DFS domain is supported with detector lines for
> the patterns defined by EN-301-893 v1.5.1. Support for FCC and JP
> will be added gradually.
>
> The detector is independent of the underlying HW, but located in
> the ath driver since so far it is used by ath9k only. It might
> move up to mac80211 as soon as other non-Atheros drivers start
> using it.
>
> NOTE: since DFS requires some more components on different layers
> that are currently missing, the detector is not functionally
> integrated yet. When ath9k is build with a certified DFS config
> option, the detector is included in ath.ko. All it does there is
> wasting kernel memory and waiting to be used by ath9k.
>
> USAGE: to use the detector, wiphy drivers must
> - use dfs_pattern_detector.h as interface
> - have a struct dfs_pattern_detector *dpd per wiphy
> - on wiphy creation, instantiate a detector with
> dpd = dfs_pattern_detector_init(enum dfs_domain)
> - forward any radar pulse detected to dpd->add_pulse()
> - report radar event if add_pulse() returns RADAR_DETECTED
> - on wiphy destruction call dpd->exit()
>
> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
> ---
> drivers/net/wireless/ath/Makefile | 10 +
> .../ath/dfs_pattern_detector/detector_elem.c | 92 ++++++
> .../ath/dfs_pattern_detector/detector_elem.h | 45 +++
> .../dfs_pattern_detector/dfs_pattern_detector.h | 92 ++++++
> .../ath/dfs_pattern_detector/pattern_detector.c | 294 ++++++++++++++++++++
> .../ath/dfs_pattern_detector/pulse_queue.c | 168 +++++++++++
> .../ath/dfs_pattern_detector/pulse_queue.h | 77 +++++
> .../ath/dfs_pattern_detector/pulse_sequence.c | 280 +++++++++++++++++++
> .../ath/dfs_pattern_detector/pulse_sequence.h | 89 ++++++
> .../ath/dfs_pattern_detector/radar_types.c | 52 ++++
> .../ath/dfs_pattern_detector/radar_types.h | 95 +++++++
> .../net/wireless/ath/dfs_pattern_detector/utils.c | 45 +++
> .../net/wireless/ath/dfs_pattern_detector/utils.h | 30 ++
> 13 files changed, 1369 insertions(+), 0 deletions(-)
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/detector_elem.c
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/detector_elem.h
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/dfs_pattern_detector.h
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/pattern_detector.c
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/pulse_queue.c
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/pulse_queue.h
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/pulse_sequence.c
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/pulse_sequence.h
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/radar_types.c
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/radar_types.h
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/utils.c
> create mode 100644 drivers/net/wireless/ath/dfs_pattern_detector/utils.h
>
> diff --git a/drivers/net/wireless/ath/Makefile b/drivers/net/wireless/ath/Makefile
> index d716b74..10f9554 100644
> --- a/drivers/net/wireless/ath/Makefile
> +++ b/drivers/net/wireless/ath/Makefile
> @@ -11,4 +11,14 @@ ath-objs := main.o \
> key.o
>
> ath-$(CONFIG_ATH_DEBUG) += debug.o
> +
> +# include DFS pattern detector if we have certified HW
> +ath-$(CONFIG_ATH9K_DFS_CERTIFIED) += \
> + dfs_pattern_detector/pulse_queue.o \
> + dfs_pattern_detector/pulse_sequence.o \
> + dfs_pattern_detector/detector_elem.o \
> + dfs_pattern_detector/pattern_detector.o \
> + dfs_pattern_detector/radar_types.o \
> + dfs_pattern_detector/utils.o
> +
> ccflags-y += -D__CHECK_ENDIAN__
> diff --git a/drivers/net/wireless/ath/dfs_pattern_detector/pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector/pattern_detector.c
> new file mode 100644
> index 0000000..2d634fe
> --- /dev/null
> +++ b/drivers/net/wireless/ath/dfs_pattern_detector/pattern_detector.c
> @@ -0,0 +1,294 @@
[...]
> +/**
> + * struct pattern_detector - overloading base dfs_pattern_detector
> + *
> + * @exit(): destructor
> + * @add_pulse(): add radar pulse to detector
> + * @num_radar_types: number of different radar types
> + * @last_pulse_ts: time stamp of last valid pulse
> + * @radar_detector_specs: array of radar detection specs
> + * @channel_detectors: list connecting channel_detector elements
> + */
> +struct pattern_detector {
> + void (*exit)(struct pattern_detector *_this);
> + enum dfs_detector_result (*add_pulse)
> + (struct pattern_detector *_this, struct pulse_event *pe);
> +
> + u8 num_radar_types;
> + u64 last_pulse_ts;
> + struct radar_detector_specs *radar_spec;
> + struct list_head channel_detectors;
> +};
To overload it this way is quite fragile. It's better to embed struct
dfs_pattern_detector here. In places where you need to go from the
struct dfs_pattern_detector to this struct, you can then use the
container_of macro, to get at least some form of type safety.
- Felix
next prev parent reply other threads:[~2012-01-26 15:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 15:34 [RFC 0/2] ath9k: DFS pattern detector Zefir Kurtisi
2012-01-26 15:34 ` [RFC 1/2] ath9k: add " Zefir Kurtisi
2012-01-26 15:53 ` Felix Fietkau [this message]
2012-01-27 15:09 ` Zefir Kurtisi
2012-01-27 15:22 ` Felix Fietkau
2012-01-26 15:34 ` [RFC 2/2] ath9k/dfs_pattern_detector: add standalone testing Zefir Kurtisi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F2176DE.9010604@openwrt.org \
--to=nbd@openwrt.org \
--cc=adrian.chadd@gmail.com \
--cc=ath9k-devel@lists.ath9k.org \
--cc=kgiori@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=rodrigue@qca.qualcomm.com \
--cc=shafi.wireless@gmail.com \
--cc=zefir.kurtisi@neratec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).