Lines Matching refs:dpd
168 static void channel_detector_reset(struct dfs_pattern_detector *dpd, in channel_detector_reset() argument
174 for (i = 0; i < dpd->num_radar_types; i++) in channel_detector_reset()
175 cd->detectors[i]->reset(cd->detectors[i], dpd->last_pulse_ts); in channel_detector_reset()
179 static void channel_detector_exit(struct dfs_pattern_detector *dpd, in channel_detector_exit() argument
187 for (i = 0; i < dpd->num_radar_types; i++) { in channel_detector_exit()
197 channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq) in channel_detector_create() argument
202 cd = kzalloc(struct_size(cd, detectors, dpd->num_radar_types), GFP_ATOMIC); in channel_detector_create()
209 for (i = 0; i < dpd->num_radar_types; i++) { in channel_detector_create()
210 const struct radar_detector_specs *rs = &dpd->radar_spec[i]; in channel_detector_create()
216 list_add(&cd->head, &dpd->channel_detectors); in channel_detector_create()
220 ath_dbg(dpd->common, DFS, in channel_detector_create()
222 channel_detector_exit(dpd, cd); in channel_detector_create()
237 channel_detector_get(struct dfs_pattern_detector *dpd, u16 freq) in channel_detector_get() argument
240 list_for_each_entry(cd, &dpd->channel_detectors, head) { in channel_detector_get()
244 return channel_detector_create(dpd, freq); in channel_detector_get()
252 static void dpd_reset(struct dfs_pattern_detector *dpd) in dpd_reset() argument
255 list_for_each_entry(cd, &dpd->channel_detectors, head) in dpd_reset()
256 channel_detector_reset(dpd, cd); in dpd_reset()
259 static void dpd_exit(struct dfs_pattern_detector *dpd) in dpd_exit() argument
262 list_for_each_entry_safe(cd, cd0, &dpd->channel_detectors, head) in dpd_exit()
263 channel_detector_exit(dpd, cd); in dpd_exit()
264 kfree(dpd); in dpd_exit()
268 dpd_add_pulse(struct dfs_pattern_detector *dpd, struct pulse_event *event, in dpd_add_pulse() argument
278 if (dpd->region == NL80211_DFS_UNSET) in dpd_add_pulse()
281 cd = channel_detector_get(dpd, event->freq); in dpd_add_pulse()
286 if (event->ts < dpd->last_pulse_ts) in dpd_add_pulse()
287 dpd_reset(dpd); in dpd_add_pulse()
288 dpd->last_pulse_ts = event->ts; in dpd_add_pulse()
291 for (i = 0; i < dpd->num_radar_types; i++) { in dpd_add_pulse()
297 ath_dbg(dpd->common, DFS, in dpd_add_pulse()
302 pd->reset(pd, dpd->last_pulse_ts); in dpd_add_pulse()
310 dpd_get_stats(struct dfs_pattern_detector *dpd) in dpd_get_stats() argument
315 static bool dpd_set_domain(struct dfs_pattern_detector *dpd, in dpd_set_domain() argument
321 if (dpd->region == region) in dpd_set_domain()
324 dpd->region = NL80211_DFS_UNSET; in dpd_set_domain()
331 list_for_each_entry_safe(cd, cd0, &dpd->channel_detectors, head) in dpd_set_domain()
332 channel_detector_exit(dpd, cd); in dpd_set_domain()
333 dpd->radar_spec = rt->radar_types; in dpd_set_domain()
334 dpd->num_radar_types = rt->num_radar_types; in dpd_set_domain()
336 dpd->region = region; in dpd_set_domain()
352 struct dfs_pattern_detector *dpd; in dfs_pattern_detector_init() local
357 dpd = kmalloc(sizeof(*dpd), GFP_KERNEL); in dfs_pattern_detector_init()
358 if (dpd == NULL) in dfs_pattern_detector_init()
361 *dpd = default_dpd; in dfs_pattern_detector_init()
362 INIT_LIST_HEAD(&dpd->channel_detectors); in dfs_pattern_detector_init()
364 dpd->common = common; in dfs_pattern_detector_init()
365 if (dpd->set_dfs_domain(dpd, region)) in dfs_pattern_detector_init()
366 return dpd; in dfs_pattern_detector_init()
369 kfree(dpd); in dfs_pattern_detector_init()