0087-mac80211-Allow-switching-of-the-ath-regulatory-domain.patch 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  2. Date: Fri, 6 Jan 2017 13:29:56 +0100
  3. Subject: mac80211: Allow switching of the ath regulatory domain
  4. ath10k has to switch the regulatory domain when switching the default
  5. country when ATH_USER_REGD is enabled. This is for example important when
  6. switching from country US (FCC) to DE (ETSI). The ath implementation will
  7. use ath_reg_dyn_country_user_allow to check if this is allowed.
  8. Unfortunately, this function always seems to return false to
  9. ath_reg_notifier_apply even when ATH_USER_REGD is enabled. But it must
  10. actually always accept the requests from the user (when ATH_USER_REGD is
  11. enabled) to correctly set the conformance test limits in the ath10k binary
  12. blob.
  13. Not doing it will sometimes allow too high transmit powers on edge channels
  14. for correctly calibrated devices outside their default regulatory domain.
  15. Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
  16. Forwarded: https://github.com/openwrt/openwrt/pull/306
  17. diff --git a/package/kernel/mac80211/patches/402-ath_regd_optional.patch b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  18. index 463428371b4c96ee63b6eba1477023ff739c6129..a3572a297718f883f6126fc33aff5e14a046b9a0 100644
  19. --- a/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  20. +++ b/package/kernel/mac80211/patches/402-ath_regd_optional.patch
  21. @@ -1,6 +1,15 @@
  22. --- a/drivers/net/wireless/ath/regd.c
  23. +++ b/drivers/net/wireless/ath/regd.c
  24. -@@ -341,6 +341,10 @@ ath_reg_apply_beaconing_flags(struct wip
  25. +@@ -188,6 +188,8 @@ static bool dynamic_country_user_possibl
  26. +
  27. + static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg)
  28. + {
  29. ++ if (config_enabled(CPTCFG_ATH_USER_REGD))
  30. ++ return true;
  31. + if (!config_enabled(CPTCFG_ATH_REG_DYNAMIC_USER_REG_HINTS))
  32. + return false;
  33. + if (!dynamic_country_user_possible(reg))
  34. +@@ -341,6 +343,10 @@ ath_reg_apply_beaconing_flags(struct wip
  35. struct ieee80211_channel *ch;
  36. unsigned int i;
  37. @@ -11,7 +20,7 @@
  38. for (band = 0; band < NUM_NL80211_BANDS; band++) {
  39. if (!wiphy->bands[band])
  40. continue;
  41. -@@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  42. +@@ -374,6 +380,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip
  43. {
  44. struct ieee80211_supported_band *sband;
  45. @@ -22,7 +31,7 @@
  46. sband = wiphy->bands[NL80211_BAND_2GHZ];
  47. if (!sband)
  48. return;
  49. -@@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st
  50. +@@ -402,6 +412,10 @@ static void ath_reg_apply_radar_flags(st
  51. struct ieee80211_channel *ch;
  52. unsigned int i;
  53. @@ -33,7 +42,7 @@
  54. if (!wiphy->bands[NL80211_BAND_5GHZ])
  55. return;
  56. -@@ -633,6 +645,11 @@ ath_regd_init_wiphy(struct ath_regulator
  57. +@@ -633,6 +647,11 @@ ath_regd_init_wiphy(struct ath_regulator
  58. const struct ieee80211_regdomain *regd;
  59. wiphy->reg_notifier = reg_notifier;