public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/4] cfg80211: add reg_get_dfs_region()
@ 2013-11-25 19:56 Janusz Dziedzic
  2013-11-25 19:56 ` [PATCH v3 2/4] cfg80211: DFS check dfs_region before usage Janusz Dziedzic
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Janusz Dziedzic @ 2013-11-25 19:56 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

This can be used outside of the regulatory context for any checks
on the DFS region. The central cfg80211 dfs_region is always used
and if it does not match with the wiphy a debug print is issued.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 net/wireless/reg.c |   27 +++++++++++++++++++++++++++
 net/wireless/reg.h |    1 +
 2 files changed, 28 insertions(+)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index ec54e1a..7d20d84 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -135,6 +135,33 @@ static const char *reg_dfs_region_str(enum nl80211_dfs_regions dfs_region)
 	return "Unknown";
 }
 
+enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy)
+{
+	const struct ieee80211_regdomain *regd = NULL;
+	const struct ieee80211_regdomain *wiphy_regd = NULL;
+
+	regd = get_cfg80211_regdom();
+	if (!wiphy)
+		goto out;
+
+	wiphy_regd = get_wiphy_regdom(wiphy);
+	if (!wiphy_regd)
+		goto out;
+
+	if (wiphy_regd->dfs_region == regd->dfs_region)
+		goto out;
+
+	REG_DBG_PRINT("%s: device specific dfs_region "
+		      "(%s) disagrees with cfg80211's "
+		      "central dfs_region (%s)\n",
+		      dev_name(&wiphy->dev),
+		      reg_dfs_region_str(wiphy_regd->dfs_region),
+		      reg_dfs_region_str(regd->dfs_region));
+
+out:
+	return regd->dfs_region;
+}
+
 static void rcu_free_regdom(const struct ieee80211_regdomain *r)
 {
 	if (!r)
diff --git a/net/wireless/reg.h b/net/wireless/reg.h
index cc4c2c0..02bd8f4 100644
--- a/net/wireless/reg.h
+++ b/net/wireless/reg.h
@@ -21,6 +21,7 @@ extern const struct ieee80211_regdomain __rcu *cfg80211_regdomain;
 bool reg_is_valid_request(const char *alpha2);
 bool is_world_regdom(const char *alpha2);
 bool reg_supported_dfs_region(enum nl80211_dfs_regions dfs_region);
+enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy);
 
 int regulatory_hint_user(const char *alpha2,
 			 enum nl80211_user_reg_hint_type user_reg_hint_type);
-- 
1.7.9.5


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

end of thread, other threads:[~2013-12-03 12:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-25 19:56 [PATCH v3 1/4] cfg80211: add reg_get_dfs_region() Janusz Dziedzic
2013-11-25 19:56 ` [PATCH v3 2/4] cfg80211: DFS check dfs_region before usage Janusz Dziedzic
2013-11-25 19:56 ` [PATCH v3 3/4] cfg80211/mac80211: DFS pass CAC time as a parameter Janusz Dziedzic
2013-11-25 19:56 ` [PATCH v3 4/4] cfg80211: DFS use 10 minutes CAC when weather channels Janusz Dziedzic
2013-11-26 14:50   ` Simon Wunderlich
2013-11-26 20:19     ` Janusz Dziedzic
2013-11-26 20:39       ` Johannes Berg
2013-11-27  6:16         ` Janusz Dziedzic
2013-12-02 14:43           ` Johannes Berg
2013-12-03 12:54 ` [PATCH v3 1/4] cfg80211: add reg_get_dfs_region() Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox