ath9k: merge a regulatory handling fix
authorFelix Fietkau <nbd@openwrt.org>
Wed, 22 Oct 2014 13:32:06 +0000 (13:32 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 22 Oct 2014 13:32:06 +0000 (13:32 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 43028

package/kernel/mac80211/patches/337-ath-use-CTL-region-from-cfg80211-if-unset-in-EEPROM.patch [new file with mode: 0644]
package/kernel/mac80211/patches/400-ath_move_debug_code.patch
package/kernel/mac80211/patches/402-ath_regd_optional.patch
package/kernel/mac80211/patches/512-ath9k_channelbw_debugfs.patch

diff --git a/package/kernel/mac80211/patches/337-ath-use-CTL-region-from-cfg80211-if-unset-in-EEPROM.patch b/package/kernel/mac80211/patches/337-ath-use-CTL-region-from-cfg80211-if-unset-in-EEPROM.patch
new file mode 100644 (file)
index 0000000..f451912
--- /dev/null
@@ -0,0 +1,56 @@
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Wed, 22 Oct 2014 15:21:22 +0200
+Subject: [PATCH] ath: use CTL region from cfg80211 if unset in EEPROM
+
+Many AP devices do not have the proper regulatory domain programmed in
+EEPROM. Instead they expect the software to set the appropriate region.
+For these devices, the country code defaults to US, and the driver uses
+the US CTL tables as well.
+On devices bought in Europe this can lead to tx power being set too high
+on the band edges, even if the cfg80211 regdomain is set correctly.
+Fix this issue by taking into account the DFS region, but only when the
+EEPROM regdomain is set to default.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+---
+
+--- a/drivers/net/wireless/ath/ath.h
++++ b/drivers/net/wireless/ath/ath.h
+@@ -80,6 +80,7 @@ struct reg_dmn_pair_mapping {
+ struct ath_regulatory {
+       char alpha2[2];
++      enum nl80211_dfs_regions region;
+       u16 country_code;
+       u16 max_power_level;
+       u16 current_rd;
+--- a/drivers/net/wireless/ath/regd.c
++++ b/drivers/net/wireless/ath/regd.c
+@@ -515,6 +515,7 @@ void ath_reg_notifier_apply(struct wiphy
+       if (!request)
+               return;
++      reg->region = request->dfs_region;
+       switch (request->initiator) {
+       case NL80211_REGDOM_SET_BY_CORE:
+               /*
+@@ -779,6 +780,19 @@ u32 ath_regd_get_band_ctl(struct ath_reg
+               return SD_NO_CTL;
+       }
++      if (ath_regd_get_eepromRD(reg) == CTRY_DEFAULT) {
++              switch (reg->region) {
++              case NL80211_DFS_FCC:
++                      return CTL_FCC;
++              case NL80211_DFS_ETSI:
++                      return CTL_ETSI;
++              case NL80211_DFS_JP:
++                      return CTL_MKK;
++              default:
++                      break;
++              }
++      }
++
+       switch (band) {
+       case IEEE80211_BAND_2GHZ:
+               return reg->regpair->reg_2ghz_ctl;
index ccd4a3e5015ed6474dd3de40d8d2f2729b902890..229fc46128c94df576e339dd9b66c35924174e9e 100644 (file)
@@ -14,7 +14,7 @@
  ccflags-y += -D__CHECK_ENDIAN__
 --- a/drivers/net/wireless/ath/ath.h
 +++ b/drivers/net/wireless/ath/ath.h
-@@ -300,13 +300,6 @@ void _ath_dbg(struct ath_common *common,
+@@ -301,13 +301,6 @@ void _ath_dbg(struct ath_common *common,
  #endif /* CPTCFG_ATH_DEBUG */
  
  /** Returns string describing opmode, or NULL if unknown mode. */
index 42260fcf86ef9ef0329e73e8cc8cc71ae52d4254..786b39ce00360285c427908b049bcc4698f74db2 100644 (file)
@@ -33,7 +33,7 @@
        if (!wiphy->bands[IEEE80211_BAND_5GHZ])
                return;
  
-@@ -631,6 +643,10 @@ ath_regd_init_wiphy(struct ath_regulator
+@@ -632,6 +644,10 @@ ath_regd_init_wiphy(struct ath_regulator
  {
        const struct ieee80211_regdomain *regd;
  
index 24671ca12ed3c28554cb9498aa0f41243a796139..fae31022064cbc5988de5f4ca7735aa9daf4e18f 100644 (file)
@@ -64,7 +64,7 @@
        debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
 --- a/drivers/net/wireless/ath/ath.h
 +++ b/drivers/net/wireless/ath/ath.h
-@@ -141,6 +141,7 @@ struct ath_common {
+@@ -142,6 +142,7 @@ struct ath_common {
        int debug_mask;
        enum ath_device_state state;
        unsigned long op_flags;