ath: a few enhancements for dynamic user selection
cover ath: a few enhancements for dynamic user selection
John, Johannes,
here's a few enhancements for the dynamic user selection stuff. I think this will depend on application on the no-ir flag patches so not sure what route to go.
Luis R. Rodriguez (3):
ath: move dynamic_country_user_possible() to the top
ath: dynamic user allow check helper to the top
ath: fix dynamic user regulatory domain support
drivers/net/wireless/ath/regd.c | 193 +++++++++++++++++++++------------------- 1 file changed, 103 insertions(+), 90 deletions(-)
Signature · 1 line
1.8.4.rc3
PATCH 1/3 ath: move dynamic_country_user_possible() to the top
This will be used later.
--- drivers/net/wireless/ath/regd.c | 144 ++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 72 deletions(-)
drivers/net/wireless/ath/regd.c +72 -72
@@ -113,6 +113,78 @@ static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = { } }; +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 inline bool is_wwr_sku (u16 regd) { return ((regd & COUNTRY_ERD_FLAG) != COUNTRY_ERD_FLAG) &&
@@ -394,78 +466,6 @@ 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)
Signature · 1 line
1.8.4.rc3
PATCH 2/3 ath: dynamic user allow check helper to the top
In reply to Luis R. RodriguezThis will be used later.
--- drivers/net/wireless/ath/regd.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/regd.c +11 -12
@@ -185,6 +185,15 @@ static bool dynamic_country_user_possible(struct ath_regulatory *reg)return true; } +static bool ath_reg_dyn_country_user_allow (struct ath_regulatory *reg) +{ +if (!config_enabled (CONFIG_ATH_REG_DYNAMIC_USER_REG_HINTS )) +return false; +if (!dynamic_country_user_possible (reg)) +return false; +return true; +} +static inline bool is_wwr_sku (u16 regd) { return ((regd & COUNTRY_ERD_FLAG) != COUNTRY_ERD_FLAG) &&
@@ -466,17 +475,6 @@ static void ath_reg_dyn_country(struct wiphy *wiphy, reg_initiator_name(request->initiator)); } -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)
@@ -509,7 +507,8 @@ 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); +if (ath_reg_dyn_country_user_allow (reg)) +ath_reg_dyn_country (wiphy, reg, request);break ;case NL80211_REGDOM_SET_BY_COUNTRY_IE :ath_reg_dyn_country (wiphy, reg, request);
Signature · 1 line
1.8.4.rc3
PATCH 3/3 ath: fix dynamic user regulatory domain support
In reply to Luis R. RodriguezAs it stands dynamic user regulatory domain support is only possible for a few programmed regulatory domains as a few countries do not allow for this.
The existing code however only would take advantage of the feature if a custom world regulatory domain is used though as that's when we clear beconing flags. We need to lift this restriction as otherwise this feature is pointless.
--- drivers/net/wireless/ath/regd.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/regd.c +20 -6
@@ -296,6 +296,7 @@ static void ath_force_no_ir_freq(struct wiphy *wiphy, u16 center_freq)static void __ath_reg_apply_beaconing_flags (struct wiphy *wiphy, +struct ath_regulatory *reg,enum nl80211_reg_initiator initiator,struct ieee80211_channel *ch) {
@@ -307,6 +308,9 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,case NL80211_REGDOM_SET_BY_COUNTRY_IE :ath_force_clear_no_ir_chan (wiphy, ch);break ; +case NL80211_REGDOM_SET_BY_USER : +if (ath_reg_dyn_country_user_allow (reg)) +ath_force_clear_no_ir_chan (wiphy, ch);default :if (ch->beacon_found) ch->flags &= ~IEEE80211_CHAN_NO_IR ;
@@ -322,6 +326,7 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,*/ static void ath_reg_apply_beaconing_flags (struct wiphy *wiphy, +struct ath_regulatory *reg,enum nl80211_reg_initiator initiator) {enum ieee80211_band band;
@@ -335,8 +340,8 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy, sband = wiphy->bands[band];for (i =0 ; i < sband->n_channels; i++) { ch = &sband->channels[i]; -__ath_reg_apply_beaconing_flags (wiphy, initiator, ch); - +__ath_reg_apply_beaconing_flags (wiphy, reg, + initiator, ch); } } }
@@ -357,7 +362,8 @@ ath_reg_apply_beaconing_flags(struct wiphy *wiphy,*/ static void ath_reg_apply_ir_flags (struct wiphy *wiphy, -enum nl80211_reg_initiator initiator) +struct ath_regulatory *reg, +enum nl80211_reg_initiator initiator) {struct ieee80211_supported_band *sband;
@@ -370,6 +376,11 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy,ath_force_clear_no_ir_freq (wiphy,2467 );ath_force_clear_no_ir_freq (wiphy,2472 );break ; +case NL80211_REGDOM_SET_BY_USER : +if (!ath_reg_dyn_country_user_allow (reg)) +break ; +ath_force_clear_no_ir_freq (wiphy,2467 ); +ath_force_clear_no_ir_freq (wiphy,2472 );default :ath_force_no_ir_freq (wiphy,2467 );ath_force_no_ir_freq (wiphy,2472 );
@@ -418,12 +429,15 @@ static void ath_reg_apply_world_flags(struct wiphy *wiphy,case 0x66 :case 0x67 :case 0x6C : -ath_reg_apply_beaconing_flags (wiphy, initiator); +ath_reg_apply_beaconing_flags (wiphy, reg, initiator);break ;case 0x68 : -ath_reg_apply_beaconing_flags (wiphy, initiator); -ath_reg_apply_ir_flags (wiphy, initiator); +ath_reg_apply_beaconing_flags (wiphy, reg, initiator); +ath_reg_apply_ir_flags (wiphy, reg, initiator);break ; +default : +if (ath_reg_dyn_country_user_allow (reg)) +ath_reg_apply_beaconing_flags (wiphy, reg, initiator); } }
Signature · 1 line
1.8.4.rc3
Re: [PATCH 3/3] ath: fix dynamic user regulatory domain support
Quoted 3 lines · Luis R. Rodriguez
As it stands dynamic user regulatory domain support is only possible for a few programmed regulatory domains as a few countries do not allow for this.
[]
drivers/net/wireless/ath/regd.c
Quoted 1 line
drivers/net/wireless/ath/regd.c +0
-0
][
Quoted 9 lines
drivers/net/wireless/ath/regd.c +1
-0@@ -296,6 +296,7 @@ static void ath_force_no_ir_freq(struct wiphy *wiphy, u16 center_freq)static void __ath_reg_apply_beaconing_flags (struct wiphy *wiphy, +struct ath_regulatory *reg,enum nl80211_reg_initiator initiator,struct ieee80211_channel *ch) {
drivers/net/wireless/ath/regd.c __ath_reg_apply_beaconing_flags(struct wiphy *wiphy, · line 313
Quoted 6 lines
drivers/net/wireless/ath/regd.c +3
-0@@ -307,6 +308,9 @@ __ath_reg_apply_beaconing_flags(struct wiphy *wiphy,case NL80211_REGDOM_SET_BY_COUNTRY_IE :ath_force_clear_no_ir_chan (wiphy, ch);break ; +case NL80211_REGDOM_SET_BY_USER : +if (ath_reg_dyn_country_user_allow (reg)) +ath_force_clear_no_ir_chan (wiphy, ch);
Nicer to add explicit /* fallthrough */
drivers/net/wireless/ath/regd.c ath_reg_apply_ir_flags(struct wiphy *wiphy, · line 383
Quoted 13 lines
drivers/net/wireless/ath/regd.c +5
-0default :if (ch->beacon_found) ch->flags &= ~IEEE80211_CHAN_NO_IR ;@@ -370,6 +376,11 @@ ath_reg_apply_ir_flags(struct wiphy *wiphy,ath_force_clear_no_ir_freq (wiphy,2467 );ath_force_clear_no_ir_freq (wiphy,2472 );break ; +case NL80211_REGDOM_SET_BY_USER : +if (!ath_reg_dyn_country_user_allow (reg)) +break ; +ath_force_clear_no_ir_freq (wiphy,2467 ); +ath_force_clear_no_ir_freq (wiphy,2472 );
Missing break?
Quoted 3 lines
drivers/net/wireless/ath/regd.c +0
-0default :ath_force_no_ir_freq (wiphy,2467 );ath_force_no_ir_freq (wiphy,2472 );
Re: [PATCH 3/3] ath: fix dynamic user regulatory domain support
Quoted 1 line · Joe Perches
Missing break?
Bug, that's what I get for working until midnight, I should know better to balance my work.... damn it. Thanks for the review.
Luis