* [PATCH 1/2] ath: fix warning on usage of REGULATORY_CUSTOM_REG
@ 2013-12-14 19:09 Luis R. Rodriguez
2013-12-14 19:09 ` [PATCH 2/2] cfg80211: make regulatory_hint() remove REGULATORY_CUSTOM_REG Luis R. Rodriguez
0 siblings, 1 reply; 4+ messages in thread
From: Luis R. Rodriguez @ 2013-12-14 19:09 UTC (permalink / raw)
To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez
ath wants to first apply the custom regd and only later
will it revert to not using it if an alpha2 regulatory
domain is found. Since the wireless core now enforces
usage of the REGULATORY_CUSTOM_REG strictly when
wiphy_apply_custom_regulatory() is used this makes
ath adhere to the expected behaviour but also updates
the wiphy after its done with the custom usage.
This fixes this warning:
[ 5.488733] ath: phy0: ASPM enabled: 0x43
[ 5.488735] ath: EEPROM regdomain: 0x0
[ 5.488736] ath: EEPROM indicates default country code should be used
[ 5.488736] ath: doing EEPROM country->regdmn map search
[ 5.488737] ath: country maps to regdmn code: 0x3a
[ 5.488737] ath: Country alpha2 being used: US
[ 5.488738] ath: Regpair used: 0x3a
[ 5.488738] ------------[ cut here ]------------
[ 5.488745] WARNING: CPU: 0 PID: 161 at
/home/sujith/dev/wireless-testing/net/wireless/reg.c:1361
wiphy_apply_custom_regulatory+0x17a/0x1b0 [cfg80211]()
[ 5.488746] wiphy should have REGULATORY_CUSTOM_REG
The wireless core can *later* lift this flag for us for when
using the regulatory_hint() to make this fix more generic.
Reported-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
drivers/net/wireless/ath/regd.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 9e15473..56c3d05 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -632,7 +632,8 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
const struct ieee80211_regdomain *regd;
wiphy->reg_notifier = reg_notifier;
- wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
+ wiphy->regulatory_flags |= REGULATORY_STRICT_REG |
+ REGULATORY_CUSTOM_REG;
if (ath_is_world_regd(reg)) {
/*
@@ -640,8 +641,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
* saved on the wiphy orig_* parameters
*/
regd = ath_world_regdomain(reg);
- wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
- REGULATORY_COUNTRY_IE_FOLLOW_POWER;
+ wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_FOLLOW_POWER;
} else {
/*
* This gets applied in the case of the absence of CRDA,
@@ -650,7 +650,10 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
*/
regd = ath_default_world_regdomain();
}
+
wiphy_apply_custom_regulatory(wiphy, regd);
+ if (!ath_is_world_regd(reg))
+ wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG;
ath_reg_apply_radar_flags(wiphy);
ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg);
return 0;
--
1.8.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] cfg80211: make regulatory_hint() remove REGULATORY_CUSTOM_REG
2013-12-14 19:09 [PATCH 1/2] ath: fix warning on usage of REGULATORY_CUSTOM_REG Luis R. Rodriguez
@ 2013-12-14 19:09 ` Luis R. Rodriguez
2013-12-16 14:55 ` Johannes Berg
0 siblings, 1 reply; 4+ messages in thread
From: Luis R. Rodriguez @ 2013-12-14 19:09 UTC (permalink / raw)
To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez, Sujith Manoharan
The REGULATORY_CUSTOM_REG can be used during early init with
the goal of overriding the wiphy's default regulatory settings
in case the alpha2 of the device is not known. In the case that
the alpha2 becomes known lets avoid having drivers having to
clear the REGULATORY_CUSTOM_REG flag by doing it for them
when regulatory_hint() is used.
Cc: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
drivers/net/wireless/ath/regd.c | 2 --
include/net/regulatory.h | 4 ++++
net/wireless/reg.c | 2 ++
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 56c3d05..e5e9059 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -652,8 +652,6 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
}
wiphy_apply_custom_regulatory(wiphy, regd);
- if (!ath_is_world_regd(reg))
- wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG;
ath_reg_apply_radar_flags(wiphy);
ath_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg);
return 0;
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index c96a0b8..b07cdc9 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -96,6 +96,10 @@ struct regulatory_request {
* initiator is %REGDOM_SET_BY_CORE). Drivers that use
* wiphy_apply_custom_regulatory() should have this flag set
* or the regulatory core will set it for the wiphy.
+ * If you use regulatory_hint() *after* using
+ * wiphy_apply_custom_regulatory() the wireless core will
+ * clear the REGULATORY_CUSTOM_REG for your wiphy as it would be
+ * implied that the device somehow gained knowledge of its region.
* @REGULATORY_STRICT_REG: tells us that the wiphy for this device
* has regulatory domain that it wishes to be considered as the
* superset for regulatory rules. After this device gets its regulatory
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index ec54e1a..070ff28 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1826,6 +1826,8 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2)
if (WARN_ON(!alpha2 || !wiphy))
return -EINVAL;
+ wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG;
+
request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
if (!request)
return -ENOMEM;
--
1.8.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] cfg80211: make regulatory_hint() remove REGULATORY_CUSTOM_REG
2013-12-14 19:09 ` [PATCH 2/2] cfg80211: make regulatory_hint() remove REGULATORY_CUSTOM_REG Luis R. Rodriguez
@ 2013-12-16 14:55 ` Johannes Berg
2013-12-16 18:00 ` Luis R. Rodriguez
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2013-12-16 14:55 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: linville, linux-wireless, Sujith Manoharan
On Sat, 2013-12-14 at 20:09 +0100, Luis R. Rodriguez wrote:
> The REGULATORY_CUSTOM_REG can be used during early init with
> the goal of overriding the wiphy's default regulatory settings
> in case the alpha2 of the device is not known. In the case that
> the alpha2 becomes known lets avoid having drivers having to
> clear the REGULATORY_CUSTOM_REG flag by doing it for them
> when regulatory_hint() is used.
This change brcmsmac behaviour afaict - are you sure that's correct?
johannes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] cfg80211: make regulatory_hint() remove REGULATORY_CUSTOM_REG
2013-12-16 14:55 ` Johannes Berg
@ 2013-12-16 18:00 ` Luis R. Rodriguez
0 siblings, 0 replies; 4+ messages in thread
From: Luis R. Rodriguez @ 2013-12-16 18:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: John W. Linville, linux-wireless, Sujith Manoharan
On Mon, Dec 16, 2013 at 3:55 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Sat, 2013-12-14 at 20:09 +0100, Luis R. Rodriguez wrote:
>> The REGULATORY_CUSTOM_REG can be used during early init with
>> the goal of overriding the wiphy's default regulatory settings
>> in case the alpha2 of the device is not known. In the case that
>> the alpha2 becomes known lets avoid having drivers having to
>> clear the REGULATORY_CUSTOM_REG flag by doing it for them
>> when regulatory_hint() is used.
>
> This change brcmsmac behaviour afaict - are you sure that's correct?
It should be, their implementation was just modeled over the ath module.
Luis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-16 18:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-14 19:09 [PATCH 1/2] ath: fix warning on usage of REGULATORY_CUSTOM_REG Luis R. Rodriguez
2013-12-14 19:09 ` [PATCH 2/2] cfg80211: make regulatory_hint() remove REGULATORY_CUSTOM_REG Luis R. Rodriguez
2013-12-16 14:55 ` Johannes Berg
2013-12-16 18:00 ` Luis R. Rodriguez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).