1 --- a/drivers/net/wireless/ath/regd.c
2 +++ b/drivers/net/wireless/ath/regd.c
4 #include "regd_common.h"
6 static int __ath_regd_init(struct ath_regulatory *reg);
7 +static struct reg_dmn_pair_mapping *ath_get_regpair(int regdmn);
10 * This is a set of common rules used by our world regulatory domains.
11 @@ -116,6 +117,9 @@ static const struct ieee80211_regdomain
13 static bool dynamic_country_user_possible(struct ath_regulatory *reg)
15 + if (IS_ENABLED(CONFIG_ATH_USER_REGD))
18 if (IS_ENABLED(CONFIG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
21 @@ -188,6 +192,8 @@ static bool dynamic_country_user_possibl
23 static bool ath_reg_dyn_country_user_allow(struct ath_regulatory *reg)
25 + if (IS_ENABLED(CONFIG_ATH_USER_REGD))
27 if (!IS_ENABLED(CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS))
29 if (!dynamic_country_user_possible(reg))
30 @@ -345,6 +351,9 @@ ath_reg_apply_beaconing_flags(struct wip
31 struct ieee80211_channel *ch;
34 + if (IS_ENABLED(CONFIG_ATH_USER_REGD))
37 for (band = 0; band < NUM_NL80211_BANDS; band++) {
38 if (!wiphy->bands[band])
40 @@ -379,6 +388,9 @@ ath_reg_apply_ir_flags(struct wiphy *wip
42 struct ieee80211_supported_band *sband;
44 + if (IS_ENABLED(CONFIG_ATH_USER_REGD))
47 sband = wiphy->bands[NL80211_BAND_2GHZ];
50 @@ -408,6 +420,9 @@ static void ath_reg_apply_radar_flags(st
51 struct ieee80211_channel *ch;
54 + if (IS_ENABLED(CONFIG_ATH_USER_REGD))
57 if (!wiphy->bands[NL80211_BAND_5GHZ])
60 @@ -640,6 +655,10 @@ ath_regd_init_wiphy(struct ath_regulator
61 const struct ieee80211_regdomain *regd;
63 wiphy->reg_notifier = reg_notifier;
65 + if (IS_ENABLED(CONFIG_ATH_USER_REGD))
68 wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
69 REGULATORY_CUSTOM_REG;
71 --- a/drivers/net/wireless/ath/Kconfig
72 +++ b/drivers/net/wireless/ath/Kconfig
73 @@ -24,6 +24,9 @@ config WLAN_VENDOR_ATH
78 + bool "Do not enforce EEPROM regulatory restrictions"
81 bool "Atheros wireless debugging"
83 --- a/drivers/net/wireless/ath/regd.c
84 +++ b/drivers/net/wireless/ath/regd.c
85 @@ -44,7 +44,8 @@ static struct reg_dmn_pair_mapping *ath_
88 /* We allow IBSS on these on a case by case basis by regulatory domain */
89 -#define ATH_5GHZ_5150_5350 REG_RULE(5150-10, 5350+10, 80, 0, 30,\
90 +#define ATH_5GHZ_5150_5350 REG_RULE(5150-10, 5240+10, 80, 0, 30, 0),\
91 + REG_RULE(5260-10, 5350+10, 80, 0, 30,\
93 #define ATH_5GHZ_5470_5850 REG_RULE(5470-10, 5850+10, 80, 0, 30,\
95 @@ -62,57 +63,56 @@ static struct reg_dmn_pair_mapping *ath_
96 #define ATH_5GHZ_NO_MIDBAND ATH_5GHZ_5150_5350, \
99 +#define REGD_RULES(...) \
100 + .reg_rules = { __VA_ARGS__ }, \
101 + .n_reg_rules = ARRAY_SIZE(((struct ieee80211_reg_rule[]) { __VA_ARGS__ }))
104 * 0x60, 0x61, 0x62 */
105 static const struct ieee80211_regdomain ath_world_regdom_60_61_62 = {
116 /* Can be used by 0x63 and 0x65 */
117 static const struct ieee80211_regdomain ath_world_regdom_63_65 = {
129 /* Can be used by 0x64 only */
130 static const struct ieee80211_regdomain ath_world_regdom_64 = {
141 /* Can be used by 0x66 and 0x69 */
142 static const struct ieee80211_regdomain ath_world_regdom_66_69 = {
153 /* Can be used by 0x67, 0x68, 0x6A and 0x6C */
154 static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = {
166 static bool dynamic_country_user_possible(struct ath_regulatory *reg)
167 --- a/net/wireless/reg.c
168 +++ b/net/wireless/reg.c
169 @@ -3370,6 +3370,8 @@ void regulatory_hint_country_ie(struct w
170 enum environment_cap env = ENVIRON_ANY;
171 struct regulatory_request *request = NULL, *lr;
175 /* IE len must be evenly divisible by 2 */
176 if (country_ie_len & 0x01)
178 @@ -3621,6 +3623,7 @@ static bool is_wiphy_all_set_reg_flag(en
180 void regulatory_hint_disconnect(void)
183 /* Restore of regulatory settings is not required when wiphy(s)
184 * ignore IE from connected access point but clearance of beacon hints
185 * is required when wiphy(s) supports beacon hints.
186 --- a/drivers/net/wireless/ath/regd_common.h
187 +++ b/drivers/net/wireless/ath/regd_common.h
188 @@ -32,6 +32,7 @@ enum EnumRd {
192 + FCC3_FCCA_2 = 0x2A,
196 @@ -173,6 +174,7 @@ static struct reg_dmn_pair_mapping regDo
197 {FCC2_WORLD, CTL_FCC, CTL_ETSI},
198 {FCC2_ETSIC, CTL_FCC, CTL_ETSI},
199 {FCC3_FCCA, CTL_FCC, CTL_FCC},
200 + {FCC3_FCCA_2, CTL_FCC, CTL_FCC},
201 {FCC3_WORLD, CTL_FCC, CTL_ETSI},
202 {FCC3_ETSIC, CTL_FCC, CTL_ETSI},
203 {FCC4_FCCA, CTL_FCC, CTL_FCC},
204 @@ -486,6 +488,7 @@ static struct country_code_to_enum_rd al
205 {CTRY_UAE, NULL1_WORLD, "AE"},
206 {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
207 {CTRY_UNITED_STATES, FCC3_FCCA, "US"},
208 + {CTRY_UNITED_STATES, FCC3_FCCA_2, "US"},
209 {CTRY_UNITED_STATES2, FCC3_FCCA, "US"},
210 {CTRY_UNITED_STATES3, FCC3_FCCA, "US"},
211 /* This "PS" is for US public safety actually... to support this we
212 --- a/drivers/net/wireless/ath/regd.c
213 +++ b/drivers/net/wireless/ath/regd.c
214 @@ -115,6 +115,16 @@ static const struct ieee80211_regdomain
218 +static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg)
220 + return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG;
223 +static bool is_default_regd(struct ath_regulatory *reg)
225 + return ath_regd_get_eepromRD(reg) == CTRY_DEFAULT;
228 static bool dynamic_country_user_possible(struct ath_regulatory *reg)
230 if (IS_ENABLED(CONFIG_ATH_USER_REGD))
231 @@ -123,6 +133,9 @@ static bool dynamic_country_user_possibl
232 if (IS_ENABLED(CONFIG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
235 + if (is_default_regd(reg))
238 switch (reg->country_code) {
239 case CTRY_UNITED_STATES:
241 @@ -208,11 +221,6 @@ static inline bool is_wwr_sku(u16 regd)
245 -static u16 ath_regd_get_eepromRD(struct ath_regulatory *reg)
247 - return reg->current_rd & ~WORLDWIDE_ROAMING_FLAG;
250 bool ath_is_world_regd(struct ath_regulatory *reg)
252 return is_wwr_sku(ath_regd_get_eepromRD(reg));
253 @@ -659,6 +667,9 @@ ath_regd_init_wiphy(struct ath_regulator
254 if (IS_ENABLED(CONFIG_ATH_USER_REGD))
257 + if (is_default_regd(reg))
260 wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
261 REGULATORY_CUSTOM_REG;
263 --- linux-6.3/drivers/net/wireless/ath/ath9k/init.c.orig 2023-04-23 21:02:52.000000000 +0200
264 +++ linux-6.3/drivers/net/wireless/ath/ath9k/init.c 2023-05-28 12:29:58.335041933 +0200
265 @@ -1108,7 +1108,7 @@
268 /* Handle world regulatory */
269 - if (!ath_is_world_regd(reg)) {
270 + if (!IS_ENABLED(CONFIG_ATH_USER_REGD) && !ath_is_world_regd(reg)) {
271 error = regulatory_hint(hw->wiphy, reg->alpha2);
274 --- linux-6.3/drivers/net/wireless/ath/ath10k/mac.c.orig 2023-04-23 21:02:52.000000000 +0200
275 +++ linux-6.3/drivers/net/wireless/ath/ath10k/mac.c 2023-05-28 12:29:12.823062813 +0200
276 @@ -10278,7 +10278,7 @@
277 ar->hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
280 - if (!ath_is_world_regd(&ar->ath_common.reg_world_copy) &&
281 + if (!IS_ENABLED(CONFIG_ATH_USER_REGD) && !ath_is_world_regd(&ar->ath_common.reg_world_copy) &&
282 !ath_is_world_regd(&ar->ath_common.regulatory)) {
283 ret = regulatory_hint(ar->hw->wiphy,
284 ar->ath_common.regulatory.alpha2);