linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI
@ 2012-10-31 11:23 Zefir Kurtisi
  2012-10-31 13:32 ` Hauke Mehrtens
  0 siblings, 1 reply; 5+ messages in thread
From: Zefir Kurtisi @ 2012-10-31 11:23 UTC (permalink / raw)
  To: linville; +Cc: ath9k-devel, linux-wireless, rodrigue, Zefir Kurtisi

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)
 
 #define ETSI_PATTERN(ID, WMIN, WMAX, PMIN, PMAX, PRF, PPB)	\
 {								\
-	ID, WMIN, WMAX, (PRF2PRI(PMAX) - PRI_TOLERANCE),	\
+	ID, WIDTH_LOWER(WMIN), WIDTH_UPPER(WMAX),		\
+	(PRF2PRI(PMAX) - PRI_TOLERANCE),			\
 	(PRF2PRI(PMIN) * PRF + PRI_TOLERANCE), PRF, PPB * PRF,	\
 	PPB_THRESH(PPB), PRI_TOLERANCE,				\
 }
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI
  2012-10-31 11:23 [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI Zefir Kurtisi
@ 2012-10-31 13:32 ` Hauke Mehrtens
  2012-10-31 13:57   ` Felix Fietkau
  2012-10-31 13:59   ` Zefir Kurtisi
  0 siblings, 2 replies; 5+ messages in thread
From: Hauke Mehrtens @ 2012-10-31 13:32 UTC (permalink / raw)
  To: Zefir Kurtisi; +Cc: linville, ath9k-devel, linux-wireless, rodrigue

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.

Hauke

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI
  2012-10-31 13:32 ` Hauke Mehrtens
@ 2012-10-31 13:57   ` Felix Fietkau
  2012-10-31 14:38     ` Zefir Kurtisi
  2012-10-31 13:59   ` Zefir Kurtisi
  1 sibling, 1 reply; 5+ messages in thread
From: Felix Fietkau @ 2012-10-31 13:57 UTC (permalink / raw)
  To: Hauke Mehrtens
  Cc: Zefir Kurtisi, linville, ath9k-devel, linux-wireless, rodrigue

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI
  2012-10-31 13:32 ` Hauke Mehrtens
  2012-10-31 13:57   ` Felix Fietkau
@ 2012-10-31 13:59   ` Zefir Kurtisi
  1 sibling, 0 replies; 5+ messages in thread
From: Zefir Kurtisi @ 2012-10-31 13:59 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, ath9k-devel, linux-wireless, rodrigue

On 10/31/2012 02: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.
> 
> Hauke
> 
Hi Hauke,

the 50 you are referring to are not the 5% defined by ETSI but used for
proper rounding in the percentage domain within that macros.

Take pattern 4 with a maximum pulse width of 30us, WIDTH_UPPER(30) then
calculates to 32. Since the HW's pulse width resolution is 1us, there is
no need to move to the nsec domain.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI
  2012-10-31 13:57   ` Felix Fietkau
@ 2012-10-31 14:38     ` Zefir Kurtisi
  0 siblings, 0 replies; 5+ messages in thread
From: Zefir Kurtisi @ 2012-10-31 14:38 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: Hauke Mehrtens, linville, ath9k-devel, linux-wireless, rodrigue

On 10/31/2012 02:57 PM, Felix Fietkau wrote:
> 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
> 
Right (you were faster on clarifying, thanks ;)).

As for the -50: the macros do rounding to the nearest int, while your
proposal would resemble a floor(), which would result in the values
being decremented from their current value. Given that 5us would be
corrected to 4us, I think it is better to go for the round() approach to
keep detection balanced.

It is maybe not relevant at all for the lower ranges, I came up with the
modification since we had failures detecting type 4 patterns with
maximum pulse width including margin with a total of 31us.

(FYI, other than that, the DFS detector works well enough for
certification by ETSI.)


Cheers,
Zefir


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-31 14:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-31 11:23 [PATCH] ath9k: [DFS] add pulse width tolerance for ETSI Zefir Kurtisi
2012-10-31 13:32 ` Hauke Mehrtens
2012-10-31 13:57   ` Felix Fietkau
2012-10-31 14:38     ` Zefir Kurtisi
2012-10-31 13:59   ` Zefir Kurtisi

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).