* [PATCH 0/4] ath: add dynamic user regulatory setting support
@ 2013-09-19 16:18 Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 1/4] cfg80211: export reg_initiator_name() Luis R. Rodriguez
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-09-19 16:18 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
This adds dynamic user regulatory domain support for the shared ath
module.
Luis R. Rodriguez (4):
cfg80211: export reg_initiator_name()
ath: move common dynamic regulatory domain setting to a helper
ath: split user and driver reguluatory hint parsing
ath: add support for proper dynamic regulatory hints
drivers/net/wireless/ath/Kconfig | 17 +++++
drivers/net/wireless/ath/regd.c | 140 +++++++++++++++++++++++++++++++++-----
include/net/cfg80211.h | 9 +++
net/wireless/reg.c | 27 +++++---
4 files changed, 165 insertions(+), 28 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] cfg80211: export reg_initiator_name()
2013-09-19 16:18 [PATCH 0/4] ath: add dynamic user regulatory setting support Luis R. Rodriguez
@ 2013-09-19 16:18 ` Luis R. Rodriguez
2013-09-30 14:29 ` Johannes Berg
2013-09-19 16:18 ` [PATCH 2/4] ath: move common dynamic regulatory domain setting to a helper Luis R. Rodriguez
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-09-19 16:18 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Drivers can now use this to parse the regulatory request and
be more verbose when needed.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
include/net/cfg80211.h | 9 +++++++++
net/wireless/reg.c | 27 +++++++++++++++++----------
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d530c54..afb2323 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -3474,6 +3474,15 @@ extern void wiphy_apply_custom_regulatory(
const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
u32 center_freq);
+/**
+ * reg_initiator_name - map regulatory request initiator enum to name
+ * @initiator: the regulatory request initiator
+ *
+ * You can use this to map the regulatory request initiator enum to a
+ * proper string representation.
+ */
+const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
+
/*
* callbacks for asynchronous cfg80211 methods, notification
* functions and BSS handling helpers
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index de06d5d..5164716 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -758,23 +758,25 @@ const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
}
EXPORT_SYMBOL(freq_reg_info);
-#ifdef CONFIG_CFG80211_REG_DEBUG
-static const char *reg_initiator_name(enum nl80211_reg_initiator initiator)
+const char *reg_initiator_name(enum nl80211_reg_initiator initiator)
{
switch (initiator) {
case NL80211_REGDOM_SET_BY_CORE:
- return "Set by core";
+ return "core";
case NL80211_REGDOM_SET_BY_USER:
- return "Set by user";
+ return "user";
case NL80211_REGDOM_SET_BY_DRIVER:
- return "Set by driver";
+ return "driver";
case NL80211_REGDOM_SET_BY_COUNTRY_IE:
- return "Set by country IE";
+ return "country IE";
default:
WARN_ON(1);
- return "Set by bug";
+ return "bug";
}
}
+EXPORT_SYMBOL(reg_initiator_name);
+
+#ifdef CONFIG_CFG80211_REG_DEBUG
static void chan_reg_rule_print_dbg(struct ieee80211_channel *chan,
const struct ieee80211_reg_rule *reg_rule)
@@ -969,14 +971,17 @@ static bool ignore_reg_update(struct wiphy *wiphy,
struct regulatory_request *lr = get_last_request();
if (!lr) {
- REG_DBG_PRINT("Ignoring regulatory request %s since last_request is not set\n",
+ REG_DBG_PRINT("Ignoring regulatory request set by %s "
+ "since last_request is not set\n",
reg_initiator_name(initiator));
return true;
}
if (initiator == NL80211_REGDOM_SET_BY_CORE &&
wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) {
- REG_DBG_PRINT("Ignoring regulatory request %s since the driver uses its own custom regulatory domain\n",
+ REG_DBG_PRINT("Ignoring regulatory request set by %s "
+ "since the driver uses its own custom "
+ "regulatory domain\n",
reg_initiator_name(initiator));
return true;
}
@@ -988,7 +993,9 @@ static bool ignore_reg_update(struct wiphy *wiphy,
if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd &&
initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
!is_world_regdom(lr->alpha2)) {
- REG_DBG_PRINT("Ignoring regulatory request %s since the driver requires its own regulatory domain to be set first\n",
+ REG_DBG_PRINT("Ignoring regulatory request set by %s "
+ "since the driver requires its own regulatory "
+ "domain to be set first\n",
reg_initiator_name(initiator));
return true;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] ath: move common dynamic regulatory domain setting to a helper
2013-09-19 16:18 [PATCH 0/4] ath: add dynamic user regulatory setting support Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 1/4] cfg80211: export reg_initiator_name() Luis R. Rodriguez
@ 2013-09-19 16:18 ` Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 3/4] ath: split user and driver reguluatory hint parsing Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 4/4] ath: add support for proper dynamic regulatory hints Luis R. Rodriguez
3 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-09-19 16:18 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
This moves the dynamic regulatory domain selection code into
a helper.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
drivers/net/wireless/ath/regd.c | 55 ++++++++++++++++++++++++++-------------
1 file changed, 37 insertions(+), 18 deletions(-)
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 7d077c7..8373650 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -356,14 +356,48 @@ static u16 ath_regd_find_country_by_name(char *alpha2)
return -1;
}
+static int __ath_reg_dyn_country(struct wiphy *wiphy,
+ struct ath_regulatory *reg,
+ struct regulatory_request *request)
+{
+ u16 country_code;
+
+ if (!ath_is_world_regd(reg))
+ return -EINVAL;
+
+ country_code = ath_regd_find_country_by_name(request->alpha2);
+ if (country_code == (u16) -1)
+ return -EINVAL;
+
+ reg->current_rd = COUNTRY_ERD_FLAG;
+ reg->current_rd |= country_code;
+
+ __ath_regd_init(reg);
+
+ ath_reg_apply_world_flags(wiphy, request->initiator, reg);
+
+ return 0;
+}
+
+static void ath_reg_dyn_country(struct wiphy *wiphy,
+ struct ath_regulatory *reg,
+ struct regulatory_request *request)
+{
+ if (__ath_reg_dyn_country(wiphy, reg, request))
+ return;
+
+ printk(KERN_DEBUG "ath: regdomain 0x%0x "
+ "dynamically updated by %s\n",
+ reg->current_rd,
+ reg_initiator_name(request->initiator));
+}
+
void ath_reg_notifier_apply(struct wiphy *wiphy,
struct regulatory_request *request,
struct ath_regulatory *reg)
{
struct ath_common *common = container_of(reg, struct ath_common,
regulatory);
- u16 country_code;
-
/* We always apply this */
ath_reg_apply_radar_flags(wiphy);
@@ -391,22 +425,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy,
case NL80211_REGDOM_SET_BY_USER:
break;
case NL80211_REGDOM_SET_BY_COUNTRY_IE:
- if (!ath_is_world_regd(reg))
- break;
-
- country_code = ath_regd_find_country_by_name(request->alpha2);
- if (country_code == (u16) -1)
- break;
-
- reg->current_rd = COUNTRY_ERD_FLAG;
- reg->current_rd |= country_code;
-
- printk(KERN_DEBUG "ath: regdomain 0x%0x updated by CountryIE\n",
- reg->current_rd);
- __ath_regd_init(reg);
-
- ath_reg_apply_world_flags(wiphy, request->initiator, reg);
-
+ ath_reg_dyn_country(wiphy, reg, request);
break;
}
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] ath: split user and driver reguluatory hint parsing
2013-09-19 16:18 [PATCH 0/4] ath: add dynamic user regulatory setting support Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 1/4] cfg80211: export reg_initiator_name() Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 2/4] ath: move common dynamic regulatory domain setting to a helper Luis R. Rodriguez
@ 2013-09-19 16:18 ` Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 4/4] ath: add support for proper dynamic regulatory hints Luis R. Rodriguez
3 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-09-19 16:18 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
On the regulatory notifier split up the parsing of the
hints coming from drivers or user. We'll treat these
separately.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
drivers/net/wireless/ath/regd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 8373650..7222eeb 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -422,6 +422,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy,
sizeof(struct ath_regulatory));
break;
case NL80211_REGDOM_SET_BY_DRIVER:
+ break;
case NL80211_REGDOM_SET_BY_USER:
break;
case NL80211_REGDOM_SET_BY_COUNTRY_IE:
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] ath: add support for proper dynamic regulatory hints
2013-09-19 16:18 [PATCH 0/4] ath: add dynamic user regulatory setting support Luis R. Rodriguez
` (2 preceding siblings ...)
2013-09-19 16:18 ` [PATCH 3/4] ath: split user and driver reguluatory hint parsing Luis R. Rodriguez
@ 2013-09-19 16:18 ` Luis R. Rodriguez
3 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-09-19 16:18 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Luis R. Rodriguez
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
This enables support for dynamic user regulatory hints.
This is enabled only when CFG80211_CERTIFICATION_ONUS
is selected. For US and JP this is explicitly disabled
unless the systems are being used for strict controlled
testing.
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
drivers/net/wireless/ath/Kconfig | 17 ++++++++
drivers/net/wireless/ath/regd.c | 84 ++++++++++++++++++++++++++++++++++++++
2 files changed, 101 insertions(+)
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig
index 1abf1d4..6515e85 100644
--- a/drivers/net/wireless/ath/Kconfig
+++ b/drivers/net/wireless/ath/Kconfig
@@ -25,6 +25,23 @@ config ATH_DEBUG
Say Y, if you want to debug atheros wireless drivers.
Right now only ath9k makes use of this.
+config ATH_REG_DYNAMIC_USER_REG_HINTS
+ bool "Atheros dynamic user regulatory hints"
+ depends on CFG80211_CERTIFICATION_ONUS
+ default n
+ ---help---
+ Say N. This should only be enabled in countries where
+ this feature is explicitly allowed and only on cards that
+ specifically have been tested for this.
+
+config ATH_REG_DYNAMIC_USER_CERT_TESTING
+ bool "Atheros dynamic user regulatory testing"
+ depends on ATH_REG_DYNAMIC_USER_REG_HINTS && CFG80211_CERTIFICATION_ONUS
+ default n
+ ---help---
+ Say N. This should only be enabled on systems
+ undergoing certification testing.
+
source "drivers/net/wireless/ath/ath5k/Kconfig"
source "drivers/net/wireless/ath/ath9k/Kconfig"
source "drivers/net/wireless/ath/carl9170/Kconfig"
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 7222eeb..c00687e 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -392,6 +392,89 @@ static void ath_reg_dyn_country(struct wiphy *wiphy,
reg_initiator_name(request->initiator));
}
+static bool dynamic_country_user_possible(struct ath_regulatory *reg)
+{
+ if (config_enabled(CONFIG_ATH_REG_DYNAMIC_USER_CERT_TESTING))
+ return true;
+
+ switch (reg->country_code) {
+ case CTRY_UNITED_STATES:
+ case CTRY_JAPAN1:
+ case CTRY_JAPAN2:
+ case CTRY_JAPAN3:
+ case CTRY_JAPAN4:
+ case CTRY_JAPAN5:
+ case CTRY_JAPAN6:
+ case CTRY_JAPAN7:
+ case CTRY_JAPAN8:
+ case CTRY_JAPAN9:
+ case CTRY_JAPAN10:
+ case CTRY_JAPAN11:
+ case CTRY_JAPAN12:
+ case CTRY_JAPAN13:
+ case CTRY_JAPAN14:
+ case CTRY_JAPAN15:
+ case CTRY_JAPAN16:
+ case CTRY_JAPAN17:
+ case CTRY_JAPAN18:
+ case CTRY_JAPAN19:
+ case CTRY_JAPAN20:
+ case CTRY_JAPAN21:
+ case CTRY_JAPAN22:
+ case CTRY_JAPAN23:
+ case CTRY_JAPAN24:
+ case CTRY_JAPAN25:
+ case CTRY_JAPAN26:
+ case CTRY_JAPAN27:
+ case CTRY_JAPAN28:
+ case CTRY_JAPAN29:
+ case CTRY_JAPAN30:
+ case CTRY_JAPAN31:
+ case CTRY_JAPAN32:
+ case CTRY_JAPAN33:
+ case CTRY_JAPAN34:
+ case CTRY_JAPAN35:
+ case CTRY_JAPAN36:
+ case CTRY_JAPAN37:
+ case CTRY_JAPAN38:
+ case CTRY_JAPAN39:
+ case CTRY_JAPAN40:
+ case CTRY_JAPAN41:
+ case CTRY_JAPAN42:
+ case CTRY_JAPAN43:
+ case CTRY_JAPAN44:
+ case CTRY_JAPAN45:
+ case CTRY_JAPAN46:
+ case CTRY_JAPAN47:
+ case CTRY_JAPAN48:
+ case CTRY_JAPAN49:
+ case CTRY_JAPAN50:
+ case CTRY_JAPAN51:
+ case CTRY_JAPAN52:
+ case CTRY_JAPAN53:
+ case CTRY_JAPAN54:
+ case CTRY_JAPAN55:
+ case CTRY_JAPAN56:
+ case CTRY_JAPAN57:
+ case CTRY_JAPAN58:
+ case CTRY_JAPAN59:
+ return false;
+ }
+
+ return true;
+}
+
+static void ath_reg_dyn_country_user(struct wiphy *wiphy,
+ struct ath_regulatory *reg,
+ struct regulatory_request *request)
+{
+ if (!config_enabled(CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS))
+ return;
+ if (!dynamic_country_user_possible(reg))
+ return;
+ ath_reg_dyn_country(wiphy, reg, request);
+}
+
void ath_reg_notifier_apply(struct wiphy *wiphy,
struct regulatory_request *request,
struct ath_regulatory *reg)
@@ -424,6 +507,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy,
case NL80211_REGDOM_SET_BY_DRIVER:
break;
case NL80211_REGDOM_SET_BY_USER:
+ ath_reg_dyn_country_user(wiphy, reg, request);
break;
case NL80211_REGDOM_SET_BY_COUNTRY_IE:
ath_reg_dyn_country(wiphy, reg, request);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/4] cfg80211: export reg_initiator_name()
2013-09-19 16:18 ` [PATCH 1/4] cfg80211: export reg_initiator_name() Luis R. Rodriguez
@ 2013-09-30 14:29 ` Johannes Berg
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2013-09-30 14:29 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: linville, linux-wireless
On Thu, 2013-09-19 at 11:18 -0500, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
>
> Drivers can now use this to parse the regulatory request and
> be more verbose when needed.
Do drivers actually have to care about the initiator though?
johannes
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-09-30 14:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-19 16:18 [PATCH 0/4] ath: add dynamic user regulatory setting support Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 1/4] cfg80211: export reg_initiator_name() Luis R. Rodriguez
2013-09-30 14:29 ` Johannes Berg
2013-09-19 16:18 ` [PATCH 2/4] ath: move common dynamic regulatory domain setting to a helper Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 3/4] ath: split user and driver reguluatory hint parsing Luis R. Rodriguez
2013-09-19 16:18 ` [PATCH 4/4] ath: add support for proper dynamic regulatory hints 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).