diff options
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r-- | net/wireless/reg.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 4de18ae18d34..3b8cbbc214db 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, | |||
510 | * | 510 | * |
511 | * This lets us know if a specific frequency rule is or is not relevant to | 511 | * This lets us know if a specific frequency rule is or is not relevant to |
512 | * a specific frequency's band. Bands are device specific and artificial | 512 | * a specific frequency's band. Bands are device specific and artificial |
513 | * definitions (the "2.4 GHz band" and the "5 GHz band"), however it is | 513 | * definitions (the "2.4 GHz band", the "5 GHz band" and the "60GHz band"), |
514 | * safe for now to assume that a frequency rule should not be part of a | 514 | * however it is safe for now to assume that a frequency rule should not be |
515 | * frequency's band if the start freq or end freq are off by more than 2 GHz. | 515 | * part of a frequency's band if the start freq or end freq are off by more |
516 | * than 2 GHz for the 2.4 and 5 GHz bands, and by more than 10 GHz for the | ||
517 | * 60 GHz band. | ||
516 | * This resolution can be lowered and should be considered as we add | 518 | * This resolution can be lowered and should be considered as we add |
517 | * regulatory rule support for other "bands". | 519 | * regulatory rule support for other "bands". |
518 | **/ | 520 | **/ |
@@ -520,9 +522,16 @@ static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range, | |||
520 | u32 freq_khz) | 522 | u32 freq_khz) |
521 | { | 523 | { |
522 | #define ONE_GHZ_IN_KHZ 1000000 | 524 | #define ONE_GHZ_IN_KHZ 1000000 |
523 | if (abs(freq_khz - freq_range->start_freq_khz) <= (2 * ONE_GHZ_IN_KHZ)) | 525 | /* |
526 | * From 802.11ad: directional multi-gigabit (DMG): | ||
527 | * Pertaining to operation in a frequency band containing a channel | ||
528 | * with the Channel starting frequency above 45 GHz. | ||
529 | */ | ||
530 | u32 limit = freq_khz > 45 * ONE_GHZ_IN_KHZ ? | ||
531 | 10 * ONE_GHZ_IN_KHZ : 2 * ONE_GHZ_IN_KHZ; | ||
532 | if (abs(freq_khz - freq_range->start_freq_khz) <= limit) | ||
524 | return true; | 533 | return true; |
525 | if (abs(freq_khz - freq_range->end_freq_khz) <= (2 * ONE_GHZ_IN_KHZ)) | 534 | if (abs(freq_khz - freq_range->end_freq_khz) <= limit) |
526 | return true; | 535 | return true; |
527 | return false; | 536 | return false; |
528 | #undef ONE_GHZ_IN_KHZ | 537 | #undef ONE_GHZ_IN_KHZ |
@@ -2199,7 +2208,6 @@ static void print_regdomain_info(const struct ieee80211_regdomain *rd) | |||
2199 | static int __set_regdom(const struct ieee80211_regdomain *rd) | 2208 | static int __set_regdom(const struct ieee80211_regdomain *rd) |
2200 | { | 2209 | { |
2201 | const struct ieee80211_regdomain *intersected_rd = NULL; | 2210 | const struct ieee80211_regdomain *intersected_rd = NULL; |
2202 | struct cfg80211_registered_device *rdev = NULL; | ||
2203 | struct wiphy *request_wiphy; | 2211 | struct wiphy *request_wiphy; |
2204 | /* Some basic sanity checks first */ | 2212 | /* Some basic sanity checks first */ |
2205 | 2213 | ||
@@ -2311,24 +2319,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
2311 | return 0; | 2319 | return 0; |
2312 | } | 2320 | } |
2313 | 2321 | ||
2314 | if (!intersected_rd) | 2322 | return -EINVAL; |
2315 | return -EINVAL; | ||
2316 | |||
2317 | rdev = wiphy_to_dev(request_wiphy); | ||
2318 | |||
2319 | rdev->country_ie_alpha2[0] = rd->alpha2[0]; | ||
2320 | rdev->country_ie_alpha2[1] = rd->alpha2[1]; | ||
2321 | rdev->env = last_request->country_ie_env; | ||
2322 | |||
2323 | BUG_ON(intersected_rd == rd); | ||
2324 | |||
2325 | kfree(rd); | ||
2326 | rd = NULL; | ||
2327 | |||
2328 | reset_regdomains(false); | ||
2329 | cfg80211_regdomain = intersected_rd; | ||
2330 | |||
2331 | return 0; | ||
2332 | } | 2323 | } |
2333 | 2324 | ||
2334 | 2325 | ||