linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ath: a few enhancements for dynamic user selection
@ 2013-10-29 22:39 Luis R. Rodriguez
  2013-10-29 22:39 ` [PATCH 1/3] ath: move dynamic_country_user_possible() to the top Luis R. Rodriguez
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-10-29 22:39 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

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(-)

-- 
1.8.4.rc3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] ath: move dynamic_country_user_possible() to the top
  2013-10-29 22:39 [PATCH 0/3] ath: a few enhancements for dynamic user selection Luis R. Rodriguez
@ 2013-10-29 22:39 ` Luis R. Rodriguez
  2013-10-29 22:39 ` [PATCH 2/3] ath: dynamic user allow check helper " Luis R. Rodriguez
  2013-10-29 22:39 ` [PATCH 3/3] ath: fix dynamic user regulatory domain support Luis R. Rodriguez
  2 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-10-29 22:39 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

This will be used later.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/wireless/ath/regd.c | 144 ++++++++++++++++++++--------------------
 1 file changed, 72 insertions(+), 72 deletions(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index bc9ba78..e27027c 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -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)
-- 
1.8.4.rc3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] ath: dynamic user allow check helper to the top
  2013-10-29 22:39 [PATCH 0/3] ath: a few enhancements for dynamic user selection Luis R. Rodriguez
  2013-10-29 22:39 ` [PATCH 1/3] ath: move dynamic_country_user_possible() to the top Luis R. Rodriguez
@ 2013-10-29 22:39 ` Luis R. Rodriguez
  2013-10-29 22:39 ` [PATCH 3/3] ath: fix dynamic user regulatory domain support Luis R. Rodriguez
  2 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-10-29 22:39 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, Luis R. Rodriguez

This will be used later.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/wireless/ath/regd.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index e27027c..5790aa2 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -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);
-- 
1.8.4.rc3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] ath: fix dynamic user regulatory domain support
  2013-10-29 22:39 [PATCH 0/3] ath: a few enhancements for dynamic user selection Luis R. Rodriguez
  2013-10-29 22:39 ` [PATCH 1/3] ath: move dynamic_country_user_possible() to the top Luis R. Rodriguez
  2013-10-29 22:39 ` [PATCH 2/3] ath: dynamic user allow check helper " Luis R. Rodriguez
@ 2013-10-29 22:39 ` Luis R. Rodriguez
  2013-10-29 22:51   ` Joe Perches
  2 siblings, 1 reply; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-10-29 22:39 UTC (permalink / raw)
  To: linville, johannes; +Cc: linux-wireless, 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.

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.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 drivers/net/wireless/ath/regd.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index 5790aa2..b2c5e41 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -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);
 	}
 }
 
-- 
1.8.4.rc3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] ath: fix dynamic user regulatory domain support
  2013-10-29 22:39 ` [PATCH 3/3] ath: fix dynamic user regulatory domain support Luis R. Rodriguez
@ 2013-10-29 22:51   ` Joe Perches
  2013-10-29 23:10     ` Luis R. Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2013-10-29 22:51 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, johannes, linux-wireless

On Tue, 2013-10-29 at 23:39 +0100, Luis R. Rodriguez wrote:
> 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.
[]
> diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
][
> @@ -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);

Nicer to add explicit /* fallthrough */

>  	default:
>  		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?

>  	default:
>  		ath_force_no_ir_freq(wiphy, 2467);
>  		ath_force_no_ir_freq(wiphy, 2472);



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] ath: fix dynamic user regulatory domain support
  2013-10-29 22:51   ` Joe Perches
@ 2013-10-29 23:10     ` Luis R. Rodriguez
  0 siblings, 0 replies; 6+ messages in thread
From: Luis R. Rodriguez @ 2013-10-29 23:10 UTC (permalink / raw)
  To: Joe Perches; +Cc: John W. Linville, Johannes Berg, linux-wireless

On Tue, Oct 29, 2013 at 11:51 PM, Joe Perches <joe@perches.com> wrote:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-10-29 23:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-29 22:39 [PATCH 0/3] ath: a few enhancements for dynamic user selection Luis R. Rodriguez
2013-10-29 22:39 ` [PATCH 1/3] ath: move dynamic_country_user_possible() to the top Luis R. Rodriguez
2013-10-29 22:39 ` [PATCH 2/3] ath: dynamic user allow check helper " Luis R. Rodriguez
2013-10-29 22:39 ` [PATCH 3/3] ath: fix dynamic user regulatory domain support Luis R. Rodriguez
2013-10-29 22:51   ` Joe Perches
2013-10-29 23:10     ` 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).