aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/chan.c
diff options
context:
space:
mode:
authorSimon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>2013-02-08 12:16:20 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-02-15 03:41:04 -0500
commit164eb02d070af987890e1db1c12b8ae0394b19f7 (patch)
treec7c1f7a8d051f095cbf02a580ad70d7b4537b714 /net/mac80211/chan.c
parent04f39047af2a6df64b763ea5a271db24879d0391 (diff)
mac80211: add radar detection command/event
Add command to trigger radar detection in the driver/FW. Once radar detection is started it should continuously monitor for radars as long as the channel active. If radar is detected usermode notified with 'radar detected' event. Scanning and remain on channel functionality must be disabled while doing radar detection/scanning, and vice versa. Based on original patch by Victor Goldenshtein <victorg@ti.com> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/chan.c')
-rw-r--r--net/mac80211/chan.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 038f249966d6..2e6faeda22ad 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -193,6 +193,7 @@ static void ieee80211_unassign_vif_chanctx(struct ieee80211_sub_if_data *sdata,
193 if (ctx->refcount > 0) { 193 if (ctx->refcount > 0) {
194 ieee80211_recalc_chanctx_chantype(sdata->local, ctx); 194 ieee80211_recalc_chanctx_chantype(sdata->local, ctx);
195 ieee80211_recalc_smps_chanctx(local, ctx); 195 ieee80211_recalc_smps_chanctx(local, ctx);
196 ieee80211_recalc_radar_chanctx(local, ctx);
196 } 197 }
197} 198}
198 199
@@ -216,6 +217,37 @@ static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata)
216 ieee80211_free_chanctx(local, ctx); 217 ieee80211_free_chanctx(local, ctx);
217} 218}
218 219
220void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local,
221 struct ieee80211_chanctx *chanctx)
222{
223 struct ieee80211_sub_if_data *sdata;
224 bool radar_enabled = false;
225
226 lockdep_assert_held(&local->chanctx_mtx);
227
228 rcu_read_lock();
229 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
230 if (sdata->radar_required) {
231 radar_enabled = true;
232 break;
233 }
234 }
235 rcu_read_unlock();
236
237 if (radar_enabled == chanctx->conf.radar_enabled)
238 return;
239
240 chanctx->conf.radar_enabled = radar_enabled;
241 local->radar_detect_enabled = chanctx->conf.radar_enabled;
242
243 if (!local->use_chanctx) {
244 local->hw.conf.radar_enabled = chanctx->conf.radar_enabled;
245 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
246 }
247
248 drv_change_chanctx(local, chanctx, IEEE80211_CHANCTX_CHANGE_RADAR);
249}
250
219void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, 251void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
220 struct ieee80211_chanctx *chanctx) 252 struct ieee80211_chanctx *chanctx)
221{ 253{
@@ -331,6 +363,7 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
331 } 363 }
332 364
333 ieee80211_recalc_smps_chanctx(local, ctx); 365 ieee80211_recalc_smps_chanctx(local, ctx);
366 ieee80211_recalc_radar_chanctx(local, ctx);
334 out: 367 out:
335 mutex_unlock(&local->chanctx_mtx); 368 mutex_unlock(&local->chanctx_mtx);
336 return ret; 369 return ret;