ath: add dynamic user regulatory setting support
cover ath: add dynamic user regulatory setting support
From: "Luis R. Rodriguez" <[email protected]>
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(-)
Signature · 1 line
1.7.10.4
PATCH 1/4 cfg80211: export reg_initiator_name()
From: "Luis R. Rodriguez" <[email protected]>
Drivers can now use this to parse the regulatory request and be more verbose when needed.
--- include/net/cfg80211.h | 9 +++++++++ net/wireless/reg.c | 27 +++++++++++++++++---------- 2 files changed, 26 insertions(+), 10 deletions(-)
include/net/cfg80211.h +9 -0
@@ -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
net/wireless/reg.c +17 -10
@@ -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; }
Signature · 1 line
1.7.10.4
Johannes Berg
maintainerRe: [PATCH 1/4] cfg80211: export reg_initiator_name()
Quoted 4 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
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
PATCH 2/4 ath: move common dynamic regulatory domain setting to a helper
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This moves the dynamic regulatory domain selection code into a helper.
--- drivers/net/wireless/ath/regd.c | 55 ++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/net/wireless/ath/regd.c +37 -18
@@ -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 ; } }
Signature · 1 line
1.7.10.4
PATCH 3/4 ath: split user and driver reguluatory hint parsing
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
On the regulatory notifier split up the parsing of the hints coming from drivers or user. We'll treat these separately.
--- drivers/net/wireless/ath/regd.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/regd.c +1 -0
@@ -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 :
Signature · 1 line
1.7.10.4
PATCH 4/4 ath: add support for proper dynamic regulatory hints
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
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.
--- drivers/net/wireless/ath/Kconfig | 17 ++++++++ drivers/net/wireless/ath/regd.c | 84 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+)
drivers/net/wireless/ath/Kconfig +17 -0
@@ -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"
drivers/net/wireless/ath/regd.c +84 -0
96 lines not on this page · raw message
Signature · 1 line
1.7.10.4