aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 1ad04e54014..844823973da 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
@@ -2193,7 +2202,6 @@ static void print_regdomain_info(const struct ieee80211_regdomain *rd)
2193static int __set_regdom(const struct ieee80211_regdomain *rd) 2202static int __set_regdom(const struct ieee80211_regdomain *rd)
2194{ 2203{
2195 const struct ieee80211_regdomain *intersected_rd = NULL; 2204 const struct ieee80211_regdomain *intersected_rd = NULL;
2196 struct cfg80211_registered_device *rdev = NULL;
2197 struct wiphy *request_wiphy; 2205 struct wiphy *request_wiphy;
2198 /* Some basic sanity checks first */ 2206 /* Some basic sanity checks first */
2199 2207
@@ -2305,24 +2313,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
2305 return 0; 2313 return 0;
2306 } 2314 }
2307 2315
2308 if (!intersected_rd) 2316 return -EINVAL;
2309 return -EINVAL;
2310
2311 rdev = wiphy_to_dev(request_wiphy);
2312
2313 rdev->country_ie_alpha2[0] = rd->alpha2[0];
2314 rdev->country_ie_alpha2[1] = rd->alpha2[1];
2315 rdev->env = last_request->country_ie_env;
2316
2317 BUG_ON(intersected_rd == rd);
2318
2319 kfree(rd);
2320 rd = NULL;
2321
2322 reset_regdomains(false);
2323 cfg80211_regdomain = intersected_rd;
2324
2325 return 0;
2326} 2317}
2327 2318
2328 2319