linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <rodrigue@qca.qualcomm.com>
To: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Cc: "John W . Linville" <linville@tuxdriver.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	<linux-wireless@vger.kernel.org>,
	"Luis R . Rodriguez" <rodrigue@qca.qualcomm.com>
Subject: Re: [PATCH v2] cfg80211: Fix regulatory check for 60GHz band frequencies
Date: Thu, 20 Sep 2012 11:37:40 -0700	[thread overview]
Message-ID: <20120920183740.GY3354@lenteja.do-not-panic.com> (raw)
In-Reply-To: <1348039339-22246-2-git-send-email-qca_vkondrat@qca.qualcomm.com>

On Wed, Sep 19, 2012 at 10:22:19AM +0300, Vladimir Kondratiev wrote:
> Adjust check in the freq_in_rule_band for the 60GHz band,
> where channel spacing is 2.160GHz.
> 
> Issue exposed in the following way: 60g band defines 3 channels supported wold-wide:
> channels 1..3 or 58320, 60480, 62640 MHz, and channel 4, or 64800 MHz,
> in the most of the world, with 2160 MHz spacing.
> Corresponded regulatory rule for channels 1..3 would be
> (57240 - 63720 @ 2160)
> 
> And, when regulatory applies to the channel 2 (60480), it get disabled since it is
> more then 2GHz from either frequency boundary and freq_in_rule_band fails
> 
> Expanding frequency limit from 2GHz to 10GHz fixes the problem

This commit log message could use a lot of love. Some code comments
below as well. As for the commit log, how about:

--
The current regulatory code on cfg80211 performs a check to
see if a regulatory rule belongs to an IEEE band so that if
a Country IE is received and no rules are specified for a
band (which is allowed by IEEE) those bands are left intact.
The current band check assumes a rule is bound to a band
if the rule's start or end frequency is less than 2 GHz
apart from the center of frequency being inspected.

In order to support 60 GHz for 802.11ad we need to increase
this to account for the channel spacing of 2160 MHz whereby
a channel somewhere in the middle of a regulatory rule may
be more than 2160 MHz apart from either the beginning or
end of the frequency rule.

Without a fix for this even though channels 1-3 are allowed world
wide on the rule (57240 - 63720 @ 2160), channel 2 at 60480 MHz
will end up geting disabled given that it is 3240 MHz from
both the frequency rule start and end frequency. Fix this by
using 2 GHz separation assumption for the 2.4 and 5 GHz bands
but for 60 GHz use a 10 GHz separation before assuming a rule
is not part of the band.

Since we have no 802.11ad drivers yet merged this change has
no impact to existing Linux upstream device drivers.
---

Then some comments below.

> Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
> ---
>  net/wireless/reg.c |   15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 4de18ae..b7c094c 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -510,9 +510,11 @@ static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
>   *
>   * This lets us know if a specific frequency rule is or is not relevant to
>   * a specific frequency's band. Bands are device specific and artificial
> - * definitions (the "2.4 GHz band" and the "5 GHz band"), however it is
> - * safe for now to assume that a frequency rule should not be part of a
> - * frequency's band if the start freq or end freq are off by more than 2 GHz.
> + * definitions (the "2.4 GHz band", the "5 GHz band" and the "60GHz band"),
> + * however it is safe for now to assume that a frequency rule should not be
> + * part of a frequency's band if the start freq or end freq are off by more
> + * than 2 GHz for the 2.4 and 5 GHz bands, and by more then 4 GHz for the
> + * 60 GHz band.

You use "4" here although you meant "10"

>   * This resolution can be lowered and should be considered as we add
>   * regulatory rule support for other "bands".
>   **/
> @@ -520,9 +522,12 @@ static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range,
>  	u32 freq_khz)
>  {
>  #define ONE_GHZ_IN_KHZ	1000000
> -	if (abs(freq_khz - freq_range->start_freq_khz) <= (2 * ONE_GHZ_IN_KHZ))
> +	/* DMG frequencies starts from 45 GHz, see 802.11ad */

What's this DMG thing?

> +	u32 limit = freq_khz > 45 * ONE_GHZ_IN_KHZ ?
> +			10 * ONE_GHZ_IN_KHZ : 2 * ONE_GHZ_IN_KHZ;
> +	if (abs(freq_khz - freq_range->start_freq_khz) <= limit)
>  		return true;
> -	if (abs(freq_khz - freq_range->end_freq_khz) <= (2 * ONE_GHZ_IN_KHZ))
> +	if (abs(freq_khz - freq_range->end_freq_khz) <= limit)
>  		return true;

Otherwise looks good.

  Luis

  reply	other threads:[~2012-09-20 18:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19  7:22 [PATCH v2] Fix for regulatory in 60g Vladimir Kondratiev
2012-09-19  7:22 ` [PATCH v2] cfg80211: Fix regulatory check for 60GHz band frequencies Vladimir Kondratiev
2012-09-20 18:37   ` Luis R. Rodriguez [this message]
2012-09-20 20:09     ` Arend van Spriel
2012-09-20 20:12       ` Luis R. Rodriguez

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=20120920183740.GY3354@lenteja.do-not-panic.com \
    --to=rodrigue@qca.qualcomm.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=qca_vkondrat@qca.qualcomm.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).