diff options
author | Michal Kazior <michal.kazior@tieto.com> | 2014-06-25 06:35:07 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-06-25 12:06:20 -0400 |
commit | 71e6195ed2541d764fb0d7ef39cdb2236817116b (patch) | |
tree | 6b05bec5528281f5cd790905f3e5a21927184218 | |
parent | 5bcae31d9cb1ebfad3ad5a3eea04c8cdc329a04f (diff) |
mac80211: make check_combinations() aware of chanctx reservation
The ieee80211_check_combinations() computes
radar_detect accordingly depending on chanctx
reservation status.
This makes it possible to use the function for
channel_switch validation.
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | net/mac80211/util.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 1b42aa16ec03..ea79668c2e5f 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -2933,6 +2933,35 @@ void ieee80211_recalc_dtim(struct ieee80211_local *local, | |||
2933 | ps->dtim_count = dtim_count; | 2933 | ps->dtim_count = dtim_count; |
2934 | } | 2934 | } |
2935 | 2935 | ||
2936 | static u8 ieee80211_chanctx_radar_detect(struct ieee80211_local *local, | ||
2937 | struct ieee80211_chanctx *ctx) | ||
2938 | { | ||
2939 | struct ieee80211_sub_if_data *sdata; | ||
2940 | u8 radar_detect = 0; | ||
2941 | |||
2942 | lockdep_assert_held(&local->chanctx_mtx); | ||
2943 | |||
2944 | if (WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)) | ||
2945 | return 0; | ||
2946 | |||
2947 | list_for_each_entry(sdata, &ctx->reserved_vifs, reserved_chanctx_list) | ||
2948 | if (sdata->reserved_radar_required) | ||
2949 | radar_detect |= BIT(sdata->reserved_chandef.width); | ||
2950 | |||
2951 | /* | ||
2952 | * An in-place reservation context should not have any assigned vifs | ||
2953 | * until it replaces the other context. | ||
2954 | */ | ||
2955 | WARN_ON(ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER && | ||
2956 | !list_empty(&ctx->assigned_vifs)); | ||
2957 | |||
2958 | list_for_each_entry(sdata, &ctx->assigned_vifs, assigned_chanctx_list) | ||
2959 | if (sdata->radar_required) | ||
2960 | radar_detect |= BIT(sdata->vif.bss_conf.chandef.width); | ||
2961 | |||
2962 | return radar_detect; | ||
2963 | } | ||
2964 | |||
2936 | int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, | 2965 | int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, |
2937 | const struct cfg80211_chan_def *chandef, | 2966 | const struct cfg80211_chan_def *chandef, |
2938 | enum ieee80211_chanctx_mode chanmode, | 2967 | enum ieee80211_chanctx_mode chanmode, |
@@ -2976,8 +3005,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, | |||
2976 | list_for_each_entry(ctx, &local->chanctx_list, list) { | 3005 | list_for_each_entry(ctx, &local->chanctx_list, list) { |
2977 | if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) | 3006 | if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) |
2978 | continue; | 3007 | continue; |
2979 | if (ctx->conf.radar_enabled) | 3008 | radar_detect |= ieee80211_chanctx_radar_detect(local, ctx); |
2980 | radar_detect |= BIT(ctx->conf.def.width); | ||
2981 | if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { | 3009 | if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) { |
2982 | num_different_channels++; | 3010 | num_different_channels++; |
2983 | continue; | 3011 | continue; |
@@ -3039,8 +3067,7 @@ int ieee80211_max_num_channels(struct ieee80211_local *local) | |||
3039 | 3067 | ||
3040 | num_different_channels++; | 3068 | num_different_channels++; |
3041 | 3069 | ||
3042 | if (ctx->conf.radar_enabled) | 3070 | radar_detect |= ieee80211_chanctx_radar_detect(local, ctx); |
3043 | radar_detect |= BIT(ctx->conf.def.width); | ||
3044 | } | 3071 | } |
3045 | 3072 | ||
3046 | list_for_each_entry_rcu(sdata, &local->interfaces, list) | 3073 | list_for_each_entry_rcu(sdata, &local->interfaces, list) |