All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI
Date: Wed, 31 Oct 2012 14:57:23 +0100	[thread overview]
Message-ID: <50912E43.7070005@openwrt.org> (raw)
In-Reply-To: <5091287C.9030408@hauke-m.de>

On 2012-10-31 2:32 PM, Hauke Mehrtens wrote:
> On 10/31/2012 12:23 PM, Zefir Kurtisi wrote:
>> Add 5% width tolerance for radar patterns defined by ETSI.
>> 
>> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
>> ---
>>  .../net/wireless/ath/ath9k/dfs_pattern_detector.c  |    7 ++++++-
>>  1 files changed, 6 insertions(+), 1 deletions(-)
>> 
>> diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
>> index 3b12914..24877b0 100644
>> --- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
>> +++ b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
>> @@ -42,10 +42,15 @@ struct radar_types {
>>  #define MIN_PPB_THRESH	50
>>  #define PPB_THRESH(PPB) ((PPB * MIN_PPB_THRESH + 50) / 100)
>>  #define PRF2PRI(PRF) ((1000000 + PRF / 2) / PRF)
>> +/* percentage of pulse width tolerance */
>> +#define WIDTH_TOLERANCE 5
>> +#define WIDTH_LOWER(X) ((X*(100-WIDTH_TOLERANCE)+50)/100)
>> +#define WIDTH_UPPER(X) ((X*(100+WIDTH_TOLERANCE)+50)/100)
>                                                    ^^^
> Why are you adding 50 there? If you want to just add 5% tolerance, then
> the +50 is wrong there, but I do not know anything about radar patterns
> defined by ETSI.
I think the 50 is correct here. It's not the tolerance (which is already
included via WIDTH_TOLERANCE in that macro), it's to account for
rounding issues.
Having said that, I wonder if it shouldn't be -50 instead of +50 in
WIDTH_LOWER().

- Felix

WARNING: multiple messages have this Message-ID (diff)
From: Felix Fietkau <nbd@openwrt.org>
To: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Zefir Kurtisi <zefir.kurtisi@neratec.com>,
	linville@tuxdriver.com, ath9k-devel@lists.ath9k.org,
	linux-wireless@vger.kernel.org, rodrigue@qca.qualcomm.com
Subject: Re: [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI
Date: Wed, 31 Oct 2012 14:57:23 +0100	[thread overview]
Message-ID: <50912E43.7070005@openwrt.org> (raw)
In-Reply-To: <5091287C.9030408@hauke-m.de>

On 2012-10-31 2:32 PM, Hauke Mehrtens wrote:
> On 10/31/2012 12:23 PM, Zefir Kurtisi wrote:
>> Add 5% width tolerance for radar patterns defined by ETSI.
>> 
>> Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
>> ---
>>  .../net/wireless/ath/ath9k/dfs_pattern_detector.c  |    7 ++++++-
>>  1 files changed, 6 insertions(+), 1 deletions(-)
>> 
>> diff --git a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
>> index 3b12914..24877b0 100644
>> --- a/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
>> +++ b/drivers/net/wireless/ath/ath9k/dfs_pattern_detector.c
>> @@ -42,10 +42,15 @@ struct radar_types {
>>  #define MIN_PPB_THRESH	50
>>  #define PPB_THRESH(PPB) ((PPB * MIN_PPB_THRESH + 50) / 100)
>>  #define PRF2PRI(PRF) ((1000000 + PRF / 2) / PRF)
>> +/* percentage of pulse width tolerance */
>> +#define WIDTH_TOLERANCE 5
>> +#define WIDTH_LOWER(X) ((X*(100-WIDTH_TOLERANCE)+50)/100)
>> +#define WIDTH_UPPER(X) ((X*(100+WIDTH_TOLERANCE)+50)/100)
>                                                    ^^^
> Why are you adding 50 there? If you want to just add 5% tolerance, then
> the +50 is wrong there, but I do not know anything about radar patterns
> defined by ETSI.
I think the 50 is correct here. It's not the tolerance (which is already
included via WIDTH_TOLERANCE in that macro), it's to account for
rounding issues.
Having said that, I wonder if it shouldn't be -50 instead of +50 in
WIDTH_LOWER().

- Felix

  reply	other threads:[~2012-10-31 13:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 11:23 [ath9k-devel] [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI Zefir Kurtisi
2012-10-31 11:23 ` Zefir Kurtisi
2012-10-31 13:32 ` [ath9k-devel] " Hauke Mehrtens
2012-10-31 13:32   ` Hauke Mehrtens
2012-10-31 13:57   ` Felix Fietkau [this message]
2012-10-31 13:57     ` Felix Fietkau
2012-10-31 14:38     ` [ath9k-devel] " Zefir Kurtisi
2012-10-31 14:38       ` Zefir Kurtisi
2012-10-31 13:59   ` [ath9k-devel] " Zefir Kurtisi
2012-10-31 13:59     ` 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=50912E43.7070005@openwrt.org \
    --to=nbd@openwrt.org \
    --cc=ath9k-devel@lists.ath9k.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.