aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2015-01-07 10:50:10 -0500
committerJohannes Berg <johannes.berg@intel.com>2015-01-14 03:37:06 -0500
commite7f2337ae70e0cdaac577c5a4823775097d0e9e7 (patch)
treed525b02d7e4b9c16ad2b5cf9ab3b38153cb255ef /net/mac80211
parent5cbc95a749c5f3b238af0953881edede9bfe5bf6 (diff)
mac80211: consider only relevant vifs for radar_required calculation
ctx->conf.radar_enabled should reflect whether radar detection is enabled for the channel context. When calculating it, make it consider only the vifs that have this context assigned (instead of all the vifs). Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/chan.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 92c721dbd5af..35b11e11e0c4 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -406,6 +406,34 @@ bool ieee80211_is_radar_required(struct ieee80211_local *local)
406 return false; 406 return false;
407} 407}
408 408
409static bool
410ieee80211_chanctx_radar_required(struct ieee80211_local *local,
411 struct ieee80211_chanctx *ctx)
412{
413 struct ieee80211_chanctx_conf *conf = &ctx->conf;
414 struct ieee80211_sub_if_data *sdata;
415 bool required = false;
416
417 lockdep_assert_held(&local->chanctx_mtx);
418 lockdep_assert_held(&local->mtx);
419
420 rcu_read_lock();
421 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
422 if (!ieee80211_sdata_running(sdata))
423 continue;
424 if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf)
425 continue;
426 if (!sdata->radar_required)
427 continue;
428
429 required = true;
430 break;
431 }
432 rcu_read_unlock();
433
434 return required;
435}
436
409static struct ieee80211_chanctx * 437static struct ieee80211_chanctx *
410ieee80211_alloc_chanctx(struct ieee80211_local *local, 438ieee80211_alloc_chanctx(struct ieee80211_local *local,
411 const struct cfg80211_chan_def *chandef, 439 const struct cfg80211_chan_def *chandef,
@@ -425,7 +453,7 @@ ieee80211_alloc_chanctx(struct ieee80211_local *local,
425 ctx->conf.rx_chains_static = 1; 453 ctx->conf.rx_chains_static = 1;
426 ctx->conf.rx_chains_dynamic = 1; 454 ctx->conf.rx_chains_dynamic = 1;
427 ctx->mode = mode; 455 ctx->mode = mode;
428 ctx->conf.radar_enabled = ieee80211_is_radar_required(local); 456 ctx->conf.radar_enabled = false;
429 ieee80211_recalc_chanctx_min_def(local, ctx); 457 ieee80211_recalc_chanctx_min_def(local, ctx);
430 458
431 return ctx; 459 return ctx;
@@ -570,7 +598,7 @@ static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local,
570 /* for ieee80211_is_radar_required */ 598 /* for ieee80211_is_radar_required */
571 lockdep_assert_held(&local->mtx); 599 lockdep_assert_held(&local->mtx);
572 600
573 radar_enabled = ieee80211_is_radar_required(local); 601 radar_enabled = ieee80211_chanctx_radar_required(local, chanctx);
574 602
575 if (radar_enabled == chanctx->conf.radar_enabled) 603 if (radar_enabled == chanctx->conf.radar_enabled)
576 return; 604 return;