linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mac80211: consider only relevant vifs for radar_required calculation
@ 2014-12-21 16:32 Eliad Peller
  2014-12-21 16:32 ` [PATCH 2/2] mac80211: allow some multi-channel combinations with DFS master Eliad Peller
  0 siblings, 1 reply; 4+ messages in thread
From: Eliad Peller @ 2014-12-21 16:32 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

no need to consider all the vifs, but only the ones
that have this context assigned.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 net/mac80211/chan.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 5d6dae9..7f83451 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -388,22 +388,31 @@ ieee80211_find_chanctx(struct ieee80211_local *local,
 	return NULL;
 }
 
-static bool ieee80211_is_radar_required(struct ieee80211_local *local)
+static bool ieee80211_is_radar_required(struct ieee80211_local *local,
+					struct ieee80211_chanctx *ctx)
 {
+	struct ieee80211_chanctx_conf *conf = &ctx->conf;
 	struct ieee80211_sub_if_data *sdata;
+	bool required = false;
 
+	lockdep_assert_held(&local->chanctx_mtx);
 	lockdep_assert_held(&local->mtx);
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
-		if (sdata->radar_required) {
-			rcu_read_unlock();
-			return true;
-		}
+		if (!ieee80211_sdata_running(sdata))
+			continue;
+		if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf)
+			continue;
+		if (!sdata->radar_required)
+			continue;
+
+		required = true;
+		break;
 	}
 	rcu_read_unlock();
 
-	return false;
+	return required;
 }
 
 static struct ieee80211_chanctx *
@@ -425,7 +434,7 @@ ieee80211_alloc_chanctx(struct ieee80211_local *local,
 	ctx->conf.rx_chains_static = 1;
 	ctx->conf.rx_chains_dynamic = 1;
 	ctx->mode = mode;
-	ctx->conf.radar_enabled = ieee80211_is_radar_required(local);
+	ctx->conf.radar_enabled = ieee80211_is_radar_required(local, ctx);
 	ieee80211_recalc_chanctx_min_def(local, ctx);
 
 	return ctx;
@@ -570,7 +579,7 @@ static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local,
 	/* for setting local->radar_detect_enabled */
 	lockdep_assert_held(&local->mtx);
 
-	radar_enabled = ieee80211_is_radar_required(local);
+	radar_enabled = ieee80211_is_radar_required(local, chanctx);
 
 	if (radar_enabled == chanctx->conf.radar_enabled)
 		return;
-- 
1.8.5.1.109.g3d252a9


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

* [PATCH 2/2] mac80211: allow some multi-channel combinations with DFS master
  2014-12-21 16:32 [PATCH 1/2] mac80211: consider only relevant vifs for radar_required calculation Eliad Peller
@ 2014-12-21 16:32 ` Eliad Peller
  2014-12-21 22:09   ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Eliad Peller @ 2014-12-21 16:32 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

Allow some multi-channel interface combinations along with
DFS master support, if there is only a single AP/GO.

Allowing other interface types at the same time is fine
(as long as the device supports them), and doesn't require
additional code.

Update ieee80211_dfs_radar_detected_work() to consider
this case, and look specifically for the chanctx with
radar_enabled.

Signed-off-by: Eliad Peller <eliad@wizery.com>
---
 net/mac80211/main.c | 11 -----------
 net/mac80211/util.c |  3 +++
 net/wireless/core.c | 23 +++++++++++++++++------
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index d9ce336..78d8c6d 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -792,17 +792,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 		 */
 		if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))
 			return -EINVAL;
-
-		/* DFS is not supported with multi-channel combinations yet */
-		for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
-			const struct ieee80211_iface_combination *comb;
-
-			comb = &local->hw.wiphy->iface_combinations[i];
-
-			if (comb->radar_detect_widths &&
-			    comb->num_different_channels > 1)
-				return -EINVAL;
-		}
 	}
 
 	/* Only HW csum features are currently compatible with mac80211 */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 974ebe7..61affe6 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2625,6 +2625,9 @@ void ieee80211_dfs_radar_detected_work(struct work_struct *work)
 		if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER)
 			continue;
 
+		if (!ctx->conf.radar_enabled)
+			continue;
+
 		num_chanctx++;
 		chandef = ctx->conf.def;
 	}
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 4910758..8bcadd9 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -453,7 +453,7 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
 	int i, j;
 
 	for (i = 0; i < wiphy->n_iface_combinations; i++) {
-		u32 cnt = 0;
+		u32 cnt = 0, dfs_cnt = 0;
 		u16 all_iftypes = 0;
 
 		c = &wiphy->iface_combinations[i];
@@ -477,11 +477,6 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
 				CFG80211_MAX_NUM_DIFFERENT_CHANNELS))
 			return -EINVAL;
 
-		/* DFS only works on one channel. */
-		if (WARN_ON(c->radar_detect_widths &&
-			    (c->num_different_channels > 1)))
-			return -EINVAL;
-
 		if (WARN_ON(!c->n_limits))
 			return -EINVAL;
 
@@ -505,6 +500,22 @@ static int wiphy_verify_combinations(struct wiphy *wiphy)
 				    c->limits[j].max > 1))
 				return -EINVAL;
 
+			if (types & (BIT(NL80211_IFTYPE_AP) |
+				     BIT(NL80211_IFTYPE_P2P_GO) |
+				     BIT(NL80211_IFTYPE_ADHOC) |
+				     BIT(NL80211_IFTYPE_MESH_POINT))) {
+				dfs_cnt += c->limits[j].max;
+
+				/*
+				 * Multiple DFS masters on multiple channels
+				 * are not supported yet.
+				 */
+				if (WARN_ON(c->radar_detect_widths &&
+					    c->num_different_channels > 1 &&
+					    dfs_cnt > 1))
+					return -EINVAL;
+			}
+
 			cnt += c->limits[j].max;
 			/*
 			 * Don't advertise an unsupported type
-- 
1.8.5.1.109.g3d252a9


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

* Re: [PATCH 2/2] mac80211: allow some multi-channel combinations with DFS master
  2014-12-21 16:32 ` [PATCH 2/2] mac80211: allow some multi-channel combinations with DFS master Eliad Peller
@ 2014-12-21 22:09   ` Johannes Berg
  2014-12-22 22:26     ` Eliad Peller
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2014-12-21 22:09 UTC (permalink / raw)
  To: Eliad Peller; +Cc: linux-wireless

On Sun, 2014-12-21 at 18:32 +0200, Eliad Peller wrote:
> Allow some multi-channel interface combinations along with
> DFS master support, if there is only a single AP/GO.
> 
> Allowing other interface types at the same time is fine

I don't believe this to be true - how are you going to do radar
detection accurately if you're spending any amount of time on another
channel?

johannes


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

* Re: [PATCH 2/2] mac80211: allow some multi-channel combinations with DFS master
  2014-12-21 22:09   ` Johannes Berg
@ 2014-12-22 22:26     ` Eliad Peller
  0 siblings, 0 replies; 4+ messages in thread
From: Eliad Peller @ 2014-12-22 22:26 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org

On Mon, Dec 22, 2014 at 12:09 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Sun, 2014-12-21 at 18:32 +0200, Eliad Peller wrote:
>> Allow some multi-channel interface combinations along with
>> DFS master support, if there is only a single AP/GO.
>>
>> Allowing other interface types at the same time is fine
>
> I don't believe this to be true - how are you going to do radar
> detection accurately if you're spending any amount of time on another
> channel?
>
right. seems i was wrong here.
please drop this patch.

thanks,
Eliad.

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

end of thread, other threads:[~2014-12-22 22:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-21 16:32 [PATCH 1/2] mac80211: consider only relevant vifs for radar_required calculation Eliad Peller
2014-12-21 16:32 ` [PATCH 2/2] mac80211: allow some multi-channel combinations with DFS master Eliad Peller
2014-12-21 22:09   ` Johannes Berg
2014-12-22 22:26     ` Eliad Peller

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