aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>2012-09-23 03:49:54 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-09-25 03:41:14 -0400
commit64629b9d412544b0ed744405944fd6edf79d7e0d (patch)
tree3cfc42f380900c5b167f2d6587d4234d7946c9ad /net/wireless/reg.c
parenteab48345c2b2d791159aaac4a77000baa8dbc1ae (diff)
cfg80211: Fix regulatory check for 60GHz band frequencies
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 2 GHz 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 getting 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. Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Acked-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 0ba3328dcc9a..844823973daf 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -504,9 +504,11 @@ static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
504 * 504 *
505 * This lets us know if a specific frequency rule is or is not relevant to 505 * This lets us know if a specific frequency rule is or is not relevant to
506 * a specific frequency's band. Bands are device specific and artificial 506 * a specific frequency's band. Bands are device specific and artificial
507 * definitions (the "2.4 GHz band" and the "5 GHz band"), however it is 507 * definitions (the "2.4 GHz band", the "5 GHz band" and the "60GHz band"),
508 * safe for now to assume that a frequency rule should not be part of a 508 * however it is safe for now to assume that a frequency rule should not be
509 * frequency's band if the start freq or end freq are off by more than 2 GHz. 509 * part of a frequency's band if the start freq or end freq are off by more
510 * than 2 GHz for the 2.4 and 5 GHz bands, and by more than 10 GHz for the
511 * 60 GHz band.
510 * This resolution can be lowered and should be considered as we add 512 * This resolution can be lowered and should be considered as we add
511 * regulatory rule support for other "bands". 513 * regulatory rule support for other "bands".
512 **/ 514 **/
@@ -514,9 +516,16 @@ static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range,
514 u32 freq_khz) 516 u32 freq_khz)
515{ 517{
516#define ONE_GHZ_IN_KHZ 1000000 518#define ONE_GHZ_IN_KHZ 1000000
517 if (abs(freq_khz - freq_range->start_freq_khz) <= (2 * ONE_GHZ_IN_KHZ)) 519 /*
520 * From 802.11ad: directional multi-gigabit (DMG):
521 * Pertaining to operation in a frequency band containing a channel
522 * with the Channel starting frequency above 45 GHz.
523 */
524 u32 limit = freq_khz > 45 * ONE_GHZ_IN_KHZ ?
525 10 * ONE_GHZ_IN_KHZ : 2 * ONE_GHZ_IN_KHZ;
526 if (abs(freq_khz - freq_range->start_freq_khz) <= limit)
518 return true; 527 return true;
519 if (abs(freq_khz - freq_range->end_freq_khz) <= (2 * ONE_GHZ_IN_KHZ)) 528 if (abs(freq_khz - freq_range->end_freq_khz) <= limit)
520 return true; 529 return true;
521 return false; 530 return false;
522#undef ONE_GHZ_IN_KHZ 531#undef ONE_GHZ_IN_KHZ